From 2082bb5099476279b53877b27d9df295ab62ca2f Mon Sep 17 00:00:00 2001 From: schnetter <> Date: Sun, 9 Dec 2001 15:41:00 +0000 Subject: Added more bones to skeleton of CarpetParamCheck. Added more bones to skeleton of CarpetParamCheck. Changed handling of interpolation orders; they are now stored in the grid functions and don't have to be passed around. Setting spatial prolongation order to zero if there are no ghost zones. Setting temporal prolongation order to zero if there is only one time level. Added prolongating the boundaries of the fine grid after restricting to the coarse grid. Restricting the coarse grid changes the coarse grid, hence changes the boundary of the fine grid. darcs-hash:20011209154152-07bb3-0ff824b0462b54926fbe0a8f5fa075dff5fecbb5.gz --- Carpet/Carpet/src/CarpetParamCheck.cc | 9 +++++++-- Carpet/Carpet/src/Comm.cc | 10 ++++------ Carpet/Carpet/src/Restrict.cc | 14 +++++++++++--- Carpet/Carpet/src/SetupGH.cc | 36 +++++++++++++++++++++-------------- Carpet/Carpet/src/Storage.cc | 9 +++++++-- Carpet/Carpet/src/carpet_public.h | 7 +++++-- Carpet/Carpet/src/carpet_public.hh | 20 ++++++++++--------- Carpet/Carpet/src/helpers.cc | 5 +++-- 8 files changed, 70 insertions(+), 40 deletions(-) (limited to 'Carpet') diff --git a/Carpet/Carpet/src/CarpetParamCheck.cc b/Carpet/Carpet/src/CarpetParamCheck.cc index cea4d186b..c948e79ab 100644 --- a/Carpet/Carpet/src/CarpetParamCheck.cc +++ b/Carpet/Carpet/src/CarpetParamCheck.cc @@ -1,11 +1,14 @@ #include +#include #include #include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" #include "carpet.hh" -static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/Carpet/src/CarpetParamCheck.cc,v 1.1 2001/12/05 17:34:54 schnetter Exp $"; +static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/Carpet/src/CarpetParamCheck.cc,v 1.2 2001/12/09 16:41:52 schnetter Exp $"; @@ -13,8 +16,10 @@ namespace Carpet { using namespace std; - int CarpetParamCheck() + int CarpetParamCheck (CCTK_ARGUMENTS) { + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; return 0; } diff --git a/Carpet/Carpet/src/Comm.cc b/Carpet/Carpet/src/Comm.cc index 36f5be6d4..50b57ce38 100644 --- a/Carpet/Carpet/src/Comm.cc +++ b/Carpet/Carpet/src/Comm.cc @@ -9,7 +9,7 @@ #include "carpet.hh" -static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/Carpet/src/Comm.cc,v 1.5 2001/11/05 17:53:01 schnetter Exp $"; +static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/Carpet/src/Comm.cc,v 1.6 2001/12/09 16:41:52 schnetter Exp $"; @@ -21,8 +21,6 @@ namespace Carpet { int SyncGroup (cGH* cgh, const char* groupname) { - DECLARE_CCTK_PARAMETERS; - if (hh->components(reflevel) > 1) assert (component == -1); Checkpoint ("%*sSyncGroup %s", 2*reflevel, "", groupname); @@ -45,11 +43,11 @@ namespace Carpet { assert (group<(int)arrdata.size()); for (int var=0; var<(int)arrdata[group].data.size(); ++var) { - if (num_tl>1 && reflevel>0) { +// if (num_tl>1 && reflevel>0) { + if (reflevel>0) { for (int c=0; ccomponents(reflevel); ++c) { arrdata[group].data[var]->ref_bnd_prolongate - (tl, reflevel, c, mglevel, - prolongation_order_space, prolongation_order_time); + (tl, reflevel, c, mglevel); } } for (int c=0; ccomponents(reflevel); ++c) { diff --git a/Carpet/Carpet/src/Restrict.cc b/Carpet/Carpet/src/Restrict.cc index 9a254d79e..ad264a346 100644 --- a/Carpet/Carpet/src/Restrict.cc +++ b/Carpet/Carpet/src/Restrict.cc @@ -8,7 +8,7 @@ #include "carpet.hh" -static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/Carpet/src/Restrict.cc,v 1.4 2001/11/05 17:53:02 schnetter Exp $"; +static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/Carpet/src/Restrict.cc,v 1.5 2001/12/09 16:41:53 schnetter Exp $"; @@ -35,12 +35,20 @@ namespace Carpet { for (int var=0; var<(int)arrdata[group].data.size(); ++var) { for (int c=0; ccomponents(reflevel); ++c) { - arrdata[group].data[var]->ref_restrict - (tl, reflevel, c, mglevel); + arrdata[group].data[var]->ref_restrict (tl, reflevel, c, mglevel); } for (int c=0; ccomponents(reflevel); ++c) { arrdata[group].data[var]->sync (tl, reflevel, c, mglevel); } + + for (int c=0; ccomponents(reflevel+1); ++c) { + arrdata[group].data[var]->ref_bnd_prolongate + (tl, reflevel+1, c, mglevel); + } + // TODO: is this necessary? + for (int c=0; ccomponents(reflevel+1); ++c) { + arrdata[group].data[var]->sync (tl, reflevel+1, c, mglevel); + } } } // if group has storage diff --git a/Carpet/Carpet/src/SetupGH.cc b/Carpet/Carpet/src/SetupGH.cc index 901b265d2..2df49033c 100644 --- a/Carpet/Carpet/src/SetupGH.cc +++ b/Carpet/Carpet/src/SetupGH.cc @@ -1,4 +1,5 @@ #include +#include #include #include "cctk.h" @@ -10,7 +11,7 @@ #include "carpet.hh" -static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/Carpet/src/SetupGH.cc,v 1.14 2001/12/07 18:24:16 schnetter Exp $"; +static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/Carpet/src/SetupGH.cc,v 1.15 2001/12/09 16:41:53 schnetter Exp $"; @@ -102,7 +103,7 @@ namespace Carpet { // Allocate data hierarchy for scalars const vect lghosts0(0); const vect ughosts0(0); - dd0 = new dh(*hh0, lghosts0, ughosts0, prolongation_order_space); + dd0 = new dh(*hh0, lghosts0, ughosts0, 0); // Allocate space for groups arrdata.resize(CCTK_NumGroups()); @@ -167,22 +168,29 @@ namespace Carpet { aughosts[d] = ghostsizes[d]; } + const int my_prolongation_order_space + = maxval(max(alghosts,aughosts))==0 ? 0 : prolongation_order_space; + arrdata[group].dd = new dh(*arrdata[group].hh, alghosts, aughosts, - prolongation_order_space); + my_prolongation_order_space); - if (gp.disttype == CCTK_DISTRIB_DEFAULT) { + // TODO: think about this + if (true || gp.disttype == CCTK_DISTRIB_DEFAULT) { if (max_refinement_levels > 1) { - const int prolongation_stencil_size - = arrdata[group].dd->prolongation_stencil_size(); - const int min_nghosts - = ((prolongation_stencil_size + refinement_factor - 2) - / (refinement_factor-1)); - if (any(min(alghosts,aughosts) < min_nghosts)) { - CCTK_VWarn (0, __LINE__, __FILE__, CCTK_THORNSTRING, - "There are not enough ghost zones for the desired spatial prolongation order for the grid function group \"%s\". With Carpet::prolongation_order_space=%d, you need at least %d ghost zones.", - CCTK_GroupName(group), - prolongation_order_space, min_nghosts); + const int actual_min_nghosts = minval(min(alghosts,aughosts)); + if (actual_min_nghosts > 0) { + const int prolongation_stencil_size + = arrdata[group].dd->prolongation_stencil_size(); + const int needed_min_nghosts + = ((prolongation_stencil_size + refinement_factor - 2) + / (refinement_factor-1)); + if (actual_min_nghosts < needed_min_nghosts) { + CCTK_VWarn (0, __LINE__, __FILE__, CCTK_THORNSTRING, + "There are not enough ghost zones for the desired spatial prolongation order for the grid function group \"%s\". With Carpet::prolongation_order_space=%d, you need at least %d ghost zones.", + CCTK_GroupName(group), + prolongation_order_space, needed_min_nghosts); + } } } } diff --git a/Carpet/Carpet/src/Storage.cc b/Carpet/Carpet/src/Storage.cc index 2b53433fa..b825b470c 100644 --- a/Carpet/Carpet/src/Storage.cc +++ b/Carpet/Carpet/src/Storage.cc @@ -2,13 +2,14 @@ #include #include "cctk.h" +#include "cctk_Parameters.h" #include "Carpet/CarpetLib/src/dh.hh" #include "Carpet/CarpetLib/src/gf.hh" #include "carpet.hh" -static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/Carpet/src/Storage.cc,v 1.5 2001/11/05 17:53:02 schnetter Exp $"; +static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/Carpet/src/Storage.cc,v 1.6 2001/12/09 16:41:53 schnetter Exp $"; @@ -20,6 +21,8 @@ namespace Carpet { int EnableGroupStorage (cGH* cgh, const char* groupname) { + DECLARE_CCTK_PARAMETERS; + Checkpoint ("%*sEnableGroupStorage %s", 2*reflevel, "", groupname); // TODO: Enabling storage for one refinement level has to enable @@ -49,6 +52,8 @@ namespace Carpet { assert (num_tl>0); const int tmin = 1 - num_tl; const int tmax = 0; + const int my_prolongation_order_time + = num_tl==1 ? 0 : prolongation_order_time; assert (arrdata[group].data.size()==0 || arrdata[group].data[0] == 0); @@ -59,7 +64,7 @@ namespace Carpet { case N: \ arrdata[group].data[var] = new gf \ (CCTK_VarName(n), *arrdata[group].tt, *arrdata[group].dd, \ - tmin, tmax); \ + tmin, tmax, my_prolongation_order_time); \ break; #include "typecase" #undef TYPECASE diff --git a/Carpet/Carpet/src/carpet_public.h b/Carpet/Carpet/src/carpet_public.h index 72ba7aadc..38a494416 100644 --- a/Carpet/Carpet/src/carpet_public.h +++ b/Carpet/Carpet/src/carpet_public.h @@ -1,11 +1,14 @@ -/* $Header: /home/eschnett/C/carpet/Carpet/Carpet/Carpet/src/carpet_public.h,v 1.3 2001/12/07 18:24:17 schnetter Exp $ */ +/* $Header: /home/eschnett/C/carpet/Carpet/Carpet/Carpet/src/carpet_public.h,v 1.4 2001/12/09 16:41:53 schnetter Exp $ */ #include #include "cctk.h" +#include "cctk_Arguments.h" + + /* Scheduled functions */ -int CarpetParamCheck (void); +int CarpetParamCheck (CCTK_ARGUMENTS); int CarpetStartup (void); /* Helper functions */ diff --git a/Carpet/Carpet/src/carpet_public.hh b/Carpet/Carpet/src/carpet_public.hh index 9497e32aa..fd0aa7a7a 100644 --- a/Carpet/Carpet/src/carpet_public.hh +++ b/Carpet/Carpet/src/carpet_public.hh @@ -1,4 +1,4 @@ -// $Header: /home/eschnett/C/carpet/Carpet/Carpet/Carpet/src/carpet_public.hh,v 1.7 2001/12/05 03:31:57 schnetter Exp $ +// $Header: /home/eschnett/C/carpet/Carpet/Carpet/Carpet/src/carpet_public.hh,v 1.8 2001/12/09 16:41:53 schnetter Exp $ // It is assumed that the number of components of all arrays is equal // to the number of components of the grid functions, and that their @@ -14,7 +14,9 @@ #include "Carpet/CarpetLib/src/ggf.hh" #include "Carpet/CarpetLib/src/gh.hh" #include "Carpet/CarpetLib/src/th.hh" - + + + namespace Carpet { @@ -147,7 +149,7 @@ namespace Carpet { { #define END_REFLEVEL_LOOP(cgh) \ } \ - if (reflevel==maxreflevels-1) break; \ + if (reflevel==hh->reflevels()-1) break; \ set_reflevel ((cGH*)(cgh), reflevel+1); \ } \ set_reflevel ((cGH*)(cgh), 0); \ @@ -159,12 +161,12 @@ namespace Carpet { // Reverse refinement level iterator -#define BEGIN_REVERSE_REFLEVEL_LOOP(cgh) \ - do { \ - int _rrl; \ - assert (reflevel==0); \ - set_reflevel ((cGH*)(cgh), maxreflevels-1); \ - for (;;) { \ +#define BEGIN_REVERSE_REFLEVEL_LOOP(cgh) \ + do { \ + int _rrl; \ + assert (reflevel==0); \ + set_reflevel ((cGH*)(cgh), hh->reflevels()-1); \ + for (;;) { \ { #define END_REVERSE_REFLEVEL_LOOP(cgh) \ } \ diff --git a/Carpet/Carpet/src/helpers.cc b/Carpet/Carpet/src/helpers.cc index cedf0391a..b2b6bc88e 100644 --- a/Carpet/Carpet/src/helpers.cc +++ b/Carpet/Carpet/src/helpers.cc @@ -11,7 +11,7 @@ #include "carpet.hh" -static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/Carpet/src/helpers.cc,v 1.11 2001/12/07 18:24:17 schnetter Exp $"; +static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/Carpet/src/helpers.cc,v 1.12 2001/12/09 16:41:53 schnetter Exp $"; @@ -287,12 +287,13 @@ namespace Carpet { assert (cgh->cctk_lsh[d]>=0 && cgh->cctk_lsh[d]<=cgh->cctk_gsh[d]); assert (cgh->cctk_lbnd[d]>=0 && cgh->cctk_ubnd[d]cctk_gsh[d]); assert (cgh->cctk_lbnd[d]<=cgh->cctk_ubnd[d]+1); +#if 0 // No outer boundaries on the finer grids cgh->cctk_bbox[2*d ] = reflevel==0 && cgh->cctk_lbnd[d] == 0; cgh->cctk_bbox[2*d+1] = reflevel==0 && cgh->cctk_ubnd[d] == cgh->cctk_gsh[d]-1; -#if 0 +#else // Do allow outer boundaries on the finer grids (but this is // generally inconsistent -- c. f. periodicity) const bbox& base = hh->baseextent; -- cgit v1.2.3