Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
e665b18
Add Kokkos Kernels
adamdempsey90 Feb 10, 2026
746344a
Sync
adamdempsey90 May 9, 2026
1328e5a
Add kokkos kernels drag impl
adamdempsey90 May 9, 2026
7c30397
eos is now a vector
May 9, 2026
1d1d040
initial implementation of drag coupling for gas
May 9, 2026
bacc043
input for drag test
May 9, 2026
e8d9a37
add unit tests for collision integrals
May 9, 2026
7919c78
Get escape_1d running
May 9, 2026
ccfb625
Actually use real artemis optoins...
May 10, 2026
09e9491
Merge remote-tracking branch 'origin/develop' into dempsey/closures
adamdempsey90 Jun 6, 2026
a5161d1
Merge remote-tracking branch 'origin/develop' into dempsey/closures
adamdempsey90 Jun 7, 2026
c2d8db6
Fix merge conflict
adamdempsey90 Jun 7, 2026
95b0d10
Atmospheric escape problem is now working, but not escaping yet
adamdempsey90 Jun 9, 2026
021a526
Add another atmosphere input
adamdempsey90 Jun 18, 2026
b667d39
Merge branch 'dempsey/closures' of github.com:lanl/artemis into demps…
adamdempsey90 Jul 7, 2026
27df22b
Cleanup
adamdempsey90 Jul 14, 2026
f0c1a32
Merge remote-tracking branch 'origin/develop' into dempsey/closures
adamdempsey90 Jul 14, 2026
612f9a3
Unlock spiner EOS (and change name from sesame)
adamdempsey90 Jul 16, 2026
025a2d7
Remove EOS lambda stuff
adamdempsey90 Jul 16, 2026
ab3ebc4
format
adamdempsey90 Jul 16, 2026
fcdb65b
Array of material opacities
adamdempsey90 Jul 28, 2026
944e8b2
Merge remote-tracking branch 'origin/develop' into dempsey/closures
adamdempsey90 Jul 28, 2026
4c8cb53
Remove dependence on gamma and mu from pgens
adamdempsey90 Jul 30, 2026
97d1a58
Remove dependence on kbmu
adamdempsey90 Jul 30, 2026
3d7a1b6
Fix 2 fluid closure issue
adamdempsey90 Jul 30, 2026
feb164d
Merge remote-tracking branch 'origin/develop' into dempsey/closures
adamdempsey90 Jul 30, 2026
f6f18b9
Use auto for host mirror
adamdempsey90 Jul 30, 2026
aeee77c
More updates for vector eos/opacity/mu
adamdempsey90 Aug 1, 2026
3b52d76
Fix eos unit conversions and fix host mirror types passed to jaybenne
adamdempsey90 Aug 2, 2026
c2e286e
Back to using auto and not host_mirror_type
adamdempsey90 Aug 2, 2026
ca80dd5
Fix EofPR calls
adamdempsey90 Aug 2, 2026
ee63027
Use species index for eos
adamdempsey90 Aug 2, 2026
306d348
Fix disk temp profile
adamdempsey90 Aug 2, 2026
91ff89a
Don't touch the device eos on host, use deep copy
adamdempsey90 Aug 3, 2026
68cf993
Use the HostArray not ParArray for the host mirros
adamdempsey90 Aug 3, 2026
1ed5b1a
Don't touch the device eos on host, use deep copy
adamdempsey90 Aug 3, 2026
44a6882
Indexing into the device ParArray is touching it on host, do that on …
adamdempsey90 Aug 3, 2026
3856c6f
Give up on host mirrors working, just store host eos in std::vector
adamdempsey90 Aug 3, 2026
8cde7f0
Add <vector>
adamdempsey90 Aug 3, 2026
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
8 changes: 6 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
url = https://github.com/lanl/jaybenne.git
ignore = dirty
[submodule "external/Catch2"]
path = external/Catch2
url = https://github.com/catchorg/Catch2.git
path = external/Catch2
url = https://github.com/catchorg/Catch2.git
ignore = dirty
[submodule "external/kokkos-kernels"]
path = external/kokkos-kernels
url = https://github.com/kokkos/kokkos-kernels
ignore = dirty
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,10 @@ set(CMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY ON CACHE BOOL "" FORCE)
message("Configuring singularity-eos")
add_subdirectory(external/singularity-eos singularity-eos)

# Kokkos kernels
message("Configuring Kokkos Kernels")
add_subdirectory(external/kokkos-kernels)

# REBOUND
message("Configuring REBOUND")
# Define the source and destination directories
Expand Down
1 change: 1 addition & 0 deletions external/kokkos-kernels
Submodule kokkos-kernels added at 2899eb
95 changes: 95 additions & 0 deletions inputs/atmosphere/escape_1d.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# =============================================================================
# Artemis input deck: 1D spherical planetary atmospheric escape
#
# Two species (H, mu=1 and O, mu=16) in a 1D spherically-symmetric atmosphere
# under point-mass gravity. Chapman-Cowling (hard-sphere) drag couples them.
# Species 0 (H) is light enough to escape; species 1 (O) is gravitationally
# bound but gets entrained by species 0 through drag.

<artemis>
problem = escape_1d

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indentations are not consistent with style of other inputs.

coordinates = spherical
radial_spacing = logarithmic

<parthenon/job>
problem_id = drag

<parthenon/time>
nlim = 1
tlim = 50.0 # ~14 t_dyn (t_dyn = r0/v_esc = 1/sqrt(2))
integrator = rk2
ncycle_out = 1

<parthenon/mesh>
nx1 = 64
x1min = 0.0 # inner radius r0
x1max = 2.302585092994046 # outer radius
ix1_bc = hydrostatic # custom inner BC (hydrostatic inflow)
ox1_bc = outflow # custom outer BC (outflow)

nx2 = 1
x2min = 0.0
x2max = 3.14159265358979
ix2_bc = outflow
ox2_bc = outflow

nx3 = 1
x3min = -0.5
x3max = 0.5
ix3_bc = outflow
ox3_bc = outflow

<parthenon/meshblock>
nx1 = 64
nx2 = 1
nx3 = 1

<parthenon/output0>
file_type = hdf5
dt = 0.1
variables = gas.prim.density, gas.prim.velocity, gas.prim.sie, gas.prim.temperature, gas.prim.pressure

<parthenon/output1>
file_type = hst
dt = 0.01

# Gas: two-species ideal gas
<gas>
nspecies = 2
gamma = 1.6666666667, 1.6666666667
mu = 1.0, 16.0 # H, O [AMU]
dfloor = 1.0e-12
siefloor = 1.0e-12

# Gravity: point mass at origin
<gravity/point>
mass = 1.0 # G*M in code units


<physics>
gas = true
gravity = true
drag = true

# Drag: full Chapman-Cowling coupling
<drag>
type = full

<drag/full>
collision_model = hard_sphere
# mu [AMU], sigma [code length = r0], dof (H/O treated here as monatomic)
mu = 1.0 , 16.0
sigma = 1.0e-3, 1.0e-3 # collision diameters ~1e-3 r0 (calibrate for your scenario)
dof = 3.0, 3.0

# Problem parameters
<problem>
# Isothermal temperature in EOS/code temperature units for this scalefree deck.
# T0 = 0.2 yields lambda_H = mu_H/T0 = 5. The inner BC maintains hydrostatic
# density/SIE and extrapolates outward radial velocity; it does not impose a
# Parker-wind velocity at r0.
T0 = 0.2 # code units (NOT Kelvin)
r0 = 1.0 # inner radius [code length]
gm = 1.0 # G*M [code units]
rho0_0 = 1.0e-4 # base density species 0 (H) at r0
rho0_1 = 1.0e-3 # base density species 1 (O) at r0 (heavier, higher abundance)
106 changes: 106 additions & 0 deletions inputs/atmosphere/escape_n3_1d.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
# =============================================================================
# Artemis input deck: 1D spherical planetary atmospheric escape
#
# Two species (H, mu=1 and O, mu=16) in a 1D spherically-symmetric atmosphere
# under point-mass gravity. Chapman-Cowling (hard-sphere) drag couples them.
# Species 0 (H) is light enough to escape; species 1 (O) is gravitationally
# bound but gets entrained by species 0 through drag.

<artemis>
problem = escape_1d
coordinates = spherical
radial_spacing = logarithmic

<parthenon/sparse>
enable_sparse = true
dealloc_count = 1
alloc_threshold = 1e-8
dealloc_threshold = 1e-10

<parthenon/job>
problem_id = drag

<parthenon/time>
nlim = 100
tlim = 50.0 # ~14 t_dyn (t_dyn = r0/v_esc = 1/sqrt(2))
integrator = rk2
ncycle_out = 1

<parthenon/mesh>
nx1 = 512
x1min = 0.0 # inner radius r0
x1max = 2.302585092994046 # outer radius
ix1_bc = hydrostatic # custom inner BC (hydrostatic inflow)
ox1_bc = outflow # custom outer BC (outflow)

nx2 = 1
x2min = 0.0
x2max = 3.14159265358979
ix2_bc = outflow
ox2_bc = outflow

nx3 = 1
x3min = -0.5
x3max = 0.5
ix3_bc = outflow
ox3_bc = outflow

<parthenon/meshblock>
nx1 = 8
nx2 = 1
nx3 = 1

<parthenon/output0>
file_type = hdf5
# dt = 0.1
dn = 1
variables = gas.prim.density, gas.prim.velocity, gas.prim.sie, gas.prim.temperature, gas.prim.pressure
use_final_label = no

<parthenon/output1>
file_type = hst
dt = 0.01

<gas>
nspecies = 3
gamma = 1.6666666667, 1.6666666667, 1.6666666667
mu = 1.0, 4.0026, 16.0 # H, He, O [AMU]
dfloor = 1.0e-12
siefloor = 1.0e-12
scr_level = 1
density_allocation_threshold = 1e-8
density_deallocation_threshold = 1e-10

# Gravity: point mass at origin
<gravity/point>
mass = 1.0 # G*M in code units


<physics>
gas = true
gravity = true
drag = true

# Drag: full Chapman-Cowling coupling
<drag>
type = full

<drag/full>
collision_model = hard_sphere
# mu [AMU], sigma [code length = r0], dof (H/O treated here as monatomic)
mu = 1.0 , 4.0026, 16.0
sigma = 1.0e-3, 1e-3, 1.0e-3 # collision diameters ~1e-3 r0 (calibrate for your scenario)
dof = 3.0, 3.0, 3.0

# Problem parameters
<problem>
# Isothermal temperature in EOS/code temperature units for this scalefree deck.
# T0 = 0.2 yields lambda_H = mu_H/T0 = 5. The inner BC maintains hydrostatic
# density/SIE and extrapolates outward radial velocity; it does not impose a
# Parker-wind velocity at r0.
T0 = 0.2 # code units (NOT Kelvin)
r0 = 1.0 # inner radius [code length]
gm = 1.0 # G*M [code units]
rho0_0 = 1.0e-4 # base density species 0 (H) at r0
rho0_1 = 3.0e-4 # base density species 1 (He) at r0
rho0_2 = 1.0e-3 # base density species 1 (O) at r0 (heavier, higher abundance)
7 changes: 3 additions & 4 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ set (SRC_LIST

drag/drag.cpp
drag/drag.hpp
drag/drag_impl.hpp
drag/collision_integrals.hpp

dust/dust.cpp
dust/dust.hpp
Expand Down Expand Up @@ -139,10 +141,6 @@ if (ARTEMIS_PORTABLE_RESTART)
add_compile_definitions(PORTABLE_RESTART)
endif()

if (ARTEMIS_ENABLE_SESAME_EOS)
add_compile_definitions(WITH_SESAME)
endif()

# Generate library
add_library(artemislib ${SRC_LIST})

Expand All @@ -168,6 +166,7 @@ endif()

# Link libraries
target_link_libraries(artemislib PUBLIC parthenon
KokkosKernels::kokkoskernels
singularity-eos
${CMAKE_BINARY_DIR}/rebound/librebound.so
lib_jaybenne_package
Expand Down
19 changes: 13 additions & 6 deletions src/artemis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
// the public, perform publicly and display publicly, and to permit others to do so.
//========================================================================================

#include <vector>

// Artemis includes
#include "artemis.hpp"
#include "artemis_driver.hpp"
Expand Down Expand Up @@ -102,6 +104,7 @@ Packages_t ProcessPackages(std::unique_ptr<ParameterInput> &pin) {
const bool do_radiation = pin->GetOrAddBoolean("physics", "radiation", false);
const bool do_coagulation = pin->GetOrAddBoolean("physics", "coagulation", false);
const bool do_raytrace = pin->GetOrAddBoolean("physics", "raytrace", false);
const bool do_closure = pin->GetOrAddBoolean("physics", "closure", false);
const bool do_orbital_advection =
pin->GetOrAddBoolean("physics", "orbital_advection", false);

Expand Down Expand Up @@ -145,6 +148,7 @@ Packages_t ProcessPackages(std::unique_ptr<ParameterInput> &pin) {
artemis->AddParam("do_orbital_advection", do_orbital_advection);
artemis->AddParam("do_raytrace", do_raytrace);
artemis->AddParam("update_fluxes", update_fluxes);
artemis->AddParam("do_closure", do_closure);

// Set coordinate system
const int ndim = ProblemDimension(pin.get());
Expand Down Expand Up @@ -172,7 +176,7 @@ Packages_t ProcessPackages(std::unique_ptr<ParameterInput> &pin) {
if (do_rotating_frame || do_orbital_advection)
packages.Add(RotatingFrame::Initialize(pin.get()));
if (do_cooling) packages.Add(Gas::Cooling::Initialize(pin.get()));
if (do_drag) packages.Add(Drag::Initialize(pin.get()));
if (do_drag) packages.Add(Drag::Initialize(pin.get(), constants, packages));

// Operator split dust coagulation
if (do_coagulation) {
Expand All @@ -188,11 +192,12 @@ Packages_t ProcessPackages(std::unique_ptr<ParameterInput> &pin) {
packages.Add(Radiation::Initialize(pin.get(), constants, do_imc));
// Select between Jaybenne IMC or Moments
if (do_imc) {
auto eos_h = packages.Get("gas")->Param<EOS>("eos_h");
auto opacity_h = packages.Get("gas")->Param<MeanOpacity>("opacity_h");
auto scattering_h = packages.Get("gas")->Param<MeanScattering>("scattering_h");
packages.Add(jaybenne::Initialize(pin.get(), opacity_h, scattering_h, eos_h,
"radiation/imc"));
auto eos_h = packages.Get("gas")->Param<std::vector<ArtemisUtils::EOS>>("eos_h");
auto opacity_h = packages.Get("gas")->Param<std::vector<MeanOpacity>>("opacity_h");
auto scattering_h =
packages.Get("gas")->Param<std::vector<MeanScattering>>("scattering_h");
packages.Add(jaybenne::Initialize(pin.get(), opacity_h[0], scattering_h[0],

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the grand scheme of artemis/jaybenne development, when is the right time to assign a "total" opacity which combines all fluid types and pases a FIELD rather than opacity object to jaybenne?

eos_h[0], "radiation/imc"));
PARTHENON_REQUIRE(coords == Coordinates::cartesian,
"Jaybenne currently supports only Cartesian coordinates!");
} else if (do_moment) {
Expand Down Expand Up @@ -238,6 +243,8 @@ Packages_t ProcessPackages(std::unique_ptr<ParameterInput> &pin) {
if (do_gas) Gas::AddHistory(coords, packages.Get("gas")->AllParams());
if (do_dust) Dust::AddHistory(coords, packages.Get("dust")->AllParams());

params.Add("do_sparse", pin->GetBoolean("parthenon/sparse", "enable_sparse"));

// Add artemis package
packages.Add(artemis);

Expand Down
6 changes: 6 additions & 0 deletions src/artemis_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,13 @@ ArtemisDriver<GEOM>::ArtemisDriver(ParameterInput *pin, ApplicationInput *app_in
do_moment = artemis_pkg->template Param<bool>("do_moment");
do_coagulation = artemis_pkg->template Param<bool>("do_coagulation");
do_raytrace = artemis_pkg->template Param<bool>("do_raytrace");
do_closure = artemis_pkg->template Param<bool>("do_closure");

// Update fluxes option--gas fields are needed for radiation temperature updates but for
// rad-only test problems turn off advection
update_fluxes = artemis_pkg->template Param<bool>("update_fluxes");

do_sparse = artemis_pkg->template Param<bool>("do_sparse");
ndim = pm->ndim;

// Moments integrator
Expand Down Expand Up @@ -406,6 +408,10 @@ TaskCollection ArtemisDriver<GEOM>::PostStepTasks() {
if (pmesh->adaptive) {
refine = tl.AddTask(new_dt, parthenon::Refinement::Tag<MeshData<Real>>, u0.get());
}
auto dealloc = refine;
if (do_sparse) {
dealloc = tl.AddTask(refine, parthenon::Update::SparseDealloc, u0.get());
}
}

return tc;
Expand Down
3 changes: 2 additions & 1 deletion src/artemis_driver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,9 @@ class ArtemisDriver : public EvolutionDriver {
bool do_gravity, do_self_gravity, do_nbody, do_rotating_frame;
bool do_orbital_advection;
bool do_cooling, do_drag, do_viscosity, do_conduction, do_diffusion;
bool do_coagulation, do_raytrace;
bool do_coagulation, do_raytrace, do_closure;
bool update_fluxes;
bool do_sparse;
const bool is_restart;
};

Expand Down
1 change: 1 addition & 0 deletions src/artemis_extras.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
//========================================================================================

#include <utility> // std::move
#include <vector> // std::vector

#include "artemis.hpp"
#include "artemis_extras.hpp"
Expand Down
11 changes: 5 additions & 6 deletions src/derived/fill_derived.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,12 +240,12 @@ void PrimToCons(T *md) {
// Extract gas parameters
Real dflr_gas = Null<Real>();
Real sieflr_gas = Null<Real>();
EOS eos_d;
ParArray1D<EOS> eos_d;
if (do_gas) {
auto &gas_pkg = pm->packages.Get("gas");
dflr_gas = gas_pkg->template Param<Real>("dfloor");
sieflr_gas = gas_pkg->template Param<Real>("siefloor");
eos_d = gas_pkg->template Param<EOS>("eos_d");
eos_d = gas_pkg->template Param<ParArray1D<EOS>>("eos_d");
}

// Extract dust parameters
Expand Down Expand Up @@ -291,7 +291,6 @@ void PrimToCons(T *md) {
const auto &hx = coords.GetScaleFactors(vg, b, k, j, i);

if (do_gas) {
Real lambda[ArtemisUtils::lambda_max_vals] = {Null<Real>()};
for (int n = 0; n < vmesh.GetSize(b, gas::prim::density()); ++n) {
// Sync conserved and primitive density
Real &w_d = vmesh(b, gas::prim::density(n), k, j, i);
Expand Down Expand Up @@ -320,9 +319,9 @@ void PrimToCons(T *md) {
const bool siefloor = (w_s > sieflr_gas);
w_s = (siefloor)*w_s + (!siefloor) * sieflr_gas;
u_u = w_s * u_d;
w_p = eos_d.PressureFromDensityInternalEnergy(w_d, w_s, lambda);
w_b = eos_d.BulkModulusFromDensityInternalEnergy(w_d, w_s, lambda);
w_t = eos_d.TemperatureFromDensityInternalEnergy(w_d, w_s, lambda);
w_p = eos_d(n).PressureFromDensityInternalEnergy(w_d, w_s);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have some concerns already if we are truly trying to implement sparse in this changeset...

Doesn't eos_d contain all gas species EOS? So don't we need to index into eos_d via sparse_id?

If it were up to me, I'd keep this PR as just gas-gas coupling and then fully thread through sparse in a subsequent PR.

w_b = eos_d(n).BulkModulusFromDensityInternalEnergy(w_d, w_s);
w_t = eos_d(n).TemperatureFromDensityInternalEnergy(w_d, w_s);

// Sync conserved total energy
const Real ke = 0.5 * w_d * (SQR(vel1) + SQR(vel2) + SQR(vel3));
Expand Down
Loading
Loading