diff options
author | schnetter <> | 2004-01-25 13:57:00 +0000 |
---|---|---|
committer | schnetter <> | 2004-01-25 13:57:00 +0000 |
commit | cfcb3f61bcd9a88abbb97d1c49325cc67dbe70a8 (patch) | |
tree | 7f2c49463717ab281fec6bb139c91533466e25dd /Carpet/Carpet/src/Storage.cc | |
parent | 55f76be95c2272b35b6941d6ec38a77bfb23a101 (diff) |
Import the recently announced changes:
Import the recently announced changes:
1. Carpet has now an infrastructure for multiple maps (aka "grid
patches"). Instead of a single grid hierarchy there can now be
several. This is largely untested, because the remainder of Cactus
cannot handle multiple coordinate systems.
2. The order in which the schedule bins are called has changed. As Ian
Hawke pointed out, the previous order during time evolution was
inconsistent. The initial data ordering did not allow for recovering
and was not usable for progressively solving elliptic equations for
initial data.
3. Carpet now supports convergence levels. The convergence level
specifies by how many factors of two the resolution in the parameter
file should be coarsened (or refined, if negative). This should make
convergence tests and test runs much easier. It is, in principle, also
possible to run several convergence levels at once. This has not been
tested because the remainder of Cactus cannot handle multiple
resolutions. This will be necessary for a multigrid solver, and also
for having a shadow hierarchy to determine where to refine adaptively.
4. Carpet works together with the new CoordBase domain specification
parameters. Without these, using convergence levels will lead to very
strange results.
5. The "modes" have changed. There are now:
meta mode: the whole simulation
global mode: one convergence level
level mode: one refinement level
singlemap mode: one map on one refinement level
local mode: as previously
The whole mode handling has been cleaned up.
6. The regridding thorn has been cleaned up.
7. The kind of prolongation stencil is now determined in Carpet, i.e. at
a fairly hight level, instead of in CarpetLib.
8. The low-order prolongation operators have been made much more
efficient (as have previously the higher-order ones).
9. Assorted smaller changes.
For Carpet users, there should be no major incompatibilities. The major
improvements are 3 and 4 combined. Here is an example:
CoordBase::domainsize = extent
CoordBase::spacing = gridspacing
CoordBase::zero_origin_x = yes
CoordBase::zero_origin_y = yes
CoordBase::zero_origin_z = yes
CoordBase::xextent = 20.0
CoordBase::yextent = 20.0
CoordBase::zextent = 20.0
CoordBase::dx = 1.0
CoordBase::dy = 1.0
CoordBase::dz = 1.0
CoordBase::boundary_shiftout_x_lower = 1
CoordBase::boundary_shiftout_y_lower = 1
CoordBase::boundary_shiftout_z_lower = 1
Carpet::domain_from_coordbase = yes
Carpet::convergence_level = 0
grid::type = coordbase
grid::domain = octant
grid::avoid_origin = no
This gives you a grid that extends from the origin ("zero_origin") up to
20.0 with a grid spacing of 1.0. Symmetry zones and boundary zones are
added automatically. The "shiftout" says that there is no boundary
point on the origin. The staggering parameters (not shown) default to
"no". In order to change the resolution, only the convergence level
has to be adjusted. Note that the old way of specifying the domain
extent still works.
For Carpet developers, one major change is the new mode handling. As
described in 5, the looping macros (that loop over all refinement
levels, or all components) have changed.
darcs-hash:20040125135727-07bb3-51c9647c1b5080e7e180b52a1b81fa155cfd19e9.gz
Diffstat (limited to 'Carpet/Carpet/src/Storage.cc')
-rw-r--r-- | Carpet/Carpet/src/Storage.cc | 165 |
1 files changed, 82 insertions, 83 deletions
diff --git a/Carpet/Carpet/src/Storage.cc b/Carpet/Carpet/src/Storage.cc index ed51a4d15..e95c8a7ec 100644 --- a/Carpet/Carpet/src/Storage.cc +++ b/Carpet/Carpet/src/Storage.cc @@ -10,7 +10,7 @@ #include "carpet.hh" extern "C" { - static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/Carpet/src/Storage.cc,v 1.29 2004/01/16 10:57:04 hawke Exp $"; + static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/Carpet/src/Storage.cc,v 1.30 2004/01/25 14:57:27 schnetter Exp $"; CCTK_FILEVERSION(Carpet_Carpet_Storage_cc); } @@ -26,16 +26,12 @@ namespace Carpet { { DECLARE_CCTK_PARAMETERS; - Checkpoint ("%*sEnableGroupStorage %s", 2*reflevel, "", groupname); + Checkpoint ("EnableGroupStorage %s", groupname); // TODO: Enabling storage for one refinement level has to enable // it for all other refinement levels as well. Disabling must // wait until all refinement levels have been disabled. - // TODO: Invent a mode "reflevel==-1" that is global, i.e. has - // effect for all refinement levels. This mode is used during - // INITIAL, and en-/disabling storage in it is also global. - const int group = CCTK_GroupIndex(groupname); assert (group>=0 && group<CCTK_NumGroups()); @@ -45,8 +41,8 @@ namespace Carpet { // No storage change in local mode if (grouptype == CCTK_GF) { - assert (reflevel == -1 - || hh->local_components(reflevel) == 1 || component == -1); + assert ((reflevel == -1 && map == -1 && mglevel == -1 && component == -1) + || (maps == 1 && vhh.at(0)->local_components(reflevel) == 1)); } if (CCTK_QueryGroupStorageI(cgh, group)) { @@ -58,19 +54,6 @@ namespace Carpet { return num_tl; } - // Check whether this group has transfer operators - if (grouptype == CCTK_GF) { - if (! arrdata[group].do_transfer) { - const int var = CCTK_FirstVarIndexI(group); - assert (var>=0); - const int vartype = CCTK_VarTypeI(var); - const char * vartypename = CCTK_VarTypeName(vartype); - CCTK_VWarn (2, __LINE__, __FILE__, CCTK_THORNSTRING, - "(Allocating storage for Cactus group \"%s\".) Note: This group (which has the variable type %s) will be neither prolongated nor restricted.", - groupname, vartypename); - } - } - // There is a difference between the Cactus time levels and the // Carpet time levels. If there are n time levels, then the // Cactus time levels are numbered 0 ... n-1, with the current @@ -82,49 +65,52 @@ 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; if (grouptype == CCTK_GF) { if (max_refinement_levels > 1) { - if (num_tl <= my_prolongation_order_time) { - CCTK_VWarn (0, __LINE__, __FILE__, CCTK_THORNSTRING, - "There are not enough time levels for the desired temporal prolongation order in the grid function group \"%s\". With Carpet::prolongation_order_time=%d, you need at least %d time levels.", - CCTK_GroupName(group), - prolongation_order_time, prolongation_order_time+1); + if (groupdata.at(group).transport_operator != op_none) { + if (num_tl <= prolongation_order_time) { + CCTK_VWarn (0, __LINE__, __FILE__, CCTK_THORNSTRING, + "There are not enough time levels for the desired temporal prolongation order in the grid function group \"%s\". With Carpet::prolongation_order_time=%d, you need at least %d time levels.", + CCTK_GroupName(group), + prolongation_order_time, prolongation_order_time+1); + } } } } // VGF: allocate - assert (arrdata[group].data.size()==0 - || arrdata[group].data[0] == 0); - assert ((int)arrdata[group].data.size() == CCTK_NumVarsInGroupI(group)); - for (int var=0; var<(int)arrdata[group].data.size(); ++var) { - const int n = n0 + var; - switch (CCTK_VarTypeI(n)) { -#define TYPECASE(N,T) \ - case N: \ - assert (! arrdata[group].data[var]); \ - /* VGF */ \ - arrdata[group].data[var] = new gf<T,dim> \ - (n, *arrdata[group].tt, *arrdata[group].dd, \ - tmin, tmax, my_prolongation_order_time); \ - break; + assert (arrdata.at(group).at(0).data.size()==0 + || arrdata.at(group).at(0).data.at(0) == 0); + for (int m=0; m<maps; ++m) { + for (int var=0; var<CCTK_NumVarsInGroupI(group); ++var) { + const int n = n0 + var; + switch (CCTK_VarTypeI(n)) { +#define TYPECASE(N,T) \ + case N: \ + /* VGF */ \ + arrdata.at(group).at(m).data.at(var) = new gf<T,dim> \ + (n, groupdata.at(group).transport_operator, \ + *arrdata.at(group).at(m).tt, *arrdata.at(group).at(m).dd, \ + tmin, tmax, prolongation_order_time); \ + break; #include "typecase" #undef TYPECASE - default: - UnsupportedVarType(n); - } // switch - - if (grouptype != CCTK_GF) { - for (int tl=0; tl<num_tl; ++tl) { - int const c = CCTK_MyProc(cgh); - cgh->data[n][tl] = ((*arrdata[group].data[var]) (-tl, 0, c, 0)->storage()); + default: + UnsupportedVarType(n); + } // switch + + if (grouptype != CCTK_GF) { + for (int tl=0; tl<num_tl; ++tl) { + assert (m == 0); + int const c = CCTK_MyProc(cgh); + cgh->data[n][tl] = ((*arrdata.at(group).at(m).data.at(var)) + (-tl, 0, c, 0)->storage()); + } } - } - + + } // for } // for // PoisonGroup (cgh, group, alltimes); @@ -137,7 +123,7 @@ namespace Carpet { int DisableGroupStorage (const cGH* cgh, const char* groupname) { - Checkpoint ("%*sDisableGroupStorage %s", 2*reflevel, "", groupname); + Checkpoint ("DisableGroupStorage %s", groupname); const int group = CCTK_GroupIndex(groupname); assert (group>=0 && group<CCTK_NumGroups()); @@ -159,34 +145,39 @@ namespace Carpet { const int num_tl = CCTK_NumTimeLevelsFromVarI(n0); assert (num_tl>0); - assert (arrdata[group].data.size()); - assert (arrdata[group].data[0]); - for (int var=0; var<(int)arrdata[group].data.size(); ++var) { - const int n = n0 + var; - switch (CCTK_VarTypeI(n)) { -#define TYPECASE(N,T) \ - case N: \ - assert (arrdata[group].data[var]); \ - delete (gf<T,dim>*)arrdata[group].data[var]; \ - arrdata[group].data[var] = 0; \ - break; + assert (arrdata.at(group).at(0).data.size()); + assert (arrdata.at(group).at(0).data.at(0)); + for (int m=0; m<maps; ++m) { + assert (m<(int)arrdata.at(group).size()); + for (int var=0; var<CCTK_NumVarsInGroupI(group); ++var) { + assert (var<(int)arrdata.at(group).at(m).data.size()); + const int n = n0 + var; + switch (CCTK_VarTypeI(n)) { +#define TYPECASE(N,T) \ + case N: \ + assert (arrdata.at(group).at(m).data.at(var)); \ + delete (gf<T,dim>*)arrdata.at(group).at(m).data.at(var); \ + arrdata.at(group).at(m).data.at(var) = 0; \ + break; #include "typecase" #undef TYPECASE - default: - UnsupportedVarType(n); - } // switch - arrdata[group].data[var] = 0; - - if (CCTK_GroupTypeI(group) != CCTK_GF) { - for (int tl=0; tl<num_tl; ++tl) { - cgh->data[n][tl] = 0; + default: + UnsupportedVarType(n); + } // switch + arrdata.at(group).at(m).data.at(var) = 0; + + if (CCTK_GroupTypeI(group) != CCTK_GF) { + for (int tl=0; tl<num_tl; ++tl) { + cgh->data[n][tl] = 0; + } } - } + + } // for } // for // VGF: free - // storage was not disabled previously + // storage was enabled previously return 1; } @@ -206,8 +197,8 @@ namespace Carpet { const int var = 0; assert (group<(int)arrdata.size()); - assert (var<(int)arrdata[group].data.size()); - return arrdata[group].data[var] != 0; + assert (var<(int)arrdata.at(group).at(0).data.size()); + return arrdata.at(group).at(0).data.at(var) != 0; } @@ -216,22 +207,29 @@ namespace Carpet { const char* groupname) { static const int zero = 0; + static const int error = -1; if (groupname) { group = CCTK_GroupIndex(groupname); } assert (group>=0 && group<CCTK_NumGroups()); - const int gpdim = arrdata[group].info.dim; + if (mglevel == -1) { + return &error; + } + + const int gptype = CCTK_GroupTypeI (group); + if (gptype == CCTK_GF && map == -1) { + return &error; + } + + const int gpdim = groupdata.at(group).info.dim; assert (dir>=0 && dir<gpdim); if (CCTK_QueryGroupStorageI(cgh, group)) { - const int var = CCTK_FirstVarIndexI(group); - assert (var>=0 && var<CCTK_NumVars()); - - assert (group<(int)arrdata.size()); - return &arrdata[group].info.lsh[dir]; + assert (group>=0 && group<(int)arrdata.size()); + return &groupdata.at(group).info.lsh[dir]; } else { @@ -246,7 +244,8 @@ namespace Carpet { int GroupDynamicData (const cGH* cgh, int group, cGroupDynamicData* data) { assert (group>=0 && group<CCTK_NumGroups()); - *data = arrdata[group].info; + assert (group>=0 && group<(int)arrdata.size()); + *data = groupdata.at(group).info; return 0; } |