Basilisk CFD
Adaptive Cartesian mesh PDE framework
Loading...
Searching...
No Matches
coriolis.h
Go to the documentation of this file.
1
/** @file coriolis.h
2
*/
3
/**
4
# Coriolis/friction terms for the multilayer solver
5
6
This approximates
7
\f[
8
\partial_t\mathbf{u} = \mathbf{B}\mathbf{u} + \mathbf{a}
9
\f]
10
with
11
\f[
12
\mathbf{B} = \left( \begin{array}{cc}
13
- K_0 & F_0\\
14
- F_0 & - K_0
15
\end{array} \right),
16
\f]
17
and \f$K_0\f$ and \f$F_0\f$ the linear friction and Coriolis parameters
18
respectively. The time-implicit discretisation of these terms can be
19
written
20
\f[
21
\frac{\mathbf{u}^{n + 1} -\mathbf{u}^n}{\Delta t} = \mathbf{B} [(1
22
- \alpha_H) \mathbf{u}^n + \alpha_H \mathbf{u}^{n + 1}] + \mathbf{a}^n
23
\f]
24
This then gives
25
\f[
26
\mathbf{u}^{n + 1} (\mathbf{I}- \alpha_H \Delta t\mathbf{B}) =
27
\mathbf{u}^n + (1 - \alpha_H) \Delta t\mathbf{B}\mathbf{u}^n + \Delta
28
t\mathbf{a}^n
29
\f]
30
The local \f$2 \times 2\f$ linear system is easily inverted analytically. The
31
final value is obtained by substracting the acceleration i.e.
32
\f[
33
\mathbf{u}^{\star} = \mathbf{u}^{n + 1} - \Delta t\mathbf{a}^n
34
\f]
35
36
The `K0()` and/or `F0()` macros should be defined before including the
37
file. */
38
39
#ifndef K0
40
# define K0() 0.
41
#endif
42
#ifndef F0
43
# define F0() 0.
44
#endif
45
#ifndef alpha_H
46
# define alpha_H 1.
47
#endif
48
49
/** @brief Event: acceleration (i++) */
50
void
event_acceleration
(
void
)
51
{
52
for
(
int
_i
= 0;
_i
<
_N
;
_i
++)
/* foreach */
53
foreach_layer
()
54
if
(
h
[] >
dry
) {
55
coord
b0
= { -
K0
(), -
K0
() },
b1
= {
F0
(), -
F0
() };
56
coord
m0
= { 1. -
alpha_H
*
dt
*
b0
.
x
, 1. -
alpha_H
*
dt
*
b0
.y };
57
coord
m1
= { -
alpha_H
*
dt
*
b1
.
x
, -
alpha_H
*
dt
*
b1
.y };
58
double
det
=
m0
.x*
m0
.y -
m1
.x*
m1
.y;
59
coord
r,
a
;
60
for
(
int
_d
= 0;
_d
<
dimension
;
_d
++) {
61
a
.
x
=
dt
*(
ha
.
x
[] +
ha
.
x
[1])/(
hf
.
x
[] +
hf
.
x
[1] +
dry
);
62
r.
x
=
u
.x[] + (1. -
alpha_H
)*
dt
*(
b0
.x*
u
.x[] +
b1
.x*
u
.y[]) +
a
.
x
;
63
}
64
for
(
int
_d
= 0;
_d
<
dimension
;
_d
++)
65
u
.x[] = (
m0
.y*r.
x
-
m1
.x*r.
y
)/
det
-
a
.
x
;
66
}
67
}
68
69
#undef alpha_H
70
71
/**
72
## Geostrophic velocity */
73
74
coord
geostrophic_velocity
(
Point
point
)
75
{
76
coord
ug
;
77
static
const
coord
a
= {-1.[0], 1.[0]};
78
for
(
int
_d
= 0;
_d
<
dimension
;
_d
++) {
79
double
hl
=
h
[] >
dry
&&
h
[-1] >
dry
,
hr
=
h
[] >
dry
&&
h
[1] >
dry
;
80
ug
.y =
a
.
y
*
G
*(
hl
*
gmetric
(0)*(
eta
[] -
eta
[-1]) +
81
hr
*
gmetric
(1)*(
eta
[1] -
eta
[]))
82
/(
Delta
*
F0
()*(
hl
+
hr
+ 1
e
-12));
83
}
84
return
ug
;
85
}
b1
double b1
Definition
NASG.h:19
u
#define u
Definition
advection.h:30
a
const vector a
Definition
all-mach.h:59
G
double G
Definition
atmosphere.h:12
h
scalar h[]
Definition
atmosphere.h:6
dimension
#define dimension
Definition
bitree.h:3
x
int x
Definition
common.h:76
point
Point point
Definition
conserving.h:86
dt
double dt
Definition
predictor-corrector.h:18
dry
double dry
Definition
entrainment.h:30
eta
scalar eta
Definition
hydro.h:50
hf
vector hf
Definition
hydro.h:209
gmetric
#define gmetric(i)
The macro below can be overloaded to define the barotropic acceleration.
Definition
hydro.h:195
ha
vector ha
Definition
hydro.h:209
event_acceleration
void event_acceleration(void)
Event: acceleration (i++)
Definition
coriolis.h:50
K0
#define K0()
Definition
coriolis.h:40
geostrophic_velocity
coord geostrophic_velocity(Point point)
Definition
coriolis.h:74
alpha_H
#define alpha_H
Definition
coriolis.h:46
F0
#define F0()
Definition
coriolis.h:43
foreach_layer
#define foreach_layer()
_i
def _i
Definition
stencils.h:405
Point
Definition
linear.h:21
coord
Definition
common.h:78
coord::x
double x
Definition
common.h:79
coord::y
double y
Definition
common.h:79
vector::x
scalar x
Definition
common.h:47
vector::y
scalar y
Definition
common.h:49
layered
coriolis.h
Generated by
1.9.8