From 79d582e24202a9cc6c136fe5ba7572e020b3befc Mon Sep 17 00:00:00 2001 From: rideout Date: Thu, 13 Feb 2003 14:26:07 +0000 Subject: Implement wrapper for radiation boundaries which allows all available options. Options are now specified via: key value --- ----- PREVIOUS TIME LEVEL name or index of gv holding previous time level (CCTK_STRING or CCTK_INT respectively) (to be deprecated, please use proper time levels) LIMIT value of field at infinity (CCTK_REAL) SPEED wave speed (CCTK_REAL) STENCIL WIDTH width of stencil in each dimension (CCTK_ARRAY of d CCTK_INTs, for a d-dimensional gv) git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/Boundary/trunk@196 6a38eb6e-646e-4a02-a296-d141613ad6c4 --- src/RadiationBoundary.c | 175 ++++++++++++++++++++++++++++++++++-------------- 1 file changed, 125 insertions(+), 50 deletions(-) (limited to 'src') diff --git a/src/RadiationBoundary.c b/src/RadiationBoundary.c index 4eb2e5f..7f83635 100644 --- a/src/RadiationBoundary.c +++ b/src/RadiationBoundary.c @@ -71,6 +71,9 @@ #include #include "cctk.h" +#include "cctk_Faces.h" +#include "util_Table.h" +#include "util_ErrorCodes.h" #include "cctk_FortranString.h" #include "cctk_Parameters.h" @@ -81,6 +84,16 @@ static const char *rcsid = "$Header$"; CCTK_FILEVERSION(CactusBase_Boundary_RadiationBoundary_c); +static int ApplyBndRadiative (const cGH *GH, + int stencil_dir, + const int *stencil_alldirs, + int dir, + CCTK_REAL var0, + CCTK_REAL speed, + int first_var_to, + int first_var_from, + int num_vars); + /******************************************************************** ******************** External Routines ************************ ********************************************************************/ @@ -93,11 +106,7 @@ CCTK_FILEVERSION(CactusBase_Boundary_RadiationBoundary_c); Top level function which is registered as handling this boundary condition @enddesc - @calls BndRadiativeVI, for the moment - @history - Perliminary version for testing, simply calls BndRadiativeVI - with hardwired arguments - @endhistory + @calls ApplyBndRadiative @var GH @vdesc Pointer to CCTK grid hierarchy @vtype const cGH * @@ -114,6 +123,11 @@ CCTK_FILEVERSION(CactusBase_Boundary_RadiationBoundary_c); @vtype int * @vio in @endvar + @var faces + @vdesc array of set of faces to which to apply the bc + @vtype int + @vio in + @endvar @var table_handles @vdesc array of table handles which hold extra arguments @vtype int @@ -121,51 +135,133 @@ CCTK_FILEVERSION(CactusBase_Boundary_RadiationBoundary_c); @endvar @returntype int @returndesc - return code of @seeroutine BndRadiativeVI
- |= -16 if valid table handle passed + return code of @seeroutine ApplyBndRadiative
@endreturndesc @@*/ -int BndRadiative(const cGH *GH, int num_vars, int *var_indices, - int *table_handles) +int BndRadiative(const cGH *GH, int num_vars, int *vars, int *faces, + int *tables) { - int i, retval=0; - int sw[3] = {1,1,1}; + int i, j, k, value_type, value_size, err, prev_time_level, + gdim, max_gdim, retval; + char *prev_time_level_name; + + /* variables to pass to ApplyBndRadiative */ + /*int stencil_dir;*/ /* width of stencil in direction dir, not needed */ + int *stencil_alldirs; /* width of stencil in all directions */ + int dir; /* direction in which to apply bc */ + CCTK_REAL limit, speed; #ifdef DEBUG printf("BndRadiative(): got passed GH=%p, num_vars=%d, var_indices[0]=%d, table_handles[0]=%d\n", (const void *) GH, num_vars, var_indices[0], table_handles[0]); #endif - /* loop through each variable (Is there some way to take advantage - of knowing the entire list of variables ahead of time?) */ - for (i=0; i=0) { + /* find other adjacent vars which are selected for identical bcs */ + j=1; + while (i+j max_gdim) + { + realloc(stencil_alldirs, gdim*sizeof(int)); + max_gdim = gdim; + } + for (k=0; k 1) { timelvl_from = 1; @@ -1504,11 +1583,6 @@ static int ApplyBndRadiative (const cGH *GH, timelvl_from = 0; } - /*if (timelvl_from < 0) - { - timelvl_from = 0; - }*/ - /* Find Courant parameters. */ dtv = speed * GH->cctk_delta_time; dtvh = 0.5 * dtv; @@ -1538,6 +1612,7 @@ static int ApplyBndRadiative (const cGH *GH, offset[i] = i == 0 ? 1 : offset[i-1] * GH->cctk_lsh[i-1]; } + /* Append r grid variable to end of coords[] array */ sprintf (coord_system_name, "spher%dd", gdim); indx = CCTK_CoordIndex (-1, "r", coord_system_name); if (indx < 0) -- cgit v1.2.3