Skip to content

Commit 2902000

Browse files
hyeoksu-leeqodo-code-review[bot]Hyeoksu Lee
authored
Refactor subgrid bubble models (#1085)
Co-authored-by: qodo-code-review[bot] <151058649+qodo-code-review[bot]@users.noreply.github.com> Co-authored-by: Hyeoksu Lee <[email protected]>
1 parent 8ae42aa commit 2902000

File tree

73 files changed

+1129
-1369
lines changed

Some content is hidden

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

73 files changed

+1129
-1369
lines changed

benchmarks/viscous_weno5_sgb_acoustic/case.py

Lines changed: 26 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,17 @@
2929
x0 = 10.0e-04
3030
y0 = 10.0e-04
3131
z0 = 10.0e-04
32-
p0 = 1.0
32+
p0 = 101325.0
33+
p0ref = p0
3334
rho0 = 1.0e03
34-
c0 = math.sqrt(p0 / rho0)
35-
patm = 1.0
35+
rho0ref = rho0
36+
u0 = math.sqrt(p0 / rho0)
37+
p0ext = 101325.0
3638

3739
# water props
38-
n_tait = 7.1
39-
B_tait = 306.0e06 / p0
40-
mul0 = 1.002e-03 # viscosity
40+
gam_l = 7.1
41+
pi_inf_l = 306.0e06
42+
mu_l = 1.002e-03 # viscosity
4143
ss = 0.07275 # surface tension
4244
pv = 2.3388e03 # vapor pressure
4345

@@ -47,43 +49,25 @@
4749
k_v = 0.019426
4850

4951
# air props
50-
gamma_n = 1.4
51-
M_n = 28.97
52-
mu_n = 1.8e-05
53-
k_n = 0.02556
54-
55-
# air props
56-
gamma_gas = gamma_n
52+
gam_g = 1.4
5753

5854
# reference bubble size
5955
R0ref = 10.0e-06
6056

61-
pa = 0.1 * 1.0e06 / 101325.0
62-
63-
# Characteristic velocity
64-
uu = math.sqrt(p0 / rho0)
65-
# Cavitation number
66-
Ca = (p0 - pv) / (rho0 * (uu**2.0))
67-
# Weber number
68-
We = rho0 * (uu**2.0) * R0ref / ss
69-
# Inv. bubble Reynolds number
70-
Re_inv = mul0 / (rho0 * uu * R0ref)
57+
pa = 0.1 * 1.0e06
7158

7259
# IC setup
7360
vf0 = 0.00004
7461
n0 = vf0 / (math.pi * 4.0e00 / 3.0e00)
7562

7663
cact = 1475.0
77-
t0 = x0 / c0
78-
79-
nbubbles = 1
80-
myr0 = R0ref
64+
t0 = x0 / u0
8165

8266
cfl = 0.01
8367
Ldomain = 20.0e-03
8468
L = Ldomain / x0
8569
dx = L / float(Nx)
86-
dt = cfl * dx * c0 / cact
70+
dt = cfl * dx * u0 / cact
8771
Lpulse = 0.3 * Ldomain
8872
Tpulse = Lpulse / cact
8973

@@ -150,10 +134,10 @@
150134
"patch_icpp(1)%vel(1)": 0.0,
151135
"patch_icpp(1)%vel(2)": 0.0,
152136
"patch_icpp(1)%vel(3)": 0.0,
153-
"patch_icpp(1)%pres": patm,
137+
"patch_icpp(1)%pres": p0ext / p0,
154138
"patch_icpp(1)%alpha_rho(1)": (1.0 - 1.0e-12) * 1.0e03 / rho0,
155139
"patch_icpp(1)%alpha(1)": 1.0e-12,
156-
"patch_icpp(1)%r0": 1.0,
140+
"patch_icpp(1)%r0": R0ref / x0,
157141
"patch_icpp(1)%v0": 0.0e00,
158142
# Patch 2 Screen
159143
"patch_icpp(2)%geometry": 9,
@@ -167,46 +151,30 @@
167151
"patch_icpp(2)%vel(1)": 0.0,
168152
"patch_icpp(2)%vel(2)": 0.0,
169153
"patch_icpp(2)%vel(3)": 0.0,
170-
"patch_icpp(2)%pres": patm,
154+
"patch_icpp(2)%pres": p0ext / p0,
171155
"patch_icpp(2)%alpha_rho(1)": (1.0 - vf0) * 1.0e03 / rho0,
172156
"patch_icpp(2)%alpha(1)": vf0,
173-
"patch_icpp(2)%r0": 1.0,
157+
"patch_icpp(2)%r0": R0ref / x0,
174158
"patch_icpp(2)%v0": 0.0e00,
175159
# Fluids Physical Parameters
176160
# Surrounding liquid
177-
"fluid_pp(1)%gamma": 1.0e00 / (n_tait - 1.0e00),
178-
"fluid_pp(1)%pi_inf": n_tait * B_tait / (n_tait - 1.0),
179-
"fluid_pp(1)%mul0": mul0,
180-
"fluid_pp(1)%ss": ss,
181-
"fluid_pp(1)%pv": pv,
182-
"fluid_pp(1)%gamma_v": gamma_v,
183-
"fluid_pp(1)%M_v": M_v,
184-
"fluid_pp(1)%mu_v": mu_v,
185-
"fluid_pp(1)%k_v": k_v,
161+
"fluid_pp(1)%gamma": 1.0e00 / (gam_l - 1.0e00),
162+
"fluid_pp(1)%pi_inf": gam_l * (pi_inf_l / p0) / (gam_l - 1.0),
186163
"fluid_pp(1)%Re(1)": 1e3,
187-
# Last fluid_pp is always reserved for bubble gas state
188-
# if applicable
189-
"fluid_pp(2)%gamma": 1.0 / (gamma_gas - 1.0),
190-
"fluid_pp(2)%pi_inf": 0.0e00,
191-
"fluid_pp(2)%gamma_v": gamma_n,
192-
"fluid_pp(2)%M_v": M_n,
193-
"fluid_pp(2)%mu_v": mu_n,
194-
"fluid_pp(2)%k_v": k_n,
195-
# Non-polytropic gas compression model AND/OR Tait EOS
196-
"pref": p0,
197-
"rhoref": rho0,
198164
# Bubbles
199165
"bubbles_euler": "T",
200166
"bubble_model": 3,
201167
"polytropic": "T",
202168
"polydisperse": "F",
203-
# 'poly_sigma' : 0.3,
204169
"thermal": 3,
205-
"R0ref": myr0,
206170
"nb": 1,
207-
"Ca": Ca,
208-
"Web": We,
209-
"Re_inv": Re_inv,
171+
"bub_pp%R0ref": R0ref / x0,
172+
"bub_pp%p0ref": p0ref / p0,
173+
"bub_pp%rho0ref": rho0ref / rho0,
174+
"bub_pp%ss": ss / (rho0 * x0 * u0 * u0),
175+
"bub_pp%pv": pv / p0,
176+
"bub_pp%mu_l": mu_l / (rho0 * x0 * u0),
177+
"bub_pp%gam_g": gam_g,
210178
# Acoustic source
211179
"acoustic_source": "T",
212180
"num_source": 1,
@@ -218,7 +186,7 @@
218186
"acoustic(1)%npulse": 1,
219187
"acoustic(1)%dir": 1.0,
220188
"acoustic(1)%pulse": 1,
221-
"acoustic(1)%mag": pa,
189+
"acoustic(1)%mag": pa / p0,
222190
"acoustic(1)%wavelength": (1.0 / (300000.0)) * cact / x0,
223191
}
224192
)

docs/documentation/case.md

Lines changed: 45 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -750,60 +750,64 @@ Details of the transducer acoustic source model can be found in [Maeda and Colon
750750

751751
### 9. Sub-grid Bubble Models
752752

753-
| Parameter | Type | Description |
754-
| ---: | :----: | :--- |
755-
| `bubbles_euler` | Logical | Ensemble-averaged bubble modeling |
756-
| `bubbles_lagrange`| Logical | Volume-averaged bubble modeling |
757-
| `bubble_model` | Integer | [1] Gilmore; [2] Keller--Miksis |
758-
| `mu_l0` * | Real | Liquid viscosity (only specify in liquid phase) |
759-
| `ss` * | Real | Surface tension (only specify in liquid phase) |
760-
| `pv` * | Real | Vapor pressure (only specify in liquid phase) |
761-
| `gamma_v`| Real | Specific heat ratio |
762-
| `M_v`| Real | Molecular weight |
763-
| `mu_v`| Real | Viscosity |
764-
| `k_v`| Real | Thermal conductivity |
765-
| `cp_v`| Real | Specific heat capacity |
766-
| `D_v`| Real | Vapor diffusivity in the gas |
767-
768-
These options work only for gas-liquid two-component flows.
769-
Component indexes are required to be 1 for liquid and 2 for gas.
770-
771-
- \* These parameters should be prepended with patch index $1$ that is filled with liquid: `fluid_pp(1)%`.
772-
- † These parameters should be prepended with patch indexes filled with liquid and gas: `fluid_pp(1)%` and `fluid_pp(2)%`.
753+
| Parameter | Type | Description |
754+
| ---: | :----: | :--- |
755+
| `bubbles_euler` | Logical | Ensemble-averaged bubble modeling |
756+
| `bubbles_lagrange` | Logical | Volume-averaged bubble modeling |
757+
| `bubble_model` | Integer | [1] Gilmore; [2] Keller--Miksis; [3] Rayleigh-Plesset |
758+
| `bub_pp%R0ref`*†‡ | Real | Reference bubble radius |
759+
| `bub_pp%p0ref`*†‡ | Real | Reference pressure |
760+
| `bub_pp%rho0ref`*†‡| Real | Reference density |
761+
| `bub_pp%T0ref`†‡ | Real | Reference temperature |
762+
| `bub_pp%ss`*†‡ | Real | Surface tension between host and gas (bubble) |
763+
| `bub_pp%pv`*†‡ | Real | Vapor pressure of host |
764+
| `bub_pp%vd`† ‡ | Real | Vapor diffusivity in gas (bubble) |
765+
| `bub_pp%mu_l`*†‡ | Real | Viscosity of host in liquid state |
766+
| `bub_pp%mu_v`| Real | Viscosity of host in vapor state |
767+
| `bub_pp%mu_g`| Real | Viscosity of gas (bubble) |
768+
| `bub_pp%gam_v`†‡ | Real | Specific heat ratio of host in vapor state |
769+
| `bub_pp%gam_g`*†‡ | Real | Specific heat ratio of gas (bubble) |
770+
| `bub_pp%M_v`†‡ | Real | Molecular weight of host |
771+
| `bub_pp%M_g`†‡ | Real | Molecular weight of gas (bubble) |
772+
| `bub_pp%k_v`†‡ | Real | Thermal conductivity of host in vapor state |
773+
| `bub_pp%k_g`†‡ | Real | Thermal conductivity of gas (bubble) |
774+
| `bub_pp%cp_v`| Real | Specific heat capacity in constant pressure of host in vapor state |
775+
| `bub_pp%cp_g`| Real | Specific heat capacity in constant pressure of gas (bubble) |
776+
| `bub_pp%R_v`†‡ | Real | Gas constant of host in vapor state |
777+
| `bub_pp%R_g`†‡ | Real | Gas constant of gas (bubble) |
778+
779+
- \* These parameters are required for ensemble-averaged bubble model.
780+
- † These parameters are required for ensemble-averaged bubble model with `polytropic = F`.
781+
- ‡ These parameters are required for volume-averaged bubble model with `polytropic = F`.
773782

774783
This table lists the sub-grid bubble model parameters, which can be utilized in both the ensemble-averaged and volume-averaged bubble models.
775784

776785
- `bubbles_euler` activates the ensemble-averaged bubble model.
777786

778787
- `bubbles_lagrange` activates the volume-averaged bubble model.
779788

780-
- `bubble_model` specified a model for spherical bubble dynamics by an integer of 1 and 2.
789+
- `bubble_model` specifies a model for spherical bubble dynamics by an integer of `1`, `2`, or `3`.
781790
`bubble_model = 1`, `2`, and `3` correspond to the Gilmore, Keller-Miksis, and Rayleigh-Plesset models.
782791

783-
- `mu_l0`, `ss`, and `pv`, `gamma_v`, `M_v`, `mu_v`, `k_v`, and `cp_v` specify simulation parameters for the non-polytropic gas compression model.
784-
`mu_l0`, `ss`, and `pv` correspond to the liquid viscosity, surface tension, and vapor pressure, respectively.
785-
`gamma_v`, `M_v`, `mu_v`, `k_v`, and `cp_v` specify the specific heat ratio, molecular weight, viscosity, thermal conductivity and specific heat capacity of a chosen component (`cp_v` only for ``bubbles_lagrange = 'T'``).
792+
- `bub_pp` specifies simulation parameters for the EE and/or EL bubble model.
793+
786794
Implementation of the parameters into the model follow [Ando (2010)](references.md).
787795

788796
#### 9.1 Ensemble-Averaged Bubble Model
789797

790-
| Parameter . | Type | Description |
791-
| ---: . | :----: | :--- |
792-
| `bubbles_euler`. | Logical | Ensemble-averaged bubble modeling |
793-
| `polytropic` | Logical | Polytropic gas compression |
794-
| `thermal` | Integer | Thermal model: [1] Adiabatic; [2] Isothermal; [3] Transfer |
795-
| `R0ref` | Real | Reference bubble radius |
796-
| `polydisperse` | Logical | Polydispersity in equilibrium bubble radius R0 |
797-
| `nb` | Integer | Number of bins: [1] Monodisperse; [$>1$] Polydisperse |
798-
| `poly_sigma` | Real | Standard deviation for probability density function of polydisperse bubble populations |
799-
| `Ca` | Real | Cavitation number |
800-
| `Web` | Real | Weber number |
801-
| `Re_inv` | Real | Inverse Reynolds number |
802-
| `qbmm` | Logical | Quadrature by method of moments |
803-
| `dist_type` | Integer | Joint probability density function for bubble radius and velocity (only for ``qbmm = 'T'``) |
804-
| `sigR` | Real | Standard deviation for the probability density function of bubble radius (only for ``qbmm = 'T'``) (EE)|
805-
| `sigV` | Real | Standard deviation for the probability density function of bubble velocity (only for ``qbmm = 'T'``) (EE)|
806-
| `rhoRV` | Real | Correlation coefficient for the joint probability density function of bubble radius and velocity (only for ``qbmm = 'T'``) |
798+
| Parameter | Type | Description |
799+
| ---: | :----: | :--- |
800+
| `bubbles_euler` | Logical | Ensemble-averaged bubble modeling |
801+
| `polytropic` | Logical | Polytropic gas compression |
802+
| `thermal` | Integer | Thermal model: [1] Adiabatic; [2] Isothermal; [3] Transfer |
803+
| `polydisperse` | Logical | Polydispersity in equilibrium bubble radius R0 |
804+
| `nb` | Integer | Number of bins: [1] Monodisperse; [$>1$] Polydisperse |
805+
| `poly_sigma` | Real | Standard deviation for probability density function of polydisperse bubble populations |
806+
| `qbmm` | Logical | Quadrature by method of moments |
807+
| `dist_type` | Integer | Joint probability density function for bubble radius and velocity (only for ``qbmm = 'T'``) |
808+
| `sigR` | Real | Standard deviation for the probability density function of bubble radius (only for ``qbmm = 'T'``) (EE)|
809+
| `sigV` | Real | Standard deviation for the probability density function of bubble velocity (only for ``qbmm = 'T'``) (EE)|
810+
| `rhoRV` | Real | Correlation coefficient for the joint probability density function of bubble radius and velocity (only for ``qbmm = 'T'``) |
807811

808812
This table lists the ensemble-averaged bubble model parameters.
809813

@@ -815,14 +819,10 @@ When ``polytropic = 'F'``, the gas compression is modeled as non-polytropic due
815819

816820
- `polydisperse` activates polydispersity in the bubble model through a probability density function (PDF) of the equilibrium bubble radius. Simpson's rule is used for integrating the log-normal PDF of equilibrium bubble radius for polydisperse populations.
817821

818-
- `R0ref` specifies the reference bubble radius.
819-
820822
- `nb` specifies the number of discrete bins that define the probability density function (PDF) of the equilibrium bubble radius.
821823

822824
- `poly_sigma` specifies the standard deviation of the log-normal PDF of equilibrium bubble radius for polydisperse populations.
823825

824-
- `Ca`, `Web`, and `Re_inv` respectively specify the Cavitation number, Weber number, and the inverse Reynolds number that characterize the offset of the gas pressure from the vapor pressure, surface tension, and liquid viscosity when the polytropic gas compression model is used.
825-
826826
- `qbmm` activates quadrature by method of moments, which assumes a PDF for bubble radius and velocity.
827827

828828
- `dist_type` specifies the initial joint PDF of initial bubble radius and bubble velocity required in qbmm. `dist_type = 1` and `2` correspond to binormal and lognormal-normal distributions respectively.
@@ -850,11 +850,6 @@ When ``polytropic = 'F'``, the gas compression is modeled as non-polytropic due
850850
| `epsilonb` | Real | Standard deviation scaling for the gaussian function |
851851
| `charwidth` | Real | Domain virtual depth (z direction, for 2D simulations) |
852852
| `valmaxvoid` | Real | Maximum void fraction permitted |
853-
| `c0` | Real | Reference speed |
854-
| `rho0` | Real | Reference density |
855-
| `T0` | Real | Reference temperature |
856-
| `x0` | Real | Reference length |
857-
| `Thost` | Real | Temperature of the surrounding liquid (host) |
858853

859854
- `nBubs_glb` Total number of bubbles. Their initial conditions need to be specified in the ./input/lag_bubbles.dat file. See the example cases for additional information.
860855

0 commit comments

Comments
 (0)