Spatial Schemes¶
The modules defining spatial schemes are located in the folder _Solver/SpatialSchemes
.
Each module defining a spatial scheme should comport a class
Scheme
within which at least the methodsComputeFlux
,Iteration
,ReconstructSolutionAtVertices
are implemented.Each module should also comport a class
AssociatedMeshType
comporting the fieldsMeshType
,MeshOrder
andControlVolumes
that will be used to select the relevant mesh and compute properly the mass lumping.
Already implemented schemes
Continuous galerkin + Lax-Friedrichs¶
-
class
3_LESARD.SourceCode._Solver.SpatialSchemes.CG_LFX.
AssociatedMeshType
(SchemeParams=[1])¶ Class that only gives out the mesh type that should be loaded when tackling the problem with this scheme, given the wished variational order. Access the associated mesh properties through the inner variables
MeshType (string) – the mesh type according to fenics’s classification
MeshOrder (integer) – the mesh order
Note
This is only a product-type class: no method is available
- Parameters
SchemeParams (string list, optional) – the parameters of the spatial scheme wished by the user
-
class
3_LESARD.SourceCode._Solver.SpatialSchemes.CG_LFX.
Scheme
(Problem, Mesh, QuadratureRules, *SchemeParams)¶ Class furnishing all the schemes tools and registers the scheme’s wished parameters. The main iteration is accessible with the method “Iteration”.
Repeats the instance’s initialisation arguments as fields with identical names within the structure. Has for additional field upon instance creation the fields:
Order (integer) – The order of the used basis functions
InnerQBFValues (float numpy array) – Value of the basis function at the quadrature points of each element (NbInnerElementsx NbQuadraturePoints x NbBasisFunc)
InnerQWeigths (float numpy array) – Weights of the quadrature points of each element (NbInnerElements x NbQuadraturePoints)
InnerQGFValues (float numpy array) – Value of the gradient of the basis function at the quadrature points of each element (NbInnerElements x NbQuadraturePoints x NbBasisFunc x dim)
InnerQPoints (float numpy array) – Quadrature points of each element (NbInnerElements x NbQuadraturePoints)
FaceWiseQWeigths (float numpy array) – Weights of the quadrature points of each element’s face (NbInnerElements x NbFace x NbQuadraturePoints)
FaceWiseQPoints (float numpy array) – Quadrature points of each element’s face (NbInnerElements x NbFace x NbQuadraturePoints)
FaceWiseQBFValues (float numpy array) – Value of the basis function at the quadrature points of each element’s face (NbInnerElements x NbFace x NbQuadraturePoints x NbBasisFunc)
- Parameters
Problem (Problem) – the considered problem
Mesh (MeshStructure) – the considered mesh instance
QuadratureRules (Quadratures) – the quadratures to use within the scheme.
SchemeParams (string list) – the scheme’s parameters as wished by the user
Methods
-
ComputeFlux
(FlagPoints, U, LSValues)¶ Emulates a flux computation as done in the iteration routine in order to be used in the DeC subtimestep evaluation.
- Parameters
FlagPoints (function callback) – mapper to the routine of the FluidSpotter FlagPoints method to flag the Fluid on given points according the given LSValues at Dofs
U (numpy float array) – buffer containing the current state values at each dof (NbVars x NbDofs)
LSValues (numpy float array) – buffer containing the current FluidSpotters values at each dof(NbFluids x NbDofs)
- Returns
fluxes in the format required by the Iteration routine
- Return type
fluxes (numpy float (multiD)array)
-
Iteration
(FlagPoints, Solution, fluxes, i, du=0, dt=1)¶ Main iteration of the scheme, implementing the most stupid scheme you can think of.
- Parameters
FlagPoints (function callback) – the handle of a function flagging the points to the relevant fluid
Solution (solution structure) – structure containing the current solution’s values to iterate
fluxes (numpy (multiD)array) – pre-computed fluxes at the points of interest. For this scheme, access with fluxes[element, face, coordinate(fx or fy), variable, pointindex]
i (integer) – the index of the considered element within which the partial residuals will be computed
du (float numpy array) – (optional) when using DeC, the difference in the time iteration
dt (float) – (optional) when using DeC, the full time step
- Returns
the computed residuals (NbVars x NbDofs)
- Return type
Resu (float numpy array)
-
ReconstructSolutionAtVertices
(Solution)¶ Routine that maps the values from the Dofs to the Physical vertices of the mesh of the solution.
- Parameters
Solution (Solution) – the currently being computed solution
- Returns
fills direclty the RSol and RFluidFlag values in the data structure
- Return type
None
Note
This is only for later plotting purposes.
-
PreEvaluateQuadratureQuantities
()¶ Precomputing and storing the values of the basis functions at the quadrature points of each element
- Parameters
None – Considers the given parameters of the class directly
- Returns
- Creates the fields InnerQBFValues, InnerQWeigths, InnerQGFValues, InnerQPoints, FaceWiseQWeigths,
FaceWiseQPoints and FaceWiseQBFValues in the scheme structure, containing the values of each basis function at each quadrature point for each element and face.
- Return type
None
-
class
3_LESARD.SourceCode._Solver.SpatialSchemes.CG.
AssociatedMeshType
(SchemeParams=[1])¶ Class that only gives out the mesh type that should be loaded when tackling the problem with this scheme, given the wished variational order. Access the associated mesh properties through the inner variables
MeshType (string) – the mesh type according to fenics’s classification
MeshOrder (integer) – the mesh order
Note
This is only a product-type class: no method is available
- Parameters
SchemeParams (string list, optional) – the parameters of the spatial scheme wished by the user
-
class
3_LESARD.SourceCode._Solver.SpatialSchemes.CG.
Scheme
(Problem, Mesh, QuadratureRules, *SchemeParams)¶ Class furnishing all the schemes tools and registers the scheme’s wished parameters. The main iteration is accessible with the method “Iteration”.
Repeats the instance’s initialisation arguments as fields with identical names within the structure. Has for additional field upon instance creation the fields:
Order (integer) – The order of the used basis functions
InnerQBFValues (float numpy array) – Value of the basis function at the quadrature points of each element (NbInnerElementsx NbQuadraturePoints x NbBasisFunc)
InnerQWeigths (float numpy array) – Weights of the quadrature points of each element (NbInnerElements x NbQuadraturePoints)
InnerQGFValues (float numpy array) – Value of the gradient of the basis function at the quadrature points of each element (NbInnerElements x NbQuadraturePoints x NbBasisFunc x dim)
InnerQPoints (float numpy array) – Quadrature points of each element (NbInnerElements x NbQuadraturePoints)
FaceWiseQWeigths (float numpy array) – Weights of the quadrature points of each element’s face (NbInnerElements x NbFace x NbQuadraturePoints)
FaceWiseQPoints (float numpy array) – Quadrature points of each element’s face (NbInnerElements x NbFace x NbQuadraturePoints)
FaceWiseQBFValues (float numpy array) – Value of the basis function at the quadrature points of each element’s face (NbInnerElements x NbFace x NbQuadraturePoints x NbBasisFunc)
- Parameters
Problem (Problem) – the considered problem
Mesh (MeshStructure) – the considered mesh instance
QuadratureRules (Quadratures) – the quadratures to use within the scheme.
SchemeParams (string list) – the scheme’s parameters as wished by the user
Methods
-
ComputeFlux
(FlagPoints, U, LSValues)¶ Emulates a flux computation as done in the iteration routine in order to be used in the DeC subtimestep evaluation.
- Parameters
FlagPoints (function callback) – mapper to the routine of the FluidSpotter FlagPoints method to flag the Fluid on given points according the given LSValues at Dofs
U (numpy float array) – buffer containing the current state values at each dof (NbVars x NbDofs)
LSValues (numpy float array) – buffer containing the current FluidSpotters values at each dof(NbFluids x NbDofs)
- Returns
fluxes in the format required by the Iteration routine
- Return type
fluxes (numpy float (multiD)array)
-
Iteration
(FlagPoints, Solution, fluxes, i, du=0, dt=1)¶ Main iteration of the scheme, implementing the most stupid scheme you can think of.
- Parameters
FlagPoints (function callback) – the handle of a function flagging the points to the relevant fluid (not used here)
Solution (solution structure) – structure containing the current solution’s values to iterate
fluxes (numpy (multiD)array) – pre-computed fluxes at the points of interest. For this scheme, access with fluxes[element, face, coordinate(fx or fy), variable, pointindex]
i (integer) – the index of the considered element within which the partial residuals will be computed
du (float numpy array) – (optional) when using DeC, the difference in the time iteration
dt (float) – (optional) when using DeC, the full time step
- Returns
the computed residuals (NbVars x NbDofs)
- Return type
Resu (float numpy array)
-
ReconstructSolutionAtVertices
(Solution)¶ Routine that maps the values from the Dofs to the Physical vertices of the mesh of the solution.
- Parameters
Solution (Solution) – the currently being computed solution
- Returns
fills direclty the RSol and RFluidFlag values in the data structure
- Return type
None
Note
This is only for later plotting purposes.
-
PreEvaluateQuadratureQuantities
()¶ Precomputing and storing the values of the basis functions at the quadrature points of each element
- Parameters
None – Considers the given parameters of the class directly
- Returns
- Creates the fields InnerBFValues and FaceWiseBFValues in the scheme structure, containing
the values of each basis function at each quadrature point for each element and face.
- Return type
None
-
class
3_LESARD.SourceCode._Solver.SpatialSchemes.CG_Primary.
AssociatedMeshType
(SchemeParams=[1])¶ Class that only gives out the mesh type that should be loaded when tackling the problem with this scheme, given the wished variational order. Access the associated mesh properties through the inner variables
MeshType (string) – the mesh type according to fenics’s classification
MeshOrder (integer) – the mesh order
Note
This is only a product-type class: no method is available
- Parameters
SchemeParams (string list, optional) – the parameters of the spatial scheme wished by the user
-
class
3_LESARD.SourceCode._Solver.SpatialSchemes.CG_Primary.
Scheme
(Problem, Mesh, QuadratureRules, *SchemeParams)¶ Class furnishing all the schemes tools and registers the scheme’s wished parameters. The main iteration is accessible with the method “Iteration”.
Repeats the instance’s initialisation arguments as fields with identical names within the structure.Has for additional field upon instance creation the fields:
Order (integer) – The order of the used basis functions
InnerQBFValues (float numpy array) – Value of the basis function at the quadrature points of each element (NbInnerElementsx NbQuadraturePoints x NbBasisFunc)
InnerQWeigths (float numpy array) – Weights of the quadrature points of each element (NbInnerElements x NbQuadraturePoints)
InnerQGFValues (float numpy array) – Value of the gradient of the basis function at the quadrature points of each element (NbInnerElements x NbQuadraturePoints x NbBasisFunc x dim)
InnerQPoints (float numpy array) – Quadrature points of each element (NbInnerElements x NbQuadraturePoints)
FaceWiseQWeigths (float numpy array) – Weights of the quadrature points of each element’s face (NbInnerElements x NbFace x NbQuadraturePoints)
FaceWiseQPoints (float numpy array) – Quadrature points of each element’s face (NbInnerElements x NbFace x NbQuadraturePoints)
FaceWiseQBFValues (float numpy array) – Value of the basis function at the quadrature points of each element’s face (NbInnerElements x NbFace x NbQuadraturePoints x NbBasisFunc)
Note
This scheme is the CG one where the variables interpolated are rho, rhoU,
rhoV, p instead of the conservative ones, in order to preserve the pressure contacts if any
- Parameters
Problem (Problem) – the considered problem
Mesh (MeshStructure) – the considered mesh instance
QuadratureRules (Quadratures) – the quadratures to use within the scheme.
SchemeParams (string list) – the scheme’s parameters as wished by the user
Methods
-
ComputeFlux
(FlagPoints, U, LSValues)¶ Emulates a flux computation as done in the iteration routine in order to be used in the DeC subtimestep evaluation.
- Parameters
FlagPoints (function callback) – mapper to the routine of the FluidSpotter FlagPoints method to flag the Fluid on given points according the given LSValues at Dofs
U (numpy float array) – buffer containing the current state values at each dof (NbVars x NbDofs)
LSValues (numpy float array) – buffer containing the current FluidSpotters values at each dof(NbFluids x NbDofs)
- Returns
fluxes in the format required by the Iteration routine
- Return type
fluxes (numpy float (multiD)array)
-
Iteration
(FlagPoints, Solution, fluxes, i, du=0, dt=1)¶ Main iteration of the scheme, implementing the most stupid scheme you can think of.
- Parameters
FlagPoints (function callback) – the handle of a function flagging the points to the relevant fluid (not used here)
Solution (solution structure) – structure containing the current solution’s values to iterate
fluxes (numpy (multiD)array) – pre-computed fluxes at the points of interest. For this scheme, access with fluxes[element, face, coordinate(fx or fy), variable, pointindex]
i (integer) – the index of the considered element within which the partial residuals will be computed
du (float numpy array) – (optional) when using DeC, the difference in the time iteration
dt (float) – (optional) when using DeC, the full time step
- Returns
the computed residuals (NbVars x NbDofs)
- Return type
Resu (float numpy array)
-
ReconstructSolutionAtVertices
(Solution)¶ Routine that maps the values from the Dofs to the Physical vertices of the mesh of the solution.
- Parameters
Solution (Solution) – the currently being computed solution
- Returns
fills direclty the RSol and RFluidFlag values in the data structure
- Return type
None
Note
This is only for later plotting purposes.
-
PreEvaluateQuadratureQuantities
()¶ Precomputing and storing the values of the basis functions at the quadrature points of each element
- Parameters
None – Considers the given parameters of the class directly
- Returns
- Creates the fields InnerBFValues and FaceWiseBFValues in the scheme structure, containing
the values of each basis function at each quadrature point for each element and face.
- Return type
None