Skip to content

Commit

Permalink
Fix particle_initrandom_mass_total scaling to use whole domain
Browse files Browse the repository at this point in the history
  • Loading branch information
jmsexton03 committed Sep 10, 2021
1 parent 0aa9b2a commit 2a4721b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 7 additions & 3 deletions Source/Particle/NyxParticles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -417,13 +417,17 @@ Nyx::init_particles ()
Real tol = 1e-12;
#endif

Real number_of_cells = Geom().ProbLength(0)/Geom().CellSize(0) *
Geom().ProbLength(1)/Geom().CellSize(1) *
Geom().ProbLength(2)/Geom().CellSize(2);
if(particle_initrandom_mass <= 0) {
particle_initrandom_mass = particle_initrandom_mass_total / amrex::Real(grids[level].numPts());
particle_initrandom_mass = particle_initrandom_mass_total / number_of_cells;
if(verbose)
amrex::Print()<<"... setting particle_initrandom_mass to "<<particle_initrandom_mass<<std::endl;
amrex::Print()<<"... setting particle_initrandom_mass to "<<particle_initrandom_mass<<
" by dividing "<<particle_initrandom_mass_total<<" by "<< number_of_cells<<std::endl;
}

if(particle_initrandom_mass_total / amrex::Real(grids[level].numPts()) - particle_initrandom_mass > tol
if(particle_initrandom_mass_total / number_of_cells - particle_initrandom_mass > tol
&& (particle_init_type == "Random" ||
particle_init_type == "RandomPerBox" ||
particle_init_type == "RandomPerCell" ))
Expand Down
2 changes: 2 additions & 0 deletions Source/TimeStep/Nyx_advance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ Nyx::advance (Real time,

{

const std::string region_name = nStep() > 1 ? "R::Nyx::advance" : "R::Nyx::advance::STEP1";
BL_PROFILE_REGION(region_name);
MultiFab::RegionTag amrlevel_tag("AmrLevel_Level_" + std::to_string(level));

#ifdef NO_HYDRO
Expand Down

0 comments on commit 2a4721b

Please sign in to comment.