From 2a4721be27945763736af5e0179efd78758f544d Mon Sep 17 00:00:00 2001 From: "Jean M. Sexton" Date: Thu, 9 Sep 2021 21:55:54 -0700 Subject: [PATCH] Fix particle_initrandom_mass_total scaling to use whole domain --- Source/Particle/NyxParticles.cpp | 10 +++++++--- Source/TimeStep/Nyx_advance.cpp | 2 ++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Source/Particle/NyxParticles.cpp b/Source/Particle/NyxParticles.cpp index c8310d4b..89fe5686 100644 --- a/Source/Particle/NyxParticles.cpp +++ b/Source/Particle/NyxParticles.cpp @@ -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 "< 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" )) diff --git a/Source/TimeStep/Nyx_advance.cpp b/Source/TimeStep/Nyx_advance.cpp index 4e5c42c4..b25da199 100644 --- a/Source/TimeStep/Nyx_advance.cpp +++ b/Source/TimeStep/Nyx_advance.cpp @@ -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