From 2e0ca1d23070449e904c60130e3cf4e707def1f2 Mon Sep 17 00:00:00 2001 From: Piyush Sharda Date: Mon, 26 Aug 2024 11:29:56 +0200 Subject: [PATCH] use powi in tdust computation --- networks/metal_chem/actual_rhs.H | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/networks/metal_chem/actual_rhs.H b/networks/metal_chem/actual_rhs.H index ed194e0a1..2cbcb4b2b 100644 --- a/networks/metal_chem/actual_rhs.H +++ b/networks/metal_chem/actual_rhs.H @@ -4129,7 +4129,7 @@ std::pair compute_Semenov_Tdust(Real Tgas, const Array1D(tau); Real const alpha_gd = 3.2e-34; Real const aR = 4 * C::sigma_SB / C::c_light; @@ -4139,17 +4139,17 @@ std::pair compute_Semenov_Tdust(Real Tgas, const Array1D(nH) * alpha_gd * user_dust2gas_ratio; Real phys_Tcmb = 2.73 * (1.0 + z); - Real C = -1.0 * (intJRad + A * std::pow(phys_Tcmb, 4) + std::pow(Tgas, 1.5) * std::pow(nH, 2) * alpha_gd * user_dust2gas_ratio); + Real C = -1.0 * (intJRad + A * amrex::Math::powi<4>(phys_Tcmb) + std::pow(Tgas, 1.5) * amrex::Math::powi<2>(nH) * alpha_gd * user_dust2gas_ratio); int iterr = 0; Real Tdold = krome_Semenov_Tdust; Real Tdnew = 0.0; while (true) { - Real fx = A * std::pow(Tdold, 4) + B * Tdold + C; - Real fdash_x = 4.0 * A * std::pow(Tdold, 3) + B; + Real fx = A * amrex::Math::powi<4>(Tdold) + B * Tdold + C; + Real fdash_x = 4.0 * A * amrex::Math::powi<3>(Tdold) + B; Tdnew = Tdold - fx / fdash_x; Real rel_t = std::abs((Tdnew - Tdold) / Tdold); @@ -4166,7 +4166,7 @@ std::pair compute_Semenov_Tdust(Real Tgas, const Array1D(Tdnew) - intJRad - A * amrex::Math::powi<4>(phys_Tcmb); return std::make_pair(Tdnew, dustSemenov_cooling); }