sandbox/msaini/Marangoni/spuriousMov.c
#define JACOBI 1
#include "grid/multigrid.h"
#include "navier-stokes/centered.h"
#if CLSVOF
# include "two-phase-clsvof.h"
#include "integral.h"
scalar sigmaf[];
#elif HF2D
# include "two-phase-HF.h"
#include "integral.h"
scalar sigmaf[];
#else
#include "vof.h"
#include "tension.h"
scalar f[], * interfaces = {f};
#endif
#define DIAMETER 0.4
#define MU sqrt(DIAMETER/LAPLACE)
#define TMAX (sq(DIAMETER)/MU)
int LEVEL;
double LAPLACE = 120.;
double DC = 0.;
FILE * fp = NULL;
int main() {
= 1e-6 [*];
TOLERANCE = true;
stokes #if CLSVOF || HF2D
.sigmaf = sigmaf;
d#else
.sigma = 1;
f#endif
periodic (right);
= 6;
LEVEL = 1 << LEVEL;
N for (LAPLACE = 120; LAPLACE <= 12000; LAPLACE *= 10)
run();
}
event init (i = 0) {
We set the constant viscosity field…
const face vector muc[] = {MU,MU};
= muc; mu
… open a new file to store the evolution of the amplitude of spurious currents for the various LAPLACE…
… and initialise the shape of the interface and the initial volume fraction field.
#if CLSVOF || HF2D
foreach(){
[] = - sqrt (sq(x - L0/2.) + sq(y - L0/2.)) + DIAMETER/2.;
d[] = 1.;
sigmaf.x[] = 1.;
u}
#else
fraction (f, sq(DIAMETER/2) - sq(x - L0/2.) - sq(y - L0/2.));
foreach()
.x[] = 1.;
u#endif
}
event logfile (i++; t <= TMAX)
{
scalar un[];
foreach()
[] = norm(u) - 1.;
unfprintf (fp, "%g %10.10f %10.10f\n",MU*t/sq(DIAMETER), normf(un).max, normf(un).rms);
}
event error (t = end) {
scalar un[];
foreach() {
[] = norm(u) - 1.;
un}
fprintf (stderr, "%d %10.10f %10.10f %10.10f\n",
, LAPLACE,normf(un).max*sqrt(DIAMETER),normf(un).rms*sqrt(DIAMETER));
LEVEL
}
We use an adaptive mesh with a constant (maximum) resolution along the interface.
#if TREE
event adapt (i++) {
({f}, (double[]){0}, maxlevel = LEVEL, minlevel = 0);
adapt_wavelet }
#endif
Results
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
from matplotlib.ticker import LogLocator
= {
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)
= ['120','1200','12000']
La
= plt.subplots(1, 3, figsize=(24/2.54, 5.5/2.54), gridspec_kw={'wspace': 0.5,'width_ratios': [1., 1, 1.]},sharey=False)
fig, ax
=["./","../spuriousMov-clsvof","../spuriousMov-hf2d"]
folders=["#440154","#3b528b","#21918c"]
cmap=np.array([0,1,2])
figno
0].set_title("CSF", loc='center')
ax[1].set_title("CLSVOF", loc='center')
ax[2].set_title("HF2D", loc='center')
ax[
for i in figno:
'log')
ax[i].set_yscale(0.,1)
ax[i].set_xlim(r'$t/t_\mu$')
ax[i].set_xlabel(r'$\epsilon_{RMS} (u)$')
ax[i].set_ylabel(for j in range(len(La)):
= "%s/La-%s" % (folders[i],La[j])
datafile = np.loadtxt(datafile)
data 0],abs(data[::,2]),color=cmap[j],label=La[j])
ax[i].plot(data[::,=0,frameon=False,fontsize=9)
ax[i].legend(loc
0.02, 0.98, '$(a)$', fontsize=14, fontweight='bold')
fig.text(0.34, 0.98, '$(b)$', fontsize=14, fontweight='bold')
fig.text(0.66, 0.98, '$(c)$', fontsize=14, fontweight='bold')
fig.text(
"spurious.pdf",bbox_inches='tight', pad_inches=0.3/2.54) savefig(