diff options
author | schnetter <schnetter@c78560ca-4b45-4335-b268-5f3340f3cb52> | 2004-01-19 22:59:32 +0000 |
---|---|---|
committer | schnetter <schnetter@c78560ca-4b45-4335-b268-5f3340f3cb52> | 2004-01-19 22:59:32 +0000 |
commit | 1d12e8e8ca9a5f91d38edd4cf0f7c660281eadca (patch) | |
tree | 412ef84432ef7a7de212bd7141f1a0197697bc5c | |
parent | 32024ef94c0b6799d030ad1a4e915bec640aa037 (diff) |
Provide a coordinate-thorn and symmetry-thorn independent way of
specifying the shape of the physical domain and the location of the
boundary points. The advantage of that is that it is now much easier
to change the resolution.
git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/CartGrid3D/trunk@190 c78560ca-4b45-4335-b268-5f3340f3cb52
-rw-r--r-- | interface.ccl | 25 | ||||
-rw-r--r-- | param.ccl | 1 | ||||
-rw-r--r-- | src/CartGrid3D.c | 61 | ||||
-rw-r--r-- | src/ParamCheck.c | 31 |
4 files changed, 111 insertions, 7 deletions
diff --git a/interface.ccl b/interface.ccl index 96f271a..3c44d2c 100644 --- a/interface.ccl +++ b/interface.ccl @@ -7,6 +7,31 @@ inherits: coordbase INCLUDE HEADER: Symmetry.h in Symmetry.h uses include header: CoordBase.h +# The overall size of the domain +CCTK_INT FUNCTION GetDomainSpecification \ + (CCTK_INT IN size, \ + CCTK_REAL OUT ARRAY physical_min, \ + CCTK_REAL OUT ARRAY physical_max, \ + CCTK_REAL OUT ARRAY interior_min, \ + CCTK_REAL OUT ARRAY interior_max, \ + CCTK_REAL OUT ARRAY exterior_min, \ + CCTK_REAL OUT ARRAY exterior_max, \ + CCTK_REAL OUT ARRAY spacing) +USES FUNCTION GetDomainSpecification + +CCTK_INT FUNCTION ConvertFromPhysicalBoundary \ + (CCTK_INT INT size, \ + CCTK_REAL IN ARRAY physical_min, \ + CCTK_REAL IN ARRAY physical_max, \ + CCTK_REAL OUT ARRAY interior_min, \ + CCTK_REAL OUT ARRAY interior_max, \ + CCTK_REAL OUT ARRAY exterior_min, \ + CCTK_REAL OUT ARRAY exterior_max, \ + CCTK_REAL IN ARRAY spacing) +USES FUNCTION ConvertFromPhysicalBoundary + + + public: REAL gridspacings type=SCALAR @@ -116,6 +116,7 @@ KEYWORD type "Grid type" "box" :: "Box grid from -0.5 to 0.5" "byrange" :: "Specify min and max values" "byspacing" :: "Specify grid spacings" + "coordbase" :: "Get specification from CoordBase" } "box" KEYWORD domain "Domain type" diff --git a/src/CartGrid3D.c b/src/CartGrid3D.c index c3eb7f0..3592adf 100644 --- a/src/CartGrid3D.c +++ b/src/CartGrid3D.c @@ -9,6 +9,7 @@ @enddesc @@*/ +#include <assert.h> #include <stdio.h> #include <math.h> @@ -68,7 +69,7 @@ void DecodeSymParameters3D(int sym[6]); void CartGrid3D(CCTK_ARGUMENTS) { int i, j, k, idx; - int iconv, is_coarsest_refinement_level, coord_handle, ierr; + int is_coarsest_refinement_level, coord_handle, ierr; CCTK_REAL origin[3], this_delta[3], min1[3], max1[3]; CCTK_REAL *coarse_delta[3]; double lower[3], upper[3]; @@ -113,8 +114,6 @@ void CartGrid3D(CCTK_ARGUMENTS) } } - iconv = 1 << cctk_convlevel; - /**************************************************************** * * BYRANGE @@ -168,12 +167,12 @@ void CartGrid3D(CCTK_ARGUMENTS) if (cntstag[i]) { *coarse_delta[i] = max1[i] / (cctk_gsh[i] - cctk_nghostzones[i]-0.5); - origin[i] = - (cctk_nghostzones[i]-0.5) * *coarse_delta[i]*iconv; + origin[i] = - (cctk_nghostzones[i]-0.5) * *coarse_delta[i]; } else { *coarse_delta[i] = max1[i] / (cctk_gsh[i] - cctk_nghostzones[i]-1); - origin[i] = - cctk_nghostzones[i] * *coarse_delta[i]*iconv; + origin[i] = - cctk_nghostzones[i] * *coarse_delta[i]; } } else @@ -188,7 +187,7 @@ void CartGrid3D(CCTK_ARGUMENTS) origin[i] = min1[i]; } - this_delta[i] = *coarse_delta[i] * iconv; + this_delta[i] = *coarse_delta[i]; } } @@ -213,7 +212,7 @@ void CartGrid3D(CCTK_ARGUMENTS) for (i = 0; i < 3; i++) { - this_delta[i] = *coarse_delta[i] * iconv; + this_delta[i] = *coarse_delta[i]; /* Set minimum values of coordinates */ if (domainsym[2*i]) @@ -227,6 +226,54 @@ void CartGrid3D(CCTK_ARGUMENTS) } } } + + /************************************************************** + * COORDBASE + * + * CoordBase gives: grid spacing on the coarsest GH and + * minimum and maximum values of coordinates and + * the number of gridpoints on the coarsest GH + * + **************************************************************/ + else if (CCTK_Equals(type,"coordbase")) + { + CCTK_REAL physical_min[3]; + CCTK_REAL physical_max[3]; + CCTK_REAL interior_min[3]; + CCTK_REAL interior_max[3]; + CCTK_REAL exterior_min[3]; + CCTK_REAL exterior_max[3]; + CCTK_REAL spacing[3]; + int ierr; + int d; + + ierr = GetDomainSpecification + (3, physical_min, physical_max, interior_min, interior_max, + exterior_min, exterior_max, spacing); + assert (!ierr); + + /* Adapt to convergence level */ + for (d=0; d<3; ++d) { + spacing[d] *= pow(cctkGH->cctk_convfac, cctkGH->cctk_convlevel); + } + + ierr = ConvertFromPhysicalBoundary + (3, physical_min, physical_max, interior_min, interior_max, + exterior_min, exterior_max, spacing); + assert (!ierr); + + for (d=0; d<3; ++d) { + origin[d] = exterior_min[d]; + this_delta[d] = spacing[d]; + *coarse_delta[d] = this_delta[d]; + } + } + + else + { + assert (0); + } + } else /* if (not coarsest refinement level) */ { diff --git a/src/ParamCheck.c b/src/ParamCheck.c index 5478b91..ffa658e 100644 --- a/src/ParamCheck.c +++ b/src/ParamCheck.c @@ -95,7 +95,38 @@ void ParamCheck_CartGrid3D(CCTK_ARGUMENTS) { iflag++; } + } + else if (CCTK_Equals(type,"coordbase")) + { + if (CCTK_IsFunctionAliased ("GetDomainSpecification")) + { + if (CCTK_Equals(domain,"bitant")) + { + iflag++; + } + if (CCTK_Equals(domain,"bitant_rotate")) + { + iflag++; + } + else if (CCTK_Equals(domain,"quadrant")) + { + iflag++; + } + else if (CCTK_Equals(domain,"quadrant_reflect_rotate")) + { + iflag++; + } + else if (CCTK_Equals(domain,"octant")) + { + iflag++; + } + else if (CCTK_Equals(domain,"full")) + { + iflag++; + } + } + } else if (CCTK_Equals(type,"box")) { iflag++; |