diff options
author | rideout <rideout@6a38eb6e-646e-4a02-a296-d141613ad6c4> | 2001-12-18 20:44:49 +0000 |
---|---|---|
committer | rideout <rideout@6a38eb6e-646e-4a02-a296-d141613ad6c4> | 2001-12-18 20:44:49 +0000 |
commit | b636bbee7c31984989db6e0f0865805b9b3dfa07 (patch) | |
tree | 1d87ea5814ef922f9b46e1f6320bfe510efc421f | |
parent | 581407f659e921cb0bd149aea57794db50bca65b (diff) |
Implemented support for complex scalar boundary conditions, in a crude
way. Now the CCTK_REAL which is passed to the scalar boundary routine
is used to set the real part of the boundary, while the complex part
is set to zero. A more complete solution will come later, in the form
of these routines taking a table object.
Also fixed some typos in the documentation.
Closes CactusBase/748.
git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/Boundary/trunk@165 6a38eb6e-646e-4a02-a296-d141613ad6c4
-rw-r--r-- | doc/documentation.tex | 6 | ||||
-rw-r--r-- | src/ScalarBoundary.c | 46 |
2 files changed, 29 insertions, 23 deletions
diff --git a/doc/documentation.tex b/doc/documentation.tex index 25c808b..3da2178 100644 --- a/doc/documentation.tex +++ b/doc/documentation.tex @@ -98,8 +98,8 @@ specified name. {\tt GN}; apply the boundary condition to all variables in the group. \item{\em variable index}: Suffix: {\tt VI}; apply the boundary condition to the variable with the specified variable index. -\item{\em goup index}: Suffix: {\tt GI} apply the boundary -condition to all variable in the group with the specified group index. +\item{\em group index}: Suffix: {\tt GI} apply the boundary +condition to all variables in the group with the specified group index. \end{itemize} \item{} For the boundary conditions in individual coordinate directions, @@ -183,7 +183,7 @@ integer \> group\_index\\ \item[{\tt ierr}] Return value, negative value indicates the boundary condition was not successfully applied \item[{\tt cctkGH}] Grid hierarchy pointer -\item[{\tt var0}] Scalar value to apply +\item[{\tt var0}] Scalar value to apply (For a complex grid function, this is the real part, the imaginary part is set to zero.) \item[{\tt dir}] Coordinate direction in which to apply boundary condition \item[{\tt stencil\_size}] Array with dimension of the grid function, containing the stencil width to apply the boundary at \item[{\tt variable\_name}] Name of the variable diff --git a/src/ScalarBoundary.c b/src/ScalarBoundary.c index ceb4bdd..48b98b4 100644 --- a/src/ScalarBoundary.c +++ b/src/ScalarBoundary.c @@ -671,7 +671,6 @@ int BndScalarVN (const cGH *GH, { int vi, retval; - vi = CCTK_VarIndex (vname); if (vi >= 0) { @@ -711,6 +710,9 @@ void CCTK_FCALL CCTK_FNAME (BndScalarVN) /* macro to compute the linear index of a 3D point */ #define INDEX_3D(lsh, i, j, k) ((i) + (lsh)[0]*((j) + (lsh)[1]*(k))) +/* an empty macro */ +#define NOTHING + /*@@ @routine SCALAR_BOUNDARY_TYPED @date Sat 20 Jan 2001 @@ -745,7 +747,7 @@ void CCTK_FCALL CCTK_FNAME (BndScalarVN) #define SCALAR_BOUNDARY_TYPED(doBC, \ iend, jend, kend, \ ii, jj, kk, \ - cctk_type) \ + left_cctk_type, right_cctk_type, part) \ { \ if (doBC) \ { \ @@ -759,7 +761,7 @@ void CCTK_FCALL CCTK_FNAME (BndScalarVN) \ \ _index = INDEX_3D (lsh, ii, jj, kk); \ - ((cctk_type *) GH->data[var][timelvl])[_index] = (cctk_type) scalar;\ + ((left_cctk_type *) GH->data[var][timelvl])[_index] part = (right_cctk_type) scalar; \ } \ } \ } \ @@ -783,35 +785,35 @@ void CCTK_FCALL CCTK_FNAME (BndScalarVN) @vio in @endvar @@*/ -#define SCALAR_BOUNDARY(cctk_type) \ +#define SCALAR_BOUNDARY(left_cctk_type, right_cctk_type, part) \ { \ /* now set the boundaries face by face */ \ if (gdim > 0) \ { \ /* lower x */ \ SCALAR_BOUNDARY_TYPED (doBC[0], stencil[0], lssh[1], lssh[2], \ - i, j, k, cctk_type); \ + i, j, k, left_cctk_type, right_cctk_type, part); \ /* upper x */ \ SCALAR_BOUNDARY_TYPED (doBC[1], stencil[0], lssh[1], lssh[2], \ - lssh[0]-i-1, j, k, cctk_type); \ + lssh[0]-i-1, j, k, left_cctk_type, right_cctk_type, part); \ } \ if (gdim > 1) \ { \ /* lower y */ \ SCALAR_BOUNDARY_TYPED (doBC[2], lssh[0], stencil[1], lssh[2], \ - i, j, k, cctk_type); \ + i, j, k, left_cctk_type, right_cctk_type, part); \ /* upper y */ \ SCALAR_BOUNDARY_TYPED (doBC[3], lssh[0], stencil[1], lssh[2], \ - i, lssh[1]-j-1, k, cctk_type); \ + i, lssh[1]-j-1, k, left_cctk_type, right_cctk_type, part); \ } \ if (gdim > 2) \ { \ /* lower z */ \ SCALAR_BOUNDARY_TYPED (doBC[4], lssh[0], lssh[1], stencil[2], \ - i, j, k, cctk_type); \ + i, j, k, left_cctk_type, right_cctk_type, part); \ /* upper z */ \ SCALAR_BOUNDARY_TYPED (doBC[5], lssh[0], lssh[1], stencil[2], \ - i, j, lssh[2]-k-1, cctk_type); \ + i, j, lssh[2]-k-1, left_cctk_type, right_cctk_type, part); \ } \ } @@ -899,7 +901,6 @@ static int ApplyBndScalar (const cGH *GH, int doBC[2*MAXDIM], dstag[MAXDIM], lsh[MAXDIM], lssh[MAXDIM], stencil[MAXDIM]; SymmetryGHex *sGHex; - /* check the direction parameter */ if (abs (dir) > MAXDIM) { @@ -988,42 +989,47 @@ static int ApplyBndScalar (const cGH *GH, switch (CCTK_VarTypeI (var)) { case CCTK_VARIABLE_CHAR: - SCALAR_BOUNDARY (CCTK_CHAR); break; + SCALAR_BOUNDARY (CCTK_CHAR, CCTK_CHAR, NOTHING); break; case CCTK_VARIABLE_INT: - SCALAR_BOUNDARY (CCTK_INT); break; + SCALAR_BOUNDARY (CCTK_INT, CCTK_INT, NOTHING); break; case CCTK_VARIABLE_REAL: - SCALAR_BOUNDARY (CCTK_REAL); break; + SCALAR_BOUNDARY (CCTK_REAL, CCTK_REAL, NOTHING); break; + + case CCTK_VARIABLE_COMPLEX: + SCALAR_BOUNDARY (CCTK_COMPLEX, CCTK_REAL, .Re); + scalar = 0.; + SCALAR_BOUNDARY (CCTK_COMPLEX, CCTK_REAL, .Im); break; #ifdef CCTK_INT2 case CCTK_VARIABLE_INT2: - SCALAR_BOUNDARY (CCTK_INT2); break; + SCALAR_BOUNDARY (CCTK_INT2, CCTK_INT2, NOTHING); break; #endif #ifdef CCTK_INT4 case CCTK_VARIABLE_INT4: - SCALAR_BOUNDARY (CCTK_INT4); break; + SCALAR_BOUNDARY (CCTK_INT4, CCTK_INT4, NOTHING); break; #endif #ifdef CCTK_INT8 case CCTK_VARIABLE_INT8: - SCALAR_BOUNDARY (CCTK_INT8); break; + SCALAR_BOUNDARY (CCTK_INT8, CCTK_INT8, NOTHING); break; #endif #ifdef CCTK_REAL4 case CCTK_VARIABLE_REAL4: - SCALAR_BOUNDARY (CCTK_REAL4); break; + SCALAR_BOUNDARY (CCTK_REAL4, CCTK_REAL4, NOTHING); break; #endif #ifdef CCTK_REAL8 case CCTK_VARIABLE_REAL8: - SCALAR_BOUNDARY (CCTK_REAL8); break; + SCALAR_BOUNDARY (CCTK_REAL8, CCTK_REAL8, NOTHING); break; #endif #ifdef CCTK_REAL16 case CCTK_VARIABLE_REAL16: - SCALAR_BOUNDARY (CCTK_REAL16); break; + SCALAR_BOUNDARY (CCTK_REAL16, CCTK_REAL16, NOTHING); break; #endif default: |