diff options
Diffstat (limited to 'src/CartGrid3D.c')
-rw-r--r-- | src/CartGrid3D.c | 190 |
1 files changed, 182 insertions, 8 deletions
diff --git a/src/CartGrid3D.c b/src/CartGrid3D.c index 55f9074..3e348e9 100644 --- a/src/CartGrid3D.c +++ b/src/CartGrid3D.c @@ -17,23 +17,65 @@ #include "cctk.h" #include "cctk_Arguments.h" #include "cctk_Parameters.h" +#include "util_Table.h" + #include "Symmetry.h" +#include "CoordBase.h" static const char *rcsid = "$Header$"; -CCTK_FILEVERSION(CactusBase_CartGrid3D_CartGrid3D_c) - -void DecodeSymParameters3D(int sym[6]); -void CartGrid3D(CCTK_ARGUMENTS); +CCTK_FILEVERSION(CactusBase_CartGrid3D_CartGrid3D_c); +/******************************************************************** + ********************* Macro Definitions ************************** + ********************************************************************/ #define max(a,b) ((a) > (b) ? (a) : (b)) #define SQR(a) ((a)*(a)) +/******************************************************************** + ********************* Scheduled Routine Prototypes *************** + ********************************************************************/ +void CartGrid3D(CCTK_ARGUMENTS); + +/******************************************************************** + ********************* External Routine Prototypes **************** + ********************************************************************/ +void DecodeSymParameters3D(int sym[6]); + +/******************************************************************** + ********************* Local Routine Prototypes ******************* + ********************************************************************/ + +/******************************************************************** + ********************* Scheduled Routines ************************* + ********************************************************************/ + /*@@ + @routine CartGrid3D + @date Oct 1999? + @author Tom Goodale? Gabrielle Allen? + @desc + Sets up Cartesian coordinates. + @enddesc + @calls DecodeSymParameters3D, CCTK_Equals, CCTK_WARN, + CCTK_CoordRegisterRange, CCTK_CoordRegisterRangePhysIndex, + CCTK_INFO, Coord_CoordHandle, Util_TableSetReal, + Util_TableSetString, Util_TableSetInt + @history + @endhistory + + @var CCTK_ARGUMENTS + @vdesc Cactus argument list + @vtype + @vio in/out + @vcomment + @endvar + + @returntype void +@@*/ void CartGrid3D(CCTK_ARGUMENTS) { - - DECLARE_CCTK_ARGUMENTS - DECLARE_CCTK_PARAMETERS + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; int iconv, i, j, k; double dconv; @@ -48,6 +90,8 @@ void CartGrid3D(CCTK_ARGUMENTS) int domainsym[6]; int cntstag[3]; + CCTK_INT coord_handle; + lowerx = upperx = lowery = uppery = lowerz = upperz = 0; lowerxi = upperxi = loweryi = upperyi = lowerzi = upperzi = 0; @@ -186,7 +230,7 @@ void CartGrid3D(CCTK_ARGUMENTS) /* Grid spacing on coarsest grid */ /* TODO: Put the coordinates into arrays, and loop over the - dimensions. That gets ride of all the triplicated code. */ + dimensions. That gets rid of all the triplicated code. */ if (domainsym[0]) { if (cntstag[0]) @@ -456,6 +500,111 @@ void CartGrid3D(CCTK_ARGUMENTS) } /* if (coarsest refinement level) */ + /* Set up coordinate tables */ + /* cart3d x */ + /* Should this be done in a function? + WriteCoordinateTable(cctkGH, "cart3d"); */ + coord_handle = Coord_CoordHandle(cctkGH, "x", "cart3d"); + if (coord_handle<0) + { + CCTK_WARN(0, "Error retreiving coordinate handle for x of cart3d"); + } + ierr = Util_TableSetReal (coord_handle, lowerx, "PHYSICALMIN"); /* ?? */ + ierr += Util_TableSetReal (coord_handle, lowerx, "COMPMIN"); + ierr += Util_TableSetReal (coord_handle, upperx, "PHYSICALMAX"); /* ?? */ + ierr += Util_TableSetReal (coord_handle, upperx, "COMPMAX"); + ierr += Util_TableSetString (coord_handle, "uniform", "TYPE"); + ierr += Util_TableSetString (coord_handle, "no", "TIMEDEPENDENT"); + ierr += Util_TableSetString (coord_handle, "CCTK_REAL", "DATATYPE"); + ierr += Util_TableSetInt (coord_handle, CCTK_VarIndex("grid::x"), + "GAINDEX"); + ierr += Util_TableSetReal (coord_handle, cctk_delta_space[0], "DELTA"); + + /* cart3d y */ + coord_handle = Coord_CoordHandle(cctkGH, "y", "cart3d"); + if (coord_handle<0) + { + CCTK_WARN(0, "Error retreiving coordinate handle for y of cart3d"); + } + ierr = Util_TableSetReal (coord_handle, lowery, "PHYSICALMIN"); /* ?? */ + ierr += Util_TableSetReal (coord_handle, lowery, "COMPMIN"); + ierr += Util_TableSetReal (coord_handle, uppery, "PHYSICALMAX"); /* ?? */ + ierr += Util_TableSetReal (coord_handle, uppery, "COMPMAX"); + ierr += Util_TableSetString (coord_handle, "uniform", "TYPE"); + ierr += Util_TableSetString (coord_handle, "no", "TIMEDEPENDENT"); + ierr += Util_TableSetString (coord_handle, "CCTK_REAL", "DATATYPE"); + ierr += Util_TableSetInt (coord_handle, CCTK_VarIndex("grid::y"), + "GAINDEX"); + ierr += Util_TableSetReal (coord_handle, cctk_delta_space[1], "DELTA"); + + /* cart3d z */ + coord_handle = Coord_CoordHandle(cctkGH, "z", "cart3d"); + if (coord_handle<0) + { + CCTK_WARN(0, "Error retreiving coordinate handle for z of cart3d"); + } + ierr = Util_TableSetReal (coord_handle, lowerz, "PHYSICALMIN"); /* ?? */ + ierr += Util_TableSetReal (coord_handle, lowerz, "COMPMIN"); + ierr += Util_TableSetReal (coord_handle, upperz, "PHYSICALMAX"); /* ?? */ + ierr += Util_TableSetReal (coord_handle, upperz, "COMPMAX"); + ierr += Util_TableSetString (coord_handle, "uniform", "TYPE"); + ierr += Util_TableSetString (coord_handle, "no", "TIMEDEPENDENT"); + ierr += Util_TableSetString (coord_handle, "CCTK_REAL", "DATATYPE"); + ierr += Util_TableSetInt (coord_handle, CCTK_VarIndex("grid::z"), + "GAINDEX"); + ierr += Util_TableSetReal (coord_handle, cctk_delta_space[2], "DELTA"); + + /* cart2d x */ + //WriteCoordinateTable(cctkGH, "cart3d"); + coord_handle = Coord_CoordHandle(cctkGH, "x", "cart2d"); + if (coord_handle<0) + { + CCTK_WARN(0, "Error retreiving coordinate handle for x of cart2d"); + } + ierr = Util_TableSetReal (coord_handle, lowerx, "PHYSICALMIN"); /* ?? */ + ierr += Util_TableSetReal (coord_handle, lowerx, "COMPMIN"); + ierr += Util_TableSetReal (coord_handle, upperx, "PHYSICALMAX"); /* ?? */ + ierr += Util_TableSetReal (coord_handle, upperx, "COMPMAX"); + ierr += Util_TableSetString (coord_handle, "uniform", "TYPE"); + ierr += Util_TableSetString (coord_handle, "no", "TIMEDEPENDENT"); + ierr += Util_TableSetString (coord_handle, "CCTK_REAL", "DATATYPE"); + ierr += Util_TableSetInt (coord_handle, CCTK_VarIndex("grid::x"), + "GAINDEX"); + ierr += Util_TableSetReal (coord_handle, cctk_delta_space[0], "DELTA"); + + /* cart2d y */ + coord_handle = Coord_CoordHandle(cctkGH, "y", "cart2d"); + if (coord_handle<0) + { + CCTK_WARN(0, "Error retreiving coordinate handle for y of cart2d"); + } + ierr = Util_TableSetReal (coord_handle, lowery, "PHYSICALMIN"); /* ?? */ + ierr += Util_TableSetReal (coord_handle, lowery, "COMPMIN"); + ierr += Util_TableSetReal (coord_handle, uppery, "PHYSICALMAX"); /* ?? */ + ierr += Util_TableSetReal (coord_handle, uppery, "COMPMAX"); + ierr += Util_TableSetString (coord_handle, "uniform", "TYPE"); + ierr += Util_TableSetString (coord_handle, "no", "TIMEDEPENDENT"); + ierr += Util_TableSetString (coord_handle, "CCTK_REAL", "DATATYPE"); + ierr += Util_TableSetInt (coord_handle, CCTK_VarIndex("grid::y"), + "GAINDEX"); + ierr += Util_TableSetReal (coord_handle, cctk_delta_space[1], "DELTA"); + + /* cart1d x */ + coord_handle = Coord_CoordHandle(cctkGH, "x", "cart1d"); + if (coord_handle<0) + { + CCTK_WARN(0, "Error retreiving coordinate handle for x of cart1d"); + } + ierr = Util_TableSetReal (coord_handle, lowerx, "PHYSICALMIN"); /* ?? */ + ierr += Util_TableSetReal (coord_handle, lowerx, "COMPMIN"); + ierr += Util_TableSetReal (coord_handle, upperx, "PHYSICALMAX"); /* ?? */ + ierr += Util_TableSetReal (coord_handle, upperx, "COMPMAX"); + ierr += Util_TableSetString (coord_handle, "uniform", "TYPE"); + ierr += Util_TableSetString (coord_handle, "no", "TIMEDEPENDENT"); + ierr += Util_TableSetString (coord_handle, "CCTK_REAL", "DATATYPE"); + ierr += Util_TableSetInt (coord_handle, CCTK_VarIndex("grid::x"), + "GAINDEX"); + ierr += Util_TableSetReal (coord_handle, cctk_delta_space[0], "DELTA"); #ifdef CARTGRID3D_DEBUG @@ -477,3 +626,28 @@ void CartGrid3D(CCTK_ARGUMENTS) #endif } + +/******************************************************************** + ********************* Local Routines ***************************** + ********************************************************************/ + + /*@@ + @routine WriteCoordinateTable + @date Aug 2003 + @author David Rideout + @desc + Writes coordinate table for a registered coordinate system + @enddesc + @calls + @history + @endhistory + + @var ... + @vdesc ... + @vtype ... + @vio in/out + @vcomment + @endvar + + @returntype void +@@*/ |