Skip to content

Commit eacd354

Browse files
Merge pull request #882 from markusbattarbee/adjust_blocks_sysboundaries_setup
Adjust blocks at sysboundaries
2 parents b64ca63 + f33deb7 commit eacd354

File tree

6 files changed

+10
-9
lines changed

6 files changed

+10
-9
lines changed

spatial_cell.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ namespace spatial_cell {
353353

354354
#endif
355355

356-
void SpatialCell::adjustSingleCellVelocityBlocks(const uint popID) {
356+
void SpatialCell::adjustSingleCellVelocityBlocks(const uint popID, bool doDeleteEmpty) {
357357
#ifdef DEBUG_SPATIAL_CELL
358358
if (popID >= populations.size()) {
359359
std::cerr << "ERROR, popID " << popID << " exceeds populations.size() " << populations.size() << " in ";
@@ -367,7 +367,7 @@ namespace spatial_cell {
367367
//space. TODO: should this delete blocks or not? Now not
368368
std::vector<SpatialCell*> neighbor_ptrs;
369369
update_velocity_block_content_lists(popID);
370-
adjust_velocity_blocks(neighbor_ptrs,popID,false);
370+
adjust_velocity_blocks(neighbor_ptrs,popID,doDeleteEmpty);
371371
}
372372

373373
void SpatialCell::coarsen_block(const vmesh::GlobalID& parent,const std::vector<vmesh::GlobalID>& children,const uint popID) {

spatial_cell.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ namespace spatial_cell {
265265
bool add_velocity_block(const vmesh::GlobalID& block,const uint popID);
266266
void add_velocity_blocks(const std::vector<vmesh::GlobalID>& blocks,const uint popID);
267267
bool add_velocity_block_octant(const vmesh::GlobalID& blockGID,const uint popID);
268-
void adjustSingleCellVelocityBlocks(const uint popID);
268+
void adjustSingleCellVelocityBlocks(const uint popID, bool doDeleteEmpty=false);
269269
void adjust_velocity_blocks(const std::vector<SpatialCell*>& spatial_neighbors,
270270
const uint popID,
271271
bool doDeleteEmptyBlocks=true);

sysboundary/copysphere.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -797,7 +797,7 @@ namespace SBC {
797797
} // for-loop over velocity blocks
798798

799799
// let's get rid of blocks not fulfilling the criteria here to save memory.
800-
templateCell.adjustSingleCellVelocityBlocks(popID);
800+
templateCell.adjustSingleCellVelocityBlocks(popID,true);
801801
} // for-loop over particle species
802802

803803
calculateCellMoments(&templateCell,true,false,true);

sysboundary/donotcompute.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,9 @@ namespace SBC {
7979

8080
//let's get rid of blocks not fulfilling the criteria here to save
8181
//memory.
82-
for (uint popID=0; popID<getObjectWrapper().particleSpecies.size(); ++popID)
83-
cell->adjustSingleCellVelocityBlocks(popID);
82+
for (uint popID=0; popID<getObjectWrapper().particleSpecies.size(); ++popID) {
83+
cell->adjustSingleCellVelocityBlocks(popID,true);
84+
}
8485
}
8586
}
8687

sysboundary/ionosphere.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3315,7 +3315,7 @@ namespace SBC {
33153315
}
33163316

33173317
// Block adjust and recalculate moments
3318-
mpiGrid[cellID]->adjustSingleCellVelocityBlocks(popID);
3318+
mpiGrid[cellID]->adjustSingleCellVelocityBlocks(popID,true);
33193319
// TODO: The moments can also be analytically calculated from ionosphere parameters.
33203320
// Maybe that's faster?
33213321
calculateCellMoments(mpiGrid[cellID], true, false, true);
@@ -3382,7 +3382,7 @@ namespace SBC {
33823382
} // for-loop over velocity blocks
33833383

33843384
// let's get rid of blocks not fulfilling the criteria here to save memory.
3385-
templateCell.adjustSingleCellVelocityBlocks(popID);
3385+
templateCell.adjustSingleCellVelocityBlocks(popID,true);
33863386
} // for-loop over particle species
33873387

33883388
calculateCellMoments(&templateCell,true,false,true);

sysboundary/setmaxwellian.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ namespace SBC {
259259

260260
//let's get rid of blocks not fulfilling the criteria here to save
261261
//memory.
262-
templateCell.adjustSingleCellVelocityBlocks(popID);
262+
templateCell.adjustSingleCellVelocityBlocks(popID,true);
263263
} // for-loop over particle species
264264

265265
B[0] = Bx;

0 commit comments

Comments
 (0)