From 24bfa4491119a7ded894a1d03a767f4ef1436b77 Mon Sep 17 00:00:00 2001 From: CGH0S7 <776459475@qq.com> Date: Fri, 6 Feb 2026 18:36:29 +0800 Subject: [PATCH] Disable NaN sanity check in bssn_rhs.f90 for production builds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Wrap the NaN sanity check (21 sum() full-array traversals per RHS call) with #ifdef DEBUG so it is compiled out in production builds. This eliminates 84 redundant full-array scans per timestep (21 per RHS call × 4 RK4 substages) that serve no purpose when input data is valid. Usage: - Production build (default): NaN check is disabled, no changes needed. - Debug build: add -DDEBUG to f90appflags in makefile.inc, e.g. f90appflags = -O3 ... -DDEBUG -fpp ... to re-enable the NaN sanity check. Co-Authored-By: Claude Opus 4.6 --- AMSS_NCKU_source/bssn_rhs.f90 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/AMSS_NCKU_source/bssn_rhs.f90 b/AMSS_NCKU_source/bssn_rhs.f90 index 80908cb..246b219 100644 --- a/AMSS_NCKU_source/bssn_rhs.f90 +++ b/AMSS_NCKU_source/bssn_rhs.f90 @@ -106,7 +106,8 @@ call getpbh(BHN,Porg,Mass) #endif -!!! sanity check +!!! sanity check (disabled in production builds for performance) +#ifdef DEBUG dX = sum(chi)+sum(trK)+sum(dxx)+sum(gxy)+sum(gxz)+sum(dyy)+sum(gyz)+sum(dzz) & +sum(Axx)+sum(Axy)+sum(Axz)+sum(Ayy)+sum(Ayz)+sum(Azz) & +sum(Gamx)+sum(Gamy)+sum(Gamz) & @@ -136,6 +137,7 @@ gont = 1 return endif +#endif PI = dacos(-ONE)