REMORA
Regional Modeling of Oceans Refined Adaptively
Loading...
Searching...
No Matches
REMORA_InitAnalyticMasks_DogboneAnalytic.H
Go to the documentation of this file.
1
// Coordinates come from the Geometry rather than remora.vec_xr/vec_yr so that this hook
2
// also works on the full-domain MultiFab used for hires_grid_level, which is
3
// not built on grids[lev] and so has no per-level coordinate arrays to index. This
4
// matches set_grid_coords_from_grid_scale, which puts the rho point of cell i at
5
// (i + 1/2) * dx measured from index 0.
6
const
Real
dx
=
geom
.CellSize(0);
7
const
Real
dy
=
geom
.CellSize(1);
8
9
// Defaults put the coast on coarse cell faces at every refinement ratio the tests use,
10
// so every block is entirely land or entirely water. Moving y_lo/y_hi off a coarse face
11
// is what produces a partially-masked coarse cell.
12
ParmParse
pp_mask
(
"remora.prob"
);
13
Real
mask_x_lo
= Real(2800.0);
14
Real
mask_x_hi
= Real(5600.0);
15
Real
mask_y_lo
= Real(250.0);
16
Real
mask_y_hi
= Real(500.0);
17
pp_mask
.query(
"mask_x_lo"
,
mask_x_lo
);
18
pp_mask
.query(
"mask_x_hi"
,
mask_x_hi
);
19
pp_mask
.query(
"mask_y_lo"
,
mask_y_lo
);
20
pp_mask
.query(
"mask_y_hi"
,
mask_y_hi
);
21
22
// A ROMS closed basin has land on its boundary ring of rho points, next to interior
23
// water. mask_ring makes the grow cells outside the non-periodic domain edges land,
24
// so the wall boundary conditions meet land beside water.
25
bool
mask_ring
=
false
;
26
pp_mask
.query(
"mask_ring"
,
mask_ring
);
27
const
Box&
dom
=
geom
.Domain();
28
const
auto
dlo
= amrex::lbound(
dom
);
29
const
auto
dhi
= amrex::ubound(
dom
);
30
const
bool
ring_x
=
mask_ring
&& !
geom
.isPeriodic(0);
31
const
bool
ring_y
=
mask_ring
&& !
geom
.isPeriodic(1);
32
33
for
(
MFIter
mfi
(
mf_mskr
,
TilingIfNotGPU
());
mfi
.isValid(); ++
mfi
)
34
{
35
// Every grow cell, not just NGROW of them: the full-domain array carries as many as
36
// the cumulative refinement ratio needs, and any it left unwritten would coarsen
37
// down as water.
38
const
Box &
bx
=
mfi
.growntilebox();
39
40
Array4< Real>
const
&
mskr
=
mf_mskr
.array(
mfi
);
41
42
// mskr is 1 everywhere already
43
ParallelFor
(
bx
, [=]
AMREX_GPU_DEVICE
(
int
i
,
int
j
,
int
)
noexcept
44
{
45
const
Real x_r = (
i
+ Real(0.5)) *
dx
;
46
const
Real y_r = (
j
+ Real(0.5)) *
dy
;
47
if
((x_r >
mask_x_lo
&& x_r <
mask_x_hi
) &&
48
(
y_r < mask_y_lo || y_r >
mask_y_hi
)) {
49
mskr
(
i
,
j
,0) =
zero
;
50
}
51
if
((
ring_x
&& (
i < dlo.x || i >
dhi
.x)) ||
52
(
ring_y
&& (
j < dlo.y || j >
dhi
.y))) {
53
mskr
(
i
,
j
,0) =
zero
;
54
}
55
});
56
}
zero
constexpr amrex::Real zero
Definition
REMORA_Constants.H:6
setVal
mf_h setVal(geomdata.ProbHi(2))
dom
const Box & dom
Definition
REMORA_InitAnalyticMasks_DogboneAnalytic.H:27
dy
const Real dy
Definition
REMORA_InitAnalyticMasks_DogboneAnalytic.H:7
mask_ring
bool mask_ring
Definition
REMORA_InitAnalyticMasks_DogboneAnalytic.H:25
mask_x_lo
Real mask_x_lo
Definition
REMORA_InitAnalyticMasks_DogboneAnalytic.H:13
mask_y_lo
Real mask_y_lo
Definition
REMORA_InitAnalyticMasks_DogboneAnalytic.H:15
dhi
const auto dhi
Definition
REMORA_InitAnalyticMasks_DogboneAnalytic.H:29
ring_y
const bool ring_y
Definition
REMORA_InitAnalyticMasks_DogboneAnalytic.H:31
dlo
const auto dlo
Definition
REMORA_InitAnalyticMasks_DogboneAnalytic.H:28
pp_mask
ParmParse pp_mask("remora.prob")
ring_x
const bool ring_x
Definition
REMORA_InitAnalyticMasks_DogboneAnalytic.H:30
mask_y_hi
Real mask_y_hi
Definition
REMORA_InitAnalyticMasks_DogboneAnalytic.H:16
mask_x_hi
Real mask_x_hi
Definition
REMORA_InitAnalyticMasks_DogboneAnalytic.H:14
dx
const Real dx
Definition
REMORA_InitAnalyticMasks_DogboneAnalytic.H:6
Source
Prob
REMORA_InitAnalyticMasks_DogboneAnalytic.H
Generated by
1.9.8