Skip to content

Grid Generation Algorithms

Andreas Nicolai edited this page Dec 1, 2018 · 7 revisions

OpenHAM implements different options for handling numerical grids:

  1. use pre-defined grid from project file
  2. generate equi-distant grid (default)
  3. generate a variably-spaced grid

Pre-defined grid

Pass the command line flag --no-disc and the grid is used as defined in the project file. This allows using a reference grid or a grid that was generated with some suitable preprozessor (python script, DELPHIN user interface, ...)

This is a useful option for comparisons between simulation models, where differences related to the grid shall be excluded.

Common rules

When small material layers are present (glue layers/foils), it may be possible that dx*3 > layer width for a selected minimum grid cell width dx (see below). In this case, the layer will always be discretized in 3 equi-distant elements.

Equi-distant grids

Pass the command line argument --disc=equi:<dx> to specify this, where dx is the element width. By default, an element width of 0.001 m is used.

Each material layer defined in the project is split into equal sizes grid cells, whereby the given element width dx is used to compute the number of elements n. Since it is possible that n*dx is not equal to the material layer width, the actual grid cell width is recomputed from dx = layer width/n

Hence, unless all the layer widths can be divided by the given dx without remainder, the actual dx value will differ in each material layer.

Variable grids

Pass the command line argument --disc=var:<min-dx>:<max-stretch> to specify this, where min-dx is the minimum element width at either side of the material layer and max-stretch is the maximum permissible stretch factor at the boundary elements.

The algorithm is using a double-sided, asymmetrical tanh distribution with iteratively determined stretch factor and grid cell count. Because of the shape of the distribution function, the minimum cell widths will usually be close (about +- 5%) to the desired min-dx value. Also, the actual stretch factor will be at maximum as large as the desired stretch factor.

To avoid excessive jumps in cell widths at a boundary between a normal and very thin material layer, the grid will be clustered more towards the thin material layer, so that the ratio between neighboring elements never becomes huge (and gives rise to numerical approximation errors). As a result, the distribution of grid cells may become asymmetric in the normal material layer.

Example:

Example for variable grid with assymmetric adjustment

Picture shows grid cell widths (approx. first derivatives of stretching function).

Grid was generated with min-dx=0.002 m and max-stretch=2. The second layer is only 0.003 mm thick, and hence is discretized in 3 cells with 0.001 m width, each.

The grids in material layer 1 and 3 are generated slightly asymmetrically. At the left side of layer 1 the desired min element width of 0.002 m (red line) is used, similar to the right-most element in the layer 3. Close to the second layer the stretch function generates element widths closer to 0.001 m, to avoid a steap jump in grid cell widths at this material boundary.

Clone this wiki locally