Skip to content
Snippets Groups Projects
Commit 16e17af6 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Merge branch 'multi_softening' into 'master'

Support for multiple softening lengths in the gravity solver

Closes #599

See merge request !884
parents 985720fc 85586929
No related branches found
No related tags found
1 merge request!884Support for multiple softening lengths in the gravity solver
Showing
with 152 additions and 102 deletions
......@@ -1390,24 +1390,21 @@ AM_CONDITIONAL([HAVESTANDALONEFOF],[test $enable_standalone_fof = "yes"])
# Gravity scheme.
AC_ARG_WITH([gravity],
[AS_HELP_STRING([--with-gravity=<scheme>],
[Gravity scheme to use @<:@default, with-potential, default: default@:>@]
[Gravity scheme to use @<:@basic, with-potential, with-multi-softening default: with-multi-softening@:>@]
)],
[with_gravity="$withval"],
[with_gravity="default"]
[with_gravity="with-multi-softening"]
)
if test "$with_subgrid" = "EAGLE"; then
if test "$with_gravity" = "default"; then
with_gravity="with-potential"
fi
fi
case "$with_gravity" in
with-potential)
AC_DEFINE([POTENTIAL_GRAVITY], [1], [Gravity scheme with potential calculation])
AC_DEFINE([POTENTIAL_GRAVITY], [1], [Basic gravity scheme with potential calculation])
;;
default)
AC_DEFINE([DEFAULT_GRAVITY], [1], [Default gravity scheme])
with-multi-softening)
AC_DEFINE([MULTI_SOFTENING_GRAVITY], [1], [Gravity scheme with per-particle type softening value and background particles])
;;
basic)
AC_DEFINE([DEFAULT_GRAVITY], [1], [Basic gravity scheme])
;;
*)
AC_MSG_ERROR([Unknown gravity scheme: $with_gravity])
......@@ -1982,13 +1979,6 @@ AC_DEFINE_UNQUOTED([SELF_GRAVITY_MULTIPOLE_ORDER], [$with_multipole_order], [Mul
AC_PATH_PROG([GIT_CMD], [git])
AC_SUBST([GIT_CMD])
# Check that the gravity model is compatible with the subgrid
if test $with_black_holes = "EAGLE"; then
if test $with_gravity != "with-potential"; then
AC_MSG_ERROR([The EAGLE BH model needs the gravity scheme to provide potentials. The code must be compile with --with-gravity=with-potential.])
fi
fi
# Make the documentation. Add conditional to handle disable option.
DX_INIT_DOXYGEN(libswift,doc/Doxyfile,doc/)
AM_CONDITIONAL([HAVE_DOXYGEN], [test "$ac_cv_path_ac_pt_DX_DOXYGEN" != ""])
......
......@@ -44,27 +44,29 @@ There are several groups that contain 'auxiliary' information, such as
the particles. Some types are currently ignored by SWIFT but are kept in the
file format for compatibility reasons.
+---------------------+------------------------+----------------------------+
| HDF5 Group Name | Physical Particle Type | In code ``enum part_type`` |
+=====================+========================+============================+
| ``/PartType0/`` | Gas | ``swift_type_gas`` |
+---------------------+------------------------+----------------------------+
| ``/PartType1/`` | Dark Matter | ``swift_type_dark_matter`` |
+---------------------+------------------------+----------------------------+
| ``/PartType2/`` | Ignored | |
+---------------------+------------------------+----------------------------+
| ``/PartType3/`` | Ignored | |
+---------------------+------------------------+----------------------------+
| ``/PartType4/`` | Stars | ``swift_type_star`` |
+---------------------+------------------------+----------------------------+
| ``/PartType5/`` | Black Holes | ``swift_type_black_hole`` |
+---------------------+------------------------+----------------------------+
+---------------------+------------------------+----------------------------------------+
| HDF5 Group Name | Physical Particle Type | In code ``enum part_type`` |
+=====================+========================+========================================+
| ``/PartType0/`` | Gas | ``swift_type_gas`` |
+---------------------+------------------------+----------------------------------------+
| ``/PartType1/`` | Dark Matter | ``swift_type_dark_matter`` |
+---------------------+------------------------+----------------------------------------+
| ``/PartType2/`` | Background Dark Matter | ``swift_type_dark_matter_background`` |
+---------------------+------------------------+----------------------------------------+
| ``/PartType3/`` | Ignored | |
+---------------------+------------------------+----------------------------------------+
| ``/PartType4/`` | Stars | ``swift_type_star`` |
+---------------------+------------------------+----------------------------------------+
| ``/PartType5/`` | Black Holes | ``swift_type_black_hole`` |
+---------------------+------------------------+----------------------------------------+
The last column in the table gives the ``enum`` value from ``part_type.h``
corresponding to a given entry in the files.
Note that the only particles that have hydrodynamical forces calculated between
them are those in ``PartType0``.
Note that the only particles that have hydrodynamical forces calculated
between them are those in ``PartType0``. The background dark matter
particles are used for zoom-in simulations and can have different masses
(and as a consequence softening length) within the ``/PartType2`` arrays.
Necessary Components
......@@ -137,8 +139,8 @@ individual particle type (e.g. ``/PartType0/``) that have the following *dataset
within [0, L)^3 where L is the side-length of the simulation volume. In the
case of cosmological simulations, these are the co-moving positions.
+ ``Velocities``, an array of shape (N, 3) that is the cartesian velocities of
the particles. When running cosmological simulations, these are the peculiar
velocities. Note that this is different from GADGET which uses peculiar
the particles. When running cosmological simulations, these are the **peculiar
velocities**. Note that this is different from GADGET which uses peculiar
velocities divided by ``sqrt(a)`` (see below for a fix).
+ ``ParticleIDs``, an array of length N that are unique identifying numbers for
each particle. Note that these have to be unique to a particle, and cannot be
......
......@@ -174,7 +174,7 @@ use the following parameters:
h: 0.6777
Omega_m: 0.307
Omega_lambda: 0.693
Omega_b: 0.0455
Omega_b: 0.0482519
Omega_r: 0. # (Optional)
w_0: -1.0 # (Optional)
w_a: 0. # (Optional)
......@@ -191,12 +191,32 @@ The behaviour of the self-gravity solver can be modified by the parameters
provided in the ``Gravity`` section. The theory document puts these parameters into the
context of the equations being solved. We give a brief overview here.
* The Plummer-equivalent co-moving softening length used for all particles :math:`\epsilon_{com}`: ``comoving_softening``,
* The Plummer-equivalent maximal physical softening length used for all particles :math:`\epsilon_{max}`: ``comoving_softening``,
At any redshift :math:`z`, the Plummer-equivalent softening length used by the
code will be :math:`\epsilon=\min(\epsilon_{max},
\frac{\epsilon_{com}}{z+1})`. This is expressed in internal units.
* The Plummer-equivalent co-moving softening length used for all dark matter particles :math:`\epsilon_{\rm com,DM}`: ``comoving_DM_softening``,
* The Plummer-equivalent co-moving softening length used for all baryon particles (gas, stars, BHs) :math:`\epsilon_{\rm com,bar}`: ``comoving_baryon_softening``,
* The Plummer-equivalent maximal physical softening length used for all dark matter particles :math:`\epsilon_{\rm max,DM}`: ``max_physical_DM_softening``,
* The Plummer-equivalent maximal physical softening length used for all baryon particles (gas, stars, BHs) :math:`\epsilon_{\rm max,bar}`: ``max_physical_baryon_softening``,
At any redshift :math:`z`, the Plummer-equivalent softening length used by
the code will be :math:`\epsilon=\min(\epsilon_{max},
\frac{\epsilon_{com}}{z+1})`. The same calculation is performed
independently for the dark matter and baryon particles. All the softening
quantities are expressed in internal units. Calculations that only involve
DM or baryons can leave the unused quantities out of the parameter
file. For non-cosmological runs, only the physical softening lengths need
to be supplied.
In case of zoom simulations, the softening of the additional, more massive, background
particles is specified via the parameter
``softening_ratio_background``. Since these particles will typically have
different masses to degrade the resolution away from the zoom region, the
particles won't have a single softening value. Instead, we specify the
fraction of the mean inter-particle separation to use. The code will then
derive the softening length of each particle assuming the mean density of
the Universe. That is :math:`\epsilon_{\rm background} =
f\sqrt[3]{\frac{m}{\Omega_m\rho_{\rm crit}}}`, where :math:`f` is the
user-defined value (typically of order 0.05).
The accuracy of the gravity calculation is governed by the following two parameters:
* The opening angle (multipole acceptance criterion) used in the FMM :math:`\theta`: ``theta``,
* The time-step size pre-factor :math:`\eta`: ``eta``,
......@@ -236,15 +256,17 @@ simulation:
# Parameters for the self-gravity scheme for the EAGLE-100 box
Gravity:
eta: 0.025
theta: 0.7
comoving_softening: 0.0026994 # 0.7 proper kpc at z=2.8.
max_physical_softening: 0.0007 # 0.7 proper kpc
rebuild_frequency: 0.01 # Default optional value
eta: 0.025
theta: 0.7
mesh_side_length: 512
a_smooth: 1.25 # Default optional value
r_cut_max: 4.5 # Default optional value
r_cut_min: 0.1 # Default optional value
comoving_DM_softening: 0.0026994 # 0.7 proper kpc at z=2.8.
max_physical_DM_softening: 0.0007 # 0.7 proper kpc
comoving_baryon_softening: 0.0026994 # 0.7 proper kpc at z=2.8.
max_physical_baryon_softening: 0.0007 # 0.7 proper kpc
rebuild_frequency: 0.01 # Default optional value
a_smooth: 1.25 # Default optional value
r_cut_max: 4.5 # Default optional value
r_cut_min: 0.1 # Default optional value
.. _Parameters_SPH:
......
......@@ -107,17 +107,19 @@ There are several groups that contain 'auxiliary' information, such as
the particles. The type use the naming convention of Gadget-2 (with
the OWLS and EAGLE extensions).
+---------------------+------------------------+----------------------------+
| HDF5 Group Name | Physical Particle Type | In code ``enum part_type`` |
+=====================+========================+============================+
| ``/PartType0/`` | Gas | ``swift_type_gas`` |
+---------------------+------------------------+----------------------------+
| ``/PartType1/`` | Dark Matter | ``swift_type_dark_matter`` |
+---------------------+------------------------+----------------------------+
| ``/PartType4/`` | Stars | ``swift_type_star`` |
+---------------------+------------------------+----------------------------+
| ``/PartType5/`` | Black Holes | ``swift_type_black_hole`` |
+---------------------+------------------------+----------------------------+
+---------------------+------------------------+----------------------------------------+
| HDF5 Group Name | Physical Particle Type | In code ``enum part_type`` |
+=====================+========================+========================================+
| ``/PartType0/`` | Gas | ``swift_type_gas`` |
+---------------------+------------------------+----------------------------------------+
| ``/PartType1/`` | Dark Matter | ``swift_type_dark_matter`` |
+---------------------+------------------------+----------------------------------------+
| ``/PartType2/`` | Background Dark Matter | ``swift_type_dark_matter_background`` |
+---------------------+------------------------+----------------------------------------+
| ``/PartType4/`` | Stars | ``swift_type_star`` |
+---------------------+------------------------+----------------------------------------+
| ``/PartType5/`` | Black Holes | ``swift_type_black_hole`` |
+---------------------+------------------------+----------------------------------------+
The last column in the table gives the ``enum`` value from ``part_type.h``
corresponding to a given entry in the files.
......
......@@ -49,6 +49,8 @@ Gravity:
mesh_side_length: 32
eta: 0.025
theta: 0.3
comoving_softening: 0.08 # 80 kpc = 1/25 of mean inter-particle separation
max_physical_softening: 0.08 # 80 kpc = 1/25 of mean inter-particle separation
comoving_DM_softening: 0.08 # 80 kpc = 1/25 of mean inter-particle separation
max_physical_DM_softening: 0.08 # 80 kpc = 1/25 of mean inter-particle separation
comoving_baryon_softening: 0.08 # 80 kpc = 1/25 of mean inter-particle separation
max_physical_baryon_softening: 0.08 # 80 kpc = 1/25 of mean inter-particle separation
......@@ -51,5 +51,7 @@ Gravity:
eta: 0.025
theta: 0.3
r_cut_max: 5.
comoving_softening: 0.001
max_physical_softening: 0.001
comoving_DM_softening: 0.001
max_physical_DM_softening: 0.001
comoving_baryon_softening: 0.001
max_physical_baryon_softening: 0.001
......@@ -23,7 +23,7 @@ TimeIntegration:
dt_max: 1e-3 # The maximal time-step size of the simulation (in internal units).
Scheduler:
max_top_level_cells: 80
max_top_level_cells: 64
# Parameters governing the snapshots
Snapshots:
......@@ -43,8 +43,9 @@ Statistics:
Gravity:
eta: 0.025 # Constant dimensionless multiplier for time integration.
theta: 0.85 # Opening angle (Multipole acceptance criterion)
comoving_softening: 0.0026994 # Comoving softening length (in internal units).
max_physical_softening: 0.0007 # Physical softening length (in internal units).
mesh_side_length: 512
comoving_DM_softening: 0.0026994 # Comoving DM softening length (in internal units).
max_physical_DM_softening: 0.0007 # Max physical DM softening length (in internal units).
# Parameters related to the initial conditions
InitialConditions:
......
......@@ -41,12 +41,11 @@ Statistics:
# Parameters for the self-gravity scheme
Gravity:
mesh_side_length: 32
eta: 0.025 # Constant dimensionless multiplier for time integration.
theta: 0.7 # Opening angle (Multipole acceptance criterion)
comoving_softening: 0.0026994 # Comoving softening length (in internal units).
max_physical_softening: 0.0007 # Physical softening length (in internal units).
mesh_side_length: 32
comoving_DM_softening: 0.0026994 # Comoving DM softening length (in internal units).
max_physical_DM_softening: 0.0007 # Max physical DM softening length (in internal units).
# Parameters related to the initial conditions
InitialConditions:
......
......@@ -43,9 +43,9 @@ Statistics:
Gravity:
eta: 0.025 # Constant dimensionless multiplier for time integration.
theta: 0.7 # Opening angle (Multipole acceptance criterion)
comoving_softening: 0.0026994 # Comoving softening length (in internal units).
max_physical_softening: 0.0007 # Physical softening length (in internal units).
mesh_side_length: 32
mesh_side_length: 64
comoving_DM_softening: 0.0026994 # Comoving DM softening length (in internal units).
max_physical_DM_softening: 0.0007 # Max physical DM softening length (in internal units).
# Parameters related to the initial conditions
InitialConditions:
......
......@@ -23,7 +23,7 @@ TimeIntegration:
dt_max: 1e-3 # The maximal time-step size of the simulation (in internal units).
Scheduler:
max_top_level_cells: 20
max_top_level_cells: 32
# Parameters governing the snapshots
Snapshots:
......@@ -42,9 +42,9 @@ Statistics:
Gravity:
eta: 0.025 # Constant dimensionless multiplier for time integration.
theta: 0.7 # Opening angle (Multipole acceptance criterion)
comoving_softening: 0.0026994 # Comoving softening length (in internal units).
max_physical_softening: 0.0007 # Physical softening length (in internal units).
mesh_side_length: 64
mesh_side_length: 128
comoving_DM_softening: 0.0026994 # Comoving DM softening length (in internal units).
max_physical_DM_softening: 0.0007 # Max physical DM softening length (in internal units).
# Parameters related to the initial conditions
InitialConditions:
......
......@@ -39,9 +39,11 @@ Statistics:
Gravity:
eta: 0.025 # Constant dimensionless multiplier for time integration.
theta: 0.7 # Opening angle (Multipole acceptance criterion)
comoving_softening: 0.0026994 # Comoving softening length (in internal units).
max_physical_softening: 0.0007 # Physical softening length (in internal units).
mesh_side_length: 64
comoving_DM_softening: 0.0026994 # Comoving DM softening length (in internal units).
max_physical_DM_softening: 0.0007 # Max physical DM softening length (in internal units).
comoving_baryon_softening: 0.0026994 # Comoving DM softening length (in internal units).
max_physical_baryon_softening: 0.0007 # Max physical DM softening length (in internal units).
# Parameters for the hydrodynamics scheme
SPH:
......
......@@ -39,9 +39,11 @@ Statistics:
Gravity:
eta: 0.025 # Constant dimensionless multiplier for time integration.
theta: 0.7 # Opening angle (Multipole acceptance criterion)
comoving_softening: 0.0026994 # Comoving softening length (in internal units).
max_physical_softening: 0.0007 # Physical softening length (in internal units).
mesh_side_length: 128
comoving_DM_softening: 0.0026994 # Comoving DM softening length (in internal units).
max_physical_DM_softening: 0.0007 # Max physical DM softening length (in internal units).
comoving_baryon_softening: 0.0026994 # Comoving DM softening length (in internal units).
max_physical_baryon_softening: 0.0007 # Max physical DM softening length (in internal units).
# Parameters for the hydrodynamics scheme
SPH:
......
......@@ -39,9 +39,11 @@ Statistics:
Gravity:
eta: 0.025 # Constant dimensionless multiplier for time integration.
theta: 0.7 # Opening angle (Multipole acceptance criterion)
comoving_softening: 0.0026994 # Comoving softening length (in internal units).
max_physical_softening: 0.0007 # Physical softening length (in internal units).
mesh_side_length: 256
comoving_DM_softening: 0.0026994 # Comoving DM softening length (in internal units).
max_physical_DM_softening: 0.0007 # Max physical DM softening length (in internal units).
comoving_baryon_softening: 0.0026994 # Comoving DM softening length (in internal units).
max_physical_baryon_softening: 0.0007 # Max physical DM softening length (in internal units).
# Parameters for the hydrodynamics scheme
SPH:
......
MetaData:
run_name: EAGLE-L0100N1504-Ref
# Define the system of units to use internally.
InternalUnitSystem:
UnitMass_in_cgs: 1.98848e43 # 10^10 M_sun in grams
......@@ -42,9 +45,11 @@ Statistics:
Gravity:
eta: 0.025 # Constant dimensionless multiplier for time integration.
theta: 0.85 # Opening angle (Multipole acceptance criterion)
comoving_softening: 0.0026994 # Comoving softening length (in internal units).
max_physical_softening: 0.0007 # Physical softening length (in internal units).
mesh_side_length: 256
comoving_DM_softening: 0.0026994 # Comoving DM softening length (in internal units).
max_physical_DM_softening: 0.0007 # Max physical DM softening length (in internal units).
comoving_baryon_softening: 0.0026994 # Comoving DM softening length (in internal units).
max_physical_baryon_softening: 0.0007 # Max physical DM softening length (in internal units).
# Parameters for the hydrodynamics scheme
SPH:
......
MetaData:
run_name: EAGLE-L0012N0188-Ref
# Define the system of units to use internally.
InternalUnitSystem:
UnitMass_in_cgs: 1.98848e43 # 10^10 M_sun in grams
......@@ -43,9 +46,11 @@ Statistics:
Gravity:
eta: 0.025 # Constant dimensionless multiplier for time integration.
theta: 0.7 # Opening angle (Multipole acceptance criterion)
comoving_softening: 0.0026994 # Comoving softening length (in internal units).
max_physical_softening: 0.0007 # Physical softening length (in internal units).
mesh_side_length: 32
comoving_DM_softening: 0.0026994 # Comoving DM softening length (in internal units).
max_physical_DM_softening: 0.0007 # Max physical DM softening length (in internal units).
comoving_baryon_softening: 0.0026994 # Comoving DM softening length (in internal units).
max_physical_baryon_softening: 0.0007 # Max physical DM softening length (in internal units).
# Parameters for the hydrodynamics scheme
SPH:
......
MetaData:
run_name: EAGLE-L0025N0376-Ref
# Define the system of units to use internally.
InternalUnitSystem:
UnitMass_in_cgs: 1.98848e43 # 10^10 M_sun in grams
......@@ -49,10 +52,13 @@ Statistics:
# Parameters for the self-gravity scheme
Gravity:
eta: 0.025 # Constant dimensionless multiplier for time integration.
theta: 0.7 # Opening angle (Multipole acceptance criterion)
comoving_softening: 0.0026994 # Comoving softening length (in internal units).
max_physical_softening: 0.0007 # Physical softening length (in internal units).
theta: 0.7 # Opening angle (Multipole acceptance criterion)
mesh_side_length: 64
comoving_DM_softening: 0.0026994 # Comoving DM softening length (in internal units).
max_physical_DM_softening: 0.0007 # Max physical DM softening length (in internal units).
comoving_baryon_softening: 0.0026994 # Comoving DM softening length (in internal units).
max_physical_baryon_softening: 0.0007 # Max physical DM softening length (in internal units).
# Parameters for the hydrodynamics scheme
SPH:
......
MetaData:
run_name: EAGLE-L0050N0752-Ref
# Define the system of units to use internally.
InternalUnitSystem:
UnitMass_in_cgs: 1.98848e43 # 10^10 M_sun in grams
......@@ -42,9 +45,11 @@ Statistics:
Gravity:
eta: 0.025 # Constant dimensionless multiplier for time integration.
theta: 0.7 # Opening angle (Multipole acceptance criterion)
comoving_softening: 0.0026994 # Comoving softening length (in internal units).
max_physical_softening: 0.0007 # Physical softening length (in internal units).
mesh_side_length: 128
comoving_DM_softening: 0.0026994 # Comoving DM softening length (in internal units).
max_physical_DM_softening: 0.0007 # Max physical DM softening length (in internal units).
comoving_baryon_softening: 0.0026994 # Comoving DM softening length (in internal units).
max_physical_baryon_softening: 0.0007 # Max physical DM softening length (in internal units).
# Parameters for the hydrodynamics scheme
SPH:
......
MetaData:
run_name: EAGLE-L0006N0094-Ref
# Define the system of units to use internally.
InternalUnitSystem:
UnitMass_in_cgs: 1.98848e43 # 10^10 M_sun in grams
......@@ -52,9 +55,11 @@ Statistics:
Gravity:
eta: 0.025 # Constant dimensionless multiplier for time integration.
theta: 0.7 # Opening angle (Multipole acceptance criterion)
comoving_softening: 0.0026994 # Comoving softening length (in internal units).
max_physical_softening: 0.0007 # Physical softening length (in internal units).
mesh_side_length: 16
comoving_DM_softening: 0.0026994 # Comoving DM softening length (in internal units).
max_physical_DM_softening: 0.0007 # Max physical DM softening length (in internal units).
comoving_baryon_softening: 0.0026994 # Comoving DM softening length (in internal units).
max_physical_baryon_softening: 0.0007 # Max physical DM softening length (in internal units).
# Parameters for the hydrodynamics scheme
SPH:
......
......@@ -48,8 +48,8 @@ SPH:
Gravity:
eta: 0.025 # Constant dimensionless multiplier for time integration.
theta: 0.7 # Opening angle (Multipole acceptance criterion)
comoving_softening: 0.003 # Comoving softening length (in internal units).
max_physical_softening: 0.003 # Physical softening length (in internal units).
comoving_baryon_softening: 0.003 # Comoving softening length (in internal units).
max_physical_baryon_softening: 0.003 # Physical softening length (in internal units).
# Parameters for the task scheduling
Scheduler:
......
......@@ -8,11 +8,9 @@ InternalUnitSystem:
# Parameters for the self-gravity scheme
Gravity:
mesh_side_length: 32 # Number of cells along each axis for the periodic gravity mesh.
eta: 0.025 # Constant dimensionless multiplier for time integration.
theta: 0.7 # Opening angle (Multipole acceptance criterion).
comoving_softening: 0.0026994 # Comoving softening length (in internal units).
max_physical_softening: 0.0007 # Physical softening length (in internal units).
max_physical_DM_softening: 0.7 # Physical softening length (in internal units).
# Parameters governing the time integration (Set dt_min and dt_max to the same value for a fixed time-step run.)
TimeIntegration:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment