Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pugs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
code
pugs
Commits
fa32e37e
Commit
fa32e37e
authored
8 months ago
by
Philippe Hoch
Browse files
Options
Downloads
Patches
Plain Diff
Intro of any order induced limitation
parent
9f45a939
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/scheme/CellbyCellLimitation.hpp
+162
-0
162 additions, 0 deletions
src/scheme/CellbyCellLimitation.hpp
with
162 additions
and
0 deletions
src/scheme/CellbyCellLimitation.hpp
+
162
−
0
View file @
fa32e37e
...
...
@@ -37,6 +37,168 @@ class CellByCellLimitation
using
Rd
=
TinyVector
<
Dimension
>
;
public:
void
density_limiter
(
const
MeshType
&
mesh
,
const
DiscreteFunctionP0
<
const
double
>&
rho
,
DiscreteFunctionDPk
<
Dimension
,
double
>&
rho_L
)
const
{
const
auto
&
cell_to_face_matrix
=
mesh
.
connectivity
().
cellToFaceMatrix
();
const
auto
&
face_to_node_matrix
=
mesh
.
connectivity
().
faceToNodeMatrix
();
const
auto
&
xr
=
mesh
.
xr
();
const
auto
&
xl
=
mesh
.
xl
();
MeshData
<
MeshType
>&
mesh_data
=
MeshDataManager
::
instance
().
getMeshData
(
mesh
);
auto
stencil
=
StencilManager
::
instance
().
getStencil
(
mesh
.
connectivity
(),
1
);
auto
xj
=
mesh_data
.
xj
();
const
QuadratureFormula
<
1
>
qf
=
QuadratureManager
::
instance
().
getLineFormula
(
GaussLegendreQuadratureDescriptor
(
m_quadrature_degree
));
parallel_for
(
mesh
.
numberOfCells
(),
PUGS_LAMBDA
(
const
CellId
cell_id
)
{
const
double
rhoj
=
rho
[
cell_id
];
double
rho_min
=
rhoj
;
double
rho_max
=
rhoj
;
const
auto
cell_stencil
=
stencil
[
cell_id
];
for
(
size_t
i_cell
=
0
;
i_cell
<
cell_stencil
.
size
();
++
i_cell
)
{
rho_min
=
std
::
min
(
rho_min
,
rho
[
cell_stencil
[
i_cell
]]);
rho_max
=
std
::
max
(
rho_max
,
rho
[
cell_stencil
[
i_cell
]]);
}
double
rho_bar_min
=
rhoj
;
double
rho_bar_max
=
rhoj
;
for
(
size_t
i_cell
=
0
;
i_cell
<
cell_stencil
.
size
();
++
i_cell
)
{
const
CellId
cell_k_id
=
cell_stencil
[
i_cell
];
const
double
rho_xk
=
rho_L
[
cell_id
](
xj
[
cell_k_id
]);
rho_bar_min
=
std
::
min
(
rho_bar_min
,
rho_xk
);
rho_bar_max
=
std
::
max
(
rho_bar_max
,
rho_xk
);
}
auto
face_list
=
cell_to_face_matrix
[
cell_id
];
for
(
size_t
i_face
=
0
;
i_face
<
face_list
.
size
();
++
i_face
)
{
const
FaceId
face_id
=
face_list
[
i_face
];
const
Rd
&
x0
=
xr
[
face_to_node_matrix
[
face_id
][
0
]];
const
Rd
&
x1
=
xl
[
face_id
][
0
];
const
Rd
&
x2
=
xr
[
face_to_node_matrix
[
face_id
][
1
]];
const
LineParabolicTransformation
<
Dimension
>
t
(
x0
,
x1
,
x2
);
for
(
size_t
iq
=
0
;
iq
<
qf
.
numberOfPoints
();
++
iq
)
{
const
double
rho_xk
=
rho_L
[
cell_id
](
t
(
qf
.
point
(
iq
)));
rho_bar_min
=
std
::
min
(
rho_bar_min
,
rho_xk
);
rho_bar_max
=
std
::
max
(
rho_bar_max
,
rho_xk
);
}
}
const
double
eps
=
1E-14
;
double
coef1
=
1
;
if
(
std
::
abs
(
rho_bar_max
-
rhoj
)
>
eps
)
{
coef1
=
(
rho_max
-
rhoj
)
/
((
rho_bar_max
-
rhoj
));
}
double
coef2
=
1.
;
if
(
std
::
abs
(
rho_bar_min
-
rhoj
)
>
eps
)
{
coef2
=
(
rho_min
-
rhoj
)
/
((
rho_bar_min
-
rhoj
));
}
const
double
lambda
=
std
::
max
(
0.
,
std
::
min
(
1.
,
std
::
min
(
coef1
,
coef2
)));
auto
coefficients
=
rho_L
.
coefficients
(
cell_id
);
coefficients
[
0
]
=
(
1
-
lambda
)
*
rho
[
cell_id
]
+
lambda
*
coefficients
[
0
];
for
(
size_t
i
=
1
;
i
<
coefficients
.
size
();
++
i
)
{
coefficients
[
i
]
*=
lambda
;
}
});
}
void
specific_internal_nrj_limiter
(
const
MeshType
&
mesh
,
const
DiscreteFunctionP0
<
const
double
>&
rho
,
const
DiscreteFunctionDPk
<
Dimension
,
double
>&
rho_L
DiscreteFunctionP0
<
const
double
>&
epsilon
,
DiscreteFunctionDPk
<
Dimension
,
double
>&
epsilon_R
)
const
{
const
auto
&
cell_to_face_matrix
=
mesh
.
connectivity
().
cellToFaceMatrix
();
const
auto
&
face_to_node_matrix
=
mesh
.
connectivity
().
faceToNodeMatrix
();
const
auto
&
xr
=
mesh
.
xr
();
const
auto
&
xl
=
mesh
.
xl
();
MeshData
<
MeshType
>&
mesh_data
=
MeshDataManager
::
instance
().
getMeshData
(
mesh
);
auto
stencil
=
StencilManager
::
instance
().
getStencil
(
mesh
.
connectivity
(),
1
);
auto
xj
=
mesh_data
.
xj
();
const
QuadratureFormula
<
1
>
qf
=
QuadratureManager
::
instance
().
getLineFormula
(
GaussLegendreQuadratureDescriptor
(
m_quadrature_degree
));
parallel_for
(
mesh
.
numberOfCells
(),
PUGS_LAMBDA
(
const
CellId
cell_id
)
{
const
double
epsilonj
=
epsilon
[
cell_id
];
double
epsilon_min
=
epsilonj
;
double
epsilon_max
=
epsilonj
;
const
auto
cell_stencil
=
stencil
[
cell_id
];
for
(
size_t
i_cell
=
0
;
i_cell
<
cell_stencil
.
size
();
++
i_cell
)
{
epsilon_min
=
std
::
min
(
epsilon_min
,
epsilon
[
cell_stencil
[
i_cell
]]);
epsilon_max
=
std
::
max
(
epsilon_max
,
epsilon
[
cell_stencil
[
i_cell
]]);
}
double
epsilon_R_min
=
epsilonj
;
double
epsilon_R_max
=
epsilonj
;
for
(
size_t
i_cell
=
0
;
i_cell
<
cell_stencil
.
size
();
++
i_cell
)
{
const
CellId
cell_k_id
=
cell_stencil
[
i_cell
];
const
double
epsilon_xk
=
epsilon_R
(
cell_id
,
xj
[
cell_k_id
]);
epsilon_R_min
=
std
::
min
(
epsilon_R_min
,
epsilon_xk
);
epsilon_R_max
=
std
::
max
(
epsilon_R_max
,
epsilon_xk
);
}
auto
face_list
=
cell_to_face_matrix
[
cell_id
];
for
(
size_t
i_face
=
0
;
i_face
<
face_list
.
size
();
++
i_face
)
{
const
FaceId
face_id
=
face_list
[
i_face
];
const
Rd
&
x0
=
xr
[
face_to_node_matrix
[
face_id
][
0
]];
const
Rd
&
x1
=
xl
[
face_id
][
0
];
const
Rd
&
x2
=
xr
[
face_to_node_matrix
[
face_id
][
1
]];
const
LineParabolicTransformation
<
Dimension
>
t
(
x0
,
x1
,
x2
);
for
(
size_t
iq
=
0
;
iq
<
qf
.
numberOfPoints
();
++
iq
)
{
const
double
epsilon_xk
=
epsilon_R
(
cell_id
,
t
(
qf
.
point
(
iq
)));
epsilon_R_min
=
std
::
min
(
epsilon_R_min
,
epsilon_xk
);
epsilon_R_max
=
std
::
max
(
epsilon_R_max
,
epsilon_xk
);
}
}
const
double
eps
=
1E-14
;
double
coef1
=
1
;
if
(
std
::
abs
(
epsilon_R_max
-
epsilonj
)
>
eps
)
{
coef1
=
(
epsilon_max
-
epsilonj
)
/
((
epsilon_R_max
-
epsilonj
));
}
double
coef2
=
1.
;
if
(
std
::
abs
(
epsilon_R_min
-
epsilonj
)
>
eps
)
{
coef2
=
(
epsilon_min
-
epsilonj
)
/
((
epsilon_R_min
-
epsilonj
));
}
lambda_epsilon
[
cell_id
]
=
std
::
max
(
0.
,
std
::
min
(
1.
,
std
::
min
(
coef1
,
coef2
)));
});
}
void
computeLimitorVolumicScalarQuantityMinModDukowiczGradient
(
const
MeshType
&
mesh
,
const
CellValue
<
double
>&
q
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment