Skip to content

Commit c0e510e

Browse files
authored
Merge pull request #201 from wilfonba/hardcodedICs
2 parents a34a51b + 3fdbddf commit c0e510e

File tree

13 files changed

+166
-16
lines changed

13 files changed

+166
-16
lines changed

docs/documentation/authors.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ We try to maintain a list of current and past developers:
1717
+ M. Rodriguez
1818
+ K. Schmidmayer
1919
+ J. Spratt
20+
+ B. Wilfong

docs/documentation/case.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,15 +205,14 @@ end if
205205

206206
#### Hard Coded Patches
207207

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`
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 200, one would add the following to `src/pre_process/include/2dHardcodedIC.fpp`
209209

210210
```f90
211-
if (patch_icpp%hcid == 201) then
211+
case(200)
212212
! Primitive variables assignment
213-
end if
214213
```
215214

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.
215+
and use `patch_icpp(i)%geometry = 7` and `patch_icpp(i)%hcid = 200` in the input file. Additional variables can be declared in `Hardcoded1[2,3]DVariables` and used in `hardcoded1[2,3]D`. 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.
217216

218217
#### Parameter Descriptions
219218

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# 2D Hardcodied IC Example
2+
3+
## Initial Condition
4+
5+
![Initial Condition](initial.png)
6+
7+
## Result
8+
9+
![Result](result.png)

examples/2D_hardcodied_ic/case.py

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
#!/usr/bin/env python3
2+
3+
import json
4+
5+
eps = 1e-9
6+
7+
# Configuring case dictionary
8+
print(json.dumps({
9+
# Logistics ================================================
10+
'run_time_info' : 'T',
11+
# ==========================================================
12+
13+
# Computational Domain Parameters ==========================
14+
'x_domain%beg' : 0.E+00,
15+
'x_domain%end' : 4.E+00,
16+
'stretch_x' : 'T',
17+
'a_x' : 7,
18+
'x_a' : -2,
19+
'x_b' : 2,
20+
'y_domain%beg' : 0.E+00,
21+
'y_domain%end' : 4.E+00,
22+
'stretch_y' : 'T',
23+
'a_y' : 7,
24+
'y_a' : -2,
25+
'y_b' : 2,
26+
'm' : 199,
27+
'n' : 199,
28+
'p' : 0,
29+
'dt' : 5.E-06,
30+
't_step_start' : 0,
31+
't_step_stop' : 2000,
32+
't_step_save' : 200,
33+
# ==========================================================
34+
35+
# Simulation Algorithm Parameters ==========================
36+
'num_patches' : 1,
37+
'model_eqns' : 3,
38+
'alt_soundspeed' : 'F',
39+
'num_fluids' : 2,
40+
'adv_alphan' : 'T',
41+
'mpp_lim' : 'T',
42+
'mixture_err' : 'T',
43+
'time_stepper' : 3,
44+
'weno_order' : 5,
45+
'weno_eps' : 1.E-16,
46+
'mapped_weno' : 'T',
47+
'null_weights' : 'F',
48+
'mp_weno' : 'F',
49+
'riemann_solver' : 2,
50+
'wave_speeds' : 1,
51+
'avg_state' : 2,
52+
'bc_x%beg' : -2,
53+
'bc_x%end' : -7,
54+
'bc_y%beg' : -2,
55+
'bc_y%end' : -7,
56+
# ==========================================================
57+
58+
# Formatted Database Files Structure Parameters ============
59+
'format' : 1,
60+
'precision' : 2,
61+
'prim_vars_wrt' :'T',
62+
'parallel_io' :'T',
63+
# ==========================================================
64+
65+
# Patch 1: Base ============================================
66+
'patch_icpp(1)%geometry' : 7,
67+
'patch_icpp(1)%hcid' : 200,
68+
'patch_icpp(1)%x_centroid' : 4.,
69+
'patch_icpp(1)%y_centroid' : 4.,
70+
'patch_icpp(1)%length_x' : 8.,
71+
'patch_icpp(1)%length_y' : 8.,
72+
'patch_icpp(1)%vel(1)' : 0.,
73+
'patch_icpp(1)%vel(2)' : 0.,
74+
'patch_icpp(1)%pres' : 10,
75+
'patch_icpp(1)%alpha_rho(1)' : (1-eps)*1000,
76+
'patch_icpp(1)%alpha_rho(2)' : eps*1,
77+
'patch_icpp(1)%alpha(1)' : 1-eps,
78+
'patch_icpp(1)%alpha(2)' : eps,
79+
# ===========================================================
80+
81+
# Fluids Physical Parameters ===============================
82+
'fluid_pp(1)%gamma' : 1.E+00/(2.35E+00-1.E+00),
83+
'fluid_pp(1)%pi_inf' : 2.35E+00*1.E+09/(2.35E+00-1.E+00),
84+
'fluid_pp(2)%gamma' : 1.E+00/(1.4E+00-1.E+00),
85+
'fluid_pp(2)%pi_inf' : 0.E+00,
86+
# ==========================================================
87+
}))
88+
# ==============================================================================
17.4 KB
Loading
59.9 KB
Loading

src/post_process/m_start_up.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ subroutine s_check_input_file() ! --------------------------------------
127127

128128
end subroutine s_check_input_file ! ------------------------------------
129129

130-
subroutine s_perform_time_step(t_step)
130+
subroutine s_perform_time_step(t_step)
131131

132132
integer, intent(INOUT) :: t_step
133133
if (proc_rank == 0) then
Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
1-
#:def Hardcoded1D()
1+
#:def Hardcoded1DVariables()
2+
! Place any declaration of intermediate variables here
3+
4+
5+
#:enddef
26

3-
if (patch_icpp(patch_id)%hcid == 100) then
7+
#:def Hardcoded1D()
48

5-
end if
9+
select case(patch_icpp(patch_id)%hcid)
10+
case(100)
11+
! Put your variable assignments here
12+
case default
13+
call s_int_to_str(patch_id, iStr)
14+
call s_mpi_abort("Invalid hcid specified for patch " // trim(iStr))
15+
end select
616

717
#:enddef
Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,30 @@
1-
#:def Hardcoded2D()
1+
#:def Hardcoded2DVariables()
2+
3+
real(kind(0d0)) :: eps
24

3-
if (patch_icpp(patch_id)%hcid == 200) then
5+
eps = 1e-9
46

5-
end if
7+
#:enddef
8+
9+
#:def Hardcoded2D()
10+
11+
select case(patch_icpp(patch_id)%hcid) ! 2D_hardcoded_ic example case
12+
case(200)
13+
if (y_cc(j) <= (-x_cc(i)**3 + 1)**(1d0/3d0)) then
14+
! Volume Fractions
15+
q_prim_vf(advxb)%sf(i, j, 0) = eps
16+
q_prim_vf(advxe)%sf(i, j, 0) = 1d0-eps
17+
! Denssities
18+
q_prim_vf(contxb)%sf(i, j, 0) = eps*1000d0
19+
q_prim_vf(contxe)%sf(i, j, 0) = (1d0-eps)*1d0
20+
! Pressure
21+
q_prim_vf(E_idx)%sf(i, j, 0) = 1000d0
22+
end if
23+
case default
24+
if (proc_rank == 0) then
25+
call s_int_to_str(patch_id, iStr)
26+
call s_mpi_abort("Invalid hcid specified for patch " // trim(iStr))
27+
end if
28+
end select
629

730
#:enddef
Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
1-
#:def Hardcoded3D()
1+
#:def Hardcoded3DVariables()
2+
! Place any declaration of intermediate variables here
3+
4+
5+
#:enddef
26

3-
if (patch_icpp(patch_id)%hcid == 300) then
7+
#:def Hardcoded3D()
48

5-
end if
9+
select case(patch_icpp(patch_id)%hcid)
10+
case(300)
11+
! Put your variable assignments here
12+
case default
13+
call s_int_to_str(patch_id, iStr)
14+
call s_mpi_abort("Invalid hcid specified for patch " // trim(iStr))
15+
end select
616

717
#:enddef

0 commit comments

Comments
 (0)