PDEModels Best Practice
Conservative versus Non-Conservative Convection
Generally speaking a convection can be modeled in a conservative and non-conservative form. The conservative form is expressed as a ConservativeConvectionPDETerm and models . The alternative is to use a ConvectionPDETerm, that models . Note the different position of
Discontinuity of secondary unknown quantities
Sometimes, it is necessary to compute secondary quantities from the primary unknown variable. These secondary quantities are often proportional to the first derivative of the primary unknown variable. Unlike the primary unknown variable, secondary variables can become discontinuous across element boundaries.
The following example shows discontinuities that arise when taking the derivative of a dependent variable . Also, it shows how the secondary quantity becomes more accurate as the number of elements increases.
The equation to solve is a diffusion term, with coefficient , and a source term that varies quadratically in space. The equation is solved in a 1D domain from to . For this problem, an analytical solution exists.
The source term is represented by the following equation:
where is a constant and is the independent variable.
Three different meshes will be used. The first will have 2 line elements, the second 4 and the last one 20.
Two DirichletCondition will be specified at both ends of the line. At the left, a value of 1 will be specified, and at the right, a value of 0.
This problem has an analytical solution given below. Note that the solution if of 4th order. This means that the quadratic elements can used in the interpolating function can not perfectly interpolate the solution.
We can see that in the primary quantity, the solution is more accurate when using more elements.
The interpolating function of the solution is quadratic. Now, when we compute the derivative of the solution the quadratic interpolating function effectively becomes linear. Additionally, it is in the nature of the finite elements that the linear elements will introduce discontinuity at the element boundaries. However, these discontinuities can be reduced by refining the mesh, as will be shown in the next.
One can see a discontinuity at the intersection of each element, but the discontinuities are less pronounced than in the first case.
With 20 elements, we no longer sees discontinuities.
Dirac delta functions
Regularized delta functions are used to implement monopole sources in various fields of physics, such as acoustics.
To make use of a monopole source, the monopole source is located at . Then the monopole source term may be written as:
where is a Dirac delta function at the source location .
The Dirac delta function, however, poses a problem in numerical simulations as it can not be resolved in the discretized spatial domain. This is because the Dirac delta function is singular at the source location . Hence, an approximation to the Dirac delta function is needed. The process of approximating the Dirac delta function is called regularization.
There are various regularized delta functions available. In this tutorial we choose:
where is the regularization parameter that controls the support of the regularized delta functions . Typically should have a size comparable to the mesh spacing .
Modifying will change the width of the regularized delta function, however, for the spatial integral is always 1.
Smoothed step functions
In some examples, we use a smoothed step function to prescribe a time profile for a transient parameter, for example the heat flux or the surface temperature . The smoothed step function is defined as follows:
Here the minimum value and the maximum value the function can reach are denoted by and . The location of the step is controlled by and the smoothed steepness is controlled by .
Solving Memory-Intensive PDEs
The finite element method documentation has a section on Solving Memory-Intensive PDEs that may alo be useful to know about in the context of PDE solving.
Units
Geometry Units
The units of a geometry can be rescaled. This is explained in the ElementMesh generation tutorial.
Material Units
Should the units of the geometry be different from the material units, then the material units can be scaled.
Internally, all material data units are converted to "SIBase" units. As a consequence the default unit of length is "Meters". If the units of the geometry are also in meters then nothing needs to be changed. If the units of the geometry are not in meters then either the PDE and material properties need to be scaled to the units the geometry or the geometry needs to be scaled to "Meters". To scale the units of the PDE and material parameters the parameter "ScaleUnits" can be given. If not explicitly stated otherwise, examples in this notebook use the default "SIBase" units.
The procedure works in the same way when the material parameters are given as a Quantity.