Skip to content

Commit b2dfcad

Browse files
committed
Make Dirichlet boundary policy explicit
1 parent a80e777 commit b2dfcad

3 files changed

Lines changed: 16 additions & 7 deletions

File tree

src/common/m_boundary_common.fpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,14 @@ module m_boundary_common
3434
contains
3535

3636
!> Allocate and set up boundary condition buffer arrays for all coordinate directions.
37-
impure subroutine s_initialize_boundary_common_module()
37+
impure subroutine s_initialize_boundary_common_module(use_dirichlet_buffers)
3838

39-
integer :: i, j, sys_size_alloc
39+
integer :: i, j, sys_size_alloc
40+
logical, intent(in), optional :: use_dirichlet_buffers
41+
42+
dirichlet_from_buffers = .false.
43+
if (present(use_dirichlet_buffers)) dirichlet_from_buffers = use_dirichlet_buffers
44+
$:GPU_UPDATE(device='[dirichlet_from_buffers]')
4045

4146
@:ALLOCATE(bc_buffers(1:3, 1:2))
4247

src/common/m_boundary_primitives.fpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ module m_boundary_primitives
1818
type(scalar_field), dimension(:,:), allocatable :: bc_buffers
1919
$:GPU_DECLARE(create='[bc_buffers]')
2020

21+
logical :: dirichlet_from_buffers
22+
$:GPU_DECLARE(create='[dirichlet_from_buffers]')
23+
2124
contains
2225

2326
!> Fill ghost cells by copying the nearest boundary cell value along the specified direction.
@@ -904,7 +907,11 @@ contains
904907
integer :: j, i
905908
type(scalar_field), optional, intent(inout) :: q_T_sf
906909

907-
#ifdef MFC_SIMULATION
910+
if (.not. dirichlet_from_buffers) then
911+
call s_ghost_cell_extrapolation(q_prim_vf, bc_dir, bc_loc, k, l, q_T_sf)
912+
return
913+
end if
914+
908915
if (bc_dir == 1) then !< x-direction
909916
if (bc_loc == -1) then ! bc_x%beg
910917
do i = 1, sys_size
@@ -982,9 +989,6 @@ contains
982989
end if
983990
#:endif
984991
end if
985-
#else
986-
call s_ghost_cell_extrapolation(q_prim_vf, bc_dir, bc_loc, k, l, q_T_sf)
987-
#endif
988992

989993
end subroutine s_dirichlet
990994

src/simulation/m_start_up.fpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -845,7 +845,7 @@ contains
845845
call s_initialize_derived_variables_module()
846846
call s_initialize_time_steppers_module()
847847

848-
call s_initialize_boundary_common_module()
848+
call s_initialize_boundary_common_module(use_dirichlet_buffers=.true.)
849849

850850
if (down_sample) then
851851
m_ds = int((m + 1)/3) - 1

0 commit comments

Comments
 (0)