version 0.6.0
Loading...
Searching...
No Matches
Node level schemes

Node level (cell, face, edge, vertex, point) discrete schemes. More...

Topics

 Discrete Derivatives
 The Discrete Derivatives module.
 
 Extrapolation
 Extrapolation schemes.
 
 Finite Differences
 Finite differences schemes.
 
 Integration
 Integration schemes.
 
 Interpolation
 Interpolation schemes for grid elements and points
 

Namespaces

module  mod_node_level_schemes_init
 Initialization of declared node level schemes.
 
module  mod_interpolation_polynomial
 Polynomial functions.
 

Detailed Description

This module has been made to simplify the discretization of various PDE systems that rely on various schemes. They can be used to discretize in an explicit or implicit manner. All of them are based on the principle of stencils that are simply an array of weights associated to some field discrete values positionned at nodes (hence the name of the module). They can be used in a more general way, even without an underlying grid.

The overall objective is to furnish to the developper a toolbox of easy to use schemes that are useful when discretizing.

The module is subdivided in 4 categories:

Modules organization

We have chosen a common organization for each submodule.

The stencil

They are based on a main type that uses an underlying stencil. The principle of a generic discrete stencil still has to be applied to all the modules. A stencil is an array of values that represente the weights that are associated for discrete node values and which defines the scheme. For compactness reseaons, the stencil is defined between index_start and index_end, where \(index_{end}-index_{start}+1\) is the size of the stencil.

Note
To access the weights associated with the relative -2 node, simply get the stencil%weight(-2) value.

By convention, we define the 0 index as the reference node index.

Example
The second order centered finite difference scheme for the first derivative is based on the stencil: \(\left\{ x_{-1},x_0,x_{+1} \right\}\) where \(x_i\) is the position of the \(i^{th}\) node relatively to the reference node. For a uniform grid of spacing \(h\), the associated weights are \(\frac{1}{2 h}\left\{ -1, 0, +1 \right\}\).
Example
Similarly, the forward finite difference scheme for the first derivative is based on the stencil: \(\left\{ x_{0},x_{+1},x_{+2} \right\}\). The associated weights are \(\frac{1}{2 h} \left\{ -3, +4, -1 \right\}\).

To explicitely compute the discrete value of the scheme, one simply has to supply the discrete values at the associated nodes.

The extrapolation, interpolation and integration modules share the same principle.

Todo
Use the type_discrete_stencil for all submodule

The schemes

A lot of schemes have already been developped. They are made in order to work with possibly variable steps between nodes (or, if not, the precision of the schemes may diminish). All the schemes are grouped in the corresponding subdirectory and are named in such a way that they are clearly identifiable.

The various schemes have to be initialized properly before being used, as their supporting stencil can vary. Thus, one has to call the associated init subroutine which do it for the various predefined schemes. The initialization is already called in Notus main function.

The computer

A collection of Fortran generic functions have been developped for each submodule to ease the use of schemes. They are named computers, as they are used to compute the schemes' stencil and explicit value.

Example 1

Imagine that you want to compute the third order backward extrapolation of a set of discrete node values at a distance d away from the 0 node, one would use:

result = ext_compute( ext_scheme_o3_backward_instance, d, [ h1, h2 ], [ phi0, phi1, phi2 ] )

where h1 is the spacing between the first two nodes (similarly for h2) and phi0 is the discrete value of a function \(\phi\) at the 0 node.

Example 2

Now if you want to compute the centered second order second derivative of a function defined on a 3D grid, at the position i,j,k (which represent the local 0 node) in the \(z\) direction:

result = fd_compute( fd_scheme_second_o2_centered, x_step_array, y_step_array, z_step_array, phi_field, i,j,k, 3 )

where x_step_array is the array of steps separating the discrete nodes (ie. dx in Notus for pressure nodes), phi_field is a 3D scalar array (ie. pressure in Notus for the pressure field), and the later 3 relates to the third dimension ( \(z\)).

Implicit usage

Anyone can also use the schemes for implicit discretization: One simply has to fill the weights of a scheme with the supplied steps and recover its value in the stencil's array.

Example
Detailed examples are given in the Finite differences documentation. The same principle can be used for extrapolation and interpolation schemes.