LESARD: Solving modules


The articulation of the solver is made around three modules: Solver_Initialisations, Solver_Spatial, and Solver_Temporal. The Solver_Initialisations takes care about all the initialisation, from the subdomain’s splitting to the fluid’s spotter values initialisation through shortcutting the problem and solver routines that have been selecting by the user. The module Solver_Spatial acts as an interface from the Residual Distribution framework to the actual spatial scheme. The temporal solver being actually defined within a shortcut routine and not needing any further interface, the module Solver_Temporal acts on the time step retrieval and defines the mass lumping routines. The documentation below explicits their role. For the practical documentation of the actual solvers (that enjoy modularity), please see the corresponding pages.


Page navigation






Solver initialisations module


The structures and classes that allow a shortcut of all the routines used upon the user’s choices (governing equations, spatial schemes, etc) are defined in the module _Solver.Solver_Initialisations. After shortuting the routine accordingly to the values registered in the file Mappers.py, it automatically defines the spatial subdomains, initialises the solution and the fluid’s selector. The fields and methods of the three main instances representing the Problem, Solver and Solution are given below.


class 3_LESARD.SourceCode._Solver.Solver_Initialisations.Parameters(SolverSpecs)

Parameter (and reader) class of scheme properties and runtime informations. It furnishes all the information given from the user through the setting file given in argument when running the script in a structure containing the following fields:


Parameters chosen by the user

The text content is exported into a ParamsReader structure variable containing:

  •   ExportInterval (float) – time interval after which the computed results will be exported

  •   Tmax (float) – the (physical) end-time of the computations

  •   CFL (float) – the CFl number

  •   TimerParams (strings list) – parameters of the time schemes

  •   TimeSchemeId (integer) – index of the time scheme (see the Mapper file)

  •   SchemeParams (string list) – parameters of the spatial scheme

  •   SchemeQuadParams (string list) – quadrature parameters of the spatial scheme

  •   SchemeId (integer) – index of the spatial scheme (see the Mapper file)

  •   ScModifiers (string) – modifier sequence for spatial scheme (limiters etc (see the Mapper file))

  •   FluidSpotterId (integer) – index of the fluid selector (see the Mapper file)

  •   FluidSpotterParams (string list) – parameters of the fluid selector (see the Mapper file)

  •   RedistancerParams (string list) – redistancing scheme and properties (see the Mapper file and the settings parser of the redistancing library)

  •   FSQuadParams (string list) – quadrature parameters of the fluid selector

  •   QuadratureType (integer) – index of the wished quadrature (see the Mapper file)

  •   QuadratureOrder (integer) – order of the wished quadrature

  •   Verbose (string) – verbose mode: , “d”: debug, “m”: minimal, “n”: none

  •   LightExport (integer) – specifies the export mode: 0 for an export containing the mesh, 1 for a mesh free export


Automatically generated attributes:

Retrieved directly at instance creation

  •   MeshType (string) – type of the mesh associated (CG, DG, RT, BDM, …)

  •   MeshOrder (integer) – order of the mesh


Note

This is only a product-type class: no method is available


Parameters

SolverSpecs (string) – the name of the setting file, either the raw name of the settings stored in the PredefinedSettings folder (or equivalent if changed by the user), or the full path to “Used settings in case of a restart.”


class 3_LESARD.SourceCode._Solver.Solver_Initialisations.Solver(Problem, Mesh, SolverParams)

Shortcutting class gathering all the methods and functions that the solver requires, upon the user desires and the inherent solver’s properties, furnishing the following fields:

  •   FluidSelector (class instance) – FluidSelector instance containing all the required Fluid selector routines

  •   SpatialScheme (class instance) – Scheme instance, containing the mail “Iteration” method that corresponds to the spatial solver

  •   SPAdmendements (class instance) – Amendements instance, containing all the required routines to limit the scheme (if wished by the user)

  •   Redistancer (class instance) – Redistancing instance, containing all the required routines to redistance the level set (if wished by the user)

  •   ControlVolumes (string) – The type of control volume required by the scheme: either “primal” or “dual”

  •   Reconstructor (function callback list) – Functions that reconstructs the solution and Fluid selector values at physical vertices from the degrees of freedom

  •   TimeStep (function callback) – Function implementing one time step iteration

  •   CFL (float) – A recall of the CFL number

  •   Tmax (float) – A recall of the final time


Parameters

SolverParams (Parameters) – the structure containing all the problem data


class 3_LESARD.SourceCode._Solver.Solver_Initialisations.Solution(Problem, Mesh)

Class used as an product type object containing all the informations on the computed solution, containing the following attributes:

  •   Subdomains (shapely multipolygons list) – List of shapely multipolygons that define each fluids countour (NbFluids)

  •   FluidFlag (integer list) – For each mesh Dof, the Flag associated to the fluid that is present at this point (NbDofs)

  •   RFluidFlag (integer list) – For each mesh vertex, the Flag associated to the fluid that is present at this point (NbMeshPoints), reconstructed from the value at Dofs

  •   LSValues (float list) – Level set values at each Dof (NbFluids x (NbDofs))

  •   RLSValues (float list) – Level set values at each vertex, reconstructed from the Dofs (NbFluids x (NbMeshPoints))

  •   Mesh (MeshStructure) – A recall of the used mesh

  •   maxh (float) – A shortcut of the mesh max element’s size

  •   minh (float) – A shortcut of the mesh min element’s size (for plotting purposes)

  •   Sol (float numpy array) – The actual solution (overwritten each time step, NbVar x (NbDofs))

  •   RSol (float numpy array) – The reconstructed solution at the Mesh’s physical vertices (overwritten each time step, NbVar x (NbMeshPoints))

  •   RXY (float numpy array) – A shortcut of the cartesian coordinates of the MeshVertices ((NbMeshPoints) x 2)

  •   t (float) – The time corresponding to the solution


Upon instance creation, itnitialises the solution structure upon the problem and the mesh (except LSValues).



Parameters
  • Problem (Problem) – structure containing all the problem info and shortcuted routines

  • Mesh (MeshStructure) – the considered mesh


Methods

Initialise_Flags(Problem, Mesh)

Initialise the solution structure upon the problem and the mesh.

Parameters
  • Problem (Problem) – structure containing all the problem info and shortcuted routines

  • Mesh (MeshStructure) – the considered mesh

Returns

filled FluidFlags vector within solution structure.

Return type

None

Initialise_SolutionValues(Problem, Mesh)

Initialise the solution structure upon the problem and the mesh.

Parameters
  • Problem (Problem) – structure containing all the problem info and shortcuted routines

  • Mesh (MeshStructure) – the considered mesh

Returns

filled intial solution values within solution structure.

Return type

None


class 3_LESARD.SourceCode._Solver.Solver_Initialisations.Problem(ProblemData, Mesh)

Shortcutting class gathering all the methods and functions that the user targets to solve the problem. It sets the problem up upon the solver parameters and the mesh, and furnishes the following fields:

  •   NbFluids (integer) – number of fluids present initially in the problem’s domain

  •   FluidIndex (integer list) – the ordered list of fluid types corresponding to the fluids present initally in the problem’s domain

  •   InitialSubdomains (shapely multipolygon list) – list of the initial fluids subdomains, in the given order of the fluid lists

  •   StudyDomain (shapely multipolygon) – the considered computational domain

  •   GoverningEquations (Equations class) – structure containing the methods of flux, jacobian, spectral radius, and a possible Roe matrix

  •   InitialConditions (function callback list) – list of all the function callbacks defining the initial conditions for each fluid

  •   FluidProp (Fluids structure list) – list of all the fluids properties correspoding to the list of fluids themselves

  •   FluidEOS (function callback list) – list of all the equations of state in use for each fluid

  •   EOSType (string) – the name of the EOS in use


Automatic initialisation routine.

Parameters
  • ProblemData (Parameters) – the structure containing all the problem data

  • Mesh (MeshStructure) – the mesh in use

Returns

fills direclty the Problem structure

Return type

None




Spatial Residual distribution interface


3_LESARD.SourceCode._Solver.Solver_Spatial.RD(Theta, m, M, dt, schemeSP, schemeFS, Problem, Mesh, Solution, up, lp)

Integrates the RD formulation in the Dec setting: interfaces from the scheme to the time stepper when used within a residual distribution framework

Parameters
  • Theta (float numpy array) – coefficients of the DeC routine

  • m (integer) – current subtimestep of the DeC correction

  • M (integer) – total number of DeC corrections

  • dt (float) – the total current time step duration

  • schemeSP (scheme module list) – handler of the spatial scheme module, followed by its amendements

  • schemeFS (scheme module list) – handler of the FluidSpotter scheme module (the scheme should already contain all the wished amendments (limiter, jumps etc))

  • Problem (Problem) – considered problem

  • Mesh (MeshStructure) – considered mesh

  • Solution (Solution) – snapshot of the solution at the previous full time step

  • up (float numpy array) – time-local increment in the solution coming from DeC

  • lp (float numpy array) – time-local increment in the FluidSpotter values coming from DeC

Returns

being of the form [upres (NbVarsxNbDofs), lsres(NbFluidsxNbDofs)], each term corresponds to the residuals of the state and the fluid’s spotters, respectively.

Return type

Residuals (3D numpy array)




Application of boundary conditions


The file SourceCode/BoundaryConditions.py contains a single routine that allows the user to apply the set of boundary conditions on the residuals according to the user input (it should prealabily have been recast in a list of boundary routines in the SolverInitialisations file).


3_LESARD.SourceCode._Solver.Solver_ApplyBCs.ApplyBCSState(Problem, Mesh, Solution, Residuals)

Applying each boundary condition wrt the boundary tags and the fluid (the Problem structure should be filled with the mapped boundary routines for each boundary tag and fluid’s type)

Parameters
  • Problem (Problem) – The considered problem

  • Mesh (MeshStructure) – The considered mesh

  • Solution (Solution) – The solution buffer containing the solution at the previous (and incremented in DeC) intermediary timestep (relates to the time scheme)

  • Residuals (2D numpy array) – The currently computed residuals (NbVars x NbDofs)

Returns

The updated residuals according to the given boundary conditions (NbVars x NbDofs)

Return type

Residuals (2D numpy array)




Tools required for the time steppings


3_LESARD.SourceCode._Solver.Solver_Temporal.GetLumpingCoefficients(Mesh, Solver)

Computes the mass lumping coefficients.

Parameters
  • Mesh (MeshStructure) – the instance containing the mesh information

  • Solver (Solver) – instance containing all the solver’s parameters

Returns

fills directly the “Lumping” field of the mesh structure

Return type

None

3_LESARD.SourceCode._Solver.Solver_Temporal.GetTimeStep(CFL, Tmax, Problem, Mesh, Solution)

Computes the time step for each iteration upon the solution and the CFL.

Parameters
  • CFL (float) – the CFL number

  • Tmax (float) – simulation end-time

  • Problem (Problem structure) – the instance containing the problem information

  • Mesh (MeshStructure) – the instance containing the mesh information

  • Solution (Solution) – the solution of the problem that is being evolved in time

Returns

the time step

Return type

timestep (float)