Initialize block.
Assign block signature, allocate dynamic memory and set block features.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| 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). |
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.
!<
!< Assign block signature, allocate dynamic memory and set block features.
class(block_object), intent(inout) :: self !< Block.
type(block_signature_object), intent(in), optional :: signature !< Signature, namely id, level, dimensions, etc...
integer(I8P), intent(in), optional :: id !< Unique (Morton) identification code.
integer(I4P), intent(in), optional :: level !< Grid refinement level.
integer(I4P), intent(in), optional :: gc(1:) !< Number of ghost cells along each frame.
integer(I4P), intent(in), optional :: ni !< Number of cells in I direction.
integer(I4P), intent(in), optional :: nj !< Number of cells in J direction.
integer(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).
self%error%status = ERROR_BLOCK_CREATE_FAILED
if ((.not.(present(signature))).and.&
(.not.(present(id).and.present(level).and.present(gc).and.present(ni).and.present(nj).and.present(nk)))) then
error stop 'error: either signature or (id, level, gc, ni, nj, nk) tuple must be passed to a block initialized'
endif
call self%destroy
call self%signature%initialize(signature=signature, &
id=id, level=level, gc=gc, ni=ni, nj=nj, nk=nk, &
emin=emin, emax=emax, is_cartesian=is_cartesian, &
is_null_x=is_null_x, is_null_y=is_null_y, is_null_z=is_null_z)
associate(gc_=>self%signature%gc, ni_=>self%signature%ni, nj_=>self%signature%nj, nk_=>self%signature%nk)
allocate(self%cell( 1 - gc_(1) : ni_ + gc_(2), 1 - gc_(3) : nj_ + gc_(4), 1 - gc_(5) : nk_ + gc_(6)))
allocate(self%face_i(0 - gc_(1) : ni_ + gc_(2), 1 - gc_(3) : nj_ + gc_(4), 1 - gc_(5) : nk_ + gc_(6)))
allocate(self%face_j(1 - gc_(1) : ni_ + gc_(2), 0 - gc_(3) : nj_ + gc_(4), 1 - gc_(5) : nk_ + gc_(6)))
allocate(self%face_k(1 - gc_(1) : ni_ + gc_(2), 1 - gc_(3) : nj_ + gc_(4), 0 - gc_(5) : nk_ + gc_(6)))
allocate(self%node( 0 - gc_(1) : ni_ + gc_(2), 0 - gc_(3) : nj_ + gc_(4), 0 - gc_(5) : nk_ + gc_(6)))
endassociate
self%error%status = NO_ERROR
endsubroutine initialize