1 #ifndef SUPERDROPLET_PC_MASSCHANGE_H_
2 #define SUPERDROPLET_PC_MASSCHANGE_H_
6 #include <AMReX_GpuPrint.H>
7 #include <AMReX_Math.H>
11 #ifdef ERF_USE_PARTICLES
15 namespace SDMassChangeUtils_LV
18 template <
typename RT >
19 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
20 RT ventilationFactor (
const RT a_R,
25 const RT a_fcap ) noexcept
27 RT x1 = a_alpha1 * std::pow(a_R, a_beta1);
28 RT x2 = a_alpha2 * std::pow(a_R, a_beta2);
29 RT fv = RT(1.0) + (x1*x2) / (x1 + x2);
30 return std::min(fv, a_fcap);
33 #ifdef ERF_USE_ML_UPHYS_DIAGNOSTICS
35 template <
typename RT >
44 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
45 RT operator () (
const RT a_R,
53 const RT a_f_v )
const noexcept
55 RT lambda_v = 2*a_D/std::sqrt(8*a_T*Rv/
PI);
57 RT dcf = (1+Kn) / (1+2*Kn*(1+Kn));
59 RT F_k = ( L/(Rv*a_T) - RT(1.0)) * ((L*rho_l) / (K*a_T));
60 RT F_d = (rho_l*Rv*a_T) / (dcf*a_D*a_e_s);
62 RT R_inv = RT(1.0)/a_R;
63 RT R_inv_cubed = R_inv*R_inv*R_inv;
65 RT
alpha = (a_S-RT(1.0)) / (F_k + F_d);
66 RT retval =
alpha*R_inv;
68 RT
beta = -(a_a/a_T) / (F_k + F_d);
69 retval +=
beta*R_inv*R_inv;
71 RT
gamma = a_b * a_N_s / (F_k + F_d);
72 retval +=
gamma*R_inv_cubed*R_inv;
74 return a_f_v * retval;
81 template <
typename RT >
90 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
91 RT rhs_func (
const RT a_R_sq,
99 const RT a_f_v )
const noexcept
101 RT lambda_v = 2*a_D/std::sqrt(8*a_T*Rv/
PI);
102 RT Kn = lambda_v/std::sqrt(a_R_sq);
103 RT dcf = (1+Kn) / (1+2*Kn*(1+Kn));
105 RT F_k = ( L/(Rv*a_T) - RT(1.0)) * ((L*rho_l) / (K*a_T));
106 RT F_d = (rho_l*Rv*a_T) / (dcf*a_D*a_e_s);
108 RT R_inv = RT(1.0)/std::sqrt(a_R_sq);
109 RT R_inv_cubed = R_inv*R_inv*R_inv;
111 RT
alpha = RT(2.0) * (a_S-RT(1.0)) / (F_k + F_d);
114 RT
beta = -RT(2.0) * (a_a/a_T) / (F_k + F_d);
115 retval +=
beta*R_inv;
117 RT
gamma = RT(2.0) * a_b * a_N_s / (F_k + F_d);
118 retval +=
gamma*R_inv_cubed;
120 return a_f_v * retval;
124 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
125 RT rhs_jac (
const RT a_R_sq,
132 const RT a_f_v )
const noexcept
134 RT lambda_v = 2*a_D/std::sqrt(8*a_T*Rv/
PI);
135 RT Kn = lambda_v/std::sqrt(a_R_sq);
136 RT dcf = (1+Kn) / (1+2*Kn*(1+Kn));
138 RT F_k = ( L/(Rv*a_T) - RT(1.0)) * ((L*rho_l) / (K*a_T));
139 RT F_d = (rho_l*Rv*a_T) / (dcf*a_D*a_e_s);
141 RT R_inv = RT(1.0)/std::sqrt(a_R_sq);
142 RT R_inv_3 = R_inv*R_inv*R_inv;
143 RT R_inv_5 = R_inv_3*R_inv*R_inv;
147 RT
beta = -RT(2.0) * (a_a/a_T) / (F_k + F_d);
150 RT
gamma = RT(2.0) * a_b * a_N_s / (F_k + F_d);
153 return a_f_v * retval;
168 template<
typename NE ,
typename RT >
179 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
180 void operator() ( RT& a_u,
197 RT res_norm0 = RT(0.0);
199 for (
int k = 0; k < m_maxits; k++) {
200 RT residual = a_mu * a_u
202 + m_ne.rhs_func( a_u, a_S, a_T, a_e_s, a_D, a_a, a_b, a_N_s, a_f_v ) );
203 a_res_norm_a = std::sqrt(residual*residual);
206 if (a_res_norm_a > 0) {
207 res_norm0 = a_res_norm_a;
212 a_res_norm_r = a_res_norm_a / res_norm0;
214 if (a_res_norm_a <= m_atol) {
218 if (a_res_norm_r <= m_rtol) {
222 if (!amrex::Math::isfinite(a_res_norm_a)) {
227 RT slope = a_mu - m_ne.rhs_jac( a_u, a_T, a_e_s, a_D, a_a, a_b, a_N_s, a_f_v );
229 du = - residual / slope;
231 RT du_norm = std::sqrt(du*du);
232 RT u_norm = std::sqrt(a_u*a_u);
233 if (du_norm/u_norm <= m_stol) {
239 if (a_u <= RT(0.0)) {
248 template<
typename ODE ,
249 typename NewtonSolver ,
261 const NewtonSolver m_newton;
290 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
291 RT ventFactor (
const RT& a_u)
const
293 if (!m_ventilation) {
return RT(1.0); }
294 return ventilationFactor( std::sqrt(a_u),
295 m_vent_alpha1, m_vent_beta1,
296 m_vent_alpha2, m_vent_beta2,
301 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
302 RT computeTimestep (
const RT& a_u)
const
304 RT tau = m_ode.rhs_jac(a_u, m_T, m_e_s, m_D, m_a, m_b, m_N_s, ventFactor(a_u));
305 return m_cfl / std::sqrt(tau*tau);
309 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
310 RT computeTau (
const RT& a_u)
const
312 return m_ode.rhs_jac(a_u, m_T, m_e_s, m_D, m_a, m_b, m_N_s, ventFactor(a_u));
316 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
317 RT limitTimestep (RT dt, RT cur_time)
const
319 if ((cur_time + dt) > m_t_final) {
320 dt = m_t_final - cur_time;
326 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
327 bool isTimestepTooSmall (RT dt, RT tau)
const
329 return (dt < (RT(1.0e-12) * m_cfl / std::sqrt(tau*tau)))
330 && (dt < (RT(1.0e-12) * m_t_final));
334 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
335 RT evalRHS (
const RT& a_u)
const
337 return m_ode.rhs_func(a_u, m_S, m_T, m_e_s, m_D, m_a, m_b, m_N_s, ventFactor(a_u));
341 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
342 void printStepInfo (RT cur_time, RT dt, RT tau, RT radius, RT snorm)
const
345 AMREX_DEVICE_PRINTF(
"Time %1.2e, dt = %1.2e, cfl = %1.1e, radius = %1.4e, snorm = %1.1e\n",
346 cur_time, dt, dt * std::sqrt(tau*tau), radius, snorm);
351 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
352 void printStepInfoNewton (RT cur_time, RT dt, RT tau, RT radius, RT snorm,
353 RT res_norm_a, RT res_norm_r,
bool converged)
const
356 AMREX_DEVICE_PRINTF(
"Time %1.2e, dt = %1.2e, cfl = %1.1e, radius = %1.4e, snorm = %1.1e\n",
357 cur_time, dt, dt * std::sqrt(tau*tau), radius, snorm);
358 AMREX_DEVICE_PRINTF(
" norms = %1.3e (abs), %1.3e (rel), converged = %s\n",
359 res_norm_a, res_norm_r, (converged ?
"yes" :
"no"));
365 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
366 void rk3bs ( RT& a_u,
367 bool& a_success )
const
369 RT cur_time = RT(0.0);
372 RT tau = m_ode.rhs_jac(a_u, m_T, m_e_s, m_D, m_a, m_b, m_N_s, ventFactor(a_u));
373 RT dt = m_cfl / std::sqrt(tau*tau);
379 while ((cur_time < m_t_final) && (n_step < m_max_steps)) {
382 tau = m_ode.rhs_jac(a_u, m_T, m_e_s, m_D, m_a, m_b, m_N_s, ventFactor(a_u));
383 dt = m_cfl / std::sqrt(tau*tau);
388 if ((cur_time + dt) > m_t_final) {
389 dt = m_t_final - cur_time;
391 if (!amrex::Math::isfinite(dt)) {
397 bool step_success =
false;
398 while (!step_success) {
400 if ( (dt < (RT(1.0e-12)*m_cfl/std::sqrt(tau*tau)))
401 && (dt < (RT(1.0e-12)*m_t_final)) ) {
410 RT f1 = m_ode.rhs_func(u1, m_S, m_T, m_e_s, m_D, m_a, m_b, m_N_s, ventFactor(a_u));
412 RT u2 = a_u +
myhalf*dt*f1;
417 RT f2 = m_ode.rhs_func(u2, m_S, m_T, m_e_s, m_D, m_a, m_b, m_N_s, ventFactor(a_u));
419 RT u3 = a_u + RT(0.75)*dt*f2;
424 RT f3 = m_ode.rhs_func(u3, m_S, m_T, m_e_s, m_D, m_a, m_b, m_N_s, ventFactor(a_u));
426 RT u4 = a_u + (RT(1.0)/RT(9.0))*dt * (RT(2.0)*f1 +
three*f2 + RT(4.0)*f3);
431 RT f4 = m_ode.rhs_func(u4, m_S, m_T, m_e_s, m_D, m_a, m_b, m_N_s, ventFactor(a_u));
436 RT u_embed = a_u + (RT(1.0)/RT(24.0))*dt * (RT(7.0)*f1 + RT(6.0)*f2 + RT(8.0)*f3 +
three*f4);
437 RT err = std::sqrt((u_new-u_embed)*(u_new-u_embed));
438 RT tol = m_atol + m_rtol * std::max(a_u, a_u_old);
440 dt_new = dt / std::cbrt(E);
443 if (amrex::Math::isfinite(u_new)) {
454 RT snorm = std::sqrt((a_u-u_new)*(a_u-u_new)/(a_u*a_u));
460 AMREX_DEVICE_PRINTF(
"Time %1.2e, dt = %1.2e, cfl = %1.1e, radius = %1.4e, snorm = %1.1e\n",
461 cur_time, dt, dt * std::sqrt(tau*tau), std::sqrt(a_u), snorm);
463 if (snorm < m_stol) {
481 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
483 bool& a_success )
const
485 RT cur_time = RT(0.0);
489 while ((cur_time < m_t_final) && (n_step < m_max_steps)) {
491 RT tau = computeTau(a_u);
492 RT dt = m_cfl / std::sqrt(tau*tau);
493 dt = limitTimestep(dt, cur_time);
494 if (!amrex::Math::isfinite(dt)) {
500 bool step_success =
false;
501 while (!step_success) {
503 if (isTimestepTooSmall(dt, tau)) {
break; }
506 if (u1 <= 0) { dt *=
myhalf;
continue; }
509 RT u2 = a_u +
myhalf*dt*f1;
510 if (u2 <= 0) { dt *=
myhalf;
continue; }
513 RT u3 = a_u +
myhalf*dt*f2;
514 if (u3 <= 0) { dt *=
myhalf;
continue; }
518 if (u4 <= 0) { dt *=
myhalf;
continue; }
521 u_new = a_u + dt*(f1 + RT(2.0)*f2 + RT(2.0)*f3 + f4)/RT(6.0);
523 if (amrex::Math::isfinite(u_new) && (u_new > 0)) {
531 RT snorm = std::sqrt((a_u-u_new)*(a_u-u_new)/(a_u*a_u));
534 printStepInfo(cur_time, dt, tau, std::sqrt(a_u), snorm);
535 if (snorm < m_stol) {
break; }
548 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
550 bool& a_success )
const
552 RT cur_time = RT(0.0);
556 while ((cur_time < m_t_final) && (n_step < m_max_steps)) {
558 RT tau = computeTau(a_u);
559 RT dt = m_cfl / std::sqrt(tau*tau);
560 dt = limitTimestep(dt, cur_time);
561 if (!amrex::Math::isfinite(dt)) {
566 #ifdef AMREX_USE_FLOAT
567 RT res_norm_a = std::numeric_limits<float>::max();
568 RT res_norm_r = std::numeric_limits<float>::max();
570 RT res_norm_a = std::numeric_limits<double>::max();
571 RT res_norm_r = std::numeric_limits<double>::max();
573 bool converged =
false;
576 bool step_success =
false;
577 while (!step_success) {
579 if (isTimestepTooSmall(dt, tau)) {
break; }
581 RT
mu = RT(1.0) / dt;
584 m_newton(u_new, rhs,
mu,
585 m_S, m_T, m_e_s, m_D, m_a, m_b, m_N_s, ventFactor(a_u),
586 res_norm_a, res_norm_r, converged);
588 if (converged && amrex::Math::isfinite(u_new) && (u_new > 0)) {
596 RT snorm = std::sqrt((a_u-u_new)*(a_u-u_new)/(a_u*a_u));
599 printStepInfoNewton(cur_time, dt, tau, std::sqrt(a_u), snorm,
600 res_norm_a, res_norm_r, converged);
601 if (snorm < m_stol) {
break; }
614 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
616 bool& a_success )
const
618 RT cur_time = RT(0.0);
622 while ((cur_time < m_t_final) && (n_step < m_max_steps)) {
624 RT tau = computeTau(a_u);
625 RT dt = m_cfl / std::sqrt(tau*tau);
626 dt = limitTimestep(dt, cur_time);
627 if (!amrex::Math::isfinite(dt)) {
632 RT res_norm_a = std::numeric_limits<RT>::max();
633 RT res_norm_r = std::numeric_limits<RT>::max();
634 bool converged =
false;
637 bool step_success =
false;
638 while (!step_success) {
640 if (isTimestepTooSmall(dt, tau)) {
break; }
648 m_newton(u2, rhs,
mu,
649 m_S, m_T, m_e_s, m_D, m_a, m_b, m_N_s, ventFactor(a_u),
650 res_norm_a, res_norm_r, converged);
651 if (u2 <= 0) { dt *=
myhalf;
continue; }
654 u_new = a_u +
myhalf * dt * (f1 + f2);
656 if (converged && amrex::Math::isfinite(u_new) && (u_new > 0)) {
664 RT snorm = std::sqrt((a_u-u_new)*(a_u-u_new)/(a_u*a_u));
667 printStepInfoNewton(cur_time, dt, tau, std::sqrt(a_u), snorm,
668 res_norm_a, res_norm_r, converged);
669 if (snorm < m_stol) {
break; }
682 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
683 void dirk212 ( RT& a_u,
684 bool& a_success )
const
686 RT cur_time = RT(0.0);
690 while ((cur_time < m_t_final) && (n_step < m_max_steps)) {
692 RT tau = computeTau(a_u);
693 RT dt = m_cfl / std::sqrt(tau*tau);
694 dt = limitTimestep(dt, cur_time);
695 if (!amrex::Math::isfinite(dt)) {
700 bool converged =
false;
701 RT res_norm_a = std::numeric_limits<RT>::max();
702 RT res_norm_r = std::numeric_limits<RT>::max();
705 bool step_success =
false;
706 while (!step_success) {
708 if (isTimestepTooSmall(dt, tau)) {
711 RT
mu = RT(1.0) / dt;
714 res_norm_a = RT(0.0);
715 res_norm_r = RT(0.0);
720 RT res_norm_a_i = std::numeric_limits<RT>::max();
721 RT res_norm_r_i = std::numeric_limits<RT>::max();
722 bool converged_i =
false;
723 m_newton( u1, rhs,
mu,
724 m_S, m_T, m_e_s, m_D, m_a, m_b, m_N_s, ventFactor(a_u),
725 res_norm_a_i, res_norm_r_i, converged_i );
726 converged = converged && converged_i;
727 res_norm_a = std::max(res_norm_a, res_norm_a_i);
728 res_norm_r = std::max(res_norm_r, res_norm_r_i);
738 RT rhs =
mu * (a_u - dt*f1);
739 RT res_norm_a_i = std::numeric_limits<RT>::max();
740 RT res_norm_r_i = std::numeric_limits<RT>::max();
741 bool converged_i =
false;
742 m_newton( u2, rhs,
mu,
743 m_S, m_T, m_e_s, m_D, m_a, m_b, m_N_s, ventFactor(a_u),
744 res_norm_a_i, res_norm_r_i, converged_i );
745 converged = converged && converged_i;
746 res_norm_a = std::max(res_norm_a, res_norm_a_i);
747 res_norm_r = std::max(res_norm_r, res_norm_r_i);
755 u_new = a_u +
myhalf * dt * (f1 + f2);
758 if (amrex::Math::isfinite(u_new)) {
770 RT snorm = std::sqrt((a_u-u_new)*(a_u-u_new)/(a_u*a_u));
774 printStepInfoNewton(cur_time, dt, tau, std::sqrt(a_u), snorm,
775 res_norm_a, res_norm_r, converged);
776 if (snorm < m_stol) {
798 namespace SDMassChangeUtils_SV
801 template <
typename RT >
810 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
811 RT growthRatio (
const RT a_T )
const noexcept
842 auto T_degC = a_T - RT(273.15);
843 int n = std::min(std::max(
static_cast<int>(std::round(RT(1.375)-RT(4.0)*T_degC)),1),121);
844 return static_cast<RT
>(tb_habit[n-1]);
849 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
850 RT Fk_plus_Fd (
const RT a_T,
852 const RT a_D )
const noexcept
854 auto F_k = (L/(Rv*a_T) - RT(1.0)) * (L / (K*a_T));
855 auto F_d = (Rv*a_T) / (a_D*a_e_s);
860 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
861 RT viscCoeff (
const RT a_T )
const noexcept
863 auto T_degC = a_T - RT(273.15);
864 RT visc_coeff = RT(0.0);
865 if( T_degC >= RT(0.0) ) {
866 visc_coeff = ( RT(1.7180) + RT(4.9E-3)*T_degC ) * RT(1.E-5);
868 visc_coeff = ( RT(1.7180) + RT(4.9E-3)*T_degC -RT(1.2E-5)*T_degC*T_degC ) * RT(1.E-5);
874 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
875 RT capacitance(
const RT a_a,
876 const RT a_c )
const noexcept
878 auto phi = a_c / a_a;
880 if(phi >= RT(1.001)) {
881 auto ecent = std::sqrt(RT(1.0) - RT(1.0)/(phi*phi));
882 capaci = ecent*a_c / std::log((RT(1.0)+ecent)*phi);
883 }
else if (phi <= RT(0.999)) {
884 auto ecent = std::sqrt(RT(1.0) - phi*phi);
885 capaci = ecent*a_a / std::asin(ecent);
887 capaci = (RT(2.0)*a_a + a_c)/
three;
893 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
894 RT ventX (
const RT a_a,
899 const RT a_D )
const noexcept
901 auto visc_coeff = viscCoeff(a_T);
902 auto maxdim = RT(2.0) * std::max(a_a, a_c);
903 auto n_re = a_rhom * maxdim * a_vterm / visc_coeff;
904 auto n_sc = visc_coeff / (a_rhom*a_D);
905 auto X_vent = std::cbrt(n_sc) * std::sqrt(n_re);
910 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
911 RT growthRatioStar (
const RT a_dmass,
917 const RT a_D )
const noexcept
919 auto capaci = capacitance(a_a, a_c);
920 auto X_vent = ventX(a_a, a_c, a_vterm, a_T, a_rhom, a_D);
922 if(X_vent <= RT(1.0)) {
923 fratio = (RT(1.0) + RT(0.14)*X_vent*X_vent*std::sqrt(a_c/capaci))
924 / (RT(1.0) + RT(0.14)*X_vent*X_vent*std::sqrt(a_a/capaci));
926 fratio = (RT(0.86) + RT(0.28)*X_vent*std::sqrt(a_c/capaci))
927 / (RT(0.86) + RT(0.28)*X_vent*std::sqrt(a_a/capaci));
930 auto gr = growthRatio(a_T);
931 if ((RT(2.0)*std::max(a_a,a_c) < RT(1.0e-5)) || (a_dmass <= RT(0.0))) { gr = RT(1.0); }
932 auto gr_star = gr * fratio;
933 if((a_dmass > RT(0.0)) && (a_c/a_a > RT(40.0))) { gr_star = std::min(gr_star,RT(1.0)); }
939 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
940 RT dVolume (
const RT a_dmass,
947 const RT a_es_ratio_wi,
948 const RT a_D )
const noexcept
951 auto gr = growthRatio(a_T);
952 if (a_dmass > RT(0.0)) {
953 if ((gr < RT(1.0)) && (a_a < RT(1.0e-4))) {
956 if (RT(2.0)*std::max(a_a,a_c) < RT(1.0e-5)) { gr = RT(1.0); }
957 auto ex_vap_dens = RT(1000.0) * (std::min(a_S,a_es_ratio_wi) - RT(1.0)) / (Fk_plus_Fd(a_T,a_e_s,a_D) * a_D);
958 rho_i_ds = rho_ice * std::exp(-
three*std::max(ex_vap_dens-RT(0.05),RT(0.0))/gr);
962 auto dvol = a_dmass / rho_i_ds;
967 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
968 RT dLogRadius (
const RT a_grstar,
969 const RT a_dlogvol )
const noexcept
971 return a_dlogvol / (a_grstar+RT(2.0));
975 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
976 RT rhs_func (
const RT a_a,
983 const RT a_D )
const noexcept
985 auto capaci = capacitance(a_a, a_c);
986 auto X_vent = ventX(a_a, a_c, a_vterm, a_T, a_rhom, a_D);
989 if (X_vent <= RT(1.0)) { f_vent = RT(1.0) + RT(0.14)*X_vent*X_vent; }
990 else { f_vent = RT(0.86) + RT(0.28)*X_vent; }
992 auto retval = RT(4.0)*
PI * capaci * (a_S-RT(1.0)) * f_vent / Fk_plus_Fd(a_T, a_e_s, a_D);
1002 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
1003 RT meltRate (
const RT a_a,
1008 const RT a_e_sat_wT0,
1011 const RT a_L_f )
const noexcept
1013 auto capaci = capacitance(a_a, a_c);
1014 auto X_vent = ventX(a_a, a_c, a_vterm, a_T, a_rhom, a_D);
1016 RT f_vent = RT(0.0);
1017 if (X_vent <= RT(1.0)) { f_vent = RT(1.0) + RT(0.14)*X_vent*X_vent; }
1018 else { f_vent = RT(0.86) + RT(0.28)*X_vent; }
1021 RT heat = K * f_vent * (a_T - T0)
1022 + (L*a_D/Rv) * (a_e_inf/a_T - a_e_sat_wT0/T0) * f_vent;
1023 return -(RT(4.0)*
PI*capaci/a_L_f) * heat;
1029 template<
typename ODE ,
1051 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
1053 bool& a_success )
const
1055 RT cur_time = RT(0.0);
1059 while ((cur_time < m_t_final) && (n_step < m_max_steps)) {
1061 if ((cur_time + m_dt) > m_t_final) {
1062 m_dt = m_t_final - cur_time;
1065 RT rhs = m_ode.rhs_func(m_a, m_c, m_vt, m_S, m_rhom, m_T, m_e_s, m_D);
1066 RT u_new = a_u + m_dt*rhs;
1067 if (!amrex::Math::isfinite(u_new)) {
1072 RT snorm = std::sqrt((a_u-u_new)*(a_u-u_new)/(a_u*a_u));
1077 AMREX_DEVICE_PRINTF(
"Time %1.2e, m_dt = %1.2e, mass = %1.4e, snorm = %1.1e\n",
1078 cur_time, m_dt, a_u, snorm);
amrex::Real gamma
Definition: ERF_InitCustomPert_DataAssimilation_ISV.H:9
amrex::Real beta
Definition: ERF_InitCustomPert_DataAssimilation_ISV.H:10
Physical constants and tuning parameters used only by the moisture and cloud-physics code.
constexpr amrex::Real tmelt
Definition: ERF_MicrophysicsConstants.H:122
Dimensionless numeric literals and pure mathematical constants.
constexpr amrex::Real three
Definition: ERF_NumericalConstants.H:32
constexpr amrex::Real myhalf
Definition: ERF_NumericalConstants.H:34
constexpr amrex::Real PI
Definition: ERF_NumericalConstants.H:39
amrex::Real Real
Definition: ERF_ShocInterface.H:19
@ mu
Definition: ERF_AdvanceMorrison.cpp:92
real(kind=kind_phys), parameter, private alpha
Definition: ERF_module_mp_wdm6.F90:62