diff options
author | 2022-02-04 17:12:55 -0800 | |
---|---|---|
committer | 2022-02-05 01:12:55 +0000 | |
commit | 5692067b01252146b8d0a90137a1bd952644c8ca (patch) | |
tree | bfb704a14588a54207b883254264a8c474d65a14 /Source/Particles/PhysicalParticleContainer.cpp | |
parent | 9263e6a9832f7ec69a8cc54fda3f6f1de51caaf1 (diff) | |
download | WarpX-5692067b01252146b8d0a90137a1bd952644c8ca.tar.gz WarpX-5692067b01252146b8d0a90137a1bd952644c8ca.tar.zst WarpX-5692067b01252146b8d0a90137a1bd952644c8ca.zip |
Fixes removing implicit double to float conversions (#2687)
* Fixes removing implicit double to float conversions
* Minor fix in Evolve
* Removed comments
* Reverted amrex::second to original version.
This change will be made in a separate PR
* More fixes
* Performance: pow2 & pow3
* One more pow2
* Cleaning: auto where types are repetitive
std::pow(float, int): see comments and
https://stackoverflow.com/a/5627278/2719194
Diffstat (limited to 'Source/Particles/PhysicalParticleContainer.cpp')
-rw-r--r-- | Source/Particles/PhysicalParticleContainer.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/Source/Particles/PhysicalParticleContainer.cpp b/Source/Particles/PhysicalParticleContainer.cpp index 80a6e6438..4225e630a 100644 --- a/Source/Particles/PhysicalParticleContainer.cpp +++ b/Source/Particles/PhysicalParticleContainer.cpp @@ -2290,7 +2290,7 @@ PhysicalParticleContainer::GetParticleSlice ( const long np = pti.numParticles(); Real uzfrm = -WarpX::gamma_boost*WarpX::beta_boost*PhysConst::c; - Real inv_c2 = 1.0/PhysConst::c/PhysConst::c; + Real inv_c2 = 1.0_rt/PhysConst::c/PhysConst::c; FlagForPartCopy.resize(np); IndexForPartCopy.resize(np); @@ -2349,7 +2349,7 @@ PhysicalParticleContainer::GetParticleSlice ( if (Flag[i] == 1) { // Lorentz Transform particles to lab-frame - const Real gamma_new_p = std::sqrt(1.0 + inv_c2* + const Real gamma_new_p = std::sqrt(1.0_rt + inv_c2* (uxpnew[i]*uxpnew[i] + uypnew[i]*uypnew[i] + uzpnew[i]*uzpnew[i])); @@ -2357,7 +2357,7 @@ PhysicalParticleContainer::GetParticleSlice ( const Real z_new_p = gammaboost*(zp_new + betaboost*Phys_c*t_boost); const Real uz_new_p = gammaboost*uzpnew[i] - gamma_new_p*uzfrm; - const Real gamma_old_p = std::sqrt(1.0 + inv_c2* + const Real gamma_old_p = std::sqrt(1.0_rt + inv_c2* (uxpold[i]*uxpold[i] + uypold[i]*uypold[i] + uzpold[i]*uzpold[i])); @@ -2664,12 +2664,12 @@ PhysicalParticleContainer::InitIonizationModule () amrex::ParallelFor(ion_atomic_number, [=] AMREX_GPU_DEVICE (int i) noexcept { Real n_eff = (i+1) * std::sqrt(UH/p_ionization_energies[i]); - Real C2 = std::pow(2,2*n_eff)/(n_eff*tgamma(n_eff+l_eff+1)*tgamma(n_eff-l_eff)); - p_adk_power[i] = -(2*n_eff - 1); + Real C2 = std::pow(2._rt,2._rt*n_eff)/(n_eff*std::tgamma(n_eff+l_eff+1._rt)*std::tgamma(n_eff-l_eff)); + p_adk_power[i] = -(2._rt*n_eff - 1._rt); Real Uion = p_ionization_energies[i]; - p_adk_prefactor[i] = dt * wa * C2 * ( Uion/(2*UH) ) - * std::pow(2*std::pow((Uion/UH),3./2)*Ea,2*n_eff - 1); - p_adk_exp_prefactor[i] = -2./3 * std::pow( Uion/UH,3./2) * Ea; + p_adk_prefactor[i] = dt * wa * C2 * ( Uion/(2._rt*UH) ) + * std::pow(2._rt*std::pow((Uion/UH),3._rt/2._rt)*Ea,2._rt*n_eff - 1._rt); + p_adk_exp_prefactor[i] = -2._rt/3._rt * std::pow( Uion/UH,3._rt/2._rt) * Ea; }); Gpu::synchronize(); |