Basilisk CFD
Adaptive Cartesian mesh PDE framework
Loading...
Searching...
No Matches
nh-staggered.h File Reference
#include "poisson.h"
Include dependency graph for nh-staggered.h:

Go to the source code of this file.

Macros

#define NH   1
 
#define PHIT   6.
 

Functions

void event_defaults (void)
 Event: defaults (i = 0)
 
void correct_qz (double dt, const scalar phis)
 
void event_viscous_term (void)
 Event: viscous_term (i++)
 
static void coeffs1 (Point point, scalar *hl, double *a, double(*b)[2], double *c)
 
static void coeffs2 (Point point, scalar *hl, double *a, double(*b)[2], double *c)
 
static void matrix (Point point, scalar *phil, scalar *rhsl, double *a, double *b, double *c, double *d)
 
static void matrix1 (Point point, scalar *phil, scalar *rhsl, double *a, double *b, double *c, double *d)
 
static trace void relax_nh (scalar *phil, scalar *rhsl, int lev, void *data)
 
static double residual_nh (scalar *phil, scalar *rhsl, scalar *resl, void *data)
 
static trace void relax_nh1 (scalar *phil, scalar *rhsl, int lev, void *data)
 
static double residual_nh2 (scalar *phil, scalar *rhsl, scalar *resl, void *data)
 
static double residual_nh3 (scalar *phil, scalar *rhsl, scalar *resl, void *data)
 
void event_pressure (void)
 Event: pressure (i++)
 
void event_cleanup (void)
 Event: cleanup (i = end, last)
 

Variables

scalarqzl = NULL
 
scalarphil = NULL
 
mgstats mgp
 
doublealpha = NULL
 
doublegammap = NULL
 
scalar phit = zeroc
 

Macro Definition Documentation

◆ NH

#define NH   1

The vertically-staggered non-hydrostatic solver

See section 3.6.1 of Popinet (2019). Note that this uses the vertical momentum qz rather than vertical velocity w and will not be compatible with [hydro.h]().

Definition at line 10 of file nh-staggered.h.

◆ PHIT

#define PHIT   6.

Definition at line 189 of file nh-staggered.h.

Function Documentation

◆ coeffs1()

static void coeffs1 ( Point  point,
scalar hl,
double a,
double(*)  b[2],
double c 
)
static

Definition at line 250 of file nh-staggered.h.

References a, b, c, h, l, nl, PHIT, x, and zb.

Referenced by event_pressure(), and matrix().

Here is the caller graph for this function:

◆ coeffs2()

static void coeffs2 ( Point  point,
scalar hl,
double a,
double(*)  b[2],
double c 
)
static

Definition at line 274 of file nh-staggered.h.

References a, b, c, h, l, nl, PHIT, and x.

Referenced by matrix().

Here is the caller graph for this function:

◆ correct_qz()

void correct_qz ( double  dt,
const scalar  phis 
)

Definition at line 191 of file nh-staggered.h.

References _i, alpha, dt, h, l, nl, phi, phil, PHIT, phit, qzl, s, sq(), and x.

Referenced by event_pressure(), and event_viscous_term().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ event_cleanup()

void event_cleanup ( void  )

Event: cleanup (i = end, last)

Definition at line 693 of file nh-staggered.h.

References alpha, free(), gammap, phil, qzl, and x.

Here is the call graph for this function:

◆ event_defaults()

void event_defaults ( void  )

Event: defaults (i = 0)

Boundary conditions for VOF-advected tracers usually depend on boundary conditions for the VOF field.

Event: defaults (i = 0)

Event: defaults (i = 0)

Initialisation

We set the default values.

Electrohydrodynamic stresses

The EHD force density, \(\mathbf{f}_e\), can be computed as the divergence of the Maxwell stress tensor \(\mathbf{M}\),

\[ M_{ij} = \varepsilon (E_i E_j - \frac{E^2}{2}\delta_{ij}) \]

where \(E_i\) is the \(i\)-component of the electric field, \(\mathbf{E}=-\nabla \phi\) and \(\delta_{ij}\) is the Kronecker delta.

We need to add the corresponding acceleration to the Navier–Stokes solver.

If the acceleration vector a (defined by the Navier–Stokes solver) is constant, we make it variable.

Event: defaults (i = 0)

Event: defaults (i = 0 )

Defaults

On trees we need to ensure conservation of the tracer when refining/coarsening.

Event: defaults (i = 0)

it is an acceleration. If necessary, we allocate a new vector field to store it.

Event: defaults (i = 0)

Event: defaults (i = 0)

\[ \begin{aligned} 0 & = - \sum_k \nabla \cdot [\theta_H (hu)_k^{n + 1} + (1 - \theta_H) (hu)^n_k] \\ \frac{(hu)^{n + 1}_k - (hu)_k^n}{\Delta t} & = - \Delta tgh^{n + 1 / 2}_k (\theta_H \nabla \eta_r^{n + 1} + (1 - \theta_H) \nabla \eta_r^n) \end{aligned} \]

where \(\eta_r\) is the equivalent free-surface height (i.e. pressure) applied on the rigid lid.

Event: defaults (i = 0)

The default density field is set to unity (times the metric).

We reset the multigrid parameters to their default values.

If the viscosity is non-zero, we need to allocate the face-centered viscosity field.

We also initialize the list of tracers to be advected with the VOF function \(f\) (or its complementary function).

We set limiting.

On trees, we ensure that limiting is also applied to prolongation and refinement.

We add the interface and the density to the default display.

We switch to a pure minmod limiter by default for increased robustness.

With the MUSCL scheme we use the CFL depends on the dimension of the problem.

On trees we need to replace the default bilinear refinement/prolongation with linear so that reconstructed values also use slope limiting.

The restriction/refine attributes of the charge density are those of a tracer otherwise the conservation is not guaranteed.

By default the permittivity is unity and other quantities are zero.

The (velocity) CFL is limited by the unsplit advection scheme, so is dependent on the dimension. The (gravity wave) CFL is set to 1/2 (if not already set by the user).

The gradient and prolongation/restriction functions are set for all tracer fields.

We setup the default display.

Definition at line 20 of file nh-staggered.h.

References alpha, assert, beta, calloc(), gammap, l, list_append(), nl, phi, phil, qzl, reset, tracers, and x.

Here is the call graph for this function:

◆ event_pressure()

void event_pressure ( void  )

Event: pressure (i++)

Definition at line 641 of file nh-staggered.h.

References _i, a, bc, cc, coeffs1(), correct_qz(), dimension, dt, fm, free(), h, l, list_clone(), mg_solve(), mgp, nl, phi, phil, phit, point, q, qzl, relax_nh(), residual_nh(), restriction, TOLERANCE, uf, vector::x, x, and zb.

Here is the call graph for this function:

◆ event_viscous_term()

void event_viscous_term ( void  )

Event: viscous_term (i++)

Definition at line 230 of file nh-staggered.h.

References _i, correct_qz(), d, dt, dut, lambda_b, nu, point, qzl, u, u_b, vertical_viscosity(), x, and zeroc.

Here is the call graph for this function:

◆ matrix()

static void matrix ( Point  point,
scalar phil,
scalar rhsl,
double a,
double b,
double c,
double d 
)
static

Definition at line 295 of file nh-staggered.h.

References a, alpha, b, c, cl, coeffs1(), coeffs2(), cr, d, gammap, h, l, neighborp(), nl, phi, phil, PHIT, phit, point, sq(), x, and zb.

Referenced by relax_nh(), residual_nh(), and residual_nh3().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ matrix1()

static void matrix1 ( Point  point,
scalar phil,
scalar rhsl,
double a,
double b,
double c,
double d 
)
static

Definition at line 354 of file nh-staggered.h.

References a, alpha, b, c, d, dimension, gammap, h, l, nl, phi, phil, PHIT, s, sq(), x, and zb.

Here is the call graph for this function:

◆ relax_nh()

static trace void relax_nh ( scalar phil,
scalar rhsl,
int  lev,
void data 
)
static

Definition at line 418 of file nh-staggered.h.

References _i, a, b, c, d, l, matrix(), nl, phi, phil, point, and x.

Referenced by event_pressure().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ relax_nh1()

static trace void relax_nh1 ( scalar phil,
scalar rhsl,
int  lev,
void data 
)
static

Definition at line 468 of file nh-staggered.h.

References _i, a, alpha, b, c, d, dimension, gammap, h, l, nl, phi, phil, PHIT, sq(), and x.

Here is the call graph for this function:

◆ residual_nh()

static double residual_nh ( scalar phil,
scalar rhsl,
scalar resl,
void data 
)
static

Definition at line 437 of file nh-staggered.h.

References a, alpha, b, c, d, data, l, matrix(), max, nl, phi, phil, point, and x.

Referenced by event_pressure().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ residual_nh2()

static double residual_nh2 ( scalar phil,
scalar rhsl,
scalar resl,
void data 
)
static

Definition at line 511 of file nh-staggered.h.

References alpha, dimension, face_gradient_x, gammap, h, l, max, nl, phi, phil, PHIT, phit, s, sq(), x, z, and zb.

Here is the call graph for this function:

◆ residual_nh3()

static double residual_nh3 ( scalar phil,
scalar rhsl,
scalar resl,
void data 
)
static

Definition at line 581 of file nh-staggered.h.

References a, alpha, b, c, d, dimension, gammap, h, l, matrix(), max, nl, phi, phil, PHIT, phit, point, s, sq(), and x.

Here is the call graph for this function:

Variable Documentation

◆ alpha

◆ gammap

double * gammap = NULL

◆ mgp

mgstats mgp

Definition at line 16 of file nh-staggered.h.

Referenced by event_pressure().

◆ phil

◆ phit

scalar phit = zeroc

Definition at line 638 of file nh-staggered.h.

Referenced by correct_qz(), event_pressure(), matrix(), residual_nh2(), and residual_nh3().

◆ qzl