REMORA
Regional Modeling of Oceans Refined Adaptively
Loading...
Searching...
No Matches
REMORA_InitAnalyticProb_Advection.H
Go to the documentation of this file.
1
2
// Whether this run carries a passive dye tracer. nComp() cannot answer this: with
3
// biology active and no dye, Tracer_comp is the first biology component, so testing
4
// nComp() would write the dye initial value into NO3.
5
const
bool
l_do_dye
= (
remora
.num_passive_scalars() > 0);
6
ParmParse
pp_prob
(
"remora.prob"
);
7
Real
u_0
=
zero
;
pp_prob
.query(
"u_0"
,
u_0
);
8
Real
v_0
=
zero
;
pp_prob
.query(
"v_0"
,
v_0
);
9
10
bool
l_use_salt
=
m_solverChoice
.use_salt;
11
12
auto
geomdata
=
geom
.data();
13
const
int
khi
=
geomdata
.Domain().bigEnd()[2];
14
15
auto
T0
=
m_solverChoice
.T0;
16
auto
S0
=
m_solverChoice
.S0;
17
18
for
(
MFIter
mfi
(
mf_cons
,
TilingIfNotGPU
());
mfi
.isValid(); ++
mfi
)
19
{
20
const
Box &
bx
=
mfi
.tilebox();
21
AMREX_ALWAYS_ASSERT
(
bx
.length()[2] ==
khi
+1);
22
23
Array4< Real>
const
&
state
=
mf_cons
.array(
mfi
);
24
Array4< Real>
const
&
x_vel
=
mf_xvel
.array(
mfi
);
25
Array4< Real>
const
&
y_vel
=
mf_yvel
.array(
mfi
);
26
27
ParallelFor
(
bx
, [=]
AMREX_GPU_DEVICE
(
int
i
,
int
j
,
int
k
)
noexcept
28
{
29
const
auto
prob_lo
=
geomdata
.ProbLo();
30
const
auto
prob_hi
=
geomdata
.ProbHi();
31
const
auto
dx
=
geomdata
.CellSize();
32
33
state
(
i
,
j
,
k
,
Temp_comp
) =
one
;
34
35
state
(
i
,
j
,
k
,
Temp_comp
)=
T0
;
//+8.0*std::exp(z/Real(50.0));
36
37
// Set tracer = 0 everywhere
38
const
Real
xcent
= Real(0.5)*(
prob_lo
[0] +
prob_hi
[0]);
39
const
Real
ycent
= Real(0.5)*(
prob_lo
[1] +
prob_hi
[1]);
40
41
const
Real
x
=
prob_lo
[0] + (
i
+ Real(0.5)) *
dx
[0] -
xcent
;
42
const
Real
y
=
prob_lo
[1] + (
j
+ Real(0.5)) *
dx
[1] -
ycent
;
43
const
Real
r2
=
x
*
x
+
y
*
y
;
44
const
Real
rad
= Real(0.1) * (
prob_hi
[0]-
prob_lo
[0]);
45
const
Real
radsq
=
rad
*
rad
;
46
const
Real
rad_inner
= Real(0.05) * (
prob_hi
[0]-
prob_lo
[0]);
47
[[
maybe_unused
]]
const
Real
rad_inner_sq
=
rad_inner
*
rad_inner
;
48
49
if
(
l_use_salt
) {
50
state
(
i
,
j
,
k
,
Salt_comp
)=
S0
;
51
}
52
53
// Single circle of tracer (default)
54
if
(
l_do_dye
) {
state
(
i
,
j
,
k
,
Tracer_comp
) = std::exp(-
r2
/(2.*
radsq
)); }
55
56
// Donut of tracer
57
//state(i, j, k, Tracer_comp) = 1.25 * (std::exp(-r2/(2.*radsq)) - std::exp(-r2/(2*rad_inner_sq)));
58
});
59
60
// Construct a box that is on x-faces
61
const
Box&
xbx
=
surroundingNodes
(
bx
,0);
62
// Set the x-velocity
63
ParallelFor
(
xbx
, [=]
AMREX_GPU_DEVICE
(
int
i
,
int
j
,
int
k
)
noexcept
64
{
65
x_vel
(
i
,
j
,
k
) =
u_0
;
66
});
67
68
// Construct a box that is on y-faces
69
const
Box&
ybx
=
surroundingNodes
(
bx
,1);
70
71
// Set the y-velocity
72
ParallelFor
(
ybx
, [=]
AMREX_GPU_DEVICE
(
int
i
,
int
j
,
int
k
)
noexcept
73
{
74
y_vel
(
i
,
j
,
k
) =
v_0
;
75
});
76
}
77
Gpu::streamSynchronize();
one
constexpr amrex::Real one
Definition
REMORA_Constants.H:7
zero
constexpr amrex::Real zero
Definition
REMORA_Constants.H:6
Coord::y
@ y
Coord::x
@ x
Temp_comp
#define Temp_comp
Definition
REMORA_IndexDefines.H:10
Tracer_comp
#define Tracer_comp
Definition
REMORA_IndexDefines.H:12
Salt_comp
#define Salt_comp
Definition
REMORA_IndexDefines.H:11
setVal
mf_h setVal(geomdata.ProbHi(2))
AMREX_ALWAYS_ASSERT
AMREX_ALWAYS_ASSERT(!NSPeriodic||!EWPeriodic)
T0
auto T0
Definition
REMORA_InitAnalyticProb_Advection.H:15
geomdata
auto geomdata
Definition
REMORA_InitAnalyticProb_Advection.H:12
khi
const int khi
Definition
REMORA_InitAnalyticProb_Advection.H:13
S0
auto S0
Definition
REMORA_InitAnalyticProb_Advection.H:16
u_0
Real u_0
Definition
REMORA_InitAnalyticProb_Advection.H:7
l_use_salt
bool l_use_salt
Definition
REMORA_InitAnalyticProb_Advection.H:10
v_0
Real v_0
Definition
REMORA_InitAnalyticProb_Advection.H:8
pp_prob
ParmParse pp_prob("remora.prob")
l_do_dye
const bool l_do_dye
Definition
REMORA_InitAnalyticProb_Advection.H:5
prob_lo
const auto prob_lo
Definition
REMORA_InitAnalyticSMFlux_DoubleGyre.H:1
dx
const auto dx
Definition
REMORA_InitAnalyticSMFlux_DoubleGyre.H:3
prob_hi
const auto prob_hi
Definition
REMORA_InitAnalyticSMFlux_DoubleGyre.H:2
Source
Prob
REMORA_InitAnalyticProb_Advection.H
Generated by
1.9.8