Location
Source/BoundaryConditions/ERF_FillPatcher.H:130-131
Source/BoundaryConditions/ERF_FillPatcher.cpp:226,243
Problem
RegisterCoarseData() allows crse_time[1] == crse_time[0] and sets:
m_dt_crse = crse_time[1] - crse_time[0];
Fill() then computes:
fac_new = (time - m_crse_times[0]) / m_dt_crse;
No guard exists for m_dt_crse == 0.
Why this is a bug
This can produce NaN/Inf interpolation factors and corrupt boundary-filled data when coarse snapshots share the same
timestamp.
Suggested patch
Handle zero-interval coarse data explicitly.
--- a/Source/BoundaryConditions/ERF_FillPatcher.H
+++ b/Source/BoundaryConditions/ERF_FillPatcher.H
@@
- amrex::Real fac_new = (time - m_crse_times[0]) / m_dt_crse;
- amrex::Real fac_old = 1.0 - fac_new;
+ amrex::Real fac_new = 0.0;
+ amrex::Real fac_old = 1.0;
+ if (amrex::Math::abs(m_dt_crse) > eps) {
+ fac_new = (time - m_crse_times[0]) / m_dt_crse;
+ fac_old = 1.0 - fac_new;
+ }
Optionally add an assert in RegisterCoarseData() if equal coarse times are unsupported.
Location
Source/BoundaryConditions/ERF_FillPatcher.H:130-131Source/BoundaryConditions/ERF_FillPatcher.cpp:226,243Problem
RegisterCoarseData()allowscrse_time[1] == crse_time[0]and sets:Fill()then computes:fac_new = (time - m_crse_times[0]) / m_dt_crse;No guard exists for
m_dt_crse == 0.Why this is a bug
This can produce NaN/Inf interpolation factors and corrupt boundary-filled data when coarse snapshots share the same
timestamp.
Suggested patch
Handle zero-interval coarse data explicitly.
Optionally add an assert in
RegisterCoarseData()if equal coarse times are unsupported.