GenerateGrid

Created Montag 08 Februar 2016

This function computes the discretisation of a given interval I of length L into N cells. It allows to distribute the N cells into a fixed number of sub-intervals. Each of these sub-intervals can feature a stretching of its cells' lengths.

1. Purpose of Function

In situations in which large gradients (e.g. temperature, pressure) need to be transferred into a discretised component, e.g. a pipe, it can be numerically advantageous to choose a non-equidistant discretisation, where the discretisation intervals exposed to potential large gradients are chosen smaller.

The function GenerateGrid provides a straight forward way to generate such stretched discretisation.

2. Limits of Validity

Each of the sub-intervals shall have at least 2 cells. Otherwise the scaling of each sub-interval becomes meaningless.

3. Interfaces

4. Nomenclature



5. Governing Equations


Idea:

We want to assign a stretching to the cells of a discretised model. This results in a vector containing sub-interval of the physical length .

Implementation

The input consists of a vector of signed reals, e.g

The number corresponds to a subdivision of into sub-intervals of length .
Accordingly every sub-interval contains (up to rounding)

cells.
Here collects the normalised remainders of the integer division at each (see source code). This ensures that
even if .

For the sub-interval the number defines a length distribution of cells.
Here

corresponds to equidistant cell spacing of the sub-interval,
to increasing cell width from beginning to the end of the sub-interval,
to decreasing cell width from beginning to the end of the sub-interval.

The modulus determines the stretching rate of cells. The sub-interval has cells

where

with the normalisation constant


6. Remarks for Usage


7. Validation


Example:


This corresponds to the following discretisation:



8. References


9. Version History

09.02.2016 - 0.1 - initial implementation - Johannes Brunnemann, XRG Simulation GmbH