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
b8d89d9
First push for MAGMA2. Right now it is just a Gasoline2 clone.
rennehan Jul 25, 2025
a6b204d
Added and tested the calculation of the correction matrix. Added in M…
rennehan Jul 25, 2025
89c0656
Now the correction matrix is used to compute the kernel gradients. Th…
rennehan Jul 26, 2025
c419a99
Rosswog 2020 has Ga and Gb using the same dx vector. That is importan…
rennehan Jul 26, 2025
85d8344
Equations 19 and 20 from Rosswog are now stored in the particle struc…
rennehan Jul 26, 2025
ed11b98
Renamed some variables to be more clear about the matrices. Added mor…
rennehan Jul 26, 2025
13be2df
The velocity Hessian is computed (a rank 3 tensor) for velocity recon…
rennehan Jul 26, 2025
609471b
Added in the Rosswog 2020 artificial viscosity using second order rec…
rennehan Jul 28, 2025
7c0316e
There are now more tensor, matrix, and vector operation functions in …
rennehan Jul 28, 2025
c7d27af
Symmetric heating from artificial viscosity is necessary or else ther…
rennehan Jul 28, 2025
28ed7ed
Added in artificial conductivity following Rosswog 2020. Also fixed t…
rennehan Jul 28, 2025
76cac7c
A lot of code clean-up in the hydro interactions. Redefined the maxim…
rennehan Jul 28, 2025
13e25aa
It is important to avoid floating point errors in the dot products. I…
rennehan Jul 28, 2025
66f25a8
Add error message with MAGMA2_DEBUG_CHECKS for time-step crash.
rennehan Jul 28, 2025
bcc5ebb
Add MAGMA2_DEBUG_CHECKS for force.h_dt. Seems there was a unit mistak…
rennehan Jul 28, 2025
5970ebf
The timestep is now the minimum over all neighbours of h_ij (mean smo…
rennehan Jul 29, 2025
eac6a2c
Renamed some constants for clarity and to allow const_slope_limiter_e…
rennehan Jul 29, 2025
3d90b7c
Can now switch between float and double precision by compiling with h…
rennehan Jul 29, 2025
db28d98
Fixed a mistake when computing dh/dt in both the MAGMA2 SPH way and t…
rennehan Jul 30, 2025
7ce9ec8
Fixed a bug in the tensor matrix contraction, now using the proper in…
rennehan Jul 30, 2025
876867e
Added in the correct Hubble flow term for the artificial viscosity.
rennehan Jul 30, 2025
26e3283
Use the pressure difference in the conductivity signal speed. I think…
rennehan Jul 30, 2025
5f2cbb5
Got the sign correct for the conductivity (heat flows from high to lo…
rennehan Jul 30, 2025
292c7ed
Cleaning up some of the variable names in the force interaction. Also…
rennehan Jul 30, 2025
f81e34e
Really now the proper dv_dot_G_ij term is included in the viscosity.
rennehan Jul 30, 2025
8a5aa7b
Forgot to remove a_inv, no longer needed.
rennehan Jul 30, 2025
0d7be29
Reorganized the viscosity weighting schemes and made new defaults.
rennehan Jul 30, 2025
ef1a126
Testing whether dh/dt calculation is causing energy non-conservation.
rennehan Jul 31, 2025
6f7976e
Added the Omega_i terms that correct for smoothing length changes in …
rennehan Jul 31, 2025
0d9183d
The "grad-h" terms in MAGMA2 (and non-conservative SPH-like methods) …
rennehan Aug 1, 2025
89a5073
Added in hydro_props_use_adiabatic_correction which allows the use of…
rennehan Aug 1, 2025
68b6ac1
Cleaning up some of the convenience functions so that dot products re…
rennehan Aug 4, 2025
fce873a
Added a Balsara limiter and figured out all of the correct Hubble flo…
rennehan Aug 14, 2025
6e3f4a9
Fixes to some of the symmetry issues and gradient estimation.
rennehan Aug 18, 2025
ff06345
Added some extra compilation options to test getting cosmological sim…
rennehan Aug 20, 2025
dcfc371
More changes to how viscosity and conductivity are done.
rennehan Aug 21, 2025
ee953e3
Always compute mu_ij from the raw velocities not the reconstructed ve…
rennehan Aug 22, 2025
d71e41a
Added a selection for different ways to compute dh/dt.
rennehan Aug 22, 2025
20bf59c
Clean up the signal speed calculation for time-stepping.
rennehan Aug 25, 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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ examples/*/*/restart
examples/Cooling/CoolingRates/cooling_rates
examples/Cooling/CoolingRates/cooling_element_*.dat
examples/Cooling/CoolingRates/cooling_output.dat
examples/Cooling/CoolingSedovBlast_3D/run/*
examples/SubgridTests/StellarEvolution/StellarEvolutionSolution*
examples/SubgridTests/CosmologicalStellarEvolution/StellarEvolutionSolution*
examples/SmallCosmoVolume/SmallCosmoVolume_DM/power_spectra
Expand Down
17 changes: 16 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,18 @@ if test "$enable_debugging_checks" = "yes"; then
AC_DEFINE([SWIFT_DEBUG_CHECKS],1,[Enable expensive debugging])
fi

# Check if expensive debugging is on.
AC_ARG_ENABLE([magma2-debugging-checks],
[AS_HELP_STRING([--enable-magma2-debugging-checks],
[Activate expensive MAGMA2 debugging checks @<:@yes/no@:>@]
)],
[enable_magma2_debugging_checks="$enableval"],
[enable_magma2_debugging_checks="no"]
)
if test "$enable_magma2_debugging_checks" = "yes"; then
AC_DEFINE([MAGMA2_DEBUG_CHECKS],1,[Enable expensive MAGMA2 debugging])
fi

# Check if cell graph is on.
AC_ARG_ENABLE([cell-graph],
[AS_HELP_STRING([--enable-cell-graph],
Expand Down Expand Up @@ -2223,7 +2235,7 @@ fi
# Hydro scheme.
AC_ARG_WITH([hydro],
[AS_HELP_STRING([--with-hydro=<scheme>],
[Hydro dynamics to use @<:@gadget2, minimal, pressure-entropy, pressure-energy, pressure-energy-monaghan, phantom, gizmo-mfv, gizmo-mfm, shadowswift, planetary, remix, sphenix, gasoline, anarchy-pu default: sphenix@:>@]
[Hydro dynamics to use @<:@gadget2, minimal, magma2, pressure-entropy, pressure-energy, pressure-energy-monaghan, phantom, gizmo-mfv, gizmo-mfm, shadowswift, planetary, remix, sphenix, gasoline, anarchy-pu default: sphenix@:>@]
)],
[with_hydro="$withval"],
[with_hydro="sphenix"]
Expand Down Expand Up @@ -2279,6 +2291,9 @@ case "$with_hydro" in
gasoline)
AC_DEFINE([GASOLINE_SPH], [1], [Gasoline SPH])
;;
magma2)
AC_DEFINE([MAGMA2_SPH], [1], [MAGMA2 SPH])
;;
anarchy-du)
AC_DEFINE([SPHENIX_SPH], [1], [SPHENIX SPH])
;;
Expand Down
4 changes: 2 additions & 2 deletions examples/Cooling/CoolingSedovBlast_3D/makeIC.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
print(rho0, "cm s^-3")

uL = 1.0e3 * pc
uM = 1.99e30
uv = 1.0e10
uM = 1.99e43
uv = 1.0e5
ut = uL / uv
uU = uv ** 2
print("ut:", ut / 3.154e7, "yr")
Expand Down
2 changes: 1 addition & 1 deletion examples/Cooling/CoolingSedovBlast_3D/sedov.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Define the system of units to use internally.
InternalUnitSystem:
UnitMass_in_cgs: 1.99e33 # g
UnitMass_in_cgs: 1.99e43 # g
UnitLength_in_cgs: 3.086e21 # cm
UnitVelocity_in_cgs: 1.e5 # Centimeters per second
UnitCurrent_in_cgs: 1 # Amperes
Expand Down
2 changes: 1 addition & 1 deletion examples/Cosmology/ZeldovichPancake_3D/makeIC.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@

# Some useful variables in h-full units
H_0 = 1.0 / Mpc_in_m * 10 ** 5 # h s^-1
rho_0 = 3.0 * H_0 ** 2 / (8 * math.pi * G_in_SI) # h^2 kg m^-3
rho_0 = 3.0 * H_0 ** 2 / (8 * pi * G_in_SI) # h^2 kg m^-3
lambda_i = 64.0 / H_0 * 10 ** 5 # h^-1 m (= 64 h^-1 Mpc)
x_min = -0.5 * lambda_i
x_max = 0.5 * lambda_i
Expand Down
2 changes: 1 addition & 1 deletion examples/HydroTests/KelvinHelmholtzGrowthRate_3D/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ then
fi

# Run SWIFT
../../../swift --hydro --threads=1 kelvinHelmholtzGrowthRate.yml 2>&1 | tee output.log
../../../swift --hydro --threads=16 kelvinHelmholtzGrowthRate.yml 2>&1 | tee output.log

# Plot the solution
python3 plotSolution.py 100
2 changes: 1 addition & 1 deletion examples/HydroTests/Rayleigh-Taylor_2D/makeMovie.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def project(data, m_res, property, ylim):
x = x[mask]
y = y[mask] - np.float64(ylim[0])

h = data.gas.smoothing_length[mask]
h = data.gas.smoothing_lengths[mask]

if property == "density":
property = "masses"
Expand Down
Empty file modified examples/HydroTests/Rayleigh-Taylor_2D/run.sh
100644 → 100755
Empty file.
2 changes: 2 additions & 0 deletions src/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@
#include "./hydro/SPHENIX/hydro_debug.h"
#elif defined(GASOLINE_SPH)
#include "./hydro/Gasoline/hydro_debug.h"
#elif defined(MAGMA2_SPH)
#include "./hydro/MAGMA2/hydro_debug.h"
#elif defined(ANARCHY_PU_SPH)
#include "./hydro/AnarchyPU/hydro_debug.h"
#else
Expand Down
6 changes: 6 additions & 0 deletions src/forcing/roberts_flow_acceleration/forcing.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,14 @@ __attribute__((always_inline)) INLINE static void forcing_terms_apply(

/* Effective viscosity from artificial viscosity, as in eq. 100 from
* arXiv:1012.1885 */
#ifndef MAGMA2_SPH
const float nu = terms->nu * p->viscosity.alpha * c_s * p->h /
(2.f * (hydro_dimension + 2.f));
#else
/* TODO: MAGMA2 does not track alpha per particle */
const float nu = terms->nu * const_viscosity_alpha * c_s * p->h /
(2.f * (hydro_dimension + 1.f));
#endif

const float Vz_factor = terms->Vz_factor;
const double k0 = (2. * M_PI / L) * terms->kv;
Expand Down
4 changes: 4 additions & 0 deletions src/hydro.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@
#include "./hydro/Gasoline/hydro.h"
#include "./hydro/Gasoline/hydro_iact.h"
#define SPH_IMPLEMENTATION "Gasoline-2 (Wadsley+ 2017)"
#elif defined(MAGMA2_SPH)
#include "./hydro/MAGMA2/hydro.h"
#include "./hydro/MAGMA2/hydro_iact.h"
#define SPH_IMPLEMENTATION "MAGMA2 (Rosswog 2020)"
#elif defined(ANARCHY_PU_SPH)
#include "./hydro/AnarchyPU/hydro.h"
#include "./hydro/AnarchyPU/hydro_iact.h"
Expand Down
Loading