Skip to content

Commit

Permalink
Fix FPE arising from ssq == Rsq (Exawind#559)
Browse files Browse the repository at this point in the history
* Fix FPE arising from ssq == Rsq

* Initializing the vector potential to zero
  • Loading branch information
marchdf authored Jan 31, 2022
1 parent fbc58ec commit 90b7d4f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions amr-wind/physics/VortexRing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real FatCore::operator()(
{
amrex::Real Rsq = std::pow(R, 2);
const amrex::Real ssq = std::pow(z, 2) + std::pow(r - R, 2);
if (ssq <= Rsq) {
if (ssq < Rsq) {
return 0.54857674 * Gamma / Rsq * std::exp(-4 * ssq / (Rsq - ssq));
}
return 0.0;
Expand Down Expand Up @@ -235,7 +235,9 @@ void VortexRing::initialize_velocity(const VortexRingType& vorticity_theta)
const amrex::Real rel_tol = 1.0e-13;
const amrex::Real abs_tol = 1.0e-13;

(*vectorpotential)(0).setVal(0.0, 0, AMREX_SPACEDIM, 1);
for (int level = 0; level <= m_repo.mesh().finestLevel(); ++level) {
(*vectorpotential)(level).setVal(0.0, 0, AMREX_SPACEDIM, 1);
}

// might be able to skip z-dir since vorticity is 0.0
for (int i = 0; i < AMREX_SPACEDIM; ++i) {
Expand Down

0 comments on commit 90b7d4f

Please sign in to comment.