einsteintoolkit / CactusElliptic_EllSOR.json
xinshuo's picture
Upload folder using huggingface_hub
10a2580 verified
{
"thorn_name": "CactusElliptic/EllSOR",
"url": "https://bitbucket.org/cactuscode/cactuselliptic.git",
"configuration": "# Configuration definition for thorn EllSOR\n# $Header$\n\nREQUIRES Boundary CartGrid3D\n",
"interface": "# Interface definition for thorn EllSOR\n# $Header$\n\nimplements: ellsor\ninherits: ellbase, boundary\n\nUSES INCLUDE HEADER: EllBase.h\nUSES INCLUDE HEADER: Ell_DBstructure.h\nUSES INCLUDE HEADER: Boundary.h\nUSES INCLUDE HEADER: Symmetry.h\n",
"param": "# Parameter definitions for thorn EllSOR\n# $Header$\n\nshares:ellbase\n\nUSES KEYWORD elliptic_verbose \n",
"schedule": "# Schedule definitions for thorn EllSOR\n# $Header$\n\nschedule EllSOR_Register at CCTK_BASEGRID\n{\n LANG:C\n} \"Register the SOR solvers\"\n",
"src": {
"make.code.defn": "# Main make.code.defn file for thorn EllSOR\n# $Header$\n\n# Source files in this directory\nSRCS = Startup.c Wrapper.c ConfMetric.c Flat.c\n\n# Subdirectories containing source files\nSUBDIRS = \n\n",
"ConfMetric.c": " /*@@\n @file ConfMetric.c\n @date Tue Sep 26 11:29:18 2000\n @author Gerd Lanfermann\n @desc \n Provides sor solver engine routines\n @enddesc \n @@*/\n\n#include <stdlib.h>\n#include <stdio.h>\n#include <math.h>\n#include <string.h>\n\n#include \"cctk.h\"\n#include \"cctk_Arguments.h\"\n#include \"cctk_Parameters.h\"\n\n#include \"Boundary.h\"\n#include \"Symmetry.h\"\n#include \"Ell_DBstructure.h\"\n#include \"EllBase.h\"\n\nstatic const char *rcsid = \"$Header$\";\n\nCCTK_FILEVERSION(CactusElliptic_EllSOR_ConfMetric_c)\n\n#define SQR(a) ((a)*(a))\n\n/********************************************************************\n ********************* Local Data Types ***********************\n ********************************************************************/\n\n/********************************************************************\n ********************* Local Routine Prototypes *********************\n ********************************************************************/\n\nint SORConfMetric3D(cGH *GH, int *MetricPsiI, int conformal,\n int FieldIndex, int MIndex, int NIndex,\n CCTK_REAL *AbsTol, CCTK_REAL *RelTol);\n\n/********************************************************************\n ***************** Scheduled Routine Prototypes *********************\n ********************************************************************/\n\n/********************************************************************\n ********************* Other Routine Prototypes *********************\n ********************************************************************/\n\n/********************************************************************\n ********************* Local Data *****************************\n ********************************************************************/\n\n/* static int firstcall = 1; */\n\n/********************************************************************\n ********************* External Routines **********************\n ********************************************************************/\n\n\n /*@@\n @routine SORConfMetric3D\n @date Tue Sep 26 11:28:08 2000\n @author Joan Masso, Paul Walker, Gerd Lanfermann\n @desc \n This is a standalone sor solver engine, \n called by the wrapper functions\n @enddesc \n @calls \n @calledby \n @history \n \n @endhistory \n\n@@*/\n\nint SORConfMetric3D(cGH *GH, int *MetricPsiI, int conformal,\n int FieldIndex, int MIndex, int NIndex,\n CCTK_REAL *AbsTol, CCTK_REAL *RelTol)\n{\n DECLARE_CCTK_PARAMETERS \n\n int retval = ELL_SUCCESS;\n int timelevel;\n int origin_sign;\n\n /* The pointer to the metric fields */\n CCTK_REAL *gxx =NULL, *gxy =NULL; \n CCTK_REAL *gxz =NULL, *gyy =NULL; \n CCTK_REAL *gyz =NULL, *gzz =NULL; \n CCTK_REAL *psi =NULL;\n CCTK_REAL *Mlin=NULL, *Nlin=NULL; \n CCTK_REAL *var =NULL; \n\n /* The inverse metric, allocated here */\n CCTK_REAL *uxx=NULL, *uyy=NULL, \n *uzz=NULL, *uxz=NULL,\n *uxy=NULL, *uyz=NULL;\n\n /* shortcuts for metric, psi, deltas, etc. */\n CCTK_REAL pm4, p12, det;\n\n CCTK_REAL dx,dy,dz;\n CCTK_REAL dxdx, dydy, dzdz, \n dxdy, dxdz, dydz;\n\n /* Some physical variables */\n CCTK_REAL omega, resnorm=0.0, residual=0.0;\n CCTK_REAL glob_residual=0.0, rjacobian=0.0; \n CCTK_REAL finf;\n CCTK_INT npow;\n CCTK_REAL tol;\n\n /* Iteration / stepping variables */\n int sorit;\n CCTK_INT maxit; \n int i,j,k;\n int nxyz;\n \n /* 19 point stencil index */\n int ijk;\n int ipjk, ijpk, ijkp, imjk, ijmk, ijkm;\n int ipjpk, ipjmk, imjpk, imjmk;\n int ipjkp, ipjkm, imjkp, imjkm;\n int ijpkp, ijpkm, ijmkp, ijmkm;\n \n /* 19 point stencil coefficients */\n CCTK_REAL ac;\n CCTK_REAL ae,aw,an,as,at,ab;\n CCTK_REAL ane, anw, ase, asw, ate, atw, abe, abw;\n CCTK_REAL atn, ats, abn, absol;\n\n /* Miscellaneous */\n int sum_handle=-1;\n int sw[3], ierr;\n int Mstorage=0, Nstorage=0;\n size_t varsize;\n CCTK_REAL detrec_pm4, sqrtdet;\n char *robin=NULL;\n char *sor_accel=NULL;\n const void* input_array[1];\n void* reduction_value[1];\n CCTK_INT input_array_dim[1];\n CCTK_INT input_array_type_codes[1];\n\n input_array[0] = &resnorm;\n reduction_value[0] = &glob_residual;\n input_array_type_codes[0] = CCTK_VARIABLE_REAL;\n \n /* Get the reduction handle */\n sum_handle = CCTK_LocalArrayReductionHandle(\"sum\");\n if (sum_handle<0) \n {\n CCTK_WARN(1,\"SORConfMetric3D: \"\n \"Cannot get handle for sum reduction\");\n retval = ELL_FAILURE;\n }\n\n /* If Robin BCs are set, prepare for a boundary call:\n setup stencil width and get Robin constants (set by the routine\n which is calling the solver interface) */\n if (conformal)\n {\n if (Ell_GetStrKey(&robin, \"EllLinConfMetric::Bnd::Robin\")< 0)\n {\n CCTK_WARN(2,\"SORConfMetric3D: Robin keys not set for LinConfMetric solver\");\n }\n }\n else\n {\n if (Ell_GetStrKey(&robin, \"EllLinMetric::Bnd::Robin\")< 0)\n {\n CCTK_WARN(2,\"SORConfMetric3D: Robin keys not set for LinMetric solver\");\n }\n }\n \n if (robin && CCTK_EQUALS(robin,\"yes\")) \n { \n sw[0]=1; \n sw[1]=1; \n sw[2]=1;\n \n if (conformal)\n {\n ierr = Ell_GetRealKey(&finf, \"EllLinConfMetric::Bnd::Robin::inf\");\n if (ierr < 0)\n {\n CCTK_WARN(1,\"EllLinConfMetric::Bnd::Robin::inf is not set\");\n }\n ierr = Ell_GetIntKey (&npow, \"EllLinConfMetric::Bnd::Robin::falloff\");\n if (ierr < 0)\n {\n CCTK_WARN(1,\"EllLinConfMetric::Bnd::Robin::falloff is not set\");\n }\n }\n else\n {\n ierr = Ell_GetRealKey(&finf, \"EllLinMetric::Bnd::Robin::inf\");\n if (ierr < 0)\n {\n CCTK_WARN(1,\"EllLinMetric::Bnd::Robin::inf is not set\");\n }\n ierr = Ell_GetIntKey (&npow, \"EllLinMetric::Bnd::Robin::falloff\");\n if (ierr < 0)\n {\n CCTK_WARN(1,\"EllLinMetric::Bnd::Robin::falloff is not set\");\n }\n }\n }\n\n /* Get the maximum number of iterations allowed. */\n if (Ell_GetIntKey(&maxit, \"Ell::SORmaxit\") == ELLGET_NOTSET)\n {\n CCTK_WARN(1,\"SORConfMetric3D: Ell::SORmaxit not set. \"\n \"Maximum allowed iterations being set to 100.\");\n maxit = 100;\n }\n\n /* Only supports absolute tolerance */\n tol = AbsTol[0];\n\n /* Get the type of acceleration to use. */\n if (Ell_GetStrKey(&sor_accel, \"Ell::SORaccel\") == ELLGET_NOTSET)\n {\n const char tmpstr[6] = \"const\";\n CCTK_WARN(3,\"SORConfMetric3D: Ell::SORaccel not set. \"\n \"Omega being set to a constant value of 1.8.\");\n sor_accel = strdup(tmpstr);\n }\n\n if (CCTK_Equals(elliptic_verbose, \"yes\"))\n {\n if (conformal)\n {\n CCTK_VInfo(CCTK_THORNSTRING,\"SOR solver for linear conformal metric (to tolerance %f)\",tol);\n }\n else\n {\n CCTK_VInfo(CCTK_THORNSTRING,\"SOR solver for linear metric (to tolerance %f)\",tol);\n }\n }\n\n /* Things to do only once! \n if (firstcall==1) \n {\n if (CCTK_Equals(elliptic_verbose, \"yes\"))\n {\n if (CCTK_Equals(sor_accel, \"cheb\"))\n {\n CCTK_INFO(\"SOR with Chebyshev acceleration\");\n }\n else if (CCTK_Equals(sor_accel, \"const\"))\n {\n CCTK_INFO(\"SOR with hardcoded omega = 1.8\");\n }\n else if (CCTK_Equals(sor_accel, \"none\"))\n {\n CCTK_INFO(\"SOR with unaccelerated relaxation (omega = 1)\");\n }\n else\n {\n CCTK_WARN(0, \"SORConfMetric3D: sor_accel not set\");\n }\n }\n firstcall = 0;\n }*/\n\n /* \n Get the data ptr of these GFs.\n They all have to be on the same timelevel. \n Derive the metric data pointer from the index array. \n Note the ordering in the metric \n */\n\n timelevel = 0;\n var = (CCTK_REAL*) CCTK_VarDataPtrI(GH, timelevel, FieldIndex);\n if (!var)\n {\n CCTK_WARN(0,\"Invalid data for Field\");\n }\n\n timelevel = 0;\n gxx = (CCTK_REAL*) CCTK_VarDataPtrI(GH, timelevel, MetricPsiI[0]);\n gxy = (CCTK_REAL*) CCTK_VarDataPtrI(GH, timelevel, MetricPsiI[1]);\n gxz = (CCTK_REAL*) CCTK_VarDataPtrI(GH, timelevel, MetricPsiI[2]);\n gyy = (CCTK_REAL*) CCTK_VarDataPtrI(GH, timelevel, MetricPsiI[3]);\n gyz = (CCTK_REAL*) CCTK_VarDataPtrI(GH, timelevel, MetricPsiI[4]);\n gzz = (CCTK_REAL*) CCTK_VarDataPtrI(GH, timelevel, MetricPsiI[5]);\n if (!(gxx&&gyy&&gzz&&gxy&&gxz&&gyz))\n {\n CCTK_WARN(0,\"Invalid data for Metric\");\n }\n\n if (conformal)\n {\n timelevel = 0;\n psi = NULL;\n psi = (CCTK_REAL*) CCTK_VarDataPtrI(GH, timelevel, MetricPsiI[6]);\n if (!psi)\n {\n CCTK_WARN(0,\"Invalid data for conformal factor\");\n }\n\n }\n\n /* if we have a negative index for M/N, this GF is not needed, \n there for don't even look for it. when index positive,\n set flag Mstorage=1, dito for N */\n if (MIndex>=0) \n { \n timelevel = 0;\n Mlin = (CCTK_REAL*) CCTK_VarDataPtrI(GH,timelevel,MIndex);\n if (Mlin)\n {\n Mstorage = 1;\n }\n else\n {\n CCTK_WARN(0, \"SORConfMetric3D: Unable to get pointer to M.\");\n }\n }\n if (NIndex>=0) \n {\n timelevel = 0;\n Nlin = (CCTK_REAL*) CCTK_VarDataPtrI(GH,timelevel,NIndex);\n if (Nlin)\n {\n Nstorage = 1;\n }\n else\n {\n CCTK_WARN(0, \"SORConfMetric3D: Unable to get pointer to N.\");\n }\n }\n\n /* Shortcuts */\n dx = GH->cctk_delta_space[0];\n dy = GH->cctk_delta_space[1];\n dz = GH->cctk_delta_space[2];\n nxyz = GH->cctk_lsh[0]*GH->cctk_lsh[1]*GH->cctk_lsh[2];\n\n /* Allocate the inverse metric */\n varsize = (size_t)CCTK_VarTypeSize(CCTK_VarTypeI(FieldIndex))*nxyz;\n uxx = (CCTK_REAL*) malloc(varsize);\n uxy = (CCTK_REAL*) malloc(varsize);\n uxz = (CCTK_REAL*) malloc(varsize);\n uyy = (CCTK_REAL*) malloc(varsize);\n uyz = (CCTK_REAL*) malloc(varsize);\n uzz = (CCTK_REAL*) malloc(varsize);\n\n if (!uxx || !uxy || !uxz || !uyy || !uyz || !uzz)\n {\n CCTK_WARN(0,\"SORConfMetric3D: Memory allocation failed for upper metric\");\n }\n \n /* calculate the differential coefficient */\n dxdx = 0.5/(dx*dx);\n dydy = 0.5/(dy*dy);\n dzdz = 0.5/(dz*dz);\n dxdy = 0.25/(dx*dy);\n dxdz = 0.25/(dx*dz);\n dydz = 0.25/(dy*dz);\n\n /* Calculate the inverse metric */\n for (ijk=0; ijk<nxyz; ijk++) \n {\n det = -(SQR(gxz[ijk])*gyy[ijk]) + \n 2*gxy[ijk]*gxz[ijk]*gyz[ijk] - \n gxx[ijk]*SQR(gyz[ijk]) -\n SQR(gxy[ijk])*gzz[ijk] + \n gxx[ijk]*gyy[ijk]*gzz[ijk];\n \n if (conformal) \n {\n pm4 = 1.0/pow(psi[ijk],4.0);\n p12 = pow(psi[ijk],12.0);\n } \n else \n {\n pm4 = 1.0;\n p12 = 1.0;\n }\n\n /* try to avoid constly division */\n detrec_pm4 = 1.0/det*pm4;\n sqrtdet = sqrt(det);\n\n uxx[ijk]=(-SQR(gyz[ijk]) + gyy[ijk]*gzz[ijk])*detrec_pm4;\n uxy[ijk]=( gxz[ijk]*gyz[ijk] - gxy[ijk]*gzz[ijk])*detrec_pm4;\n uxz[ijk]=(-gxz[ijk]*gyy[ijk] + gxy[ijk]*gyz[ijk])*detrec_pm4;\n uyy[ijk]=(-SQR(gxz[ijk]) + gxx[ijk]*gzz[ijk])*detrec_pm4;\n uyz[ijk]=( gxy[ijk]*gxz[ijk] - gxx[ijk]*gyz[ijk])*detrec_pm4;\n uzz[ijk]=(-SQR(gxy[ijk]) + gxx[ijk]*gyy[ijk])*detrec_pm4;\n \n det = det*p12;\n sqrtdet= sqrt(det);\n \n /* Rescaling for the uppermetric solver */\n if (Mstorage) \n {\n Mlin[ijk] = Mlin[ijk]*sqrt(det);\n }\n if (Nstorage)\n {\n Nlin[ijk] = Nlin[ijk]*sqrt(det);\n }\n \n uxx[ijk]=uxx[ijk]*dxdx*sqrtdet;\n uyy[ijk]=uyy[ijk]*dydy*sqrtdet;\n uzz[ijk]=uzz[ijk]*dzdz*sqrtdet;\n uxy[ijk]=uxy[ijk]*dxdy*sqrtdet;\n uxz[ijk]=uxz[ijk]*dxdz*sqrtdet;\n uyz[ijk]=uyz[ijk]*dydz*sqrtdet;\n\n } \n\n /* Initialize omega. */\n /* TODO: Make it so that the value of the constant omega can be set. */\n if (CCTK_Equals(sor_accel, \"const\"))\n {\n omega = 1.8;\n }\n else\n {\n omega = 1.;\n }\n\n /* Set the spectral radius of the Jacobi iteration. */\n rjacobian = 0.999;\n\n /* Compute whether the origin of this processor's \n sub grid is \"red\" or \"black\". */\n\n origin_sign = (GH->cctk_lbnd[0] + GH->cctk_lbnd[1] + GH->cctk_lbnd[2])%2;\n\n /* start at 1 for historic (Fortran) reasons */\n for (sorit=1; sorit<=maxit; sorit++)\n {\n resnorm = 0.0;\n\n for (k=1; k<GH->cctk_lsh[2]-1; k++) \n {\n for (j=1; j<GH->cctk_lsh[1]-1; j++) \n {\n for (i=1; i<GH->cctk_lsh[0]-1; i++) \n {\n if ((origin_sign+i+j+k)%2 == sorit%2)\n {\n ijk = CCTK_GFINDEX3D(GH,i ,j ,k );\n\n ipjk = CCTK_GFINDEX3D(GH,i+1,j ,k );\n imjk = CCTK_GFINDEX3D(GH,i-1,j ,k );\n ijpk = CCTK_GFINDEX3D(GH,i ,j+1,k );\n ijmk = CCTK_GFINDEX3D(GH,i ,j-1,k );\n ijkp = CCTK_GFINDEX3D(GH,i ,j ,k+1);\n ijkm = CCTK_GFINDEX3D(GH,i ,j ,k-1);\n\n ipjpk = CCTK_GFINDEX3D(GH,i+1,j+1,k );\n ipjmk = CCTK_GFINDEX3D(GH,i+1,j-1,k );\n imjpk = CCTK_GFINDEX3D(GH,i-1,j+1,k );\n imjmk = CCTK_GFINDEX3D(GH,i-1,j-1,k );\n \n ijpkp = CCTK_GFINDEX3D(GH,i ,j+1,k+1);\n ijpkm = CCTK_GFINDEX3D(GH,i ,j+1,k-1);\n ijmkp = CCTK_GFINDEX3D(GH,i ,j-1,k+1);\n ijmkm = CCTK_GFINDEX3D(GH,i ,j-1,k-1);\n \n ipjkp = CCTK_GFINDEX3D(GH,i+1,j ,k+1);\n ipjkm = CCTK_GFINDEX3D(GH,i+1,j ,k-1);\n imjkp = CCTK_GFINDEX3D(GH,i-1,j ,k+1);\n imjkm = CCTK_GFINDEX3D(GH,i-1,j ,k-1);\n\n ac = -1.0*uxx[ipjk] - 2.0*uxx[ijk] - 1.0*uxx[imjk]\n -1.0*uyy[ijpk] - 2.0*uyy[ijk] - 1.0*uyy[ijmk]\n -1.0*uzz[ijkp] - 2.0*uzz[ijk] - 1.0*uzz[ijkm];\n \n if (Mstorage) \n {\n ac += Mlin[ijk];\n }\n\n ae = uxx[ipjk]+uxx[ijk];\n aw = uxx[imjk]+uxx[ijk];\n an = uyy[ijpk]+uyy[ijk];\n as = uyy[ijmk]+uyy[ijk];\n at = uzz[ijkp]+uzz[ijk];\n ab = uzz[ijkm]+uzz[ijk];\n \n ane = uxy[ijpk]+uxy[ipjk];\n anw =-uxy[imjk]-uxy[ijpk];\n ase =-uxy[ipjk]-uxy[ijmk];\n asw = uxy[imjk]+uxy[ijmk];\n \n ate = uxz[ijkp]+uxz[ipjk];\n atw =-uxz[imjk]-uxz[ijkp];\n abe =-uxz[ipjk]-uxz[ijkm];\n abw = uxz[imjk]+uxz[ijkm];\n \n atn = uyz[ijpk]+uyz[ijkp]; \n ats =-uyz[ijkp]-uyz[ijmk];\n abn =-uyz[ijkm]-uyz[ijpk];\n absol = uyz[ijkm]+uyz[ijmk];\n \n residual = ac * var[ijk]\n + ae *var[ipjk] + aw*var[imjk]\n + an *var[ijpk] + as*var[ijmk]\n + at *var[ijkp] + ab*var[ijkm];\n \n residual = residual \n + ane*var[ipjpk] + anw*var[imjpk]; \n \n residual = residual \n + ase*var[ipjmk] + asw*var[imjmk];\n\n residual = residual \n + ate*var[ipjkp] + atw*var[imjkp] \n + abe*var[ipjkm] + abw*var[imjkm]\n + atn*var[ijpkp] + ats*var[ijmkp]\n + abn*var[ijpkm] + absol*var[ijmkm];\n\n if (Nstorage)\n {\n residual +=Nlin[ijk];\n }\n\n resnorm = resnorm + fabs(residual);\n\n var[ijk] = var[ijk] - omega*residual/ac; \n\n }\n }\n }\n }\n\n /* reduction operation on processor-local residual values */\n ierr = CCTK_ReduceArraysGlobally(GH, -1,sum_handle, -1, 1,input_array,0,\n input_array_dim,\n input_array_type_codes,\n 1,\n input_array_type_codes,\n reduction_value);\n\t\t\t \n if (ierr<0) \n {\n CCTK_WARN(1,\"SORConfMetric3D: Reduction of residual failed\");\n }\n\n glob_residual = glob_residual / \n (GH->cctk_gsh[0]*GH->cctk_gsh[1]*GH->cctk_gsh[2]);\n\n /* apply symmetry boundary conditions within loop */ \n if (CartSymVI(GH,FieldIndex)<0) \n {\n CCTK_WARN(1,\"SORConfMetric3D: CartSymVI failed in EllSOR loop\");\n }\n\n /* apply Robin boundary conditions within loop */\n if (robin && CCTK_EQUALS(robin,\"yes\")) \n {\n if (BndRobinVI(GH, sw, finf, npow, FieldIndex)<0)\n {\n CCTK_WARN(1, \"SORConfMetric3D: BndRobinVI failed in EllSOR loop\");\n break;\n }\n }\n\n /* synchronization of grid variable */\n ierr = CCTK_SyncGroupWithVarI(GH, FieldIndex);\n if (ierr < 0)\n {\n CCTK_VWarn(1,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"ConfMetric3D: Synchronization of %s failed (Error: %d)\",\n CCTK_VarName(FieldIndex),ierr);\n }\n\n /* Leave iteration loop if tolerance criterium is met */\n if (glob_residual<tol)\n {\n break;\n }\n\n /* Update omega if using Chebyshev acceleration. */\n if (CCTK_Equals(sor_accel, \"cheb\"))\n {\n if (sorit == 1)\n {\n omega = 1. / (1. - 0.5 * rjacobian * rjacobian);\n }\n else\n {\n omega = 1. / (1. - 0.25 * rjacobian * rjacobian * omega);\n }\n }\n\n if (CCTK_Equals(elliptic_verbose,\"debug\"))\n {\n CCTK_VInfo(CCTK_THORNSTRING,\" .. residual at %f\",glob_residual);\n }\n }\n\n if (CCTK_Equals(elliptic_verbose,\"yes\"))\n {\n CCTK_VInfo(CCTK_THORNSTRING,\" ... achieved SOR residual %f (at %d iterations)\",glob_residual,sorit);\n }\n\n if (glob_residual>tol) \n {\n CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, \n \"SOR Solver did not converge (reached tol:%f at %d iterations, requested tol:%f\",glob_residual,sorit,tol);\n retval = ELL_NOCONVERGENCE;\n }\n\n if (uxx) \n {\n free(uxx); \n }\n if (uyy) \n {\n free(uyy); \n }\n if (uzz)\n { \n free(uzz);\n }\n if (uxy) \n {\n free(uxy); \n }\n if (uxz) \n {\n free(uxz); \n }\n if (uyz) \n {\n free(uyz);\n }\n if (robin) \n {\n free(robin);\n }\n if (sor_accel) \n {\n free(sor_accel);\n }\n\n return retval;\n}\n",
"Flat.c": " /*@@\n @file Flat.c\n @date Tue Aug 24 12:50:07 1999\n @author Gerd Lanfermann\n @desc \n SOR solver for 3D flat equation\n @enddesc \n @@*/\n\n/*#define DEBUG_ELLIPTIC*/\n\n#include <stdlib.h> \n#include <stdio.h>\n#include <math.h>\n#include <string.h>\n\n#include \"cctk.h\"\n#include \"cctk_Parameters.h\"\n\n#include \"Boundary.h\"\n#include \"Symmetry.h\"\n#include \"Ell_DBstructure.h\"\n#include \"EllBase.h\"\n\nstatic const char *rcsid = \"$Header$\";\n\nCCTK_FILEVERSION(CactusElliptic_EllSOR_Flat_c)\n \nint SORFlat3D(cGH *GH, int FieldIndex, int MIndex, int NIndex,\n CCTK_REAL *AbsTol, CCTK_REAL *RelTol);\n\nint SORFlat3D(cGH *GH, int FieldIndex, int MIndex, int NIndex,\n CCTK_REAL *AbsTol, CCTK_REAL *RelTol)\n{\n DECLARE_CCTK_PARAMETERS\n\n int retval = ELL_SUCCESS;\n\n /* The pointer to the data fields */\n CCTK_REAL *Mlin=NULL;\n CCTK_REAL *Nlin=NULL; \n CCTK_REAL *var =NULL; \n\n /* shortcuts for deltas,etc. */\n CCTK_REAL dx,dy,dz; \n\n /* Some physical variables */\n CCTK_REAL omega, resnorm, residual, glob_residual, rjacobian; \n CCTK_REAL finf;\n CCTK_INT npow;\n CCTK_REAL tol;\n\n /* Iteration and stepping variables */\n int sorit;\n CCTK_INT maxit;\n int i, j, k;\n int origin_sign;\n\n /* stencil index */\n int ijk;\n int ipjk, ijpk, ijkp, imjk, ijmk, ijkm;\n\n /* Coefficients for the stencil... */\n CCTK_REAL ac,ac_orig,aw,ae,an,as,at,ab;\n \n /* Miscellaneous */\n int sum_handle;\n int sw[3];\n int Mstorage=0, Nstorage=0;\n static int firstcall = 1;\n CCTK_REAL dx2rec, dy2rec, dz2rec; \n char *robin = NULL;\n char *sor_accel = NULL;\n int ierr = 0;\n const void* input_array[1];\n void* reduction_value[1];\n CCTK_INT input_array_dim[1];\n CCTK_INT input_array_type_codes[1];\n\n /* Boundary conditions */\n int use_robin = 0;\n \n input_array[0] = (CCTK_REAL *)&resnorm;\n input_array_dim[0] = 0;\n reduction_value[0] = (CCTK_REAL *)&glob_residual;\n input_array_type_codes[0] = CCTK_VARIABLE_REAL;\n \n /* Avoid compiler warnings */\n RelTol = RelTol;\n\n /* Get the reduction handle */\n sum_handle = CCTK_LocalArrayReductionHandle(\"sum\");\n if (sum_handle<0) \n {\n CCTK_WARN(1,\"SORFlat3D: Cannot get reduction handle for sum operation\");\n }\n\n /* IF Robin BCs are set, prepare for a boundary call:\n setup stencil width and get Robin constants (set by the routine\n which is calling the solver interface) */\n\n if (Ell_GetStrKey(&robin,\"EllLinFlat::Bnd::Robin\") < 0)\n {\n CCTK_WARN(2,\"SORFlat3D: Robin keys not set\");\n }\n else\n {\n if (CCTK_Equals(robin,\"yes\"))\n {\n use_robin = 1;\n\n sw[0]=1; \n sw[1]=1; \n sw[2]=1;\n\n if (Ell_GetRealKey(&finf, \"EllLinFlat::Bnd::Robin::inf\") == \n ELLGET_NOTSET)\n {\n CCTK_WARN(1,\"SORFlat3D: EllLinFlat::Bnd::Robin::inf not set, \"\n \"setting to 1\");\n finf = 1;\n }\n if (Ell_GetIntKey(&npow, \"EllLinFlat::Bnd::Robin::falloff\") \n == ELLGET_NOTSET)\n {\n CCTK_WARN(1,\"SORFlat3D: EllLinFlat::Bnd::Robin::falloff not set, \"\n \"setting to 1\");\n npow = 1;\n }\n }\n }\n\n /* Get the maximum number of iterations allowed. */\n if (Ell_GetIntKey(&maxit, \"Ell::SORmaxit\") == ELLGET_NOTSET)\n {\n CCTK_WARN(1,\"SORFlat3D: Ell::SORmaxit not set. \"\n \"Maximum allowed iterations being set to 100.\");\n maxit = 100;\n }\n \n /* Only supports absolute tolerance */\n tol = AbsTol[0];\n\n /* Get the type of acceleration to use. */\n if (Ell_GetStrKey(&sor_accel, \"Ell::SORaccel\") == ELLGET_NOTSET)\n {\n const char tmpstr[6] = \"const\";\n CCTK_WARN(3, \"SORFlat3D: Ell::SORaccel not set. \"\n \"Omega being set to a constant value of 1.8.\");\n sor_accel = strdup(tmpstr);\n }\n\n /* Things to do only once! */\n /* TODO: Need to handle this differently, since it may be called\n for different reasons by the same code. */\n if (firstcall==1) \n {\n if (CCTK_Equals(elliptic_verbose, \"yes\"))\n {\n if (CCTK_Equals(sor_accel, \"cheb\"))\n {\n CCTK_INFO(\"SOR with Chebyshev acceleration\");\n }\n else if (CCTK_Equals(sor_accel, \"const\"))\n {\n CCTK_INFO(\"SOR with hardcoded omega = 1.8\");\n }\n else if (CCTK_Equals(sor_accel, \"none\"))\n {\n CCTK_INFO(\"SOR with unaccelerated relaxation (omega = 1)\");\n }\n else\n {\n CCTK_WARN(0, \"SORFlat3D: sor_accel not set\");\n }\n }\n firstcall = 0;\n }\n\n /* Get the data ptr of these GFs, They all have to be\n on the same timelevel; if we have a negative index for M/N, \n this GF is not set, there for don't even look for it and flag it */\n\n var = (CCTK_REAL *)CCTK_VarDataPtrI(GH, 0, FieldIndex);\n if (var == NULL)\n {\n CCTK_WARN(0, \"SORFlat3D: Unable to get pointer to GF variable\");\n }\n\n if (MIndex>=0) \n { \n Mlin = (CCTK_REAL *)CCTK_VarDataPtrI(GH, 0, MIndex);\n if (Mlin)\n {\n Mstorage = 1;\n }\n else\n {\n CCTK_WARN(0, \"SORFlat3D: Unable to get pointer to M\");\n }\n }\n\n if (NIndex>=0) \n {\n Nlin = (CCTK_REAL *)CCTK_VarDataPtrI(GH, 0, NIndex);\n if (Nlin)\n {\n Nstorage = 1;\n }\n else\n {\n CCTK_WARN(0, \"SORFlat3D: Unable to get pointer to N\");\n }\n }\n\n /* Shortcuts */\n dx = GH->cctk_delta_space[0];\n dy = GH->cctk_delta_space[1];\n dz = GH->cctk_delta_space[2];\n \n dx2rec = 1.0/(dx*dx);\n dy2rec = 1.0/(dy*dy);\n dz2rec = 1.0/(dz*dz);\n\n ae = dx2rec;\n aw = dx2rec;\n an = dy2rec;\n as = dy2rec;\n at = dz2rec;\n ab = dz2rec;\n\n ac_orig = -2.0*dx2rec - 2.0*dy2rec - 2.0*dz2rec;\n\n /* Initialize omega. */\n /* TODO: Make it so that the value of the constant omega can be set. */\n if (CCTK_Equals(sor_accel, \"const\"))\n {\n omega = 1.8;\n }\n else\n {\n omega = 1.;\n }\n\n /* Set the spectral radius of the Jacobi iteration. */\n /* TODO: I think this can be easily computed for flat metrics? */\n rjacobian = 0.999;\n\n /* Compute whether the origin of this processor's sub grid is \"red\" or\n \"black\". */\n origin_sign = (GH->cctk_lbnd[0] + GH->cctk_lbnd[1] + GH->cctk_lbnd[2])%2;\n\n /* start at 1 for historic (Fortran) reasons */\n for (sorit=1; sorit<=maxit; sorit++) \n {\n resnorm = 0.;\n \n for (k=1; k<GH->cctk_lsh[2]-1; k++) \n {\n for (j=1; j<GH->cctk_lsh[1]-1; j++) \n {\n for (i=1; i<GH->cctk_lsh[0]-1; i++) \n {\n if ((origin_sign + i + j + k)%2 == sorit%2)\n {\n ac = ac_orig;\n\n ijk = CCTK_GFINDEX3D(GH,i ,j ,k );\n ipjk = CCTK_GFINDEX3D(GH,i+1,j ,k );\n imjk = CCTK_GFINDEX3D(GH,i-1,j ,k );\n ijpk = CCTK_GFINDEX3D(GH,i ,j+1,k );\n ijmk = CCTK_GFINDEX3D(GH,i ,j-1,k );\n ijkp = CCTK_GFINDEX3D(GH,i ,j ,k+1);\n ijkm = CCTK_GFINDEX3D(GH,i ,j ,k-1);\n \n if (Mstorage)\n {\n ac += Mlin[ijk];\n }\n\n residual = ac * var[ijk]\n + ae*var[ipjk] + aw*var[imjk]\n + an*var[ijpk] + as*var[ijmk]\n + at*var[ijkp] + ab*var[ijkm];\n\n if (Nstorage)\n {\n residual += Nlin[ijk];\n }\n\n resnorm += fabs(residual);\n\n var[ijk] -= omega*residual/ac; \n }\n }\n }\n }\n \n /* reduction operation on processor-local residual values */\n ierr = CCTK_ReduceArraysGlobally(GH, -1,sum_handle, -1, 1,input_array,0,\n input_array_dim,\n input_array_type_codes,\n 1,\n input_array_type_codes,\n reduction_value);\n\n if (ierr<0) \n {\n CCTK_WARN(1,\"SORFlat3D: Reduction of Norm failed\");\n }\n\n#ifdef DEBUG_ELLIPTIC\n printf(\"it: %d SOR solve residual %f (tol %f)\\n\",sorit,glob_residual,tol);\n#endif\n\n glob_residual /= (GH->cctk_gsh[0]*GH->cctk_gsh[1]*GH->cctk_gsh[2]);\n\n\n#ifdef DEBUG_ELLIPTIC\n printf(\"it: %d SOR solve residual %f (tol %f)\\n\",sorit,glob_residual,tol);\n#endif\n\n /* apply symmetry boundary conditions within loop */ \n if (CartSymVI(GH,FieldIndex)<0)\n { \n CCTK_WARN(1,\"SORFlat3D: CartSymVI failed in EllSOR loop\");\n break;\n }\n\n /* apply Robin boundary conditions within loop */\n if (use_robin)\n {\n if (BndRobinVI(GH, sw, finf, npow, FieldIndex)<0)\n { \n CCTK_WARN(1,\"SORFlat3D: BndRobinVI failed in EllSOR loop\");\n break;\n }\n }\n\n /* synchronization of grid variable */\n CCTK_SyncGroupWithVarI(GH, FieldIndex);\n\n /* Leave iteration loop if tolerance criterium is met */\n if (glob_residual<tol)\n {\n break;\n }\n\n /* Update omega if using Chebyshev acceleration. */\n if (CCTK_Equals(sor_accel, \"cheb\"))\n {\n if (sorit == 1)\n {\n omega = 1. / (1. - 0.5 * rjacobian * rjacobian);\n }\n else\n {\n omega = 1. / (1. - 0.25 * rjacobian * rjacobian * omega);\n }\n }\n \n }\n\n if (elliptic_verbose)\n {\n CCTK_VInfo(\"EllSOR\",\"Required SOR tolerence was set at %f\",tol);\n CCTK_VInfo(\"EllSOR\",\"Achieved SOR residual was %f\",glob_residual);\n CCTK_VInfo(\"EllSOR\",\"Number of iterations was %d (max: %d)\",\n (int)sorit,(int)maxit);\n }\n \n if (glob_residual>tol) \n {\n CCTK_WARN(1,\"SORFlat3D: SOR Solver did not converge\");\n retval = ELL_NOCONVERGENCE;\n }\n\n if (use_robin) \n {\n free(robin);\n }\n if (sor_accel)\n { \n free(sor_accel);\n }\n\n return retval;\n}\n",
"Wrapper.c": " /*@@\n @file Wrapper.c\n @date Tue Aug 24 12:50:07 1999\n @author Gerd Lanfermann\n @desc \n The C wrapper, which calles the core Fortran routine, which \n performs the actual solve.\n We cannot derive the pointers to the GF data from the indices in \n Fortran. So we do this here in C and then pass the everything \n over to the Fortran routine.\n\n This wrapper is registers with the Elliptic solver registry \n (not the Fortran file) , as coded up in ./CactusElliptic/EllBase\n @enddesc \n @@*/\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n#include \"cctk.h\"\n#include \"cctk_Parameters.h\"\n#include \"cctk_FortranString.h\"\n\n#include \"EllBase.h\"\n\nstatic const char *rcsid = \"$Header$\";\n\nCCTK_FILEVERSION(CactusElliptic_EllSOR_Wrapper_c)\n\nint SORFlat3D(cGH *GH, int FieldIndex, int MIndex, int NIndex,\n CCTK_REAL *AbsTol, CCTK_REAL *RelTol);\nint SORConfMetric3D(cGH *GH, int *MetricPsiI, int conformal,\n int FieldIndex, int MIndex, int NIndex,\n CCTK_REAL *AbsTol, CCTK_REAL *RelTol);\nint SORConfMetric(cGH *GH, \n int *MetricPsiI, \n int FieldIndex, \n int MIndex, \n int NIndex, \n CCTK_REAL *AbsTol,\n CCTK_REAL *RelTol);\nint SORFlat(cGH *GH, \n int FieldIndex, \n int MIndex, \n int NIndex, \n CCTK_REAL *AbsTol, \n CCTK_REAL *RelTol);\n\n/*@@\n @routine SORConfMetric\n @date Tue Sep 26 11:31:42 2000\n @author Gerd Lanfermann\n @desc \n elliptic solver wrapper which provides a interface to the \n different n-dimensional SOR solvers for the conformal metric, \n of which only 3D is coded currently.\n\n This wrapper is registered and if it is being called with \n a n-dim. grid function, it goes of and picks the correct solver.\n\n We pass in the arguments that are neccessary for this class of elliptic eq. \n this solver is intended to solve. See ./CactusElliptic/EllBase/src/ for the\n classes of elliptic eq. \n @enddesc \n @calls \n @calledby \n @history \n \n @endhistory \n\n@@*/\n\nint SORConfMetric(cGH *GH, \n int *MetricPsiI, \n int FieldIndex, \n int MIndex, \n int NIndex, \n CCTK_REAL *AbsTol,\n CCTK_REAL *RelTol) \n{\n int retval = ELL_NOSOLVER;\n\n switch (CCTK_GroupDimFromVarI(FieldIndex))\n {\n case 1: \n CCTK_WARN(0,\"SORConfMetric: No 1D SOR solver implemented\");\n break;\n case 2:\n CCTK_WARN(0,\"SORConfMetric: No 2D SOR solver implemented\");\n break;\n case 3:\n retval = SORConfMetric3D(GH, MetricPsiI, 1, \n FieldIndex, MIndex, NIndex,\n AbsTol, RelTol);\n break;\n default:\n CCTK_WARN(1,\"SORConfMetric: Solver only implemented for 3D\");\n break;\n }\n\n return retval;\n}\n \nint SORMetric(cGH *GH, \n int *MetricI, \n int FieldIndex, \n int MIndex, \n int NIndex, \n CCTK_REAL *AbsTol,\n CCTK_REAL *RelTol) \n{\n int retval = ELL_NOSOLVER;\n\n switch (CCTK_GroupDimFromVarI(FieldIndex))\n {\n case 1: \n CCTK_WARN(0,\"SORMetric: No 1D SOR solver implemented\");\n break;\n case 2:\n CCTK_WARN(0,\"SORMetric: No 2D SOR solver implemented\");\n break;\n case 3:\n retval = SORConfMetric3D(GH, MetricI, 0, \n FieldIndex, MIndex, NIndex,\n AbsTol, RelTol);\n break;\n default:\n CCTK_WARN(1,\"SORMetric: Solver only implemented for 3D\");\n break;\n }\n\n return retval;\n}\n \n/*@@\n @routine SORFlat\n @date Tue Sep 26 11:31:42 2000\n @author Gerd Lanfermann\n @desc \n Elliptic solver wrapper which provides a interface to the \n different n-dimensional SOR solvers (flat case), \n of which only 3D is coded currently.\n\n This wrapper is registered and if it is being called with \n a n-dimensional grid function, it then picks the correct solver.\n\n We pass in the arguments that are necessary for this class of \n elliptic equations this solver is intended to solve. \n See ./CactusElliptic/EllBase/src/ for the classes of elliptic equations.\n @enddesc \n @calls \n @calledby \n @history \n \n @endhistory \n\n@@*/\n\nint SORFlat(cGH *GH, \n int FieldIndex, \n int MIndex, \n int NIndex, \n CCTK_REAL *AbsTol, \n CCTK_REAL *RelTol) \n{\n int retval;\n\n retval = ELL_NOSOLVER;\n\n switch (CCTK_GroupDimFromVarI(FieldIndex))\n {\n case 1: \n CCTK_WARN(1,\"SORFlat: No 1D SOR solver implemented\");\n break;\n case 2:\n CCTK_WARN(1,\"SORFlat: No 2D SOR solver implemented\");\n break;\n case 3:\n retval = SORFlat3D(GH, FieldIndex, MIndex, NIndex, AbsTol, RelTol);\n break;\n default:\n CCTK_WARN(1,\"SORFlat: Solver only implemented for 3D\");\n break;\n }\n\n return retval;\n\n}\n",
"Startup.c": " /*@@\n @header Startup.c\n @date \n @author \n @desc \n Register known elliptic interfaces\n @enddesc\n @version $Header$\n @@*/\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n#include \"cctk.h\"\n\n#include \"cctk_Arguments.h\"\n#include \"cctk_Parameters.h\"\n\n#include \"CactusElliptic/EllBase/src/EllBase.h\"\n#include \"CactusElliptic/EllBase/src/Ell_DBstructure.h\"\n\nstatic const char *rcsid = \"$Header$\";\n\nCCTK_FILEVERSION(CactusElliptic_EllSOR_Startup_c)\n\n/********************************************************************\n ********************* Local Data Types ***********************\n ********************************************************************/\n\n/********************************************************************\n ********************* Local Routine Prototypes *********************\n ********************************************************************/\n\nvoid EllSOR_Register(CCTK_ARGUMENTS);\nvoid SORConfMetric(cGH *GH, \n int *MetricPsiI, \n int FieldI, \n int MI,\n int NI, \n CCTK_REAL *AbsTol, \n CCTK_REAL *RelTol);\nvoid SORMetric(cGH *GH, \n int *MetricI, \n int FieldI, \n int MI,\n int NI, \n CCTK_REAL *AbsTol, \n CCTK_REAL *RelTol);\nvoid SORFlat(cGH *GH, \n int FieldI,\n int MI, \n int NI, \n CCTK_REAL *AbsTol, \n CCTK_REAL *RelTol);\n\n\n/********************************************************************\n ***************** Scheduled Routine Prototypes *********************\n ********************************************************************/\n\nvoid EllSOR_Register(CCTK_ARGUMENTS);\n \n/********************************************************************\n ********************* Other Routine Prototypes *********************\n ********************************************************************/\n\n/********************************************************************\n ********************* Local Data *****************************\n ********************************************************************/\n\n/********************************************************************\n ********************* External Routines **********************\n ********************************************************************/\n\n/*@@\n @routine EllSOR_Register\n @date \n @author \n @desc \n Scheduled routine to register the SOR solvers SORConfMetric and \n SORFlatunder with the name \"sor\" for the Elliptic Classes \n LinConfMetric and LinFlat\n @enddesc \n @calls \n @calledby \n @history \n \n @endhistory \n \n @@*/\nvoid EllSOR_Register(CCTK_ARGUMENTS) \n{\n\n DECLARE_CCTK_ARGUMENTS \n DECLARE_CCTK_PARAMETERS \n\n int err;\n\n if (Ell_RegisterSolver(SORConfMetric,\"sor\",\"Ell_LinConfMetric\")\n != ELL_SUCCESS)\n {\n CCTK_WARN(0,\n \"EllSOR_Register: Failed to register sor for Ell_LinConfMetric\");\n }\n\n if (Ell_RegisterSolver(SORMetric,\"sor\",\"Ell_LinMetric\")\n != ELL_SUCCESS)\n {\n CCTK_WARN(0,\n \"EllSOR_Register: Failed to register sor for Ell_LinMetric\");\n }\n\n if (Ell_RegisterSolver(SORFlat,\"sor\",\"Ell_LinFlat\") != ELL_SUCCESS)\n {\n CCTK_WARN(0,\"EllSOR_Register: Failed to register sor for Ell_LinFlat\");\n }\n\n /* These \"keys\" have to be same in other elliptic solvers and in \n the routines that sets them ! */\n\n /* Register boundaries which SOR can handle */\n err = Ell_CreateKey(CCTK_VARIABLE_STRING,\"EllLinFlat::Bnd::Robin\");\n if (err == ELLCREATE_FAILED)\n {\n CCTK_VWarn(1,__LINE__,__FILE__,CCTK_THORNSTRING,\n \"EllSOR_Register: Failed to create key EllLinFlat::Bnd::Robin (Error %d)\",err);\n }\n err = Ell_CreateKey(CCTK_VARIABLE_STRING,\"EllLinFlat::Bnd::Const\");\n if (err == ELLCREATE_FAILED)\n {\n CCTK_WARN(1,\n \"EllSOR_Register: Failed to create key EllLinFlat::Bnd::Const\");\n }\n\n /* Create a key for the maximum number of iterations allowed. */\n err = Ell_CreateKey(CCTK_VARIABLE_INT, \"Ell::SORmaxit\");\n if (err == ELLCREATE_FAILED)\n {\n CCTK_WARN(0, \"EllSOR_Register: Failed to create key Ell::SORmaxit\");\n } \n\n /* Create a key for the type of acceleration to be used. */\n err = Ell_CreateKey(CCTK_VARIABLE_STRING, \"Ell::SORaccel\");\n if (err == ELLCREATE_FAILED)\n {\n CCTK_WARN(0, \"EllSOR_Register: Failed to create key Ell::SORaccel\");\n } \n\n}\n"
},
"test": {},
"doc": {
"documentation.tex": "\\documentclass{article}\n\n% Use the Cactus ThornGuide style file\n% (Automatically used from Cactus distribution, if you have a \n% thorn without the Cactus Flesh download this from the Cactus\n% homepage at www.cactuscode.org)\n\\usepackage{../../../../doc/latex/cactus}\n\n\\begin{document}\n\n\\title{EllSOR}\n\\author{Joan Masso}\n\\date{$ $Date$ $}\n\n\\maketitle\n\n% Do not delete next line\n% START CACTUS THORNGUIDE\n\n\\begin{abstract}\n{\\tt EllSOR} provides 3D elliptic solvers for the various\nclasses of elliptic problems defined in {\\tt EllBase}. {\\tt EllSOR} is \nbased on the successive over relaxation algorithm. It is called by the\ninterfaces provided in {\\tt EllBase}.\n\\end{abstract}\n\n\\section{Purpose}\nThe purpose of this thorn is to provide a simple and straightforward\n3D elliptic solver: not to be used by production but to demonstrate key\nfeatures of the elliptic infrastructure.\n\nThis thorn provides\n \\begin{enumerate}\n \\item No Pizza\n \\item No Wine\n \\item peace\n \\end{enumerate}\n\n\\section{Technical Details}\nThis thorn supports three elliptic problem classes: {\\bf LinFlat} for \na standard 3D cartesian Laplace operator, using the standard 7-point\ncomputational molecule. {\\bf LinMetric} for a Laplace operator derived\nfrom the metric, using 19-point stencil. {\\bf LinConfMetric} for a\nLaplace operator derived from the metric and a conformal factor, using \na 19-point stencil. The code of the solvers differs for the classes\nand is explained in the following section. \n\nIn general, a stencil variable needs to be set for each of the\ndirection relative to the central gridpoint. These variables are\ncalled {\\tt ac}, {\\tt ae}, {\\tt aw}, {\\tt an}, {\\tt as}, {\\tt at}, {\\tt ab}, {\\tt\nane}, {\\tt anw}, {\\tt ase}, {\\tt asw}, {\\tt ate}, {\\tt atw}, {\\tt abe}, {\\tt\nabw}, {\\tt atn}, {\\tt ats}, {\\tt abn}, {\\tt asb}, where ``{\\tt ac}'' =\na-central, ``{\\tt t}'' = top, ``{\\tt b}'' = bottom, ``{\\tt n,s,w,e}'' = north, south, west, east\n\n\\subsection{{\\bf LinFlat}}\nFor this class we employ the the 7-point stencil based on {\\tt at,ab,\naw, ae, an, as} only. These values are constant at each gridpoint.\n\n\\subsection{{\\bf LinMetric}}\nFor this class the standard 19-point stencil is initialized, taken the \nunderlying metric into account. The values for the stencil function\ndiffer at each gridpoints.\n\n\\subsection{{\\bf LinConfMetric}}\nFor this class the standard 19-point stencil is initialized, taken the \nunderlying metric and its conformal factor into account. The values\nfor the stencil function differ at each gridpoints.\n\n\\section{Comments}\nThe sizes of the arrays {\\tt Mlinear} for the coefficient matrix and\n{\\tt Nsource} are passed in the solver. A storage flag is set if these \nvariables are of a sized greater 1. In this case, the array can be\naccessed.\n\n%\\section{My own section}\n\n% Do not delete next line\n% END CACTUS THORNGUIDE\n\n\\end{document}\n"
}
}