REMORA
Regional Modeling of Oceans Refined Adaptively
Loading...
Searching...
No Matches
REMORAMaskedAvgDown Namespace Reference

Functions

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void avgdown_masked (int i, int j, int k, int n, amrex::Array4< amrex::Real > const &crse, amrex::Array4< amrex::Real const > const &fine, amrex::Array4< amrex::Real const > const &fmsk, amrex::Array4< amrex::Real const > const &cmsk, int ccomp, int fcomp, amrex::IntVect const &ratio) noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void avgdown_faces_masked (int i, int j, int k, int n, amrex::Array4< amrex::Real > const &crse, amrex::Array4< amrex::Real const > const &fine, amrex::Array4< amrex::Real const > const &fmsk, amrex::Array4< amrex::Real const > const &cmsk, int ccomp, int fcomp, amrex::IntVect const &ratio, int idir) noexcept
 

Detailed Description

Two-way nesting's fine-to-coarse update, weighted by the land/sea mask.

Ported from ROMS fine2coarse2d/fine2coarse3d in Nonlinear/nesting.F, the AreaAvg = .FALSE. branch that every call site there uses:

num  = sum of (fine value * fine mask) over the fine points under the coarse one
den  = sum of min(1, fine mask) over the same
crse = num/den * coarse mask

Dividing by the count of wet fine points rather than by how many there are means a coarse point only partly covered by water takes the mean of that water, not a value diluted toward zero by land. That is not conservative; ROMS makes the same trade deliberately. The coarse mask has the final say on wet or dry.

Where every fine point is wet these have to reproduce amrex_avgdown and amrex_avgdown_faces bit for bit, or every existing multilevel answer moves in its last bit.

Function Documentation

◆ avgdown_faces_masked()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void REMORAMaskedAvgDown::avgdown_faces_masked ( int  i,
int  j,
int  k,
int  n,
amrex::Array4< amrex::Real > const crse,
amrex::Array4< amrex::Real const > const fine,
amrex::Array4< amrex::Real const > const fmsk,
amrex::Array4< amrex::Real const > const cmsk,
int  ccomp,
int  fcomp,
amrex::IntVect const ratio,
int  idir 
)
noexcept

Face-centered fields: only the fine faces in the coarse face's own plane, the stencil amrex_avgdown_faces uses, so "wet" means the flow really does cross here.

Definition at line 69 of file REMORA_MaskedAverageDown.H.

Referenced by REMORA::average_down_masked(), and REMORA::average_down_with_grow_cells().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ avgdown_masked()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void REMORAMaskedAvgDown::avgdown_masked ( int  i,
int  j,
int  k,
int  n,
amrex::Array4< amrex::Real > const crse,
amrex::Array4< amrex::Real const > const fine,
amrex::Array4< amrex::Real const > const fmsk,
amrex::Array4< amrex::Real const > const cmsk,
int  ccomp,
int  fcomp,
amrex::IntVect const ratio 
)
noexcept

Cell-centered fields: every fine cell under the coarse one. The mask is 2D, read at k=0.

Definition at line 31 of file REMORA_MaskedAverageDown.H.

Referenced by REMORA::average_down_masked(), and REMORA::average_down_with_grow_cells().

Here is the call graph for this function:
Here is the caller graph for this function: