@@ -40,20 +40,12 @@ contains
4040 @:PROHIBIT(patch_ib(i)%geometry == dflt_int, " IB patch undefined. patch_ib(" // trim (iStr)// " )%geometry must be set." )
4141
4242 ! Constraints on the geometric initial condition patch parameters
43- if (patch_ib(i)%geometry == 2 ) then
43+ if (patch_ib(i)%geometry == 2 .or. patch_ib(i)%geometry == 8 .or. patch_ib(i)%geometry == 10 ) then
4444 call s_check_circle_ib_patch_geometry(i)
45- else if (patch_ib(i)%geometry == 3 ) then
45+ else if (patch_ib(i)%geometry == 3 .or. patch_ib(i)%geometry == 9 ) then
4646 call s_check_rectangle_ib_patch_geometry(i)
47- else if (patch_ib(i)%geometry == 8 ) then
48- call s_check_sphere_ib_patch_geometry(i)
49- else if (patch_ib(i)%geometry == 9 ) then
50- call s_check_cuboid_ib_patch_geometry(i)
51- else if (patch_ib(i)%geometry == 4 ) then
47+ else if (patch_ib(i)%geometry == 4 .or. patch_ib(i)%geometry == 11 ) then
5248 call s_check_airfoil_ib_patch_geometry(i)
53- else if (patch_ib(i)%geometry == 11 ) then
54- call s_check_3d_airfoil_ib_patch_geometry(i)
55- else if (patch_ib(i)%geometry == 10 ) then
56- call s_check_cylinder_ib_patch_geometry(i)
5749 else if (patch_ib(i)%geometry == 5 .or. patch_ib(i)%geometry == 12 ) then
5850 call s_check_model_ib_patch_geometry(i)
5951 else if (patch_ib(i)%geometry == 6 ) then
@@ -80,8 +72,29 @@ contains
8072
8173 call s_int_to_str(patch_id, iStr)
8274
83- @:PROHIBIT(n == 0 .or. p > 0 .or. patch_ib(patch_id)%radius <= 0._wp .or. f_is_default(patch_ib(patch_id)%x_centroid) &
84- & .or. f_is_default(patch_ib(patch_id)%y_centroid), ' in circle IB patch ' // trim (iStr))
75+ @:PROHIBIT(n == 0 .or. patch_ib(patch_id)%radius <= 0._wp .or. f_is_default(patch_ib(patch_id)%x_centroid) &
76+ & .or. f_is_default(patch_ib(patch_id)%y_centroid), ' in circle/cylinder/sphere IB patch ' // trim (iStr))
77+
78+ ! Additional checks strictly for 3D shapes (Spheres and Cylinders)
79+ if (p > 0 ) then
80+ ! Both Spheres and Cylinder require Z centroid
81+ @:PROHIBIT(f_is_default(patch_ib(patch_id)%z_centroid), ' in 3D sphere/cylinder IB patch ' // trim (iStr))
82+
83+ ! If any length is defined, it is a Cylinder. Ensure exactly ONE length axis is defined.
84+ if ((.not. f_is_default(patch_ib(patch_id)%length_x)) .or. (.not. f_is_default(patch_ib(patch_id)%length_y)) &
85+ & .or. (.not. f_is_default(patch_ib(patch_id)%length_z))) then
86+ ! Check 1 : Exactly ONE axis must be provided (prevents double- axis degenerate shapes)
87+ @:PROHIBIT(count ([.not. f_is_default(patch_ib(patch_id)%length_x), &
88+ & .not. f_is_default(patch_ib(patch_id)%length_y), &
89+ & .not. f_is_default(patch_ib(patch_id)%length_z)]) /= 1 , &
90+ & ' in cylinder IB patch ' // trim (iStr) // ' : exactly one length must be provided' )
91+
92+ ! Check 2 : That single provided axis MUST be a positive number
93+ @:PROHIBIT(count ([patch_ib(patch_id)%length_x > 0._wp , patch_ib(patch_id)%length_y > 0._wp , &
94+ & patch_ib(patch_id)%length_z > 0._wp ]) /= 1 , &
95+ & ' in cylinder IB patch ' // trim (iStr) // ' : provided length must be positive' )
96+ end if
97+ end if
8598
8699 end subroutine s_check_circle_ib_patch_geometry
87100
@@ -107,33 +120,22 @@ contains
107120
108121 call s_int_to_str(patch_id, iStr)
109122
110- @:PROHIBIT(n == 0 .or. p > 0 .or. patch_ib(patch_id)%airfoil_id <= 0 &
111- & .or. ib_airfoil(patch_ib(patch_id)%airfoil_id)%c <= 0._wp &
123+ @:PROHIBIT(n == 0 .or. patch_ib(patch_id)%airfoil_id <= 0 .or. ib_airfoil(patch_ib(patch_id)%airfoil_id)%c <= 0._wp &
112124 & .or. ib_airfoil(patch_ib(patch_id)%airfoil_id)%p <= 0._wp &
113125 & .or. ib_airfoil(patch_ib(patch_id)%airfoil_id)%t <= 0._wp &
114126 & .or. ib_airfoil(patch_ib(patch_id)%airfoil_id)%m <= 0._wp .or. f_is_default(patch_ib(patch_id)%x_centroid) &
115127 & .or. f_is_default(patch_ib(patch_id)%y_centroid), ' in airfoil IB patch ' // trim (iStr))
116128
129+ ! Additional checks strictly for 3D airfoils
130+ if (p > 0 ) then
131+ @:PROHIBIT(f_is_default(patch_ib(patch_id)%z_centroid) .or. f_is_default(patch_ib(patch_id)%length_z), &
132+ & ' in 3D airfoil IB patch ' // trim (iStr))
133+ end if
134+
117135 end subroutine s_check_airfoil_ib_patch_geometry
118136
119137 !> Verify that the geometric parameters of the 3D airfoil patch have been consistently inputted.
120138
121- impure subroutine s_check_3d_airfoil_ib_patch_geometry (patch_id )
122-
123- integer , intent (in ) :: patch_id
124-
125- call s_int_to_str(patch_id, iStr)
126-
127- @:PROHIBIT(n == 0 .or. p == 0 .or. patch_ib(patch_id)%airfoil_id <= 0 &
128- & .or. ib_airfoil(patch_ib(patch_id)%airfoil_id)%c <= 0._wp &
129- & .or. ib_airfoil(patch_ib(patch_id)%airfoil_id)%p <= 0._wp &
130- & .or. ib_airfoil(patch_ib(patch_id)%airfoil_id)%t <= 0._wp &
131- & .or. ib_airfoil(patch_ib(patch_id)%airfoil_id)%m <= 0._wp .or. f_is_default(patch_ib(patch_id)%x_centroid) &
132- & .or. f_is_default(patch_ib(patch_id)%y_centroid) .or. f_is_default(patch_ib(patch_id)%z_centroid) &
133- & .or. f_is_default(patch_ib(patch_id)%length_z), ' in 3d airfoil IB patch ' // trim (iStr))
134-
135- end subroutine s_check_3d_airfoil_ib_patch_geometry
136-
137139 !> Verify that the geometric parameters of the rectangle patch have been consistently inputted.
138140
139141 impure subroutine s_check_rectangle_ib_patch_geometry (patch_id )
@@ -142,62 +144,17 @@ contains
142144
143145 call s_int_to_str(patch_id, iStr)
144146
145- @:PROHIBIT(n == 0 .or. p > 0 .or. f_is_default(patch_ib(patch_id)%x_centroid) &
146- & .or. f_is_default(patch_ib(patch_id)%y_centroid) .or. patch_ib(patch_id)%length_x <= 0._wp &
147- & .or. patch_ib(patch_id)%length_y <= 0._wp , ' in rectangle IB patch ' // trim (iStr))
148-
149- end subroutine s_check_rectangle_ib_patch_geometry
150-
151- !> Verify that the geometric parameters of the sphere patch have been consistently inputted.
152-
153- impure subroutine s_check_sphere_ib_patch_geometry (patch_id )
154-
155- integer , intent (in ) :: patch_id
156-
157- call s_int_to_str(patch_id, iStr)
158-
159- @:PROHIBIT(n == 0 .or. p == 0 .or. f_is_default(patch_ib(patch_id)%x_centroid) &
160- & .or. f_is_default(patch_ib(patch_id)%y_centroid) .or. f_is_default(patch_ib(patch_id)%z_centroid) &
161- & .or. patch_ib(patch_id)%radius <= 0._wp , ' in sphere IB patch ' // trim (iStr))
162-
163- end subroutine s_check_sphere_ib_patch_geometry
164-
165- !> Verify that the geometric parameters of the cuboid patch have been consistently inputted.
166-
167- impure subroutine s_check_cuboid_ib_patch_geometry (patch_id )
168-
169- integer , intent (in ) :: patch_id
170-
171- call s_int_to_str(patch_id, iStr)
172-
173- @:PROHIBIT(n == 0 .or. p == 0 .or. f_is_default(patch_ib(patch_id)%x_centroid) &
174- & .or. f_is_default(patch_ib(patch_id)%y_centroid) .or. f_is_default(patch_ib(patch_id)%z_centroid) &
175- & .or. patch_ib(patch_id)%length_x <= 0._wp .or. patch_ib(patch_id)%length_y <= 0._wp &
176- & .or. patch_ib(patch_id)%length_z <= 0._wp , ' in cuboid IB patch ' // trim (iStr))
147+ @:PROHIBIT(n == 0 .or. f_is_default(patch_ib(patch_id)%x_centroid) .or. f_is_default(patch_ib(patch_id)%y_centroid) &
148+ & .or. patch_ib(patch_id)%length_x <= 0._wp .or. patch_ib(patch_id)%length_y <= 0._wp , &
149+ & ' in rectangle/cuboid IB patch ' // trim (iStr))
177150
178- end subroutine s_check_cuboid_ib_patch_geometry
151+ ! If the simulation is 3D , also mandate Z lengths and centroids
152+ if (p > 0 ) then
153+ @:PROHIBIT(f_is_default(patch_ib(patch_id)%z_centroid) .or. patch_ib(patch_id)%length_z <= 0._wp , &
154+ & ' in 3D cuboid IB patch ' // trim (iStr))
155+ end if
179156
180- !> Verify that the geometric parameters of the cylinder patch have been consistently inputted.
181-
182- impure subroutine s_check_cylinder_ib_patch_geometry (patch_id )
183-
184- integer , intent (in ) :: patch_id
185-
186- call s_int_to_str(patch_id, iStr)
187-
188- @:PROHIBIT(p == 0 .or. f_is_default(patch_ib(patch_id)%x_centroid) .or. f_is_default(patch_ib(patch_id)%y_centroid) &
189- & .or. f_is_default(patch_ib(patch_id)%z_centroid) .or. (patch_ib(patch_id)%length_x <= 0._wp &
190- & .and. patch_ib(patch_id)%length_y <= 0._wp .and. patch_ib(patch_id)%length_z <= 0._wp ) &
191- & .or. patch_ib(patch_id)%radius <= 0._wp , ' in cylinder IB patch ' // trim (iStr))
192-
193- @:PROHIBIT((patch_ib(patch_id)%length_x > 0._wp .and. ((.not. f_is_default(patch_ib(patch_id)%length_y)) &
194- & .or. (.not. f_is_default(patch_ib(patch_id)%length_z)))) .or. (patch_ib(patch_id)%length_y > 0._wp &
195- & .and. ((.not. f_is_default(patch_ib(patch_id)%length_x)) &
196- & .or. (.not. f_is_default(patch_ib(patch_id)%length_z)))) .or. (patch_ib(patch_id)%length_z > 0._wp &
197- & .and. ((.not. f_is_default(patch_ib(patch_id)%length_x)) &
198- & .or. (.not. f_is_default(patch_ib(patch_id)%length_y)))), ' in cylinder IB patch ' // trim (iStr))
199-
200- end subroutine s_check_cylinder_ib_patch_geometry
157+ end subroutine s_check_rectangle_ib_patch_geometry
201158
202159 !> Verify that the geometric parameters of the model patch have been consistently inputted.
203160
0 commit comments