REMORA
Regional Modeling of Oceans Refined Adaptively
Loading...
Searching...
No Matches
REMORA_InitAnalyticProb_ChannelTest.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
bool
l_use_salt
=
m_solverChoice
.use_salt;
7
8
auto
geomdata
=
geom
.data();
9
const
int
khi
=
geomdata
.Domain().bigEnd()[2];
10
11
[[
maybe_unused
]]
bool
EWPeriodic
=
geomdata
.isPeriodic(1);
12
[[
maybe_unused
]]
bool
NSPeriodic
=
geomdata
.isPeriodic(0);
13
14
// Uniform tracers and no initial jet, which a test needs if its exact solution is rest.
15
// Pairs with remora.prob.quiescent in the surface stress, which drops the wind.
16
amrex::ParmParse
pp_prob
(
"remora.prob"
);
17
bool
quiescent
=
false
;
18
pp_prob
.query(
"quiescent"
,
quiescent
);
19
const
bool
l_quiescent
=
quiescent
;
20
21
auto
T0
=
m_solverChoice
.T0;
22
auto
S0
=
m_solverChoice
.S0;
23
for
(
MFIter
mfi
(
mf_cons
,
TilingIfNotGPU
());
mfi
.isValid(); ++
mfi
)
24
{
25
const
Box &
bx
=
mfi
.tilebox();
26
AMREX_ALWAYS_ASSERT
(
bx
.length()[2] ==
khi
+1);
27
28
Array4< Real>
const
&
state
=
mf_cons
.array(
mfi
);
29
Array4< Real>
const
&
x_vel
=
mf_xvel
.array(
mfi
);
30
Array4< Real>
const
&
y_vel
=
mf_yvel
.array(
mfi
);
31
32
Array4<const Real>
const
& z_r =
coords
.z_r->const_array(
mfi
);
33
34
ParallelFor
(
grow
(
grow
(
bx
,0,1),1,1), [=]
AMREX_GPU_DEVICE
(
int
i
,
int
j
,
int
k
)
noexcept
35
{
36
const
auto
prob_lo
=
geomdata
.ProbLo();
37
const
auto
prob_hi
=
geomdata
.ProbHi();
38
const
auto
dx
=
geomdata
.CellSize();
39
40
const
Real
z
= z_r(
i
,
j
,
k
);
41
42
// Create bounding box for x and y to make spatially-dependent T and S
43
const
Real
xcent
= Real(0.5)*(
prob_lo
[0] +
prob_hi
[0]);
44
[[
maybe_unused
]]
const
Real
ycent
= Real(0.5)*(
prob_lo
[1] +
prob_hi
[1]);
45
46
[[
maybe_unused
]]
const
Real
x
=
prob_lo
[0] + (
i
+ Real(0.5)) *
dx
[0] -
xcent
;
47
const
Real
y
=
prob_lo
[1] + (
j
+ Real(0.5)) *
dx
[1];
48
49
state
(
i
,
j
,
k
,
Temp_comp
) =
l_quiescent
?
T0
50
:
T0
+
z
/ (Real(9.8) * Real(1.7));
51
if
(
l_use_salt
) {
52
state
(
i
,
j
,
k
,
Salt_comp
) =
l_quiescent
?
S0
53
:
S0
+
y
/ (Real(9.8) * Real(760.0));
54
}
55
56
// Set tracer = 0 everywhere
57
if
(
l_do_dye
) {
state
(
i
,
j
,
k
,
Tracer_comp
) =
zero
; }
58
});
59
60
const
Box&
xbx
=
surroundingNodes
(
bx
,0);
61
const
Box&
ybx
=
surroundingNodes
(
bx
,1);
62
ParallelFor
(
grow
(
grow
(
xbx
,1,1),0,1), [=]
AMREX_GPU_DEVICE
(
int
i
,
int
j
,
int
k
)
noexcept
63
{
64
// Create bounding box for x and y to make spatially-dependent T and S
65
const
auto
prob_lo
=
geomdata
.ProbLo();
66
const
auto
prob_hi
=
geomdata
.ProbHi();
67
const
auto
dx
=
geomdata
.CellSize();
68
69
[[
maybe_unused
]]
const
Real
xcent
= Real(0.5)*(
prob_lo
[0] +
prob_hi
[0]);
70
[[
maybe_unused
]]
const
Real
ycent
= Real(0.5)*(
prob_lo
[1] +
prob_hi
[1]);
71
72
const
Real
z
= z_r(
i
,
j
,
k
);
73
// h(i,j,0) = -geomdata.ProbLo(2);
74
const
Real
depth
= Real(50.0);
75
76
const
Real
x
=
prob_lo
[0] + (
i
+ Real(0.5)) *
dx
[0];
// - xcent;
77
const
Real
y
=
prob_lo
[1] + (
j
+ Real(0.5)) *
dx
[1];
// - ycent;
78
79
const
Real
val1
=
x
* Real(6.28318530718) * Real(1.0e-5);
80
const
Real
val2
=
y
* Real(6.28318530718) * Real(1.0e-5);
81
x_vel
(
i
,
j
,
k
) =
l_quiescent
?
zero
82
: (
depth
+
z
) * Real(0.01) + Real(0.05) * std::sin(
val1
) * std::sin(
val2
);
83
});
84
ParallelFor
(
ybx
, [=]
AMREX_GPU_DEVICE
(
int
i
,
int
j
,
int
k
)
noexcept
85
{
86
y_vel
(
i
,
j
,
k
) =
zero
;
87
});
88
}
89
Gpu::streamSynchronize();
zero
constexpr amrex::Real zero
Definition
REMORA_Constants.H:6
Coord::y
@ y
Coord::x
@ x
Coord::z
@ z
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)
depth
Real depth
Definition
REMORA_InitAnalyticBathymetry_DogboneAnalytic.H:8
dx
const Real dx
Definition
REMORA_InitAnalyticMasks_DogboneAnalytic.H:6
T0
auto T0
Definition
REMORA_InitAnalyticProb_ChannelTest.H:21
geomdata
auto geomdata
Definition
REMORA_InitAnalyticProb_ChannelTest.H:8
khi
const int khi
Definition
REMORA_InitAnalyticProb_ChannelTest.H:9
quiescent
bool quiescent
Definition
REMORA_InitAnalyticProb_ChannelTest.H:17
NSPeriodic
bool NSPeriodic
Definition
REMORA_InitAnalyticProb_ChannelTest.H:12
S0
auto S0
Definition
REMORA_InitAnalyticProb_ChannelTest.H:22
l_use_salt
bool l_use_salt
Definition
REMORA_InitAnalyticProb_ChannelTest.H:6
EWPeriodic
bool EWPeriodic
Definition
REMORA_InitAnalyticProb_ChannelTest.H:11
pp_prob
amrex::ParmParse pp_prob("remora.prob")
l_do_dye
const bool l_do_dye
Definition
REMORA_InitAnalyticProb_ChannelTest.H:5
l_quiescent
const bool l_quiescent
Definition
REMORA_InitAnalyticProb_ChannelTest.H:19
val2
Real val2
Definition
REMORA_InitAnalyticProb_DoubleGyre.H:13
val1
Real val1
Definition
REMORA_InitAnalyticProb_DoubleGyre.H:12
prob_lo
const auto prob_lo
Definition
REMORA_InitAnalyticSMFlux_DoubleGyre.H:1
prob_hi
const auto prob_hi
Definition
REMORA_InitAnalyticSMFlux_DoubleGyre.H:2
Source
Prob
REMORA_InitAnalyticProb_ChannelTest.H
Generated by
1.9.8