Skip to content

Commit

Permalink
Disable tracer particles at run time
Browse files Browse the repository at this point in the history
There is a runtime parameter `particles.do_nspc_particles` for disabling
particles. But it was not used everywhere. This commit fixes it.
  • Loading branch information
WeiqunZhang committed Mar 5, 2024
1 parent 535de11 commit d550332
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 14 deletions.
26 changes: 14 additions & 12 deletions Source/NS_setup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -449,18 +449,20 @@ NavierStokes::variableSetUp ()
derive_lst.addComponent("avg_pressure",desc_lst,Press_Type,Pressure,1);

#ifdef AMREX_PARTICLES
//
// The particle count at this level.
//
derive_lst.add("particle_count",IndexType::TheCellType(),1,
dernull,the_same_box);
derive_lst.addComponent("particle_count",desc_lst,State_Type,Density,1);
//
// The total # of particles at our level or above.
//
derive_lst.add("total_particle_count",IndexType::TheCellType(),1,
dernull,the_same_box);
derive_lst.addComponent("total_particle_count",desc_lst,State_Type,Density,1);
if (do_nspc) {
//
// The particle count at this level.
//
derive_lst.add("particle_count",IndexType::TheCellType(),1,
dernull,the_same_box);
derive_lst.addComponent("particle_count",desc_lst,State_Type,Density,1);
//
// The total # of particles at our level or above.
//
derive_lst.add("total_particle_count",IndexType::TheCellType(),1,
dernull,the_same_box);
derive_lst.addComponent("total_particle_count",desc_lst,State_Type,Density,1);
}
#endif

//
Expand Down
4 changes: 3 additions & 1 deletion Source/NavierStokes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,9 @@ NavierStokes::initData ()
}

#ifdef AMREX_PARTICLES
initParticleData ();
if (do_nspc) {
initParticleData ();
}
#endif
}

Expand Down
4 changes: 3 additions & 1 deletion Source/NavierStokesBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ NavierStokesBase::advance_setup (Real /*time*/,
umac_n_grow = 1;

#ifdef AMREX_PARTICLES
if (ncycle > umac_n_grow) {
if (ncycle > umac_n_grow && NSPC) {
umac_n_grow = ncycle;
}
#endif
Expand Down Expand Up @@ -3813,6 +3813,8 @@ NavierStokesBase::read_particle_params ()
void
NavierStokesBase::initParticleData ()
{
if (!do_nspc) { return; }

if (level == 0)
{
if (NSPC == 0)
Expand Down

0 comments on commit d550332

Please sign in to comment.