ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
most_aitken Struct Reference

#include <ERF_MOSTUtils.H>

Collaboration diagram for most_aitken:

Public Member Functions

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real update (amrex::Real u_new, int iter)
 

Public Attributes

int start {25}
 
bool extrapolated {false}
 whether the last update returned an extrapolated value More...
 
int n {0}
 
amrex::Real u0 {zero}
 
amrex::Real u1 {zero}
 
amrex::Real u2 {zero}
 

Detailed Description

Aitken delta-squared acceleration of the relaxed u* iteration in the prescribed-flux kernels.

Near the stable fold the slope of the fixed-point map approaches 1 and the plain iteration needs hundreds of passes. From pass start on, every third iterate is replaced by the Aitken extrapolation of the last three (kept only within a factor of 2 of them), so points that converge before start are unchanged. The map is not stationary when w* or a u*-dependent z0 also changes from pass to pass, so the kernels do not stop on an extrapolated pass: the plain pass after it, with zeta and psi from the same u*, decides convergence.

Member Function Documentation

◆ update()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real most_aitken::update ( amrex::Real  u_new,
int  iter 
)
inline

Return the iterate to continue from.

Parameters
[in]u_newiterate after pass iter
[in]iternumber of passes done
541  {
542  extrapolated = false;
543  if (iter < start) { return u_new; }
544  u0 = u1;
545  u1 = u2;
546  u2 = u_new;
547  if (++n < 3) { return u_new; }
548  const amrex::Real d = u2 - two * u1 + u0;
549  const amrex::Real ua = (d != zero) ? u2 - (u2 - u1) * (u2 - u1) / d : u_new;
550  const amrex::Real lo = myhalf * amrex::min(u0, amrex::min(u1, u2));
551  const amrex::Real hi = two * amrex::max(u0, amrex::max(u1, u2));
552  if (d == zero || !(ua > lo && ua < hi)) {
553  n = 0;
554  return u_new;
555  }
556  // The extrapolated value starts the next triple
557  u2 = ua;
558  n = 1;
559  extrapolated = true;
560  return ua;
561  }
constexpr amrex::Real two
Definition: ERF_NumericalConstants.H:38
constexpr amrex::Real zero
Definition: ERF_NumericalConstants.H:36
constexpr amrex::Real myhalf
Definition: ERF_NumericalConstants.H:41
amrex::Real Real
Definition: ERF_ShocInterface.H:19
amrex::Real u2
Definition: ERF_MOSTUtils.H:568
int start
Definition: ERF_MOSTUtils.H:563
bool extrapolated
whether the last update returned an extrapolated value
Definition: ERF_MOSTUtils.H:564
int n
Definition: ERF_MOSTUtils.H:565
amrex::Real u0
Definition: ERF_MOSTUtils.H:566
amrex::Real u1
Definition: ERF_MOSTUtils.H:567

Referenced by surface_flux_charnock::iterate_flux(), surface_flux_mod_charnock::iterate_flux(), surface_flux_donelan::iterate_flux(), surface_flux_wave_coupled::iterate_flux(), surface_flux::iterate_flux(), and surface_flux_eb::iterate_flux().

Here is the caller graph for this function:

Member Data Documentation

◆ extrapolated

◆ n

int most_aitken::n {0}

Referenced by update().

◆ start

int most_aitken::start {25}

Referenced by update().

◆ u0

amrex::Real most_aitken::u0 {zero}

Referenced by update().

◆ u1

amrex::Real most_aitken::u1 {zero}

Referenced by update().

◆ u2

amrex::Real most_aitken::u2 {zero}

Referenced by update().


The documentation for this struct was generated from the following file: