version 0.6.0
Loading...
Searching...
No Matches
Grid generation

Compute grid coordinates and spatial steps. More...

Functions

subroutine, public mod_grid_generator::initialize_grid_generator (coordg_fx, coordg_fy, coordg_fz)
 Allocate 3 directional grids.
 
subroutine, public mod_grid_generator::grid_generate_regular (cell_range, coordinate_range, coordg)
 Generate a regular grid.
 
subroutine, public mod_grid_generator::grid_generate_chebyshev (cell_range, coordinate_range, coordg)
 Generate a Chebyshev grid.
 
subroutine, public mod_grid_generator::grid_generate_exponential (cell_range, coordinate_range, expansion_ratio, coordg)
 Generate an exponential grid from the expansion ratio.
 
subroutine, public mod_grid_generator::grid_generate_exponential2 (cell_range, coordinate_range, first_step, reverse, coordg)
 Generate an exponential grid from the first step.
 
subroutine, public mod_grid_generator::read_grid_dimensions_from_file (filename)
 Create a grid from a file.
 
subroutine, public mod_grid_generator::create_grid_from_file (coordg_fx, coordg_fy, coordg_fz, filename)
 Create a grid from a file.
 
subroutine, public mod_grid_generator::complete_grid_structure (coordg_fx, coordg_fy, coordg_fz)
 Compute coordinates and spatial steps using global face coordinates.
 
subroutine mod_grid_generator_refined_grid::complete_grid_structure_refined_grid ()
 Compute coordinates and spatial steps of the refined grid using the main grid.
 

Detailed Description

Function Documentation

◆ complete_grid_structure()

subroutine, public mod_grid_generator::complete_grid_structure ( double precision, dimension(nxg+1), intent(in) coordg_fx,
double precision, dimension(nyg+1), intent(in) coordg_fy,
double precision, dimension(nzg+1), intent(in) coordg_fz )
Parameters
[in]coordg_fxGlobal face coordinates along x-axis
[in]coordg_fyGlobal face coordinates along y-axis
[in]coordg_fzGlobal face coordinates along z-axis

◆ create_grid_from_file()

subroutine, public mod_grid_generator::create_grid_from_file ( double precision, dimension(:), intent(inout) coordg_fx,
double precision, dimension(:), intent(inout) coordg_fy,
double precision, dimension(:), intent(inout) coordg_fz,
character(len=*), intent(in) filename )
Parameters
[in,out]coordg_fxGlobal face coordinates along x-axis
[in,out]coordg_fyGlobal face coordinates along y-axis
[in,out]coordg_fzGlobal face coordinates along z-axis
[in]filenameMesh file name

◆ grid_generate_chebyshev()

subroutine, public mod_grid_generator::grid_generate_chebyshev ( integer, dimension(2), intent(in) cell_range,
double precision, dimension(2), intent(in) coordinate_range,
double precision, dimension(:), intent(inout) coordg )

The spacial steps are determined by

\begin{align} x_i = x_1 + \frac{L}{2} \Big( 1 - \cos\big( \frac{\pi}{L} (i - 1) \big) \Big) \end{align}

where \(L\) is the coordinate range and \(i\) ranges from 1 to the number of cells.

Parameters
[in]cell_rangecell range of the sub-grid (e.g. [3,6] means from cell 3 to cell 6)
[in]coordinate_rangecoordinate range of the sub_grid (e.g. [1.0,2.0] means from 1.0 to 2.0)
[in,out]coordgface coordinates along a given axis

◆ grid_generate_exponential()

subroutine, public mod_grid_generator::grid_generate_exponential ( integer, dimension(2), intent(in) cell_range,
double precision, dimension(2), intent(in) coordinate_range,
double precision, intent(in) expansion_ratio,
double precision, dimension(:), intent(inout) coordg )

The expansion ratio is defined as the ratio of the last step over the first step

   !!         length = l
   !!  ┌──┬────┬─ ─ ─ ─┬───────┐
   !!   Δ1  Δ2             Δn
   !! 

The spacial steps are determined by

\[ \Delta_i = l \dfrac{1-q}{1-q^n}q^{i-1} \]

where \( q = \frac{\Delta_n}{\Delta_1}^{\frac{1}{n-1}} \)

Parameters
[in]cell_rangecell range of the sub-grid (e.g. [3,6] means from cell 3 to cell 6)
[in]coordinate_rangecoordinate range of the sub_grid (e.g. [1.0,2.0] means from 1.0 to 2.0)
[in]expansion_ratioratio of the last step over the first step
[in,out]coordgface coordinates along a given axis

◆ grid_generate_exponential2()

subroutine, public mod_grid_generator::grid_generate_exponential2 ( integer, dimension(2), intent(in) cell_range,
double precision, dimension(2), intent(in) coordinate_range,
double precision, intent(in) first_step,
logical, intent(in) reverse,
double precision, dimension(:), intent(inout) coordg )
   !!         length = l
   !!  ┌──┬────┬─ ─ ─ ─┬───────┐
   !!   Δ1  Δ2             Δn
   !! 

The spatial steps are determined by

\[ \Delta_i = \Delta_1 k^{i-1} \]

The common ratio k is determinated by solving the following equation using a Newton-Raphson algorithm.

\[ \Delta_1 \dfrac{1-k^n}{1-k} = l \]

Reordering the equation and taking the logarithm on both sides prevents the term \( k^n \) to explode.

\[ n \log(k) - \log\bigl(1 + d\frac{l}{\Delta_1(k - 1)}\bigr) = 0 \]

Parameters
[in]cell_rangecell range of the sub-grid (e.g. [3,6] means from cell 3 to cell 6)
[in]coordinate_rangecoordinate range of the sub_grid (e.g. [1.0,2.0] means from 1.0 to 2.0)
[in]first_stepfirst step of the exponential mesh (also last_step if reverse is set to .true.)
[in]reversethe first step becomes the last step if this flag is set to .true.
[in,out]coordgface coordinates along a given axis

◆ grid_generate_regular()

subroutine, public mod_grid_generator::grid_generate_regular ( integer, dimension(2), intent(in) cell_range,
double precision, dimension(2), intent(in) coordinate_range,
double precision, dimension(:), intent(inout) coordg )
Parameters
[in]cell_rangecell range of the sub-grid (e.g. [3,6] means from cell 3 to cell 6)
[in]coordinate_rangecoordinate range of the sub_grid (e.g. [1.0,2.0] means from 1.0 to 2.0)
[in,out]coordgface coordinates along a given axis

◆ read_grid_dimensions_from_file()

subroutine, public mod_grid_generator::read_grid_dimensions_from_file ( character(len=*), intent(in) filename)
Parameters
[in]filenameMesh file name