REMORA
Regional Modeling of Oceans Refined Adaptively
Loading...
Searching...
No Matches
REMORA_InitAnalyticProb_ParticleAdvectionFlat.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
= Real(0.0);
pp_prob
.query(
"u_0"
,
u_0
);
8
Real
v_0
= Real(0.0);
pp_prob
.query(
"v_0"
,
v_0
);
9
Real
z0
= Real(0.1);
pp_prob
.query(
"z0"
,
z0
);
// Surface Roughness
10
Real
zRef
= Real(80.);
pp_prob
.query(
"zRef"
,
zRef
);
// Reference Height
11
Real
uRef
= Real(0.0);
pp_prob
.query(
"uRef"
,
uRef
);
// Reference Wind Speed
12
13
auto
geomdata
=
geom
.data();
14
const
int
khi
=
geomdata
.Domain().bigEnd()[2];
15
16
bool
l_use_salt
=
m_solverChoice
.use_salt;
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
Array4<const Real>
const
& z_r =
remora
.vec_z_r[
lev
]->const_array(
mfi
);
28
29
Real
S0
=
m_solverChoice
.S0;
30
Real
T0
=
m_solverChoice
.T0;
31
ParallelFor
(
bx
, [=]
AMREX_GPU_DEVICE
(
int
i
,
int
j
,
int
k
)
noexcept
32
{
33
// Geometry (note we must include these here to get the data on device)
34
// const auto prob_lo = geomdata.ProbLo();
35
// const auto dx = geomdata.CellSize();
36
37
// const Real x = prob_lo[0] + (i + 0.5) * dx[0];
38
// const Real y = prob_lo[1] + (j + 0.5) * dx[1];
39
const
Real
z
= z_r(
i
,
j
,
k
);
40
41
state
(
i
,
j
,
k
,
Temp_comp
) =
one
;
42
43
state
(
i
,
j
,
k
,
Temp_comp
)=
T0
+Real(8.0)*std::exp(
z
/Real(50.0));
44
if
(
l_use_salt
) {
45
state
(
i
,
j
,
k
,
Salt_comp
)=
S0
;
46
}
47
48
// Set tracer = 0 everywhere
49
if
(
l_do_dye
) {
state
(
i
,
j
,
k
,
Tracer_comp
) =
zero
; }
50
});
51
52
// Construct a box that is on x-faces
53
const
Box&
xbx
=
surroundingNodes
(
bx
,0);
54
// Set the x-velocity
55
ParallelFor
(
xbx
, [=]
AMREX_GPU_DEVICE
(
int
i
,
int
j
,
int
k
)
noexcept
56
{
57
const
Real
z
= -z_r(
i
,
j
,
k
);
58
59
// Set the x-velocity
60
x_vel
(
i
,
j
,
k
) =
u_0
+
uRef
* std::log((
z
+
z0
)/
z0
) / std::log((
zRef
+
z0
)/
z0
);
61
});
62
63
// Construct a box that is on y-faces
64
const
Box&
ybx
=
surroundingNodes
(
bx
,1);
65
66
// Set the y-velocity
67
ParallelFor
(
ybx
, [=]
AMREX_GPU_DEVICE
(
int
i
,
int
j
,
int
k
)
noexcept
68
{
69
y_vel
(
i
,
j
,
k
) =
zero
;
70
});
71
}
one
constexpr amrex::Real one
Definition
REMORA_Constants.H:7
zero
constexpr amrex::Real zero
Definition
REMORA_Constants.H:6
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_Advection.H:15
S0
auto S0
Definition
REMORA_InitAnalyticProb_Advection.H:16
geomdata
auto geomdata
Definition
REMORA_InitAnalyticProb_ParticleAdvectionFlat.H:13
khi
const int khi
Definition
REMORA_InitAnalyticProb_ParticleAdvectionFlat.H:14
z0
Real z0
Definition
REMORA_InitAnalyticProb_ParticleAdvectionFlat.H:9
u_0
Real u_0
Definition
REMORA_InitAnalyticProb_ParticleAdvectionFlat.H:7
l_use_salt
bool l_use_salt
Definition
REMORA_InitAnalyticProb_ParticleAdvectionFlat.H:16
v_0
Real v_0
Definition
REMORA_InitAnalyticProb_ParticleAdvectionFlat.H:8
uRef
Real uRef
Definition
REMORA_InitAnalyticProb_ParticleAdvectionFlat.H:11
pp_prob
ParmParse pp_prob("remora.prob")
zRef
Real zRef
Definition
REMORA_InitAnalyticProb_ParticleAdvectionFlat.H:10
l_do_dye
const bool l_do_dye
Definition
REMORA_InitAnalyticProb_ParticleAdvectionFlat.H:5
Source
Prob
REMORA_InitAnalyticProb_ParticleAdvectionFlat.H
Generated by
1.9.8