Skip to content

Commit 4089cda

Browse files
committed
Refactor to get it work on Frontier
1 parent 5cd2996 commit 4089cda

File tree

15 files changed

+148
-102
lines changed

15 files changed

+148
-102
lines changed

docs/documentation/case.md

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -166,12 +166,12 @@ MPI topology is automatically optimized to maximize the parallel efficiency for
166166
| `vel(i)` * | Real | Supported | Velocity in direction $i$. |
167167
| `hcid` * | Integer | N/A | Hard coded patch id |
168168
| `cf_val` * | Real | Supported | Surface tension color function value |
169-
| `model%%filepath` | String | Not Supported | Path to an STL or OBJ file (not all OBJs are supported). |
170-
| `model%%scale(i)` | Real | Not Supported | Model's (applied) scaling factor for component $i$. |
171-
| `model%%rotate(i)` | Real | Not Supported | Model's (applied) angle of rotation about axis $i$. |
172-
| `model%%translate(i)` | Real | Not Supported | Model's $i$-th component of (applied) translation. |
173-
| `model%%spc` | Integer | Not Supported | Number of samples per cell when discretizing the model into the grid. |
174-
| `model%%threshold` | Real | Not Supported | Ray fraction inside the model patch above which the fraction is set to one.|
169+
| `model_filepath` | String | Not Supported | Path to an STL or OBJ file (not all OBJs are supported). |
170+
| `model_scale(i)` | Real | Not Supported | Model's (applied) scaling factor for component $i$. |
171+
| `model_rotate(i)` | Real | Not Supported | Model's (applied) angle of rotation about axis $i$. |
172+
| `model_translate(i)` | Real | Not Supported | Model's $i$-th component of (applied) translation. |
173+
| `model_spc` | Integer | Not Supported | Number of samples per cell when discretizing the model into the grid. |
174+
| `model_threshold` | Real | Not Supported | Ray fraction inside the model patch above which the fraction is set to one.|
175175

176176
*: These parameters should be prepended with `patch_icpp(j)%` where $j$ is the patch index.
177177

@@ -263,7 +263,11 @@ Optimal choice of the value of `smooth_coeff` is case-dependent and left to the
263263
- `patch_icpp(j)alpha(i)`, `patch_icpp(j)alpha_rho(i)`, `patch_icpp(j)pres`, and `patch_icpp(j)vel(i)` define for $j$-th patch the void fraction of `fluid(i)`, partial density of `fluid(i)`, the pressure, and the velocity in the $i$-th coordinate direction.
264264
These physical parameters must be consistent with fluid material's parameters defined in the next subsection.
265265

266-
- `model%%scale`, `model%%rotate` and `model%%translate` define how the model should be transformed to domain-space by first scaling by `model%%scale`, then rotating about the Z, X, and Y axes (using `model%%rotate`), and finally translating by `model%%translate`.
266+
- `model_filepath` defines the root directory of the STL or OBJ model file.
267+
268+
- `model_scale`, `model_rotate` and `model_translate` define how the model should be transformed to domain-space by first scaling by `model_scale`, then rotating about the Z, X, and Y axes (using `model_rotate`), and finally translating by `model_translate`.
269+
270+
- `model_spc` and `model_threshold` are ray-tracing parameters. `model_spc` defines the number of rays per cell to render the model. `model_threshold` defines the ray-tracing threshold at which the cell is marked as the model.
267271

268272
### 4. Immersed Boundary Patches
269273

@@ -279,12 +283,12 @@ These physical parameters must be consistent with fluid material's parameters de
279283
| `m` | Real | NACA airfoil parameters (see below) |
280284
| `p` | Real | NACA airfoil parameters (see below) |
281285
| `slip` | Logical | Apply a slip boundary |
282-
| `model%%filepath` | String | Path to an STL or OBJ file (not all OBJs are supported). |
283-
| `model%%scale(i)` | Real | Model's (applied) scaling factor for component $i$. |
284-
| `model%%rotate(i)` | Real | Model's (applied) angle of rotation about axis $i$. |
285-
| `model%%translate(i)` | Real | Model's $i$-th component of (applied) translation. |
286-
| `model%%spc` | Integer | Number of samples per cell when discretizing the model into the grid. |
287-
| `model%%threshold` | Real | Ray fraction inside the model patch above which the fraction is set to one.|
286+
| `model_filepath` | String | Path to an STL or OBJ file (not all OBJs are supported). |
287+
| `model_scale(i)` | Real | Model's (applied) scaling factor for component $i$. |
288+
| `model_rotate(i)` | Real | Model's (applied) angle of rotation about axis $i$. |
289+
| `model_translate(i)` | Real | Model's $i$-th component of (applied) translation. |
290+
| `model_spc` | Integer | Number of samples per cell when discretizing the model into the grid. |
291+
| `model_threshold` | Real | Ray fraction inside the model patch above which the fraction is set to one.|
288292

289293
These parameters should be prepended with `patch_ib(j)%` where $j$ is the patch index.
290294

@@ -307,6 +311,8 @@ Additional details on this specification can be found in [The Naca Airfoil Serie
307311

308312
- `slip` applies a slip boundary to the surface of the patch if true and a no-slip boundary condition to the surface if false.
309313

314+
- Please see [Patch Parameters](#3-patches) for the descriptions of `model_filepath`, `model_scale`, `model_rotate`, `model_translate`, `model_spc`, and `model_threshold`.
315+
310316
### 5. Fluid Material’s
311317

312318
| Parameter | Type | Description |

examples/2D_ibm_stl_MFCCharacter/case.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,11 @@
7777
'patch_icpp(1)%alpha(1)' : 1.0,
7878
# ==========================================================================
7979
'patch_ib(1)%geometry' : 5,
80-
'patch_ib(1)%model%filepath' : 'Character_IBM.stl',
81-
'patch_ib(1)%model%translate(1)' : -0.0469828735,
82-
'patch_ib(1)%model%translate(2)' : -0.0094892600,
83-
'patch_ib(1)%model%spc' : 200,
84-
'patch_ib(1)%model%threshold' : 0.99,
80+
'patch_ib(1)%model_filepath' : 'Character_IBM.stl',
81+
'patch_ib(1)%model_translate(1)' : -0.0469828735,
82+
'patch_ib(1)%model_translate(2)' : -0.0094892600,
83+
'patch_ib(1)%model_model_spc' : 200,
84+
'patch_ib(1)%model_threshold' : 0.99,
8585
'patch_ib(1)%slip' : 'F',
8686
# # ========================================================================
8787

examples/2D_ibm_stl_test/case.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,11 @@
7878
'patch_icpp(1)%alpha(1)' : 1.0,
7979
# ==========================================================================
8080
'patch_ib(1)%geometry' : 5,
81-
'patch_ib(1)%model%filepath' : "Circle_IBM.stl",
82-
'patch_ib(1)%model%translate(1)' : -0.05,
83-
'patch_ib(1)%model%translate(2)' : -0.05,
84-
'patch_ib(1)%model%spc' : 100,
85-
'patch_ib(1)%model%threshold' : 0.95,
81+
'patch_ib(1)%model_filepath' : "Circle_IBM.stl",
82+
'patch_ib(1)%model_translate(1)' : -0.05,
83+
'patch_ib(1)%model_translate(2)' : -0.05,
84+
'patch_ib(1)%model_spc' : 100,
85+
'patch_ib(1)%model_threshold' : 0.95,
8686
'patch_ib(1)%slip' : 'F',
8787
# # ========================================================================
8888

examples/2D_ibm_stl_wedge/case.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,11 @@
7878
'patch_icpp(1)%alpha(1)' : 1.0,
7979
# ==========================================================================
8080
'patch_ib(1)%geometry' : 5,
81-
'patch_ib(1)%model%filepath' : 'Wedge2D_IBM.stl',
82-
'patch_ib(1)%model%translate(1)' : -0.0500000000,
83-
'patch_ib(1)%model%translate(2)' : -0.0373970250,
84-
'patch_ib(1)%model%spc' : 200,
85-
'patch_ib(1)%model%threshold' : 0.90,
81+
'patch_ib(1)%model_filepath' : 'Wedge2D_IBM.stl',
82+
'patch_ib(1)%model_translate(1)' : -0.0500000000,
83+
'patch_ib(1)%model_translate(2)' : -0.0373970250,
84+
'patch_ib(1)%model_spc' : 200,
85+
'patch_ib(1)%model_threshold' : 0.95,
8686
'patch_ib(1)%slip' : 'F',
8787
# # ========================================================================
8888

examples/3D_ibm_stl_ellipsoid/case.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222
'z_domain%beg' : -2*D,
2323
'z_domain%end' : 2*D,
2424
'cyl_coord' : 'F',
25-
'm' : 399,
26-
'n' : 199,
27-
'p' : 199,
25+
'm' : 139,
26+
'n' : 69,
27+
'p' : 69,
2828
'dt' : 1.0E-6,
2929
't_step_start' : 0,
3030
't_step_stop' : 1000,
@@ -90,12 +90,12 @@
9090

9191
# Patch: Model Immersed Boundary ===========================================
9292
'patch_ib(1)%geometry' : 12,
93-
'patch_ib(1)%model%filepath' : 'Ellipsoid_IBM.stl',
94-
'patch_ib(1)%model%translate(1)' : -0.02056,
95-
'patch_ib(1)%model%translate(2)' : -0.01,
96-
'patch_ib(1)%model%translate(3)' : -0.01,
97-
'patch_ib(1)%model%spc' : 100,
98-
'patch_ib(1)%model%threshold' : 0.01,
93+
'patch_ib(1)%model_filepath' : 'Ellipsoid_IBM.stl',
94+
'patch_ib(1)%model_translate(1)' : -0.02056,
95+
'patch_ib(1)%model_translate(2)' : -0.01,
96+
'patch_ib(1)%model_translate(3)' : -0.01,
97+
'patch_ib(1)%model_spc' : 20,
98+
'patch_ib(1)%model_threshold' : 0.01,
9999
'patch_ib(1)%slip' : 'F',
100100
# ==========================================================================
101101

examples/3D_ibm_stl_pyramid/case.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,12 @@
9090

9191
# Patch: Model Immersed Boundary ===========================================
9292
'patch_ib(1)%geometry' : 12,
93-
'patch_ib(1)%model%filepath' : '3DPyramid_IBM.stl',
94-
'patch_ib(1)%model%translate(1)' : -0.0500000984,
95-
'patch_ib(1)%model%translate(2)' : -0.0500001003,
96-
'patch_ib(1)%model%translate(3)' : -0.0500001003,
97-
'patch_ib(1)%model%spc' : 100,
98-
'patch_ib(1)%model%threshold' : 0.95,
93+
'patch_ib(1)%model_filepath' : '3DPyramid_IBM.stl',
94+
'patch_ib(1)%model_translate(1)' : -0.0500000984,
95+
'patch_ib(1)%model_translate(2)' : -0.0500001003,
96+
'patch_ib(1)%model_translate(3)' : -0.0500001003,
97+
'patch_ib(1)%model_spc' : 100,
98+
'patch_ib(1)%model_threshold' : 0.95,
9999
'patch_ib(1)%slip' : 'F',
100100
# ==========================================================================
101101

examples/3D_ibm_stl_test/case.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,12 @@
9090

9191
# Patch: Model Immersed Boundary ===========================================
9292
'patch_ib(1)%geometry' : 12,
93-
'patch_ib(1)%model%filepath' : "Cube_IBM.stl",
94-
'patch_ib(1)%model%translate(1)' : 0,
95-
'patch_ib(1)%model%translate(2)' : -0.05,
96-
'patch_ib(1)%model%translate(3)' : -0.05,
97-
'patch_ib(1)%model%spc' : 100,
98-
'patch_ib(1)%model%threshold' : 0.95,
93+
'patch_ib(1)%model_filepath' : "Cube_IBM.stl",
94+
'patch_ib(1)%model_translate(1)' : 0,
95+
'patch_ib(1)%model_translate(2)' : -0.05,
96+
'patch_ib(1)%model_translate(3)' : -0.05,
97+
'patch_ib(1)%model_spc' : 100,
98+
'patch_ib(1)%model_threshold' : 0.95,
9999
'patch_ib(1)%slip' : 'F',
100100
# ==========================================================================
101101

src/common/m_constants.fpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ module m_constants
2929
real(kind(0d0)), parameter :: broadband_spectral_level_growth_rate = 10d0 !< The spectral level constant to correct the magnitude at each frqeuency to ensure the source is overall broadband
3030

3131
! IBM+STL interpolation constants
32-
integer, parameter :: Ifactor_2D = 100 !< Multiple factor of the ratio (edge to cell width) for interpolation along edges for 2D models
33-
integer, parameter :: Ifactor_3D = 10 !< Multiple factor of the ratio (edge to cell width) for interpolation along edges for 3D models
34-
integer, parameter :: Ifactor_bary_3D = 30 !< Multiple factor of the ratio (triangle area to cell face area) for interpolation on triangle facets for 3D models
32+
integer, parameter :: Ifactor_2D = 50 !< Multiple factor of the ratio (edge to cell width) for interpolation along edges for 2D models
33+
integer, parameter :: Ifactor_3D = 5 !< Multiple factor of the ratio (edge to cell width) for interpolation along edges for 3D models
34+
integer, parameter :: Ifactor_bary_3D = 20 !< Multiple factor of the ratio (triangle area to cell face area) for interpolation on triangle facets for 3D models
3535
integer, parameter :: num_ray = 20 !< Default number of rays traced per cell
3636
real(kind(0d0)), parameter :: ray_tracing_threshold = 0.9d0 !< Threshold above which the cell is marked as the model patch
3737
real(kind(0d0)), parameter :: threshold_vector_zero = 1d-10 !< Threshold to treat the component of a vector to be zero

src/common/m_derived_types.fpp

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ module m_derived_types
104104
end type bub_bounds_info
105105

106106
!> Defines parameters for a Model Patch
107-
type :: ic_model_parameters
107+
type ic_model_parameters
108108
character(LEN=pathlen_max) :: filepath !<
109109
!! Path the STL file relative to case_dir.
110110

@@ -165,8 +165,6 @@ module m_derived_types
165165
!! patch geometries. It is specified through its x-, y-, and z-components
166166
!! respectively.
167167

168-
type(ic_model_parameters) :: model !< Model parameters
169-
170168
real(kind(0d0)) :: epsilon, beta !<
171169
!! The spherical harmonics eccentricity parameters.
172170

@@ -220,6 +218,26 @@ module m_derived_types
220218
real(kind(0d0)) :: cf_val !! color function value
221219
real(kind(0d0)) :: Y(1:num_species)
222220

221+
!! STL or OBJ model input parameter
222+
character(LEN=pathlen_max) :: model_filepath !<
223+
!! Path the STL file relative to case_dir.
224+
225+
t_vec3 :: model_translate !<
226+
!! Translation of the STL object.
227+
228+
t_vec3 :: model_scale !<
229+
!! Scale factor for the STL object.
230+
231+
t_vec3 :: model_rotate !<
232+
!! Angle to rotate the STL object along each cartesian coordinate axis,
233+
!! in radians.
234+
235+
integer :: model_spc !<
236+
!! Number of samples per cell to use when discretizing the STL object.
237+
238+
real(kind(0d0)) :: model_threshold !<
239+
!! Threshold to turn on smoothen STL patch.
240+
223241
end type ic_patch_parameters
224242

225243
type ib_patch_parameters
@@ -238,8 +256,25 @@ module m_derived_types
238256

239257
logical :: slip
240258

241-
type(ic_model_parameters) :: model
259+
!! STL or OBJ model input parameter
260+
character(LEN=pathlen_max) :: model_filepath !<
261+
!! Path the STL file relative to case_dir.
262+
263+
t_vec3 :: model_translate !<
264+
!! Translation of the STL object.
265+
266+
t_vec3 :: model_scale !<
267+
!! Scale factor for the STL object.
268+
269+
t_vec3 :: model_rotate !<
270+
!! Angle to rotate the STL object along each cartesian coordinate axis,
271+
!! in radians.
272+
273+
integer :: model_spc !<
274+
!! Number of samples per cell to use when discretizing the STL object.
242275

276+
real(kind(0d0)) :: model_threshold !<
277+
!! Threshold to turn on smoothen STL patch.
243278
end type ib_patch_parameters
244279

245280
!> Derived type annexing the physical parameters (PP) of the fluids. These

src/pre_process/m_check_ib_patches.fpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -269,14 +269,14 @@ contains
269269

270270
call s_int_to_str(patch_id, iStr)
271271

272-
@:PROHIBIT(patch_ib(patch_id)%model%filepath == dflt_char, &
272+
@:PROHIBIT(patch_ib(patch_id)%model_filepath == dflt_char, &
273273
'Empty model file path for patch '//trim(iStr))
274274

275-
@:PROHIBIT(patch_ib(patch_id)%model%scale(1) <= 0d0 &
275+
@:PROHIBIT(patch_ib(patch_id)%model_scale(1) <= 0d0 &
276276
.or. &
277-
patch_ib(patch_id)%model%scale(2) <= 0d0 &
277+
patch_ib(patch_id)%model_scale(2) <= 0d0 &
278278
.or. &
279-
patch_ib(patch_id)%model%scale(3) <= 0d0, &
279+
patch_ib(patch_id)%model_scale(3) <= 0d0, &
280280
'Negative scale in model IB patch '//trim(iStr))
281281

282282
end subroutine s_check_model_ib_patch_geometry

0 commit comments

Comments
 (0)