diff --git a/Template-Config.sh b/Template-Config.sh index 8091e3cb2030930ca59df77a5a042e85c87a5809..49e155bcb3e683dff0a2d8a96a7921f388d41778 100644 --- a/Template-Config.sh +++ b/Template-Config.sh @@ -10,6 +10,7 @@ #PERIODIC # enables periodic boundary condistions #NTYPES=6 # number of particle types #RANDOMIZE_DOMAINCENTER # shifts the particle distribution randomly each step to reduce correlations of force errors in time +#RANDOMIZE_DOMAINCENTER_TYPES # can be used to set a zoom region via a particle type which is then never placed across large node boundaries #LEAN # selects a special 'lean' mode of code operation, which is optimized for aggressive memory saving #LONG_X_BITS=2 # can be used to reduce periodic box-dimension in x-direction relative to nominal box size #LONG_Y_BITS=2 # can be used to reduce periodic box-dimension in y-direction relative to nominal box size diff --git a/documentation/04_config-options.md b/documentation/04_config-options.md index cf80f934b9f357ae0226c9d69861ae91bd4449b1..0c9bd761861e3dc1d798c72ce93ee38e385515a6 100644 --- a/documentation/04_config-options.md +++ b/documentation/04_config-options.md @@ -324,6 +324,18 @@ recommended, and should have only positive effects. ------- +**RANDOMIZE_DOMAINCENTER_TYPES** = 2 + +Can be set to select one or several types (this is a bitmask) which +will then be used to locate the extension of a certain region. When +the particle set is randomly translated throughout the box, the code +will then try to avoid intersecting large oct-tree node boundaries +with this region. When this option is not set explicitely but +PLACEHIGHRESREGION is active, then this is automatically done +with a default setting RANDOMIZE_DOMAINCENTER_TYPES=PLACEHIGHRESREGION. + +------- + **EVALPOTENTIAL** When this is activated, the code also computes the gravitational diff --git a/src/data/constants.h b/src/data/constants.h index 2fc5303aa9552c88ea297548995f86e350e69262..7aa40b3fac9616d2e37ea8130ccbdbe288581f56 100644 --- a/src/data/constants.h +++ b/src/data/constants.h @@ -147,6 +147,10 @@ #define HRPMGRID PMGRID #endif +#if !defined(RANDOMIZE_DOMAINCENTER_TYPES) && defined(PLACEHIGHRESREGION) +#define RANDOMIZE_DOMAINCENTER_TYPES PLACEHIGHRESREGION +#endif + #if defined(SUBFIND) && !defined(SELFGRAVITY) #error "Running SUBFIND without SELFGRAVITY enabled does not make sense." #endif diff --git a/src/data/simparticles.h b/src/data/simparticles.h index 6b4f2279bdbfa4b79baff00af79a2f985d21ce68..5fcf5546c524cc03f22d3be06446c8f7bdf7dfab 100644 --- a/src/data/simparticles.h +++ b/src/data/simparticles.h @@ -153,6 +153,9 @@ class simparticles : public intposconvert, public setcomm MyIntPosType Left[2][3]; MyIntPosType OldMeshSize[2]; MyIntPosType ReferenceIntPos[2][3]; +#endif + +#if defined(RANDOMIZE_DOMAINCENTER_TYPES) || defined(PLACEHIGHRESREGION) MyIntPosType PlacingMask; MyIntPosType PlacingBlocksize; #endif diff --git a/src/domain/domain.h b/src/domain/domain.h index 58d42041cad5112fb46031cd9dbf4b432bce7279..1ac2308a3876d37aa44baa876d82a6a7f7e2dda1 100644 --- a/src/domain/domain.h +++ b/src/domain/domain.h @@ -255,7 +255,7 @@ class domain : public setcomm return a.targetindex < b.targetindex; } -#if defined(PLACEHIGHRESREGION) || defined(RANDOMIZE_DOMAINCENTER) +#if defined(RANDOMIZE_DOMAINCENTER_TYPES) || defined(RANDOMIZE_DOMAINCENTER) MyIntPosType domainInnersize; MyIntPosType domainReferenceIntPos[3]; MySignedIntPosType domainXmintot[3], domainXmaxtot[3]; diff --git a/src/domain/domain_box.cc b/src/domain/domain_box.cc index 2c1520c11647ad6b52bab7681ebf355a1d7b7ffc..10bc0b008ceb64de12be2089d0deb7f93de79af4 100644 --- a/src/domain/domain_box.cc +++ b/src/domain/domain_box.cc @@ -119,13 +119,13 @@ void domain<simparticles>::do_box_wrapping(void) #ifdef RANDOMIZE_DOMAINCENTER /* determine new shift vector */ -#if defined(PLACEHIGHRESREGION) +#if defined(RANDOMIZE_DOMAINCENTER_TYPES) || defined(PLACEHIGHRESREGION) domain_find_type_extension(); #endif if(ThisTask == 0) { -#if defined(PLACEHIGHRESREGION) +#if defined(RANDOMIZE_DOMAINCENTER_TYPES) || defined(PLACEHIGHRESREGION) int count = 0; #endif @@ -145,7 +145,7 @@ void domain<simparticles>::do_box_wrapping(void) Tp->CurrentShiftVector[j] += get_random_number() * pow(2.0, 32); #endif -#if defined(PLACEHIGHRESREGION) +#if defined(RANDOMIZE_DOMAINCENTER_TYPES) || defined(PLACEHIGHRESREGION) MyIntPosType boxoff = (Tp->CurrentShiftVector[j] & Tp->PlacingMask); MyIntPosType inboxoff = (Tp->CurrentShiftVector[j] - boxoff) % (Tp->PlacingBlocksize - domainInnersize); @@ -190,7 +190,7 @@ void domain<simparticles>::do_box_wrapping(void) #endif } -#if defined(PLACEHIGHRESREGION) +#if defined(RANDOMIZE_DOMAINCENTER_TYPES) || defined(PLACEHIGHRESREGION) template <typename partset> int domain<partset>::domain_type_extension_overlap(int j) @@ -217,7 +217,7 @@ void domain<partset>::domain_find_type_extension(void) for(int i = 0; i < Tp->NumPart; i++) { - if(((1 << Tp->P[i].getType()) & (PLACEHIGHRESREGION))) + if(((1 << Tp->P[i].getType()) & (RANDOMIZE_DOMAINCENTER_TYPES))) { for(int j = 0; j < 3; j++) domainReferenceIntPos[j] = Tp->P[i].IntPos[j]; @@ -232,8 +232,8 @@ void domain<partset>::domain_find_type_extension(void) MPI_Allreduce(MPI_IN_PLACE, have_global, 1, MPI_2INT, MPI_MINLOC, Communicator); if(have_global[0] >= NTask) - Terminate("have_global[0]=%d >= NTask=%d: Don't we have any particle? Note: PLACEHIGHRESREGION=%d is a bitmask", have_global[0], - NTask, PLACEHIGHRESREGION); + Terminate("have_global[0]=%d >= NTask=%d: Don't we have any particle? Note: RANDOMIZE_DOMAINCENTER_TYPES=%d is a bitmask", + have_global[0], NTask, RANDOMIZE_DOMAINCENTER_TYPES); MPI_Bcast(domainReferenceIntPos, 3 * sizeof(MyIntPosType), MPI_BYTE, have_global[1], Communicator); @@ -249,7 +249,7 @@ void domain<partset>::domain_find_type_extension(void) for(int i = 0; i < Tp->NumPart; i++) { - if(((1 << Tp->P[i].getType()) & (PLACEHIGHRESREGION))) + if(((1 << Tp->P[i].getType()) & (RANDOMIZE_DOMAINCENTER_TYPES))) { MyIntPosType diff[3] = {Tp->P[i].IntPos[0] - domainReferenceIntPos[0], Tp->P[i].IntPos[1] - domainReferenceIntPos[1], Tp->P[i].IntPos[2] - domainReferenceIntPos[2]}; @@ -280,10 +280,10 @@ void domain<partset>::domain_find_type_extension(void) if((MyIntPosType)(domainXmaxtot[2] - domainXmintot[2]) > domainInnersize) domainInnersize = domainXmaxtot[2] - domainXmintot[2]; - domain_printf("DOMAIN: Shrink-wrap region size for PLACEHIGHRESREGION is %g\n", domainInnersize * Tp->FacIntToCoord); + domain_printf("DOMAIN: Shrink-wrap region size for RANDOMIZE_DOMAINCENTER_TYPES is %g\n", domainInnersize * Tp->FacIntToCoord); if(domainInnersize * Tp->FacIntToCoord >= 0.125 * All.BoxSize) - Terminate("inappropriately big region selection for PLACEHIGHRESREGION"); + Terminate("inappropriately big region selection for RANDOMIZE_DOMAINCENTER_TYPES"); /* increase the region by at least 1/8 of its size to still allow some randomness in placing the particles within the high-res node */