-
Notifications
You must be signed in to change notification settings - Fork 144
Expand file tree
/
Copy pathm_check_ib_patches.fpp
More file actions
228 lines (152 loc) · 10 KB
/
m_check_ib_patches.fpp
File metadata and controls
228 lines (152 loc) · 10 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
!>
!! @file
!! @brief Contains module m_check_ib_patches
!> @brief Validates geometry parameters and constraints for immersed boundary patches
#:include 'macros.fpp'
module m_check_ib_patches
use m_derived_types
use m_global_parameters
use m_mpi_proxy
use m_data_output
#ifdef MFC_MPI
use mpi !< Message passing interface (MPI) module
#endif
use m_compile_specific
use m_helper_basic
use m_helper
implicit none
private
public :: s_check_ib_patches
character(len=10) :: iStr
contains
!> Validate the geometry parameters of all active and inactive immersed boundary patches.
impure subroutine s_check_ib_patches
integer :: i
do i = 1, num_patches_max
if (i <= num_ibs) then
call s_int_to_str(i, iStr)
@:PROHIBIT(patch_ib(i)%geometry == dflt_int, "IB patch undefined. patch_ib("//trim(iStr)//")%geometry must be set.")
! Constraints on the geometric initial condition patch parameters
if (patch_ib(i)%geometry == 2) then
call s_check_circle_ib_patch_geometry(i)
else if (patch_ib(i)%geometry == 3) then
call s_check_rectangle_ib_patch_geometry(i)
else if (patch_ib(i)%geometry == 8) then
call s_check_sphere_ib_patch_geometry(i)
else if (patch_ib(i)%geometry == 9) then
call s_check_cuboid_ib_patch_geometry(i)
else if (patch_ib(i)%geometry == 4) then
call s_check_airfoil_ib_patch_geometry(i)
else if (patch_ib(i)%geometry == 11) then
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 == 5 .or. patch_ib(i)%geometry == 12) then
call s_check_model_ib_patch_geometry(i)
else if (patch_ib(i)%geometry == 6) then
call s_check_ellipse_ib_patch_geometry(i)
else
call s_prohibit_abort("Invalid IB patch", &
& "patch_ib(" // trim(iStr) // ")%geometry must be " // "2-4, 8-10, 11 or 12.")
end if
else
@:PROHIBIT(patch_ib(i)%geometry /= dflt_int, &
& "Inactive IB patch defined. " // "patch_ib(" // trim(iStr) &
& // ")%geometry must not be set for inactive patches.")
call s_check_inactive_ib_patch_geometry(i)
end if
end do
end subroutine s_check_ib_patches
!> Verify that the geometric parameters of the circle patch have been consistently inputted.
impure subroutine s_check_circle_ib_patch_geometry(patch_id)
integer, intent(in) :: patch_id
call s_int_to_str(patch_id, iStr)
@:PROHIBIT(n == 0 .or. p > 0 .or. patch_ib(patch_id)%radius <= 0._wp .or. f_is_default(patch_ib(patch_id)%x_centroid) &
& .or. f_is_default(patch_ib(patch_id)%y_centroid), 'in circle IB patch ' // trim(iStr))
end subroutine s_check_circle_ib_patch_geometry
!> Verify that the geometric parameters of the ellipse patch have been consistently inputted.
impure subroutine s_check_ellipse_ib_patch_geometry(patch_id)
integer, intent(in) :: patch_id
call s_int_to_str(patch_id, iStr)
@:PROHIBIT(n == 0 .or. p > 0 .or. patch_ib(patch_id)%length_x <= 0._wp .or. patch_ib(patch_id)%length_y <= 0._wp &
& .or. f_is_default(patch_ib(patch_id)%x_centroid) .or. f_is_default(patch_ib(patch_id)%y_centroid), &
& 'in ellipse IB patch ' // trim(iStr))
end subroutine s_check_ellipse_ib_patch_geometry
!> Verify that the geometric parameters of the airfoil patch have been consistently inputted.
impure subroutine s_check_airfoil_ib_patch_geometry(patch_id)
integer, intent(in) :: patch_id
call s_int_to_str(patch_id, iStr)
@:PROHIBIT(n == 0 .or. p > 0 .or. patch_ib(patch_id)%c <= 0._wp .or. patch_ib(patch_id)%p <= 0._wp &
& .or. patch_ib(patch_id)%t <= 0._wp .or. patch_ib(patch_id)%m <= 0._wp &
& .or. f_is_default(patch_ib(patch_id)%x_centroid) .or. f_is_default(patch_ib(patch_id)%y_centroid), &
& 'in airfoil IB patch ' // trim(iStr))
end subroutine s_check_airfoil_ib_patch_geometry
!> Verify that the geometric parameters of the 3D airfoil patch have been consistently inputted.
impure subroutine s_check_3d_airfoil_ib_patch_geometry(patch_id)
integer, intent(in) :: patch_id
call s_int_to_str(patch_id, iStr)
@:PROHIBIT(n == 0 .or. p == 0 .or. patch_ib(patch_id)%c <= 0._wp .or. patch_ib(patch_id)%p <= 0._wp &
& .or. patch_ib(patch_id)%t <= 0._wp .or. patch_ib(patch_id)%m <= 0._wp &
& .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 IB patch ' // trim(iStr))
end subroutine s_check_3d_airfoil_ib_patch_geometry
!> Verify that the geometric parameters of the rectangle patch have been consistently inputted.
impure subroutine s_check_rectangle_ib_patch_geometry(patch_id)
integer, intent(in) :: patch_id
call s_int_to_str(patch_id, iStr)
@: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 <= 0._wp &
& .or. patch_ib(patch_id)%length_y <= 0._wp, 'in rectangle IB patch ' // trim(iStr))
end subroutine s_check_rectangle_ib_patch_geometry
!> Verify that the geometric parameters of the sphere patch have been consistently inputted.
impure subroutine s_check_sphere_ib_patch_geometry(patch_id)
integer, intent(in) :: patch_id
call s_int_to_str(patch_id, iStr)
@: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 <= 0._wp, 'in sphere IB patch ' // trim(iStr))
end subroutine s_check_sphere_ib_patch_geometry
!> Verify that the geometric parameters of the cuboid patch have been consistently inputted.
impure subroutine s_check_cuboid_ib_patch_geometry(patch_id)
integer, intent(in) :: patch_id
call s_int_to_str(patch_id, iStr)
@: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)%length_x <= 0._wp .or. patch_ib(patch_id)%length_y <= 0._wp &
& .or. patch_ib(patch_id)%length_z <= 0._wp, 'in cuboid IB patch ' // trim(iStr))
end subroutine s_check_cuboid_ib_patch_geometry
!> Verify that the geometric parameters of the cylinder patch have been consistently inputted.
impure subroutine s_check_cylinder_ib_patch_geometry(patch_id)
integer, intent(in) :: patch_id
call s_int_to_str(patch_id, iStr)
@:PROHIBIT(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)%length_x <= 0._wp &
& .and. patch_ib(patch_id)%length_y <= 0._wp .and. patch_ib(patch_id)%length_z <= 0._wp) &
& .or. patch_ib(patch_id)%radius <= 0._wp, 'in cylinder IB patch ' // trim(iStr))
@:PROHIBIT((patch_ib(patch_id)%length_x > 0._wp .and. ((.not. f_is_default(patch_ib(patch_id)%length_y)) &
& .or. (.not. f_is_default(patch_ib(patch_id)%length_z)))) .or. (patch_ib(patch_id)%length_y > 0._wp &
& .and. ((.not. f_is_default(patch_ib(patch_id)%length_x)) &
& .or. (.not. f_is_default(patch_ib(patch_id)%length_z)))) .or. (patch_ib(patch_id)%length_z > 0._wp &
& .and. ((.not. f_is_default(patch_ib(patch_id)%length_x)) &
& .or. (.not. f_is_default(patch_ib(patch_id)%length_y)))), 'in cylinder IB patch ' // trim(iStr))
end subroutine s_check_cylinder_ib_patch_geometry
!> Verify that the geometric parameters of the model patch have been consistently inputted.
impure subroutine s_check_model_ib_patch_geometry(patch_id)
integer, intent(in) :: patch_id
call s_int_to_str(patch_id, iStr)
@:PROHIBIT(patch_ib(patch_id)%model_filepath == dflt_char, 'Empty model file path for patch '//trim(iStr))
@:PROHIBIT(patch_ib(patch_id)%model_scale(1) <= 0._wp .or. patch_ib(patch_id)%model_scale(2) <= 0._wp &
& .or. patch_ib(patch_id)%model_scale(3) <= 0._wp, 'Negative scale in model IB patch ' // trim(iStr))
end subroutine s_check_model_ib_patch_geometry
!> Verify that inactive IB patch geometry parameters remain at defaults
impure subroutine s_check_inactive_ib_patch_geometry(patch_id)
integer, intent(in) :: patch_id
call s_int_to_str(patch_id, iStr)
@:PROHIBIT((.not. f_is_default(patch_ib(patch_id)%x_centroid)) .or. (.not. f_is_default(patch_ib(patch_id)%y_centroid)) &
& .or. (.not. f_is_default(patch_ib(patch_id)%z_centroid)) &
& .or. (.not. f_is_default(patch_ib(patch_id)%length_x)) .or. (.not. f_is_default(patch_ib(patch_id)%length_y)) &
& .or. (.not. f_is_default(patch_ib(patch_id)%length_z)) .or. (.not. f_is_default(patch_ib(patch_id)%radius)), &
& 'in inactive IB patch ' // trim(iStr))
end subroutine s_check_inactive_ib_patch_geometry
end module m_check_ib_patches