Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion external/parthenon
Submodule parthenon updated 69 files
+1 −1 .github/workflows/ci-extended.yml
+49 −13 CHANGELOG.md
+39 −3 CMakeLists.txt
+63 −1 doc/sphinx/src/boundary_communication.rst
+1 −0 doc/sphinx/src/building.rst
+3 −0 doc/sphinx/src/generated/diffusion-parth-table.csv
+38 −50 doc/sphinx/src/interface/sparse.rst
+7 −0 doc/sphinx/src/particles.rst
+44 −0 doc/sphinx/src/sparse_packs.rst
+8 −0 example/diffusion/CMakeLists.txt
+6 −0 example/poisson/CMakeLists.txt
+7 −0 example/poisson_gmg/CMakeLists.txt
+2 −2 example/poisson_gmg/parthenon_app_inputs.cpp
+8 −18 example/poisson_gmg/poisson_equation.hpp
+2 −0 example/sparse_advection/parthinput.sparse_advection
+1 −1 external/Kokkos
+31 −7 scripts/python/packages/parthenon_tools/parthenon_tools/movie2d.py
+5 −2 src/CMakeLists.txt
+13 −11 src/amr_criteria/amr_criteria.cpp
+12 −0 src/basic_types.hpp
+0 −1 src/bvals/bvals.cpp
+4 −2 src/bvals/comms/bnd_id.hpp
+4 −0 src/bvals/comms/bnd_info.cpp
+2 −0 src/bvals/comms/bnd_info.hpp
+73 −29 src/bvals/comms/build_boundary_buffers.cpp
+4 −1 src/bvals/comms/bvals_in_one.hpp
+0 −1 src/bvals/neighbor_block.cpp
+3 −0 src/driver/driver.cpp
+8 −0 src/driver/driver.hpp
+6 −2 src/interface/mesh_data.hpp
+1 −0 src/interface/meshblock_data.hpp
+21 −1 src/interface/metadata.hpp
+29 −0 src/interface/state_descriptor.hpp
+2 −1 src/interface/swarm.cpp
+6 −3 src/interface/swarm.hpp
+3 −77 src/interface/update.cpp
+4 −67 src/interface/update.hpp
+6 −10 src/interface/variable.cpp
+7 −1 src/interface/variable.hpp
+19 −5 src/kokkos_abstraction.hpp
+0 −1 src/mesh/mesh-amr_loadbalance.cpp
+15 −1 src/mesh/mesh-gmg.cpp
+87 −36 src/mesh/mesh.cpp
+21 −9 src/mesh/mesh.hpp
+1 −2 src/mesh/meshblock.cpp
+1 −0 src/outputs/output_parameters.hpp
+5 −1 src/outputs/outputs.cpp
+113 −0 src/pack/scratch_variables.hpp
+1 −0 src/parthenon/package.hpp
+68 −28 src/solvers/bicgstab_solver.hpp
+23 −12 src/solvers/internal_prolongation.hpp
+124 −33 src/solvers/mg_solver.hpp
+7 −0 src/solvers/solver_base.hpp
+178 −0 src/sparse/sparse_management.cpp
+53 −0 src/sparse/sparse_management.hpp
+109 −0 src/tasks/task_timing.cpp
+113 −0 src/tasks/task_timing.hpp
+12 −0 src/tasks/tasks.cpp
+20 −0 src/tasks/tasks.hpp
+25 −2 src/tasks/thread_pool.hpp
+0 −160 src/utils/buffer_utils.cpp
+0 −52 src/utils/buffer_utils.hpp
+6 −6 src/utils/index_split.cpp
+17 −0 src/utils/object_pool.hpp
+1 −0 tst/regression/test_suites/sparse_advection/parthinput.sparse_advection
+1 −0 tst/unit/CMakeLists.txt
+139 −0 tst/unit/test_scratch_variables.cpp
+5 −2 tst/unit/test_swarm.cpp
+258 −0 tst/unit/test_tasklist.cpp
103 changes: 103 additions & 0 deletions inputs/self-gravity/poly.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# ========================================================================================
# (C) (or copyright) 2025. Triad National Security, LLC. All rights reserved.
#
# This program was produced under U.S. Government contract 89233218CNA000001 for Los
# Alamos National Laboratory (LANL), which is operated by Triad National Security, LLC
# for the U.S. Department of Energy/National Nuclear Security Administration. All rights
# in the program are reserved by Triad National Security, LLC, and the U.S. Department
# of Energy/National Nuclear Security Administration. The Government is granted for
# itself and others acting on its behalf a nonexclusive, paid-up, irrevocable worldwide
# license in this material to reproduce, prepare derivative works, distribute copies to
# the public, perform publicly and display publicly, and to permit others to do so.
# ========================================================================================

<artemis>
problem = polytrope # name of the pgen
coordinates = cartesian # coordinate system

<parthenon/job>
problem_id = polytrope # problem ID: basename of output filenames

<parthenon/output1>
file_type = hdf5 # HDF5 data dump
variables = gas.prim.density, &
gas.prim.velocity, &
gas.prim.pressure, &
grav.phi, &
grav.rhs
dt = 1.0 # time increment between outputs

<parthenon/output2>
file_type = hst # HDF5 data dump
dt = 1.0 # time increment between outputs

<parthenon/time>
nlim = -1 # cycle limit
tlim = 100.0 # time limit (to be reset by problem generator)
integrator = rk2 # time integration algorithm
ncycle_out = 1 # interval for stdout summary info

<parthenon/mesh>
# do_coalesced_comms = true
refinement = adaptive
numlevel = 3
multigrid = true

nx1 = 64
x1min = -32.0
x1max = 32.0
ix1_bc = outflow
ox1_bc = outflow

nx2 = 64
x2min = -32.0
x2max = 32.0
ix2_bc = outflow
ox2_bc = outflow

nx3 = 64
x3min = -32.0
x3max = 32.0
ix3_bc = outflow
ox3_bc = outflow

<parthenon/meshblock>
nx1 = 16
nx2 = 16
nx3 = 16

<parthenon/refinement0>
method = magnitude
comparator = greater_than
field = gas.prim.density_0
refine_tol = 0.1
derefine_tol = 0.1

<physics>
gas = true
self_gravity = true

<gas>
cfl = 0.9
reconstruct = plm
riemann = hllc
gamma = 2.0

<self_gravity>
precondition = true
print_per_step = true
max_iterations = 100
residual_tolerance = 1.0e-6
smoother = SRJ2
do_FAS = true
units_override = true
use_swindle = false
ix1_bc = zero
ox1_bc = zero
ix2_bc = zero
ox2_bc = zero
ix3_bc = zero
ox3_bc = zero

<problem>
iprob = 2
9 changes: 8 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ set (SRC_LIST

gravity/binary_mass.cpp
gravity/gravity.cpp
gravity/gravity.hpp
gravity/nbody_gravity.hpp
gravity/point_mass.cpp
gravity/uniform.cpp
gravity/gravity.hpp

nbody/nbody.cpp
nbody/nbody.hpp
Expand All @@ -64,6 +64,7 @@ set (SRC_LIST
pgen/kh.hpp
pgen/linear_wave.hpp
pgen/lw.hpp
pgen/polytrope.hpp
pgen/pgen.hpp
pgen/problem_modifier.hpp
pgen/rt.hpp
Expand All @@ -85,6 +86,12 @@ set (SRC_LIST
rotating_frame/rotating_frame_impl.hpp
rotating_frame/rotating_frame.hpp

self_gravity/self_gravity.cpp
self_gravity/self_gravity.hpp
self_gravity/poisson_driver.cpp
self_gravity/poisson_equation.hpp
self_gravity/self_gravity.cpp

utils/artemis_utils.cpp
utils/artemis_utils.hpp
utils/history.hpp
Expand Down
6 changes: 6 additions & 0 deletions src/artemis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "radiation/moments/moments.hpp"
#include "radiation/radiation.hpp"
#include "rotating_frame/rotating_frame.hpp"
#include "self_gravity/self_gravity.hpp"
#include "utils/artemis_utils.hpp"
#include "utils/history.hpp"
#include "utils/units.hpp"
Expand Down Expand Up @@ -80,6 +81,7 @@ Packages_t ProcessPackages(std::unique_ptr<ParameterInput> &pin) {
artemis->AddParam("x2max", x2max);
artemis->AddParam("x3min", x3min);
artemis->AddParam("x3max", x3max);
artemis->AddParam("domain_volume", (x1max - x1min) * (x2max - x2min) * (x3max - x3min));

// Add optionally enrollable operator split Metadata flag
parthenon::MetadataFlag MetadataOperatorSplit =
Expand All @@ -89,6 +91,7 @@ Packages_t ProcessPackages(std::unique_ptr<ParameterInput> &pin) {
const bool do_gas = pin->GetOrAddBoolean("physics", "gas", true);
const bool do_dust = pin->GetOrAddBoolean("physics", "dust", false);
const bool do_gravity = pin->GetOrAddBoolean("physics", "gravity", false);
const bool do_self_gravity = pin->GetOrAddBoolean("physics", "self_gravity", false);
const bool do_nbody = pin->GetOrAddBoolean("physics", "nbody", false);
const bool do_rotating_frame = pin->GetOrAddBoolean("physics", "rotating_frame", false);
const bool do_cooling = pin->GetOrAddBoolean("physics", "cooling", false);
Expand Down Expand Up @@ -119,6 +122,7 @@ Packages_t ProcessPackages(std::unique_ptr<ParameterInput> &pin) {
artemis->AddParam("do_gas", do_gas);
artemis->AddParam("do_dust", do_dust);
artemis->AddParam("do_gravity", do_gravity);
artemis->AddParam("do_self_gravity", do_self_gravity);
artemis->AddParam("do_nbody", do_nbody);
artemis->AddParam("do_rotating_frame", do_rotating_frame);
artemis->AddParam("do_cooling", do_cooling);
Expand All @@ -144,6 +148,8 @@ Packages_t ProcessPackages(std::unique_ptr<ParameterInput> &pin) {
// Call package initializers here
if (do_nbody) packages.Add(NBody::Initialize(pin.get(), constants));
if (do_gravity) packages.Add(Gravity::Initialize(pin.get(), constants, packages));
if (do_self_gravity)
packages.Add(SelfGravity::Initialize(pin.get(), constants, packages));
if (do_gas) packages.Add(Gas::Initialize(pin.get(), units, constants, packages));
if (do_dust) packages.Add(Dust::Initialize(pin.get(), units));
if (do_rotating_frame) packages.Add(RotatingFrame::Initialize(pin.get()));
Expand Down
5 changes: 5 additions & 0 deletions src/artemis.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ ARTEMIS_VARIABLE(rad.opac, scattering);
} // namespace opac
} // namespace rad

namespace grav {
ARTEMIS_VARIABLE(grav, phi);
ARTEMIS_VARIABLE(grav, rhs);
} // namespace grav

#undef ARTEMIS_VARIABLE

// Restart options (see Parthenon #1231)
Expand Down
19 changes: 16 additions & 3 deletions src/artemis_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include "radiation/imc/imc.hpp"
#include "radiation/moments/moments.hpp"
#include "rotating_frame/rotating_frame.hpp"
#include "self_gravity/self_gravity.hpp"
#include "utils/integrators/artemis_integrator.hpp"

using namespace parthenon::driver::prelude;
Expand Down Expand Up @@ -59,6 +60,7 @@ ArtemisDriver<GEOM>::ArtemisDriver(ParameterInput *pin, ApplicationInput *app_in
do_gas = artemis_pkg->template Param<bool>("do_gas");
do_dust = artemis_pkg->template Param<bool>("do_dust");
do_gravity = artemis_pkg->template Param<bool>("do_gravity");
do_self_gravity = artemis_pkg->template Param<bool>("do_self_gravity");
do_rotating_frame = artemis_pkg->template Param<bool>("do_rotating_frame");
do_shear = artemis_pkg->template Param<bool>("do_shear");
do_cooling = artemis_pkg->template Param<bool>("do_cooling");
Expand Down Expand Up @@ -206,6 +208,9 @@ TaskCollection ArtemisDriver<GEOM>::StepTasks() {
const Real g1 = integrator->gam1[stage - 1];
const Real bdt = integrator->beta[stage - 1] * integrator->dt;

// Compute gravitational potential
if (do_self_gravity) SelfGravity::SolvePoisson(tc, pmesh);

TaskRegion &tr = tc.AddRegion(num_partitions);
for (int i = 0; i < num_partitions; i++) {
auto &tl = tr[i];
Expand Down Expand Up @@ -264,11 +269,19 @@ TaskCollection ArtemisDriver<GEOM>::StepTasks() {
Gravity::ExternalGravity<GEOM>, u0.get(), time, bdt);
}

// Apply self-gravity source term
TaskID self_gravity_src = gas_coord_src | dust_coord_src | gas_diff_src;
if (do_self_gravity) {
self_gravity_src =
tl.AddTask(gas_coord_src | dust_coord_src | gas_diff_src,
SelfGravity::SelfGravity<GEOM>, u0.get(), time, bdt);
}

// Apply rotating frame source term
TaskID rframe_src = gravity_src;
TaskID rframe_src = gravity_src | self_gravity_src;
if (do_rotating_frame) {
rframe_src = tl.AddTask(gravity_src, RotatingFrame::RotatingFrameForce, u0.get(),
time, bdt);
rframe_src = tl.AddTask(gravity_src | self_gravity_src,
RotatingFrame::RotatingFrameForce, u0.get(), time, bdt);
}

// Apply drag source term
Expand Down
2 changes: 1 addition & 1 deletion src/artemis_driver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class ArtemisDriver : public EvolutionDriver {
IntegratorPtr_t integrator, nbody_integrator, rad_integrator;
StateDescriptor *artemis_pkg;
bool do_gas, do_dust, do_moment, do_imc;
bool do_gravity, do_nbody, do_rotating_frame, do_shear;
bool do_gravity, do_self_gravity, do_nbody, do_rotating_frame, do_shear;
bool do_cooling, do_drag, do_viscosity, do_conduction, do_diffusion;
const bool is_restart;
};
Expand Down
4 changes: 4 additions & 0 deletions src/artemis_params.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ physics:
_type: "bool"
_default: "false"
_description: "Turn on gravity"
self_gravity:
_type: "bool"
_default: "false"
_description: "Turn on self-gravity"
rotating_frame:
_type: "bool"
_default: "false"
Expand Down
1 change: 0 additions & 1 deletion src/gravity/gravity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ std::shared_ptr<StateDescriptor> Initialize(ParameterInput *pin,
}

PARTHENON_REQUIRE((count > 0) && (gtype != GravityType::null), "Unknown gravity node!");

PARTHENON_REQUIRE(count == 1, "artemis only supports 1 gravity type at this time");

params.Add("type", gtype);
Expand Down
3 changes: 1 addition & 2 deletions src/gravity/gravity.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ TaskStatus NBodyGravityFixed(MeshData<Real> *md, const Real time, const Real dt)
template <Coordinates GEOM>
TaskStatus ExternalGravity(MeshData<Real> *md, const Real time, const Real dt);

KOKKOS_INLINE_FUNCTION
Real quad_ramp(const Real x) { return SQR(x); }
KOKKOS_INLINE_FUNCTION Real quad_ramp(const Real x) { return SQR(x); }

} // namespace Gravity

Expand Down
5 changes: 4 additions & 1 deletion src/pgen/pgen.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//========================================================================================
// (C) (or copyright) 2023-2024. Triad National Security, LLC. All rights reserved.
// (C) (or copyright) 2023-2025. Triad National Security, LLC. All rights reserved.
//
// This program was produced under U.S. Government contract 89233218CNA000001 for Los
// Alamos National Laboratory (LANL), which is operated by Triad National Security, LLC
Expand Down Expand Up @@ -28,6 +28,7 @@
#include "kh.hpp"
#include "linear_wave.hpp"
#include "lw.hpp"
#include "polytrope.hpp"
#include "rt.hpp"
#include "shock.hpp"
#include "strat.hpp"
Expand Down Expand Up @@ -60,6 +61,8 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) {
linear_wave::ProblemGenerator<T>(pmb, pin);
} else if (name == "lw") {
lw::ProblemGenerator<T>(pmb, pin);
} else if (name == "polytrope") {
polytrope::ProblemGenerator<T>(pmb, pin);
} else if (name == "kh") {
kh::ProblemGenerator<T>(pmb, pin);
} else if (name == "rt") {
Expand Down
Loading