Commit 30e3e622 authored by Peter W. Draper's avatar Peter W. Draper
Browse files

Merge remote-tracking branch 'origin/master' into intel-amd-optimization

parents 30b62c26 dee5c258
......@@ -1060,7 +1060,7 @@ AC_ARG_WITH([random-seed],
[with_random_seed="$withval"],
[with_random_seed="0"]
)
AC_DEFINE_UNQUOTED([SWIFT_RANDOM_SEED_XOR], [$with_random_seed],[Value of the random seed.]),
AC_DEFINE_UNQUOTED([SWIFT_RANDOM_SEED_XOR], [$with_random_seed],[Value of the random seed.])
# Check for python.
have_python="no"
......@@ -1555,8 +1555,11 @@ case "$with_hydro" in
planetary)
AC_DEFINE([PLANETARY_SPH], [1], [Planetary SPH])
;;
sphenix)
AC_DEFINE([SPHENIX_SPH], [1], [SPHENIX SPH])
;;
anarchy-du)
AC_DEFINE([ANARCHY_DU_SPH], [1], [ANARCHY (DU) SPH])
AC_DEFINE([SPHENIX_SPH], [1], [SPHENIX SPH])
;;
anarchy-pu)
AC_DEFINE([ANARCHY_PU_SPH], [1], [ANARCHY (PU) SPH])
......
......@@ -62,64 +62,3 @@ There is also a compile-time parameter, ``viscosity_beta`` that we set to
``hydro_props_default_viscosity_alpha_feedback_reset = 2.0`` and the
diffusion is set to ``hydro_props_default_diffusion_alpha_feedback_reset =
0.0``. These can be changed in ``src/hydro/AnarchyPU/hydro_parameters.h``.
ANARCHY-DU SPH
==============
This is the new scheme that will be used in EAGLE-XL. This scheme includes:
+ Durier & Dalla Vecchia (2012) time-step limiter
+ Density-Energy SPH
+ Thermal diffusion following Price (2012)
+ A simplified version of the 'Inviscid SPH' artificial viscosity
(Cullen & Dehnen 2010), with a Balsara switch
+ A diffusion limiter, used to prevent energy leakage out of EAGLE
supernovae (Borrow in prep).
More information will be made available in a forthcoming publication.
The simplified version of the 'Inviscid SPH' artificial viscosity calculates
the time differential of the velocity divergence explicitly, using the value
from the previous step. We also use the Balsara switch instead of the improved
neighbour-based limiter from Cullen & Dehnen 2010, to avoid matrix
calculations.
The diffusion limiter is implemented to ensure that the diffusion is turned
ff in very viscous flows and works as follows:
.. code-block:: C
float new_diffusion_alpha = old_diffusion_alpha;
const float viscous_diffusion_limit =
diffusion_alpha_max *
(1.f - maximum_alpha_visc_over_ngb / viscosity_alpha_max);
new_diffusion_alpha = min(new_diffusion_alpha, viscous_diffusion_limit);
The parameters available for this scheme, and their defaults, are:
.. code-block:: yaml
SPH:
viscosity_alpha: 0.1 # Initial value for the alpha viscosity
viscosity_length: 0.25 # Viscosity decay length (in terms of sound-crossing time)
# These are enforced each time-step
viscosity_alpha_max: 2.0 # Maximal allowed value for the viscosity alpha
viscosity_alpha_min: 0.0 # Minimal allowed value for the viscosity alpha
diffusion_alpha: 0.0 # Initial value for the diffusion alpha
diffusion_beta: 0.25 # Timescale to raise the diffusion coefficient over
# (decay is on the sound-crossing time)
# These are enforced each time-step
diffusion_alpha_max: 1.0
diffusion_alpha_min: 0.0
There is also a compile-time parameter, ``viscosity_beta`` that we set to
3.0. During feedback events, the viscosity is set to the compile-time
``hydro_props_default_viscosity_alpha_feedback_reset = 2.0`` and the
diffusion is set to ``hydro_props_default_diffusion_alpha_feedback_reset =
0.0``. These can be changed in ``src/hydro/AnarchyPU/hydro_parameters.h``.
......@@ -18,6 +18,7 @@ schemes available in SWIFT, as well as how to implement your own.
planetary
hopkins_sph
anarchy_sph
sphenix_sph
gizmo
adding_your_own
.. SPHENIX SPH
Josh Borrow 8th January 2020
SPHENIX
=======
This is the new scheme that will be used in EAGLE-XL. This scheme includes:
+ Durier & Dalla Vecchia (2012) time-step limiter
+ Density-Energy SPH
+ Thermal diffusion following Price (2012)
+ A simplified version of the 'Inviscid SPH' artificial viscosity
(Cullen & Dehnen 2010), with a Balsara switch
+ A diffusion limiter, used to prevent energy leakage out of EAGLE
supernovae (Borrow+ 2020).
The simplified version of the 'Inviscid SPH' artificial viscosity calculates
the time differential of the velocity divergence explicitly, using the value
from the previous step. We also use the Balsara switch instead of the improved
neighbour-based limiter from Cullen & Dehnen 2010, to avoid matrix
calculations.
To configure with this scheme, use
.. code-block:: bash
./configure --with-hydro=sphenix --with-kernel=quintic-spline --disable-hand-vec
The diffusion limiter is implemented to ensure that the diffusion is turned
off in very viscous flows and works as follows:
.. code-block:: C
float new_diffusion_alpha = old_diffusion_alpha;
const float viscous_diffusion_limit =
diffusion_alpha_max *
(1.f - maximum_alpha_visc_over_ngb / viscosity_alpha_max);
new_diffusion_alpha = min(new_diffusion_alpha, viscous_diffusion_limit);
The parameters available for this scheme, and their defaults, are:
.. code-block:: yaml
SPH:
viscosity_alpha: 0.1 # Initial value for the alpha viscosity
viscosity_length: 0.25 # Viscosity decay length (in terms of sound-crossing time)
# These are enforced each time-step
viscosity_alpha_max: 2.0 # Maximal allowed value for the viscosity alpha
viscosity_alpha_min: 0.0 # Minimal allowed value for the viscosity alpha
diffusion_alpha: 0.0 # Initial value for the diffusion alpha
diffusion_beta: 0.25 # Timescale to raise the diffusion coefficient over
# (decay is on the sound-crossing time)
# These are enforced each time-step
diffusion_alpha_max: 1.0
diffusion_alpha_min: 0.0
There is also a compile-time parameter, ``viscosity_beta`` that we set to
3.0. During feedback events, the viscosity is set to the compile-time
``hydro_props_default_viscosity_alpha_feedback_reset = 2.0`` and the
diffusion is set to ``hydro_props_default_diffusion_alpha_feedback_reset =
0.0``. These can be changed in ``src/hydro/SPHENIX/hydro_parameters.h``.
Logger Output
=============
The logger is a particle based output (e.g. snapshot) that takes into account the large difference of timescale.
If you have any question, a slack channel is available for it in SWIFT's slack.
To run it, you will need to use the configuration option ``--enable-logger``.
Currently the logger is implemented only for Gadget2 and the default gravity / stars, but can be easily extended to the other schemes by adding the logger structure to the particles (see ``src/hydro/Gadget2/hydro_part.h``).
The main parameters of the logger are ``Logger:delta_step`` and ``Logger:index_mem_frac`` that define the time accuracy of the logger and the number of index files.
The first parameter defines the number of active steps that a particle is doing before writing and the second defines the total storage size of the index files as function of the dump file.
Unfortunately, the API is not really developed yet. Therefore if you wish to dump another field, you will need to trick the logger by replacing a field in the ``logger_log_part`` function.
For reading, the python wrapper is available through the configuration option ``--with-python``. Once compiled, you will be able to use the file ``logger/examples/reader_example.py``.
The first argument is the basename of the index file and the second one is the time requested.
During the first reading, the library is manipulating the dump file and therefore it should not be killed and may take a bit more time than usual.
......@@ -30,3 +30,4 @@ difference is the parameter file that will need to be adapted for SWIFT.
Task/index
VELOCIraptorInterface/index
AnalysisTools/index
Logger/index
......@@ -858,9 +858,9 @@ int main(int argc, char *argv[]) {
/* Initialise the cooling function properties */
#ifdef COOLING_NONE
if (with_cooling || with_temperature) {
if (with_cooling) {
error(
"ERROR: Running with cooling / temperature calculation"
"ERROR: Running with cooling calculation"
" but compiled without it.");
}
#else
......
......@@ -130,9 +130,9 @@ nobase_noinst_HEADERS = align.h approx_math.h atomic.h barrier.h cycle.h error.h
hydro/AnarchyPU/hydro.h hydro/PressureEnergy/hydro_iact.h hydro/PressureEnergy/hydro_io.h \
hydro/AnarchyPU/hydro_debug.h hydro/PressureEnergy/hydro_part.h \
hydro/AnarchyPU/hydro_parameters.h \
hydro/AnarchyDU/hydro.h hydro/PressureEnergy/hydro_iact.h hydro/PressureEnergy/hydro_io.h \
hydro/AnarchyDU/hydro_debug.h hydro/PressureEnergy/hydro_part.h \
hydro/AnarchyDU/hydro_parameters.h \
hydro/SPHENIX/hydro.h hydro/PressureEnergy/hydro_iact.h hydro/PressureEnergy/hydro_io.h \
hydro/SPHENIX/hydro_debug.h hydro/PressureEnergy/hydro_part.h \
hydro/SPHENIX/hydro_parameters.h \
hydro/Gizmo/hydro_parameters.h \
hydro/Gizmo/hydro_io.h hydro/Gizmo/hydro_debug.h \
hydro/Gizmo/hydro.h hydro/Gizmo/hydro_iact.h \
......
......@@ -58,8 +58,8 @@
#include "./hydro/Shadowswift/hydro_debug.h"
#elif defined(PLANETARY_SPH)
#include "./hydro/Planetary/hydro_debug.h"
#elif defined(ANARCHY_DU_SPH)
#include "./hydro/AnarchyDU/hydro_debug.h"
#elif defined(SPHENIX_SPH)
#include "./hydro/SPHENIX/hydro_debug.h"
#elif defined(ANARCHY_PU_SPH)
#include "./hydro/AnarchyPU/hydro_debug.h"
#else
......
......@@ -67,10 +67,10 @@
#include "./hydro/Planetary/hydro.h"
#include "./hydro/Planetary/hydro_iact.h"
#define SPH_IMPLEMENTATION "Minimal version of SPH with multiple materials"
#elif defined(ANARCHY_DU_SPH)
#include "./hydro/AnarchyDU/hydro.h"
#include "./hydro/AnarchyDU/hydro_iact.h"
#define SPH_IMPLEMENTATION "ANARCHY (Density-Energy) SPH (Borrow+ in prep)"
#elif defined(SPHENIX_SPH)
#include "./hydro/SPHENIX/hydro.h"
#include "./hydro/SPHENIX/hydro_iact.h"
#define SPH_IMPLEMENTATION "SPHENIX (Borrow+ 2020)"
#elif defined(ANARCHY_PU_SPH)
#include "./hydro/AnarchyPU/hydro.h"
#include "./hydro/AnarchyPU/hydro_iact.h"
......
......@@ -17,14 +17,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
******************************************************************************/
#ifndef SWIFT_ANARCHY_DU_HYDRO_H
#define SWIFT_ANARCHY_DU_HYDRO_H
#ifndef SWIFT_SPHENIX_HYDRO_H
#define SWIFT_SPHENIX_HYDRO_H
/**
* @file AnarchyDU/hydro.h
* @file SPHENIX/hydro.h
* @brief Density-Energy conservative implementation of SPH,
* with added ANARCHY physics (Cullen & Denhen 2011 AV,
* Price 2008 thermal diffusion (Non-neighbour loop
* with added SPHENIX physics (Borrow 2020) (Non-neighbour loop
* equations)
*/
......@@ -1083,4 +1082,4 @@ hydro_set_init_internal_energy(struct part *p, float u_init) {
p->u = u_init;
}
#endif /* SWIFT_ANARCHY_DU_HYDRO_H */
#endif /* SWIFT_SPHENIX_HYDRO_H */
......@@ -18,14 +18,13 @@
*
******************************************************************************/
#ifndef SWIFT_ANARCHY_DU_HYDRO_DEBUG_H
#define SWIFT_ANARCHY_DU_HYDRO_DEBUG_H
#ifndef SWIFT_SPHENIX_HYDRO_DEBUG_H
#define SWIFT_SPHENIX_HYDRO_DEBUG_H
/**
* @file AnarchyDU/hydro_debug.h
* @file SPHENIX/hydro_debug.h
* @brief Density-Energy conservative implementation of SPH,
* with added ANARCHY physics (Cullen & Denhen 2011 AV,
* Price 2008 thermal diffusion (Debugging routines)
* with added SPHENIX physics (Borrow 2020) (Debugging routines)
*/
__attribute__((always_inline)) INLINE static void hydro_debug_particle(
......@@ -44,4 +43,4 @@ __attribute__((always_inline)) INLINE static void hydro_debug_particle(
p->viscosity.alpha, p->time_bin);
}
#endif /* SWIFT_ANARCHY_DU_HYDRO_DEBUG_H */
#endif /* SWIFT_SPHENIX_HYDRO_DEBUG_H */
......@@ -17,14 +17,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
******************************************************************************/
#ifndef SWIFT_ANARCHY_DU_HYDRO_IACT_H
#define SWIFT_ANARCHY_DU_HYDRO_IACT_H
#ifndef SWIFT_SPHENIX_HYDRO_IACT_H
#define SWIFT_SPHENIX_HYDRO_IACT_H
/**
* @file AnarchyDU/hydro_iact.h
* @file SPHENIX/hydro_iact.h
* @brief Density-Energy conservative implementation of SPH,
* with added ANARCHY physics (Cullen & Denhen 2011 AV,
* Price 2008 thermal diffusion (interaction routines)
* with added SPHENIX physics (Borrow 2020) (interaction routines)
*/
#include "adiabatic_index.h"
......@@ -572,4 +571,4 @@ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_force(
pi->viscosity.v_sig = max(pi->viscosity.v_sig, v_sig);
}
#endif /* SWIFT_ANARCHY_DU_HYDRO_IACT_H */
#endif /* SWIFT_SPHENIX_HYDRO_IACT_H */
......@@ -17,14 +17,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
******************************************************************************/
#ifndef SWIFT_ANARCHY_DU_HYDRO_IO_H
#define SWIFT_ANARCHY_DU_HYDRO_IO_H
#ifndef SWIFT_SPHENIX_HYDRO_IO_H
#define SWIFT_SPHENIX_HYDRO_IO_H
/**
* @file AnarchyDU/hydro_io.h
* @file SPHENIX/hydro_io.h
* @brief Density-Energy conservative implementation of SPH,
* with added ANARCHY physics (Cullen & Denhen 2011 AV,
* Price 2008 thermal diffusion (i/o routines)
* with added SPHENIX physics (Borrow 2020) (i/o routines)
*/
#include "adiabatic_index.h"
......@@ -236,4 +235,4 @@ INLINE static void hydro_write_flavour(hid_t h_grpsph) {
*/
INLINE static int writeEntropyFlag(void) { return 0; }
#endif /* SWIFT_ANARCHY_DU_HYDRO_IO_H */
#endif /* SWIFT_SPHENIX_HYDRO_IO_H */
......@@ -18,8 +18,8 @@
*
******************************************************************************/
#ifndef SWIFT_ANARCHY_DU_HYDRO_PARAMETERS_H
#define SWIFT_ANARCHY_DU_HYDRO_PARAMETERS_H
#ifndef SWIFT_SPHENIX_HYDRO_PARAMETERS_H
#define SWIFT_SPHENIX_HYDRO_PARAMETERS_H
/* Configuration file */
#include "config.h"
......@@ -35,10 +35,9 @@
#include "inline.h"
/**
* @file AnarchyDU/hydro_parameters.h
* @file SPHENIX/hydro_parameters.h
* @brief Density-Energy conservative implementation of SPH,
* with added ANARCHY physics (Cullen & Denhen 2011 AV,
* Price 2008 thermal diffusion (default compile-time
* with added SPHENIX physics (Borrow 2020) (default compile-time
* parameters).
*
* This file defines a number of things that are used in
......@@ -301,4 +300,4 @@ static INLINE void diffusion_print_snapshot(
}
#endif
#endif /* SWIFT_ANARCHY_DU_HYDRO_PARAMETERS_H */
#endif /* SWIFT_SPHENIX_HYDRO_PARAMETERS_H */
......@@ -17,14 +17,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
******************************************************************************/
#ifndef SWIFT_ANARCHY_DU_HYDRO_PART_H
#define SWIFT_ANARCHY_DU_HYDRO_PART_H
#ifndef SWIFT_SPHENIX_HYDRO_PART_H
#define SWIFT_SPHENIX_HYDRO_PART_H
/**
* @file AnarchyDU/hydro_part.h
* @file SPHENIX/hydro_part.h
* @brief Density-Energy conservative implementation of SPH,
* with added ANARCHY physics (Cullen & Denhen 2011 AV,
* Price 2008 thermal diffusion (particle definition)
* with added SPHENIX physics (Borrow 2020) (particle definition)
*/
#include "black_holes_struct.h"
......@@ -216,4 +215,4 @@ struct part {
} SWIFT_STRUCT_ALIGN;
#endif /* SWIFT_ANARCHY_DU_HYDRO_PART_H */
#endif /* SWIFT_SPHENIX_HYDRO_PART_H */
......@@ -41,8 +41,8 @@
#include "./hydro/Shadowswift/hydro_io.h"
#elif defined(PLANETARY_SPH)
#include "./hydro/Planetary/hydro_io.h"
#elif defined(ANARCHY_DU_SPH)
#include "./hydro/AnarchyDU/hydro_io.h"
#elif defined(SPHENIX_SPH)
#include "./hydro/SPHENIX/hydro_io.h"
#elif defined(ANARCHY_PU_SPH)
#include "./hydro/AnarchyPU/hydro_io.h"
#else
......
......@@ -47,8 +47,8 @@
#include "./hydro/Shadowswift/hydro_parameters.h"
#elif defined(PLANETARY_SPH)
#include "./hydro/Planetary/hydro_parameters.h"
#elif defined(ANARCHY_DU_SPH)
#include "./hydro/AnarchyDU/hydro_parameters.h"
#elif defined(SPHENIX_SPH)
#include "./hydro/SPHENIX/hydro_parameters.h"
#elif defined(ANARCHY_PU_SPH)
#include "./hydro/AnarchyPU/hydro_parameters.h"
#else
......
......@@ -74,8 +74,8 @@
#elif defined(PLANETARY_SPH)
#include "./hydro/Planetary/hydro_part.h"
#define hydro_need_extra_init_loop 0
#elif defined(ANARCHY_DU_SPH)
#include "./hydro/AnarchyDU/hydro_part.h"
#elif defined(SPHENIX_SPH)
#include "./hydro/SPHENIX/hydro_part.h"
#define hydro_need_extra_init_loop 0
#define EXTRA_HYDRO_LOOP
#elif defined(ANARCHY_PU_SPH)
......
......@@ -113,7 +113,7 @@ void set_energy_state(struct part *part, enum pressure_field press, float size,
part->u = pressure / (hydro_gamma_minus_one * density);
#elif defined(MINIMAL_SPH) || defined(HOPKINS_PU_SPH) || \
defined(HOPKINS_PU_SPH_MONAGHAN) || defined(ANARCHY_PU_SPH) || \
defined(ANARCHY_DU_SPH) || defined(DEFAULT_SPH)
defined(SPHENIX_SPH) || defined(DEFAULT_SPH)
part->u = pressure / (hydro_gamma_minus_one * density);
#elif defined(PLANETARY_SPH)
part->u = pressure / (hydro_gamma_minus_one * density);
......@@ -406,7 +406,7 @@ void dump_particle_fields(char *fileName, struct cell *main_cell,
defined(GIZMO_MFV_SPH) || defined(SHADOWFAX_SPH) || \
defined(HOPKINS_PU_SPH) || defined(HOPKINS_PU_SPH_MONAGHAN)
0.f,
#elif defined(ANARCHY_PU_SPH) || defined(ANARCHY_DU_SPH) || defined(DEFAULT_SPH)
#elif defined(ANARCHY_PU_SPH) || defined(SPHENIX_SPH) || defined(DEFAULT_SPH)
main_cell->hydro.parts[pid].viscosity.div_v,
#else
main_cell->hydro.parts[pid].density.div_v,
......@@ -427,7 +427,7 @@ void dump_particle_fields(char *fileName, struct cell *main_cell,
defined(HOPKINS_PU_SPH_MONAGHAN)
main_cell->hydro.parts[pid].force.v_sig, 0.f,
main_cell->hydro.parts[pid].u_dt
#elif defined(ANARCHY_PU_SPH) || defined(ANARCHY_DU_SPH) || defined(DEFAULT_SPH)
#elif defined(ANARCHY_PU_SPH) || defined(SPHENIX_SPH) || defined(DEFAULT_SPH)
main_cell->hydro.parts[pid].viscosity.v_sig, 0.f,
main_cell->hydro.parts[pid].u_dt
#else
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment