Basilisk CFD
Adaptive Cartesian mesh PDE framework
Loading...
Searching...
No Matches
tension.h
Go to the documentation of this file.
1/** @file tension.h
2 */
3/**
4# Surface tension
5
6Surface tension can be expressed as the interfacial force density
7\f[
8\phi\nabla f
9\f]
10with \f$f\f$ the volume fraction describing the interface and the potential
11\f[
12\phi = \sigma\kappa
13\f]
14with \f$\sigma\f$ the (constant) surface tension coefficient and \f$\kappa\f$
15the interface mean curvature. */
16
17#include "iforce.h"
18#include "curvature.h"
19
20/**
21The surface tension coefficient is associated to each VOF tracer. */
22
24 double sigma;
25}
26
27/**
28## Stability condition
29
30The surface tension scheme is time-explicit so the maximum timestep is
31the oscillation period of the smallest capillary wave.
32\f[
33T = \sqrt{\frac{\rho_{m}\Delta_{min}^3}{\pi\sigma}}
34\f]
35with \f$\rho_m=(\rho_1+\rho_2)/2.\f$ and \f$\rho_1\f$, \f$\rho_2\f$ the densities
36on either side of the interface. */
37
38/** @brief Event: stability (i++) */
39void event_stability (void)
40{
41
42 /**
43 We first compute the minimum and maximum values of \f$\alpha/f_m =
44 1/\rho\f$, as well as \f$\Delta_{min}\f$. */
45
46 double amin = HUGE, amax = -HUGE, dmin = HUGE;
47 for (int _i = 0; _i < _N; _i++) /* foreach_face */ reduction(max:amax) reduction(min:dmin))
48 if (fm.x[] > 0.) {
49 if (alpha.x[]/fm.x[] > amax) amax = alpha.x[]/fm.x[];
50 if (alpha.x[]/fm.x[] < amin) amin = alpha.x[]/fm.x[];
51 if (Delta < dmin) dmin = Delta;
52 }
53 double rhom = (1./amin + 1./amax)/2.;
54
55 /**
56 The maximum timestep is set using the sum of surface tension
57 coefficients. */
58
59 double sigma = 0.;
60 for (int _c = 0; _c < 1; _c++) /* scalar in interfaces */
61 sigma += c.sigma;
62 if (sigma) {
63 double dt = sqrt (rhom*cube(dmin)/(pi*sigma));
64 if (dt < dtmax)
65 dtmax = dt;
66 }
67}
68
69/**
70## Definition of the potential
71
72We overload the acceleration event to define the potential
73\f$\phi=\sigma\kappa\f$. */
74
75/** @brief Event: acceleration (i++) */
77{
78
79 /**
80 We check for all VOF interfaces for which \f$\sigma\f$ is non-zero. */
81
82 for (int _f = 0; _f < 1; _f++) /* scalar in interfaces */
83 if (f.sigma) {
84
85 /**
86 If \f$\phi\f$ is already allocated, we add \f$\sigma\kappa\f$, otherwise
87 we allocate a new field and set it to \f$\sigma\kappa\f$. */
88
89 scalar phi = f.phi;
90 if (phi.i)
91 curvature (f, phi, f.sigma, add = true);
92 else {
93 phi = {0} /* new scalar */;
94 curvature (f, phi, f.sigma, add = false);
95 f.phi = phi;
96 }
97 }
98}
double dtmax
The timestep is computed using the CFL condition on the face velocity field.
Definition all-mach.h:105
const vector alpha
Definition all-mach.h:47
int min
Definition balance.h:192
int x
Definition common.h:76
#define pi
Definition common.h:4
#define HUGE
Definition common.h:6
const vector fm[]
Definition common.h:396
static number cube(number x)
Definition common.h:12
scalar f[]
The primary fields are:
Definition two-phase.h:56
trace cstats curvature(scalar c, scalar kappa, double sigma=1.[0], bool add=false)
Definition curvature.h:543
double dt
scalar phi[]
The electric potential and the volume charge density are scalars while the permittivity and conductiv...
Definition implicit.h:34
const scalar sigma[]
size_t max
Definition mtrace.h:8
def _i
Definition stencils.h:405
int i
Definition common.h:44
scalar x
Definition common.h:47
void event_acceleration(void)
Event: acceleration (i++)
Definition tension.h:76
void event_stability(void)
Event: stability (i++)
Definition tension.h:39
attribute
The surface tension coefficient is associated to each VOF tracer.
Definition tension.h:23
scalar dmin
Definition terrain.h:17
scalar c
Definition vof.h:57