ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_ProbHeights.H
Go to the documentation of this file.
1 #ifndef ERF_PROB_HEIGHTS_H_
2 #define ERF_PROB_HEIGHTS_H_
3 
4 /**
5  * Physical heights at the face centres of a cell, from the nodal heights z_nd.
6  *
7  * On a mesh other than ConstantDz, geometry's prob_lo[2], prob_hi[2] and CellSize(2) only
8  * bound and step the computational coordinate, so problem setups take their heights from
9  * z_nd (and z_cc) there.
10  */
11 
12 #include <AMReX_Array4.H>
13 #include <AMReX_GpuQualifiers.H>
14 #include <AMReX_REAL.H>
15 
16 namespace erf_prob_heights {
17 
18 //! Height of the centre of x-face (i,j,k)
19 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
21 z_xface (int i, int j, int k, amrex::Array4<amrex::Real const> const& z_nd) noexcept
22 {
23  return amrex::Real(0.25) * ( z_nd(i,j ,k) + z_nd(i,j ,k+1)
24  + z_nd(i,j+1,k) + z_nd(i,j+1,k+1) );
25 }
26 
27 //! Height of the centre of y-face (i,j,k)
28 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
30 z_yface (int i, int j, int k, amrex::Array4<amrex::Real const> const& z_nd) noexcept
31 {
32  return amrex::Real(0.25) * ( z_nd(i ,j,k) + z_nd(i ,j,k+1)
33  + z_nd(i+1,j,k) + z_nd(i+1,j,k+1) );
34 }
35 
36 //! Height of the centre of z-face (i,j,k)
37 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
39 z_zface (int i, int j, int k, amrex::Array4<amrex::Real const> const& z_nd) noexcept
40 {
41  return amrex::Real(0.25) * ( z_nd(i,j ,k) + z_nd(i+1,j ,k)
42  + z_nd(i,j+1,k) + z_nd(i+1,j+1,k) );
43 }
44 
45 //! Height of the ground under cell (i,j), from z_sfc_nd, the ground heights at the nodes
46 //! of the bottom face of each column (see ERF::init_custom)
47 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
49 z_ground_cc (int i, int j, amrex::Array4<amrex::Real const> const& z_sfc_nd) noexcept
50 {
51  return amrex::Real(0.25) * ( z_sfc_nd(i,j ,0) + z_sfc_nd(i+1,j ,0)
52  + z_sfc_nd(i,j+1,0) + z_sfc_nd(i+1,j+1,0) );
53 }
54 
55 //! Height of the ground under x-face (i,j)
56 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
58 z_ground_xface (int i, int j, amrex::Array4<amrex::Real const> const& z_sfc_nd) noexcept
59 {
60  return amrex::Real(0.5) * ( z_sfc_nd(i,j,0) + z_sfc_nd(i,j+1,0) );
61 }
62 
63 //! Height of the ground under y-face (i,j)
64 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
66 z_ground_yface (int i, int j, amrex::Array4<amrex::Real const> const& z_sfc_nd) noexcept
67 {
68  return amrex::Real(0.5) * ( z_sfc_nd(i,j,0) + z_sfc_nd(i+1,j,0) );
69 }
70 
71 } // namespace erf_prob_heights
72 
73 #endif
amrex::Real Real
Definition: ERF_ShocInterface.H:19
Definition: ERF_ProbHeights.H:16
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real z_ground_xface(int i, int j, amrex::Array4< amrex::Real const > const &z_sfc_nd) noexcept
Height of the ground under x-face (i,j)
Definition: ERF_ProbHeights.H:58
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real z_ground_cc(int i, int j, amrex::Array4< amrex::Real const > const &z_sfc_nd) noexcept
Definition: ERF_ProbHeights.H:49
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real z_zface(int i, int j, int k, amrex::Array4< amrex::Real const > const &z_nd) noexcept
Height of the centre of z-face (i,j,k)
Definition: ERF_ProbHeights.H:39
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real z_yface(int i, int j, int k, amrex::Array4< amrex::Real const > const &z_nd) noexcept
Height of the centre of y-face (i,j,k)
Definition: ERF_ProbHeights.H:30
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real z_xface(int i, int j, int k, amrex::Array4< amrex::Real const > const &z_nd) noexcept
Height of the centre of x-face (i,j,k)
Definition: ERF_ProbHeights.H:21
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real z_ground_yface(int i, int j, amrex::Array4< amrex::Real const > const &z_sfc_nd) noexcept
Height of the ground under y-face (i,j)
Definition: ERF_ProbHeights.H:66