diff options
author | schnetter <schnetter@eec4d7dc-71c2-46d6-addf-10296150bf52> | 2004-03-09 19:51:22 +0000 |
---|---|---|
committer | schnetter <schnetter@eec4d7dc-71c2-46d6-addf-10296150bf52> | 2004-03-09 19:51:22 +0000 |
commit | 63344a7ebbb1b34018dfd60001afbc03c549a575 (patch) | |
tree | b7150449acdab2300ebbfc6f8bbad41ea9c54781 /src/ApplyCartoon.c | |
parent | ae407aca63c86a9a4d7a5d94e602034cff3db3a8 (diff) |
(Changes from Ian Hawke.)
Possibly use ENO interpolation. Useful e.g. for hydro where shocks may appear.
To make Cartoon use the ENO interpolator you need an additional tags table entry. The same tags are used as for Carpet. Either
tags='Prolongation="TVD"'
or
tags='Prolongation="ENO"'
will work.
The default (i.e., with no tag) is to use the standard Lagrange polynomials. The tags "Lagrange" and "None" will also do this. Also, any direct call to the Cartoon functions (BndCartoon2DVI etc.) will use Lagrange interpolation.
Code from Burkhard Zink for interpolation; tags table stuff from me.
git-svn-id: http://svn.cactuscode.org/arrangements/CactusNumerical/Cartoon2D/trunk@76 eec4d7dc-71c2-46d6-addf-10296150bf52
Diffstat (limited to 'src/ApplyCartoon.c')
-rw-r--r-- | src/ApplyCartoon.c | 56 |
1 files changed, 52 insertions, 4 deletions
diff --git a/src/ApplyCartoon.c b/src/ApplyCartoon.c index a203105..61424e8 100644 --- a/src/ApplyCartoon.c +++ b/src/ApplyCartoon.c @@ -25,6 +25,7 @@ CCTK_FILEVERSION(BetaThorns_Cartoon2D_ApplyCartoon_c); ********************************************************************/ /* #define DEBUG 1 */ #define TENSORTYPE_BUFF_SIZE 7 +#define PROLONG_BUFF_SIZE 1000 /******************************************************************** ********************* Local Routine Prototypes ********************* @@ -77,11 +78,15 @@ void Cartoon_ApplyBoundaries(CCTK_ARGUMENTS); @endreturndesc @@*/ -void Cartoon_ApplyBoundaries(CCTK_ARGUMENTS) { +void Cartoon_ApplyBoundaries(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; int num_vars, err, i, gi, group_tags_table; CCTK_INT * vars; char tensortype[TENSORTYPE_BUFF_SIZE]; + char prolongtype[PROLONG_BUFF_SIZE]; + int prolongmethod; /* Allocate memory to hold selected bcs */ num_vars = Boundary_SelectedGVs(cctkGH, 0, NULL, NULL, NULL, NULL, NULL); @@ -145,6 +150,49 @@ void Cartoon_ApplyBoundaries(CCTK_ARGUMENTS) { #ifdef DEBUG printf("Cartoon_ApplyBoundaries: tensor type is %s\n",tensortype); #endif + + /* Get prolongation type from group tags table */ + + err = Util_TableGetString(group_tags_table, PROLONG_BUFF_SIZE, + prolongtype, "Prolongation"); + + if (err == UTIL_ERROR_TABLE_NO_SUCH_KEY) + { + /* Use the default */ + + prolongmethod = PROLONG_LAGRANGE; + } + else if (err < 0) + { + CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING, + "Error (%d) in TAGS table for variable group %s", err, + CCTK_GroupName(gi)); + } + else + { + if (CCTK_Equals(prolongtype, "None")) + { + prolongmethod = PROLONG_LAGRANGE; /* But why? */ + } + else if (CCTK_Equals(prolongtype, "Lagrange")) + { + prolongmethod = PROLONG_LAGRANGE; + } + else if (CCTK_Equals(prolongtype, "TVD")) + { + prolongmethod = PROLONG_ENO; + } + else if (CCTK_Equals(prolongtype, "ENO")) + { + prolongmethod = PROLONG_ENO; + } + else + { + CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING, + "Error in TAGS table for variable group %s", + CCTK_GroupName(gi)); + } + } /* Here one should check that the group's size is correct for the * specified tensortype. @@ -154,13 +202,13 @@ void Cartoon_ApplyBoundaries(CCTK_ARGUMENTS) { macro */ if (CCTK_Equals(tensortype, "scalar")) { - BndCartoon2DVI(cctkGH, TENSORTYPE_SCALAR, vars[i]); + BndCartoon2DVI(cctkGH, TENSORTYPE_SCALAR, prolongmethod, vars[i]); } else if (CCTK_Equals(tensortype, "u")) { - BndCartoon2DVI(cctkGH, TENSORTYPE_U, vars[i]); + BndCartoon2DVI(cctkGH, TENSORTYPE_U, prolongmethod, vars[i]); } else if (CCTK_Equals(tensortype, "dd_sym")) { - BndCartoon2DVI(cctkGH, TENSORTYPE_DDSYM, vars[i]); + BndCartoon2DVI(cctkGH, TENSORTYPE_DDSYM, prolongmethod, vars[i]); } else { CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, |