Skip to content

Commit dcde7a1

Browse files
committed
update BC enumeration
1 parent 03c9c66 commit dcde7a1

18 files changed

+266
-227
lines changed

src/common/m_boundary_common.fpp

Lines changed: 94 additions & 88 deletions
Large diffs are not rendered by default.

src/common/m_checker_common.fpp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,8 @@ contains
224224
#:for BOUND in ['beg', 'end']
225225
@:PROHIBIT(${VAR}$ == 0 .and. bc_${X}$%${BOUND}$ /= dflt_int, "bc_${X}$%${BOUND}$ is not supported for ${VAR}$ = 0")
226226
@:PROHIBIT(${VAR}$ > 0 .and. bc_${X}$%${BOUND}$ == dflt_int, "${VAR}$ != 0 but bc_${X}$%${BOUND}$ is not set")
227-
@:PROHIBIT((bc_${X}$%beg == -1 .and. bc_${X}$%end /= -1) .or. &
228-
(bc_${X}$%end == -1 .and. bc_${X}$%beg /= -1), &
227+
@:PROHIBIT((bc_${X}$%beg == BC_PERIODIC .and. bc_${X}$%end /= BC_PERIODIC) .or. &
228+
(bc_${X}$%end == BC_PERIODIC .and. bc_${X}$%beg /= BC_PERIODIC), &
229229
"bc_${X}$%beg and bc_${X}$%end must be both periodic (= -1) or both non-periodic")
230230

231231
! For cylindrical coordinates, y and z directions use a different check
@@ -236,31 +236,31 @@ contains
236236
#:endif
237237

238238
if (.not. skip_check) then
239-
@:PROHIBIT(bc_${X}$%${BOUND}$ /= dflt_int .and. (bc_${X}$%${BOUND}$ > -1 .or. bc_${X}$%${BOUND}$ < -17), &
239+
@:PROHIBIT(bc_${X}$%${BOUND}$ /= dflt_int .and. (bc_${X}$%${BOUND}$ > -1 .or. bc_${X}$%${BOUND}$ < BC_DIRICHLET), &
240240
"bc_${X}$%${BOUND}$ must be between -1 and -17")
241241

242-
@:PROHIBIT(bc_${X}$%${BOUND}$ /= dflt_int .and. bc_${X}$%${BOUND}$ == -14, &
242+
@:PROHIBIT(bc_${X}$%${BOUND}$ /= dflt_int .and. bc_${X}$%${BOUND}$ == BC_AXIS, &
243243
"bc_${X}$%${BOUND}$ must not be -14 for non-cylindrical coordinates")
244244
end if
245245

246246
#:endfor
247247
#:endfor
248248

249-
@:PROHIBIT(any((/bc_x%beg, bc_x%end, bc_y%beg, bc_y%end, bc_z%beg, bc_z%end/) == -13), &
249+
@:PROHIBIT(any((/bc_x%beg, bc_x%end, bc_y%beg, bc_y%end, bc_z%beg, bc_z%end/) == BC_NULL), &
250250
"Boundary condition -13 is not supported")
251251

252252
! Check for y and z directions for cylindrical coordinates
253253
@: PROHIBIT(cyl_coord .and. n == 0, "n must be positive (2D or 3D) for cylindrical coordinates")
254-
@: PROHIBIT(cyl_coord .and. p == 0 .and. bc_y%beg /= -2, "bc_y%beg must be -2 for 2D cylindrical coordinates (p = 0)")
255-
@: PROHIBIT(cyl_coord .and. p > 0 .and. bc_y%beg /= -14, "bc_y%beg must be -14 for 3D cylindrical coordinates (p > 0)")
256-
@: PROHIBIT(cyl_coord .and. (bc_y%end > -1 .or. bc_y%end < -17), "bc_y%end must be between -1 and -17")
257-
@: PROHIBIT(cyl_coord .and. bc_y%end == -14, "bc_y%end must not be -14")
254+
@: PROHIBIT(cyl_coord .and. p == 0 .and. bc_y%beg /= BC_REFLECTIVE, "bc_y%beg must be -2 for 2D cylindrical coordinates (p = 0)")
255+
@: PROHIBIT(cyl_coord .and. p > 0 .and. bc_y%beg /= BC_AXIS, "bc_y%beg must be -14 for 3D cylindrical coordinates (p > 0)")
256+
@: PROHIBIT(cyl_coord .and. (bc_y%end > BC_PERIODIC .or. bc_y%end < BC_DIRICHLET), "bc_y%end must be between -1 and -17")
257+
@: PROHIBIT(cyl_coord .and. bc_y%end == BC_AXIS, "bc_y%end must not be -14")
258258

259259
! Check for y and z directions for 3D cylindrical coordinates
260-
@: PROHIBIT(cyl_coord .and. p > 0 .and. (bc_z%beg /= -1 .and. bc_z%beg /= -2), &
260+
@: PROHIBIT(cyl_coord .and. p > 0 .and. (bc_z%beg /= BC_PERIODIC .and. bc_z%beg /= BC_REFLECTIVE), &
261261
"bc_z%beg must be -1 or -2 for 3D cylindrical coordinates")
262262

263-
@: PROHIBIT(cyl_coord .and. p > 0 .and. (bc_z%end /= -1 .and. bc_z%end /= -2), &
263+
@: PROHIBIT(cyl_coord .and. p > 0 .and. (bc_z%end /= BC_PERIODIC .and. bc_z%end /= BC_REFLECTIVE), &
264264
"bc_z%end must be -1 or -2 for 3D cylindrical coordinates")
265265

266266
#ifndef MFC_POST_PROCESS
@@ -348,13 +348,13 @@ contains
348348
subroutine s_check_inputs_moving_bc
349349
#:for X, VB2, VB3 in [('x', 'vb2', 'vb3'), ('y', 'vb3', 'vb1'), ('z', 'vb1', 'vb2')]
350350
if (any((/bc_${X}$%vb1, bc_${X}$%vb2, bc_${X}$%vb3/) /= 0._wp)) then
351-
if (bc_${X}$%beg == -15) then
351+
if (bc_${X}$%beg == BC_SLIP_WALL) then
352352
if (any((/bc_${X}$%${VB2}$, bc_${X}$%${VB3}$/) /= 0._wp)) then
353353
call s_mpi_abort("bc_${X}$%beg must be -15 if "// &
354354
"bc_${X}$%${VB2}$ or bc_${X}$%${VB3}$ "// &
355355
"is set. Exiting.", CASE_FILE_ERROR_CODE)
356356
end if
357-
elseif (bc_${X}$%beg /= -16) then
357+
elseif (bc_${X}$%beg /= BC_NO_SLIP_WALL) then
358358
call s_mpi_abort("bc_${X}$%beg must be -15 or -16 if "// &
359359
"bc_${X}$%vb[1,2,3] is set. Exiting.", CASE_FILE_ERROR_CODE)
360360
end if
@@ -363,13 +363,13 @@ contains
363363

364364
#:for X, VE2, VE3 in [('x', 've2', 've3'), ('y', 've3', 've1'), ('z', 've1', 've2')]
365365
if (any((/bc_${X}$%ve1, bc_${X}$%ve2, bc_${X}$%ve3/) /= 0._wp)) then
366-
if (bc_${X}$%end == -15) then
366+
if (bc_${X}$%end == BC_SLIP_WALL) then
367367
if (any((/bc_${X}$%${VE2}$, bc_${X}$%${VE3}$/) /= 0._wp)) then
368368
call s_mpi_abort("bc_${X}$%end must be -15 if "// &
369369
"bc_${X}$%${VE2}$ or bc_${X}$%${VE3}$ "// &
370370
"is set. Exiting.", CASE_FILE_ERROR_CODE)
371371
end if
372-
elseif (bc_${X}$%end /= -16) then
372+
elseif (bc_${X}$%end /= BC_NO_SLIP_WALL) then
373373
call s_mpi_abort("bc_${X}$%end must be -15 or -16 if "// &
374374
"bc_${X}$%ve[1,2,3] is set. Exiting.", CASE_FILE_ERROR_CODE)
375375
end if

src/common/m_constants.fpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,30 @@ module m_constants
8585
! System constants
8686
integer, parameter :: CASE_FILE_ERROR_CODE = 22
8787

88+
! Boundary condition enumeration
89+
! Abbreviations
90+
! CHAR - Characteristic
91+
! NR - Non-reflecting
92+
! SUB - subsonic
93+
! SUP - supersonic
94+
! FF - Force-free
95+
! CP - Constant pressure
96+
integer, parameter :: BC_PERIODIC = -1
97+
integer, parameter :: BC_REFLECTIVE = -2
98+
integer, parameter :: BC_GHOST_EXTRAP = -3
99+
integer, parameter :: BC_RIEMANN_EXTRAP = -4
100+
integer, parameter :: BC_CHAR_SLIP_WALL = -5
101+
integer, parameter :: BC_CHAR_NR_SUB_BUFFER = -6
102+
integer, parameter :: BC_CHAR_NR_SUB_INFLOW = -7
103+
integer, parameter :: BC_CHAR_NR_SUB_OUTFLOW = -8
104+
integer, parameter :: BC_CHAR_FF_SUB_OUTFLOW = -9
105+
integer, parameter :: BC_CHAR_CP_SUB_OUTFLOW = -10
106+
integer, parameter :: BC_CHAR_SUP_INFLOW = -11
107+
integer, parameter :: BC_CHAR_SUP_OUTFLOW = -12
108+
integer, parameter :: BC_NULL = -13
109+
integer, parameter :: BC_AXIS = -14
110+
integer, parameter :: BC_SLIP_WALL = -15
111+
integer, parameter :: BC_NO_SLIP_WALL = -16
112+
integer, parameter :: BC_DIRICHLET = -17
113+
88114
end module m_constants

0 commit comments

Comments
 (0)