REMORA
Regional Modeling of Oceans Refined Adaptively
Loading...
Searching...
No Matches
REMORA_InitAnalyticGridScale_BoundaryLayer.H
Go to the documentation of this file.
1
// Cell width grows linearly across the domain in x; pn is uniform. Taken as the
2
// difference of a face-position mapping X(xi) = c1*xi + c2*xi^2, xi = i / n_cell_x, so
3
// the widths telescope and a level's cells subdivide its parent's exactly. Setting the
4
// width from the cell index instead would give a refined level cells the physical size
5
// of its parent's, and no conservative flux at the interface (see check_cf_metrics).
6
//
7
// The constants reproduce dx(i) = first_width + width_growth*i at 39 cells, exactly.
8
constexpr
Real
first_width
= Real(725.0);
9
constexpr
Real
width_growth
= Real(50.0);
10
constexpr
Real
n_base
= Real(39.0);
11
12
constexpr
Real
c1
=
n_base
* (
first_width
- Real(0.5) *
width_growth
);
13
constexpr
Real
c2
= Real(0.5) *
width_growth
*
n_base
*
n_base
;
14
15
const
int
n_cell_x
=
geom
.Domain().size()[0];
16
const
auto
dxi
=
geom
.InvCellSize();
17
18
for
(
MFIter
mfi
(
mf_pm
,
TilingIfNotGPU
());
mfi
.isValid(); ++
mfi
)
19
{
20
Array4<Real>
const
&
pm
= (
mf_pm
).array(
mfi
);
21
22
Box
bx
=
mfi
.tilebox();
23
Box
gbx2
=
bx
;
24
gbx2
.grow(IntVect(
NGROW
+1,
NGROW
+1,0));
25
26
Box
gbx2D
=
gbx2
;
27
gbx2D
.makeSlab(2,0);
28
29
Gpu::streamSynchronize();
30
ParallelFor
(
gbx2D
, [=]
AMREX_GPU_DEVICE
(
int
i
,
int
j
,
int
)
31
{
32
const
Real
xi_lo
= Real(
i
) / Real(
n_cell_x
);
33
const
Real
xi_hi
= Real(
i
+1) / Real(
n_cell_x
);
34
const
Real
dx
= (
c1
*
xi_hi
+
c2
*
xi_hi
*
xi_hi
)
35
- (
c1
*
xi_lo
+
c2
*
xi_lo
*
xi_lo
);
36
pm
(
i
,
j
,0) =
one
/
dx
;
37
});
38
}
39
40
mf_pn
.setVal(
dxi
[1]);
one
constexpr amrex::Real one
Definition
REMORA_Constants.H:7
NGROW
#define NGROW
Definition
REMORA_IndexDefines.H:30
n_base
constexpr Real n_base
Definition
REMORA_InitAnalyticGridScale_BoundaryLayer.H:10
n_cell_x
const int n_cell_x
Definition
REMORA_InitAnalyticGridScale_BoundaryLayer.H:15
width_growth
constexpr Real width_growth
Definition
REMORA_InitAnalyticGridScale_BoundaryLayer.H:9
setVal
mf_pn setVal(dxi[1])
c1
constexpr Real c1
Definition
REMORA_InitAnalyticGridScale_BoundaryLayer.H:12
dxi
const auto dxi
Definition
REMORA_InitAnalyticGridScale_BoundaryLayer.H:16
c2
constexpr Real c2
Definition
REMORA_InitAnalyticGridScale_BoundaryLayer.H:13
first_width
constexpr Real first_width
Definition
REMORA_InitAnalyticGridScale_BoundaryLayer.H:8
dx
const Real dx
Definition
REMORA_InitAnalyticMasks_DogboneAnalytic.H:6
Source
Prob
REMORA_InitAnalyticGridScale_BoundaryLayer.H
Generated by
1.9.8