ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_AdvanceWSM6.cpp File Reference
#include "ERF_WSM6.H"
#include "ERF_WSM6_Fortran_Interface.H"
#include "ERF_MicrophysicsConstants.H"
#include "ERF_Constants.H"
#include <AMReX_Reduce.H>
#include <algorithm>
#include <array>
#include <cctype>
#include <cstdio>
#include <cmath>
#include <cstdint>
#include <cstring>
#include <string>
#include <vector>
Include dependency graph for ERF_AdvanceWSM6.cpp:

Namespaces

 WSM6SedCellScratch
 
 WSM6SedNodeScratch
 

Enumerations

enum  {
  WSM6SedCellScratch::wd = 0 , WSM6SedCellScratch::wa , WSM6SedCellScratch::wa2 , WSM6SedCellScratch::qn ,
  WSM6SedCellScratch::qn2 , WSM6SedCellScratch::dz , WSM6SedCellScratch::ww , WSM6SedCellScratch::qq ,
  WSM6SedCellScratch::qq2 , WSM6SedCellScratch::was , WSM6SedCellScratch::den , WSM6SedCellScratch::denfac ,
  WSM6SedCellScratch::tk , WSM6SedCellScratch::qr , WSM6SedCellScratch::qr2 , WSM6SedCellScratch::tmp ,
  WSM6SedCellScratch::tmp1 , WSM6SedCellScratch::tmp2 , WSM6SedCellScratch::tmp3 , WSM6SedCellScratch::workr_col ,
  WSM6SedCellScratch::worka_col , WSM6SedCellScratch::denqrs1_col , WSM6SedCellScratch::denqrs2_col , WSM6SedCellScratch::denqrs3_col ,
  WSM6SedCellScratch::qsum_col , WSM6SedCellScratch::work1c_col , WSM6SedCellScratch::denqci_col , WSM6SedCellScratch::NumComps
}
 
enum  {
  WSM6SedNodeScratch::wi = 0 , WSM6SedNodeScratch::zi , WSM6SedNodeScratch::za , WSM6SedNodeScratch::dza ,
  WSM6SedNodeScratch::qa , WSM6SedNodeScratch::qa2 , WSM6SedNodeScratch::qmi , WSM6SedNodeScratch::qpi ,
  WSM6SedNodeScratch::NumComps
}
 

Functions

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real wsm6_cpmcal (Real x, Real qmin_arg, Real cpd_arg, Real cpv_arg)
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real wsm6_xlcal (Real x, Real xlv0_arg, Real xlv1_arg, Real t0c_arg)
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real wsm6_diffus (Real x, Real y)
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real wsm6_viscos (Real x, Real y)
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real wsm6_xka (Real x, Real y)
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real wsm6_diffac (Real a, Real b, Real c, Real d, Real e, Real rv_arg)
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real wsm6_venfac (Real a, Real b, Real c, Real den0_arg)
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real wsm6_conden (Real a, Real b, Real c, Real d, Real e, Real qmin_arg, Real rv_arg)
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real wsm6_lamdar (Real x, Real y, Real pidn0r_arg)
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real wsm6_lamdas (Real x, Real y, Real z, Real pidn0s_arg)
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real wsm6_lamdag (Real x, Real y, Real pidn0g_arg)
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void wsm6_slope_rain_cell (Real qr, Real den, Real denfac, Real pidn0r_arg, Real qcrmin_arg, Real rslopermax_arg, Real rsloperbmax_arg, Real rsloper2max_arg, Real rsloper3max_arg, Real bvtr_arg, Real pvtr_arg, Real &rslope, Real &rslopeb, Real &rslope2, Real &rslope3, Real &vt)
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void wsm6_slope_snow_cell (Real qs, Real den, Real denfac, Real t, Real pidn0s_arg, Real alpha_arg, Real n0smax_arg, Real n0s_arg, Real t0c_arg, Real qcrmin_arg, Real rslopesmax_arg, Real rslopesbmax_arg, Real rslopes2max_arg, Real rslopes3max_arg, Real bvts_arg, Real pvts_arg, Real &rslope, Real &rslopeb, Real &rslope2, Real &rslope3, Real &vt, Real &n0sfac)
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void wsm6_slope_graup_cell (Real qg, Real den, Real denfac, Real pidn0g_arg, Real qcrmin_arg, Real rslopegmax_arg, Real rslopegbmax_arg, Real rslopeg2max_arg, Real rslopeg3max_arg, Real bvtg_arg, Real pvtg_arg, Real &rslope, Real &rslopeb, Real &rslope2, Real &rslope3, Real &vt)
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void wsm6_nislfv_rain_plm_scratch (int km, int ww_comp, int rq_comp, Real *precip, Real dt, int iter, Array4< Real > const &sed_cell, Array4< Real > const &sed_node, int i_s, int j_s, int klo_s)
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void wsm6_nislfv_rain_plm6_scratch (int km, int ww_comp, int rq_comp, int rq2_comp, Real *precip1, Real *precip2, Real dt, int iter, Array4< Real > const &sed_cell, Array4< Real > const &sed_node, int i_s, int j_s, int klo_s)
 

Function Documentation

◆ wsm6_conden()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real wsm6_conden ( Real  a,
Real  b,
Real  c,
Real  d,
Real  e,
Real  qmin_arg,
Real  rv_arg 
)
67  {
68  return (amrex::max(b,qmin_arg)-c)
69  /(Real(1.0)+d*d/(rv_arg*e)*c/(a*a));
70 }
amrex::Real Real
Definition: ERF_ShocInterface.H:19

Referenced by WSM6::AdvanceColumns().

Here is the caller graph for this function:

◆ wsm6_cpmcal()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real wsm6_cpmcal ( Real  x,
Real  qmin_arg,
Real  cpd_arg,
Real  cpv_arg 
)
25  {
26  return cpd_arg*(Real(1.0)-amrex::max(x,qmin_arg))
27  +amrex::max(x,qmin_arg)*cpv_arg;
28 }

Referenced by WSM6::AdvanceColumns().

Here is the caller graph for this function:

◆ wsm6_diffac()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real wsm6_diffac ( Real  a,
Real  b,
Real  c,
Real  d,
Real  e,
Real  rv_arg 
)
52  {
53  return d*a*a/(wsm6_xka(c,d)*rv_arg*c*c)
54  +Real(1.0)/(e*wsm6_diffus(c,b));
55 }
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real wsm6_xka(Real x, Real y)
Definition: ERF_AdvanceWSM6.cpp:46
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real wsm6_diffus(Real x, Real y)
Definition: ERF_AdvanceWSM6.cpp:36

Referenced by WSM6::AdvanceColumns().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ wsm6_diffus()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real wsm6_diffus ( Real  x,
Real  y 
)
36  {
37  return Real(8.794e-5)*std::exp(std::log(x)*Real(1.81))/y;
38 }

Referenced by wsm6_diffac(), and wsm6_venfac().

Here is the caller graph for this function:

◆ wsm6_lamdag()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real wsm6_lamdag ( Real  x,
Real  y,
Real  pidn0g_arg 
)
89  {
90  return std::sqrt(std::sqrt(pidn0g_arg/(x*y)));
91 }

Referenced by wsm6_slope_graup_cell().

Here is the caller graph for this function:

◆ wsm6_lamdar()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real wsm6_lamdar ( Real  x,
Real  y,
Real  pidn0r_arg 
)
79  {
80  return std::sqrt(std::sqrt(pidn0r_arg/(x*y)));
81 }

Referenced by wsm6_slope_rain_cell().

Here is the caller graph for this function:

◆ wsm6_lamdas()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real wsm6_lamdas ( Real  x,
Real  y,
Real  z,
Real  pidn0s_arg 
)
84  {
85  return std::sqrt(std::sqrt(pidn0s_arg*z/(x*y)));
86 }

Referenced by wsm6_slope_snow_cell().

Here is the caller graph for this function:

◆ wsm6_nislfv_rain_plm6_scratch()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void wsm6_nislfv_rain_plm6_scratch ( int  km,
int  ww_comp,
int  rq_comp,
int  rq2_comp,
Real *  precip1,
Real *  precip2,
Real  dt,
int  iter,
Array4< Real > const &  sed_cell,
Array4< Real > const &  sed_node,
int  i_s,
int  j_s,
int  klo_s 
)
517 {
518  auto DZ = [&](int k) -> amrex::Real& {
519  return sed_cell(i_s, j_s, klo_s + k, WSM6SedCellScratch::dz);
520  };
521  auto WW = [&](int k) -> amrex::Real& {
522  return sed_cell(i_s, j_s, klo_s + k, WSM6SedCellScratch::ww);
523  };
524  auto QQ = [&](int k) -> amrex::Real& {
525  return sed_cell(i_s, j_s, klo_s + k, WSM6SedCellScratch::qq);
526  };
527  auto QQ2 = [&](int k) -> amrex::Real& {
528  return sed_cell(i_s, j_s, klo_s + k, WSM6SedCellScratch::qq2);
529  };
530  auto WD = [&](int k) -> amrex::Real& {
531  return sed_cell(i_s, j_s, klo_s + k, WSM6SedCellScratch::wd);
532  };
533  auto WA = [&](int k) -> amrex::Real& {
534  return sed_cell(i_s, j_s, klo_s + k, WSM6SedCellScratch::wa);
535  };
536  auto WA2 = [&](int k) -> amrex::Real& {
537  return sed_cell(i_s, j_s, klo_s + k, WSM6SedCellScratch::wa2);
538  };
539  auto WAS = [&](int k) -> amrex::Real& {
540  return sed_cell(i_s, j_s, klo_s + k, WSM6SedCellScratch::was);
541  };
542  auto DEN = [&](int k) -> amrex::Real& {
543  return sed_cell(i_s, j_s, klo_s + k, WSM6SedCellScratch::den);
544  };
545  auto DENFAC = [&](int k) -> amrex::Real& {
546  return sed_cell(i_s, j_s, klo_s + k, WSM6SedCellScratch::denfac);
547  };
548  auto TK = [&](int k) -> amrex::Real& {
549  return sed_cell(i_s, j_s, klo_s + k, WSM6SedCellScratch::tk);
550  };
551  auto QN = [&](int k) -> amrex::Real& {
552  return sed_cell(i_s, j_s, klo_s + k, WSM6SedCellScratch::qn);
553  };
554  auto QN2 = [&](int k) -> amrex::Real& {
555  return sed_cell(i_s, j_s, klo_s + k, WSM6SedCellScratch::qn2);
556  };
557  auto QR = [&](int k) -> amrex::Real& {
558  return sed_cell(i_s, j_s, klo_s + k, WSM6SedCellScratch::qr);
559  };
560  auto QR2 = [&](int k) -> amrex::Real& {
561  return sed_cell(i_s, j_s, klo_s + k, WSM6SedCellScratch::qr2);
562  };
563  auto TMP = [&](int k) -> amrex::Real& {
564  return sed_cell(i_s, j_s, klo_s + k, WSM6SedCellScratch::tmp);
565  };
566  auto TMP1 = [&](int k) -> amrex::Real& {
567  return sed_cell(i_s, j_s, klo_s + k, WSM6SedCellScratch::tmp1);
568  };
569  auto TMP2 = [&](int k) -> amrex::Real& {
570  return sed_cell(i_s, j_s, klo_s + k, WSM6SedCellScratch::tmp2);
571  };
572  auto TMP3 = [&](int k) -> amrex::Real& {
573  return sed_cell(i_s, j_s, klo_s + k, WSM6SedCellScratch::tmp3);
574  };
575 
576  auto WI = [&](int k) -> amrex::Real& {
577  return sed_node(i_s, j_s, klo_s + k, WSM6SedNodeScratch::wi);
578  };
579  auto ZI = [&](int k) -> amrex::Real& {
580  return sed_node(i_s, j_s, klo_s + k, WSM6SedNodeScratch::zi);
581  };
582  auto ZA = [&](int k) -> amrex::Real& {
583  return sed_node(i_s, j_s, klo_s + k, WSM6SedNodeScratch::za);
584  };
585  auto DZA = [&](int k) -> amrex::Real& {
586  return sed_node(i_s, j_s, klo_s + k, WSM6SedNodeScratch::dza);
587  };
588  auto QA = [&](int k) -> amrex::Real& {
589  return sed_node(i_s, j_s, klo_s + k, WSM6SedNodeScratch::qa);
590  };
591  auto QA2 = [&](int k) -> amrex::Real& {
592  return sed_node(i_s, j_s, klo_s + k, WSM6SedNodeScratch::qa2);
593  };
594  auto QMI = [&](int k) -> amrex::Real& {
595  return sed_node(i_s, j_s, klo_s + k, WSM6SedNodeScratch::qmi);
596  };
597  auto QPI = [&](int k) -> amrex::Real& {
598  return sed_node(i_s, j_s, klo_s + k, WSM6SedNodeScratch::qpi);
599  };
600 
601  constexpr Real pi = Real(3.141592653589793238462643383279502884);
602  auto rgmma = [](Real x) -> Real {
603  if (x == Real(1.0)) return Real(0.0);
604  constexpr Real euler = Real(0.577215664901532);
605  Real rg = x * std::exp(euler * x);
606  for (int ii = 1; ii <= 10000; ++ii) {
607  const Real y = static_cast<Real>(ii);
608  rg = rg * (Real(1.0) + x / y) * std::exp(-x / y);
609  }
610  return Real(1.0) / rg;
611  };
612 
613  const Real dens = WSM6::dens_snow;
614  const Real n0g = Real(4.0e6);
615  const Real deng = Real(500.0);
616  const Real avtg = Real(330.0);
617  const Real bvtg = Real(0.8);
618  const Real lamdagmax = Real(6.0e4);
619 
620  const Real pidn0s = pi * dens * WSM6::n0s;
621  const Real pidn0g = pi * deng * n0g;
622  const Real rslopesmax = Real(1.0) / WSM6::lamdasmax;
623  const Real rslopesbmax = std::pow(rslopesmax, WSM6::bvts);
626  const Real rslopegmax = Real(1.0) / lamdagmax;
627  const Real rslopegbmax = std::pow(rslopegmax, bvtg);
630  const Real pvts = WSM6::avts * rgmma(Real(4.0) + WSM6::bvts) / Real(6.0);
631  const Real pvtg = avtg * rgmma(Real(4.0) + bvtg) / Real(6.0);
632 
633  Real allold = Real(0.0);
634  for (int k = 0; k < km; ++k) {
635  QQ(k) = sed_cell(i_s, j_s, klo_s + k, rq_comp);
636  QQ2(k) = sed_cell(i_s, j_s, klo_s + k, rq2_comp);
637  WW(k) = sed_cell(i_s, j_s, klo_s + k, ww_comp);
638  WD(k) = WW(k);
639  allold += QQ(k) + QQ2(k);
640  }
641 
642  precip1[0] = Real(0.0);
643  precip2[0] = Real(0.0);
644  if (allold <= Real(0.0)) {
645  return;
646  }
647 
648  ZI(0) = Real(0.0);
649  for (int k = 0; k < km; ++k) {
650  ZI(k + 1) = ZI(k) + DZ(k);
651  }
652 
653  auto update_wind_and_state = [&](void) {
654  WI(0) = WW(0);
655  WI(km) = WW(km - 1);
656  for (int k = 1; k < km; ++k) {
657  WI(k) = (WW(k) * DZ(k - 1) + WW(k - 1) * DZ(k)) / (DZ(k - 1) + DZ(k));
658  }
659 
660  WI(0) = WW(0);
661  WI(1) = Real(0.5) * (WW(1) + WW(0));
662  for (int k = 2; k < km - 1; ++k) {
663  WI(k) = Real(9.0) / Real(16.0) * (WW(k) + WW(k - 1))
664  - Real(1.0) / Real(16.0) * (WW(k + 1) + WW(k - 2));
665  }
666  if (km > 1) {
667  WI(km - 1) = Real(0.5) * (WW(km - 1) + WW(km - 2));
668  WI(km) = WW(km - 1);
669  }
670 
671  for (int k = 1; k < km; ++k) {
672  if (WW(k) == Real(0.0)) WI(k) = WW(k - 1);
673  }
674 
675  const Real con1 = Real(0.05);
676  for (int k = km - 1; k >= 0; --k) {
677  const Real decfl = (WI(k + 1) - WI(k)) * dt / DZ(k);
678  if (decfl > con1) {
679  WI(k) = WI(k + 1) - con1 * DZ(k) / dt;
680  }
681  }
682 
683  for (int k = 0; k <= km; ++k) {
684  ZA(k) = ZI(k) - WI(k) * dt;
685  }
686 
687  for (int k = 0; k < km; ++k) {
688  DZA(k) = ZA(k + 1) - ZA(k);
689  if (DZA(k) <= Real(0.0)) DZA(k) = DZ(k);
690  }
691  DZA(km) = ZI(km) - ZA(km);
692  if (DZA(km) <= Real(0.0)) DZA(km) = DZ(km > 0 ? km - 1 : 0);
693  for (int k = 0; k < km; ++k) {
694  QA(k) = QQ(k) * DZ(k) / DZA(k);
695  QA2(k) = QQ2(k) * DZ(k) / DZA(k);
696  QR(k) = QA(k) / DEN(k);
697  QR2(k) = QA2(k) / DEN(k);
698  }
699  QA(km) = Real(0.0);
700  QA2(km) = Real(0.0);
701  };
702 
703  update_wind_and_state();
704 
705  if (iter > 0) {
706  Real n0sfac_dummy;
707  for (int k = 0; k < km; ++k) {
708  wsm6_slope_snow_cell(QR(k), DEN(k), DENFAC(k), TK(k), pidn0s,
709  Real(0.12), Real(1.0e11), Real(2.0e6),
710  Real(273.15), Real(WSM6::qcrmin),
713  TMP(k), TMP1(k), TMP2(k), TMP3(k),
714  WA(k), n0sfac_dummy);
715  wsm6_slope_graup_cell(QR2(k), DEN(k), DENFAC(k), pidn0g,
718  Real(0.8), pvtg,
719  TMP(k), TMP1(k), TMP2(k), TMP3(k),
720  WA2(k));
721  }
722  for (int k = 0; k < km; ++k) {
723  const Real tmpq = amrex::max(QR(k) + QR2(k), Real(1.0e-15));
724  if (tmpq > Real(1.0e-15)) {
725  WA(k) = (WA(k) * QR(k) + WA2(k) * QR2(k)) / tmpq;
726  } else {
727  WA(k) = Real(0.0);
728  }
729  }
730  for (int k = 0; k < km; ++k) {
731  WW(k) = Real(0.5) * (WD(k) + WA(k));
732  WAS(k) = WA(k);
733  }
734  update_wind_and_state();
735  }
736 
737  for (int ist = 0; ist < 2; ++ist) {
738  const int qn_comp = (ist == 0)
741  const int qa_comp = (ist == 0)
744  auto QN_DST = [&](int k) -> Real& {
745  return sed_cell(i_s,j_s,klo_s+k,qn_comp);
746  };
747  auto QA_SRC = [&](int k) -> Real& {
748  return sed_node(i_s,j_s,klo_s+k,qa_comp);
749  };
750  Real* precip_dst = (ist == 0) ? &precip1[0] : &precip2[0];
751 
752  for (int k = 1; k < km; ++k) {
753  const Real dip = (QA_SRC(k + 1) - QA_SRC(k)) / (DZA(k + 1) + DZA(k));
754  const Real dim = (QA_SRC(k) - QA_SRC(k - 1)) / (DZA(k - 1) + DZA(k));
755  if (dip * dim <= Real(0.0)) {
756  QMI(k) = QA_SRC(k);
757  QPI(k) = QA_SRC(k);
758  } else {
759  QPI(k) = QA_SRC(k) + Real(0.5) * (dip + dim) * DZA(k);
760  QMI(k) = Real(2.0) * QA_SRC(k) - QPI(k);
761  if (QPI(k) < Real(0.0) || QMI(k) < Real(0.0)) {
762  QPI(k) = QA_SRC(k);
763  QMI(k) = QA_SRC(k);
764  }
765  }
766  }
767  QPI(0) = QA_SRC(0);
768  QMI(0) = QA_SRC(0);
769  QMI(km) = QA_SRC(km);
770  QPI(km) = QA_SRC(km);
771 
772  for (int k = 0; k < km; ++k) {
773  QN_DST(k) = Real(0.0);
774  }
775 
776  int kb = 0;
777  int kt = 0;
778  for (int k = 0; k < km; ++k) {
779  if (ZI(k) >= ZA(km)) {
780  break;
781  }
782 
783  for (int kk = kb; kk < km; ++kk) {
784  if (ZI(k) <= ZA(kk + 1)) {
785  kb = kk;
786  break;
787  }
788  }
789 
790  // Unlike the WRF original, also try the departure point of the column top, and when
791  // the cell top lies above even that, take the rest from the empty region above it
792  // (QA(km) = 0). Otherwise the search fails for the top cells of the column, which
793  // then come out empty and lose what they held: harmless at the model top, where
794  // there is nothing, but not at the top of a refined patch.
795  bool kt_found = false;
796  for (int kk = kt; kk <= km; ++kk) {
797  if (ZI(k + 1) <= ZA(kk)) {
798  kt = kk;
799  kt_found = true;
800  break;
801  }
802  }
803  if (!kt_found) { kt = km + 1; }
804  kt = amrex::max(kt - 1, 0);
805 
806  if (kt == kb) {
807  const Real tl = (ZI(k) - ZA(kb)) / DZA(kb);
808  const Real th = (ZI(k + 1) - ZA(kb)) / DZA(kb);
809  const Real tl2 = tl * tl;
810  const Real th2 = th * th;
811  const Real qqd = Real(0.5) * (QPI(kb) - QMI(kb));
812  const Real qqh = qqd * th2 + QMI(kb) * th;
813  const Real qql = qqd * tl2 + QMI(kb) * tl;
814  QN_DST(k) = (qqh - qql) / (th - tl);
815  } else if (kt > kb) {
816  const Real tl = (ZI(k) - ZA(kb)) / DZA(kb);
817  const Real tl2 = tl * tl;
818  const Real qqd = Real(0.5) * (QPI(kb) - QMI(kb));
819  const Real qql = qqd * tl2 + QMI(kb) * tl;
820  const Real dql = QA_SRC(kb) - qql;
821  Real zsum = (Real(1.0) - tl) * DZA(kb);
822  Real qsum = dql * DZA(kb);
823  if (kt - kb > 1) {
824  for (int m = kb + 1; m < kt; ++m) {
825  zsum += DZA(m);
826  qsum += QA_SRC(m) * DZA(m);
827  }
828  }
829  const Real th = (ZI(k + 1) - ZA(kt)) / DZA(kt);
830  const Real th2 = th * th;
831  const Real dqh = Real(0.5) * (QPI(kt) - QMI(kt)) * th2 + QMI(kt) * th;
832  zsum += th * DZA(kt);
833  qsum += dqh * DZA(kt);
834  QN_DST(k) = qsum / zsum;
835  }
836  }
837 
838  Real precip = Real(0.0);
839  for (int k = 0; k < km; ++k) {
840  if (ZA(k) < Real(0.0) && ZA(k + 1) < Real(0.0)) {
841  precip += QA_SRC(k) * DZA(k);
842  } else if (ZA(k) < Real(0.0) && ZA(k + 1) >= Real(0.0)) {
843  precip += QA_SRC(k) * (Real(0.0) - ZA(k));
844  break;
845  } else {
846  break;
847  }
848  }
849  *precip_dst = precip;
850  }
851 
852  for (int k = 0; k < km; ++k) {
853  sed_cell(i_s, j_s, klo_s + k, rq_comp) = QN(k);
854  sed_cell(i_s, j_s, klo_s + k, rq2_comp) = QN2(k);
855  sed_cell(i_s, j_s, klo_s + k, ww_comp) = WW(k);
856  }
857 }
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void wsm6_slope_snow_cell(Real qs, Real den, Real denfac, Real t, Real pidn0s_arg, Real alpha_arg, Real n0smax_arg, Real n0s_arg, Real t0c_arg, Real qcrmin_arg, Real rslopesmax_arg, Real rslopesbmax_arg, Real rslopes2max_arg, Real rslopes3max_arg, Real bvts_arg, Real pvts_arg, Real &rslope, Real &rslopeb, Real &rslope2, Real &rslope3, Real &vt, Real &n0sfac)
Definition: ERF_AdvanceWSM6.cpp:172
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void wsm6_slope_graup_cell(Real qg, Real den, Real denfac, Real pidn0g_arg, Real qcrmin_arg, Real rslopegmax_arg, Real rslopegbmax_arg, Real rslopeg2max_arg, Real rslopeg3max_arg, Real bvtg_arg, Real pvtg_arg, Real &rslope, Real &rslopeb, Real &rslope2, Real &rslope3, Real &vt)
Definition: ERF_AdvanceWSM6.cpp:202
static constexpr amrex::Real qcrmin
Definition: ERF_WSM6.H:161
static constexpr amrex::Real lamdasmax
Definition: ERF_WSM6.H:156
static constexpr amrex::Real n0s
Definition: ERF_WSM6.H:166
static constexpr amrex::Real dens_snow
Definition: ERF_WSM6.H:163
static constexpr amrex::Real bvts
Definition: ERF_WSM6.H:154
static constexpr amrex::Real avts
Definition: ERF_WSM6.H:153
@ n0g
Definition: ERF_AdvanceMorrison.cpp:45
@ QR
Definition: ERF_IndexDefines.H:182
@ precip
Definition: ERF_SLM.H:133
constexpr int DZ
Definition: ERF_TwoStreamColumn.H:599
@ qsum
Definition: ERF_WSM6.H:344
@ qq2
Definition: ERF_AdvanceWSM6.cpp:109
@ qq
Definition: ERF_AdvanceWSM6.cpp:108
@ qn2
Definition: ERF_AdvanceWSM6.cpp:105
@ tmp
Definition: ERF_AdvanceWSM6.cpp:116
@ wa
Definition: ERF_AdvanceWSM6.cpp:102
@ qn
Definition: ERF_AdvanceWSM6.cpp:104
@ was
Definition: ERF_AdvanceWSM6.cpp:110
@ tmp3
Definition: ERF_AdvanceWSM6.cpp:119
@ wa2
Definition: ERF_AdvanceWSM6.cpp:103
@ wd
Definition: ERF_AdvanceWSM6.cpp:101
@ qr2
Definition: ERF_AdvanceWSM6.cpp:115
@ tmp1
Definition: ERF_AdvanceWSM6.cpp:117
@ den
Definition: ERF_AdvanceWSM6.cpp:111
@ dz
Definition: ERF_AdvanceWSM6.cpp:106
@ tk
Definition: ERF_AdvanceWSM6.cpp:113
@ tmp2
Definition: ERF_AdvanceWSM6.cpp:118
@ denfac
Definition: ERF_AdvanceWSM6.cpp:112
@ qr
Definition: ERF_AdvanceWSM6.cpp:114
@ ww
Definition: ERF_AdvanceWSM6.cpp:107
@ wi
Definition: ERF_AdvanceWSM6.cpp:134
@ qmi
Definition: ERF_AdvanceWSM6.cpp:140
@ qa2
Definition: ERF_AdvanceWSM6.cpp:139
@ qpi
Definition: ERF_AdvanceWSM6.cpp:141
@ qa
Definition: ERF_AdvanceWSM6.cpp:138
@ dza
Definition: ERF_AdvanceWSM6.cpp:137
@ zi
Definition: ERF_AdvanceWSM6.cpp:135
@ za
Definition: ERF_AdvanceWSM6.cpp:136
real(c_double), parameter, private pi
Definition: ERF_module_mp_morr_two_moment.F90:100
real(kind=kind_phys), save rslopes3max
Definition: ERF_module_mp_wdm6.F90:100
real(kind=kind_phys), save rslopegmax
Definition: ERF_module_mp_wdm6.F90:100
real(kind=kind_phys), save rslopesmax
Definition: ERF_module_mp_wdm6.F90:100
real(kind=kind_phys), save pidn0s
Definition: ERF_module_mp_wdm6.F90:100
real(kind=kind_phys), save rslopeg3max
Definition: ERF_module_mp_wdm6.F90:100
real(kind=kind_phys), save deng
Definition: ERF_module_mp_wdm6.F90:100
real(kind=kind_phys), save avtg
Definition: ERF_module_mp_wdm6.F90:100
real(kind=kind_phys), save pvtg
Definition: ERF_module_mp_wdm6.F90:100
real(kind=kind_phys), parameter, private dens
Definition: ERF_module_mp_wdm6.F90:61
real(kind=kind_phys), save lamdagmax
Definition: ERF_module_mp_wdm6.F90:100
real(kind=kind_phys), save bvtg
Definition: ERF_module_mp_wdm6.F90:100
real(kind=kind_phys), save pvts
Definition: ERF_module_mp_wdm6.F90:100
real(kind=kind_phys), save rslopeg2max
Definition: ERF_module_mp_wdm6.F90:100
real(kind=kind_phys) function rgmma(x)
Definition: ERF_module_mp_wdm6.F90:2185
real(kind=kind_phys), save rslopesbmax
Definition: ERF_module_mp_wdm6.F90:100
real(kind=kind_phys), save pidn0g
Definition: ERF_module_mp_wdm6.F90:100
real(kind=kind_phys), save rslopegbmax
Definition: ERF_module_mp_wdm6.F90:100
real(kind=kind_phys), save rslopes2max
Definition: ERF_module_mp_wdm6.F90:100

Referenced by WSM6::AdvanceColumns().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ wsm6_nislfv_rain_plm_scratch()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void wsm6_nislfv_rain_plm_scratch ( int  km,
int  ww_comp,
int  rq_comp,
Real *  precip,
Real  dt,
int  iter,
Array4< Real > const &  sed_cell,
Array4< Real > const &  sed_node,
int  i_s,
int  j_s,
int  klo_s 
)
234 {
235  auto DZ = [&](int k) -> amrex::Real& {
236  return sed_cell(i_s, j_s, klo_s + k, WSM6SedCellScratch::dz);
237  };
238  auto WW = [&](int k) -> amrex::Real& {
239  return sed_cell(i_s, j_s, klo_s + k, WSM6SedCellScratch::ww);
240  };
241  auto QQ = [&](int k) -> amrex::Real& {
242  return sed_cell(i_s, j_s, klo_s + k, WSM6SedCellScratch::qq);
243  };
244  auto WD = [&](int k) -> amrex::Real& {
245  return sed_cell(i_s, j_s, klo_s + k, WSM6SedCellScratch::wd);
246  };
247  auto WA = [&](int k) -> amrex::Real& {
248  return sed_cell(i_s, j_s, klo_s + k, WSM6SedCellScratch::wa);
249  };
250  auto WAS = [&](int k) -> amrex::Real& {
251  return sed_cell(i_s, j_s, klo_s + k, WSM6SedCellScratch::was);
252  };
253  auto DEN = [&](int k) -> amrex::Real& {
254  return sed_cell(i_s, j_s, klo_s + k, WSM6SedCellScratch::den);
255  };
256  auto DENFAC = [&](int k) -> amrex::Real& {
257  return sed_cell(i_s, j_s, klo_s + k, WSM6SedCellScratch::denfac);
258  };
259  auto QN = [&](int k) -> amrex::Real& {
260  return sed_cell(i_s, j_s, klo_s + k, WSM6SedCellScratch::qn);
261  };
262  auto QR = [&](int k) -> amrex::Real& {
263  return sed_cell(i_s, j_s, klo_s + k, WSM6SedCellScratch::qr);
264  };
265  auto TMP = [&](int k) -> amrex::Real& {
266  return sed_cell(i_s, j_s, klo_s + k, WSM6SedCellScratch::tmp);
267  };
268  auto TMP1 = [&](int k) -> amrex::Real& {
269  return sed_cell(i_s, j_s, klo_s + k, WSM6SedCellScratch::tmp1);
270  };
271  auto TMP2 = [&](int k) -> amrex::Real& {
272  return sed_cell(i_s, j_s, klo_s + k, WSM6SedCellScratch::tmp2);
273  };
274  auto TMP3 = [&](int k) -> amrex::Real& {
275  return sed_cell(i_s, j_s, klo_s + k, WSM6SedCellScratch::tmp3);
276  };
277 
278  auto WI = [&](int k) -> amrex::Real& {
279  return sed_node(i_s, j_s, klo_s + k, WSM6SedNodeScratch::wi);
280  };
281  auto ZI = [&](int k) -> amrex::Real& {
282  return sed_node(i_s, j_s, klo_s + k, WSM6SedNodeScratch::zi);
283  };
284  auto ZA = [&](int k) -> amrex::Real& {
285  return sed_node(i_s, j_s, klo_s + k, WSM6SedNodeScratch::za);
286  };
287  auto DZA = [&](int k) -> amrex::Real& {
288  return sed_node(i_s, j_s, klo_s + k, WSM6SedNodeScratch::dza);
289  };
290  auto QA = [&](int k) -> amrex::Real& {
291  return sed_node(i_s, j_s, klo_s + k, WSM6SedNodeScratch::qa);
292  };
293  auto QMI = [&](int k) -> amrex::Real& {
294  return sed_node(i_s, j_s, klo_s + k, WSM6SedNodeScratch::qmi);
295  };
296  auto QPI = [&](int k) -> amrex::Real& {
297  return sed_node(i_s, j_s, klo_s + k, WSM6SedNodeScratch::qpi);
298  };
299 
300  constexpr Real pi = Real(3.141592653589793238462643383279502884);
301  auto rgmma = [](Real x) -> Real {
302  if (x == Real(1.0)) return Real(0.0);
303  constexpr Real euler = Real(0.577215664901532);
304  Real rg = x * std::exp(euler * x);
305  for (int ii = 1; ii <= 10000; ++ii) {
306  const Real y = static_cast<Real>(ii);
307  rg = rg * (Real(1.0) + x / y) * std::exp(-x / y);
308  }
309  return Real(1.0) / rg;
310  };
311 
312  const Real pidn0r = pi * Real(rhoh2o) * WSM6::n0r;
313  const Real rslopermax = Real(1.0) / WSM6::lamdarmax;
314  const Real rsloperbmax = std::pow(rslopermax, WSM6::bvtr);
317  const Real pvtr = WSM6::avtr * rgmma(Real(4.0) + WSM6::bvtr) / Real(6.0);
318 
319  Real allold = Real(0.0);
320  for (int k = 0; k < km; ++k) {
321  QQ(k) = sed_cell(i_s, j_s, klo_s + k, rq_comp);
322  WW(k) = sed_cell(i_s, j_s, klo_s + k, ww_comp);
323  WD(k) = WW(k);
324  allold += QQ(k);
325  }
326 
327  precip[0] = Real(0.0);
328  if (allold <= Real(0.0)) {
329  return;
330  }
331 
332  ZI(0) = Real(0.0);
333  for (int k = 0; k < km; ++k) {
334  ZI(k + 1) = ZI(k) + DZ(k);
335  }
336 
337  auto update_wind_and_state = [&](void) {
338  WI(0) = WW(0);
339  WI(km) = WW(km - 1);
340  for (int k = 1; k < km; ++k) {
341  WI(k) = (WW(k) * DZ(k - 1) + WW(k - 1) * DZ(k)) / (DZ(k - 1) + DZ(k));
342  }
343 
344  WI(0) = WW(0);
345  WI(1) = Real(0.5) * (WW(1) + WW(0));
346  for (int k = 2; k < km - 1; ++k) {
347  WI(k) = Real(9.0) / Real(16.0) * (WW(k) + WW(k - 1))
348  - Real(1.0) / Real(16.0) * (WW(k + 1) + WW(k - 2));
349  }
350  if (km > 1) {
351  WI(km - 1) = Real(0.5) * (WW(km - 1) + WW(km - 2));
352  WI(km) = WW(km - 1);
353  }
354 
355  for (int k = 1; k < km; ++k) {
356  if (WW(k) == Real(0.0)) WI(k) = WW(k - 1);
357  }
358 
359  const Real con1 = Real(0.05);
360  for (int k = km - 1; k >= 0; --k) {
361  const Real decfl = (WI(k + 1) - WI(k)) * dt / DZ(k);
362  if (decfl > con1) {
363  WI(k) = WI(k + 1) - con1 * DZ(k) / dt;
364  }
365  }
366 
367  for (int k = 0; k <= km; ++k) {
368  ZA(k) = ZI(k) - WI(k) * dt;
369  }
370 
371  for (int k = 0; k < km; ++k) {
372  DZA(k) = ZA(k + 1) - ZA(k);
373  if (DZA(k) <= Real(0.0)) DZA(k) = DZ(k);
374  }
375  DZA(km) = ZI(km) - ZA(km);
376  if (DZA(km) <= Real(0.0)) DZA(km) = DZ(km > 0 ? km - 1 : 0);
377  for (int k = 0; k < km; ++k) {
378  QA(k) = QQ(k) * DZ(k) / DZA(k);
379  QR(k) = QA(k) / DEN(k);
380  }
381  QA(km) = Real(0.0);
382  };
383 
384  update_wind_and_state();
385 
386  if (iter > 0) {
387  for (int k = 0; k < km; ++k) {
388  wsm6_slope_rain_cell(QR(k), DEN(k), DENFAC(k), pidn0r,
389  WSM6::qcrmin,
392  TMP(k), TMP1(k), TMP2(k), TMP3(k), WA(k));
393  }
394  for (int k = 0; k < km; ++k) {
395  WW(k) = Real(0.5) * (WD(k) + WA(k));
396  WAS(k) = WA(k);
397  }
398  update_wind_and_state();
399  }
400 
401  for (int k = 1; k < km; ++k) {
402  const Real dip = (QA(k + 1) - QA(k)) / (DZA(k + 1) + DZA(k));
403  const Real dim = (QA(k) - QA(k - 1)) / (DZA(k - 1) + DZA(k));
404  if (dip * dim <= Real(0.0)) {
405  QMI(k) = QA(k);
406  QPI(k) = QA(k);
407  } else {
408  QPI(k) = QA(k) + Real(0.5) * (dip + dim) * DZA(k);
409  QMI(k) = Real(2.0) * QA(k) - QPI(k);
410  if (QPI(k) < Real(0.0) || QMI(k) < Real(0.0)) {
411  QPI(k) = QA(k);
412  QMI(k) = QA(k);
413  }
414  }
415  }
416  QPI(0) = QA(0);
417  QMI(0) = QA(0);
418  QMI(km) = QA(km);
419  QPI(km) = QA(km);
420 
421  for (int k = 0; k < km; ++k) {
422  QN(k) = Real(0.0);
423  }
424 
425  int kb = 0;
426  int kt = 0;
427  for (int k = 0; k < km; ++k) {
428  kb = amrex::max(kb - 1, 0);
429  kt = amrex::max(kt - 1, 0);
430 
431  if (ZI(k) >= ZA(km)) {
432  break;
433  }
434 
435  for (int kk = kb; kk < km; ++kk) {
436  if (ZI(k) <= ZA(kk + 1)) {
437  kb = kk;
438  break;
439  }
440  }
441 
442  // Unlike the WRF original, also try the departure point of the column top, and when
443  // the cell top lies above even that, take the rest from the empty region above it
444  // (QA(km) = 0). Otherwise the search fails for the top cells of the column, which
445  // then come out empty and lose what they held: harmless at the model top, where
446  // there is nothing, but not at the top of a refined patch.
447  bool kt_found = false;
448  for (int kk = kt; kk <= km; ++kk) {
449  if (ZI(k + 1) <= ZA(kk)) {
450  kt = kk;
451  kt_found = true;
452  break;
453  }
454  }
455  if (!kt_found) { kt = km + 1; }
456  kt = amrex::max(kt - 1, 0);
457 
458  if (kt == kb) {
459  const Real tl = (ZI(k) - ZA(kb)) / DZA(kb);
460  const Real th = (ZI(k + 1) - ZA(kb)) / DZA(kb);
461  const Real tl2 = tl * tl;
462  const Real th2 = th * th;
463  const Real qqd = Real(0.5) * (QPI(kb) - QMI(kb));
464  const Real qqh = qqd * th2 + QMI(kb) * th;
465  const Real qql = qqd * tl2 + QMI(kb) * tl;
466  QN(k) = (qqh - qql) / (th - tl);
467  } else if (kt > kb) {
468  const Real tl = (ZI(k) - ZA(kb)) / DZA(kb);
469  const Real tl2 = tl * tl;
470  const Real qqd = Real(0.5) * (QPI(kb) - QMI(kb));
471  const Real qql = qqd * tl2 + QMI(kb) * tl;
472  const Real dql = QA(kb) - qql;
473  Real zsum = (Real(1.0) - tl) * DZA(kb);
474  Real qsum = dql * DZA(kb);
475  if (kt - kb > 1) {
476  for (int m = kb + 1; m < kt; ++m) {
477  zsum += DZA(m);
478  qsum += QA(m) * DZA(m);
479  }
480  }
481  const Real th = (ZI(k + 1) - ZA(kt)) / DZA(kt);
482  const Real th2 = th * th;
483  const Real dqh = Real(0.5) * (QPI(kt) - QMI(kt)) * th2 + QMI(kt) * th;
484  zsum += th * DZA(kt);
485  qsum += dqh * DZA(kt);
486  QN(k) = qsum / zsum;
487  }
488  }
489 
490  for (int k = 0; k < km; ++k) {
491  if (ZA(k) < Real(0.0) && ZA(k + 1) < Real(0.0)) {
492  precip[0] += QA(k) * DZA(k);
493  } else if (ZA(k) < Real(0.0) && ZA(k + 1) >= Real(0.0)) {
494  precip[0] += QA(k) * (Real(0.0) - ZA(k));
495  break;
496  } else {
497  break;
498  }
499  }
500 
501  for (int k = 0; k < km; ++k) {
502  sed_cell(i_s, j_s, klo_s + k, rq_comp) = QN(k);
503  sed_cell(i_s, j_s, klo_s + k, ww_comp) = WW(k);
504  }
505 }
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void wsm6_slope_rain_cell(Real qr, Real den, Real denfac, Real pidn0r_arg, Real qcrmin_arg, Real rslopermax_arg, Real rsloperbmax_arg, Real rsloper2max_arg, Real rsloper3max_arg, Real bvtr_arg, Real pvtr_arg, Real &rslope, Real &rslopeb, Real &rslope2, Real &rslope3, Real &vt)
Definition: ERF_AdvanceWSM6.cpp:147
constexpr amrex::Real rhoh2o
Definition: ERF_MicrophysicsConstants.H:42
static constexpr amrex::Real avtr
Definition: ERF_WSM6.H:147
static constexpr amrex::Real n0r
Definition: ERF_WSM6.H:146
static constexpr amrex::Real lamdarmax
Definition: ERF_WSM6.H:155
static constexpr amrex::Real bvtr
Definition: ERF_WSM6.H:148
real(kind=kind_phys), save pvtr
Definition: ERF_module_mp_wdm6.F90:100
real(kind=kind_phys), save rsloper2max
Definition: ERF_module_mp_wdm6.F90:100
real(kind=kind_phys), save rsloperbmax
Definition: ERF_module_mp_wdm6.F90:100
real(kind=kind_phys), save rsloper3max
Definition: ERF_module_mp_wdm6.F90:100
real(kind=kind_phys), save rslopermax
Definition: ERF_module_mp_wdm6.F90:100
real(kind=kind_phys), save pidn0r
Definition: ERF_module_mp_wdm6.F90:100

Referenced by WSM6::AdvanceColumns().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ wsm6_slope_graup_cell()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void wsm6_slope_graup_cell ( Real  qg,
Real  den,
Real  denfac,
Real  pidn0g_arg,
Real  qcrmin_arg,
Real  rslopegmax_arg,
Real  rslopegbmax_arg,
Real  rslopeg2max_arg,
Real  rslopeg3max_arg,
Real  bvtg_arg,
Real  pvtg_arg,
Real &  rslope,
Real &  rslopeb,
Real &  rslope2,
Real &  rslope3,
Real &  vt 
)
209 {
210  if (qg <= qcrmin_arg) {
211  rslope = rslopegmax_arg;
212  rslopeb = rslopegbmax_arg;
213  rslope2 = rslopeg2max_arg;
214  rslope3 = rslopeg3max_arg;
215  } else {
216  rslope = Real(1.0)/wsm6_lamdag(qg,den,pidn0g_arg);
217  rslopeb = std::pow(rslope,bvtg_arg);
218  rslope2 = rslope*rslope;
219  rslope3 = rslope2*rslope;
220  }
221  vt = pvtg_arg*rslopeb*denfac;
222  if (qg <= Real(0.0)) vt = Real(0.0);
223 }
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real wsm6_lamdag(Real x, Real y, Real pidn0g_arg)
Definition: ERF_AdvanceWSM6.cpp:89
@ qg
Definition: ERF_Morrison.H:114

Referenced by WSM6::AdvanceColumns(), and wsm6_nislfv_rain_plm6_scratch().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ wsm6_slope_rain_cell()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void wsm6_slope_rain_cell ( Real  qr,
Real  den,
Real  denfac,
Real  pidn0r_arg,
Real  qcrmin_arg,
Real  rslopermax_arg,
Real  rsloperbmax_arg,
Real  rsloper2max_arg,
Real  rsloper3max_arg,
Real  bvtr_arg,
Real  pvtr_arg,
Real &  rslope,
Real &  rslopeb,
Real &  rslope2,
Real &  rslope3,
Real &  vt 
)
155 {
156  if (qr <= qcrmin_arg) {
157  rslope = rslopermax_arg;
158  rslopeb = rsloperbmax_arg;
159  rslope2 = rsloper2max_arg;
160  rslope3 = rsloper3max_arg;
161  } else {
162  rslope = Real(1.0)/wsm6_lamdar(qr,den,pidn0r_arg);
163  rslopeb = std::pow(rslope,bvtr_arg);
164  rslope2 = rslope*rslope;
165  rslope3 = rslope2*rslope;
166  }
167  vt = pvtr_arg*rslopeb*denfac;
168  if (qr <= Real(0.0)) vt = Real(0.0);
169 }
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real wsm6_lamdar(Real x, Real y, Real pidn0r_arg)
Definition: ERF_AdvanceWSM6.cpp:79

Referenced by WSM6::AdvanceColumns(), and wsm6_nislfv_rain_plm_scratch().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ wsm6_slope_snow_cell()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void wsm6_slope_snow_cell ( Real  qs,
Real  den,
Real  denfac,
Real  t,
Real  pidn0s_arg,
Real  alpha_arg,
Real  n0smax_arg,
Real  n0s_arg,
Real  t0c_arg,
Real  qcrmin_arg,
Real  rslopesmax_arg,
Real  rslopesbmax_arg,
Real  rslopes2max_arg,
Real  rslopes3max_arg,
Real  bvts_arg,
Real  pvts_arg,
Real &  rslope,
Real &  rslopeb,
Real &  rslope2,
Real &  rslope3,
Real &  vt,
Real &  n0sfac 
)
182 {
183  Real supcol = t0c_arg - t;
184  n0sfac = amrex::max(amrex::min(std::exp(alpha_arg*supcol),
185  n0smax_arg/n0s_arg), Real(1.0));
186  if (qs <= qcrmin_arg) {
187  rslope = rslopesmax_arg;
188  rslopeb = rslopesbmax_arg;
189  rslope2 = rslopes2max_arg;
190  rslope3 = rslopes3max_arg;
191  } else {
192  rslope = Real(1.0)/wsm6_lamdas(qs,den,n0sfac,pidn0s_arg);
193  rslopeb = std::pow(rslope,bvts_arg);
194  rslope2 = rslope*rslope;
195  rslope3 = rslope2*rslope;
196  }
197  vt = pvts_arg*rslopeb*denfac;
198  if (qs <= Real(0.0)) vt = Real(0.0);
199 }
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real wsm6_lamdas(Real x, Real y, Real z, Real pidn0s_arg)
Definition: ERF_AdvanceWSM6.cpp:84
@ qs
Definition: ERF_Morrison.H:113
@ n0sfac
Definition: ERF_WSM6.H:354
@ t
Definition: ERF_WSM6.H:293

Referenced by WSM6::AdvanceColumns(), and wsm6_nislfv_rain_plm6_scratch().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ wsm6_venfac()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real wsm6_venfac ( Real  a,
Real  b,
Real  c,
Real  den0_arg 
)
58  {
59  return std::exp(std::log(wsm6_viscos(b,c)/wsm6_diffus(b,a))
60  *Real(0.3333333))
61  /std::sqrt(wsm6_viscos(b,c))
62  *std::sqrt(std::sqrt(den0_arg/c));
63 }
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real wsm6_viscos(Real x, Real y)
Definition: ERF_AdvanceWSM6.cpp:41

Referenced by WSM6::AdvanceColumns().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ wsm6_viscos()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real wsm6_viscos ( Real  x,
Real  y 
)
41  {
42  return Real(1.496e-6)*(x*std::sqrt(x))/(x+Real(120.0))/y;
43 }

Referenced by wsm6_venfac(), and wsm6_xka().

Here is the caller graph for this function:

◆ wsm6_xka()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real wsm6_xka ( Real  x,
Real  y 
)
46  {
47  return Real(1.414e3)*wsm6_viscos(x,y)*y;
48 }

Referenced by WSM6::AdvanceColumns(), and wsm6_diffac().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ wsm6_xlcal()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real wsm6_xlcal ( Real  x,
Real  xlv0_arg,
Real  xlv1_arg,
Real  t0c_arg 
)
31  {
32  return xlv0_arg - xlv1_arg*(x - t0c_arg);
33 }

Referenced by WSM6::AdvanceColumns().

Here is the caller graph for this function: