diff options
author | hawke <hawke@578cdeb0-5ea1-4b81-8215-5a3b8777ee0b> | 2003-09-04 09:04:13 +0000 |
---|---|---|
committer | hawke <hawke@578cdeb0-5ea1-4b81-8215-5a3b8777ee0b> | 2003-09-04 09:04:13 +0000 |
commit | 2d958e593d3ad1939e95e483b3902de9ecb45093 (patch) | |
tree | 74680f6954d305d4e9c437170bde3a3b61e229e3 /src | |
parent | 579471ae87529bef4f6b0134918ae3adef92a8e3 (diff) |
Add the ability to NaNcheck the RHS GFs.
git-svn-id: http://svn.cactuscode.org/arrangements/CactusNumerical/MoL/trunk@34 578cdeb0-5ea1-4b81-8215-5a3b8777ee0b
Diffstat (limited to 'src')
-rw-r--r-- | src/RHSNaNCheck.c | 101 | ||||
-rw-r--r-- | src/make.code.defn | 1 |
2 files changed, 102 insertions, 0 deletions
diff --git a/src/RHSNaNCheck.c b/src/RHSNaNCheck.c new file mode 100644 index 0000000..a11e55e --- /dev/null +++ b/src/RHSNaNCheck.c @@ -0,0 +1,101 @@ + /*@@ + @file RHSNaNCheck.c + @date Mon May 20 09:52:33 2002 + @author Ian Hawke + @desc + Check the RHS GFs for NaNs. + @enddesc + @version $Header$ + @@*/ + +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" + +#include "ExternalVariables.h" + +#include "NaNChecker.h" + +static const char *rcsid = "$Header$"; + +CCTK_FILEVERSION(AlphaThorns_MoL_RHSNaNCheck_c); + +/******************************************************************** + ********************* Local Data Types *********************** + ********************************************************************/ + +/******************************************************************** + ********************* Local Routine Prototypes ********************* + ********************************************************************/ + +/******************************************************************** + ***************** Scheduled Routine Prototypes ********************* + ********************************************************************/ + +int MoL_NaNCheck(CCTK_ARGUMENTS); + +/******************************************************************** + ********************* Other Routine Prototypes ********************* + ********************************************************************/ + +/******************************************************************** + ********************* Local Data ***************************** + ********************************************************************/ + +/******************************************************************** + ********************* External Routines ********************** + ********************************************************************/ + + /*@@ + @routine MoL_NaNCheck + @date Mon May 20 09:54:39 2002 + @author Ian Hawke + @desc + Check the RHS GFs for NaNs. + @enddesc + @calls + @calledby + @history + + @endhistory + +@@*/ + +int MoL_NaNCheck(CCTK_ARGUMENTS) +{ + + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INT var; + CCTK_INT num_nans; + + const char *check_for = "both"; + const char *action_if_found = "just warn"; + + num_nans = 0; + + for (var = 0; var < MoLNumEvolvedVariables; var++) + { + const char * const varname = CCTK_FullName(RHSVariableIndex[var]); + num_nans += NaNChecker_CheckVarsForNaN(cctkGH, + -1, + varname, + check_for, + action_if_found); + free((void*)varname); + } + + if (num_nans) + { + CCTK_VWarn(0,__LINE__,__FILE__,"MoL", + "NaNs were found on iteration %d inside MoL", + MoL_Intermediate_Steps - *MoL_Intermediate_Step + 1); + } + + return 0; +} + +/******************************************************************** + ********************* Local Routines ************************* + ********************************************************************/ diff --git a/src/make.code.defn b/src/make.code.defn index 48a4349..adfbe27 100644 --- a/src/make.code.defn +++ b/src/make.code.defn @@ -13,6 +13,7 @@ SRCS = ChangeType.c \ RK3.c \ Registration.c \ RKCoefficients.c \ + RHSNaNCheck.c \ SandR.c \ SetTime.c \ Startup.c |