sandbox/msaini/Marangoni/marangoniad2bub.c
In this case, we study the effect of wall on the drop driven by Marangoni flows. The test is discussed in detail in our new paper. Note that the results here are obtained lower resolution as compared to the paper because of limited computational time on the Basilisk.fr servers. As you refine the grid, you will obtain better results with lower oscillations.
#include "axi.h"
#include "navier-stokes/centered.h"
#if CLSVOF
# include "two-phase-clsvof.h"
# include "integral.h"
#else
# include "two-phase-HF.h"
#include "integral.h"
#endif
#include "advdiff.h"
#include "view.h"
#include "tag.h"
int LEVEL = 8;
[left] = dirichlet(L0);
PhiC[right] = dirichlet(0);
PhiC
const double R = 1. [1], NablaT = 1., Mu = 1., Rho = 1. [0];
const double Re = 0.066, Ca = 0.66;
const double Gamma_T = Re*sq(Mu)/(Rho*sq(R)*NablaT);
const double Gamma_0 = (Gamma_T*R*NablaT)/Ca;
const double t0 = Mu/(Gamma_T*NablaT);
const double Cdrop = 1., Cbulk = 1.;
double U_drop;
scalar sigmaf[];
static FILE * fp;
int main()
{
(12*R);
size = rho2 = Rho;
rho1 = Mu; mu2 = Mu*0.0005;
mu1
= 1.e+4;
Diff_C1 = 1.e+4*0.0005;
Diff_C2
.sigmaf = sigmaf;
d
= 1e-4 [*];
TOLERANCE = - 2./((2. + 3.*mu2/mu1)*(2. + Diff_C2/Diff_C1))*Gamma_T*R*NablaT/mu1;
U_drop
= 1 << (LEVEL - 3);
N run();
}
We initialize the signed distance d and the surface tension gradient.
event init (t = 0)
{
= fopen ("bubbles.dat", "w");
fp
if (!restore (file = "restart")) {
for(int ii = 0; ii < 3; ii++)
refine(y < (L0/2 + 4.*Delta) && level < (LEVEL-(2. - ii)));
vertex scalar dist[];
foreach_vertex()
[] = min(sqrt (sq(x - L0/2. - R) + sq(y)) - R,sqrt (sq(x - L0/2. + R/3. + R*0.5) + sq(y)) - R/3.);
dist
fractions(dist,f);
foreach() {
[] = min(sqrt (sq(x - L0/2. - R) + sq(y)) - R,sqrt (sq(x - L0/2. + R/3. + R*0.5) + sq(y)) - R/3.);
d}
foreach(){
[] = 0;
PhiC[] = Gamma_0 - Gamma_T*(PhiC[] - L0);
sigmaf}
}
}
event properties(i++){
foreach()
[] = Gamma_0 - Gamma_T*(PhiC[] - L0);
sigmaf}
double u_drop = 0.;
event statistics(t+=2.*t0/2000.){
double U_drops[2] = {- 2./((2. + 3.*mu2/mu1)*(2. + Diff_C2/Diff_C1))*Gamma_T*R/3.*NablaT/mu1,- 2./((2. + 3.*mu2/mu1)*(2. + Diff_C2/Diff_C1))*Gamma_T*R*NablaT/mu1};
scalar m[];
foreach()
[] = (1. - f[]) > 1e-3;
mint n = tag (m);
double v[n];
[n];
coord b[n];
coord ubfor (int j = 0; j < n; j++)
[j] = b[j].x = b[j].y = b[j].z = ub[j].x = ub[j].y =0.;
vforeach (serial)
if (m[] > 0) {
int j = m[] - 1;
[j] += dv()*(1. - f[]);
v= {x,y,z};
coord p foreach_dimension(){
[j].x += dv()*(1. - f[])*p.x;
b[j].x += dv()*(1. - f[])*u.x[];
ub}
}
#if _MPI
(MPI_IN_PLACE, v, n, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
MPI_Allreduce (MPI_IN_PLACE, b, 3*n, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
MPI_Allreduce (MPI_IN_PLACE, ub, 3*n, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
MPI_Allreduce #endif
if(pid() ==0 && n > 1){
for (int j = 0; j < n; j++)
fprintf (fp, "%g %g %g ", t/t0,b[j].x/v[j],ub[j].x/v[j]/U_drops[j]);
}
fprintf(fp,"\n");
}
event logfile (i += 2)
{
double xb = 0., vb = 0., sb = 0.;
static double xb0 = 0., previous = 0.;
if (t == 0.)
= 0.;
previous foreach(reduction(+:xb) reduction(+:vb) reduction(+:sb)) {
double dv = (1. - f[])*dv();
+= u.x[]*dv;
vb += x*dv;
xb += dv;
sb }
static double sb0 = 0.;
if (i == 0) {
= sb;
sb0 fprintf (stdout, "#dsb xb vb/U_drop ta u_drop/U_drop dt perf.t perf.speed\n");
}
= t > previous ? (xb/sb - xb0)/(t - previous) : 0.;
u_drop fprintf (ferr, "%g %g %g %g %g %g %g\n",
/t0, (sb - sb0)/sb0, xb/sb, vb/sb/U_drop,
t(t + previous)/2./t0, u_drop/U_drop,
);
dt= xb/sb, previous = t;
xb0 }
event movie (t += 1.68*t0/120.){
clear();
view(fov = 9., ty = -0.5, quat = {0,0,-cos(pi/4.),cos(pi/4.)}, width = 1980, height = 1980);
draw_vof("f",lw=4);
squares("PhiC", linear=true, map = cool_warm);
vectors (u = "u", scale = 0.1);
mirror({0,1}) {
draw_vof("f",lw=4);
squares("PhiC", linear=true, map = cool_warm);
vectors (u = "u", scale = 0.05);
}
save("movie.mp4");
}
event graphics (t = 1.5*t0)
{
double U = -2./((2. + 3.*mu2/mu1)*(2. + Diff_C2/Diff_C1))*Gamma_T*R*NablaT/mu1;;
fprintf (stderr, "#%d %g %g %g\n", N/16, u_drop/U, U_drop/U,Diff_C2/Diff_C1);
}
#if TREE
event adapt (i++) {
({f,u}, (double[]){1e-2, 1e-5, 1e-5}, LEVEL);
adapt_wavelet }
#endif
import numpy
import sys
import string
import math
import glob
from pylab import *
from matplotlib.colors import LogNorm, Normalize,ListedColormap
from scipy.interpolate import CubicSpline
= {
params 'axes.labelsize': 14,
'font.size': 12,
'mathtext.fontset' : 'cm',
'font.family' : 'sans-serif',
'legend.fontsize': 12,
'xtick.labelsize': 12,
'ytick.labelsize': 12,
'xtick.major.size' : 2.,
'ytick.major.size' : 2.,
'xtick.minor.size' : 1.,
'ytick.minor.size' : 1.,
'text.usetex': False,
# 'figure.figsize': [2.15,1.85],
'axes.linewidth' : 0.75,
'figure.subplot.left' : 0.1,
'figure.subplot.bottom' : 0.18,
'figure.subplot.right' : 0.96,
'figure.subplot.top' : 0.98,
'savefig.dpi' : 300,
}
rcParams.update(params)
= ['#E41A1C', '#377EB8', '#4DAF4A', '#FFC107',
colors '#6A3D9A', '#00CED1', '#4D4D4D', '#FB8072']
= "./bubbles.dat"
datafile1 =numpy.loadtxt(datafile1)
data1
= "../marangoniad2bub-clsvof/bubbles.dat"
datafile =numpy.loadtxt(datafile)
data
= "../thSmall.dat"
datafile2 =numpy.loadtxt(datafile2)
data2
= "../thBig.dat"
datafile3 =numpy.loadtxt(datafile3)
data3
= plt.subplots(figsize=(6/2.54, 5.5/2.54))
fig, ax
= np.linspace(0.15,1,num=200)
xdata
-data[::5,1] + data[::5,4] - 1. - 1./3.),data[::5,2],'--',linewidth=3,color=colors[0],label=r"CLSVOF, $u_S$")
ax.plot((-data1[::4,1] + data1[::4,4] - 1. - 1./3.),data1[::4,2],'--',linewidth=2.5,color=colors[1],label=r"HF2D, $u_S$")
ax.plot((1.+2.*(3./(3.*xdata+4.))**3.,'-.',linewidth=2,color=colors[2],label="Equation (50)")
ax.plot(xdata,0],data2[:,1],'--',linewidth=2,color=colors[3],label=r"Meyyappan et al. ($u_S$)")
ax.plot(data2[:,
0,0.6)
ax.set_xlim(0.9,2.1)
ax.set_ylim(
r"$H/R$")
ax.set_xlabel(r"$u/u_{YGB}$")
ax.set_ylabel(
-data[::5,1] + data[::5,4] - 1. - 1./3.),data[::5,5],'--',linewidth=2.5,color=colors[4],label=r"CLSVOF, $u_L$")
ax.plot((-data1[::4,1] + data1[::4,4] - 1. - 1./3.),data1[::4,5],'--',linewidth=3,color=colors[5],label=r"HF2D, $u_L$")
ax.plot((1.-2./3.*(1/(3.*xdata+4.))**3.,'-.',linewidth=2,color=colors[6],label="Equation (51)")
ax.plot(xdata,0],data3[:,1],'--',linewidth=2,color=colors[7],label=r"Meyyappan et al. ($u_L$)")
ax.plot(data3[:,
=0,frameon=False,fontsize=9,bbox_to_anchor=(1, 0.15))
ax.legend(loc
"vel2bub.svg",bbox_inches='tight', pad_inches=0.3/2.54) savefig(