REMORA
Regional Modeling of Oceans Refined Adaptively
Loading...
Searching...
No Matches
REMORA_InitAnalyticProb_DoublyPeriodic.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
bool
l_use_salt
=
m_solverChoice
.use_salt;
14
15
auto
geomdata
=
geom
.data();
16
const
int
khi
=
geomdata
.Domain().bigEnd()[2];
17
18
auto
T0
=
m_solverChoice
.T0;
19
auto
S0
=
m_solverChoice
.S0;
20
for
(
MFIter
mfi
(
mf_cons
,
TilingIfNotGPU
());
mfi
.isValid(); ++
mfi
)
21
{
22
const
Box &
bx
=
mfi
.tilebox();
23
AMREX_ALWAYS_ASSERT
(
bx
.length()[2] ==
khi
+1);
24
25
Array4< Real>
const
&
state
=
mf_cons
.array(
mfi
);
26
Array4< Real>
const
&
x_vel
=
mf_xvel
.array(
mfi
);
27
Array4< Real>
const
&
y_vel
=
mf_yvel
.array(
mfi
);
28
29
Array4<const Real>
const
& z_r =
coords
.z_r->const_array(
mfi
);
30
31
ParallelFor
(
bx
, [=]
AMREX_GPU_DEVICE
(
int
i
,
int
j
,
int
k
)
noexcept
32
{
33
const
auto
prob_lo
=
geomdata
.ProbLo();
34
const
auto
prob_hi
=
geomdata
.ProbHi();
35
const
auto
dx
=
geomdata
.CellSize();
36
37
const
Real
z
= z_r(
i
,
j
,
k
);
38
39
state
(
i
,
j
,
k
,
Temp_comp
) =
one
;
40
41
state
(
i
,
j
,
k
,
Temp_comp
)=
T0
+Real(8.0)*std::exp(
z
/Real(50.0));
42
if
(
l_use_salt
) {
43
state
(
i
,
j
,
k
,
Salt_comp
)=
S0
;
44
}
45
46
// Set tracer = 0 everywhere
47
const
Real
xcent
= Real(0.5)*(
prob_lo
[0] +
prob_hi
[0]);
48
const
Real
ycent
= Real(0.5)*(
prob_lo
[1] +
prob_hi
[1]);
49
50
const
Real
x
=
prob_lo
[0] + (
i
+ Real(0.5)) *
dx
[0] -
xcent
;
51
const
Real
y
=
prob_lo
[1] + (
j
+ Real(0.5)) *
dx
[1] -
ycent
;
52
const
Real
r2
=
x
*
x
+
y
*
y
;
53
const
Real
rad
= Real(0.1) * (
prob_hi
[0]-
prob_lo
[0]);
54
const
Real
radsq
=
rad
*
rad
;
55
56
if
(
l_do_dye
) {
state
(
i
,
j
,
k
,
Tracer_comp
) = (
r2
<
radsq
) ?
one
:
zero
; }
57
});
58
59
// Construct a box that is on x-faces
60
const
Box&
xbx
=
surroundingNodes
(
bx
,0);
61
// Set the x-velocity
62
ParallelFor
(
xbx
, [=]
AMREX_GPU_DEVICE
(
int
i
,
int
j
,
int
k
)
noexcept
63
{
64
// const auto prob_lo = geomdata.ProbLo();
65
// const auto dx = geomdata.CellSize();
66
67
// const Real x = prob_lo[0] + (i + 0.5) * dx[0];
68
// const Real y = prob_lo[1] + (j + 0.5) * dx[1];
69
const
Real
z
= -z_r(
i
,
j
,
k
);
70
71
// Set the x-velocity
72
x_vel
(
i
,
j
,
k
) =
u_0
+
uRef
* std::log((
z
+
z0
)/
z0
) / std::log((
zRef
+
z0
)/
z0
);
73
});
74
75
// Construct a box that is on y-faces
76
const
Box&
ybx
=
surroundingNodes
(
bx
,1);
77
78
// Set the y-velocity
79
ParallelFor
(
ybx
, [=]
AMREX_GPU_DEVICE
(
int
i
,
int
j
,
int
k
)
noexcept
80
{
81
//const auto prob_lo = geomdata.ProbLo();
82
//const auto dx = geomdata.CellSize();
83
84
// const Real x = prob_lo[0] + (i + 0.5) * dx[0];
85
// const Real y = prob_lo[1] + (j + 0.5) * dx[1];
86
y_vel
(
i
,
j
,
k
) =
v_0
; });
87
}
88
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
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)
dx
const Real dx
Definition
REMORA_InitAnalyticMasks_DogboneAnalytic.H:6
T0
auto T0
Definition
REMORA_InitAnalyticProb_DoublyPeriodic.H:18
geomdata
auto geomdata
Definition
REMORA_InitAnalyticProb_DoublyPeriodic.H:15
khi
const int khi
Definition
REMORA_InitAnalyticProb_DoublyPeriodic.H:16
z0
Real z0
Definition
REMORA_InitAnalyticProb_DoublyPeriodic.H:9
S0
auto S0
Definition
REMORA_InitAnalyticProb_DoublyPeriodic.H:19
u_0
Real u_0
Definition
REMORA_InitAnalyticProb_DoublyPeriodic.H:7
l_use_salt
bool l_use_salt
Definition
REMORA_InitAnalyticProb_DoublyPeriodic.H:13
v_0
Real v_0
Definition
REMORA_InitAnalyticProb_DoublyPeriodic.H:8
uRef
Real uRef
Definition
REMORA_InitAnalyticProb_DoublyPeriodic.H:11
pp_prob
ParmParse pp_prob("remora.prob")
zRef
Real zRef
Definition
REMORA_InitAnalyticProb_DoublyPeriodic.H:10
l_do_dye
const bool l_do_dye
Definition
REMORA_InitAnalyticProb_DoublyPeriodic.H:5
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_DoublyPeriodic.H
Generated by
1.9.8