aboutsummaryrefslogtreecommitdiff
path: root/src/RKCoefficients.c
diff options
context:
space:
mode:
authorhawke <hawke@578cdeb0-5ea1-4b81-8215-5a3b8777ee0b>2003-07-22 07:07:14 +0000
committerhawke <hawke@578cdeb0-5ea1-4b81-8215-5a3b8777ee0b>2003-07-22 07:07:14 +0000
commite3096d84ffb4b909977066f158db78eb45f4a80b (patch)
tree9e41096faa3de1f2af27660866aa5e4eea4cffed /src/RKCoefficients.c
parent06f6fb8bd438528724715988336a8b8ef86192ce (diff)
Add two methods:
RK3. The optimized version of the TVD RK3 solver. Requires no scratch space so is about as efficient as ICN, but third order. Generic method from a parameter table. By specifying the number of intermediate steps and the alpha and beta arrays, create your own method at parameter time. Not well (or at all) documented because it doesn't seem to work correctly at the moment. Some tidying of extraneous code as well. git-svn-id: http://svn.cactuscode.org/arrangements/CactusNumerical/MoL/trunk@29 578cdeb0-5ea1-4b81-8215-5a3b8777ee0b
Diffstat (limited to 'src/RKCoefficients.c')
-rw-r--r--src/RKCoefficients.c58
1 files changed, 58 insertions, 0 deletions
diff --git a/src/RKCoefficients.c b/src/RKCoefficients.c
index 635df7a..cae00b2 100644
--- a/src/RKCoefficients.c
+++ b/src/RKCoefficients.c
@@ -14,6 +14,9 @@
#include "cctk_Arguments.h"
#include "cctk_Parameters.h"
+#include "util_ErrorCodes.h"
+#include "util_Table.h"
+
static const char *rcsid = "$Header$";
CCTK_FILEVERSION(AlphaThorns_MoL_RKCoefficients_c);
@@ -68,6 +71,8 @@ int MoL_SetupRKCoefficients(CCTK_ARGUMENTS)
CCTK_INT i, j;
+ CCTK_INT ierr, options_table;
+
if (CCTK_Equals(Generic_Type,"ICN"))
{
for (i = 0; i < MoL_Intermediate_Steps; i++)
@@ -145,6 +150,59 @@ int MoL_SetupRKCoefficients(CCTK_ARGUMENTS)
CCTK_WARN(0, "RKCoefficients cannot do generic RK methods with MoL_Intermediate_Steps greater than 4");
}
}
+ else if (CCTK_Equals(Generic_Type,"Table"))
+ {
+ if (MoL_Num_Scratch_Levels < MoL_Intermediate_Steps - 1)
+ {
+ CCTK_WARN(0, "For generic methods, MoL_Num_Scratch_Levels should be at least MoL_Intermediate_Steps - 1");
+ }
+ options_table =
+ Util_TableCreateFromString(Generic_Method_Descriptor);
+ if (options_table < 0)
+ {
+ CCTK_WARN(0, "Failed to create table from Generic_Method_Descriptor!");
+ }
+ ierr = Util_TableGetRealArray(options_table,
+ (MoL_Num_Scratch_Levels + 1) *
+ MoL_Intermediate_Steps,
+ RKAlphaCoefficients,
+ "GenericAlphaCoeffs");
+ if (ierr < (MoL_Num_Scratch_Levels + 1) * MoL_Intermediate_Steps )
+ {
+ if (ierr >= 0)
+ {
+ CCTK_WARN(0, "Insufficient elements in the specified GenericAlphaCoeffs array");
+ }
+ else if (ierr == UTIL_ERROR_TABLE_NO_SUCH_KEY)
+ {
+ CCTK_WARN(0, "When using the generic table options you must set \"GenericAlphaCoeffs\" in the options table");
+ }
+ else
+ {
+ CCTK_WARN(0, "Table error - check with Ian.");
+ }
+ }
+ ierr = Util_TableGetRealArray(options_table,
+ MoL_Intermediate_Steps,
+ RKBetaCoefficients,
+ "GenericBetaCoeffs");
+ if (ierr < MoL_Intermediate_Steps)
+ {
+ if (ierr >= 0)
+ {
+ CCTK_WARN(0, "Insufficient elements in the specified GenericBetaCoeffs array");
+ }
+ else if (ierr == UTIL_ERROR_TABLE_NO_SUCH_KEY)
+ {
+ CCTK_WARN(0, "When using the generic table options you must set \"GenericBetaCoeffs\" in the options table");
+ }
+ else
+ {
+ CCTK_WARN(0, "Table error - check with Ian.");
+ }
+ }
+ ierr = Util_TableDestroy(options_table);
+ }
else
{
CCTK_WARN(0, "RKCoefficients does not recognize the value of Generic_Type");