ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_LatLonMap.H File Reference
#include <AMReX_Array.H>
#include <AMReX_Array4.H>
#include <AMReX_Box.H>
#include <AMReX_BoxArray.H>
#include <AMReX_DistributionMapping.H>
#include <AMReX_Geometry.H>
#include <AMReX_MultiFab.H>
#include <AMReX_REAL.H>
#include <algorithm>
#include <cmath>
#include <limits>
Include dependency graph for ERF_LatLonMap.H:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  LatLonLocation
 
class  LatLonMap
 

Enumerations

enum class  LatLonStatus { Ok , Degenerate , TooFar }
 

Functions

bool invert_latlon_offset (amrex::Real dlat, amrex::Real dlon, amrex::Real dlat_di, amrex::Real dlon_di, amrex::Real dlat_dj, amrex::Real dlon_dj, amrex::Real &di, amrex::Real &dj)
 
amrex::Real wrap_longitude_difference (amrex::Real dlon)
 
void grid_rotation_from_latlon (const amrex::Array4< const amrex::Real > &ll, const amrex::Box &dom, int i, int j, amrex::Real &cos_alpha, amrex::Real &sin_alpha)
 
LatLonStatus locate_latlon_on_grid (const amrex::Array4< const amrex::Real > &ll, const amrex::Box &dom, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &problo, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &dx, amrex::Real req_lat, amrex::Real req_lon, LatLonLocation &loc)
 
void pack_latlon (amrex::MultiFab &latlon, const amrex::MultiFab &lat, const amrex::MultiFab &lon)
 

Enumeration Type Documentation

◆ LatLonStatus

enum LatLonStatus
strong
Enumerator
Ok 
Degenerate 
TooFar 
105  {
106  Ok, // placed
107  Degenerate, // the lat/lon gradients are parallel near the point
108  TooFar // more than one cell from the nearest mass point: outside the domain
109 };

Function Documentation

◆ grid_rotation_from_latlon()

void grid_rotation_from_latlon ( const amrex::Array4< const amrex::Real > &  ll,
const amrex::Box &  dom,
int  i,
int  j,
amrex::Real &  cos_alpha,
amrex::Real &  sin_alpha 
)

◆ invert_latlon_offset()

bool invert_latlon_offset ( amrex::Real  dlat,
amrex::Real  dlon,
amrex::Real  dlat_di,
amrex::Real  dlon_di,
amrex::Real  dlat_dj,
amrex::Real  dlon_dj,
amrex::Real &  di,
amrex::Real &  dj 
)
inline
56 {
57  const amrex::Real scale = std::max(std::max(std::abs(dlat_di), std::abs(dlon_di)),
58  std::max(std::abs(dlat_dj), std::abs(dlon_dj)));
59  const amrex::Real det = dlat_di*dlon_dj - dlat_dj*dlon_di;
60  const amrex::Real rel = std::max(amrex::Real(1.0e-12),
62  if (scale <= amrex::Real(0.0) || std::abs(det) <= rel*scale*scale) {
63  return false;
64  }
65  di = ( dlat*dlon_dj - dlon*dlat_dj) / det;
66  dj = (-dlat*dlon_di + dlon*dlat_di) / det;
67  return true;
68 }
amrex::Real Real
Definition: ERF_ShocInterface.H:19
real(c_double), parameter epsilon
Definition: ERF_module_model_constants.F90:12
real(c_double), private di
Definition: ERF_module_mp_morr_two_moment.F90:203

Referenced by locate_latlon_on_grid().

Here is the caller graph for this function:

◆ locate_latlon_on_grid()

LatLonStatus locate_latlon_on_grid ( const amrex::Array4< const amrex::Real > &  ll,
const amrex::Box &  dom,
const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &  problo,
const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &  dx,
amrex::Real  req_lat,
amrex::Real  req_lon,
LatLonLocation &  loc 
)

◆ pack_latlon()

void pack_latlon ( amrex::MultiFab &  latlon,
const amrex::MultiFab &  lat,
const amrex::MultiFab &  lon 
)

◆ wrap_longitude_difference()

amrex::Real wrap_longitude_difference ( amrex::Real  dlon)
inline
76 {
77  if (dlon > amrex::Real(180.0)) { return dlon - amrex::Real(360.0); }
78  if (dlon < -amrex::Real(180.0)) { return dlon + amrex::Real(360.0); }
79  return dlon;
80 }

Referenced by grid_rotation_from_latlon(), and locate_latlon_on_grid().

Here is the caller graph for this function: