off_block_object Module

module~~off_block_object~~UsesGraph module~off_block_object off_block_object module~off_error_object off_error_object module~off_error_object->module~off_block_object module~off_cell_object off_cell_object module~off_cell_object->module~off_block_object iso_fortran_env iso_fortran_env iso_fortran_env->module~off_block_object iso_fortran_env->module~off_error_object module~off_block_signature_object off_block_signature_object module~off_block_signature_object->module~off_block_object module~off_node_object off_node_object module~off_node_object->module~off_block_object penf penf penf->module~off_block_object penf->module~off_error_object penf->module~off_cell_object penf->module~off_block_signature_object module~off_face_object off_face_object penf->module~off_face_object module~off_face_object->module~off_block_object vecfor vecfor vecfor->module~off_block_object vecfor->module~off_cell_object vecfor->module~off_block_signature_object vecfor->module~off_node_object vecfor->module~off_face_object vtk_fortran vtk_fortran vtk_fortran->module~off_block_object
Help

OFF block object definition and implementation.

block_object is a Finite Volume block-structured class.

It allows the easy handling of metrics data for the robust and efficient computation of numerical spatial operators in the framework of Finite Volume Methods (FVM).

Let us assume that the fluid domain \(D\) is decomposed in \(N_b\) structured blocks \(D^b\), each subdivided in \(N_i \times N_j \times N_k\) disjoint hexahedrons \(D_{ijk}^b\) such that \(\bigcup D_{ijk}^b = D^b\). The block class is designed to aid the computations of the spatial operators into each block: $$ \frac{\partial}{{\partial t}}\int\limits_{V_{ijk}} {\overrightarrow U dV} = -\sum\limits_{s = 1}^6 {\int\limits_{S_s} {\left(\overline{\overline {F}}\right) \cdot \overrightarrow n dS}} + \int\limits_{V_{ijk}} {\overrightarrow {{Q}} dV}\label{eq:rans-cons-num} $$ where \(S_s\) is the \(s^{th}\) face of the finite volume \(D_{ijk}\) whose measure is \(V_{ijk}\).

A structured block is composed of hexahedron finite volumes with quadrilateral faces using the following internal numeration for nodes and faces:

 /|\Z
  |                            F(4)         _ F(6)
  |                            /|\          /!
  |                        7    |          /    8
  |                         *------------------*
  |                        /|   |        /    /|
  |                       / |   |       /    / |
  |                      /  |   |      /    /  |
  |                     /   |   |     /    /   |
  |                    /    |   |    +    /    |
  |                   /     |   |        /     |
  |                  /      |   +       /      |
  |                 /      3|          /       |4
  |                /        * --------/--------*
  |      F(1)<----/----+   /         /        /
  |              *------------------*    +-------->F(2)
  |             5|       /          |6      /
  |              |      /           |      /
  |              |     /        +   |     /
  |              |    /         |   |    /
  |              |   /      +   |   |   /
  |              |  /      /    |   |  /
  |              | /      /     |   | /
  |              |/      /      |   |/
  |              *------------------*
  |             1      /        |    2
  |                   /        \|/
  |   _ Y           |/_       F(3)
  |   /|         F(5)
  |  /
  | /
  |/                                                    X
  O----------------------------------------------------->

Each hexadron cells is faces-connected to its neighboring, thus the cells build a structured block with implicit connectivity, e.g. in 2D space a block could be as the following:

                 _ J
                 /|                          _____
               5+ ...*----*----*----*----*...     |
               /    /    /    /    /    /         |
              /    /    /    /    /    /          |
            4+ ...*----*----*----*----*...        |
            /    /    /    /    /    /            |
           /    /    /    /    /    /             |
         3+ ...*----*----*----*----*...           |  Structured block of 4x4 Finite Volumes
         /    /    / FV /    /    /               |
        /    /    /    /    /    /                |
      2+ ...*----*----*----*----*...              |
      /    /    /    /    /    /                  |
     /    /    /    /    /    /                   |
   1+ ...*----*----*----*----*...                 |
   /     .    .    .    .    .                    |
  /      .    .    .    .    .               _____
 O-------+----+----+----+----+-------------> I
         1    2    3    4    5

The nodes of cells are not required to be on the Cartesian coordinates, thus allowing a general curvilinear mesh: the are 3 implicit coordinate lines, i, j and k that are not required to be orthogonal.

Used By

module~~off_block_object~~UsedByGraph module~off_block_object off_block_object module~off_simulation_object off_simulation_object module~off_block_object->module~off_simulation_object module~off_file_grid_object off_file_grid_object module~off_block_object->module~off_file_grid_object module~off_objects off_objects module~off_block_object->module~off_objects module~off_simulation_object->module~off_objects module~off_file_grid_object->module~off_simulation_object module~off_file_grid_object->module~off_objects program~off_test_save_load_file_parameters off_test_save_load_file_parameters module~off_objects->program~off_test_save_load_file_parameters program~off_test_load_file_parameters off_test_load_file_parameters module~off_objects->program~off_test_load_file_parameters program~off_test_save_load_file_grid off_test_save_load_file_grid module~off_objects->program~off_test_save_load_file_grid
Help


Variables

TypeVisibility AttributesNameInitial
integer(kind=I4P), private, parameter:: ERROR_BLOCK_COMPUTE_EXTENTS_FAILED =1

Failed to compute block extents.

integer(kind=I4P), private, parameter:: ERROR_BLOCK_CREATE_FAILED =2

Failed to create block.

integer(kind=I4P), private, parameter:: ERROR_BLOCK_CREATE_LINSPACE_FAILED =4

Failed to create a uniform-spaced linear block.

integer(kind=I4P), private, parameter:: ERROR_BLOCK_DESTROY_FAILED =3

Failed to destroy block.

integer(kind=I4P), private, parameter:: NO_ERROR =0

No errors occurred.


Derived Types

type, public :: block_object

Block object class.

Components

TypeVisibility AttributesNameInitial
type(cell_object), public, allocatable:: cell(:,:,:)

Cell.

type(error_object), public :: error

Errors handler.

type(face_object), public, allocatable:: face_i(:,:,:)

Faces along I direction.

type(face_object), public, allocatable:: face_j(:,:,:)

Faces along I direction.

type(face_object), public, allocatable:: face_k(:,:,:)

Faces along I direction.

type(node_object), public, allocatable:: node(:,:,:)

Cell.

type(block_signature_object), public :: signature

Signature, namely id, level, dimensions, etc…

Type-Bound Procedures

generic, public :: assignment(=) => block_assign_block

Overload =.

procedure, private, pass(lhs) :: block_assign_block

Operator =.

procedure, public, pass(self) :: cells_number

Return the number of cells.

procedure, private, pass(self) :: compute_extents

Compute block extents.

procedure, private, pass(self) :: compute_faces_metrics

Compute block faces metrics.

procedure, private, pass(self) :: compute_metrics

Compute block metrics.

procedure, public, pass(self) :: compute_space_operator

Compute space operator.

procedure, private, pass(self) :: compute_volumes

Compute block volumes.

procedure, private, pass(self) :: correct_metrics

Correct block metrics.

procedure, public, pass(self) :: create_linspace

Create a Cartesian block with linearly spaced nodes.

procedure, public, pass(self) :: destroy

Destroy block.

procedure, public, pass(self) :: initialize

Initialize block.

procedure, public, pass(self) :: interpolate_at_nodes

Interpolate cell-centered variable at nodes.

procedure, public, pass(self) :: load_nodes_from_file

Load nodes from file.

procedure, private, pass(self) :: node_to_center

Compute cell centers coordinates from cell nodes.

procedure, public, pass(self) :: nodes_number

Return the number of nodes.

procedure, private, pass(self) :: nullify_normals

Nullify normals for 2D or 1D domains.

procedure, public, pass(self) :: save_file_grid

Save gird file.

procedure, private, pass(self) :: save_file_grid_tec

Save grid file in Tecplot format.

procedure, private, pass(self) :: save_file_grid_vtk

Save grid file in VTK format.

procedure, public, pass(self) :: save_nodes_into_file

Save nodes into file.


Functions

private elemental function cells_number(self, with_ghosts) result(cells_number_)

Return the number of cells.

Arguments

Type IntentOptional AttributesName
class(block_object), intent(in) :: self

Block.

logical, intent(in), optional :: with_ghosts

Take into account ghost cells.

Return Value integer(kind=I4P)

Number of cells.

private pure function node_to_center(self) result(center)

Compute cell centers coordinates from cell nodes.

Arguments

Type IntentOptional AttributesName
class(block_object), intent(in) :: self

Block.

Return Value type(vector), allocatable, (:,:,:)

Cell centers coordinates.

private elemental function nodes_number(self, with_ghosts) result(nodes_number_)

Return the number of nodes.

Arguments

Type IntentOptional AttributesName
class(block_object), intent(in) :: self

Block.

logical, intent(in), optional :: with_ghosts

Take into account ghost cells.

Return Value integer(kind=I4P)

Number of cells.


Subroutines

private pure subroutine block_assign_block(lhs, rhs)

Operator =.

Arguments

Type IntentOptional AttributesName
class(block_object), intent(inout) :: lhs

Left hand side.

type(block_object), intent(in) :: rhs

Right hand side.

private elemental subroutine compute_extents(self)

Compute block extents.

Arguments

Type IntentOptional AttributesName
class(block_object), intent(inout) :: self

Block.

private elemental subroutine compute_faces_metrics(self)

Compute block faces metrics.

Arguments

Type IntentOptional AttributesName
class(block_object), intent(inout) :: self

Block.

private subroutine compute_metrics(self)

Compute block metrics.

Arguments

Type IntentOptional AttributesName
class(block_object), intent(inout) :: self

Block.

private subroutine compute_space_operator(self)

Compute space operator.

Arguments

Type IntentOptional AttributesName
class(block_object), intent(in) :: self

Block.

private elemental subroutine compute_volumes(self)

Compute block volumes.

Arguments

Type IntentOptional AttributesName
class(block_object), intent(inout) :: self

Block.

private subroutine correct_metrics(self)

Arguments

Type IntentOptional AttributesName
class(block_object), intent(inout) :: self

Correct the metrics.

private subroutine create_linspace(self, emin, emax)

Create a Cartesian block with linearly spaced nodes.

Arguments

Type IntentOptional AttributesName
class(block_object), intent(inout) :: self

Block.

type(vector), intent(in), optional :: emin

Coordinates of minimum abscissa of the block.

type(vector), intent(in), optional :: emax

Coordinates of maximum abscissa of the block.

private elemental subroutine destroy(self)

Destroy block.

Arguments

Type IntentOptional AttributesName
class(block_object), intent(inout) :: self

Block.

private subroutine initialize(self, signature, id, level, gc, ni, nj, nk, emin, emax, is_cartesian, is_null_x, is_null_y, is_null_z)

Initialize block.

Arguments

Type IntentOptional AttributesName
class(block_object), intent(inout) :: self

Block.

type(block_signature_object), intent(in), optional :: signature

Signature, namely id, level, dimensions, etc…

integer(kind=I8P), intent(in), optional :: id

Unique (Morton) identification code.

integer(kind=I4P), intent(in), optional :: level

Grid refinement level.

integer(kind=I4P), intent(in), optional :: gc(1:)

Number of ghost cells along each frame.

integer(kind=I4P), intent(in), optional :: ni

Number of cells in I direction.

integer(kind=I4P), intent(in), optional :: nj

Number of cells in J direction.

integer(kind=I4P), intent(in), optional :: nk

Number of cells in K direction.

type(vector), intent(in), optional :: emin

Coordinates of minimum abscissa of the block.

type(vector), intent(in), optional :: emax

Coordinates of maximum abscissa of the block.

logical, intent(in), optional :: is_cartesian

Flag for checking if the block is Cartesian.

logical, intent(in), optional :: is_null_x

Nullify X direction (2D yz, 1D y or z domain).

logical, intent(in), optional :: is_null_y

Nullify Y direction (2D xy, 1D x or y domain).

logical, intent(in), optional :: is_null_z

Nullify Z direction (2D xy, 1D x or y domain).

private pure subroutine interpolate_at_nodes(self, var_cell, var_node)

Interpolate cell-centered variable at nodes.

Arguments

Type IntentOptional AttributesName
class(block_object), intent(in) :: self

Block.

real(kind=R8P), intent(in) :: var_cell(1-self%signature%gc(1):,1-self%signature%gc(3):,1-self%signature%gc(5):)

Cell-centered variable.

real(kind=R8P), intent(out) :: var_node(0-self%signature%gc(1):,0-self%signature%gc(3):,0-self%signature%gc(5):)

Node-centered variable.

private subroutine load_nodes_from_file(self, file_unit, pos)

Load nodes from file.

Arguments

Type IntentOptional AttributesName
class(block_object), intent(inout) :: self

Block.

integer(kind=I4P), intent(in) :: file_unit

File unit.

integer(kind=I4P), intent(in) :: pos

Position to start the loading.

private elemental subroutine nullify_normals(self)

Nullify normals for 2D or 1D domains.

Arguments

Type IntentOptional AttributesName
class(block_object), intent(inout) :: self

Block.

private subroutine save_file_grid(self, file_name, ascii, metrics, tecplot, vtk)

Save grid file file.

Arguments

Type IntentOptional AttributesName
class(block_object), intent(inout) :: self

Block.

character(len=*), intent(in) :: file_name

File name.

logical, intent(in), optional :: ascii

Ascii/binary output.

logical, intent(in), optional :: metrics

Save also metrics data.

logical, intent(in), optional :: tecplot

Tecplot output format sentinel.

logical, intent(in), optional :: vtk

VTK output format sentinel.

private subroutine save_file_grid_tec(self, file_name, ascii, metrics)

Save grid file in Tecplot format.

Arguments

Type IntentOptional AttributesName
class(block_object), intent(inout) :: self

Block.

character(len=*), intent(in) :: file_name

Output file name.

logical, intent(in), optional :: ascii

Ascii/binary output.

logical, intent(in), optional :: metrics

Save also metrics data.

private subroutine save_file_grid_vtk(self, file_name, ascii, metrics)

Save mesh data into VTK file.

Arguments

Type IntentOptional AttributesName
class(block_object), intent(inout) :: self

Block.

character(len=*), intent(in) :: file_name

Output file name.

logical, intent(in), optional :: ascii

Ascii/binary output.

logical, intent(in), optional :: metrics

Save also metrics data.

private subroutine save_nodes_into_file(self, file_unit, pos)

Save nodes into file.

Arguments

Type IntentOptional AttributesName
class(block_object), intent(inout) :: self

Block.

integer(kind=I4P), intent(in) :: file_unit

File unit.

integer(kind=I4P), intent(in) :: pos

Position to start the loading.