Skip to content

Commit

Permalink
PROHIBIT for m_check_patches and m_check_ib_patches
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisZYJ committed Sep 3, 2024
1 parent fa76abe commit 0d1df19
Show file tree
Hide file tree
Showing 2 changed files with 273 additions and 645 deletions.
125 changes: 48 additions & 77 deletions src/pre_process/m_check_ib_patches.fpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
!> @brief This module contains subroutines that read, and check consistency
!! of, the user provided inputs and data.

#:include 'macros.fpp'

module m_check_ib_patches

! Dependencies =============================================================
Expand Down Expand Up @@ -40,6 +43,7 @@ contains
if (i <= num_ibs) then
! call s_check_patch_geometry(i)
call s_int_to_str(i, iStr)

! Constraints on the geometric initial condition patch parameters
if (patch_ib(i)%geometry == 2) then
call s_check_circle_ib_patch_geometry(i)
Expand All @@ -53,18 +57,21 @@ contains
call s_check_3D_airfoil_ib_patch_geometry(i)
else if (patch_ib(i)%geometry == 10) then
call s_check_cylinder_ib_patch_geometry(i)
else if (patch_ib(i)%geometry == dflt_int) then
call s_prohibit_abort("IB patch undefined", &
"patch_icpp("//trim(iStr)//")%geometry must not be set.")
else
call s_mpi_abort('Unsupported choice of the '// &
'geometry of active patch '//trim(iStr)// &
' detected. Exiting ...')
call s_prohibit_abort("Invalid IB patch", &
"patch_icpp("//trim(iStr)//")%geometry must be "// &
"2-4, 8, 10, or 11.")
end if
else
if (patch_ib(i)%geometry == dflt_int) then
call s_check_inactive_ib_patch_geometry(i)
else
call s_mpi_abort('Unsupported choice of the '// &
'geometry of inactive patch '//trim(iStr)// &
' detected. Exiting ...')
call s_prohibit_abort("Inactive IB patch defined", &
"patch_icpp("//trim(iStr)//")%geometry "// &
"must not be set for inactive patches.")
end if
end if
end do
Expand All @@ -81,18 +88,11 @@ contains

call s_int_to_str(patch_id, iStr)

! Constraints on the geometric parameters of the circle patch
if (n == 0 .or. p > 0 .or. patch_ib(patch_id)%radius <= 0d0 &
.or. &
f_is_default(patch_ib(patch_id)%x_centroid) &
.or. &
f_is_default(patch_ib(patch_id)%y_centroid)) then

call s_mpi_abort('Inconsistency(ies) detected in '// &
'geometric parameters of circle '// &
'patch '//trim(iStr)//'. Exiting ...')

end if
@:PROHIBIT(n == 0 .or. p > 0 &
.or. patch_ib(patch_id)%radius <= 0d0 &
.or. f_is_default(patch_ib(patch_id)%x_centroid) &
.or. f_is_default(patch_ib(patch_id)%y_centroid), &
'in circle patch '//trim(iStr))

end subroutine s_check_circle_ib_patch_geometry

Expand All @@ -106,17 +106,14 @@ contains

call s_int_to_str(patch_id, iStr)

! Constraints on the geometric parameters of the airfoil patch
if (n == 0 .or. p > 0 .or. patch_ib(patch_id)%c <= 0d0 &
.or. patch_ib(patch_id)%p <= 0d0 .or. patch_ib(patch_id)%t <= 0d0 &
.or. patch_ib(patch_id)%m <= 0d0 .or. f_is_default(patch_ib(patch_id)%x_centroid) &
.or. f_is_default(patch_ib(patch_id)%y_centroid)) then

call s_mpi_abort('Inconsistency(ies) detected in '// &
'geometric parameters of airfoil '// &
'patch '//trim(iStr)//'. Exiting ...')

end if
@:PROHIBIT(n == 0 .or. p > 0 &
.or. patch_ib(patch_id)%c <= 0d0 &
.or. patch_ib(patch_id)%p <= 0d0 &
.or. patch_ib(patch_id)%t <= 0d0 &
.or. patch_ib(patch_id)%m <= 0d0 &
.or. f_is_default(patch_ib(patch_id)%x_centroid) &
.or. f_is_default(patch_ib(patch_id)%y_centroid), &
'in airfoil patch '//trim(iStr))

end subroutine s_check_airfoil_ib_patch_geometry

Expand All @@ -130,18 +127,16 @@ contains

call s_int_to_str(patch_id, iStr)

! Constraints on the geometric parameters of the 3d airfoil patch
if (n == 0 .or. p == 0 .or. patch_ib(patch_id)%c <= 0d0 &
.or. patch_ib(patch_id)%p <= 0d0 .or. patch_ib(patch_id)%t <= 0d0 &
.or. patch_ib(patch_id)%m <= 0d0 .or. f_is_default(patch_ib(patch_id)%x_centroid) &
.or. f_is_default(patch_ib(patch_id)%y_centroid) .or. f_is_default(patch_ib(patch_id)%z_centroid) &
.or. f_is_default(patch_ib(patch_id)%length_z)) then

call s_mpi_abort('Inconsistency(ies) detected in '// &
'geometric parameters of airfoil '// &
'patch '//trim(iStr)//'. Exiting ...')

end if
@:PROHIBIT(n == 0 .or. p > 0 &
.or. patch_ib(patch_id)%c <= 0d0 &
.or. patch_ib(patch_id)%p <= 0d0 &
.or. patch_ib(patch_id)%t <= 0d0 &
.or. patch_ib(patch_id)%m <= 0d0 &
.or. f_is_default(patch_ib(patch_id)%x_centroid) &
.or. f_is_default(patch_ib(patch_id)%y_centroid) &
.or. f_is_default(patch_ib(patch_id)%z_centroid) &
.or. f_is_default(patch_ib(patch_id)%length_z), &
'in 3d airfoil patch '//trim(iStr))

end subroutine s_check_3d_airfoil_ib_patch_geometry

Expand All @@ -155,22 +150,16 @@ contains

call s_int_to_str(patch_id, iStr)

! Constraints on the geometric parameters of the rectangle patch
if (n == 0 .or. p > 0 &
@:PROHIBIT(n == 0 .or. p > 0 &
.or. &
f_is_default(patch_ib(patch_id)%x_centroid) &
.or. &
f_is_default(patch_ib(patch_id)%y_centroid) &
.or. &
patch_ib(patch_id)%length_x <= 0d0 &
.or. &
patch_ib(patch_id)%length_y <= 0d0) then

call s_mpi_abort('Inconsistency(ies) detected in '// &
'geometric parameters of rectangle '// &
'patch '//trim(iStr)//'. Exiting ...')

end if
patch_ib(patch_id)%length_y <= 0d0, &
'in rectangle patch '//trim(iStr))

end subroutine s_check_rectangle_ib_patch_geometry

Expand All @@ -184,22 +173,16 @@ contains

call s_int_to_str(patch_id, iStr)

! Constraints on the geometric parameters of the sphere patch
if (n == 0 .or. p == 0 &
@:PROHIBIT(n == 0 .or. p > 0 &
.or. &
f_is_default(patch_ib(patch_id)%x_centroid) &
.or. &
f_is_default(patch_ib(patch_id)%y_centroid) &
.or. &
f_is_default(patch_ib(patch_id)%z_centroid) &
.or. &
patch_ib(patch_id)%radius <= 0d0) then

call s_mpi_abort('Inconsistency(ies) detected in '// &
'geometric parameters of rectangle '// &
'patch '//trim(iStr)//'. Exiting ...')

end if
patch_ib(patch_id)%radius <= 0d0, &
'in sphere patch '//trim(iStr))

end subroutine s_check_sphere_ib_patch_geometry

Expand All @@ -213,8 +196,7 @@ contains

call s_int_to_str(patch_id, iStr)

! Constraints on the geometric parameters of the cylinder patch
if (p == 0 &
@:PROHIBIT(p == 0 &
.or. &
f_is_default(patch_ib(patch_id)%x_centroid) &
.or. &
Expand All @@ -238,13 +220,8 @@ contains
((.not. f_is_default(patch_ib(patch_id)%length_x)) .or. &
(.not. f_is_default(patch_ib(patch_id)%length_y)))) &
.or. &
patch_ib(patch_id)%radius <= 0d0) then

call s_mpi_abort('Inconsistency(ies) detected in '// &
'geometric parameters of cylinder '// &
'patch '//trim(iStr)//'. Exiting ...')

end if
patch_ib(patch_id)%radius <= 0d0, &
'in cylinder patch '//trim(iStr))

end subroutine s_check_cylinder_ib_patch_geometry

Expand All @@ -257,8 +234,7 @@ contains

call s_int_to_str(patch_id, iStr)

! Constraints on the geometric parameters of the inactive patch
if ((.not. f_is_default(patch_ib(patch_id)%x_centroid)) &
@:PROHIBIT((.not. f_is_default(patch_ib(patch_id)%x_centroid)) &
.or. &
(.not. f_is_default(patch_ib(patch_id)%y_centroid)) &
.or. &
Expand All @@ -270,13 +246,8 @@ contains
.or. &
(.not. f_is_default(patch_ib(patch_id)%length_z)) &
.or. &
(.not. f_is_default(patch_ib(patch_id)%radius))) then

call s_mpi_abort('Inconsistency(ies) detected in '// &
'geometric parameters of inactive '// &
'patch '//trim(iStr)//'. Exiting ...')

end if
(.not. f_is_default(patch_ib(patch_id)%radius)), &
'in inactive patch '//trim(iStr))

end subroutine s_check_inactive_ib_patch_geometry

Expand Down
Loading

0 comments on commit 0d1df19

Please sign in to comment.