Basilisk CFD
Adaptive Cartesian mesh PDE framework
Loading...
Searching...
No Matches
engquist.h
Go to the documentation of this file.
1
/** @file engquist.h
2
*/
3
/**
4
# Filter for grid-scale oscillations
5
6
**Note that this is obsolete and is kept only for historical interest.**
7
8
Because it is colocated, the [layered solver](hydro.h) can be prone to
9
grid-scale oscillations. This noise is usually small but can be
10
significant when gradients of bathymetry/wave fields are
11
under-resolved.
12
13
The filter below can be used to reduce this noise. It is inspired from
14
the work of [Engquist et al, 1989](#engquist1989).
15
16
The strength of the filter is controlled by the filtering timescale
17
`filter`: the smaller the value, the stronger the filter. This can be
18
interpreted as the timescale during which a disturbance must not move
19
to be seen by the filter. */
20
21
double
efilter
= 0.;
22
23
/** @brief Event: viscous_term (i++) */
24
void
event_viscous_term
(
void
)
25
{
26
if
(
efilter
> 0.) {
27
for
(
int
_i
= 0;
_i
<
_N
;
_i
++)
/* foreach */
28
for
(
int
_d
= 0;
_d
<
dimension
;
_d
++) {
29
double
Hm
= 0.,
H
= 0.,
Hp
= 0.;
30
foreach_layer
()
31
Hm
+=
h
[-1],
H
+=
h
[],
Hp
+=
h
[1];
32
if
(
Hm
>
dry
&&
H
>
dry
&&
Hp
>
dry
) {
33
double
Dp
=
eta
[1] -
eta
[],
Dm
=
eta
[] -
eta
[-1];
34
35
/**
36
The filter is only applied to extrema in the free-surface
37
height \f$\eta\f$ (first condition) contained within two
38
inflection points (second condition): this effectively
39
selects only grid-scale oscillations and avoid filtering
40
smooth extrema. */
41
42
if
(
Dp
*
Dm
< 0. && ((
eta
[2] +
eta
[] - 2.*
eta
[1])*
43
(
eta
[-1] +
eta
[1] - 2.*
eta
[]) < 0. ||
44
(
eta
[-1] +
eta
[1] - 2.*
eta
[])*
45
(
eta
[-2] +
eta
[] - 2.*
eta
[-1]) < 0.)) {
46
47
/**
48
We then compute the shift in the value of \f$\eta\f$ necessary
49
to smooth the extremum, see Algorithm 2.1 in [Engquist et
50
al, 1989](#engquist1989). */
51
52
double
dp
,
dm
;
53
if
(
fabs
(
Dp
) >
fabs
(
Dm
)) {
54
dp
=
fabs
(
Dp
);
55
dm
=
fabs
(
Dm
);
56
}
57
else
{
58
dp
=
fabs
(
Dm
);
59
dm
=
fabs
(
Dp
);
60
}
61
double
d
=
min
(
dm
,
dp
/2.);
62
double
a
=
Dp
> 0. ? 1. : -1.;
63
64
/**
65
We apply only part of the correction, weighted by the
66
timescale. */
67
68
eta
[] +=
min
(
dt
/
efilter
, 1.)*
a
*
d
;
69
double
Hnew
=
eta
[] -
zb
[];
70
if
(
Hnew
>
dry
)
71
foreach_layer
()
72
h
[] *=
Hnew
/
H
;
73
else
74
for
(
int
_s
= 0;
_s
< 1;
_s
++)
/* scalar in tracers */
75
foreach_layer
()
76
s
[] = 0.;
77
}
78
}
79
}
80
}
81
}
82
83
/**
84
## References
85
86
~~~bib
87
@article{engquist1989,
88
title={Nonlinear filters for efficient shock computation},
89
author={Engquist, Bj{\"o}rn and L{\"o}tstedt, Per and
90
Sj{\"o}green, Bj{\"o}rn},
91
journal={Mathematics of Computation},
92
volume={52},
93
number={186},
94
pages={509--537},
95
year={1989},
96
url={https://www.ams.org/journals/mcom/1989-52-186/S0025-5718-1989-0955750-9/S0025-5718-1989-0955750-9.pdf}
97
}
98
~~~
99
*/
a
const vector a
Definition
all-mach.h:59
zb
scalar zb[]
Definition
atmosphere.h:6
h
scalar h[]
Definition
atmosphere.h:6
min
int min
Definition
balance.h:192
dimension
#define dimension
Definition
bitree.h:3
x
int x
Definition
common.h:76
dp
scalar dp[]
Definition
double-projection.h:104
dt
double dt
Definition
predictor-corrector.h:18
s
scalar s
Definition
embed-tree.h:56
d
double d[2]
Definition
embed.h:383
efilter
double efilter
Definition
engquist.h:21
event_viscous_term
void event_viscous_term(void)
Event: viscous_term (i++)
Definition
engquist.h:24
dry
double dry
Definition
entrainment.h:30
eta
scalar eta
Definition
hydro.h:50
foreach_layer
#define foreach_layer()
_i
def _i
Definition
stencils.h:405
layered
engquist.h
Generated by
1.9.8