ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_Orbit.H File Reference
#include <AMReX.H>
#include <AMReX_MultiFab.H>
#include <ERF_Rrtmgp.H>
#include <ERF_Constants.H>
Include dependency graph for ERF_Orbit.H:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void zenith (int &calday, amrex::MultiFab *clat, amrex::MultiFab *clon, const amrex::Vector< int > &rank_offsets, real1d &coszrs, int &ncol, const amrex::Real &eccen, const amrex::Real &mvelpp, const amrex::Real &lambm0, const amrex::Real &obliqr, amrex::Real uniform_angle=-1.0)
 
AMREX_GPU_HOST AMREX_FORCE_INLINE amrex::Real shr_orb_cosz (const amrex::Real &jday, const amrex::Real &lat, const amrex::Real &lon, const amrex::Real &declin, amrex::Real uniform_angle)
 
AMREX_GPU_HOST AMREX_FORCE_INLINE void shr_orb_decl (const amrex::Real &calday, const amrex::Real &eccen, const amrex::Real &mvelpp, const amrex::Real &lambm0, const amrex::Real &obliqr, amrex::Real &delta, amrex::Real &eccf)
 

Function Documentation

◆ shr_orb_cosz()

AMREX_GPU_HOST AMREX_FORCE_INLINE amrex::Real shr_orb_cosz ( const amrex::Real &  jday,
const amrex::Real &  lat,
const amrex::Real &  lon,
const amrex::Real &  declin,
amrex::Real  uniform_angle 
)
31 {
32  amrex::Real cos_sol_zen_ang;
33 
34  // If uniform angle is specified we use that.
35  // NOTE: uniform angle is in degrees
36  if (uniform_angle>0.0) {
37  cos_sol_zen_ang = std::cos(uniform_angle * PI/180.0);
38  }
39  // Default method
40  else {
41  cos_sol_zen_ang = std::sin(lat)*std::sin(declin) - std::cos(lat)*std::cos(declin) *
42  std::cos((jday-std::floor(jday))*2.0*PI + lon);
43  }
44 
45  return cos_sol_zen_ang;
46 }
constexpr amrex::Real PI
Definition: ERF_Constants.H:6

Referenced by zenith().

Here is the caller graph for this function:

◆ shr_orb_decl()

AMREX_GPU_HOST AMREX_FORCE_INLINE void shr_orb_decl ( const amrex::Real &  calday,
const amrex::Real &  eccen,
const amrex::Real &  mvelpp,
const amrex::Real &  lambm0,
const amrex::Real &  obliqr,
amrex::Real &  delta,
amrex::Real &  eccf 
)
59 {
60 
61  static constexpr amrex::Real day_p_yr = 365.0;
62  static constexpr amrex::Real ve = 80.5;
63 
64  // Compute eccentricity factor and solar declination using
65  // day value where a round day (such as 213.0) refers to 0z at
66  // Greenwich longitude.
67 
68  // Use formulas from Berger, Andre 1978: Long-Term Variations of Daily
69  // Insolation and Quaternary Climatic Changes. J. of the Atmo. Sci.
70  // 35:2362-2367.
71 
72  // To get the earths true longitude (position in orbit; lambda in Berger
73  // 1978) which is necessary to find the eccentricity factor and declination,
74  // must first calculate the mean longitude (lambda m in Berger 1978) at
75  // the present day. This is done by adding to lambm0 (the mean longitude
76  // at the vernal equinox, set as March 21 at noon, when lambda=0; in radians)
77  // an increment (delta lambda m in Berger 1978) that is the number of
78  // days past or before (a negative increment) the vernal equinox divided by
79  // the days in a model year times the 2*pi radians in a complete orbit.
80  amrex::Real lambm = lambm0 + (calday - ve)*2.0*PI/day_p_yr;
81  amrex::Real lmm = lambm - mvelpp;
82 
83  // The earths true longitude, in radians, is then found from
84  // the formula in Berger 1978:
85  amrex::Real sinl = std::sin(lmm);
86  amrex::Real lamb = lambm + eccen*(2.0*sinl + eccen*(1.25*sin(2.0*lmm)
87  + eccen*((13.0/12.0)*sin(3.0*lmm) - 0.25*sinl)));
88 
89 
90  // Using the obliquity, eccentricity, moving vernal equinox longitude of
91  // perihelion (plus), and earths true longitude, the declination (delta)
92  // and the normalized earth/sun distance (rho in Berger 1978; actually inverse
93  // rho will be used), and thus the eccentricity factor (eccf), can be
94  // calculated from formulas given in Berger 1978.
95  amrex::Real invrho = (1.0 + eccen*std::cos(lamb - mvelpp)) / (1.0 - eccen*eccen);
96 
97  // Set solar declination and eccentricity factor
98  delta = std::asin(std::sin(obliqr)*std::sin(lamb));
99  eccf = invrho*invrho;
100 }

Referenced by Radiation::radiation_driver_sw(), and zenith().

Here is the caller graph for this function:

◆ zenith()

void zenith ( int &  calday,
amrex::MultiFab *  clat,
amrex::MultiFab *  clon,
const amrex::Vector< int > &  rank_offsets,
real1d &  coszrs,
int &  ncol,
const amrex::Real &  eccen,
const amrex::Real &  mvelpp,
const amrex::Real &  lambm0,
const amrex::Real &  obliqr,
amrex::Real  uniform_angle = -1.0 
)