Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/documentation/case.md
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,7 @@ Details of the transducer acoustic source model can be found in [Maeda and Colon
| `mu_v` † | Real | Viscosity |
| `k_v` † | Real | Thermal conductivity |
| `cp_v` † | Real | Specific heat capacity |
| `D_v` † | Real | Vapor diffusivity in the gas |

These options work only for gas-liquid two-component flows.
Component indexes are required to be 1 for liquid and 2 for gas.
Expand Down Expand Up @@ -836,7 +837,6 @@ When ``polytropic = 'F'``, the gas compression is modeled as non-polytropic due
| `T0` | Real | Reference temperature |
| `x0` | Real | Reference length |
| `Thost` | Real | Temperature of the surrounding liquid (host) |
| `diffcoefvap` | Real | Vapor diffusivity in the gas |

- `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.

Expand Down
2 changes: 2 additions & 0 deletions examples/1D_qbmm/case.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
M_n = 28.97
mu_n = 1.8e-05
k_n = 0.02556
D = 0.242e-4

# air props
# gamma_gas = gamma_n
Expand Down Expand Up @@ -163,6 +164,7 @@
"fluid_pp(2)%M_v": M_n,
"fluid_pp(2)%mu_v": mu_n,
"fluid_pp(2)%k_v": k_n,
"fluid_pp(2)%D_v": D,
# Non-polytropic gas compression model AND/OR Tait EOS
"pref": p0,
"rhoref": rho0,
Expand Down
2 changes: 1 addition & 1 deletion examples/3D_lagrange_bubblescreen/case.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@
"lag_params%rho0": rho0,
"lag_params%T0": T0,
"lag_params%x0": x0,
"lag_params%diffcoefvap": diffVapor,
"lag_params%Thost": T_host,
# Fluids Physical Parameters
# Host medium
Expand All @@ -177,6 +176,7 @@
"fluid_pp(2)%M_v": MW_g,
"fluid_pp(2)%k_v": k_g,
"fluid_pp(2)%cp_v": cp_g,
"fluid_pp(2)%D_v": diffVapor,
}
)
)
2 changes: 1 addition & 1 deletion examples/3D_lagrange_shbubcollapse/case.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@
"lag_params%rho0": rho0,
"lag_params%T0": T0,
"lag_params%x0": x0,
"lag_params%diffcoefvap": diffVapor,
"lag_params%Thost": T_host,
# Fluids Physical Parameters
# Host medium
Expand All @@ -179,6 +178,7 @@
"fluid_pp(2)%M_v": MW_g,
"fluid_pp(2)%k_v": k_g,
"fluid_pp(2)%cp_v": cp_g,
"fluid_pp(2)%D_v": diffVapor,
}
)
)
3 changes: 2 additions & 1 deletion src/common/m_derived_types.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,8 @@ module m_derived_types
real(wp) :: k_v !< Bubble constants (see Preston (2007), Ando (2010))
real(wp) :: cp_v
real(wp) :: G
real(wp) :: D_v !< Vapor diffusivity in the gas

end type physical_parameters

type mpi_io_airfoil_ib_var
Expand Down Expand Up @@ -459,7 +461,6 @@ module m_derived_types
real(wp) :: rho0 !< Reference density
real(wp) :: T0, Thost !< Reference temperature and host temperature
real(wp) :: x0 !< Reference length
real(wp) :: diffcoefvap !< Vapor diffusivity in the gas

end type bubbles_lagrange_parameters

Expand Down
9 changes: 3 additions & 6 deletions src/common/m_helper.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,6 @@ contains
real(wp), parameter :: k_poly = 1._wp !<
!! polytropic index used to compute isothermal natural frequency

real(wp), parameter :: Ru = 8314._wp !<
!! universal gas constant

rhol0 = rhoref
pl0 = pref
#ifdef MFC_SIMULATION
Expand Down Expand Up @@ -154,15 +151,15 @@ contains
if (thermal == 2) gamma_m = 1._wp

temp = 293.15_wp
D_m = 0.242e-4_wp
D_m = fluid_pp(2)%D_v
uu = sqrt(pl0/rhol0)

omega_ref = 3._wp*k_poly*Ca + 2._wp*(3._wp*k_poly - 1._wp)/Web

!!! thermal properties !!!
! gas constants
R_n = Ru/M_n
R_v = Ru/M_v
R_n = R_uni/M_n
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Nov 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

R_uni is referenced without being imported into m_helper, so the code no longer compiles after removing the local Ru constant.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/common/m_helper.fpp, line 161:

<comment>`R_uni` is referenced without being imported into `m_helper`, so the code no longer compiles after removing the local `Ru` constant.</comment>

<file context>
@@ -154,15 +151,15 @@ contains
         ! gas constants
-        R_n = Ru/M_n
-        R_v = Ru/M_v
+        R_n = R_uni/M_n
+        R_v = R_uni/M_v
         ! phi_vn &amp; phi_nv (phi_nn = phi_vv = 1)
</file context>
Fix with Cubic

R_v = R_uni/M_v
! phi_vn & phi_nv (phi_nn = phi_vv = 1)
phi_vn = (1._wp + sqrt(mu_v/mu_n)*(M_n/M_v)**(0.25_wp))**2 &
/(sqrt(8._wp)*sqrt(1._wp + M_v/M_n))
Expand Down
1 change: 1 addition & 0 deletions src/post_process/m_global_parameters.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,7 @@ contains
fluid_pp(i)%qv = 0._wp
fluid_pp(i)%qvp = 0._wp
fluid_pp(i)%G = dflt_real
fluid_pp(i)%D_v = dflt_real
end do

! Formatted database file(s) structure parameters
Expand Down
1 change: 1 addition & 0 deletions src/post_process/m_mpi_proxy.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ contains
call MPI_BCAST(fluid_pp(i)%qv, 1, mpi_p, 0, MPI_COMM_WORLD, ierr)
call MPI_BCAST(fluid_pp(i)%qvp, 1, mpi_p, 0, MPI_COMM_WORLD, ierr)
call MPI_BCAST(fluid_pp(i)%G, 1, mpi_p, 0, MPI_COMM_WORLD, ierr)
call MPI_BCAST(fluid_pp(i)%D_v, 1, mpi_p, 0, MPI_COMM_WORLD, ierr)
end do
#:for VAR in [ 'pref', 'rhoref', 'R0ref', 'poly_sigma', 'Web', 'Ca', &
Expand Down
1 change: 1 addition & 0 deletions src/pre_process/m_global_parameters.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,7 @@ contains
fluid_pp(i)%qv = 0._wp
fluid_pp(i)%qvp = 0._wp
fluid_pp(i)%G = 0._wp
fluid_pp(i)%D_v = dflt_real
end do

Bx0 = dflt_real
Expand Down
4 changes: 2 additions & 2 deletions src/pre_process/m_mpi_proxy.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,15 +144,15 @@ contains
! Fluids physical parameters
do i = 1, num_fluids_max
#:for VAR in [ 'gamma','pi_inf','mul0','ss','pv','gamma_v','M_v', &
& 'mu_v','k_v', 'G', 'cv', 'qv', 'qvp' ]
& 'mu_v','k_v', 'G', 'cv', 'qv', 'qvp', 'D_v' ]
call MPI_BCAST(fluid_pp(i)%${VAR}$, 1, mpi_p, 0, MPI_COMM_WORLD, ierr)
#:endfor
end do

! Simplex noise and fluid physical parameters
do i = 1, num_fluids_max
#:for VAR in [ 'gamma','pi_inf','mul0','ss','pv','gamma_v','M_v', &
& 'mu_v','k_v', 'G', 'cv', 'qv', 'qvp' ]
& 'mu_v','k_v', 'G', 'cv', 'qv', 'qvp', 'D_v' ]
call MPI_BCAST(fluid_pp(i)%${VAR}$, 1, mpi_p, 0, MPI_COMM_WORLD, ierr)
#:endfor

Expand Down
6 changes: 3 additions & 3 deletions src/simulation/m_bubbles_EL.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ contains
cp_n = fluid_pp(id_host)%cp_v*(T0/(c0*c0))
R_v = (R_uni/fluid_pp(id_bubbles)%M_v)*(T0/(c0*c0))
R_n = (R_uni/fluid_pp(id_host)%M_v)*(T0/(c0*c0))
lag_params%diffcoefvap = lag_params%diffcoefvap/(x0*c0)
fluid_pp(id_bubbles)%D_v = fluid_pp(id_bubbles)%D_v/(x0*c0)
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Nov 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Existing cases still provide the diffusion coefficient via lag_params%diffcoefvap, so fluid_pp(num_fluids)%D_v stays at its default sentinel and PeG now divides by an unset value. Add a fallback that populates fluid_pp% D_v from lag_params when it has not been provided to avoid dividing by zero for current inputs.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/simulation/m_bubbles_EL.fpp, line 181:

<comment>Existing cases still provide the diffusion coefficient via `lag_params%diffcoefvap`, so `fluid_pp(num_fluids)%D_v` stays at its default sentinel and `PeG` now divides by an unset value. Add a fallback that populates `fluid_pp% D_v` from `lag_params` when it has not been provided to avoid dividing by zero for current inputs.</comment>

<file context>
@@ -178,7 +178,7 @@ contains
         R_v = (R_uni/fluid_pp(id_bubbles)%M_v)*(T0/(c0*c0))
         R_n = (R_uni/fluid_pp(id_host)%M_v)*(T0/(c0*c0))
-        lag_params%diffcoefvap = lag_params%diffcoefvap/(x0*c0)
+        fluid_pp(id_bubbles)%D_v = fluid_pp(id_bubbles)%D_v/(x0*c0)
         ss = fluid_pp(id_host)%ss/(rho0*x0*c0*c0)
         mul0 = fluid_pp(id_host)%mul0/(rho0*x0*c0)
</file context>
Fix with Cubic

ss = fluid_pp(id_host)%ss/(rho0*x0*c0*c0)
mul0 = fluid_pp(id_host)%mul0/(rho0*x0*c0)

Expand Down Expand Up @@ -386,9 +386,9 @@ contains
call s_transcoeff(1._wp, PeT, Re_trans, Im_trans)
gas_betaT(bub_id) = Re_trans*(heatflag)*kparticle

PeG = bub_R0(bub_id)**2._wp*omegaN_local/lag_params%diffcoefvap
PeG = bub_R0(bub_id)**2._wp*omegaN_local/fluid_pp(num_fluids)%D_v
call s_transcoeff(1._wp, PeG, Re_trans, Im_trans)
gas_betaC(bub_id) = Re_trans*(massflag)*lag_params%diffcoefvap
gas_betaC(bub_id) = Re_trans*(massflag)*fluid_pp(num_fluids)%D_v

if (gas_mg(bub_id) <= 0._wp) then
call s_mpi_abort("Negative gas mass in the bubble, check if the bubble is in the domain.")
Expand Down
2 changes: 1 addition & 1 deletion src/simulation/m_global_parameters.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -682,6 +682,7 @@ contains
fluid_pp(i)%k_v = dflt_real
fluid_pp(i)%cp_v = dflt_real
fluid_pp(i)%G = 0._wp
fluid_pp(i)%D_v = dflt_real
end do
! Tait EOS
Expand Down Expand Up @@ -819,7 +820,6 @@ contains
lag_params%T0 = dflt_real
lag_params%Thost = dflt_real
lag_params%x0 = dflt_real
lag_params%diffcoefvap = dflt_real
! Continuum damage model
tau_star = dflt_real
Expand Down
4 changes: 2 additions & 2 deletions src/simulation/m_mpi_proxy.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ contains
call MPI_BCAST(lag_params%${VAR}$, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr)
#:endfor

#:for VAR in [ 'c0', 'rho0', 'T0', 'x0', 'diffcoefvap', 'epsilonb','charwidth', &
#:for VAR in [ 'c0', 'rho0', 'T0', 'x0', 'epsilonb','charwidth', &
& 'valmaxvoid', 'Thost']
call MPI_BCAST(lag_params%${VAR}$, 1, mpi_p, 0, MPI_COMM_WORLD, ierr)
#:endfor
Expand Down Expand Up @@ -189,7 +189,7 @@ contains

do i = 1, num_fluids_max
#:for VAR in [ 'gamma','pi_inf','mul0','ss','pv','gamma_v','M_v', &
& 'mu_v','k_v', 'cp_v','G', 'cv', 'qv', 'qvp' ]
& 'mu_v','k_v', 'cp_v','G', 'cv', 'qv', 'qvp', 'D_v' ]
call MPI_BCAST(fluid_pp(i)%${VAR}$, 1, mpi_p, 0, MPI_COMM_WORLD, ierr)
#:endfor
call MPI_BCAST(fluid_pp(i)%Re(1), 2, mpi_p, 0, MPI_COMM_WORLD, ierr)
Expand Down
8 changes: 4 additions & 4 deletions toolchain/mfc/run/case_dicts.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def analytic(self):
PRE_PROCESS[f'fluid_rho({f_id})'] = ParamType.REAL

for real_attr in ["gamma", "pi_inf", "mul0", "ss", "pv", "gamma_v", "M_v",
"mu_v", "k_v", "cp_v", "G", "cv", "qv", "qvp" ]:
"mu_v", "k_v", "cp_v", "G", "cv", "qv", "qvp", "D_v" ]:
PRE_PROCESS[f"fluid_pp({f_id})%{real_attr}"] = ParamType.REAL

PRE_PROCESS[f"simplex_params%perturb_dens({f_id})"] = ParamType.LOG
Expand Down Expand Up @@ -349,7 +349,7 @@ def analytic(self):
for var in [ 'solver_approach', 'cluster_type', 'smooth_type', 'nBubs_glb']:
SIMULATION[f'lag_params%{var}'] = ParamType.INT

for var in [ 'epsilonb', 'valmaxvoid', 'charwidth', 'diffcoefvap',
for var in [ 'epsilonb', 'valmaxvoid', 'charwidth',
'c0', 'rho0', 'T0', 'x0', 'Thost' ]:
SIMULATION[f'lag_params%{var}'] = ParamType.REAL

Expand Down Expand Up @@ -414,7 +414,7 @@ def analytic(self):

for f_id in range(1,10+1):
for real_attr in ["gamma", "pi_inf", "mul0", "ss", "pv", "gamma_v", "M_v",
"mu_v", "k_v", "cp_v", "G", "cv", "qv", "qvp" ]:
"mu_v", "k_v", "cp_v", "G", "cv", "qv", "qvp", 'D_v' ]:
SIMULATION[f"fluid_pp({f_id})%{real_attr}"] = ParamType.REAL

for re_id in [1, 2]:
Expand Down Expand Up @@ -534,7 +534,7 @@ def analytic(self):
POST_PROCESS[f'{append}({fl_id})'] = ty

for real_attr in ["gamma", "pi_inf", "ss", "pv", "gamma_v", "M_v", "mu_v", "k_v", "cp_v",
"G", "mul0", "cv", "qv", "qvp" ]:
"G", "mul0", "cv", "qv", "qvp", "D_v" ]:
POST_PROCESS[f"fluid_pp({fl_id})%{real_attr}"] = ParamType.REAL

IGNORE = ["cantera_file", "chemistry"]
Expand Down
1 change: 0 additions & 1 deletion toolchain/mfc/test/case.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@
'lag_params%rho0' : 1000.,
'lag_params%T0' : 298.,
'lag_params%x0' : 1.,
'lag_params%diffcoefvap' : 2.5e-5,
'lag_params%Thost' : 298.,
}

Expand Down
8 changes: 5 additions & 3 deletions toolchain/mfc/test/cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -518,8 +518,9 @@ def alter_bubbles(dimInfo):
'fluid_pp(1)%ss' : 0.07275,'fluid_pp(1)%pv' : 2338.8,'fluid_pp(1)%gamma_v' : 1.33,
'fluid_pp(1)%M_v' : 18.02,'fluid_pp(1)%mu_v' : 8.816e-06,'fluid_pp(1)%k_v' : 0.019426,
'fluid_pp(2)%gamma_v' : 1.4,'fluid_pp(2)%M_v' : 28.97,'fluid_pp(2)%mu_v' : 1.8e-05,
'fluid_pp(2)%k_v' : 0.02556, 'patch_icpp(1)%alpha_rho(1)': 0.96, 'patch_icpp(1)%alpha(1)':
4e-02, 'patch_icpp(2)%alpha_rho(1)': 0.96, 'patch_icpp(2)%alpha(1)': 4e-02, 'patch_icpp(3)%alpha_rho(1)': 0.96,
'fluid_pp(2)%k_v' : 0.02556, 'fluid_pp(2)%D_v' : 0.242e-4,
'patch_icpp(1)%alpha_rho(1)': 0.96, 'patch_icpp(1)%alpha(1)': 4e-02,
'patch_icpp(2)%alpha_rho(1)': 0.96, 'patch_icpp(2)%alpha(1)': 4e-02, 'patch_icpp(3)%alpha_rho(1)': 0.96,
'patch_icpp(3)%alpha(1)': 4e-02, 'patch_icpp(1)%pres': 1.0, 'patch_icpp(2)%pres': 1.0,
'patch_icpp(3)%pres': 1.0, 'acoustic(1)%support': 1, 'acoustic(1)%wavelength': 0.25
})
Expand Down Expand Up @@ -846,7 +847,8 @@ def alter_lag_bubbles(dimInfo):
'fluid_pp(1)%pv' : 2338.8,'fluid_pp(1)%gamma_v' : 1.33, 'fluid_pp(1)%M_v' : 18.02,
'fluid_pp(1)%mu_v' : 8.816e-06,'fluid_pp(1)%k_v' : 0.019426, 'fluid_pp(1)%cp_v' : 2.1e3,
'fluid_pp(2)%gamma_v' : 1.4,'fluid_pp(2)%M_v' : 28.97, 'fluid_pp(2)%mu_v' : 1.8e-05,
'fluid_pp(2)%k_v' : 0.02556, 'fluid_pp(2)%cp_v' : 1.e3, 'patch_icpp(1)%alpha_rho(1)': 0.96,
'fluid_pp(2)%k_v' : 0.02556, 'fluid_pp(2)%cp_v' : 1.e3, 'fluid_pp(2)%D_v' : 2.5e-5,
'patch_icpp(1)%alpha_rho(1)': 0.96,
'patch_icpp(1)%alpha(1)': 4e-02, 'patch_icpp(1)%alpha_rho(2)': 0., 'patch_icpp(1)%alpha(2)': 0.,
'patch_icpp(2)%alpha_rho(1)': 0.96, 'patch_icpp(2)%alpha(1)': 4e-02, 'patch_icpp(2)%alpha_rho(2)': 0.,
'patch_icpp(2)%alpha(2)': 0., 'patch_icpp(3)%alpha_rho(1)': 0.96, 'patch_icpp(3)%alpha(1)': 4e-02,
Expand Down
Loading