src/test/shrinking.c
A bubble shrinking due to thermal effects
This reproduces Figure 3.a of Saade et al, 2023 where more detailed explanations can be found (section “4.1 Epstein-Plesset like problem for temperature”).
set xlabel 't/tau'
set ylabel 'R/R_0'
plot "log" u 1:2 w l t 'Spherical', "../shrinking-axi/log" u 1:2 w l t 'Axisymmetric'
Animation of the pressure and temperature fields.
[saade2023] |
Youssef Saade, Detlef Lohse, and Daniel Fuster. A multigrid solver for the coupled pressure-temperature equations in an all-Mach solver with VoF. Journal of Computational Physics, 476:111865, 2023. [ DOI | http | .pdf ] |
We run both the axisymmetric and the spherically-symmetric versions.
#if AXIS
# include "axi.h"
# include "compressible/thermal.h"
# include "view.h"
# define LEVEL 8
#else
# include "spherisym.h"
# include "compressible/thermal.h"
# define LEVEL 9
#endif
#include "compressible/NASG.h"
The initial density of the gas is chosen such that the initial temperature inside the bubble is twice the far-field temperature T_\infty.
double rhoL = 1., rhoR = 0.02011771644;
double p0L = 1.;
double p0 = 1.;
double tend = 1.;
double R0 = 1.;
double tau;
The problem is rendered dimensionless using the ambient pressure, the liquid density, the far-field temperature and the bubble initial radius. The values employed for this simulation are respectively listed.
double pdim = 5e6;
double rhodim = 975.91;
double Tdim = 350;
double Rdim = 1e-4;
[right] = dirichlet(p0L);
p.n[right] = neumann(0.);
q
#if AXIS
[left] = dirichlet(p0L);
p.n[left] = neumann(0.);
q
[top] = dirichlet(p0L);
p.n[top] = neumann(0.);
q#endif
Although the thermal solver is implicit and unconditionally stable, a diffusive CFL condition is employed for better accuracy.
event stability (i++) {
= rhoR*cp2*sq(L0/pow(2,LEVEL))/kappa2/2.;
dtmax }
int main()
{
= 8.;
L0 #if AXIS
= -L0/2.;
X0 #endif
Liquid water parameters in the Noble-Abel Stiffened Gas (NASG) equation of state.
= 1.187;
gamma1 = 7028e5/pdim;
PI1 = 6.61e-4*rhodim;
b1 = -1177788*rhodim/pdim; q1
Specific heats and thermal conductivity of the fluids.
= 3610*rhodim*Tdim/pdim; cv2 = 729.1*rhodim*Tdim/pdim;
cv1 = 4285*rhodim*Tdim/pdim; cp2 = 1063*rhodim*Tdim/pdim;
cp1
= 0.6705/(Rdim/Tdim*sqrt(cube(pdim)/rhodim));
kappa1 = 0.03153/(Rdim/Tdim*sqrt(cube(pdim)/rhodim));
kappa2
= 3.7e-4/(Rdim*sqrt(rhodim*pdim));
mu1 = mu1*1e-2; mu2
The diffusive time scale \tau based on the gas properties.
= rhoR*cp2/kappa2;
tau
*= tau;
tend
#if TREE
= 1 << 4;
N #else
= 1 << LEVEL;
N #endif
run();
}
event init (t = 0)
{
if (!restore (file = "restart")) {
The static mesh refinement.
#if TREE
for (int l = 4; l <= LEVEL; l++)
refine (level < l && sqrt(sq(x) + sq(y)) < (2.5*R0 + 4.*sqrt(2.)*L0/(1 << (l - 1))));
#endif
Initialization of a bubble with initial radius R0
.
fraction (f, - (sq(R0) - sq(x) - sq(y)));
foreach() {
[] = f[]*rhoL;
frho1[] = (1. - f[])*rhoR;
frho2
double pL = p0L;
[] = pL*f[] + p0*(1. - f[]);
p[] = average_temperature (point, p[]);
T
[] = (pL + gamma1*PI1)/(gamma1 - 1.)*(f[] - frho1[]*b1) + frho1[]*q1;
fE1[] = (1. - f[])*(p0/(gamma2 - 1.));
fE2}
}
}
We log the evolution of the bubble radius.
event centroid (i += 20)
{
double volume = 0.;
foreach(reduction(+:volume))
+= dv()*(1. - f[]);
volume #if AXIS
/= 2.;
volume #endif
fprintf (stderr ,"%g %g\n", t/tau, pow(3.*volume,1./3.));
}
Output of some statistics about the fields.
event logfile (i++)
{
stats sp = statsf (p), su = statsf (q.x), sT = statsf (T);
if (i == 0)
fprintf (stdout, "t dt max(p) max(T) max(u)\n");
fprintf (stdout, "%g %g %g %g %g\n",
/tau, dt/tau, sp.max, sT.max, su.max);
t}
On the fly movie generation.
#if AXIS
event movie (t += 0.01*4737.81)
{
view (fov = 12.5, quat = {0,0,-cos(M_PI/4.),cos(M_PI/4.)}, width = 640, height = 990);
draw_vof ("f");
squares ("p", min = 1., map = cool_warm);
char s[80];
sprintf (s, "t = %.2f", t/4737.81);
mirror({0,1}) {
draw_vof ("f");
squares ("T", min = 1.0896, max = 2.1792, map = cool_warm);
draw_string (s, pos = 2, size = 16, lc = {255,255,255}, lw = 4);
draw_string ("Temperature", pos = 3, size = 25, lc = {255,255,255}, lw = 4);
draw_string ("Pressure", size = 25, lc = {255,255,255}, lw = 4);
}
save ("T2.mp4");
Saving dump files for post-processing. (Uncomment)