simulationCases/JumpingDrops_Snellius_legacy.c
/* Title: Jumping Drops # Author: Vatsal Sanjay # [email protected] # Physics of Fluids
#include “grid/octree.h” #include “navier-stokes/centered.h” #define FILTERED #include “two-phase.h” #include “navier-stokes/conserving.h” #include “tension.h” // #include “distance.h” #include “adapt_wavelet_limited_v2.h” #define MINlevel 2 // maximum level #define tsnap (1e-2) #define tsnap2 (1e-4) // Error tolerances #define fErr (1e-2) // error tolerance in VOF #define KErr (1e-3) // error tolerance in KAPPA #define VelErr (1e-1) // error tolerances in velocity #define Mu21 (1.00e-3) #define Rho21 (1.00e-3) // domain #define Ldomain 4 // Dimension of the domain // boundary conditions u.t[bottom] = dirichlet(0.); u.r[bottom] = dirichlet(0.); f[bottom] = dirichlet(0.); double tmax, Oh, Bo; int MAXlevel; // maximum level int main(int argc, char argv[]) { tmax = atof(argv[1]); Oh = atof(argv[2]); // <0.001/sqrt(10000.0720.001)> Bo = atof(argv[3]); // <0.001/(10009.810.072)> MAXlevel = atoi(argv[4]); init_grid (1 << MINlevel); L0=Ldomain; fprintf(ferr, “tmax = %g. Oh = %g”,tmax, Oh); rho1 = 1.0; mu1 = Oh; rho2 = Rho21; mu2 = Mu21Oh; f.sigma = 1.0; char comm[80]; sprintf (comm, “mkdir -p intermediate”); system(comm); run(); } int refRegion(double x, double y, double z){ return (y < 1.5 && x < 1.5 && z < 1e-2) ? MAXlevel+1: // close to coalescence plane (y < -0.999 && x < 1.5 && z < 2.5)? MAXlevel+1: // close to the substrate (y < 1.5 && x < 2e0 && z < 3e0)? MAXlevel: // inside the drop MAXlevel-1; // everywhere else } event init(t = 0){ if(!restore (file = “dump”)){ fprintf(ferr, “Cannot restore using the dump file”); return 1; } } event adapt(i++) { scalar KAPPA[]; curvature(f, KAPPA); adapt_wavelet_limited ((scalar ){f, KAPPA, u.x, u.y, u.z}, (double[]){fErr, KErr, VelErr, VelErr, VelErr}, refRegion, minlevel=MINlevel); } // Outputs event writingFiles (t = 0; t += tsnap; t <= tmax+tsnap) { dump (file = “dump”); char nameOut[80]; sprintf (nameOut, “intermediate/snapshot-%5.4f”, t); dump (file = nameOut); } event logWriting (t = 0; t += tsnap2; t <= tmax+tsnap) { double ke = 0., wt = 0., Vcm = 0.; foreach (reduction(+:ke), reduction(+:Vcm), reduction(+:wt)){ ke += 0.5(sq(u.x[]) + sq(u.y[]) + sq(u.z[]))clamp(f[], 0., 1.)cube(Delta); Vcm += clamp(f[], 0., 1.)u.y[]cube(Delta); wt += clamp(f[], 0., 1.)cube(Delta); } Vcm /= wt; static FILE fp; if (pid() == 0){ if (i == 0) { fprintf(ferr, “tmax = %g. Oh = %g”,tmax, Oh); fprintf (ferr, “i dt t ke Vcm”); fp = fopen (“log”, “w”); fprintf (fp, “i dt t ke Vcm”); fprintf (fp, “%d %g %g %g %g”, i, dt, t, ke, Vcm); fclose(fp); } else { fp = fopen (“log”, “a”); fprintf (fp, “%d %g %g %g %g”, i, dt, t, ke, Vcm); fclose(fp); } fprintf (ferr, “%d %g %g %g %g”, i, dt, t, ke, Vcm); } }