boundary conditions
Boundary conditions are supplied by the user-defined application. However,
the driver provides utilities to simplify the implementation of
penalty-like boundary conditions.
The user-defined application must include four routines for implementing
boundary conditions:
- hyperboundary :
Header: subroutine hyperboundary(u, dxu, dyu, dzu, udot, v, w, imask, par)
type(gridfunction), dimension(NU), intent(inout) :: u, dxu,dyu,dzu,udot
type(gridfunction), dimension(NV) :: v
type(gridfunction), dimension(NW) :: w
CCTK_REAL, dimension(:) :: par
CCTK_INT, dimension(:,:,:) :: imask
- prim2char
Header: subroutine prim2char(par,v,w,direction,u,w_in,w_out,w_0,T,uevolved,uexact,dxu,dyu,dzu,sources)
CCTK_REAL, dimension(:), intent(in) :: par
CCTK_REAL, dimension(:), intent(in) :: w,v
character(len=*), intent(in):: direction
CCTK_REAL, dimension(:), intent(in) :: u,uevolved,uexact,dxu,dyu,dzu
CCTK_REAL, dimension(:), intent(out) :: w_in, w_out
CCTK_REAL, dimension(:), intent(out) :: sources
CCTK_REAL, dimension(:), intent(out) :: w_0
CCTK_REAL, dimension(3):: n_down
CCTK_REAL, dimension(3,3) :: T
- char2prim
Header: subroutine char2prim(par,v,w,direction,u,w_in,w_out,w_0,T,uevolved,uexact)
CCTK_REAL, dimension(:), intent(in) :: par
CCTK_REAL, dimension(:), intent(in):: w,uevolved,uexact,v
character(len=*), intent(in):: direction
CCTK_REAL, dimension(:), intent(out) :: u
CCTK_REAL, dimension(:), intent(in) :: w_in, w_out
CCTK_REAL, dimension(:), intent(in) :: w_0
CCTK_REAL, dimension(3) :: n_down
CCTK_REAL, dimension(3,3) :: T
- exactu
If the user-defined application is not using characteristic decomposition
for the boundaries ( like that needed for maximally dissipative boundary conditions ), routines prim2char and char2prim can be
left blank. Otherwise, the characteristic decomposition for the user defined
equation set will need to be specified in routines prim2char and char2prim.
Routine hyperboundary is the routine where user-defined boundary
conditions can be defined. Memory pointers to the ufuncs, time and spatial derivaties of the ufuncs,
vfuncs,
wfuncs,
imask ( for excision ),
and all parameters
are passed into the hyperboundary routine.
Parameters that may be useful for implementing boundary conditions:
- boundary_conditions: this parameter is used in controlling the
type of penalty method boundary condition used ( if any ).
To use these boundary conditions, the user must supply the characteristic
decomposition for the user-defined application equations in the routines
prim2char and char2prim. The user must also explicitly call
the function char_boundary in the user-supplied hyperboundary routine.
boundary_conditions = 1 --> Boundary conditions to the incoming characteristic variables
boundary_conditions = 2 --> Boundary conditions to the incoming characteristic variables (nonlinear principal part)
boundary_conditions = 3 --> Penalty boundary (maximally dissipative)
If boundary_conditions = 3 then another tuning parameter must also be set: penalty = 0.0 (default). Usually, penalty = ~1.0
boundary_conditions = 4 --> Carpenter boundary (penalty method)
boundary_conditions = 5 --> Olson's boundary (maximally dissipative)
boundary_conditions = 7 --> Constraint preserving boundary condition (incomplete)
boundary_conditions = 8 --> Constraint preserving boundary condition (incomplete)
When parameter runge_kutta_type = 1 or runge_kutta_type = 3, that is, when using
standard rk3 integration or rk3tvd for finite volumes, the parameter
boundary_conditions also controls when the routine hyperboundary
is called.
For runge_kutta_type = 1 or runge_kutta_type = 3:
hyperboundary is called just before the
rk3 update if boundary_conditions > 2 and boundary_conditions ≠ 8
hyperboundary is called just after the
rk3 update if boundary_conditions = 8
hyperboundary is called at the start of each rk3 iteration
if boundary_conditions = 1,2,7
For runge_kutta_type = 2 (rk3tvd), see parameter runge_kutta_bound.
- runge_kutta_bound: this parameter is set by the driver
in rk3tvd. It is only used when parameter runge_kutta_type = 2.
It has a value of either 1 or 2.
Certain boundary conditions need to be applied,
either just before or after the rk3 update. This parameter gives the
freedom to the user to specify when the boundary condition should be applied.
If runge_kutta_bound is 1, hyperboundary is called just prior
to an rk3 update--after the time and spatial derivatives necessary
for the rk3 update have been calculated but before the actual update.
If runge_kutta_bound is 2, hyperboundary is called
just after the rk3 update.
For example, if one wanted a certain boundary condition applied just before
an rk3 update, write something like this in hyperboundary:
if (nint(par(P_RUNGE_KUTTA_BOUND)) == 1) then
call my_own_boundary_condition()
end if
Continuing the example, if one wanted a certain boundary condition applied just after
an rk3 update, write something like this in hyperboundary:
if (nint(par(P_RUNGE_KUTTA_BOUND)) == 2) then
call my_own_boundary_condition2()
end if
- bc_type: this parameter is deprecated. It is active only when
runge_kutta_type = 1,3 and when bc_type = 3. It is used only for testing
and debugging purposes.
Multiple example routines are provided in "had/src/hyper" which may assist the user in
developing
their own boundary conditions. These include:
- outflow_boundary
- fixed_boundary
- PWN2D_boundary
- PWN3D_boundary
Notes
- Modifications to the scheduling of the boundary condition are trivial to make.
Simply modify when the call to hyperboundary is made in the integration scheme
in "had/src/hyper".
See Also
runge_kutta_type,
inner_bound_data,
exactu,
List of required routines
Index of all manual pages
Examples
An example of hyperboundary is found in
had/src/hyperCurvedWave/boundary.f90
An example of prim2char and char2prim is found in
had/src/hyperCurvedWave/charvars.f90