Basilisk CFD
Adaptive Cartesian mesh PDE framework
Loading...
Searching...
No Matches
entrainment.h
Go to the documentation of this file.
1
/** @file entrainment.h
2
*/
3
/**
4
# Diapycnal "entrainment" and "detrainment"
5
6
This implements the entrainment/detrainment between isopycnal layers
7
briefly described in [Hurlburt & Hogan, 2000](#hurlburt2000), section
8
2, equations 1), 2) and 3).
9
10
`omr` is the average entrainment velocity between layers
11
(\f$\tilde{\omega}_k\f$ in H&H, 2000) and `Cm` is the coefficient of
12
additional interfacial friction associated with entrainment (\f$C_M\f$ in
13
H&H, 2000). They are parameters provided by the user. */
14
15
extern
double
omr
,
Cm
;
16
17
/**
18
The maximum and minimum layer thicknesses (\f$h_k^+\f$ and \f$h_k^-\f$
19
respectively in H&H, 2000) are provided by the user and used to define
20
the weighing factors appearing in the definition of the "diapycnal
21
mixing velocities" \f$\omega_k^+\f$ and \f$\omega_k^-\f$ in H&H, 2000. */
22
23
extern
double
*
hmin
, *
hmax
;
24
#define wmin(h,hmin) (h >= hmin ? 0. : sq((hmin - h)/hmin))
25
#define wmax(h,hmax) (h <= hmax ? 0. : sq((h - hmax)/hmax))
26
27
/**
28
These come from the [multilayer solver](hydro.h). */
29
30
extern
double
dt
,
dry
;
31
32
/** @brief Event: viscous_term (i++) */
33
void
event_viscous_term
(
void
)
34
{
35
36
/**
37
If the average entrainment velocity is negative or null, we do
38
nothing. */
39
40
if
(
omr
<= 0.)
41
return
0;
42
43
/**
44
We compute the volumed-averaged entrainment/detrainment for each
45
layer (bottom layer excepted). */
46
47
double
oma
[
nl
],
wa
[
nl
];
48
for
(
int
l
= 0;
l
<
nl
;
l
++)
49
oma
[
l
] = 0.,
wa
[
l
] = 0.;
50
foreach_layer
() {
51
double
o
= 0.,
w
= 0.;
52
if
(
_layer
> 0)
53
foreach
(
reduction
(+:
o
)
reduction
(+:
w
)) {
54
double
om
=
omr
*(
wmin
((
h
[]),
hmin
[
_layer
]) -
wmax
((
h
[]),
hmax
[
_layer
]));
55
if
(
h
[] +
dt
*
om
>
dry
&&
h
[0,0,-1] -
dt
*
om
>
dry
)
56
o
+=
dv
()*
om
,
w
+=
dv
();
57
}
58
oma
[
_layer
] =
o
,
wa
[
_layer
] =
w
;
59
}
60
61
/**
62
The local entrainment/detrainment is then applied as the sum of a
63
global contribution and a local contribution which depends on the
64
local thickness. */
65
66
for
(
int
_i
= 0;
_i
<
_N
;
_i
++)
/* foreach */
{
67
double
hn
[
nl
];
68
coord
un
[
nl
];
69
foreach_layer
() {
70
hn
[
point
.l] =
h
[];
71
for
(
int
_d
= 0;
_d
<
dimension
;
_d
++)
72
un
[
point
.l].
x
=
h
[]*
u
.x[];
73
}
74
for
(
int
l
=
nl
- 1;
l
>= 1;
l
--) {
75
double
om
=
omr
*(
wmin
((
h
[0,0,
l
]),
hmin
[
l
]) -
wmax
((
h
[0,0,
l
]),
hmax
[
l
]));
76
if
(
h
[0,0,
l
] +
dt
*
om
>
dry
&&
h
[0,0,
l
-1] -
dt
*
om
>
dry
) {
77
om
-=
oma
[
l
]/
wa
[
l
];
78
hn
[
l
] +=
dt
*
om
;
79
hn
[
l
- 1] -=
dt
*
om
;
80
81
/**
82
These are the entrainment and detrainment terms for the
83
velocity components in eqs. 1) and 2) of H&H, 2000. */
84
85
int
lum
=
om
>= 0 ?
l
- 1 :
l
;
86
for
(
int
_d
= 0;
_d
<
dimension
;
_d
++) {
87
double
flux
=
dt
*
om
*(
u
.x[0,0,
lum
]*(1. +
Cm
) -
Cm
*
u
.x[0,0,
l
]);
88
un
[
l
].
x
+=
flux
;
89
un
[
l
- 1].
x
-=
flux
;
90
}
91
}
92
}
93
94
/**
95
We then update `h` and `u`. */
96
97
foreach_layer
() {
98
h
[] =
hn
[
point
.l];
99
for
(
int
_d
= 0;
_d
<
dimension
;
_d
++)
100
u
.x[] =
h
[] >
dry
?
un
[
point
.l].
x
/
h
[] : 0.;
101
}
102
}
103
}
104
105
/**
106
## References
107
108
~~~bib
109
@article{hurlburt2000,
110
title={Impact of 1/8 to 1/64 resolution on {G}ulf {S}tream model--data
111
comparisons in basin-scale subtropical {A}tlantic {O}cean models},
112
author={Hurlburt, Harley E and Hogan, Patrick J},
113
journal={Dynamics of Atmospheres and Oceans},
114
volume={32},
115
number={3-4},
116
pages={283--329},
117
year={2000},
118
publisher={Elsevier},
119
DOI={10.1016/S0377-0265(00)00050-6},
120
PDF={https://apps.dtic.mil/sti/tr/pdf/ADA531039.pdf}
121
}
122
~~~
123
*/
u
#define u
Definition
advection.h:30
un
vector un[]
Definition
atmosphere.h:5
hn
scalar hn[]
Definition
atmosphere.h:6
h
scalar h[]
Definition
atmosphere.h:6
dimension
#define dimension
Definition
bitree.h:3
l
define l
Definition
cartesian-common.h:8
x
int x
Definition
common.h:76
dv
#define dv()
Definition
common.h:92
w
vector w[]
Definition
compressible.h:51
point
Point point
Definition
conserving.h:86
o
coord o
Definition
curvature.h:672
Cm
double Cm
Definition
entrainment.h:15
dt
double dt
These come from the multilayer solver.
Definition
predictor-corrector.h:18
omr
double omr
hmax
double * hmax
Definition
entrainment.h:23
wmax
#define wmax(h, hmax)
Definition
entrainment.h:25
hmin
double * hmin
The maximum and minimum layer thicknesses ( and respectively in H&H, 2000) are provided by the user...
dry
double dry
Definition
entrainment.h:30
wmin
#define wmin(h, hmin)
Definition
entrainment.h:24
event_viscous_term
void event_viscous_term(void)
Event: viscous_term (i++)
Definition
entrainment.h:33
nl
int nl
Definition
layers.h:9
_layer
which uses a global _layer index *int _layer
Definition
layers.h:15
foreach_layer
#define foreach_layer()
_i
def _i
Definition
stencils.h:405
coord
Definition
common.h:78
vector::x
scalar x
Definition
common.h:47
flux
scalar flux[]
Definition
vof.h:166
layered
entrainment.h
Generated by
1.9.8