Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Update submodules, API changes, tracer swarm packs, formatting CI #225

Open
wants to merge 27 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
00205d1
cleanup pgens, fix tracer init in advection problem and move to postinit
AstroBarker Oct 17, 2024
e33d1c7
boundary condition work
AstroBarker Oct 17, 2024
59b10ab
refactoring, misc, lots of changes, bad commit practice...
AstroBarker Oct 17, 2024
498bc46
update parthenon
AstroBarker Oct 17, 2024
f28bcdd
fix: swarm positon names
AstroBarker Nov 15, 2024
8c30be3
BC
AstroBarker Nov 15, 2024
f687fa2
bump parthenon
AstroBarker Nov 15, 2024
ffc7a5b
dump submodules
AstroBarker Jan 6, 2025
4bc1327
revert something
AstroBarker Jan 6, 2025
b374060
updates to mean opacity API
AstroBarker Jan 6, 2025
0f679cb
fmt
AstroBarker Jan 6, 2025
55e5ef3
fast logs disabled by default
AstroBarker Jan 6, 2025
7fee7f8
Merge branch 'main' into blb/update_parthenon
AstroBarker Jan 6, 2025
94955cb
ubuntu clang format broke. attempting to switch to pip provided.. mor…
AstroBarker Jan 6, 2025
ac9945b
broke yaml
AstroBarker Jan 6, 2025
6800e14
hate actions
AstroBarker Jan 6, 2025
27d1be3
clang format is the most version unstable software
AstroBarker Jan 6, 2025
6423e9b
mean opac param type
AstroBarker Jan 6, 2025
8c338cd
cleanup
AstroBarker Jan 7, 2025
ec1499e
pack fix?
AstroBarker Jan 7, 2025
64aae21
fighting types
AstroBarker Jan 7, 2025
2bc3a91
weird changed behavior in regression testing
AstroBarker Jan 7, 2025
e76eccc
fmt
AstroBarker Jan 7, 2025
bf398c4
feat: tracers work on MeshData, use SWARM_VARIABLES for tracer vars
AstroBarker Jan 9, 2025
13a84dd
WIP + compile time number of tracies for MOCMC
AstroBarker Jan 17, 2025
a2990dd
WIP MOCMC refactor to use swarm packs and MeshData and work with mode…
AstroBarker Jan 17, 2025
41c06e1
remove debugging prints
AstroBarker Jan 17, 2025
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
9 changes: 7 additions & 2 deletions .github/workflows/formatting.yml
Copy link
Collaborator

Choose a reason for hiding this comment

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

at some point we might want to change to a different clang-format version

Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ jobs:
run: export DEBIAN_FRONTEND=noninteractive
- name: install dependencies
run: |
sudo apt-get install -y --force-yes -qq git clang-format-12
sudo apt-get install -y --force-yes -qq git
- name: Install pip, clang-format
uses: BSFishy/pip-action@v1
with:
packages: |
clang-format==12.0.1
- name: check formatting
run: find . -regex '.*\.\(cpp\|hpp\)' | xargs clang-format-12 -style=file -i && git diff --exit-code --ignore-submodules
run: find . -regex '.*\.\(cpp\|hpp\)' | xargs clang-format -style=file -i && git diff --exit-code --ignore-submodules
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ set(SINGULARITY_USE_FORTRAN OFF CACHE BOOL "" FORCE)
set(SINGULARITY_FORCE_SUBMODULE_MODE ON CACHE BOOL "" FORCE)
set(SINGULARITY_USE_KOKKOSKERNELS OFF CACHE BOOL "" FORCE)
set(SINGULARITY_BUILD_CLOSURE OFF CACHE BOOL "" FORCE)
set(SINGULARITY_USE_TRUE_LOG_GRIDDING ON CACHE BOOL "" FORCE)

# Kill cmake's package registry because it can interfere
set(CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY ON CACHE BOOL "" FORCE)
Expand All @@ -184,6 +185,9 @@ include(cmake/Geometry.cmake)
# Fluid
include(cmake/Fluid.cmake)

# Transport
include(cmake/Transport.cmake)

# Phoebus src
message("\nConfiguring src")
add_subdirectory(src)
Expand Down
13 changes: 13 additions & 0 deletions cmake/Transport.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# © 2021-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.

set(MOCMC_NUM_SPECIES 3 CACHE INTEGER "Number of radiation species for MOCMC.")
2 changes: 1 addition & 1 deletion external/parthenon
2 changes: 1 addition & 1 deletion external/singularity-eos
Submodule singularity-eos updated 87 files
+1 −1 .github/workflows/docs.yml
+1 −1 .github/workflows/formatting.yml
+40 −0 .github/workflows/sanitizer.yml
+8 −3 .github/workflows/tests.yml
+1 −1 .github/workflows/tests_minimal.yml
+1 −1 .github/workflows/tests_minimal_kokkos.yml
+37 −0 .github/workflows/warnings.yml
+171 −35 .gitlab-ci.yml
+10 −14 .gitlab/common.yml
+20 −0 CHANGELOG.md
+96 −17 CMakeLists.txt
+3 −1 cmake/singularity-eos/kokkos.cmake
+ doc/sphinx/ApproxForTH.png
+ doc/sphinx/GibbsOrder.png
+ doc/sphinx/PMGvsMGUsupPress.png
+ doc/sphinx/SteinbergGammarho.png
+9 −1 doc/sphinx/src/building.rst
+29 −21 doc/sphinx/src/contributing.rst
+1 −1 doc/sphinx/src/examples.rst
+15 −5 doc/sphinx/src/getting-started.rst
+278 −8 doc/sphinx/src/models.rst
+122 −8 doc/sphinx/src/modifiers.rst
+4 −0 doc/sphinx/src/python.rst
+94 −20 doc/sphinx/src/using-closures.rst
+94 −22 doc/sphinx/src/using-eos.rst
+1 −1 doc/sphinx/src/using-kpt.rst
+6 −0 example/CMakeLists.txt
+165 −0 example/eos_grid.cpp
+1 −1 example/get_sound_speed_press.cpp
+3 −1 joss-paper/paper.md
+10 −1 joss-paper/refs.bib
+6 −0 sesame2spiner/generate_files.cpp
+4 −2 singularity-eos/CMakeLists.txt
+200 −97 singularity-eos/base/fast-math/logs.hpp
+25 −25 singularity-eos/base/root-finding-1d/root_finding.hpp
+1 −0 singularity-eos/base/sp5/singularity_eos_sp5.hpp
+235 −210 singularity-eos/closure/mixed_cell_models.hpp
+99 −23 singularity-eos/eos/eos_base.hpp
+13 −5 singularity-eos/eos/eos_carnahan_starling.hpp
+16 −4 singularity-eos/eos/eos_davis.hpp
+264 −0 singularity-eos/eos/eos_electrons.hpp
+95 −42 singularity-eos/eos/eos_eospac.hpp
+13 −6 singularity-eos/eos/eos_gruneisen.hpp
+25 −0 singularity-eos/eos/eos_helmholtz.hpp
+14 −4 singularity-eos/eos/eos_ideal.hpp
+10 −4 singularity-eos/eos/eos_jwl.hpp
+9 −3 singularity-eos/eos/eos_mgusup.hpp
+2 −0 singularity-eos/eos/eos_models.hpp
+12 −5 singularity-eos/eos/eos_noble_abel.hpp
+8 −3 singularity-eos/eos/eos_powermg.hpp
+8 −4 singularity-eos/eos/eos_sap_polynomial.hpp
+22 −0 singularity-eos/eos/eos_spiner.hpp
+69 −30 singularity-eos/eos/eos_stellar_collapse.hpp
+12 −5 singularity-eos/eos/eos_stiff.hpp
+5 −1 singularity-eos/eos/eos_type_lists.hpp
+37 −2 singularity-eos/eos/eos_variant.hpp
+10 −4 singularity-eos/eos/eos_vinet.hpp
+1 −1 singularity-eos/eos/get_sg_eos_p_t.cpp
+14 −5 singularity-eos/eos/get_sg_eos_rho_e.cpp
+12 −5 singularity-eos/eos/get_sg_eos_rho_p.cpp
+14 −5 singularity-eos/eos/get_sg_eos_rho_t.cpp
+18 −2 singularity-eos/eos/modifiers/eos_unitsystem.hpp
+15 −0 singularity-eos/eos/modifiers/ramps_eos.hpp
+14 −0 singularity-eos/eos/modifiers/relativistic_eos.hpp
+19 −0 singularity-eos/eos/modifiers/scaled_eos.hpp
+14 −0 singularity-eos/eos/modifiers/shifted_eos.hpp
+285 −0 singularity-eos/eos/modifiers/zsplit_eos.hpp
+18 −0 singularity-eos/eos/singularity_eos.cpp
+2 −2 singularity-eos/eos/singularity_eos.f90
+1 −0 spack-repo/packages/ports-of-call/package.py
+2 −0 spack-repo/packages/singularity-eos/package.py
+4 −2 test/CMakeLists.txt
+4 −4 test/test_bounds.cpp
+10 −7 test/test_closure_pte.cpp
+79 −3 test/test_eos_ideal.cpp
+1 −114 test/test_eos_modifiers.cpp
+161 −0 test/test_eos_modifiers_minimal.cpp
+3 −0 test/test_eos_stellar_collapse.cpp
+10 −0 test/test_eos_tabulated.cpp
+133 −0 test/test_eos_zsplit.cpp
+13 −1 test/test_math_utils.cpp
+2 −2 test/test_pte.cpp
+2 −2 test/test_pte_2phase.cpp
+2 −2 test/test_pte_3phase.cpp
+1 −1 utils/kokkos
+1 −1 utils/kokkos-kernels
+1 −1 utils/ports-of-call
2 changes: 1 addition & 1 deletion external/singularity-opac
Submodule singularity-opac updated 32 files
+1 −1 CMakeLists.txt
+15 −0 README.md
+19 −10 cmake/SetupDeps.cmake
+10 −3 cmake/SetupOptions.cmake
+64 −18 singularity-opac/constants/constants.hpp
+8 −1 singularity-opac/neutrinos/brt_neutrinos.hpp
+8 −1 singularity-opac/neutrinos/gray_opacity_neutrinos.hpp
+13 −1 singularity-opac/neutrinos/mean_neutrino_variant.hpp
+19 −8 singularity-opac/neutrinos/mean_opacity_neutrinos.hpp
+7 −1 singularity-opac/neutrinos/neutrino_variant.hpp
+29 −5 singularity-opac/neutrinos/non_cgs_neutrinos.hpp
+186 −23 singularity-opac/neutrinos/spiner_opac_neutrinos.hpp
+9 −1 singularity-opac/neutrinos/tophat_emissivity_neutrinos.hpp
+12 −1 singularity-opac/photons/epbremsstrahlung_opacity_photons.hpp
+19 −0 singularity-opac/photons/example_ascii/kap_plaw.txt
+103 −0 singularity-opac/photons/example_ascii/preproc_ascii_opac.py
+8 −1 singularity-opac/photons/gray_opacity_photons.hpp
+155 −39 singularity-opac/photons/mean_opacity_photons.hpp
+13 −1 singularity-opac/photons/mean_photon_variant.hpp
+26 −3 singularity-opac/photons/non_cgs_photons.hpp
+6 −2 singularity-opac/photons/opac_photons.hpp
+7 −1 singularity-opac/photons/photon_variant.hpp
+192 −0 singularity-opac/photons/powerlaw_opacity_photons.hpp
+8 −2 test/CMakeLists.txt
+100 −4 test/test_gray_opacities.cpp
+145 −16 test/test_mean_opacities.cpp
+198 −0 test/test_powerlaw_opacities.cpp
+5 −1 utils/fast-math/logs.hpp
+1 −1 utils/kokkos
+1 −1 utils/ports-of-call
+1 −1 utils/spiner
+1 −1 utils/variant
2 changes: 2 additions & 0 deletions src/compile_constants.hpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

#define NCONS_MAX (@MAX_NUMBER_CONSERVED_VARS@)

#define MOCMC_NUM_SPECIES (@MOCMC_NUM_SPECIES@)

#define PHOEBUS_GEOMETRY Geometry::@PHOEBUS_GEOMETRY@
#define GEOMETRY_MESH @GEOMETRY_MESH@
#define GEOMETRY_MESH_BLOCK @GEOMETRY_MESH_BLOCK@
Expand Down
11 changes: 6 additions & 5 deletions src/fixup/fixup.cpp
Copy link
Collaborator

Choose a reason for hiding this comment

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

whoopsy daisy. good catch.

Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

#include "fixup.hpp"

#include <bvals/bvals_interfaces.hpp>
#include <defs.hpp>

#include "analysis/history.hpp"
Expand Down Expand Up @@ -731,6 +730,8 @@ TaskStatus FixFluxes(MeshBlockData<Real> *rc) {
const std::string ox1_bc = fluid->Param<std::string>("ox1_bc");
const std::string ix2_bc = fluid->Param<std::string>("ix2_bc");
const std::string ox2_bc = fluid->Param<std::string>("ox2_bc");
const std::string ix3_bc = fluid->Param<std::string>("ix3_bc");
const std::string ox3_bc = fluid->Param<std::string>("ox3_bc");

auto rad = pmb->packages.Get("radiation");
int num_species = 0;
Expand Down Expand Up @@ -993,7 +994,7 @@ TaskStatus FixFluxes(MeshBlockData<Real> *rc) {
if (ndim == 2) return TaskStatus::complete;

// x3-direction
if (pmb->boundary_flag[BoundaryFace::inner_x3] == BoundaryFlag::outflow) {
if (ix3_bc == "outflow") {
PackIndexMap imap;
auto v =
rc->PackVariablesAndFluxes(std::vector<std::string>({c::density::name()}),
Expand All @@ -1004,7 +1005,7 @@ TaskStatus FixFluxes(MeshBlockData<Real> *rc) {
ib.s, ib.e, KOKKOS_LAMBDA(const int k, const int j, const int i) {
v.flux(X3DIR, crho, k, j, i) = std::min(v.flux(X3DIR, crho, k, j, i), 0.0);
});
} else if (pmb->boundary_flag[BoundaryFace::inner_x3] == BoundaryFlag::reflect) {
} else if (ix3_bc == "reflect") {
PackIndexMap imap;
auto v = rc->PackVariablesAndFluxes(
std::vector<std::string>({c::density::name(), c::energy::name(), cr::E::name()}),
Expand All @@ -1025,7 +1026,7 @@ TaskStatus FixFluxes(MeshBlockData<Real> *rc) {
}
});
}
if (pmb->boundary_flag[BoundaryFace::outer_x3] == BoundaryFlag::outflow) {
if (ox3_bc == "outflow") {
PackIndexMap imap;
auto v =
rc->PackVariablesAndFluxes(std::vector<std::string>({c::density::name()}),
Expand All @@ -1036,7 +1037,7 @@ TaskStatus FixFluxes(MeshBlockData<Real> *rc) {
jb.e, ib.s, ib.e, KOKKOS_LAMBDA(const int k, const int j, const int i) {
v.flux(X3DIR, crho, k, j, i) = std::max(v.flux(X3DIR, crho, k, j, i), 0.0);
});
} else if (pmb->boundary_flag[BoundaryFace::outer_x3] == BoundaryFlag::reflect) {
} else if (ox3_bc == "reflect") {
PackIndexMap imap;
auto v = rc->PackVariablesAndFluxes(
std::vector<std::string>({c::density::name(), c::energy::name(), cr::E::name()}),
Expand Down
1 change: 0 additions & 1 deletion src/fixup/fixup_c2p.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

#include "fixup.hpp"

#include <bvals/bvals_interfaces.hpp>
#include <defs.hpp>

#include "fluid/con2prim_robust.hpp"
Expand Down
1 change: 0 additions & 1 deletion src/fixup/fixup_netfield.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

#include "fixup.hpp"

#include <bvals/bvals_interfaces.hpp>
#include <defs.hpp>
#include <globals.hpp>

Expand Down
9 changes: 5 additions & 4 deletions src/fixup/fixup_particles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,12 @@ TaskStatus PurgeParticles(MeshBlockData<Real> *rc, const std::string swarmName)
/* only do this when FMKS is used. */
if constexpr (std::is_same<PHOEBUS_GEOMETRY, Geometry::FMKS>::value) {
auto *pmb = rc->GetParentPointer();
auto &swarm = pmb->swarm_data.Get()->Get(swarmName);
// auto &swarm = rc->swarm_data.Get()->Get(swarmName);
auto &swarm = rc->GetSwarmData()->Get(swarmName);

auto &x = swarm->Get<Real>("x").Get();
auto &y = swarm->Get<Real>("y").Get();
auto &z = swarm->Get<Real>("z").Get();
auto &x = swarm->Get<Real>(swarm_position::x::name()).Get();
auto &y = swarm->Get<Real>(swarm_position::y::name()).Get();
auto &z = swarm->Get<Real>(swarm_position::z::name()).Get();

auto swarm_d = swarm->GetDeviceContext();

Expand Down
1 change: 0 additions & 1 deletion src/fixup/fixup_radc2p.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

#include "fixup.hpp"

#include <bvals/bvals_interfaces.hpp>
#include <defs.hpp>

#include "fluid/con2prim_robust.hpp"
Expand Down
1 change: 0 additions & 1 deletion src/fixup/fixup_src.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

#include "fixup.hpp"

#include <bvals/bvals_interfaces.hpp>
#include <defs.hpp>

#include "fluid/con2prim_robust.hpp"
Expand Down
58 changes: 34 additions & 24 deletions src/fluid/fluid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,10 @@ std::shared_ptr<StateDescriptor> Initialize(ParameterInput *pin) {
params.Add("ix2_bc", ix2_bc);
const std::string ox2_bc = pin->GetString("phoebus", "ox2_bc");
params.Add("ox2_bc", ox2_bc);
const std::string ix3_bc = pin->GetString("phoebus", "ix3_bc");
params.Add("ix3_bc", ix3_bc);
const std::string ox3_bc = pin->GetString("phoebus", "ox3_bc");
params.Add("ox3_bc", ox3_bc);

int ndim = 1;
if (pin->GetInteger("parthenon/mesh", "nx3") > 1)
Expand Down Expand Up @@ -768,6 +772,7 @@ TaskStatus CalculateFluxes(MeshBlockData<Real> *rc) {
}

TaskStatus FluxCT(MeshBlockData<Real> *rc) {
using parthenon::MakePackDescriptor;
Mesh *pmesh = rc->GetMeshPointer();
auto &fluid = pmesh->packages.Get("fluid");
if (!fluid->Param<bool>("mhd") || !fluid->Param<bool>("active") ||
Expand All @@ -780,49 +785,54 @@ TaskStatus FluxCT(MeshBlockData<Real> *rc) {
IndexRange jb = rc->GetBoundsJ(IndexDomain::interior);
IndexRange kb = rc->GetBoundsK(IndexDomain::interior);

auto f1 = rc->Get(fluid_cons::bfield::name()).flux[X1DIR];
auto f2 = rc->Get(fluid_cons::bfield::name()).flux[X2DIR];
auto f3 = rc->Get(fluid_cons::bfield::name()).flux[X3DIR];
auto &resolved_pkgs = pmesh->resolved_packages;
static auto desc = MakePackDescriptor<fluid_cons::bfield>(
resolved_pkgs.get(), {}, {parthenon::PDOpt::WithFluxes});
auto v = desc.GetPack(rc);
auto emf = rc->Get(internal_variables::emf::name()).data;

if (ndim == 2) {
parthenon::par_for(
DEFAULT_LOOP_PATTERN, "FluxCT::EMF::2D", DevExecSpace(), kb.s, kb.e, jb.s,
jb.e + 1, ib.s, ib.e + 1, KOKKOS_LAMBDA(const int k, const int j, const int i) {
emf(k, j, i) = 0.25 * (f1(1, k, j, i) + f1(1, k, j - 1, i) - f2(0, k, j, i) -
f2(0, k, j, i - 1));
emf(k, j, i) =
0.25 * (v.flux(0, X1DIR, 1, k, j, i) + v.flux(0, X1DIR, 1, k, j - 1, i) -
v.flux(0, X2DIR, 0, k, j, i) - v.flux(0, X2DIR, 0, k, j, i - 1));
});
parthenon::par_for(
DEFAULT_LOOP_PATTERN, "FluxCT::Flux::2D", DevExecSpace(), kb.s, kb.e, jb.s,
jb.e + 1, ib.s, ib.e + 1, KOKKOS_LAMBDA(const int k, const int j, const int i) {
f1(0, k, j, i) = 0.0;
f1(1, k, j, i) = 0.5 * (emf(k, j, i) + emf(k, j + 1, i));
f2(0, k, j, i) = -0.5 * (emf(k, j, i) + emf(k, j, i + 1));
f2(1, k, j, i) = 0.0;
v.flux(0, X1DIR, 0, k, j, i) = 0.0;
v.flux(0, X1DIR, 1, k, j, i) = 0.5 * (emf(k, j, i) + emf(k, j + 1, i));
v.flux(0, X2DIR, 0, k, j, i) = -0.5 * (emf(k, j, i) + emf(k, j, i + 1));
v.flux(0, X2DIR, 1, k, j, i) = 0.0;
});
} else if (ndim == 3) {
parthenon::par_for(
DEFAULT_LOOP_PATTERN, "FluxCT::EMF::3D", DevExecSpace(), kb.s, kb.e + 1, jb.s,
jb.e + 1, ib.s, ib.e + 1, KOKKOS_LAMBDA(const int k, const int j, const int i) {
emf(0, k, j, i) = 0.25 * (f2(2, k, j, i) + f2(2, k - 1, j, i) - f3(1, k, j, i) -
f3(1, k, j - 1, i));
emf(1, k, j, i) = -0.25 * (f1(2, k, j, i) + f1(2, k - 1, j, i) -
f3(0, k, j, i) - f3(0, k, j, i - 1));
emf(2, k, j, i) = 0.25 * (f1(1, k, j, i) + f1(1, k, j - 1, i) - f2(0, k, j, i) -
f2(0, k, j, i - 1));
emf(0, k, j, i) =
0.25 * (v.flux(0, X2DIR, 2, k, j, i) + v.flux(0, X2DIR, 2, k - 1, j, i) -
v.flux(0, X3DIR, 1, k, j, i) - v.flux(0, X3DIR, 1, k, j - 1, i));
emf(1, k, j, i) =
-0.25 * (v.flux(0, X1DIR, 2, k, j, i) + v.flux(0, X1DIR, 2, k - 1, j, i) -
v.flux(0, X3DIR, 0, k, j, i) - v.flux(0, X3DIR, 0, k, j, i - 1));
emf(2, k, j, i) =
0.25 * (v.flux(0, X1DIR, 1, k, j, i) + v.flux(0, X1DIR, 1, k, j - 1, i) -
v.flux(0, X2DIR, 0, k, j, i) - v.flux(0, X2DIR, 0, k, j, i - 1));
});
parthenon::par_for(
DEFAULT_LOOP_PATTERN, "FluxCT::Flux::3D", DevExecSpace(), kb.s, kb.e + 1, jb.s,
jb.e + 1, ib.s, ib.e + 1, KOKKOS_LAMBDA(const int k, const int j, const int i) {
f1(0, k, j, i) = 0.0;
f1(1, k, j, i) = 0.5 * (emf(2, k, j, i) + emf(2, k, j + 1, i));
f1(2, k, j, i) = -0.5 * (emf(1, k, j, i) + emf(1, k + 1, j, i));
f2(0, k, j, i) = -0.5 * (emf(2, k, j, i) + emf(2, k, j, i + 1));
f2(1, k, j, i) = 0.0;
f2(2, k, j, i) = 0.5 * (emf(0, k, j, i) + emf(0, k + 1, j, i));
f3(0, k, j, i) = 0.5 * (emf(1, k, j, i) + emf(1, k, j, i + 1));
f3(1, k, j, i) = -0.5 * (emf(0, k, j, i) + emf(0, k, j + 1, i));
f3(2, k, j, i) = 0.0;
v.flux(0, X1DIR, 0, k, j, i) = 0.0;
v.flux(0, X1DIR, 1, k, j, i) = 0.5 * (emf(2, k, j, i) + emf(2, k, j + 1, i));
v.flux(0, X1DIR, 2, k, j, i) = -0.5 * (emf(1, k, j, i) + emf(1, k + 1, j, i));
v.flux(0, X2DIR, 0, k, j, i) = -0.5 * (emf(2, k, j, i) + emf(2, k, j, i + 1));
v.flux(0, X2DIR, 1, k, j, i) = 0.0;
v.flux(0, X2DIR, 2, k, j, i) = 0.5 * (emf(0, k, j, i) + emf(0, k + 1, j, i));
v.flux(0, X3DIR, 0, k, j, i) = 0.5 * (emf(1, k, j, i) + emf(1, k, j, i + 1));
v.flux(0, X3DIR, 1, k, j, i) = -0.5 * (emf(0, k, j, i) + emf(0, k, j + 1, i));
v.flux(0, X3DIR, 2, k, j, i) = 0.0;
});
}

Expand Down
24 changes: 16 additions & 8 deletions src/fluid/riemann.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,16 @@ class FluxState {
}
static void FluxVars(const std::string &var) { flux_vars.push_back(var); }

static std::vector<std::string> ReconVars() { return recon_vars; }
static std::vector<std::string> FluxVars() { return flux_vars; }
static std::vector<std::string> ReconVars() {
for (auto &v : recon_vars) {
}
return recon_vars;
}
static std::vector<std::string> FluxVars() {
for (auto &v : flux_vars) {
}
return flux_vars;
}

KOKKOS_FORCEINLINE_FUNCTION
int NumConserved() const { return ncons; }
Expand Down Expand Up @@ -229,12 +237,12 @@ class FluxState {
pye(imap[fluid_prim::ye::name()].second),
prs(imap[fluid_prim::pressure::name()].first),
gm1(imap[fluid_prim::gamma1::name()].first),
crho(imap[fluid_cons::density::name()].first),
cmom_lo(imap[fluid_cons::momentum::name()].first),
ceng(imap[fluid_cons::energy::name()].first),
cb_lo(imap[fluid_cons::bfield::name()].first),
cb_hi(imap[fluid_cons::bfield::name()].second),
cye(imap[fluid_cons::ye::name()].first),
crho(imap[fluid_prim::density::name()].first),
cmom_lo(imap[fluid_prim::velocity::name()].first),
ceng(imap[fluid_prim::energy::name()].first),
cb_lo(imap[fluid_prim::bfield::name()].first),
cb_hi(imap[fluid_prim::bfield::name()].second),
cye(imap[fluid_prim::ye::name()].first),
ncons(5 + (pb_hi - pb_lo + 1) + (cye > 0)) {
PARTHENON_REQUIRE_THROWS(
ncons <= NCONS_MAX,
Expand Down
4 changes: 3 additions & 1 deletion src/geometry/geometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,10 @@ std::shared_ptr<StateDescriptor> Initialize(ParameterInput *pin) {
Metadata gcoord_cell =
Metadata({Metadata::Cell, Metadata::Derived, Metadata::OneCopy}, cell_shape);
// TODO(JMM): Make this actual node-centered data when available
// TODO: Warning: g.n.coord output broken in Parthenon currently
std::vector<int> node_shape = {dims.nx1 + 1, dims.nx2 + 1, dims.nx3 + 1, 4};
Metadata gcoord_node = Metadata({Metadata::Derived, Metadata::OneCopy}, node_shape);
Metadata gcoord_node =
Metadata({Metadata::Derived, Metadata::OneCopy, Metadata::None}, node_shape);
geometry->AddField(geometric_variables::cell_coords::name(), gcoord_cell);
geometry->AddField(geometric_variables::node_coords::name(), gcoord_node);

Expand Down
25 changes: 12 additions & 13 deletions src/microphysics/opac_phoebus/opac_phoebus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,7 @@ std::shared_ptr<StateDescriptor> Initialize(ParameterInput *pin) {
}

{
auto opacity_host =
params.Get<singularity::neutrinos::Opacity>("h.opacity_baseunits");
auto opacity_host = params.Get<singularity::neutrinos::Opacity>("h.opacity");
const Real YeMin = pin->GetOrAddReal("mean_opacity", "yemin", 0.1);
const Real YeMax = pin->GetOrAddReal("mean_opacity", "yemax", 0.5);
const int NYe = pin->GetOrAddInteger("mean_opacity", "nye", 10);
Expand All @@ -159,10 +158,10 @@ std::shared_ptr<StateDescriptor> Initialize(ParameterInput *pin) {
const Real lNuMin = std::log10(pin->GetOrAddReal("mean_opacity", "numin", 0.1));
const Real lNuMax = std::log10(pin->GetOrAddReal("mean_opacity", "numax", 10.));
const int NNu = pin->GetOrAddInteger("mean_opacity", "nnu", 100);
MeanOpacity mean_opac_host =
MeanOpacityScaleFree(opacity_host, lRhoMin, lRhoMax, NRho, lTMin, lTMax, NT,
YeMin, YeMax, NYe, lNuMin, lNuMax, NNu);
auto mean_opac_device = mean_opac_host.GetOnDevice();
auto mean_opac_host =
MeanOpacityBase(opacity_host, lRhoMin, lRhoMax, NRho, lTMin, lTMax, NT, YeMin,
YeMax, NYe, lNuMin, lNuMax, NNu);
MeanOpacity mean_opac_device = mean_opac_host.GetOnDevice();
params.Add("h.mean_opacity", mean_opac_host);
params.Add("d.mean_opacity", mean_opac_device);
} else {
Expand All @@ -176,13 +175,13 @@ std::shared_ptr<StateDescriptor> Initialize(ParameterInput *pin) {
const Real lNuMin = std::log10(pin->GetOrAddReal("mean_opacity", "numin", 1.e10));
const Real lNuMax = std::log10(pin->GetOrAddReal("mean_opacity", "numax", 1.e24));
const int NNu = pin->GetOrAddInteger("mean_opacity", "nnu", 100);
MeanOpacityCGS cgs_mean_opacity =
MeanOpacityCGS(opacity_host, lRhoMin, lRhoMax, NRho, lTMin, lTMax, NT, YeMin,
YeMax, NYe, lNuMin, lNuMax, NNu);
MeanOpacity mean_opac_host =
MeanNonCGSUnits<MeanOpacityCGS>(std::forward<MeanOpacityCGS>(cgs_mean_opacity),
time_unit, mass_unit, length_unit, temp_unit);
auto mean_opac_device = mean_opac_host.GetOnDevice();
auto cgs_mean_opacity =
MeanOpacityBase(opacity_host, lRhoMin, lRhoMax, NRho, lTMin, lTMax, NT, YeMin,
YeMax, NYe, lNuMin, lNuMax, NNu);
auto mean_opac_host = MeanNonCGSUnits<MeanOpacityBase>(
std::forward<MeanOpacityBase>(cgs_mean_opacity), time_unit, mass_unit,
length_unit, temp_unit);
MeanOpacity mean_opac_device = mean_opac_host.GetOnDevice();
params.Add("h.mean_opacity", mean_opac_host);
params.Add("d.mean_opacity", mean_opac_device);
}
Expand Down
Loading
Loading