Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jan 9, 2024
1 parent 73a2343 commit f4b822b
Showing 1 changed file with 39 additions and 40 deletions.
79 changes: 39 additions & 40 deletions src/simulation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,9 +338,9 @@ template <typename problem_t> class AMRSimulation : public amrex::AmrCore

// tracer particles
#ifdef AMREX_PARTICLES
void InitParticles(); // create tracer particles
int do_tracers = 0;
std::unique_ptr<amrex::AmrTracerParticleContainer> TracerPC;
void InitParticles(); // create tracer particles
int do_tracers = 0;
std::unique_ptr<amrex::AmrTracerParticleContainer> TracerPC;
#endif

// external objects
Expand Down Expand Up @@ -576,9 +576,9 @@ template <typename problem_t> void AMRSimulation<problem_t>::setInitialCondition
AverageDown();

#ifdef AMREX_PARTICLES
if (do_tracers) {
InitParticles();
}
if (do_tracers) {
InitParticles();
}
#endif

if (checkpointInterval_ > 0) {
Expand Down Expand Up @@ -991,9 +991,9 @@ template <typename problem_t> auto AMRSimulation<problem_t>::timeStepWithSubcycl

#ifdef AMREX_PARTICLES
// redistribute particles
if (do_tracers) {
TracerPC->Redistribute(lev);
}
if (do_tracers) {
TracerPC->Redistribute(lev);
}
#endif

// do fix-up on all levels that have been re-gridded
Expand Down Expand Up @@ -1121,17 +1121,17 @@ template <typename problem_t> auto AMRSimulation<problem_t>::timeStepWithSubcycl

#ifdef AMREX_PARTICLES
// redistribute particles
if (do_tracers) {
int redistribute_ngrow = 0;
if ((iteration < nsubsteps[lev]) || (lev == 0)){
if (lev == 0){
redistribute_ngrow = 0;
} else {
redistribute_ngrow = iteration;
}
TracerPC->Redistribute(lev, TracerPC->finestLevel(), redistribute_ngrow);
}
}
if (do_tracers) {
int redistribute_ngrow = 0;
if ((iteration < nsubsteps[lev]) || (lev == 0)) {
if (lev == 0) {
redistribute_ngrow = 0;
} else {
redistribute_ngrow = iteration;
}
TracerPC->Redistribute(lev, TracerPC->finestLevel(), redistribute_ngrow);
}
}
#endif

return stepsLeft;
Expand Down Expand Up @@ -1680,17 +1680,16 @@ template <typename problem_t> void AMRSimulation<problem_t>::AverageDownTo(int c
#ifdef AMREX_PARTICLES
template <typename problem_t> void AMRSimulation<problem_t>::InitParticles()
{
if (do_tracers)
{
AMREX_ASSERT(TracerPC == nullptr);
TracerPC = std::make_unique<AmrTracerParticleContainer>(this);
if (do_tracers) {
AMREX_ASSERT(TracerPC == nullptr);
TracerPC = std::make_unique<AmrTracerParticleContainer>(this);

AmrTracerParticleContainer::ParticleInitData pdata = {{AMREX_D_DECL(0.0, 0.0, 0.0)},{},{},{}};
AmrTracerParticleContainer::ParticleInitData pdata = {{AMREX_D_DECL(0.0, 0.0, 0.0)}, {}, {}, {}};

TracerPC->SetVerbose(0);
TracerPC->InitOnePerCell(0.5, 0.5, 0.5, pdata);
TracerPC->Redistribute();
}
TracerPC->SetVerbose(0);
TracerPC->InitOnePerCell(0.5, 0.5, 0.5, pdata);
TracerPC->Redistribute();
}
}
#endif

Expand Down Expand Up @@ -1914,9 +1913,9 @@ template <typename problem_t> void AMRSimulation<problem_t>::WritePlotFile()
WriteMetadataFile(plotfilename + "/metadata.yaml");
#ifdef AMREX_PARTICLES
// write particles
if (do_tracers) {
TracerPC->WritePlotFile(plotfilename, "particles");
}
if (do_tracers) {
TracerPC->WritePlotFile(plotfilename, "particles");
}
#endif // AMREX_PARTICLES
#endif
}
Expand Down Expand Up @@ -2241,9 +2240,9 @@ template <typename problem_t> void AMRSimulation<problem_t>::WriteCheckpointFile

// write particle data
#ifdef AMREX_PARTICLES
if (do_tracers) {
TracerPC->Checkpoint(checkpointname, "particles", true);
}
if (do_tracers) {
TracerPC->Checkpoint(checkpointname, "particles", true);
}
#endif

// create symlink and point it at this checkpoint dir
Expand Down Expand Up @@ -2402,11 +2401,11 @@ template <typename problem_t> void AMRSimulation<problem_t>::ReadCheckpointFile(

#ifdef AMREX_PARTICLES
// read particle data
if (do_tracers) {
AMREX_ASSERT(TracerPC == nullptr);
TracerPC = std::make_unique<AmrTracerParticleContainer>(this);
TracerPC->Restart(restart_chkfile, "particles");
}
if (do_tracers) {
AMREX_ASSERT(TracerPC == nullptr);
TracerPC = std::make_unique<AmrTracerParticleContainer>(this);
TracerPC->Restart(restart_chkfile, "particles");
}
#endif

areInitialConditionsDefined_ = true;
Expand Down

0 comments on commit f4b822b

Please sign in to comment.