diff options
author | sai <sai@eec4d7dc-71c2-46d6-addf-10296150bf52> | 1999-11-22 14:15:23 +0000 |
---|---|---|
committer | sai <sai@eec4d7dc-71c2-46d6-addf-10296150bf52> | 1999-11-22 14:15:23 +0000 |
commit | 124f678b9124db29df5dcee8ef432c92f7b0d521 (patch) | |
tree | 24427d1ae645b06373350295959164923f3290b4 /src/Cartoon2DBC.c | |
parent | b1849ef1e3f1d76fa730e5bd3e0b7652e869f036 (diff) |
Compiles but gives crappy results.
git-svn-id: http://svn.cactuscode.org/arrangements/CactusNumerical/Cartoon2D/trunk@9 eec4d7dc-71c2-46d6-addf-10296150bf52
Diffstat (limited to 'src/Cartoon2DBC.c')
-rw-r--r-- | src/Cartoon2DBC.c | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/src/Cartoon2DBC.c b/src/Cartoon2DBC.c index f7dfe70..9440da7 100644 --- a/src/Cartoon2DBC.c +++ b/src/Cartoon2DBC.c @@ -10,7 +10,7 @@ @enddesc @@*/ -static char *rcsid = "$Id$" +static char *rcsid = "$Id$"; #include <stdio.h> #include <assert.h> @@ -39,7 +39,7 @@ CCTK_INT Cartoon2DBCVar(cGH *GH, const char *impvarname, CCTK_INT tensortype); void FMODIFIER FORTRAN_NAME(Cartoon2DBCVarI)(CCTK_INT *retval, cGH *GH, CCTK_INT *vi, CCTK_INT *tensortype); void FMODIFIER FORTRAN_NAME(Cartoon2DBCVar)(CCTK_INT *retval, cGH *GH, - ONE_FORTSTRING_ARG, CCTK_INT *tensortype); + CCTK_INT *tensortype, ONE_FORTSTRING_ARG); /* set boundaries of a grid tensor assuming axisymmetry - handles lower boundary in x @@ -64,6 +64,8 @@ CCTK_INT Cartoon2DBCVarI(cGH *GH, CCTK_INT vi, CCTK_INT tensor_type) CCTK_INT i, j, k, di, dj, dk, ijk; CCTK_INT jj, n, s; CCTK_INT lnx, lny, lnz, ny; + CCTK_REAL *xp; + CCTK_REAL x, y, rho; CCTK_REAL lx0, dx0, dy0; CCTK_REAL rxx, rxy, ryx, ryy; CCTK_REAL sxx, sxy, syx, syy; @@ -75,7 +77,8 @@ CCTK_INT Cartoon2DBCVarI(cGH *GH, CCTK_INT vi, CCTK_INT tensor_type) lny = GH->cctk_lsh[1]; lnz = GH->cctk_lsh[2]; ny = GH->cctk_gsh[1]; - lx0 = GH->data[CCTK_CoordIndex("x")][0][0]; + xp = GH->data[CCTK_CoordIndex("x")][0]; + lx0 = xp[0]; dx0 = GH->cctk_delta_space[0]/GH->cctk_levfac[0]; dy0 = GH->cctk_delta_space[1]/GH->cctk_levfac[1]; @@ -104,7 +107,6 @@ CCTK_INT Cartoon2DBCVarI(cGH *GH, CCTK_INT vi, CCTK_INT tensor_type) /* what a neat way to hack in the zombie for x < 0, y = 0 */ if (i < 0) {i += s; ijk += s; dj = 0;} - /* compute coordinates (could also use Cactus grid function) */ x = lx0 + dx0 * i; y = (dj) ? dy0 * jj : 0; @@ -127,7 +129,7 @@ CCTK_INT Cartoon2DBCVarI(cGH *GH, CCTK_INT vi, CCTK_INT tensor_type) /* interpolate grid functions */ for (n = 0; n < tensor_type_n[tensor_type]; n++) - f[n] = axisym_interpolate(GH, GH->data[vi+n][0], i, di, ijk, rho); + f[n] = Cartoon2DInterp(GH, GH->data[vi+n][0], i, di, ijk, rho); /* rotate grid tensor by matrix multiplication */ if (tensor_type == TENSOR_TYPE_SCALAR) { @@ -189,7 +191,7 @@ CCTK_INT Cartoon2DBCVarI(cGH *GH, CCTK_INT vi, CCTK_INT tensor_type) /* syncs needed after interpolation (actually only for x direction) */ for (n = 0; n < tensor_type_n[tensor_type]; n++) - CCTK_SyncGroup(GH, CCTK_GroupNameFromVarI[vi+n]); + CCTK_SyncGroup(GH, CCTK_GroupNameFromVarI(vi+n)); return(0); } @@ -200,19 +202,17 @@ void FMODIFIER FORTRAN_NAME(Cartoon2DBCVarI)(CCTK_INT *retval, cGH *GH, CCTK_INT CCTK_INT Cartoon2DBCVar(cGH *GH, const char *impvarname, CCTK_INT tensortype) { + DECLARE_CCTK_PARAMETERS + CCTK_INT vi; - static CCTK_INT firstcall = 1, pr = 0; - if (firstcall) { - firstcall = 0; - pr = CCTK_Equals(verbose, "yes"); - } - if (pr) printf("cartoon_2d_tensorbound called for %s\n", name); + if (verbose) printf("cartoon_2d_tensorbound called for %s\n", impvarname); vi = CCTK_VarIndex(impvarname); + return(Cartoon2DBCVarI(GH, vi, tensortype)); } -void FMODIFIER FORTRAN_NAME(Cartoon2DBCVar)(CCTK_INT *retval, cGH *GH, ONE_FORTSTRING_ARG, CCTK_INT *tensortype) { +void FMODIFIER FORTRAN_NAME(Cartoon2DBCVar)(CCTK_INT *retval, cGH *GH, CCTK_INT *tensortype, ONE_FORTSTRING_ARG) { ONE_FORTSTRING_CREATE(impvarname) *retval = Cartoon2DBCVar(GH, impvarname, *tensortype); free(impvarname); @@ -224,13 +224,16 @@ CCTK_REAL Cartoon2DInterp(cGH *GH, CCTK_REAL *f, CCTK_INT i, CCTK_INT di, { DECLARE_CCTK_PARAMETERS - CCTK_REAL c, d, x0; + CCTK_REAL x0; CCTK_REAL lx0, dx0; CCTK_REAL y[6], r; + CCTK_REAL *xp; + CCTK_INT lnx; CCTK_INT n, offset; lnx = GH->cctk_lsh[0]; - lx0 = GH->data[CCTK_CoordIndex("x")][0][0]; + xp = GH->data[CCTK_CoordIndex("x")][0]; + lx0 = xp[0]; dx0 = GH->cctk_delta_space[0]/GH->cctk_levfac[0]; /* find i such that x(i) < x <= x(i+1) |