diff options
author | allen <allen@c78560ca-4b45-4335-b268-5f3340f3cb52> | 1999-07-27 21:20:45 +0000 |
---|---|---|
committer | allen <allen@c78560ca-4b45-4335-b268-5f3340f3cb52> | 1999-07-27 21:20:45 +0000 |
commit | 3721707a26f1c1d807396c358089cf441fdec09f (patch) | |
tree | 4fd256e92bc73e62be1547f2379b820886276de2 /src | |
parent | e1f81b6d2b66628d8ea266f4b6157ece250a105d (diff) |
Bug fixes and enhancements, mainly to do with moving to 6 element
arrays for deciding about the BCs
git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/CartGrid3D/trunk@41 c78560ca-4b45-4335-b268-5f3340f3cb52
Diffstat (limited to 'src')
-rw-r--r-- | src/GHExtension.c | 30 | ||||
-rw-r--r-- | src/Symmetry.c | 32 | ||||
-rw-r--r-- | src/SymmetryCondition.F77 | 16 |
3 files changed, 49 insertions, 29 deletions
diff --git a/src/GHExtension.c b/src/GHExtension.c index 865f831..0fb295a 100644 --- a/src/GHExtension.c +++ b/src/GHExtension.c @@ -1,3 +1,12 @@ + /*@@ + @file GHExtension.c + @date Mon Mar 15 15:48:42 1999 + @author Gerd Lanfermann + @desc + Set up the symmetry GH extension. This should really be done + with StoredData + @enddesc + @@*/ #include <stdlib.h> @@ -9,10 +18,11 @@ #include "GHExtensions.h" -void *Symmetry_AllocGHex(tFleshConfig *config, int convlevel, cGH *GH) { +void *Symmetry_AllocGHex(tFleshConfig *config, int convlevel, cGH *GH) +{ int gf,grid_dim,NumVars; /* Number of dimensions, grid functions */ - SymmetryGHex *newGHex; /* Type of GHextension is EinsteinBoundGHex */ + SymmetryGHex *newGHex; /* Type of GHextension is EinsteinBoundGHex */ NumVars = CCTK_NumVars(); /* Get number of grid functions */ grid_dim = CCTK_MaxDim(); /* Get maximal dimension of the grid */ @@ -24,12 +34,13 @@ void *Symmetry_AllocGHex(tFleshConfig *config, int convlevel, cGH *GH) { newGHex->GFSym = (int **)malloc(NumVars*sizeof(int *)); /* allocation for the number of dimensions*/ - for (gf=0;gf<NumVars;gf++) { - newGHex->GFSym[gf] = (int *)malloc(grid_dim*sizeof(int)); + for (gf=0;gf<NumVars;gf++) + { + newGHex->GFSym[gf] = (int *)malloc(2*grid_dim*sizeof(int)); } /* Now we have something, that looks like [0..NumVars-1][0..grid_dim-1] - and we return that. For the progammer (that's me): This will be merged into + and we return that: This will be merged into the GH and can be referenced in the following manner: int handle = CCTK_GHExtensionHandle("Symmetry"); ..... which returns a pointer the GHextension @@ -42,7 +53,8 @@ void *Symmetry_AllocGHex(tFleshConfig *config, int convlevel, cGH *GH) { } -void Symmetry_InitGHex(cGH *GH) { +void Symmetry_InitGHex(cGH *GH) +{ SymmetryGHex *newGHex; int handle; int gf,d; @@ -54,8 +66,10 @@ void Symmetry_InitGHex(cGH *GH) { newGHex = (SymmetryGHex*) GH->extensions[handle]; /* ... and initialize them: */ - for (gf=0;gf<NumVars;gf++) { - for(d=0;d<grid_dim;d++) { + for (gf=0;gf<NumVars;gf++) + { + for(d=0;d<2*grid_dim;d++) + { newGHex->GFSym[gf][d] = GFSYM_UNSET; /* not set */ } } diff --git a/src/Symmetry.c b/src/Symmetry.c index 923a984..80f2905 100644 --- a/src/Symmetry.c +++ b/src/Symmetry.c @@ -76,8 +76,8 @@ void SetCartSymmetry(cGH *GH, int *sym, const char *imp_gf) { #endif sGHex->GFSym[index][0] = GFSYM_NOSYM; - sGHex->GFSym[index][1] = GFSYM_NOSYM; sGHex->GFSym[index][2] = GFSYM_NOSYM; + sGHex->GFSym[index][4] = GFSYM_NOSYM; } else if (CCTK_Equals(symmetry,"octant")) { @@ -86,8 +86,8 @@ void SetCartSymmetry(cGH *GH, int *sym, const char *imp_gf) { #endif sGHex->GFSym[index][0] = sym[0]; - sGHex->GFSym[index][1] = sym[1]; - sGHex->GFSym[index][2] = sym[2]; + sGHex->GFSym[index][2] = sym[1]; + sGHex->GFSym[index][4] = sym[2]; } else if (CCTK_Equals(symmetry,"quadrant")) { @@ -96,8 +96,8 @@ void SetCartSymmetry(cGH *GH, int *sym, const char *imp_gf) { #endif sGHex->GFSym[index][0] = sym[0]; - sGHex->GFSym[index][1] = sym[1]; - sGHex->GFSym[index][2] = GFSYM_NOSYM; + sGHex->GFSym[index][2] = sym[1]; + sGHex->GFSym[index][4] = GFSYM_NOSYM; } else if (CCTK_Equals(symmetry,"bitant")) { @@ -105,9 +105,9 @@ void SetCartSymmetry(cGH *GH, int *sym, const char *imp_gf) { printf("Registered bitant symmetries for -%s- in SetCartSymmetry\n",imp_gf); #endif - sGHex->GFSym[index][2] = sym[2]; + sGHex->GFSym[index][4] = sym[2]; sGHex->GFSym[index][0] = GFSYM_NOSYM; - sGHex->GFSym[index][1] = GFSYM_NOSYM; + sGHex->GFSym[index][2] = GFSYM_NOSYM; } /* All untouched GFSym[][] will hold GFSYM_UNSET */ @@ -153,7 +153,7 @@ void ApplySymmetry(cGH *GH, char *name) { SymmetryGHex *sGHex; int groupnum; int first,last,index,j; - int doSym[3]; + int doSym[6]; /* Get out if we are sure no symmetries should be applied */ if (CCTK_Equals(symmetry,"full")) return; @@ -190,8 +190,8 @@ void ApplySymmetry(cGH *GH, char *name) { /*at this point, there should be NO ESYM_UNSET anymore if there is, we forgot to register the symmetries for a GF */ if ((sGHex->GFSym[index][0]==GFSYM_UNSET)|| - (sGHex->GFSym[index][1]==GFSYM_UNSET)|| - (sGHex->GFSym[index][2]==GFSYM_UNSET)) { + (sGHex->GFSym[index][2]==GFSYM_UNSET)|| + (sGHex->GFSym[index][4]==GFSYM_UNSET)) { char *message=NULL; message = (char *)malloc(300*sizeof(char)+sizeof(name)); sprintf(message,"Cannot apply symmetry to -%s- without registered symmetries",name); @@ -201,13 +201,15 @@ void ApplySymmetry(cGH *GH, char *name) { /* whether we want to apply sym depends on several things: */ for (j=0;j<3;j++) + { + doSym[2*j+1]=0; if ((GH->cctk_lsh[j]>1) && - (sGHex->GFSym[index][j] != GFSYM_UNSET) && - (sGHex->GFSym[index][j] != GFSYM_NOSYM)) - doSym[j] = 1; + (sGHex->GFSym[index][2*j] != GFSYM_UNSET) && + (sGHex->GFSym[index][2*j] != GFSYM_NOSYM)) + doSym[2*j] = 1; else - doSym[j] = 0; - + doSym[2*j] = 0; + } /* Call the Fortran Symmetry Routine */ FORTRAN_NAME(SymmetryCondition)( diff --git a/src/SymmetryCondition.F77 b/src/SymmetryCondition.F77 index 762ac72..20e7aa5 100644 --- a/src/SymmetryCondition.F77 +++ b/src/SymmetryCondition.F77 @@ -24,8 +24,8 @@ INTEGER nxyz(3) CCTK_REAL var(nxyz(1),nxyz(2),nxyz(3)) INTEGER nghostzones - INTEGER sym(3) - INTEGER doSym(3) + INTEGER sym(6) + INTEGER doSym(6) INTEGER sw @@ -34,6 +34,10 @@ c * the grid chunk has a physical boundary (bbox) c * its size in a direction is bigger than one (sh) c * we actually want a symmetry (sx.ne.ESYM_UNSET) + if (doSym(2) .eq. 1 .or. doSym(4) .eq. 1 .or. doSym(6) .eq. 1) then + call CCTKi_NotYetImplemented("Right hand side boundary conditions") + end if + if (doSym(1) .eq. 1) then do sw=1, nghostzones @@ -46,24 +50,24 @@ c * we actually want a symmetry (sx.ne.ESYM_UNSET) end if - if (doSym(2) .eq. 1) then + if (doSym(3) .eq. 1) then do sw=1, nghostzones do i=1,nxyz(1) do k=1,nxyz(3) - var(i,sw,k) = sym(2)*var(i,nghostzones+sw,k) + var(i,sw,k) = sym(3)*var(i,nghostzones+sw,k) end do end do end do end if - if (doSym(3).eq.1) then + if (doSym(5).eq.1) then do sw=1, nghostzones do i=1,nxyz(1) do j=1,nxyz(2) - var(i,j,sw) = sym(3)*var(i,j,nghostzones+sw) + var(i,j,sw) = sym(5)*var(i,j,nghostzones+sw) end do end do end do |