Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:lanl/artemis into sli/dust
Browse files Browse the repository at this point in the history
  • Loading branch information
shengtai committed Feb 4, 2025
2 parents 22cf399 + bf19cdb commit dd8b375
Show file tree
Hide file tree
Showing 58 changed files with 464 additions and 312 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ jobs:
python-version: '3.x' # Specify the Python version you need
- name: Install dependencies
run: |
pip install clang-format==12.0.1.2
pip install black
- name: Run format check
run: |
source env/bash
VERBOSE=1 ./style/format.sh
VERBOSE=1 CFM=clang-format ./style/format.sh
git diff --exit-code --ignore-submodules
cpu:
Expand Down
8 changes: 7 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,11 @@ if(ARTEMIS_ENABLE_ASAN)
add_link_options(-fsanitize=address -fsanitize=undefined)
endif()

if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
# silence sprintf warnings on mac
add_compile_options(-Wno-deprecated-declarations)
endif()

# NOTE(@jonahm): For some reason, order still matters for including
# parthenon and singularity. Likely has to do with project
# includes other than Kokkos. MPI and OpenMP likely culprits.
Expand Down Expand Up @@ -186,7 +191,8 @@ set(ARTEMIS_SINGULARITY_INCLUDE_PATHS
${CMAKE_CURRENT_SOURCE_DIR}/external/singularity-eos/utils/variant/include
${CMAKE_CURRENT_SOURCE_DIR}/external/singularity-opac/utils
${CMAKE_CURRENT_SOURCE_DIR}/src
${CMAKE_CURRENT_SOURCE_DIR})
${CMAKE_CURRENT_SOURCE_DIR}
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/generated>)

# Set Jaybenne config options and paths
# NOTE(@pdmullen): For the life of us, we are still not sure why we can't treat
Expand Down
20 changes: 5 additions & 15 deletions doc/src/physics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -673,10 +673,7 @@ Specifically, |code|, adds the body force,
.. math::
\rho \frac{D \mathbf{v}}{D t} = \rho \mathbf{g}
To activate external gravity, there must be a ``<gravity>`` node and ``gravity = true`` under the ``<physics>`` node.
The ``<gravity>`` requires setting the parameter ``gm``, typically this is set to ``gm = 1.0``.
In addition to ``gm``, the ``tstart`` and ``tstop`` parameters control when gravity is active.

To activate external gravity, there must be a subnode of ``<gravity>`` (e.g., ``<gravity/point>``) and ``gravity = true`` under the ``<physics>`` node.
The specific model for the gravitational acceleration, :math:`\mathbf{g}`, is controlled by adding the appropriate subnode.
Available options are:

Expand All @@ -687,8 +684,6 @@ Available options are:

::

<gravity>
gm = 1.0
<gravity/constant>
gx1 = 0.0
gx2 = 0.0
Expand All @@ -703,9 +698,8 @@ Available options are:

::

<gravity>
gm = 1.0
<gravity/point>
mass = 1.0
x = 0.0
y = 0.0
z = 0.0
Expand All @@ -721,9 +715,8 @@ Available options are:

::

<gravity>
gm = 1.0 # Binary total GM
<gravity/binary>
mass = 1.0 # Total binary mass
x = 0.0 # Binary x center of mass
y = 0.0 # Binary y center of mass
z = 0.0 # Binary z center of mass
Expand All @@ -745,14 +738,11 @@ Available options are:
* ``<gravity/nbody>``

This indicates that the gravitational force will be calculated by the N-body system defined in the ``<nbody>`` input block.
The only parameter required is the ``gm`` parameter.
Note that the total mass of the system defined in the ``<nbody>`` block will be rescaled to ``gm``.
An example input block would thus read:
Unlike the other gravity nodes, ``<gravity/nbody>`` has no parameters. Instead, all parameters live under the ``<nbody>`` node.
To activate nbody gravity, simply add:

::

<gravity>
gm = 1.0
<gravity/nbody>

See `N-Body Dynamics`_ for a description of how to set up the N-body system.
Expand Down
3 changes: 1 addition & 2 deletions inputs/diffusion/alpha_disk.in
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,8 @@ beta0 = 0.0
tcyl = .0025
cyl_plaw = -1.0

<gravity>
mass_tot = 1.0
<gravity/point>
mass = 1.0

<problem>
r0 = 1.0
Expand Down
2 changes: 1 addition & 1 deletion inputs/diffusion/conduction.in
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ dfloor = 1.0e-10
siefloor = 1.0e-15

<gas/conductivity>
type = constant
type = conductivity
cond = 1.0e-1

<gravity/uniform>
Expand Down
2 changes: 1 addition & 1 deletion inputs/diffusion/gaussian_bump.in
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ type = constant
nu = 5.0e-3

<gas/conductivity>
type = constant
type = conductivity
cond = 5.0e-3

<problem>
Expand Down
3 changes: 1 addition & 2 deletions inputs/disk/binary_cyl.in
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,8 @@ omega = 1.0
type = alpha
alpha = 1e-3

<gravity>
mass_tot = 1.0
<gravity/binary>
mass = 1.0
q = 1.0e-5
a = 1.0
e = 0.0
Expand Down
3 changes: 1 addition & 2 deletions inputs/disk/binary_nbody_cyl.in
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,8 @@ omega = 1.0
type = alpha
alpha = 1e-3

<gravity>
mass_tot = 1.0
<gravity/nbody>
mtot = 1.0

<nbody>
dt_reb = 0.01
Expand Down
3 changes: 1 addition & 2 deletions inputs/disk/cb_disk.in
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,8 @@ siefloor = 1.0e-6
type = constant
nu = 1e-3

<gravity>
mass_tot = 1.0
<gravity/nbody>
mtot = 1.0

<nbody>
integrator = ias15
Expand Down
3 changes: 1 addition & 2 deletions inputs/disk/disk_alpha.in
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,8 @@ siefloor = 1.0e-10
type = alpha
alpha = 1e-2

<gravity>
mass_tot = 1.0
<gravity/point>
mass = 1.0

<cooling>
type = beta
Expand Down
3 changes: 1 addition & 2 deletions inputs/disk/disk_axi.in
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,8 @@ omega = 1.0
type = alpha
alpha = 1e-3

<gravity>
mass_tot = 1.0
<gravity/point>
mass = 1.0

<problem>
r0 = 1.0
Expand Down
3 changes: 1 addition & 2 deletions inputs/disk/disk_cart.in
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,8 @@ riemann = hlle
dfloor = 1.0e-10
pfloor = 1.0e-15

<gravity>
mass_tot = 1.0
<gravity/point>
mass = 1.0

<problem>
r0 = 1.0
Expand Down
3 changes: 1 addition & 2 deletions inputs/disk/disk_collision.in
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,8 @@ riemann = hllc
dfloor = 1.0e-10
siefloor = 1.0e-10

<gravity>
mass_tot = 1.0
<gravity/nbody>
mtot = 1.0

<gas/damping>
inner_x1 = 0.45
Expand Down
3 changes: 1 addition & 2 deletions inputs/disk/disk_cyl.in
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,8 @@ omega = 1.0
type = alpha
alpha = 1e-3

<gravity>
mass_tot = 1.0
<gravity/point>
mass = 1.0

<problem>
r0 = 1.0
Expand Down
2 changes: 0 additions & 2 deletions inputs/disk/disk_nbody_cyl.in
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,6 @@ siefloor = 1.0e-10
type = alpha
alpha = 1e-3

<gravity>
mass_tot = 1.0
<gravity/nbody>

<nbody>
Expand Down
3 changes: 1 addition & 2 deletions inputs/disk/disk_sph.in
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,8 @@ omega = 1.0
type = alpha
alpha = 1e-3

<gravity>
mass_tot = 1.0
<gravity/point>
mass = 1.0

<problem>
r0 = 1.0
Expand Down
3 changes: 1 addition & 2 deletions inputs/ssheet/ssheet.in
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,8 @@ refine_type = magnitude
refine_thr = 3.0
deref_thr = 0.8

<gravity>
mass_tot = 1.0e-5
<gravity/point>
mass = 1.0e-5
soft = 0.03
x = 0.0
y = 0.0
Expand Down
15 changes: 11 additions & 4 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,15 @@ if (CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
message(STATUS "Standalone mode. Adding artemis executable")
add_executable(artemis main.cpp)
target_link_libraries(artemis PRIVATE artemislib)
add_custom_command(TARGET artemis POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_BINARY_DIR}/rebound/librebound.so
$<TARGET_FILE_DIR:artemis>)

# Bake in rpath to rebound on mac
if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
set_target_properties(artemis PROPERTIES
BUILD_RPATH "${CMAKE_BINARY_DIR}/rebound"
)
add_custom_command(TARGET artemis POST_BUILD
COMMAND install_name_tool -add_rpath @executable_path/../rebound $<TARGET_FILE:artemis>
COMMAND install_name_tool -change librebound.so @rpath/librebound.so $<TARGET_FILE:artemis>
)
endif()
endif()
8 changes: 4 additions & 4 deletions src/artemis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,13 @@ Packages_t ProcessPackages(std::unique_ptr<ParameterInput> &pin) {
artemis->AddParam("coord_sys", sys);

// Call package initializers here
if (do_gas) packages.Add(Gas::Initialize(pin.get(), units, constants));
if (do_dust) packages.Add(Dust::Initialize(pin.get()));
if (do_gravity) packages.Add(Gravity::Initialize(pin.get(), constants));
if (do_nbody) packages.Add(NBody::Initialize(pin.get(), constants));
if (do_gravity) packages.Add(Gravity::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()));
if (do_cooling) packages.Add(Gas::Cooling::Initialize(pin.get()));
if (do_drag) packages.Add(Drag::Initialize(pin.get()));
if (do_nbody) packages.Add(NBody::Initialize(pin.get(), constants));
if (do_coagulation) {
auto &dustPars = packages.Get("dust")->AllParams();
packages.Add(Dust::Coagulation::Initialize(pin.get(), dustPars, units, constants));
Expand Down
15 changes: 10 additions & 5 deletions src/artemis_params.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,37 +23,42 @@ artemis:
_type: bool
_default: "false"
_description: "Add user-defined AMR criterion."
units:
_description: "Unit conversions between code and cgs."
physical_units:
_type: "string"
_default: "scalefree"
_description: "What unit system to use for physical units"
code:
scalefree:
_type: opt
_description: "Native code units; no conversions"
cgs:
_type: opt
_description: "CGS unit system"
unit_conversion:
unit_specifier:
_type: "string"
_default: "base"
_description: "How to provide unit conversions between code and physical units"
base:
_type: opt
_description: "Provide base unit conversions (length, time, mass)"
_description: "Provide base unit conversions (length, time, mass, temperature)"
ppd:
_type: opt
_description: "AU, Year/(2 pi), solar mass units for protoplanetary disks"
length:
_type: "Real"
_default: "1.0"
_description: "Physical units value of length equal to 1 code unit"
time:
_type: "Real"
_default: "1.0"
_description: "Physical units value of time equal to 1 code unit"
mass:
_type: "Real"
_default: "1.0"
_description: "Physical units value of mass equal to 1 code unit"
temperature:
_type: "Real"
_default: "1.0"
_description: "Physical units value of temperature equal to 1 code unit"


physics:
Expand Down
10 changes: 5 additions & 5 deletions src/drag/drag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ TaskStatus DragSource(MeshData<Real> *md, const Real time, const Real dt) {
auto &gas_pkg = pm->packages.Get("gas");
const auto &dp = gas_pkg->template Param<Diffusion::DiffCoeffParams>("visc_params");
const auto &eos_d = gas_pkg->template Param<EOS>("eos_d");
if (dp.type == Diffusion::DiffType::viscosity_const) {
return SelfDragSourceImpl<Diffusion::DiffType::viscosity_const, GEOM>(
if (dp.type == Diffusion::DiffType::viscosity_plaw) {
return SelfDragSourceImpl<Diffusion::DiffType::viscosity_plaw, GEOM>(
md, time, dt, dp, eos_d, gas_self_par, dust_self_par);
} else if (dp.type == Diffusion::DiffType::viscosity_alpha) {
return SelfDragSourceImpl<Diffusion::DiffType::viscosity_alpha, GEOM>(
Expand All @@ -134,13 +134,13 @@ TaskStatus DragSource(MeshData<Real> *md, const Real time, const Real dt) {
drag_pkg->template Param<StoppingTimeParams>("stopping_time_params");
if (gas_self_par.damp_to_visc) {
auto &dp = gas_pkg->template Param<Diffusion::DiffCoeffParams>("visc_params");
if (dp.type == Diffusion::DiffType::viscosity_const) {
if (dp.type == Diffusion::DiffType::viscosity_plaw) {
if (stop_par.model == DragModel::constant) {
return SimpleDragSourceImpl<Diffusion::DiffType::viscosity_const,
return SimpleDragSourceImpl<Diffusion::DiffType::viscosity_plaw,
DragModel::constant, GEOM>(
md, time, dt, dp, eos_d, gas_self_par, dust_self_par, stop_par);
} else if (stop_par.model == DragModel::stokes) {
return SimpleDragSourceImpl<Diffusion::DiffType::viscosity_const,
return SimpleDragSourceImpl<Diffusion::DiffType::viscosity_plaw,
DragModel::stokes, GEOM>(
md, time, dt, dp, eos_d, gas_self_par, dust_self_par, stop_par);
}
Expand Down
Loading

0 comments on commit dd8b375

Please sign in to comment.