Skip to content

Commit 0c5e360

Browse files
authored
Merge pull request #197 from wilfonba/hardcodedICs
2 parents eaabf93 + ed207ac commit 0c5e360

File tree

8 files changed

+46
-4
lines changed

8 files changed

+46
-4
lines changed

docs/documentation/case.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ the grid stretching funciton is applied and has a default value of one.
155155
| `alpha_rho(i)` * | Real | Supported | Partial density of fluid $i$. |
156156
| `pres` * | Real | Supported | Pressure. |
157157
| `vel(i)` * | Real | Supported | Velocity in direction $i$. |
158+
| `hcid` * | Integer | N/A | Hard coded patch id |
158159
| `model%filepath` | String | Not Supported | Path to an STL or OBJ file (not all OBJs are supported). |
159160
| `model%scale(i)` | Real | Not Supported | Model's (applied) scaling factor for component $i$. |
160161
| `model%rotate(i)` | Real | Not Supported | Model's (applied) angle of rotation about axis $i$. |
@@ -202,6 +203,18 @@ if (patch_id == 2) then
202203
end if
203204
```
204205

206+
#### Hard Coded Patches
207+
208+
Some patch configurations are not adequatley handeled with the above analytic variable definitions. In this case, a hard coded patch can be used. Hard coded patches can be added by adding additional hard coded patch identifers to `src/pre_process/include/1[2,3]dHardcodedIC.fpp`. For example, to add a 2D Hardcoded patch with an id of 201, one would add the following to `src/pre_process/include/2dHardcodedIC.fpp`
209+
210+
```f90
211+
if (patch_icpp%hcid == 201) then
212+
! Primitive variables assignment
213+
end if
214+
```
215+
216+
and use `patch_icpp(i)%geometry = y` and `patch_icpp(i)%hcid = 201` in the input file. As a convention, any hard coded patches that are part of the MFC master branch should be identied as 1[2,3]xx where the first digit indiates the number of dimensions.
217+
205218
#### Parameter Descriptions
206219

207220
- `num_patches` defines the total number of patches defined in the domain. The number has to be a positive integer.

src/common/m_derived_types.fpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,9 @@ module m_derived_types
168168
real(kind(0d0)) :: p0 !< Bubble size
169169
real(kind(0d0)) :: m0 !< Bubble velocity
170170

171+
integer :: hcid
172+
!! id for hard coded initial condition
173+
171174
end type ic_patch_parameters
172175

173176
!> Derived type annexing the physical parameters (PP) of the fluids. These
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#:def Hardcoded1D()
2+
3+
if (patch_icpp(patch_id)%hcid == 100) then
4+
5+
end if
6+
7+
#:enddef
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#:def Hardcoded2D()
2+
3+
if (patch_icpp(patch_id)%hcid == 200) then
4+
5+
end if
6+
7+
#:enddef
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#:def Hardcoded3D()
2+
3+
if (patch_icpp(patch_id)%hcid == 300) then
4+
5+
end if
6+
7+
#:enddef

src/pre_process/m_global_parameters.fpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,8 @@ contains
300300

301301
patch_icpp(i)%p0 = dflt_real
302302
patch_icpp(i)%m0 = dflt_real
303+
304+
patch_icpp(i)%hcid = dflt_int
303305
end do
304306

305307
! Tait EOS

src/pre_process/m_patches.fpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
!! @brief Contains module m_patches
44

55
#:include 'case.fpp'
6+
#:include '1dHardcodedIC.fpp'
7+
#:include '2dHardcodedIC.fpp'
8+
#:include '3dHardcodedIC.fpp'
69
#:include 'macros.fpp'
710

811
module m_patches
@@ -813,7 +816,7 @@ contains
813816
call s_assign_patch_primitive_variables(patch_id, i, 0, 0, &
814817
eta, q_prim_vf, patch_id_fp)
815818
816-
@:analytical()
819+
@:Hardcoded1D()
817820
end if
818821
end do
819822
@@ -927,7 +930,7 @@ contains
927930
call s_assign_patch_primitive_variables(patch_id, i, j, 0, &
928931
eta, q_prim_vf, patch_id_fp)
929932
930-
@:analytical()
933+
@:Hardcoded2D()
931934
end if
932935
end do
933936
end do
@@ -1001,7 +1004,7 @@ contains
10011004
call s_assign_patch_primitive_variables(patch_id, i, j, k, &
10021005
eta, q_prim_vf, patch_id_fp)
10031006

1004-
@:analytical()
1007+
@:Hardcoded3D()
10051008

10061009
end if
10071010

toolchain/mfc/run/case_dicts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
for attribute in ["geometry", "radius", "radii", "epsilon", "beta",
4040
"normal", "smoothen", "smooth_patch_id", "alpha_rho",
4141
"smooth_coeff", "rho", "vel", "pres", "alpha", "gamma",
42-
"pi_inf", "r0", "v0", "p0", "m0"]:
42+
"pi_inf", "r0", "v0", "p0", "m0", "hcid"]:
4343
PRE_PROCESS.append(f"patch_icpp({p_id})%{attribute}")
4444

4545
PRE_PROCESS.append(f"patch_icpp({p_id})%model%filepath")

0 commit comments

Comments
 (0)