"Erroneous arithmetic operation" in EB_CNS when AMR based on density gradient is activated for 2D simulation #3320
-
Hi, I wanted to share my experience using the EB_CNS examples, specifically the Sod example, and its source codes for my research. I made some adjustments to the input files and managed to reproduce the Cylinder-shock interaction test and Schardin experiment test mentioned in the article by modifying the The simulations worked well, except for the grids around the moving shock wave, which were not properly refined. To address this issue, I added two lines to the settings in the input file: To troubleshoot this issue, I investigated the backtrace file and reviewed the relevant source code files where the error could potentially occur. I discovered that in the file if (amrex::max(ax, ay, az) >= dengrad_threshold) To resolve this problem, I implemented a fix by adding a conditional compilation if statement as shown below. In conclusion, I believe it would be beneficial to notify the AMReX team about this issue so that other users working with the 2D EB_CNS may avoid spending a significant amount of time being confused by similar errors. Thank you for your attention, and I welcome any feedback or suggestions regarding this matter. AMREX_GPU_DEVICE AMREX_FORCE_INLINE
void
cns_tag_denerror (int i, int j, int k,
amrex::Array4<char> const& tag,
amrex::Array4<amrex::Real const> const& rho,
amrex::Real dengrad_threshold, char tagval) noexcept
{
amrex::Real ax = std::abs(rho(i+1,j,k) - rho(i,j,k));
amrex::Real ay = std::abs(rho(i,j+1,k) - rho(i,j,k));
ax = amrex::max(ax,std::abs(rho(i,j,k) - rho(i-1,j,k)));
ay = amrex::max(ay,std::abs(rho(i,j,k) - rho(i,j-1,k)));
#if (AMREX_SPACEDIM == 3)
amrex::Real az = std::abs(rho(i,j,k+1) - rho(i,j,k));
az = amrex::max(az,std::abs(rho(i,j,k) - rho(i,j,k-1)));
if (amrex::max(ax,ay,az) >= dengrad_threshold) {
tag(i,j,k) = tagval;
}
#else
if (amrex::max(ax,ay) >= dengrad_threshold) {
tag(i,j,k) = tagval;
}
#endif
} |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Thanks for reporting this! We will fix this. |
Beta Was this translation helpful? Give feedback.
Thanks for reporting this! We will fix this.