Skip to content

Commit 3f61225

Browse files
Added Models to the list of refactored code
1 parent 92260b9 commit 3f61225

24 files changed

Lines changed: 306 additions & 233 deletions

File tree

docs/documentation/case.md

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -312,22 +312,14 @@ This is enabled by adding ``'elliptic_smoothing': "T",`` and ``'elliptic_smoothi
312312
| Parameter | Type | Description |
313313
| ---: | :----: | :--- |
314314
| `num_ibs` | Integer | Number of immersed boundary patches |
315+
| `num_stl_models` | Integer | Number of STL/OBJ model entries in the `stl_models` array |
315316
| `geometry` | Integer | Geometry configuration of the patch.|
316317
| `x[y,z]_centroid` | Real | Centroid of the applied geometry in the [x,y,z]-direction. |
317318
| `length_x[y,z]` | Real | Length, if applicable, in the [x,y,z]-direction. |
318319
| `radius` | Real | Radius, if applicable, of the applied geometry. |
319-
| `theta` | Real | Angle of attach applied to airfoil IB patches |
320-
| `c` | Real | NACA airfoil parameters (see below) |
321-
| `t` | Real | NACA airfoil parameters (see below) |
322-
| `m` | Real | NACA airfoil parameters (see below) |
323-
| `p` | Real | NACA airfoil parameters (see below) |
320+
| `airfoil_id` | Integer | Index into `ib_airfoil` array for NACA airfoil geometry patches. |
321+
| `model_id` | Integer | Index into `stl_models` array for STL/OBJ geometry patches. |
324322
| `slip` | Logical | Apply a slip boundary |
325-
| `model_filepath` | String | Path to an STL or OBJ file (not all OBJs are supported). |
326-
| `model_scale(i)` | Real | Model's (applied) scaling factor for component $i$. |
327-
| `model_rotate(i)` | Real | Model's (applied) angle of rotation about axis $i$. |
328-
| `model_translate(i)` | Real | Model's $i$-th component of (applied) translation. |
329-
| `model_spc` | Integer | Number of samples per cell when discretizing the model into the grid. |
330-
| `model_threshold` | Real | Ray fraction inside the model patch above which the fraction is set to one.|
331323
| `moving_ibm` | Integer | Sets the method used for IB movement. |
332324
| `vel(i)` | Real | Initial velocity of the moving IB in the i-th direction. |
333325
| `angular_vel(i)` | Real | Initial angular velocity of the moving IB in the i-th direction. |
@@ -338,6 +330,17 @@ This is enabled by adding ``'elliptic_smoothing': "T",`` and ``'elliptic_smoothi
338330

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

333+
STL/OBJ model geometry parameters are set on the `stl_models` array (indexed by `model_id`):
334+
335+
| Parameter | Type | Description |
336+
|:---------------------|:--------|:------------|
337+
| `model_filepath` | String | Path to an STL or OBJ file (not all OBJs are supported). |
338+
| `model_scale(i)` | Real | Model's scaling factor for component $i$. |
339+
| `model_translate(i)` | Real | Model's $i$-th component of translation. |
340+
| `model_threshold` | Real | Winding number threshold above which a cell is marked as inside the model. |
341+
342+
These parameters should be prepended with `stl_models(k)%` where $k$ is the model index.
343+
341344
#### Parameter Descriptions
342345

343346
- `geometry` defines the type of geometry of an immersed boundary patch with an integer number.
@@ -349,15 +352,13 @@ Definitions for currently implemented immersed boundary patch types are listed i
349352

350353
- `radius` is the radius to be used for circular patches.
351354

352-
- `theta` allows for the angle of attach of airfoil patches to be changed.
353-
354-
- `c`, `t`, `p`, and `m` specify the parameters for a NACA airfoil.
355-
`m` is the maximum camber, `p` is the location of maximum camber, `c` is the coord length, and `t` is the thickness.
355+
- `c`, `t`, `p`, and `m` specify the parameters for a NACA airfoil (set on the referenced `ib_airfoil` entry).
356+
`m` is the maximum camber, `p` is the location of maximum camber, `c` is the chord length, and `t` is the thickness.
356357
Additional details on this specification can be found in [NACA airfoil](https://en.wikipedia.org/wiki/NACA_airfoil).
357358

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

360-
- Please see [Patch Parameters](#sec-patches) for the descriptions of `model_filepath`, `model_scale`, `model_rotate`, `model_translate`, `model_spc`, and `model_threshold`.
361+
- For STL/OBJ geometry (geometry 5 or 12), set `model_id` to index into the `stl_models` array and specify `model_filepath`, `model_scale`, `model_translate`, and `model_threshold` on that entry.
361362

362363
- `moving_ibm` sets the method by which movement will be applied to the immersed boundary. Using 0 will result in no movement. Using 1 will result 1-way coupling where the boundary moves at a constant rate and applied forces to the fluid based upon it's own motion. In 1-way coupling, the fluid does not apply forces back onto the IB. Using 2 will result in 2-way coupling, where the boundary pushes on the fluid and the fluid pushes back on the boundary via pressure and viscous forces. If external forces are applied, the boundary will also experience those forces.
363364

examples/2D_ibm_stl_MFCCharacter/case.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,13 @@
6868
"patch_icpp(1)%pres": 100000,
6969
"patch_icpp(1)%alpha_rho(1)": (1.0) * rho1,
7070
"patch_icpp(1)%alpha(1)": 1.0,
71+
"num_stl_models": 1,
7172
"patch_ib(1)%geometry": 5,
72-
"patch_ib(1)%model_filepath": "Character_IBM.stl",
73-
"patch_ib(1)%model_translate(1)": -0.0469828735,
74-
"patch_ib(1)%model_translate(2)": -0.0094892600,
75-
"patch_ib(1)%model_spc": 200,
76-
"patch_ib(1)%model_threshold": 0.99,
73+
"patch_ib(1)%model_id": 1,
74+
"stl_models(1)%model_filepath": "Character_IBM.stl",
75+
"stl_models(1)%model_translate(1)": -0.0469828735,
76+
"stl_models(1)%model_translate(2)": -0.0094892600,
77+
"stl_models(1)%model_threshold": 0.99,
7778
"patch_ib(1)%slip": "F",
7879
# Fluids Physical Parameters
7980
"fluid_pp(1)%gamma": 1.0e00 / (gam_a - 1.0e00),

examples/2D_ibm_stl_test/case.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,13 @@
6969
"patch_icpp(1)%pres": 100000,
7070
"patch_icpp(1)%alpha_rho(1)": (1.0) * rho1,
7171
"patch_icpp(1)%alpha(1)": 1.0,
72+
"num_stl_models": 1,
7273
"patch_ib(1)%geometry": 5,
73-
"patch_ib(1)%model_filepath": "Circle_IBM.stl",
74-
"patch_ib(1)%model_translate(1)": -0.05,
75-
"patch_ib(1)%model_translate(2)": -0.05,
76-
"patch_ib(1)%model_spc": 100,
77-
"patch_ib(1)%model_threshold": 0.95,
74+
"patch_ib(1)%model_id": 1,
75+
"stl_models(1)%model_filepath": "Circle_IBM.stl",
76+
"stl_models(1)%model_translate(1)": -0.05,
77+
"stl_models(1)%model_translate(2)": -0.05,
78+
"stl_models(1)%model_threshold": 0.95,
7879
"patch_ib(1)%slip": "F",
7980
# Fluids Physical Parameters
8081
"fluid_pp(1)%gamma": 1.0e00 / (gam_a - 1.0e00),

examples/2D_ibm_stl_wedge/case.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,13 @@
6969
"patch_icpp(1)%pres": 10918.2549,
7070
"patch_icpp(1)%alpha_rho(1)": (1.0) * rho1,
7171
"patch_icpp(1)%alpha(1)": 1.0,
72+
"num_stl_models": 1,
7273
"patch_ib(1)%geometry": 5,
73-
"patch_ib(1)%model_filepath": "Wedge2D_IBM.stl",
74-
"patch_ib(1)%model_translate(1)": -0.0500000000,
75-
"patch_ib(1)%model_translate(2)": -0.0373970250,
76-
"patch_ib(1)%model_spc": 200,
77-
"patch_ib(1)%model_threshold": 0.95,
74+
"patch_ib(1)%model_id": 1,
75+
"stl_models(1)%model_filepath": "Wedge2D_IBM.stl",
76+
"stl_models(1)%model_translate(1)": -0.0500000000,
77+
"stl_models(1)%model_translate(2)": -0.0373970250,
78+
"stl_models(1)%model_threshold": 0.95,
7879
"patch_ib(1)%slip": "F",
7980
# Fluids Physical Parameters
8081
"fluid_pp(1)%gamma": 1.0e00 / (gam_a - 1.0e00),
6.75 KB
Binary file not shown.

examples/3D_ibm_stl_ellipsoid/case.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,14 @@
8181
"patch_icpp(1)%alpha_rho(1)": (1.0) * rho1,
8282
"patch_icpp(1)%alpha(1)": 1.0e00,
8383
# Patch: Model Immersed Boundary
84+
"num_stl_models": 1,
8485
"patch_ib(1)%geometry": 12,
85-
"patch_ib(1)%model_filepath": "Ellipsoid_IBM.stl",
86-
"patch_ib(1)%model_translate(1)": -0.02056,
87-
"patch_ib(1)%model_translate(2)": -0.01,
88-
"patch_ib(1)%model_translate(3)": -0.01,
89-
"patch_ib(1)%model_spc": 20,
90-
"patch_ib(1)%model_threshold": 0.01,
86+
"patch_ib(1)%model_id": 1,
87+
"stl_models(1)%model_filepath": "Ellipsoid_IBM.stl",
88+
"stl_models(1)%model_translate(1)": -0.02056,
89+
"stl_models(1)%model_translate(2)": -0.01,
90+
"stl_models(1)%model_translate(3)": -0.01,
91+
"stl_models(1)%model_threshold": 0.01,
9192
"patch_ib(1)%slip": "F",
9293
# Fluids Physical Parameters
9394
"fluid_pp(1)%gamma": 1.0e00 / (gam_a - 1.0e00),

examples/3D_ibm_stl_pyramid/case.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,14 @@
8181
"patch_icpp(1)%alpha_rho(1)": (1.0) * rho1,
8282
"patch_icpp(1)%alpha(1)": 1.0e00,
8383
# Patch: Model Immersed Boundary
84+
"num_stl_models": 1,
8485
"patch_ib(1)%geometry": 12,
85-
"patch_ib(1)%model_filepath": "3DPyramid_IBM.stl",
86-
"patch_ib(1)%model_translate(1)": -0.0500000984,
87-
"patch_ib(1)%model_translate(2)": -0.0500001003,
88-
"patch_ib(1)%model_translate(3)": -0.0500001003,
89-
"patch_ib(1)%model_spc": 100,
90-
"patch_ib(1)%model_threshold": 0.95,
86+
"patch_ib(1)%model_id": 1,
87+
"stl_models(1)%model_filepath": "3DPyramid_IBM.stl",
88+
"stl_models(1)%model_translate(1)": -0.0500000984,
89+
"stl_models(1)%model_translate(2)": -0.0500001003,
90+
"stl_models(1)%model_translate(3)": -0.0500001003,
91+
"stl_models(1)%model_threshold": 0.95,
9192
"patch_ib(1)%slip": "F",
9293
# Fluids Physical Parameters
9394
"fluid_pp(1)%gamma": 1.0e00 / (gam_a - 1.0e00),

examples/3D_ibm_stl_test/case.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,14 @@
8181
"patch_icpp(1)%alpha_rho(1)": (1.0) * rho1,
8282
"patch_icpp(1)%alpha(1)": 1.0e00,
8383
# Patch: Model Immersed Boundary
84+
"num_stl_models": 1,
8485
"patch_ib(1)%geometry": 12,
85-
"patch_ib(1)%model_filepath": "Cube_IBM.stl",
86-
"patch_ib(1)%model_translate(1)": 0,
87-
"patch_ib(1)%model_translate(2)": -0.05,
88-
"patch_ib(1)%model_translate(3)": -0.05,
89-
"patch_ib(1)%model_spc": 100,
90-
"patch_ib(1)%model_threshold": 0.95,
86+
"patch_ib(1)%model_id": 1,
87+
"stl_models(1)%model_filepath": "Cube_IBM.stl",
88+
"stl_models(1)%model_translate(1)": 0,
89+
"stl_models(1)%model_translate(2)": -0.05,
90+
"stl_models(1)%model_translate(3)": -0.05,
91+
"stl_models(1)%model_threshold": 0.95,
9192
"patch_ib(1)%slip": "F",
9293
# Fluids Physical Parameters
9394
"fluid_pp(1)%gamma": 1.0e00 / (gam_a - 1.0e00),

src/common/m_constants.fpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ module m_constants
2626
integer, parameter :: num_patches_max = 10 !< Maximum number of IC patches
2727
integer, parameter :: num_ib_patches_max = 50000 !< Maximum number of immersed boundary patches (patch_ib)
2828
integer, parameter :: num_ib_airfoils_max = 5 !< Maximum number of ib_airfoil instances
29+
integer, parameter :: num_stl_models_max = 10 !< Maximum number of stl_models instances
2930
integer, parameter :: num_bc_patches_max = 10 !< Maximum number of boundary condition patches
3031
integer, parameter :: max_2d_fourier_modes = 10 !< Max Fourier mode index for 2D modal patch (geometry 13)
3132
integer, parameter :: max_sph_harm_degree = 5 !< Max degree L for 3D spherical harmonic patch (geometry 14)

src/common/m_derived_types.fpp

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,14 @@ module m_derived_types
286286
type(vec3_dt), allocatable :: lower(:) !< lower surface grid points (1:Np)
287287
end type ib_airfoil_grid
288288

289+
!> User-input parameters for an STL/OBJ immersed boundary model (namelist-safe: scalars + fixed arrays)
290+
type ib_stl_parameters
291+
character(LEN=pathlen_max) :: model_filepath !< Path to the STL file relative to case_dir.
292+
real(wp), dimension(1:3) :: model_translate !< Translation of the STL object.
293+
real(wp), dimension(1:3) :: model_scale !< Scale factor for the STL object.
294+
real(wp) :: model_threshold !< Threshold to turn on smooth STL patch.
295+
end type ib_stl_parameters
296+
289297
type ib_patch_parameters
290298

291299
integer :: geometry !< Type of geometry for the patch
@@ -299,20 +307,11 @@ module m_derived_types
299307
real(wp), dimension(1:3,1:3) :: rotation_matrix
300308
!> matrix that converts from fluid reference frame to IB reference frame
301309
real(wp), dimension(1:3,1:3) :: rotation_matrix_inverse
302-
integer :: airfoil_id !< index into ib_airfoil(:) for airfoil geometry patches
303-
real(wp) :: length_x, length_y, length_z !< Dimensions of the patch. x,y,z Lengths.
304-
real(wp) :: radius !< Dimensions of the patch. radius.
305-
real(wp) :: theta
306-
logical :: slip
307-
308-
! STL or OBJ model input parameter
309-
character(LEN=pathlen_max) :: model_filepath !< Path the STL file relative to case_dir.
310-
real(wp), dimension(1:3) :: model_translate !< Translation of the STL object.
311-
real(wp), dimension(1:3) :: model_scale !< Scale factor for the STL object.
312-
!> Angle to rotate the STL object along each cartesian coordinate axis, in radians.
313-
real(wp), dimension(1:3) :: model_rotate
314-
integer :: model_spc !< Number of samples per cell to use when discretizing the STL object.
315-
real(wp) :: model_threshold !< Threshold to turn on smoothen STL patch. Patch conditions for moving imersed boundaries
310+
integer :: airfoil_id !< index into ib_airfoil(:) for airfoil geometry patches
311+
integer :: model_id !< index into stl_models(:) for STL/OBJ geometry patches
312+
real(wp) :: length_x, length_y, length_z !< Dimensions of the patch. x,y,z Lengths.
313+
real(wp) :: radius !< Dimensions of the patch. radius.
314+
logical :: slip
316315
integer :: moving_ibm !< 0 for no moving, 1 for moving, 2 for moving on forced path
317316
real(wp) :: mass, moment !< mass and moment of inertia of object used to compute forces in 2-way coupling
318317
real(wp), dimension(1:3) :: force, torque !< vectors for the computed force and torque values applied to an IB

0 commit comments

Comments
 (0)