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
auto
T0
=
m_solverChoice
.T0;
15
auto
S0
=
m_solverChoice
.S0;
16
for
(
MFIter
mfi
(
mf_cons
,
TilingIfNotGPU
());
mfi
.isValid(); ++
mfi
)
17
{
18
const
Box &
bx
=
mfi
.tilebox();
19
AMREX_ALWAYS_ASSERT
(
bx
.length()[2] ==
khi
+1);
20
21
Array4< Real>
const
&
state
=
mf_cons
.array(
mfi
);
22
Array4< Real>
const
&
x_vel
=
mf_xvel
.array(
mfi
);
23
Array4< Real>
const
&
y_vel
=
mf_yvel
.array(
mfi
);
24
25
Array4<const Real>
const
& z_r =
remora
.vec_z_r[
lev
]->const_array(
mfi
);
26
27
ParallelFor
(
grow
(
grow
(
bx
,0,1),1,1), [=]
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
const
Real
z
= z_r(
i
,
j
,
k
);
34
35
// Create bounding box for x and y to make spatially-dependent T and S
36
const
Real
xcent
= Real(0.5)*(
prob_lo
[0] +
prob_hi
[0]);
37
[[
maybe_unused
]]
const
Real
ycent
= Real(0.5)*(
prob_lo
[1] +
prob_hi
[1]);
38
39
[[
maybe_unused
]]
const
Real
x
=
prob_lo
[0] + (
i
+ Real(0.5)) *
dx
[0] -
xcent
;
40
const
Real
y
=
prob_lo
[1] + (
j
+ Real(0.5)) *
dx
[1];
41
42
state
(
i
,
j
,
k
,
Temp_comp
)=
T0
+
z
/ (Real(9.8) * Real(1.7));
43
if
(
l_use_salt
) {
44
state
(
i
,
j
,
k
,
Salt_comp
)=
S0
+
y
/ (Real(9.8) * Real(760.0));
45
}
46
47
// Set tracer = 0 everywhere
48
if
(
l_do_dye
) {
state
(
i
,
j
,
k
,
Tracer_comp
) =
zero
; }
49
});
50
51
const
Box&
xbx
=
surroundingNodes
(
bx
,0);
52
const
Box&
ybx
=
surroundingNodes
(
bx
,1);
53
ParallelFor
(
grow
(
grow
(
xbx
,1,1),0,1), [=]
AMREX_GPU_DEVICE
(
int
i
,
int
j
,
int
k
)
noexcept
54
{
55
// Create bounding box for x and y to make spatially-dependent T and S
56
const
auto
prob_lo
=
geomdata
.ProbLo();
57
const
auto
prob_hi
=
geomdata
.ProbHi();
58
const
auto
dx
=
geomdata
.CellSize();
59
60
[[
maybe_unused
]]
const
Real
xcent
= Real(0.5)*(
prob_lo
[0] +
prob_hi
[0]);
61
[[
maybe_unused
]]
const
Real
ycent
= Real(0.5)*(
prob_lo
[1] +
prob_hi
[1]);
62
63
const
Real
z
= z_r(
i
,
j
,
k
);
64
// h(i,j,0) = -geomdata.ProbLo(2);
65
const
Real
depth
= Real(50.0);
66
67
const
Real
x
=
prob_lo
[0] + (
i
+ Real(0.5)) *
dx
[0];
// - xcent;
68
const
Real
y
=
prob_lo
[1] + (
j
+ Real(0.5)) *
dx
[1];
// - ycent;
69
70
const
Real
val1
=
x
* Real(6.28318530718) * Real(1.0e-5);
71
const
Real
val2
=
y
* Real(6.28318530718) * Real(1.0e-5);
72
x_vel
(
i
,
j
,
k
) = (
depth
+
z
) * Real(0.01) + Real(0.05) * std::sin(
val1
) * std::sin(
val2
);
73
});
74
ParallelFor
(
ybx
, [=]
AMREX_GPU_DEVICE
(
int
i
,
int
j
,
int
k
)
noexcept
75
{
76
y_vel
(
i
,
j
,
k
) =
zero
;
77
});
78
}
79
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)
T0
auto T0
Definition
REMORA_InitAnalyticProb_ChannelTest.H:14
geomdata
auto geomdata
Definition
REMORA_InitAnalyticProb_ChannelTest.H:8
khi
const int khi
Definition
REMORA_InitAnalyticProb_ChannelTest.H:9
NSPeriodic
bool NSPeriodic
Definition
REMORA_InitAnalyticProb_ChannelTest.H:12
S0
auto S0
Definition
REMORA_InitAnalyticProb_ChannelTest.H:15
l_use_salt
bool l_use_salt
Definition
REMORA_InitAnalyticProb_ChannelTest.H:6
EWPeriodic
bool EWPeriodic
Definition
REMORA_InitAnalyticProb_ChannelTest.H:11
l_do_dye
const bool l_do_dye
Definition
REMORA_InitAnalyticProb_ChannelTest.H:5
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
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_ChannelTest.H
Generated by
1.9.8