Skip to content

Commit ff6e3e0

Browse files
anandrdbzAnandAnandAnandAnand Radhakrishnan
authored
GRCBC (#698)
Co-authored-by: Anand <[email protected]> Co-authored-by: Anand <[email protected]> Co-authored-by: Anand <[email protected]> Co-authored-by: Anand Radhakrishnan <[email protected]> Co-authored-by: Anand <[email protected]>
1 parent 80cfb88 commit ff6e3e0

File tree

25 files changed

+1578
-1
lines changed

25 files changed

+1578
-1
lines changed

docs/documentation/case.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -815,6 +815,22 @@ The boundary condition supported by the MFC are listed in table [Boundary Condit
815815
Their number (`#`) corresponds to the input value in `input.py` labeled `bc_[x,y,z]%[beg,end]` (see table [Simulation Algorithm Parameters](#5-simulation-algorithm)).
816816
The entries labeled "Characteristic." are characteristic boundary conditions based on [Thompson (1987)](references.md#Thompson87) and [Thompson (1990)](references.md#Thompson90).
817817

818+
### Generalized Characteristic Boundary conditions
819+
820+
| Parameter | Type | Description |
821+
| ---: | :----: | :--- |
822+
| `bc_[x,y,z]%grcbc_in` | Logical | Enable grcbc for subsonic inflow |
823+
| `bc_[x,y,z]%grcbc_out` | Logical | Enable grcbc for subsonic outflow (pressure)|
824+
| `bc_[x,y,z]%grcbc_vel_out` | Logical | Enable grcbc for subsonic outflow (pressure + normal velocity) |
825+
| `bc_[x,y,z]%vel_in` | Real Array | Inflow velocities in x, y and z directions |
826+
| `bc_[x,y,z]%vel_out` | Real Array | Outflow velocities in x, y and z directions |
827+
| `bc_[x,y,z]%pres_in` | Real | Inflow pressure |
828+
| `bc_[x,y,z]%pres_out` | Real | Outflow pressure |
829+
| `bc_[x,y,z]%alpha_rho_in` | Real Array | Inflow density |
830+
| `bc_[x,y,z]%alpha_in` | Real Array | Inflow void fraction |
831+
832+
This boundary condition can be used for subsonic inflow (`bc_[x,y,z]%[beg,end]` = -7) and subsonic outflow (`bc_[x,y,z]%[beg,end]` = -8) characteristic boundary conditions. These are based on [Pirozzoli (2013)](references.md#Pirozzoli13). This enables to provide inflow and outflow conditions outside the computational domain.
833+
818834
### Patch types
819835

820836
| # | Name | Dim. | Smooth | Description |

docs/documentation/references.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232

3333
- <a id="Meng16">Meng, J. C. C. (2016). Numerical simulations of droplet aerobreakup. PhD thesis, California Institute of Technology.</a>
3434

35+
- <a id="Pirozzoli13">Pirozzoli, S., and Colonius, T. (2013). Generalized characteristic relaxation boundary conditions for unsteady compressible flow simulations. Journal of Computational Physics, 248:109-126.</a>
36+
3537
- <a id="Preston07">Preston, A., Colonius, T., and Brennen, C. (2007). A reduced-order model of diffusive effects on the dynamics of bubbles. Physics of Fluids, 19(12):123302.</a>
3638

3739
- <a id="Saurel09">Saurel, R., Petitpas, F., and Berry, R. A. (2009). Simple and efficient relaxation methods for interfaces separating compressible fluids, cavitating flows and shocks in multiphase mixtures. journal of Computational Physics, 228(5):1678–1712</a>

examples/2D_acoustic_pulse/case.py

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
import math
2+
import json
3+
4+
# Numerical setup
5+
Nx = 99
6+
Ny = 99
7+
dx = 8./(1.*(Nx+1))
8+
9+
alf_st = 0.4
10+
11+
p_inf = 101325
12+
rho_inf = 1
13+
gam = 1.4
14+
15+
c = math.sqrt(gam*(p_inf) / rho_inf)
16+
cfl = 0.3
17+
mydt = cfl * dx / c
18+
Tfinal = 80*1 / c
19+
Nt = int(Tfinal/mydt)
20+
21+
# Configuring case dictionary
22+
print(json.dumps({
23+
# Logistics ================================================================
24+
'run_time_info' : 'T',
25+
# ==========================================================================
26+
27+
# Computational Domain Parameters ==========================================
28+
'x_domain%beg' : -4,
29+
'x_domain%end' : 4,
30+
'y_domain%beg' : -4,
31+
'y_domain%end' : 4,
32+
'm' : Nx,
33+
'n' : Ny,
34+
'p' : 0,
35+
'dt' : mydt,
36+
't_step_start' : 0,
37+
't_step_stop' : Nt,
38+
't_step_save' : int(Nt/100),
39+
# ==========================================================================
40+
41+
# Simulation Algorithm Parameters ==========================================
42+
'num_patches' : 2,
43+
'model_eqns' : 2,
44+
'alt_soundspeed' : 'F',
45+
'num_fluids' : 1,
46+
'mpp_lim' : 'F',
47+
'mixture_err' : 'F',
48+
'time_stepper' : 3,
49+
'weno_order' : 5,
50+
'weno_eps' : 1.E-16,
51+
'mapped_weno' : 'T',
52+
'null_weights' : 'F',
53+
'mp_weno' : 'F',
54+
'riemann_solver' : 2,
55+
'wave_speeds' : 1,
56+
'avg_state' : 2,
57+
'bc_x%beg' : -8,
58+
'bc_x%end' : -8,
59+
'bc_y%beg' : -8,
60+
'bc_y%end' : -8,
61+
# ==========================================================================
62+
63+
# Formatted Database Files Structure Parameters ============================
64+
'format' : 1,
65+
'precision' : 2,
66+
'prim_vars_wrt' :'T',
67+
'parallel_io' :'T',
68+
'omega_wrt(3)' :'T',
69+
'fd_order' : 2,
70+
# ==========================================================================
71+
72+
# Patch 1 ==================================================================
73+
'patch_icpp(1)%geometry' : 3,
74+
'patch_icpp(1)%x_centroid' : 0,
75+
'patch_icpp(1)%y_centroid' : 0,
76+
'patch_icpp(1)%length_x' : 8.,
77+
'patch_icpp(1)%length_y' : 8.,
78+
'patch_icpp(1)%vel(1)' : 0,
79+
'patch_icpp(1)%vel(2)' : 0,
80+
'patch_icpp(1)%pres' : p_inf,
81+
'patch_icpp(1)%alpha_rho(1)' : rho_inf,
82+
'patch_icpp(1)%alpha(1)' : 1.,
83+
# ==========================================================================
84+
85+
# Patch 2 ==================================================================
86+
'patch_icpp(2)%geometry' : 2,
87+
'patch_icpp(2)%x_centroid' : 0,
88+
'patch_icpp(2)%y_centroid' : 0,
89+
'patch_icpp(2)%radius' : 1.,
90+
'patch_icpp(2)%vel(1)' : 0,
91+
'patch_icpp(2)%vel(2)' : 0,
92+
'patch_icpp(2)%pres' : f"{p_inf}*(1 - 0.5*({gam} - 1)*({alf_st})**2*exp(0.5*(1 - sqrt(x**2 + y**2))))**({gam} / ({gam} - 1))",
93+
'patch_icpp(2)%alpha_rho(1)' : f"{rho_inf}*(1 - 0.5*({gam} - 1)*({alf_st})**2*exp(0.5*(1 - sqrt(x**2 + y**2))))**(1 / ({gam} - 1))",
94+
'patch_icpp(2)%alpha(1)' : 1.,
95+
'patch_icpp(2)%alter_patch(1)' : 'T',
96+
# ==========================================================================
97+
98+
# CBC Inflow / Outflow ========================================
99+
'bc_x%grcbc_in' : 'F',
100+
'bc_x%grcbc_out' : 'T',
101+
'bc_x%grcbc_vel_out' : 'F',
102+
'bc_x%pres_out' : p_inf,
103+
'bc_y%grcbc_in' : 'F',
104+
'bc_y%grcbc_out' : 'T',
105+
'bc_y%grcbc_vel_out' : 'F',
106+
'bc_y%pres_out' : p_inf,
107+
# # ========================================================================
108+
109+
# Fluids Physical Parameters ===============================================
110+
'fluid_pp(1)%gamma' : 1.E+00/(gam-1.E+00),
111+
'fluid_pp(1)%pi_inf' : 0.0,
112+
# ==========================================================================
113+
}))
114+
115+
# ==============================================================================
Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
import json
2+
import math
3+
4+
Mu = 1.84E-05
5+
gam_a = 1.4
6+
gam_b = 1.1
7+
8+
9+
x0 = 10E-06
10+
p0 = 101325
11+
rho0 = 1.0
12+
c0 = math.sqrt( p0/rho0 )
13+
patm = 1.
14+
rhoatm = 1.
15+
16+
#air props
17+
n_tait = 1.4
18+
B_tait = 0.0
19+
20+
21+
vf0 = 0.0
22+
23+
cact = math.sqrt(n_tait*(p0 + p0*B_tait) / ((1 - vf0) * rho0) )
24+
cfl = 0.3
25+
Nx = 400
26+
Ny = 200
27+
dx = 6.E-03 / (x0*float(Nx))
28+
dt = cfl*dx*c0/cact
29+
30+
31+
vel = 1.5
32+
vel_ac = vel * c0
33+
34+
Min = (n_tait + 1)*vel_ac + math.sqrt((n_tait + 1)**2 * vel_ac**2 + 16 * cact**2)
35+
Min = Min / (4 * cact)
36+
beta = (n_tait + 1) * Min**2 / (Min**2 * (n_tait - 1 + 2*vf0) + 2 * (1 - vf0))
37+
delta = (1 - vf0) + n_tait * Min**2 * (beta - 1) * (1 + B_tait) / beta
38+
39+
vel = Min * cact * (beta - 1) / (beta * c0)
40+
41+
# Configuring case dictionary
42+
print(json.dumps({
43+
# Logistics ================================================================
44+
'run_time_info' : 'F',
45+
# ==========================================================================
46+
47+
# Computational Domain Parameters ==========================================
48+
'x_domain%beg' : 0.0E+00,
49+
'x_domain%end' : 6.0E-03 / x0,
50+
'y_domain%beg' : 0.0E+00,
51+
'y_domain%end' : 3.0E-03 / x0,
52+
'cyl_coord' : 'F',
53+
'm' : Nx,
54+
'n' : Ny,
55+
'p' : 0,
56+
'dt' : dt,
57+
't_step_start' : 0,
58+
't_step_stop' : 1000, #3000
59+
't_step_save' : 10, #10
60+
# ==========================================================================
61+
62+
# Simulation Algorithm Parameters ==========================================
63+
'num_patches' : 2,
64+
# Use the 5 equation model
65+
'model_eqns' : 2,
66+
'alt_soundspeed' : 'F',
67+
'num_fluids' : 1,
68+
# No need to ensure the volume fractions sum to unity at the end of each
69+
# time step
70+
'mpp_lim' : 'F',
71+
# Correct errors when computing speed of sound
72+
'mixture_err' : 'T',
73+
# Use TVD RK3 for time marching
74+
'time_stepper' : 3,
75+
# Reconstruct the primitive variables to minimize spurious
76+
# Use WENO5
77+
'weno_order' : 5,
78+
'weno_eps' : 1.E-16,
79+
'weno_Re_flux' : 'F',
80+
'weno_avg' : 'T',
81+
'avg_state' : 2,
82+
# Use the mapped WENO weights to maintain monotinicity
83+
'mapped_weno' : 'T',
84+
'null_weights' : 'F',
85+
'mp_weno' : 'F',
86+
# Use the HLLC Riemann solver
87+
'riemann_solver' : 2,
88+
'wave_speeds' : 1,
89+
'bc_x%beg' : -7,
90+
'bc_x%end' : -8,
91+
'bc_y%beg' : -3,
92+
'bc_y%end' : -3,
93+
# Set IB to True and add 1 patch
94+
'ib' : 'T',
95+
'num_ibs' : 1,
96+
# ==========================================================================
97+
98+
# Formatted Database Files Structure Parameters ============================
99+
# Export primitive variables in double precision with parallel
100+
# I/O to minimize I/O computational time during large simulations
101+
'format' : 1,
102+
'precision' : 2,
103+
'prim_vars_wrt' :'T',
104+
'fd_order' : 1,
105+
'omega_wrt(3)' :'T',
106+
'parallel_io' :'T',
107+
# ==========================================================================
108+
109+
#Ambient State =====================================
110+
'patch_icpp(1)%geometry' : 3,
111+
'patch_icpp(1)%x_centroid' : 3.0E-03 / x0,
112+
'patch_icpp(1)%y_centroid' : 1.50E-03 / x0,
113+
'patch_icpp(1)%length_x' : 6.0E-03 / x0,
114+
'patch_icpp(1)%length_y' : 3.0E-03 / x0,
115+
'patch_icpp(1)%alpha_rho(1)' : rhoatm,
116+
'patch_icpp(1)%alpha(1)' : 1,
117+
'patch_icpp(1)%vel(1)' : 0.0,
118+
'patch_icpp(1)%vel(2)' : 0.0E+00,
119+
'patch_icpp(1)%pres' : patm,
120+
'patch_icpp(1)%r0' : 1.,
121+
'patch_icpp(1)%v0' : 0.0E+00,
122+
# # ========================================================================
123+
124+
#Shocked State =====================================
125+
'patch_icpp(2)%geometry' : 3,
126+
'patch_icpp(2)%x_centroid' : 0.5E-03 / x0,
127+
'patch_icpp(2)%y_centroid' : 1.50E-03 / x0,
128+
'patch_icpp(2)%length_x' : 1.0E-03 / x0,
129+
'patch_icpp(2)%length_y' : 3.0E-03 / x0,
130+
'patch_icpp(2)%alpha_rho(1)' : beta*rhoatm,
131+
'patch_icpp(2)%alpha(1)' : 1.,
132+
'patch_icpp(2)%vel(1)' : vel,
133+
'patch_icpp(2)%vel(2)' : 0.0E+00,
134+
'patch_icpp(2)%pres' : delta*patm,
135+
'patch_icpp(2)%r0' : 1.,
136+
'patch_icpp(2)%v0' : 0.0E+00,
137+
'patch_icpp(2)%alter_patch(1)' : 'T',
138+
# # ========================================================================
139+
140+
141+
# CBC Inflow / Outflow ========================================
142+
'bc_x%grcbc_in' : 'T',
143+
'bc_x%grcbc_out' : 'F',
144+
'bc_x%grcbc_vel_out' : 'F',
145+
'bc_x%vel_in(1)' : vel,
146+
'bc_x%vel_in(2)' : 0,
147+
'bc_x%vel_in(3)' : 0,
148+
'bc_x%pres_in' : delta*patm,
149+
'bc_x%alpha_rho_in(1)' : beta*rhoatm,
150+
'bc_x%alpha_in(1)' : 1,
151+
'bc_x%vel_out(1)' : vel,
152+
'bc_x%vel_out(2)' : 0,
153+
'bc_x%vel_out(3)' : 0,
154+
'bc_x%pres_out' : 1.,
155+
# # ========================================================================
156+
157+
# Patch: Cylinder Immersed Boundary ========================================
158+
'patch_ib(1)%geometry' : 4,
159+
'patch_ib(1)%x_centroid' : 1.5E-03 / x0,
160+
'patch_ib(1)%y_centroid' : 1.5E-03 / x0,
161+
'patch_ib(1)%c' : 1.0E-03 / x0,
162+
'patch_ib(1)%t' : 0.15,
163+
'patch_ib(1)%p' : 0.4,
164+
'patch_ib(1)%m' : 0.02,
165+
'patch_ib(1)%slip' : 'F',
166+
'patch_ib(1)%theta' : 15,
167+
168+
# Fluids Physical Parameters ===============================
169+
# Surrounding liquid
170+
'fluid_pp(1)%gamma' : 1.E+00/(n_tait-1.E+00),
171+
'fluid_pp(1)%pi_inf' : n_tait*B_tait/(n_tait-1.),
172+
#'fluid_pp(1)%Re(1)' : 67567,
173+
174+
175+
# ==========================================================================
176+
}))

0 commit comments

Comments
 (0)