1 #ifndef SUPERDROPLET_PC_MASSCHANGE_H_
2 #define SUPERDROPLET_PC_MASSCHANGE_H_
5 #include <AMReX_GpuPrint.H>
8 #ifdef ERF_USE_PARTICLES
12 namespace SDMassChangeUtils_LV
15 template <
typename RT >
16 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
17 RT ventilationFactor (
const RT a_R,
22 const RT a_fcap ) noexcept
24 RT x1 = a_alpha1 * std::pow(a_R, a_beta1);
25 RT x2 = a_alpha2 * std::pow(a_R, a_beta2);
26 RT fv = RT(1.0) + (x1*x2) / (x1 + x2);
27 return std::min(fv, a_fcap);
30 #ifdef ERF_USE_ML_UPHYS_DIAGNOSTICS
32 template <
typename RT >
41 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
42 RT operator () (
const RT a_R,
50 const RT a_f_v )
const noexcept
52 RT lambda_v = 2*a_D/std::sqrt(8*a_T*Rv/
PI);
54 RT dcf = (1+Kn) / (1+2*Kn*(1+Kn));
56 RT F_k = ( L/(Rv*a_T) - RT(1.0)) * ((L*rho_l) / (K*a_T));
57 RT F_d = (rho_l*Rv*a_T) / (dcf*a_D*a_e_s);
59 RT R_inv = RT(1.0)/a_R;
60 RT R_inv_cubed = R_inv*R_inv*R_inv;
62 RT
alpha = (a_S-RT(1.0)) / (F_k + F_d);
63 RT retval =
alpha*R_inv;
65 RT
beta = -(a_a/a_T) / (F_k + F_d);
66 retval +=
beta*R_inv*R_inv;
68 RT
gamma = a_b * a_N_s / (F_k + F_d);
69 retval +=
gamma*R_inv_cubed*R_inv;
71 return a_f_v * retval;
78 template <
typename RT >
87 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
88 RT rhs_func (
const RT a_R_sq,
96 const RT a_f_v )
const noexcept
98 RT lambda_v = 2*a_D/std::sqrt(8*a_T*Rv/
PI);
99 RT Kn = lambda_v/std::sqrt(a_R_sq);
100 RT dcf = (1+Kn) / (1+2*Kn*(1+Kn));
102 RT F_k = ( L/(Rv*a_T) - RT(1.0)) * ((L*rho_l) / (K*a_T));
103 RT F_d = (rho_l*Rv*a_T) / (dcf*a_D*a_e_s);
105 RT R_inv = RT(1.0)/std::sqrt(a_R_sq);
106 RT R_inv_cubed = R_inv*R_inv*R_inv;
108 RT
alpha = RT(2.0) * (a_S-RT(1.0)) / (F_k + F_d);
111 RT
beta = -RT(2.0) * (a_a/a_T) / (F_k + F_d);
112 retval +=
beta*R_inv;
114 RT
gamma = RT(2.0) * a_b * a_N_s / (F_k + F_d);
115 retval +=
gamma*R_inv_cubed;
117 return a_f_v * retval;
121 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
122 RT rhs_jac (
const RT a_R_sq,
129 const RT a_f_v )
const noexcept
131 RT lambda_v = 2*a_D/std::sqrt(8*a_T*Rv/
PI);
132 RT Kn = lambda_v/std::sqrt(a_R_sq);
133 RT dcf = (1+Kn) / (1+2*Kn*(1+Kn));
135 RT F_k = ( L/(Rv*a_T) - RT(1.0)) * ((L*rho_l) / (K*a_T));
136 RT F_d = (rho_l*Rv*a_T) / (dcf*a_D*a_e_s);
138 RT R_inv = RT(1.0)/std::sqrt(a_R_sq);
139 RT R_inv_3 = R_inv*R_inv*R_inv;
140 RT R_inv_5 = R_inv_3*R_inv*R_inv;
144 RT
beta = -RT(2.0) * (a_a/a_T) / (F_k + F_d);
147 RT
gamma = RT(2.0) * a_b * a_N_s / (F_k + F_d);
150 return a_f_v * retval;
165 template<
typename NE ,
typename RT >
176 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
177 void operator() ( RT& a_u,
194 RT res_norm0 = RT(0.0);
196 for (
int k = 0; k < m_maxits; k++) {
197 RT residual = a_mu * a_u
199 + 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 ) );
200 a_res_norm_a = std::sqrt(residual*residual);
203 if (a_res_norm_a > 0) {
204 res_norm0 = a_res_norm_a;
209 a_res_norm_r = a_res_norm_a / res_norm0;
211 if (a_res_norm_a <= m_atol) {
215 if (a_res_norm_r <= m_rtol) {
219 if (!std::isfinite(a_res_norm_a)) {
224 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 );
226 du = - residual / slope;
228 RT du_norm = std::sqrt(du*du);
229 RT u_norm = std::sqrt(a_u*a_u);
230 if (du_norm/u_norm <= m_stol) {
236 if (a_u <= RT(0.0)) {
245 template<
typename ODE ,
246 typename NewtonSolver ,
258 const NewtonSolver m_newton;
287 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
288 RT ventFactor (
const RT& a_u)
const
290 if (!m_ventilation) {
return RT(1.0); }
291 return ventilationFactor( std::sqrt(a_u),
292 m_vent_alpha1, m_vent_beta1,
293 m_vent_alpha2, m_vent_beta2,
298 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
299 RT computeTimestep (
const RT& a_u)
const
301 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));
302 return m_cfl / std::sqrt(tau*tau);
306 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
307 RT computeTau (
const RT& a_u)
const
309 return m_ode.rhs_jac(a_u, m_T, m_e_s, m_D, m_a, m_b, m_N_s, ventFactor(a_u));
313 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
314 RT limitTimestep (RT dt, RT cur_time)
const
316 if ((cur_time + dt) > m_t_final) {
317 dt = m_t_final - cur_time;
323 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
324 bool isTimestepTooSmall (RT dt, RT tau)
const
326 return (dt < (RT(1.0e-12) * m_cfl / std::sqrt(tau*tau)))
327 && (dt < (RT(1.0e-12) * m_t_final));
331 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
332 RT evalRHS (
const RT& a_u)
const
334 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));
338 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
339 void printStepInfo (RT cur_time, RT dt, RT tau, RT radius, RT snorm)
const
342 AMREX_DEVICE_PRINTF(
"Time %1.2e, dt = %1.2e, cfl = %1.1e, radius = %1.4e, snorm = %1.1e\n",
343 cur_time, dt, dt * std::sqrt(tau*tau), radius, snorm);
348 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
349 void printStepInfoNewton (RT cur_time, RT dt, RT tau, RT radius, RT snorm,
350 RT res_norm_a, RT res_norm_r,
bool converged)
const
353 AMREX_DEVICE_PRINTF(
"Time %1.2e, dt = %1.2e, cfl = %1.1e, radius = %1.4e, snorm = %1.1e\n",
354 cur_time, dt, dt * std::sqrt(tau*tau), radius, snorm);
355 AMREX_DEVICE_PRINTF(
" norms = %1.3e (abs), %1.3e (rel), converged = %s\n",
356 res_norm_a, res_norm_r, (converged ?
"yes" :
"no"));
362 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
363 void rk3bs ( RT& a_u,
364 bool& a_success )
const
366 RT cur_time = RT(0.0);
369 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));
370 RT dt = m_cfl / std::sqrt(tau*tau);
376 while ((cur_time < m_t_final) && (n_step < m_max_steps)) {
379 tau = m_ode.rhs_jac(a_u, m_T, m_e_s, m_D, m_a, m_b, m_N_s, ventFactor(a_u));
380 dt = m_cfl / std::sqrt(tau*tau);
385 if ((cur_time + dt) > m_t_final) {
386 dt = m_t_final - cur_time;
388 if (!std::isfinite(dt)) {
394 bool step_success =
false;
395 while (!step_success) {
397 if ( (dt < (RT(1.0e-12)*m_cfl/std::sqrt(tau*tau)))
398 && (dt < (RT(1.0e-12)*m_t_final)) ) {
407 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));
409 RT u2 = a_u +
myhalf*dt*f1;
414 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));
416 RT u3 = a_u + RT(0.75)*dt*f2;
421 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));
423 RT u4 = a_u + (RT(1.0)/RT(9.0))*dt * (RT(2.0)*f1 +
three*f2 + RT(4.0)*f3);
428 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));
433 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);
434 RT err = std::sqrt((u_new-u_embed)*(u_new-u_embed));
435 RT tol = m_atol + m_rtol * std::max(a_u, a_u_old);
437 dt_new = dt / std::cbrt(E);
440 if (std::isfinite(u_new)) {
451 RT snorm = std::sqrt((a_u-u_new)*(a_u-u_new)/(a_u*a_u));
457 AMREX_DEVICE_PRINTF(
"Time %1.2e, dt = %1.2e, cfl = %1.1e, radius = %1.4e, snorm = %1.1e\n",
458 cur_time, dt, dt * std::sqrt(tau*tau), std::sqrt(a_u), snorm);
460 if (snorm < m_stol) {
478 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
480 bool& a_success )
const
482 RT cur_time = RT(0.0);
486 while ((cur_time < m_t_final) && (n_step < m_max_steps)) {
488 RT tau = computeTau(a_u);
489 RT dt = m_cfl / std::sqrt(tau*tau);
490 dt = limitTimestep(dt, cur_time);
491 if (!std::isfinite(dt)) {
497 bool step_success =
false;
498 while (!step_success) {
500 if (isTimestepTooSmall(dt, tau)) {
break; }
503 if (u1 <= 0) { dt *=
myhalf;
continue; }
506 RT u2 = a_u +
myhalf*dt*f1;
507 if (u2 <= 0) { dt *=
myhalf;
continue; }
510 RT u3 = a_u +
myhalf*dt*f2;
511 if (u3 <= 0) { dt *=
myhalf;
continue; }
515 if (u4 <= 0) { dt *=
myhalf;
continue; }
518 u_new = a_u + dt*(f1 + RT(2.0)*f2 + RT(2.0)*f3 + f4)/RT(6.0);
520 if (std::isfinite(u_new) && (u_new > 0)) {
528 RT snorm = std::sqrt((a_u-u_new)*(a_u-u_new)/(a_u*a_u));
531 printStepInfo(cur_time, dt, tau, std::sqrt(a_u), snorm);
532 if (snorm < m_stol) {
break; }
545 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
547 bool& a_success )
const
549 RT cur_time = RT(0.0);
553 while ((cur_time < m_t_final) && (n_step < m_max_steps)) {
555 RT tau = computeTau(a_u);
556 RT dt = m_cfl / std::sqrt(tau*tau);
557 dt = limitTimestep(dt, cur_time);
558 if (!std::isfinite(dt)) {
563 #ifdef AMREX_USE_FLOAT
564 RT res_norm_a = std::numeric_limits<float>::max();
565 RT res_norm_r = std::numeric_limits<float>::max();
567 RT res_norm_a = std::numeric_limits<double>::max();
568 RT res_norm_r = std::numeric_limits<double>::max();
570 bool converged =
false;
573 bool step_success =
false;
574 while (!step_success) {
576 if (isTimestepTooSmall(dt, tau)) {
break; }
578 RT
mu = RT(1.0) / dt;
581 m_newton(u_new, rhs,
mu,
582 m_S, m_T, m_e_s, m_D, m_a, m_b, m_N_s, ventFactor(a_u),
583 res_norm_a, res_norm_r, converged);
585 if (converged && std::isfinite(u_new) && (u_new > 0)) {
593 RT snorm = std::sqrt((a_u-u_new)*(a_u-u_new)/(a_u*a_u));
596 printStepInfoNewton(cur_time, dt, tau, std::sqrt(a_u), snorm,
597 res_norm_a, res_norm_r, converged);
598 if (snorm < m_stol) {
break; }
611 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
613 bool& a_success )
const
615 RT cur_time = RT(0.0);
619 while ((cur_time < m_t_final) && (n_step < m_max_steps)) {
621 RT tau = computeTau(a_u);
622 RT dt = m_cfl / std::sqrt(tau*tau);
623 dt = limitTimestep(dt, cur_time);
624 if (!std::isfinite(dt)) {
629 RT res_norm_a = std::numeric_limits<RT>::max();
630 RT res_norm_r = std::numeric_limits<RT>::max();
631 bool converged =
false;
634 bool step_success =
false;
635 while (!step_success) {
637 if (isTimestepTooSmall(dt, tau)) {
break; }
645 m_newton(u2, rhs,
mu,
646 m_S, m_T, m_e_s, m_D, m_a, m_b, m_N_s, ventFactor(a_u),
647 res_norm_a, res_norm_r, converged);
648 if (u2 <= 0) { dt *=
myhalf;
continue; }
651 u_new = a_u +
myhalf * dt * (f1 + f2);
653 if (converged && std::isfinite(u_new) && (u_new > 0)) {
661 RT snorm = std::sqrt((a_u-u_new)*(a_u-u_new)/(a_u*a_u));
664 printStepInfoNewton(cur_time, dt, tau, std::sqrt(a_u), snorm,
665 res_norm_a, res_norm_r, converged);
666 if (snorm < m_stol) {
break; }
679 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
680 void dirk212 ( RT& a_u,
681 bool& a_success )
const
683 RT cur_time = RT(0.0);
687 while ((cur_time < m_t_final) && (n_step < m_max_steps)) {
689 RT tau = computeTau(a_u);
690 RT dt = m_cfl / std::sqrt(tau*tau);
691 dt = limitTimestep(dt, cur_time);
692 if (!std::isfinite(dt)) {
697 bool converged =
false;
698 RT res_norm_a = std::numeric_limits<RT>::max();
699 RT res_norm_r = std::numeric_limits<RT>::max();
702 bool step_success =
false;
703 while (!step_success) {
705 if (isTimestepTooSmall(dt, tau)) {
708 RT
mu = RT(1.0) / dt;
711 res_norm_a = RT(0.0);
712 res_norm_r = RT(0.0);
717 RT res_norm_a_i = std::numeric_limits<RT>::max();
718 RT res_norm_r_i = std::numeric_limits<RT>::max();
719 bool converged_i =
false;
720 m_newton( u1, rhs,
mu,
721 m_S, m_T, m_e_s, m_D, m_a, m_b, m_N_s, ventFactor(a_u),
722 res_norm_a_i, res_norm_r_i, converged_i );
723 converged = converged && converged_i;
724 res_norm_a = std::max(res_norm_a, res_norm_a_i);
725 res_norm_r = std::max(res_norm_r, res_norm_r_i);
735 RT rhs =
mu * (a_u - dt*f1);
736 RT res_norm_a_i = std::numeric_limits<RT>::max();
737 RT res_norm_r_i = std::numeric_limits<RT>::max();
738 bool converged_i =
false;
739 m_newton( u2, rhs,
mu,
740 m_S, m_T, m_e_s, m_D, m_a, m_b, m_N_s, ventFactor(a_u),
741 res_norm_a_i, res_norm_r_i, converged_i );
742 converged = converged && converged_i;
743 res_norm_a = std::max(res_norm_a, res_norm_a_i);
744 res_norm_r = std::max(res_norm_r, res_norm_r_i);
752 u_new = a_u +
myhalf * dt * (f1 + f2);
755 if (std::isfinite(u_new)) {
767 RT snorm = std::sqrt((a_u-u_new)*(a_u-u_new)/(a_u*a_u));
771 printStepInfoNewton(cur_time, dt, tau, std::sqrt(a_u), snorm,
772 res_norm_a, res_norm_r, converged);
773 if (snorm < m_stol) {
795 namespace SDMassChangeUtils_SV
798 template <
typename RT >
807 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
808 RT growthRatio (
const RT a_T )
const noexcept
839 auto T_degC = a_T - RT(273.15);
840 int n = std::min(std::max(
static_cast<int>(std::round(RT(1.375)-RT(4.0)*T_degC)),1),121);
841 return static_cast<RT
>(tb_habit[n-1]);
846 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
847 RT Fk_plus_Fd (
const RT a_T,
849 const RT a_D )
const noexcept
851 auto F_k = (L/(Rv*a_T) - RT(1.0)) * (L / (K*a_T));
852 auto F_d = (Rv*a_T) / (a_D*a_e_s);
857 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
858 RT viscCoeff (
const RT a_T )
const noexcept
860 auto T_degC = a_T - RT(273.15);
861 RT visc_coeff = RT(0.0);
862 if( T_degC >= RT(0.0) ) {
863 visc_coeff = ( RT(1.7180) + RT(4.9E-3)*T_degC ) * RT(1.E-5);
865 visc_coeff = ( RT(1.7180) + RT(4.9E-3)*T_degC -RT(1.2E-5)*T_degC*T_degC ) * RT(1.E-5);
871 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
872 RT capacitance(
const RT a_a,
873 const RT a_c )
const noexcept
875 auto phi = a_c / a_a;
877 if(phi >= RT(1.001)) {
878 auto ecent = std::sqrt(RT(1.0) - RT(1.0)/(phi*phi));
879 capaci = ecent*a_c / std::log((RT(1.0)+ecent)*phi);
880 }
else if (phi <= RT(0.999)) {
881 auto ecent = std::sqrt(RT(1.0) - phi*phi);
882 capaci = ecent*a_a / std::asin(ecent);
884 capaci = (RT(2.0)*a_a + a_c)/
three;
890 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
891 RT ventX (
const RT a_a,
896 const RT a_D )
const noexcept
898 auto visc_coeff = viscCoeff(a_T);
899 auto maxdim = RT(2.0) * std::max(a_a, a_c);
900 auto n_re = a_rhom * maxdim * a_vterm / visc_coeff;
901 auto n_sc = visc_coeff / (a_rhom*a_D);
902 auto X_vent = std::cbrt(n_sc) * std::sqrt(n_re);
907 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
908 RT growthRatioStar (
const RT a_dmass,
914 const RT a_D )
const noexcept
916 auto capaci = capacitance(a_a, a_c);
917 auto X_vent = ventX(a_a, a_c, a_vterm, a_T, a_rhom, a_D);
919 if(X_vent <= RT(1.0)) {
920 fratio = (RT(1.0) + RT(0.14)*X_vent*X_vent*std::sqrt(a_c/capaci))
921 / (RT(1.0) + RT(0.14)*X_vent*X_vent*std::sqrt(a_a/capaci));
923 fratio = (RT(0.86) + RT(0.28)*X_vent*std::sqrt(a_c/capaci))
924 / (RT(0.86) + RT(0.28)*X_vent*std::sqrt(a_a/capaci));
927 auto gr = growthRatio(a_T);
928 if ((RT(2.0)*std::max(a_a,a_c) < RT(1.0e-5)) || (a_dmass <= RT(0.0))) { gr = RT(1.0); }
929 auto gr_star = gr * fratio;
930 if((a_dmass > RT(0.0)) && (a_c/a_a > RT(40.0))) { gr_star = std::min(gr_star,RT(1.0)); }
936 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
937 RT dVolume (
const RT a_dmass,
944 const RT a_es_ratio_wi,
945 const RT a_D )
const noexcept
948 auto gr = growthRatio(a_T);
949 if (a_dmass > RT(0.0)) {
950 if ((gr < RT(1.0)) && (a_a < RT(1.0e-4))) {
953 if (RT(2.0)*std::max(a_a,a_c) < RT(1.0e-5)) { gr = RT(1.0); }
954 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);
955 rho_i_ds = rho_ice * std::exp(-
three*std::max(ex_vap_dens-RT(0.05),RT(0.0))/gr);
959 auto dvol = a_dmass / rho_i_ds;
964 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
965 RT dLogRadius (
const RT a_grstar,
966 const RT a_dlogvol )
const noexcept
968 return a_dlogvol / (a_grstar+RT(2.0));
972 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
973 RT rhs_func (
const RT a_a,
980 const RT a_D )
const noexcept
982 auto capaci = capacitance(a_a, a_c);
983 auto X_vent = ventX(a_a, a_c, a_vterm, a_T, a_rhom, a_D);
986 if (X_vent <= RT(1.0)) { f_vent = RT(1.0) + RT(0.14)*X_vent*X_vent; }
987 else { f_vent = RT(0.86) + RT(0.28)*X_vent; }
989 auto retval = RT(4.0)*
PI * capaci * (a_S-RT(1.0)) * f_vent / Fk_plus_Fd(a_T, a_e_s, a_D);
999 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
1000 RT meltRate (
const RT a_a,
1005 const RT a_e_sat_wT0,
1008 const RT a_L_f )
const noexcept
1010 auto capaci = capacitance(a_a, a_c);
1011 auto X_vent = ventX(a_a, a_c, a_vterm, a_T, a_rhom, a_D);
1013 RT f_vent = RT(0.0);
1014 if (X_vent <= RT(1.0)) { f_vent = RT(1.0) + RT(0.14)*X_vent*X_vent; }
1015 else { f_vent = RT(0.86) + RT(0.28)*X_vent; }
1018 RT heat = K * f_vent * (a_T - T0)
1019 + (L*a_D/Rv) * (a_e_inf/a_T - a_e_sat_wT0/T0) * f_vent;
1020 return -(RT(4.0)*
PI*capaci/a_L_f) * heat;
1026 template<
typename ODE ,
1048 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
1050 bool& a_success )
const
1052 RT cur_time = RT(0.0);
1056 while ((cur_time < m_t_final) && (n_step < m_max_steps)) {
1058 if ((cur_time + m_dt) > m_t_final) {
1059 m_dt = m_t_final - cur_time;
1062 RT rhs = m_ode.rhs_func(m_a, m_c, m_vt, m_S, m_rhom, m_T, m_e_s, m_D);
1063 RT u_new = a_u + m_dt*rhs;
1064 if (!std::isfinite(u_new)) {
1069 RT snorm = std::sqrt((a_u-u_new)*(a_u-u_new)/(a_u*a_u));
1074 AMREX_DEVICE_PRINTF(
"Time %1.2e, m_dt = %1.2e, mass = %1.4e, snorm = %1.1e\n",
1075 cur_time, m_dt, a_u, snorm);
constexpr amrex::Real three
Definition: ERF_Constants.H:11
constexpr amrex::Real tmelt
Definition: ERF_Constants.H:130
constexpr amrex::Real myhalf
Definition: ERF_Constants.H:13
constexpr amrex::Real PI
Definition: ERF_Constants.H:42
amrex::Real gamma
Definition: ERF_InitCustomPert_DataAssimilation_ISV.H:9
amrex::Real beta
Definition: ERF_InitCustomPert_DataAssimilation_ISV.H:10
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