Wiki

Clone wiki

Simflowny / UserGuide_PDEDiscretization

Creation of PDE discretization policy

Creation of PDE discretization policy

In order to create a discretization policy, the first step is to choose a PDE problem and generate the discretization policy template. In the document manager the user can select any PDE problem.


images/UserGuide/problemselectionPDE.png

When pressing Create Discretization Policy button, Simflowny starts the policy generation process:

Briefly a template discretization policy is created. Open it with the editor by double-clicking it or with the toolbar pencil icon:


images/UserGuide/discPolicyPDE.png

Head

Head information is commonly used in several documents in Simflowny. See more detail in Head.

Problem

The first action is to link the policy to the problem we want to discretize. Expand Sim Problem and set a problem name, just for readability, and the edit the Problem Id to select the problem from the integrated document manager.

This element is automatically filled when using the Create Discretization Policy actions button. Otherwise it must be properly set.

Mesh Variables (optional)

The user must specify which fields and auxiliary fields in the problem are going to be discretized using a mesh (finite volumes or finite differences). If there are only mesh variables, there is the possibility to fill a mesh variable as All, to avoid setting all fields.

Particle Variables (optional)

The user must specify which variables in the problem are going to be discretized using particles. Particles are grouped by species. Each species must set a name, a list of variables belonging to that species and the equation to calculate particle volume. Optionally, if the particles are not static, the Velocities tag can be added, allowing to set, for every spatial dimension, their movement equations.

In the following picture, there is the definition of a ion species with velocities:


images/UserGuide/particlesPolicy.png

Notice that every problem field and auxiliary field must be set once and only once as mesh or particle variable.

Region Discretizations

For PDE problems, the discretization is applied using the Method of Lines. Consequently, the user must complete the Region discretization elements with the spatial and time discretizations separately. To fill the information, the user must set the Operator Discretizations and select a document for the Time Integration Schema, which is the schema integrating the spatial and time discretization. There must be one Operator Discretization for each operator in the model's equations, in which the user must specify a proper Spatial Operator Discretization.


images/UserGuide/completePDEPolicy.png

A region discretization could be applied only a set of field groups (if defined) by setting Field Groups. Then, only the fields of those groups (defined in the region and subregions of the problem) will be discretized by this configuration.

Also, complex discretization schemas may have different instructions to discretize some specific fields. For instance, making a distinction for primitives and conservative fields. When the schema is created there is no information of which fields correspond to primitives or conservatives groups, but it is known that whatever the fields would be, they must be differently discretized. In order to assign which problem fields correspond to those groups, the user must add a Field Group Maps tag, to assign the problem field groups to the schema field groups.

Analysis Discretization (Optional)

When discretizing a problem with analysis variables, the analysis discretization must be set. Analysis discretization is similar to region discretization configuration, using a spatial discretization but no temporal one. So, the user must set Operator Discretizations element in a similar way than in the previous section.

Notice that the user can set a different set of operators for analysis and equation discretizations. Therefore, a list of input variables must be set for the spatial operator discretization.

The following image shows the typical configuration for analysis:


images/UserGuide/analysisPDEPolicy.png

Post Initialization (Optional)

In some cases, the problem's initial conditions are not enough for a given discretization schema, and some extra algorithm or variables are needed. In that case, the optional Post Initialization tag must be added, setting the Simml as needed.

The following image shows how a variable q is created and set for two particle species, ion and electron:


images/UserGuide/postIinitializationPDEPolicy.png

Extrapolation Method (Optional)

As stated previously, Simflowny overcomes incompatible regions (regions with different fields) and performs an extrapolation of the missing fields. Three extrapolation algorithms are supported, namely, Linear, Quadratic and Cubic spline (where the number of interior data points used in the extrapolation can be chosen by the user). The selection of the method and its parameter should be done in the discretization policy. So, if needed, add the optional element Extrapolation Method from the root element and configure it properly.


images/UserGuide/discExtrapolation.png

In case the user does not add the extrapolation information element and the problem had incompatible regions, Simflowny uses by default a linear extrapolation method from two interior cells.

Mesh Interpolation Method (Optional)

When using particle and mesh variables in the same simulation, it may occur that particles get information from mesh variable. In that case, an interpolation from the mesh variables is performed. Currently, only linear interpolation is available.

Particle Interpolation Method (Optional)

In the same way, cells may need to gather information from near particle variables. In that case, an interpolation using a kernel is performed. Currently, only wendland interpolation is available.

Next steps

Go to code generation to start generating code in Simflowny.

Updated