Skip to content

Commit

Permalink
Merge pull request #213 from wilfonba/boundaryConditionsRefactor
Browse files Browse the repository at this point in the history
  • Loading branch information
sbryngelson authored Sep 21, 2023
2 parents a1e6f55 + a21d9ac commit 38ef7b9
Show file tree
Hide file tree
Showing 55 changed files with 3,051 additions and 1,114 deletions.
7 changes: 6 additions & 1 deletion docs/documentation/case.md
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,12 @@ The table lists velocity field parameters. The parameters are optionally used to
| -10 | Characteristic | Constant pressure subsonic outflow |
| -11 | Characteristic | Supersonic inflow |
| -12 | Characteristic | Supersonic outflow |

| -14 | Normal | Axis * |
| -15 | Normal | Slip wall |
| -16 | Normal | No-slip wall |

*: This boundary condition is only used for `bc_y%beg` when using cylindrical coordinates (`cyl_coord = 'T'` and 3d). For axisymmetric problems, use `bc_y%beg = -2` with `cyl_coord = 'T'` in 2D.

The boundary condition supported by the MFC are listed in table [Boundary Conditions](#boundary-conditions). Their number (`#`)
corresponds to the input value in `input.py` labeled `bc_[x,y,z]%[beg,end]` (see table [Simulation Algorithm Parameters](#5-simulation-algorithm)).
The entries labeled "Characteristic." are characteristic boundary conditions based on [Thompson (1987)](references.md#Thompson87) and [Thompson (1990)](references.md#Thompson90).
Expand Down
16 changes: 9 additions & 7 deletions src/post_process/m_checker.f90
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,10 @@ subroutine s_check_inputs()
'weno_order. Exiting ...')

! Constraints on the boundary conditions in the x-direction
elseif (bc_x%beg < -12 .or. bc_x%beg > -1) then
elseif (bc_x%beg < -16 .or. bc_x%beg > -1 .or. bc_x%beg == -14) then
call s_mpi_abort('Unsupported choice for the value of '// &
'bc_x%beg. Exiting ...')
elseif (bc_x%end < -12 .or. bc_x%end > -1) then
elseif (bc_x%end < -16 .or. bc_x%end > -1 .or. bc_x%beg == -14) then
call s_mpi_abort('Unsupported choice for the value of '// &
'bc_x%end. Exiting ...')
elseif ((bc_x%beg == -1 .and. bc_x%end /= -1) &
Expand All @@ -126,16 +126,16 @@ subroutine s_check_inputs()
.or. &
(cyl_coord .and. p == 0)) &
.and. &
(bc_y%beg < -12 .or. bc_y%beg > -1)) &
(bc_y%beg < -16 .or. bc_y%beg > -1 .or. bc_y%beg == -14)) &
.or. &
(cyl_coord .and. p > 0 &
.and. &
(bc_y%beg < -13 .or. bc_y%beg > -1)))) then
(bc_y%beg < -16 .or. bc_y%beg > -1)))) then
call s_mpi_abort('Unsupported choice for the value of '// &
'bc_y%beg. Exiting ...')
elseif (bc_y%end /= dflt_int &
.and. &
(bc_y%end < -12 .or. bc_y%end > -1)) then
(bc_y%end < -16 .or. bc_y%end > -1 .or. bc_y%end == -14)) then
call s_mpi_abort('Unsupported choice for the value of '// &
'bc_y%end. Exiting ...')
elseif ((n == 0 .and. bc_y%beg /= dflt_int) &
Expand All @@ -160,14 +160,16 @@ subroutine s_check_inputs()
! Constraints on the boundary conditions in the z-direction
elseif (bc_z%beg /= dflt_int &
.and. &
(bc_z%beg < -12 .or. bc_z%beg > -1)) then
(bc_z%beg < -16 .or. bc_z%beg > -1 .or. bc_z%beg == -14)) then
call s_mpi_abort('Unsupported choice for the value of '// &
'bc_z%beg. Exiting ...')
elseif (bc_z%end /= dflt_int &
.and. &
(bc_z%end < -12 .or. bc_z%end > -1)) then
(bc_z%end < -16 .or. bc_z%end > -1 .or. bc_z%end == -14)) then
call s_mpi_abort('Unsupported choice for the value of '// &
'bc_z%end. Exiting ...')
elseif (any((/bc_x%beg, bc_x%end, bc_y%beg, bc_y%end, bc_z%beg, bc_z%end/) == -13)) then
call s_mpi_abort('Unsupported coice of boundary condition -13')
elseif ((p == 0 .and. bc_z%beg /= dflt_int) &
.or. &
(p > 0 .and. bc_z%beg == dflt_int)) then
Expand Down
8 changes: 4 additions & 4 deletions src/post_process/m_data_input.f90
Original file line number Diff line number Diff line change
Expand Up @@ -458,14 +458,14 @@ subroutine s_populate_grid_variables_buffer_regions() ! ----------------
if (n > 0) then

! Ghost-cell extrapolation BC at the beginning
if (bc_y%beg <= -3 .and. bc_y%beg /= -13) then
if (bc_y%beg <= -3 .and. bc_y%beg /= -14) then

do i = 1, buff_size
dy(-i) = dy(0)
end do

! Symmetry BC at the beginning
elseif (bc_y%beg == -2 .or. bc_y%beg == -13) then
elseif (bc_y%beg == -2 .or. bc_y%beg == -14) then

do i = 1, buff_size
dy(-i) = dy(i - 1)
Expand Down Expand Up @@ -734,7 +734,7 @@ subroutine s_populate_conservative_variables_buffer_regions() ! --------
if (n > 0) then

! Ghost-cell extrapolation BC at the beginning
if (bc_y%beg <= -3 .and. bc_y%beg /= -13) then
if (bc_y%beg <= -3 .and. bc_y%beg /= -14) then

do j = 1, buff_size
do i = 1, sys_size
Expand All @@ -743,7 +743,7 @@ subroutine s_populate_conservative_variables_buffer_regions() ! --------
end do

! Axis BC at the beginning
elseif (bc_y%beg == -13) then
elseif (bc_y%beg == -14) then

do j = 1, buff_size
do k = 0, p
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,12 +271,9 @@ subroutine s_assign_default_values_to_user_inputs() ! ------------------
alt_soundspeed = .false.
hypoelasticity = .false.

bc_x%beg = dflt_int
bc_x%end = dflt_int
bc_y%beg = dflt_int
bc_y%end = dflt_int
bc_z%beg = dflt_int
bc_z%end = dflt_int
bc_x%beg = dflt_int; bc_x%end = dflt_int
bc_y%beg = dflt_int; bc_y%end = dflt_int
bc_z%beg = dflt_int; bc_z%end = dflt_int

! Fluids physical parameters
do i = 1, num_fluids_max
Expand Down
20 changes: 11 additions & 9 deletions src/pre_process/m_checker.f90
Original file line number Diff line number Diff line change
Expand Up @@ -402,11 +402,11 @@ subroutine s_check_inputs()
'values for num_procs, m, n, p and '// &
'weno_order. Exiting ...')

! Constraints on the boundary conditions in the x-direction
elseif (bc_x%beg < -12 .or. bc_x%beg > -1) then
! Constraints on the boundary conditions in the x-direction
elseif (bc_x%beg < -16 .or. bc_x%beg > -1 .or. bc_x%beg == -14) then
call s_mpi_abort('Unsupported choice for the value of '// &
'bc_x%beg. Exiting ...')
elseif (bc_x%end < -12 .or. bc_x%end > -1) then
elseif (bc_x%end < -16 .or. bc_x%end > -1 .or. bc_x%beg == -14) then
call s_mpi_abort('Unsupported choice for the value of '// &
'bc_x%end. Exiting ...')
elseif ((bc_x%beg == -1 .and. bc_x%end /= -1) &
Expand All @@ -422,14 +422,14 @@ subroutine s_check_inputs()
! Constraints on the boundary conditions in the r-direction
if (bc_y%beg /= dflt_int &
.and. &
((p > 0 .and. bc_y%beg /= -13) &
((p > 0 .and. bc_y%beg /= -14) &
.or. &
(p == 0 .and. bc_y%beg /= -2))) then
call s_mpi_abort('Unsupported choice for the value of '// &
'bc_y%beg. Exiting ...')
elseif (bc_y%end /= dflt_int &
.and. &
(bc_y%end < -12 .or. bc_y%end > -1)) then
(bc_y%end < -16 .or. bc_y%end > -1 .or. bc_y%end == -14)) then
call s_mpi_abort('Unsupported choice for the value of '// &
'bc_y%end. Exiting ...')
elseif ((n > 0 .and. bc_y%beg == dflt_int)) then
Expand Down Expand Up @@ -475,12 +475,12 @@ subroutine s_check_inputs()
! Constraints on the boundary conditions in the y-direction
if (bc_y%beg /= dflt_int &
.and. &
(bc_y%beg < -12 .or. bc_y%beg > -1)) then
(bc_y%beg < -16 .or. bc_y%beg > -1 .or. bc_y%beg == -14)) then
call s_mpi_abort('Unsupported choice for the value of '// &
'bc_y%beg. Exiting ...')
elseif (bc_y%end /= dflt_int &
.and. &
(bc_y%end < -12 .or. bc_y%end > -1)) then
(bc_y%end < -16 .or. bc_y%end > -1 .or. bc_y%end == -14)) then
call s_mpi_abort('Unsupported choice for the value of '// &
'bc_y%end. Exiting ...')
elseif ((n == 0 .and. bc_y%beg /= dflt_int) &
Expand All @@ -505,14 +505,16 @@ subroutine s_check_inputs()
! Constraints on the boundary conditions in the z-direction
elseif (bc_z%beg /= dflt_int &
.and. &
(bc_z%beg < -12 .or. bc_z%beg > -1)) then
(bc_z%beg < -16 .or. bc_z%beg > -1 .or. bc_z%beg == -14)) then
call s_mpi_abort('Unsupported choice for the value of '// &
'bc_z%beg. Exiting ...')
elseif (bc_z%end /= dflt_int &
.and. &
(bc_z%end < -12 .or. bc_z%end > -1)) then
(bc_z%end < -16 .or. bc_z%end > -1 .or. bc_z%end == -14)) then
call s_mpi_abort('Unsupported choice for the value of '// &
'bc_z%end. Exiting ...')
elseif (any((/bc_x%beg, bc_x%end, bc_y%beg, bc_y%end, bc_z%beg, bc_z%end/) == -13)) then
call s_mpi_abort('Unsupported coice of boundary condition -13')
elseif ((p == 0 .and. bc_z%beg /= dflt_int) &
.or. &
(p > 0 .and. bc_z%beg == dflt_int)) then
Expand Down
9 changes: 3 additions & 6 deletions src/pre_process/m_global_parameters.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,12 +244,9 @@ contains

hypoelasticity = .false.

bc_x%beg = dflt_int
bc_x%end = dflt_int
bc_y%beg = dflt_int
bc_y%end = dflt_int
bc_z%beg = dflt_int
bc_z%end = dflt_int
bc_x%beg = dflt_int; bc_x%end = dflt_int
bc_y%beg = dflt_int; bc_y%end = dflt_int
bc_z%beg = dflt_int; bc_z%end = dflt_int

parallel_io = .false.
precision = 2
Expand Down
3 changes: 3 additions & 0 deletions src/pre_process/m_patches.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ module m_patches

use m_helper

use m_mpi_common

use m_assign_variables

use m_mpi_common
Expand Down Expand Up @@ -927,6 +929,7 @@ contains
! permission to write to that cell. If both queries check out,
! the primitive variables of the current patch are assigned
! to this cell.
do j = 0, n
do i = 0, m
if (x_boundary%beg <= x_cc(i) .and. &
Expand Down
Loading

0 comments on commit 38ef7b9

Please sign in to comment.