leapBC Module

Defines and manages boundary conditions. Current limitations: - Supports only second order schemes. - Neumann BC assume gradient=0. - Symmetry BC are not implemented yet.

These limitations will be lifted as the need arises.


Uses

  • module~~leapbc~~UsesGraph module~leapbc leapBC module~leapblock leapBlock module~leapbc->module~leapblock module~leapeulerian leapEulerian module~leapbc->module~leapeulerian module~leapkinds leapKinds module~leapbc->module~leapkinds module~leapparallel leapParallel module~leapbc->module~leapparallel module~leaputils leapUtils module~leapbc->module~leaputils mpi_f08 mpi_f08 module~leapbc->mpi_f08 module~leapblock->module~leapkinds module~leapblock->module~leapparallel module~leapblock->mpi_f08 module~leapeulerian->module~leapblock module~leapeulerian->module~leapkinds module~leapeulerian->module~leapparallel module~leapeulerian->module~leaputils module~leapeulerian->mpi_f08 module~leapio leapIO module~leapeulerian->module~leapio module~leapio_mpi leapIO_mpi module~leapeulerian->module~leapio_mpi module~leapparser leapParser module~leapeulerian->module~leapparser iso_fortran_env iso_fortran_env module~leapkinds->iso_fortran_env module~leapparallel->module~leapkinds module~leapparallel->mpi_f08 module~leapparallel->module~leapparser module~leaputils->module~leapkinds module~leaputils->mpi_f08 module~leapio->module~leapio_mpi module~leapio_h5hut leapIO_h5hut module~leapio->module~leapio_h5hut module~leapio_hdf5 leapIO_hdf5 module~leapio->module~leapio_hdf5 module~leapio_silo leapIO_silo module~leapio->module~leapio_silo module~leapio_mpi->module~leapblock module~leapio_mpi->module~leapkinds module~leapio_mpi->module~leapparallel module~leapio_mpi->mpi_f08 module~leapparser->module~leapkinds module~leapcli leapCli module~leapparser->module~leapcli module~leapcli->module~leapkinds module~leapio_h5hut->module~leapkinds module~leapio_h5hut->module~leapparallel h5hut h5hut module~leapio_h5hut->h5hut module~leapio_hdf5->module~leapkinds module~leapio_hdf5->module~leapparallel module~leapio_hdf5->module~leaputils hdf5 hdf5 module~leapio_hdf5->hdf5 module~leapio_silo->module~leapblock module~leapio_silo->module~leapkinds module~leapio_silo->module~leapparallel module~leapio_silo->module~leaputils module~leapio_silo->mpi_f08

Used by

  • module~~leapbc~~UsedByGraph module~leapbc leapBC module~cdifs cdifs module~cdifs->module~leapbc module~leapdiffop leapDiffOp module~cdifs->module~leapdiffop module~particles_resolved particles_resolved module~cdifs->module~particles_resolved module~immersed_boundaries immersed_boundaries module~cdifs->module~immersed_boundaries module~leapdiffop->module~leapbc proc~cdifs_channel_flow_bcs cdifs_channel_flow_bcs proc~cdifs_channel_flow_bcs->module~leapbc proc~cdifs_cylinder_bcs cdifs_cylinder_bcs proc~cdifs_cylinder_bcs->module~leapbc proc~cdifs_lamb_oseen_bcs cdifs_lamb_oseen_bcs proc~cdifs_lamb_oseen_bcs->module~leapbc proc~cdifs_lid_driven_cavity_bcs cdifs_lid_driven_cavity_bcs proc~cdifs_lid_driven_cavity_bcs->module~leapbc proc~cdifs_obj_preparesolveroperators cdifs_obj_PrepareSolverOperators proc~cdifs_obj_preparesolveroperators->module~leapbc proc~cdifs_obj_preparesolveroperatorsdiv cdifs_obj_PrepareSolverOperatorsDIV proc~cdifs_obj_preparesolveroperatorsdiv->module~leapbc proc~cdifs_obj_preparesolveroperatorspgrad cdifs_obj_PrepareSolverOperatorsPGRAD proc~cdifs_obj_preparesolveroperatorspgrad->module~leapbc proc~cdifs_obj_preparesolveroperatorsvlap cdifs_obj_PrepareSolverOperatorsVLAP proc~cdifs_obj_preparesolveroperatorsvlap->module~leapbc proc~cdifs_rebound_bcs cdifs_rebound_bcs proc~cdifs_rebound_bcs->module~leapbc proc~cdifs_settling_sphere_bcs cdifs_settling_sphere_bcs proc~cdifs_settling_sphere_bcs->module~leapbc proc~cdifs_taylor_green_bcs cdifs_taylor_green_bcs proc~cdifs_taylor_green_bcs->module~leapbc proc~cdifs_vortex_dipole_bcs cdifs_vortex_dipole_bcs proc~cdifs_vortex_dipole_bcs->module~leapbc proc~cdifs_vortex_impingement_bcs cdifs_vortex_impingement_bcs proc~cdifs_vortex_impingement_bcs->module~leapbc proc~op_obj_applylaplaciandc op_obj%op_obj_ApplyLaplacianDC proc~op_obj_applylaplaciandc->module~leapbc module~cdifs_advancesolution_smod cdifs_AdvanceSolution_smod module~cdifs_advancesolution_smod->module~cdifs module~cdifs_monitor_smod cdifs_Monitor_smod module~cdifs_monitor_smod->module~cdifs module~cdifs_preparesolver_smod cdifs_PrepareSolver_smod module~cdifs_preparesolver_smod->module~cdifs module~cdifs_writeoutputdata_smod cdifs_WriteOutputData_smod module~cdifs_writeoutputdata_smod->module~cdifs module~cdifs_writerestartdata_smod cdifs_WriteRestartData_smod module~cdifs_writerestartdata_smod->module~cdifs module~immersed_boundaries_markers immersed_boundaries_markers module~immersed_boundaries_markers->module~leapdiffop module~particles_resolved->module~leapdiffop module~particles_resolved->module~immersed_boundaries proc~grans_obj_preparesolver_operators grans_obj_PrepareSolver_operators proc~grans_obj_preparesolver_operators->module~leapdiffop proc~marker_set_computesolidvolfrac marker_set%marker_set_ComputeSolidVolFrac proc~marker_set_computesolidvolfrac->module~leapdiffop program~main main program~main->module~cdifs module~grans grans program~main->module~grans module~grans->module~particles_resolved module~grans_cases grans_cases module~grans->module~grans_cases module~grans->module~immersed_boundaries module~grans_cases->module~particles_resolved module~grans_cases->module~immersed_boundaries module~immersed_boundaries->module~immersed_boundaries_markers module~immersed_boundaries_solids immersed_boundaries_solids module~immersed_boundaries->module~immersed_boundaries_solids module~immersed_boundaries_solids->module~immersed_boundaries_markers proc~add_markers add_markers proc~add_markers->module~particles_resolved proc~add_markers->module~immersed_boundaries proc~add_markers~2 add_markers proc~add_markers~2->module~particles_resolved proc~add_markers~2->module~immersed_boundaries proc~cdifs_rebound_respart cdifs_rebound_ResPart proc~cdifs_rebound_respart->module~particles_resolved proc~cdifs_settling_sphere_respart cdifs_settling_sphere_ResPart proc~cdifs_settling_sphere_respart->module~particles_resolved module~grans_advancesolution_smod grans_AdvanceSolution_smod module~grans_advancesolution_smod->module~grans module~grans_module_smod grans_module_smod module~grans_module_smod->module~grans module~grans_preparesolver_smod grans_PrepareSolver_smod module~grans_preparesolver_smod->module~grans module~grans_writeoutputdata_smod grans_WriteOutputData_smod module~grans_writeoutputdata_smod->module~grans module~grans_writerestartdata_smod grans_WriteRestartData_smod module~grans_writerestartdata_smod->module~grans module~headon_collision_smod headon_collision_smod module~headon_collision_smod->module~grans_cases module~homogeneous_cooling_smod homogeneous_cooling_smod module~homogeneous_cooling_smod->module~grans_cases module~rotating_drum_smod rotating_drum_smod module~rotating_drum_smod->module~grans_cases proc~cdifs_cylinder_ib cdifs_cylinder_IB proc~cdifs_cylinder_ib->module~immersed_boundaries proc~cdifs_rebound_ib cdifs_rebound_IB proc~cdifs_rebound_ib->module~immersed_boundaries proc~cdifs_settling_sphere_ib cdifs_settling_sphere_IB proc~cdifs_settling_sphere_ib->module~immersed_boundaries

Variables

Type Visibility Attributes Name Initial
integer, public, parameter :: BC_DIRICHLET = 4
integer, public, parameter :: BC_INFLOW = 2
integer, public, parameter :: BC_NEUMANN = 5
integer, public, parameter :: BC_OUTFLOW = 3
integer, public, parameter :: BC_SYMMETRY = 7
integer, public, parameter :: BC_WALL = 1
integer, private, parameter :: BC_LEFT = 0
integer, private, parameter :: BC_RIGHT = 1
integer, private, parameter :: BC_SET_HTBL_SIZE = 20
integer, private, parameter :: BC_UNDEFINED = 0

Derived Types

type, public ::  bc_set

Collection of regions

Components

Type Visibility Attributes Name Initial
type(block_obj), public, pointer :: block => null()

Associated block structure

integer, public :: count = 0

Total number of regions across all MPI ranks

type(parallel_obj), public, pointer :: parallel => null()

Associated parallel structure

type(region_obj), public, allocatable :: region(:)

Array of regions

type(hashtbl_obj), private :: tbl

Hash table

Type-Bound Procedures

procedure, public :: Add => bc_set_Add
procedure, public :: BuildMask => bc_set_BuildMask
procedure, public :: CheckBCExists => bc_set_CheckBCExists
procedure, public, nopass :: CheckBounds => bc_set_CheckBounds
procedure, public :: Expand => bc_set_Expand
procedure, public :: Finalize => bc_set_Final
procedure, public :: GetBCPointer => bc_set_GetBCPointer
procedure, public :: GetBCType => bc_set_GetBCType
procedure, public :: GetExtents => bc_set_GetExtents
procedure, public :: GetRegionIndex => bc_set_GetRegionIndex
procedure, public :: GetSideDirByNormal => bc_set_GetSideDirByNormal
procedure, public :: GetSideDirByRegion => bc_set_GetSideDirByRegion
procedure, public :: Info => bc_set_Info
procedure, public :: Initialize => bc_set_Init
procedure, public :: Read => bc_set_Read
procedure, public :: SetBC => bc_set_SetBC
procedure, public :: UpdateBoundary => bc_set_UpdateBoundary
procedure, public :: UpdateBoundaryDirichlet => bc_set_UpdateBoundaryDirichlet
procedure, public :: UpdateBoundaryNeumann => bc_set_UpdateBoundaryNeumann
procedure, public :: UpdateExtents => bc_set_UpdateExtents
procedure, public :: Write => bc_set_Write

type, public ::  extent_obj

Extents of a region

Components

Type Visibility Attributes Name Initial
integer, public :: hi(3) = -1

High bound

integer, public :: lo(3) = -1

Low bound

type, private ::  bc_obj

Specified a boundary condition for a variable The BC type can be among the predefined types (BC_WALL, BC_INFLOW, etc). Val(:,:,:) stores the imposed values for BC_DIRICHLET, or the gradient in the normal for direction for BC_NEUMANN. Be mindful of staggering: E.g. if the variable is cell-centered (e.g. P) and the BC is on BC_LEFT in the 1-DIR, then val(i,j,k) is on x(i),ym(j),zm(k). For a face-centered variable like V (on xm(i),y(j), zm(k)) if the BC is on BC_LEFT in the 1-DIR, then val(i,j,k) is on x(i),y(j),zm(k).

Components

Type Visibility Attributes Name Initial
character(len=str8), public :: name

Name of variable

integer, public :: type = BC_UNDEFINED

Type of BC

real(kind=wp), public, pointer :: val(:,:,:)

Values on the parent region

type, private ::  region_obj

Defines regions where boundary conditions are applied. Regions must be 2D planes in 3D simulations, defined by their extent xlo, xhi, and the normal to the plane (which gives side and dir) E.g.: a region with normal '+x1' (dir=1,side=BC_LEFT) looks like this:

Read more…

Components

Type Visibility Attributes Name Initial
type(bc_obj), public, allocatable :: BC(:)

Variables on this region

integer, public :: count = 0

Count of variables defined on this region

integer, public :: dir

Normal direction (=1,2,3)

integer, public :: hi(3) = -100

Grid hi bound

integer, public :: lo(3) = -100

Grid low bound

character(len=:), public, allocatable :: name

Name of this region

type(block_obj), public :: region

Block/grid for this region

integer, public :: side

Side (BC_LEFT or BC_RIGHT)

real(kind=wp), public :: xhi(3)

Position of upper right corner

real(kind=wp), public :: xlo(3)

Position of lower left corner

type(hashtbl_obj), private :: tbl

Hash table

Type-Bound Procedures

procedure, public :: Add => region_obj_Add
procedure, public :: Expand => region_obj_Expand
procedure, public :: Finalize => region_obj_Final
procedure, public :: GetBCIndex => region_obj_GetBCIndex
procedure, public :: Initialize => region_obj_Init

Functions

private pure function bc_set_CheckBCExists(this, region, var) result(val)

Check whether there is BC for a given variable on a given region

Arguments

Type IntentOptional Attributes Name
class(bc_set), intent(in) :: this

Boundary conditions

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

Region name

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

Variable name

Return Value logical

private pure function bc_set_CheckBounds(xlo, xhi) result(val)

Make sure bounds represent a plane

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: xlo(3)

Lower left corner

real(kind=wp), intent(in) :: xhi(3)

Upper right corner

Return Value logical

True, if bounds represent a plane

private pure function bc_set_GetBCType(this, region, var) result(val)

Arguments

Type IntentOptional Attributes Name
class(bc_set), intent(in) :: this

Boundary conditions

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

Region name

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

Variable name

Return Value integer

private pure function bc_set_GetExtents(this, name) result(extents)

Returns the extents (lo and hi bounds) of a region.

Arguments

Type IntentOptional Attributes Name
class(bc_set), intent(in) :: this

Boundary conditions

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

Region name

Return Value type(extent_obj)

private pure function bc_set_GetRegionIndex(this, name) result(val)

Returns the index of a region, or -1 if not found.

Arguments

Type IntentOptional Attributes Name
class(bc_set), intent(in) :: this

Boundary conditions

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

Region name

Return Value integer

private pure function region_obj_GetBCIndex(this, name) result(val)

Returns index of a variable in this region, or -1 if not found.

Arguments

Type IntentOptional Attributes Name
class(region_obj), intent(in) :: this

A Region

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

Name of region

Return Value integer


Subroutines

private impure subroutine bc_set_Add(this, name, xlo, xhi, normal)

Add a new region to bc_set

Arguments

Type IntentOptional Attributes Name
class(bc_set), intent(inout) :: this

Boundary conditions

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

Name of region

real(kind=wp), intent(in) :: xlo(3)

Position of lower left corner

real(kind=wp), intent(in) :: xhi(3)

Position of upper right corner

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

Oriented normal

private impure subroutine bc_set_BuildMask(this, name, mask)

Build an integer field, where cells=0 denotes interior cells, and cells=1 denotes boundary cells for input variable

Arguments

Type IntentOptional Attributes Name
class(bc_set), intent(in) :: this

Boundary conditions

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

Name of the variable

type(eulerian_obj_i), intent(inout) :: mask

Mask for this variable

private pure subroutine bc_set_Expand(this)

Resize array to accomodate a new element

Arguments

Type IntentOptional Attributes Name
class(bc_set), intent(inout) :: this

Boundary conditions

private pure subroutine bc_set_Final(this)

Finalizes bc_set

Arguments

Type IntentOptional Attributes Name
class(bc_set), intent(inout) :: this

Boundary conditions

private impure subroutine bc_set_GetBCPointer(this, region, var, val)

Fetches a pointer to the val array describing the Dirichlet or Neumann BC of a given variable on a given region.

Arguments

Type IntentOptional Attributes Name
class(bc_set), intent(in) :: this

Boundary conditions

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

Region name

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

Variable name

real(kind=wp), intent(inout), pointer :: val(:,:,:)

Pointer

private impure subroutine bc_set_GetSideDirByNormal(this, normal, side, dir)

Arguments

Type IntentOptional Attributes Name
class(bc_set), intent(in) :: this

Boundary conditions

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

String denoting the normal direction

integer, intent(out) :: side

Side (=BC_LEFT,BC_RIGHT)

integer, intent(out) :: dir

Direction (=1,2,3,)

private pure subroutine bc_set_GetSideDirByRegion(this, region, side, dir)

Arguments

Type IntentOptional Attributes Name
class(bc_set), intent(in) :: this

Boundary conditions

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

Region name

integer, intent(out) :: side

Side (=BC_LEFT,BC_RIGHT)

integer, intent(out) :: dir

Direction (=1,2,3,)

private impure subroutine bc_set_Info(this)

Print to stdout information on bc_set, for debugging

Arguments

Type IntentOptional Attributes Name
class(bc_set), intent(inout) :: this

Boundary conditions

private impure subroutine bc_set_Init(this, block, parallel)

Initializes bc_set

Arguments

Type IntentOptional Attributes Name
class(bc_set), intent(inout) :: this

Boundary conditions

type(block_obj), intent(in), target :: block

A block object

type(parallel_obj), intent(in), target :: parallel

parallel structure from main program

private impure subroutine bc_set_Read(this, iter, time, name)

Read boundary conditions from file

Arguments

Type IntentOptional Attributes Name
class(bc_set), intent(inout) :: this

Boundary conditions

integer, intent(out) :: iter

Iteration read from file

real(kind=wp), intent(out) :: time

Time read from file

character(len=*), intent(in), optional :: name

Name of file to read

private impure subroutine bc_set_SetBC(this, region, type, var)

Set boundary condition of a given type, for a given variable on a given region.

Arguments

Type IntentOptional Attributes Name
class(bc_set), intent(inout) :: this

Boundary conditions

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

Region name

integer, intent(in) :: type

BC type

character(len=*), intent(in), optional :: var

Variable name

private impure subroutine bc_set_UpdateBoundary(this, var)

Imposes boundary conditions for a given variable.

Arguments

Type IntentOptional Attributes Name
class(bc_set), intent(in) :: this

Boundary conditions

type(eulerian_obj_r), intent(inout) :: var

Eulerian variable

private impure subroutine bc_set_UpdateBoundaryDirichlet(this, region, var)

Update ghostboundaries to enforce Dirichlet BC

Arguments

Type IntentOptional Attributes Name
class(bc_set), intent(in) :: this

Boundary conditions

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

Region name

type(eulerian_obj_r), intent(inout) :: var

Eulerian variable

private impure subroutine bc_set_UpdateBoundaryNeumann(this, region, var)

Update ghostboundaries to enforce Neumann BC

Arguments

Type IntentOptional Attributes Name
class(bc_set), intent(in) :: this

Boundary conditions

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

Region name

type(eulerian_obj_r), intent(inout) :: var

Eulerian variable

private pure subroutine bc_set_UpdateExtents(this, name)

Finds the intersection between block owned by this MPI rank, and the plane defining the region

Arguments

Type IntentOptional Attributes Name
class(bc_set), intent(inout) :: this

Boundary conditions

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

Region name

private impure subroutine bc_set_Write(this, iter, time, name)

Write bc_set to disk using HDF5. The file structure follows this convention: / (root) !-- Time !-- Iter !-- Region 1 !-- xlo !-- xhi !-- dir !-- side |-- Var 1 |-- Type |-- Values(:,:,:) !-- Var 2 . . !-- Region 2 . .

Arguments

Type IntentOptional Attributes Name
class(bc_set), intent(inout) :: this

Boundary conditions

integer, intent(in) :: iter

Iteration at write

real(kind=wp), intent(in) :: time

Time at write

character(len=*), intent(in), optional :: name

Name of file to write

private pure subroutine region_obj_Add(this, name, type, extents)

Adds a new variable to region

Arguments

Type IntentOptional Attributes Name
class(region_obj), intent(inout) :: this

A Region

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

Region name

integer, intent(in) :: type

BC type

type(extent_obj), intent(in) :: extents

Region extents

private pure subroutine region_obj_Expand(this)

Resize array to accomodate a new element

Arguments

Type IntentOptional Attributes Name
class(region_obj), intent(inout) :: this

A Region

private pure subroutine region_obj_Final(this)

Arguments

Type IntentOptional Attributes Name
class(region_obj), intent(inout) :: this

A Region

private pure subroutine region_obj_Init(this, name, xlo, xhi, dir, side)

Initializes a region

Arguments

Type IntentOptional Attributes Name
class(region_obj), intent(inout) :: this

A Region

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

Name of region

real(kind=wp), intent(in) :: xlo(3)

Position of low left corner

real(kind=wp), intent(in) :: xhi(3)

Position of high right corner

integer, intent(in) :: dir

Direction of normal

integer, intent(in) :: side

Side (left or right) of the cell