Skip to content

Commit 437e2d1

Browse files
hyeoksu-leeHyeoksu LeeHyeoksu LeeHyeoksu LeeHyeoksu Lee
authored
Operator splitting, adaptive time stepping, and other fixes for mixing layer and bubbles (#285)
Co-authored-by: Hyeoksu Lee <[email protected]> Co-authored-by: Hyeoksu Lee <[email protected]> Co-authored-by: Hyeoksu Lee <[email protected]> Co-authored-by: Hyeoksu Lee <[email protected]> Co-authored-by: Hyeoksu Lee <[email protected]> Co-authored-by: Hyeoksu Lee <[email protected]> Co-authored-by: Hyeoksu Lee <[email protected]> Co-authored-by: Anand Radhakrishnan <[email protected]> Co-authored-by: Anand Radhakrishnan <[email protected]> Co-authored-by: Anand Radhakrishnan <[email protected]> Co-authored-by: Anand <[email protected]>
1 parent b3761e3 commit 437e2d1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+3383
-227
lines changed

docs/documentation/case.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ There are multiple sets of parameters that must be specified in the python input
7979
8. [(Optional) Ensemble-Averaged Bubble Model Parameters](#8-ensemble-averaged-bubble-model)
8080
9. [(Optional) Velocity Field Setup Parameters](#9-velocity-field-setup)
8181
10. [(Optional) Phase Change Parameters](#10-Phase-Change-Model)
82+
11. [(Optional) Artificial Mach Number Parameters](#11-artificial-Mach-number)
8283

8384
Items 7, 8, 9, and 10 are optional sets of parameters that activate the acoustic source model, ensemble-averaged bubble model, initial velocity field setup, and phase change, respectively.
8485
Definition of the parameters is described in the following subsections.
@@ -348,9 +349,11 @@ Details of implementation of viscosity in MFC can be found in [Coralic (2015)](r
348349
| `model_eqns` | Integer | Multicomponent model: [1] $\Gamma/\Pi_\infty$; [2] 5-equation; [3] 6-equation\\%;%[4] 4-equation |
349350
| `alt_soundspeed` * | Logical | Alternate sound speed and $K \nabla \cdot u$ for 5-equation model |
350351
| `adv_alphan` | Logical | Equations for all $N$ volume fractions (instead of $N-1$) |
352+
| `adv_n` | Logical | Solving directly for the number density (in the method of classes) and compute void fraction from the number density |
351353
| `mpp_lim` | Logical | Mixture physical parameters limits |
352354
| `mixture_err` | Logical | Mixture properties correction |
353-
| `time_stepper` | Integer | Runge-Kutta order [1-3] |
355+
| `time_stepper` | Integer | Runge--Kutta order [1-3] |
356+
| `adap_dt` | Loginal | Strang splitting scheme with adaptive time stepping |
354357
| `weno_order` | Integer | WENO order [1,3,5] |
355358
| `weno_eps` | Real | WENO perturbation (avoid division by zero) |
356359
| `mapped_weno` | Logical | WENO with mapping of nonlinear weights |
@@ -396,13 +399,17 @@ $$ \alpha_N=1-\sum^{N-1}_{i=1} \alpha_i $$
396399
where $\alpha_i$ is the void fraction of $i$-th component.
397400
When a single-component flow is simulated, it requires that `adv_alphan = 'T'`.
398401

402+
- `adv_n` activates the direct computation of number density by the Riemann solver instead of computing number density from the void fraction in the method of classes.
403+
399404
- `mpp_lim` activates correction of solutions to avoid a negative void fraction of each component in each grid cell, such that $\alpha_i>\varepsilon$ is satisfied at each time step.
400405

401406
- `mixture_err` activates correction of solutions to avoid imaginary speed of sound at each grid cell.
402407

403408
- `time_stepper` specifies the order of the Runge-Kutta (RK) time integration scheme that is used for temporal integration in simulation, from the 1st to 5th order by corresponding integer.
404409
Note that `time_stepper = 3` specifies the total variation diminishing (TVD), third order RK scheme ([Gottlieb and Shu, 1998](references.md#Gottlieb98)).
405410

411+
- `adap_dt` activates the Strang operator splitting scheme which splits flux and source terms in time marching, and an adaptive time stepping strategy is implemented for the source term. It requires `bubbles = 'T'`, `polytropic = 'T'`, `adv_n = 'T'` and `time_stepper = 3`.
412+
406413
- `weno_order` specifies the order of WENO scheme that is used for spatial reconstruction of variables by an integer of 1, 3, and 5, that correspond to the 1st, 3rd, and 5th order, respectively.
407414

408415
- `weno_eps` specifies the lower bound of the WENO nonlinear weights.
@@ -636,8 +643,7 @@ The parameters are optionally used to define initial velocity profiles and pertu
636643

637644
- `vel_profile` activates setting the mean streamwise velocity to hyperbolic tangent profile. This option works only for 2D and 3D cases.
638645

639-
- `instability_wave` activates the perturbation of initial velocity by instability waves obtained from linear stability analysis for a mixing layer with hyperbolic tangent mean streamwise velocity profile.
640-
This option only works for 2D and 3D cases, together with `vel_profile = 'T'`.
646+
- `instability_wave` activates the perturbation of initial velocity by instability waves obtained from linear stability analysis for a mixing layer with hyperbolic tangent mean streamwise velocity profile. This option only works for `n > 0`, `bc_y%[beg,end] = -5`, and `vel_profile = 'T'`.
641647

642648
### 11. Phase Change Model
643649
| Parameter | Type | Description |
@@ -655,6 +661,14 @@ This option only works for 2D and 3D cases, together with `vel_profile = 'T'`.
655661

656662
- `ptgalpha_eps` Specifies the tolerance used for the Newton Solvers used in the pTg-equilibrium model.
657663

664+
### 11. Artificial Mach Number
665+
| Parameter | Type | Description |
666+
| ---: | :----: | :--- |
667+
| `pi_fac` | Real | Ratio of artificial and true `pi_\infty` values|
668+
669+
- `pi_fac` specifies the ratio of artificial and true `pi_\infty` values (`=` artificial `pi_\infty` / true `pi_\infty`). This parameter enables the use of true `pi_\infty` in bubble dynamics models, when the `pi_\infty` given in the `case.py` file is an artificial value.
670+
671+
658672
## Enumerations
659673

660674
### Boundary conditions
Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
#!/usr/bin/env python2
2+
3+
import math
4+
import json
5+
6+
# FLUID PROPERTIES ============================================================
7+
# Water
8+
n_tait = 7.1
9+
B_tait = 306.E+06
10+
rho0 = 1.E+03
11+
mul0 = 1.002E-03
12+
ss = 0.07275
13+
pv = 2.3388E+03
14+
15+
# Vapor
16+
gamma_v = 1.33
17+
M_v = 18.02
18+
mu_v = 0.8816E-05
19+
k_v = 0.019426
20+
21+
# Air
22+
gamma_n = 1.4
23+
M_n = 28.97
24+
mu_n = 1.8E-05
25+
k_n = 0.02556
26+
27+
# REFERENCE VALUES ============================================================
28+
R0ref = 50.E-06
29+
x0 = R0ref
30+
p0 = 8236. # for Ca = 1 in mixing layer scale
31+
u0 = math.sqrt( p0/rho0 )
32+
patm = 1.
33+
cact = math.sqrt(n_tait*(p0+B_tait)/rho0)
34+
35+
# NONDIMENSIONAL NUMBERS ======================================================
36+
Ca = (p0 - pv)/(rho0*(u0**2.)) # Cavitation number
37+
We = rho0*(u0**2.)*R0ref/ss # Weber number
38+
Re_inv = mul0/(rho0*u0*R0ref) # Inv. bubble Reynolds number
39+
40+
# BUBBLES =====================================================================
41+
vf0 = 1e-5
42+
nb = 1
43+
44+
# DOMAIN ======================================================================
45+
Nx = 30
46+
Ldomain = 20.E-03
47+
L = Ldomain/x0
48+
dx = L/float(Nx+1)
49+
50+
# TIME STEPS ==================================================================
51+
Tfinal = 0.05
52+
Nt = int(5e2+1)
53+
t_save = 1
54+
dt = Tfinal/(Nt-1)
55+
56+
# Configuring case dictionary
57+
print(json.dumps({
58+
# Logistics ================================================
59+
'run_time_info' : 'T',
60+
# ==========================================================
61+
62+
# Computational Domain Parameters ==========================
63+
'x_domain%beg' : -0.5*L,
64+
'x_domain%end' : 0.5*L,
65+
'stretch_x' : 'F',
66+
'cyl_coord' : 'F',
67+
'm' : Nx,
68+
'n' : 0,
69+
'p' : 0,
70+
'dt' : dt,
71+
't_step_start' : 0,
72+
't_step_stop' : Nt,
73+
't_step_save' : t_save,
74+
# ==========================================================
75+
76+
# Simulation Algorithm Parameters ==========================
77+
'num_patches' : 1,
78+
'model_eqns' : 2,
79+
'alt_soundspeed' : 'F',
80+
'num_fluids' : 1,
81+
'adv_alphan' : 'T',
82+
'mpp_lim' : 'F',
83+
'mixture_err' : 'F',
84+
'time_stepper' : 3,
85+
'weno_order' : 5,
86+
'weno_eps' : 1.E-16,
87+
'mapped_weno' : 'T',
88+
'null_weights' : 'F',
89+
'mp_weno' : 'T',
90+
'riemann_solver' : 2,
91+
'wave_speeds' : 1,
92+
'avg_state' : 2,
93+
'bc_x%beg' : -1,
94+
'bc_x%end' : -1,
95+
# ==========================================================
96+
97+
# Formatted Database Files Structure Parameters ============
98+
'format' : 1,
99+
'precision' : 2,
100+
'prim_vars_wrt' :'T',
101+
'parallel_io' :'T',
102+
'fd_order' : 1,
103+
# ==========================================================
104+
105+
# Patch 1 _ Background =====================================
106+
'patch_icpp(1)%geometry' : 1,
107+
'patch_icpp(1)%x_centroid' : 0.,
108+
'patch_icpp(1)%length_x' : L,
109+
'patch_icpp(1)%vel(1)' : 0.,
110+
'patch_icpp(1)%pres' : 1000.,
111+
'patch_icpp(1)%alpha_rho(1)' : (1.-vf0),
112+
'patch_icpp(1)%alpha(1)' : vf0,
113+
'patch_icpp(1)%r0' : 1.,
114+
'patch_icpp(1)%v0' : 0.,
115+
# ==========================================================
116+
117+
# Non-polytropic gas compression model AND/OR Tait EOS =====
118+
'pref' : p0,
119+
'rhoref' : rho0,
120+
# ==========================================================
121+
122+
# Bubbles ==================================================
123+
'bubbles' : 'T',
124+
'bubble_model' : 2,
125+
126+
# Nondimensional numbers
127+
'Ca' : Ca,
128+
'Web' : We,
129+
'Re_inv' : Re_inv,
130+
131+
# adv_n
132+
'adv_n' : 'T',
133+
134+
# adap_dt
135+
'adap_dt' : 'T',
136+
137+
# Gas compression model
138+
'polytropic' : 'T',
139+
'thermal' : 1,
140+
141+
# Polydispersity
142+
'polydisperse' : 'F',
143+
'nb' : nb,
144+
145+
# QBMM
146+
'qbmm' : 'F',
147+
# ==========================================================
148+
149+
# Fluids Physical Parameters ===============================
150+
# Surrounding liquid
151+
'fluid_pp(1)%gamma' : 1.E+00/(n_tait-1.E+00),
152+
'fluid_pp(1)%pi_inf' : n_tait*(B_tait/p0)/(n_tait-1.),
153+
'fluid_pp(1)%ss' : ss,
154+
'fluid_pp(1)%pv' : pv,
155+
156+
# Last fluid_pp is always reserved for bubble gas state ===
157+
# if applicable ==========================================
158+
'fluid_pp(2)%gamma' : 1./(gamma_n-1.),
159+
'fluid_pp(2)%pi_inf' : 0.0E+00,
160+
# ==========================================================
161+
162+
}))
163+
164+
# ==============================================================================
Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
#!/usr/bin/env python3
2+
3+
import math
4+
import json
5+
6+
# FLUID PROPERTIES (WATER, VAPOR & AIR) ========================================
7+
# Water
8+
rho_w = 1.E+03 # [kg/m3] density of water
9+
gamma_w = 7.1 # [1] specific heat ratio
10+
pi_inf_w = 3.06E+08 # [N/m2] water stiffness
11+
# ==============================================================================
12+
13+
# REFERENCE VALUES =============================================================
14+
x_ref = 0.002475 # [m] initial vorticity thickness
15+
u_ref = 3.4343 # [m/s] upper stream velocity
16+
# ==============================================================================
17+
18+
# NON-DIMENSIONAL NUMBERS ======================================================
19+
Re = 50. # [1] Reynolds number based on the upper stream
20+
# velocity and the initial vorticity thickness
21+
# ==============================================================================
22+
23+
# SPEED OF SOUND ===============================================================
24+
pres = 8236. # [N/m2] pressure of water
25+
c_w = math.sqrt(gamma_w*(pres+pi_inf_w)/rho_w)
26+
# ==============================================================================
27+
28+
# MODIFIED PROPERTIES FOR ARTIFICIAL MACH NUMBER ==============================
29+
Ma_t = 0.1 # [1] target Mach number
30+
pi_fac = (rho_w*u_ref**2/(gamma_w*Ma_t**2)-pres)/pi_inf_w
31+
pi_inf_w = pi_inf_w*pi_fac
32+
c_w = math.sqrt(gamma_w*(pres+pi_inf_w)/rho_w)
33+
# =============================================================================
34+
35+
# SIMULATION SETUP ============================================================
36+
# Domain size
37+
Lx = 59.0
38+
Ly = 59.0
39+
40+
# Number of grid cells
41+
Nx = 191
42+
Ny = 191
43+
44+
# Grid spacing
45+
dx = Lx/float(Nx+1)
46+
dy = Ly/float(Ny+1)
47+
48+
# Time advancement
49+
cfl = 5e-1
50+
T = 20.
51+
dt = cfl*dx/(1.+c_w/u_ref)
52+
Ntfinal = int(T/dt)
53+
Ntstart = 0
54+
Nfiles = 20
55+
t_save = int(math.ceil((Ntfinal-0)/float(Nfiles)))
56+
Nt = t_save*Nfiles
57+
t_step_start = Ntstart
58+
t_step_stop = int(Nt)
59+
60+
# ==============================================================================
61+
62+
63+
# Configuring case dictionary
64+
print(json.dumps({
65+
# Logistics ================================================================
66+
'run_time_info' : 'T',
67+
# ==========================================================================
68+
69+
# Computational Domain Parameters ==========================================
70+
'x_domain%beg' : 0.,
71+
'x_domain%end' : Lx,
72+
'y_domain%beg' : -Ly/2.,
73+
'y_domain%end' : Ly/2.,
74+
'm' : Nx,
75+
'n' : Ny,
76+
'p' : 0,
77+
'dt' : dt,
78+
't_step_start' : t_step_start,
79+
't_step_stop' : t_step_stop,
80+
't_step_save' : t_save,
81+
# ==========================================================================
82+
83+
# Simulation Algorithm Parameters ==========================================
84+
'num_patches' : 1,
85+
'model_eqns' : 2,
86+
'num_fluids' : 1,
87+
'time_stepper' : 3,
88+
'weno_order' : 5,
89+
'weno_eps' : 1.E-16,
90+
'weno_Re_flux' : 'T',
91+
'mapped_weno' : 'T',
92+
'riemann_solver' : 2,
93+
'wave_speeds' : 1,
94+
'avg_state' : 2,
95+
'bc_x%beg' : -1,
96+
'bc_x%end' : -1,
97+
'bc_y%beg' : -5,
98+
'bc_y%end' : -5,
99+
# ==========================================================================
100+
101+
# Formatted Database Files Structure Parameters ============================
102+
'format' : 1,
103+
'precision' : 2,
104+
'cons_vars_wrt' :'T',
105+
'prim_vars_wrt' :'T',
106+
'parallel_io' :'T',
107+
'fd_order' : 1,
108+
'omega_wrt(3)' :'T',
109+
# ==========================================================================
110+
111+
# Patch 1 ==================================================================
112+
'patch_icpp(1)%geometry' : 3,
113+
'patch_icpp(1)%x_centroid' : Lx/2.,
114+
'patch_icpp(1)%y_centroid' : 0.,
115+
'patch_icpp(1)%length_x' : Lx,
116+
'patch_icpp(1)%length_y' : Ly,
117+
'patch_icpp(1)%alpha_rho(1)' : 1.,
118+
'patch_icpp(1)%alpha(1)' : 1.,
119+
'patch_icpp(1)%vel(1)' : 1.,
120+
'patch_icpp(1)%vel(2)' : 0.,
121+
'patch_icpp(1)%pres' : pres/(rho_w*u_ref**2),
122+
# ==========================================================================
123+
124+
# Mixing layer === =========================================================
125+
'vel_profile' : 'T',
126+
'instability_wave' : 'T',
127+
# ==========================================================================
128+
129+
# Artificial Mach number ===================================================
130+
'pi_fac' : pi_fac,
131+
# ==========================================================================
132+
133+
# Fluids Physical Parameters ===============================================
134+
'fluid_pp(1)%gamma' : 1.E+00/(gamma_w-1.E+00),
135+
'fluid_pp(1)%pi_inf' : gamma_w*(pi_inf_w/(rho_w*u_ref**2))/(gamma_w-1.E+00),
136+
'fluid_pp(1)%Re(1)' : Re,
137+
# =========================================================================
138+
}))
139+
140+
# ==============================================================================

src/common/m_helper.fpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ module m_helper
1111

1212
use m_global_parameters !< Definitions of the global parameters
1313

14+
use m_mpi_common !< MPI modules
15+
16+
use ieee_arithmetic !< For checking NaN
17+
1418
! ==========================================================================
1519

1620
implicit none

0 commit comments

Comments
 (0)