4 #include <AMReX_RealVect.H>
9 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
10 amrex::Real
avg_h ( amrex::Real XXXm, amrex::Real XXXp) {
11 if ( XXXm + XXXp < std::numeric_limits<amrex::Real>::min()) {
return 0.; }
12 else {
return ((XXXm * XXXp) / (0.5*(XXXm + XXXp))); }
15 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
16 amrex::Real
trD (
int i,
int j,
int k,
17 amrex::GpuArray<amrex::Real,AMREX_SPACEDIM>
const& dx,
18 amrex::Array4<amrex::Real const>
const& vel_x,
19 amrex::Array4<amrex::Real const>
const& vel_y,
20 amrex::Array4<amrex::Real const>
const& vel_z)
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];
28 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
31 amrex::RealVect
const& a_plane_normal,
32 amrex::RealVect
const& a_edge_point0,
33 amrex::RealVect
const& a_edge_point1,
34 amrex::RealVect& a_intersection_point,
35 amrex::Real& a_intersection_dist )
37 amrex::RealVect
const edge(a_edge_point1 - a_edge_point0);
38 amrex::Real
const edge_length = edge.vectorLength();
40 AMREX_ALWAYS_ASSERT(edge_length > 0.);
42 amrex::RealVect edge_normal = edge / edge_length;
44 amrex::Real np_dot_ne = a_plane_normal.dotProduct(edge_normal);
46 if ( amrex::Math::abs(np_dot_ne) < std::numeric_limits<amrex::Real>::min() )
49 a_intersection_dist = a_plane_normal.dotProduct(a_plane_point - a_edge_point0);
50 a_intersection_dist /= np_dot_ne;
52 a_intersection_point = a_edge_point0 + a_intersection_dist*edge_normal;
54 if (0. <= a_intersection_dist && a_intersection_dist <= edge_length) {
return 1;}
Definition: ERF_EBUtils.H:6
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)
Definition: ERF_EBUtils.H:30
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)
Definition: ERF_EBUtils.H:16
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real avg_h(amrex::Real XXXm, amrex::Real XXXp)
Definition: ERF_EBUtils.H:10