Basilisk CFD
Adaptive Cartesian mesh PDE framework
Loading...
Searching...
No Matches
dr.h
Go to the documentation of this file.
1/** @file dr.h
2 */
3/**
4# Boussinesq buoyancy
5
6The momentum equation of the [multilayer solver](hydro.h) becomes
7\f[
8\begin{aligned}
9 \partial_t \left( h \mathbf{u} \right)_k + \mathbf{{\nabla}} \cdot \left(
10 h \mathbf{u} \mathbf{u} \right)_k & = - gh_k \mathbf{{\nabla}} (\eta)
11 {\color{blue} - \mathbf{{\nabla}} (h q)_k + \left[ q
12 \mathbf{{\nabla}} z \right]_k}
13\end{aligned}
14\f]
15where the terms in blue have been added and \f$q\f$ is the (hydrostatic)
16pressure deviation due to (small) density variations.
17
18The density variations are described by a scalar field \f$T\f$, which is
19advected by the flow, and an associated "equation of state"
20\f$\Delta\rho(T)\f$ defined by the user. This gives the additional
21equations
22\f[
23\begin{aligned}
24\partial_t \left( h T \right)_k + \mathbf{{\nabla}} \cdot \left(
25h \mathbf{u} T \right)_k & = 0,\\
26q(z) & = \int_0^z g \Delta \rho(T) dz
27\end{aligned}
28\f]
29*/
30
32
33/** @brief Event: defaults (i = 0) */
34void event_defaults (void)
35{
36 T = {0} /* new scalar */[nl];
38}
39
40/** @brief Event: cleanup (t = end, last) */
41void event_cleanup (void)
42{
43 delete ({T});
44}
45
46/**
47The pressure gradient terms in blue are added to the acceleration of
48the [multilayer solver](hydro.h). */
49
50/** @brief Event: acceleration (i++) */
52{
53
54 /**
55 The hydrostatic pressure deviation \f$q\f$ is stored on the interfaces
56 between layers (consistently with the Keller box scheme
57 discretisation, see [Popinet,
58 2020](/Bibliography#popinet2020)). This gives the following vertical
59 discrete integration scheme. */
60
61 scalar q = {0} /* new scalar */[nl];
62
63 for (int _i = 0; _i < _N; _i++) /* foreach */ {
64 double ph = 0.;
65 for (point.l = nl - 1; point.l >= 0; point.l--) {
66 ph += G*drho(T[])*h[];
67 q[] = ph;
68 }
69 }
70
71 /**
72 Once the pressure deviation is known, the terms in blue above are
73 added to the face acceleration field `ha`, using the
74 [pressure-gradient macro](hydro.h#horizontal-pressure-gradient). */
75
76 for (int _i = 0; _i < _N; _i++) /* foreach_face */
77 hpg (pg, q, 0,
78 ha.x[] += pg);
79
80 delete ({q});
81}
82
83/**
84## See also
85
86* [Boussinesq buoyancy for isopycnal layers](isopycnal.h)
87*/
scalar * tracers
Here we set the gradient functions for each tracer (as defined in the user-provided tracers list).
Definition hydro.h:60
vector q[]
The primitive variables are the momentum , pressure , density , (face) specific volume ,...
Definition all-mach.h:44
double G
Definition atmosphere.h:12
scalar h[]
Definition atmosphere.h:6
int x
Definition common.h:76
scalar * list_append(scalar *list, scalar s)
Definition common.h:188
Point point
Definition conserving.h:86
void event_acceleration(void)
The pressure gradient terms in blue are added to the acceleration of the multilayer solver.
Definition dr.h:51
scalar T
Definition dr.h:31
void event_cleanup(void)
Event: cleanup (t = end, last)
Definition dr.h:41
void event_defaults(void)
Event: defaults (i = 0)
Definition dr.h:34
vector ha
Definition hydro.h:209
#define hpg(pg, phi, i, code)
Definition hydro.h:525
double * drho
int nl
Definition layers.h:9
def _i
Definition stencils.h:405
scalar x
Definition common.h:47