ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
utils Namespace Reference

Functions

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real avg_h (amrex::Real XXXm, amrex::Real XXXp)
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real trD (int i, int j, int k, amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > const &dx, amrex::Array4< amrex::Real const > const &vel_x, amrex::Array4< amrex::Real const > const &vel_y, amrex::Array4< amrex::Real const > const &vel_z)
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int intersect_plane_edge (amrex::RealVect const &a_plane_point, amrex::RealVect const &a_plane_normal, amrex::RealVect const &a_edge_point0, amrex::RealVect const &a_edge_point1, amrex::RealVect &a_intersection_point, amrex::Real &a_intersection_dist)
 

Function Documentation

◆ avg_h()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real utils::avg_h ( amrex::Real  XXXm,
amrex::Real  XXXp 
)
10  {
11  if ( XXXm + XXXp < std::numeric_limits<amrex::Real>::min()) { return 0.; }
12  else { return ((XXXm * XXXp) / (0.5*(XXXm + XXXp))); }
13 }

Referenced by TurbulentPerturbation::calc_tpi_meanMag_perBox(), and TurbulentPerturbation::netZeroBuoyantAdd().

Here is the caller graph for this function:

◆ intersect_plane_edge()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int utils::intersect_plane_edge ( amrex::RealVect const &  a_plane_point,
amrex::RealVect const &  a_plane_normal,
amrex::RealVect const &  a_edge_point0,
amrex::RealVect const &  a_edge_point1,
amrex::RealVect &  a_intersection_point,
amrex::Real &  a_intersection_dist 
)
36 {
37  amrex::RealVect const edge(a_edge_point1 - a_edge_point0);
38  amrex::Real const edge_length = edge.vectorLength();
39 
40  AMREX_ALWAYS_ASSERT(edge_length > 0.);
41 
42  amrex::RealVect edge_normal = edge / edge_length;
43 
44  amrex::Real np_dot_ne = a_plane_normal.dotProduct(edge_normal);
45 
46  if ( amrex::Math::abs(np_dot_ne) < std::numeric_limits<amrex::Real>::min() )
47  { return 0; }
48 
49  a_intersection_dist = a_plane_normal.dotProduct(a_plane_point - a_edge_point0);
50  a_intersection_dist /= np_dot_ne;
51 
52  a_intersection_point = a_edge_point0 + a_intersection_dist*edge_normal;
53 
54  if (0. <= a_intersection_dist && a_intersection_dist <= edge_length) { return 1;}
55 
56  return 0;
57 }

Referenced by eb_cut_cell_::calc_edge_intersections().

Here is the caller graph for this function:

◆ trD()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real utils::trD ( int  i,
int  j,
int  k,
amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > const &  dx,
amrex::Array4< amrex::Real const > const &  vel_x,
amrex::Array4< amrex::Real const > const &  vel_y,
amrex::Array4< amrex::Real const > const &  vel_z 
)
21 {
22  return (vel_x(i+1,j,k)-vel_x(i,j,k))/dx[0] +
23  (vel_y(i,j+1,k)-vel_y(i,j,k))/dx[1] +
24  (vel_z(i,j,k+1)-vel_z(i,j,k))/dx[2];
25 }