From d48436428d6e1c10aea9d02e5b2123f073de54dd Mon Sep 17 00:00:00 2001 From: Ben Wibking Date: Thu, 18 Jan 2024 16:16:02 -0500 Subject: [PATCH] add massive particles to SphericalCollapse problem --- src/SphericalCollapse/spherical_collapse.cpp | 9 ++++++++- tests/SphericalCollapse.in | 3 ++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/SphericalCollapse/spherical_collapse.cpp b/src/SphericalCollapse/spherical_collapse.cpp index 929f996c4..36b1b5094 100644 --- a/src/SphericalCollapse/spherical_collapse.cpp +++ b/src/SphericalCollapse/spherical_collapse.cpp @@ -87,7 +87,14 @@ template <> void RadhydroSimulation::setInitialConditionsOnGrid template <> void RadhydroSimulation::createInitialParticles() { - // note: an implementation is only required if particles are used + // add particles at random positions in the box + bool generate_on_root_rank = true; + int iseed = 42; + int num_particles = 1000; + double particle_mass = 0.5 / static_cast(num_particles); + + quokka::CICParticleContainer::ParticleInitData pdata = {{particle_mass}, {0}, {0}, {0}}; // mass vx vy vz + CICParticles->InitRandom(num_particles, iseed, pdata, generate_on_root_rank); } template <> void RadhydroSimulation::ErrorEst(int lev, amrex::TagBoxArray &tags, amrex::Real /*time*/, int /*ngrow*/) diff --git a/tests/SphericalCollapse.in b/tests/SphericalCollapse.in index 943e37065..ede0bede0 100644 --- a/tests/SphericalCollapse.in +++ b/tests/SphericalCollapse.in @@ -31,7 +31,8 @@ gravity.Gconst = 1.0 # gravitational constant do_reflux = 1 do_subcycle = 0 -do_tracers = 1 # turn on tracer particles +do_tracers = 0 # turn on tracer particles +do_cic_particles = 1 # turns on CIC particles ascent_interval = 100 plotfile_interval = 200