diff --git a/configure.ac b/configure.ac index 4d8b5970d1a11bffd324bf7e1b85c42f3cee59ab..3cb4679da342a7830a5ffe4345fec3385fc1efc1 100644 --- a/configure.ac +++ b/configure.ac @@ -184,6 +184,18 @@ if test "$enable_task_debugging" = "yes"; then AC_DEFINE([SWIFT_DEBUG_TASKS],1,[Enable task debugging]) fi +# Check if expensive debugging is on. +AC_ARG_ENABLE([debugging-checks], + [AS_HELP_STRING([--enable-debugging-checks], + [Activate expensive consistency checks @<:@yes/no@:>@] + )], + [enable_debugging_checks="$enableval"], + [enable_debugging_checks="no"] +) +if test "$enable_debugging_checks" = "yes"; then + AC_DEFINE([SWIFT_DEBUG_CHECKS],1,[Enable expensive debugging]) +fi + # Define HAVE_POSIX_MEMALIGN if it works. AX_FUNC_POSIX_MEMALIGN @@ -520,20 +532,20 @@ fi # Hydro scheme. AC_ARG_WITH([hydro], [AS_HELP_STRING([--with-hydro=<scheme>], - [Hydro dynamics to use @<:@gadget2,minimal,hopkins,default,gizmo default gadget2@:>@] + [Hydro dynamics to use @<:@gadget2, minimal, hopkins, default, gizmo default: gadget2@:>@] )], [with_hydro="$withval"], [with_hydro="gadget2"] ) case "$with_hydro" in gadget2) - AC_DEFINE([GADGET2_SPH], [1], [Gadget2 SPH]) + AC_DEFINE([GADGET2_SPH], [1], [Gadget-2 SPH]) ;; minimal) AC_DEFINE([MINIMAL_SPH], [1], [Minimal SPH]) ;; hopkins) - AC_DEFINE([HOPKINS_PE_SPH], [1], [Hopkins Pressure-Entropy SPH]) + AC_DEFINE([HOPKINS_PE_SPH], [1], [Pressure-Entropy SPH]) ;; default) AC_DEFINE([DEFAULT_SPH], [1], [Default SPH]) @@ -543,16 +555,48 @@ case "$with_hydro" in ;; *) - AC_MSG_ERROR([unknown hydrodynamics scheme: $with_hydro]) + AC_MSG_ERROR([Unknown hydrodynamics scheme: $with_hydro]) ;; esac +# SPH Kernel function +AC_ARG_WITH([kernel], + [AS_HELP_STRING([--with-kernel=<kernel>], + [Kernel function to use @<:@cubic-spline, quartic-spline, quintic-spline, wendland-C2, wendland-C4, wendland-C6 default: cubic-spline@:>@] + )], + [with_kernel="$withval"], + [with_kernel="cubic-spline"] +) +case "$with_kernel" in + cubic-spline) + AC_DEFINE([CUBIC_SPLINE_KERNEL], [1], [Cubic spline kernel]) + ;; + quartic-spline) + AC_DEFINE([QUARTIC_SPLINE_KERNEL], [1], [Quartic spline kernel]) + ;; + quintic-spline) + AC_DEFINE([QUINTIC_SPLINE_KERNEL], [1], [Quintic spline kernel]) + ;; + wendland-C2) + AC_DEFINE([WENDLAND_C2_KERNEL], [1], [Wendland-C2 kernel]) + ;; + wendland-C4) + AC_DEFINE([WENDLAND_C4_KERNEL], [1], [Wendland-C4 kernel]) + ;; + wendland-C6) + AC_DEFINE([WENDLAND_C6_KERNEL], [1], [Wendland-C6 kernel]) + ;; + *) + AC_MSG_ERROR([Unknown kernel function: $with_kernel]) + ;; +esac + # Dimensionality of the hydro scheme. AC_ARG_WITH([hydro-dimension], - [AS_HELP_STRING([--with-hydro-dimension=3, 2 or 1], - [dimensionality of problem @<:@3/2/1 default 3@:>@] + [AS_HELP_STRING([--with-hydro-dimension=<dim>], + [dimensionality of problem @<:@3/2/1 default: 3@:>@] )], [with_dimension="$withval"], [with_dimension="3"] @@ -562,16 +606,116 @@ case "$with_dimension" in AC_DEFINE([HYDRO_DIMENSION_1D], [1], [1D analysis]) ;; 2) - AC_DEFINE([HYDRO_DIMENSION_2D], [1], [2D analysis]) + AC_DEFINE([HYDRO_DIMENSION_2D], [2], [2D analysis]) ;; 3) - AC_DEFINE([HYDRO_DIMENSION_3D], [1], [3D analysis]) + AC_DEFINE([HYDRO_DIMENSION_3D], [3], [3D analysis]) ;; *) AC_MSG_ERROR([Dimensionality must be 1, 2 or 3]) ;; esac +# Equation of state +AC_ARG_WITH([equation-of-state], + [AS_HELP_STRING([--with-equation-of-state=<EoS>], + [equation of state @<:@ideal-gas, isothermal-gas default: ideal-gas@:>@] + )], + [with_eos="$withval"], + [with_eos="ideal-gas"] +) +case "$with_eos" in + ideal-gas) + AC_DEFINE([EOS_IDEAL_GAS], [1], [Ideal gas equation of state]) + ;; + isothermal-gas) + AC_DEFINE([EOS_ISOTHERMAL_GAS], [1], [Isothermal gas equation of state]) + ;; + *) + AC_MSG_ERROR([Unknown equation of state: $with_eos]) + ;; +esac + +# Adiabatic index +AC_ARG_WITH([adiabatic-index], + [AS_HELP_STRING([--with-adiabatic-index=<gamma>], + [adiabatic index @<:@5/3, 7/5, 4/3, 2 default: 5/3@:>@] + )], + [with_gamma="$withval"], + [with_gamma="5/3"] +) +case "$with_gamma" in + 5/3) + AC_DEFINE([HYDRO_GAMMA_5_3], [5./3.], [Adiabatic index is 5/3]) + ;; + 7/5) + AC_DEFINE([HYDRO_GAMMA_7_5], [7./5.], [Adiabatic index is 7/5]) + ;; + 4/3) + AC_DEFINE([HYDRO_GAMMA_4_3], [4./3.], [Adiabatic index is 4/3]) + ;; + 2) + AC_DEFINE([HYDRO_GAMMA_2_1], [2.], [Adiabatic index is 2]) + ;; + *) + AC_MSG_ERROR([Unknown adiabatic index: $with_gamma]) + ;; +esac + +# Cooling function +AC_ARG_WITH([cooling], + [AS_HELP_STRING([--with-cooling=<function>], + [cooling function @<:@none, const-du, const-lambda, grackle default: none@:>@] + )], + [with_cooling="$withval"], + [with_cooling="none"] +) +case "$with_cooling" in + none) + AC_DEFINE([COOLING_NONE], [1], [No cooling function]) + ;; + const-du) + AC_DEFINE([COOLING_CONST_DU], [1], [Const du/dt cooling function]) + ;; + const-lambda) + AC_DEFINE([COOLING_CONST_LAMBDA], [1], [Const Lambda cooling function]) + ;; + grackle) + AC_DEFINE([COOLING_GRACKLE], [1], [Cooling via the grackle library]) + ;; + *) + AC_MSG_ERROR([Unknown cooling function: $with_cooling]) + ;; +esac + +# External potential +AC_ARG_WITH([ext-potential], + [AS_HELP_STRING([--with-ext-potential=<pot>], + [external potential @<:@none, point-mass, isothermal, softened-isothermal, disc-patch default: none@:>@] + )], + [with_potential="$withval"], + [with_potential="none"] +) +case "$with_potential" in + none) + AC_DEFINE([EXTERNAL_POTENTIAL_NONE], [1], [No external potential]) + ;; + point-mass) + AC_DEFINE([EXTERNAL_POTENTIAL_POINTMASS], [1], [Point-mass external potential]) + ;; + isothermal) + AC_DEFINE([EXTERNAL_POTENTIAL_ISOTHERMAL], [1], [Isothermal external potential]) + ;; + softened-isothermal) + AC_DEFINE([EXTERNAL_POTENTIAL_SOFTENED_ISOTHERMAL], [1], [Softened isothermal external potential]) + ;; + disc-patch) + AC_DEFINE([EXTERNAL_POTENTIAL_DISC_PATCH], [1], [Disc-patch external potential]) + ;; + *) + AC_MSG_ERROR([Unknown external potential: $with_potential]) + ;; +esac @@ -610,9 +754,16 @@ AC_MSG_RESULT([ libNUMA enabled : $have_numa Using tcmalloc : $have_tcmalloc CPU profiler : $have_profiler - Hydro scheme : $with_hydro - Dimensionality : $with_dimension - Task debugging : $enable_task_debugging + + Hydro scheme : $with_hydro + Dimensionality : $with_dimension + Kernel function : $with_kernel + Equation of state : $with_eos + Adiabatic index : $with_gamma + Cooling function : $with_cooling + External potential : $with_potential + Task debugging : $enable_task_debugging + Debugging checks : $enable_debugging_checks ]) # Generate output. diff --git a/src/active.h b/src/active.h index f0aba74df440e9538634bfe6a848d9ee9bcd1674..e33f8baf6e5bd5d799e122e4e04610a7cab443bf 100644 --- a/src/active.h +++ b/src/active.h @@ -24,7 +24,6 @@ /* Local includes. */ #include "cell.h" -#include "const.h" #include "engine.h" #include "part.h" diff --git a/src/adiabatic_index.h b/src/adiabatic_index.h index 59937db3c8d09fc7e6e969de0aee60f01a2e5a2c..94504af18b7b9ae99fc8c7abaf097e985cb53ab6 100644 --- a/src/adiabatic_index.h +++ b/src/adiabatic_index.h @@ -33,7 +33,6 @@ #include <math.h> /* Local headers. */ -#include "const.h" #include "debug.h" #include "error.h" #include "inline.h" diff --git a/src/const.h b/src/const.h index 9a912d47ca0cc2bfcaf90a8650c7508bc297600d..8f8d25f93e4d924f0c12a5578d6e38b94c562b7c 100644 --- a/src/const.h +++ b/src/const.h @@ -39,35 +39,11 @@ /* Thermal energy per unit mass used as a constant for the isothermal EoS */ #define const_isothermal_internal_energy 20.2615290634f -/* Dimensionality of the problem */ -//#define HYDRO_DIMENSION_3D -//#define HYDRO_DIMENSION_2D -//#define HYDRO_DIMENSION_1D - -/* Hydrodynamical adiabatic index. */ -#define HYDRO_GAMMA_5_3 -//#define HYDRO_GAMMA_7_5 -//#define HYDRO_GAMMA_4_3 -//#define HYDRO_GAMMA_2_1 - -/* Equation of state choice */ -#define EOS_IDEAL_GAS -//#define EOS_ISOTHERMAL_GAS - -/* Kernel function to use */ -#define CUBIC_SPLINE_KERNEL -//#define QUARTIC_SPLINE_KERNEL -//#define QUINTIC_SPLINE_KERNEL -//#define WENDLAND_C2_KERNEL -//#define WENDLAND_C4_KERNEL -//#define WENDLAND_C6_KERNEL - -/* SPH variant to use */ -//#define MINIMAL_SPH -//#define GADGET2_SPH -//#define HOPKINS_PE_SPH -//#define DEFAULT_SPH -//#define GIZMO_SPH +/* Self gravity stuff. */ +#define const_gravity_multipole_order 1 +#define const_gravity_a_smooth 1.25f +#define const_gravity_r_cut 4.5f +#define const_gravity_eta 0.025f /* Riemann solver to use (GIZMO_SPH only) */ #define RIEMANN_SOLVER_EXACT @@ -84,30 +60,8 @@ #define SLOPE_LIMITER_PER_FACE #define SLOPE_LIMITER_CELL_WIDE -/* Self gravity stuff. */ -#define const_gravity_multipole_order 1 -#define const_gravity_a_smooth 1.25f -#define const_gravity_r_cut 4.5f -#define const_gravity_eta 0.025f - -/* External gravity properties */ -#define EXTERNAL_POTENTIAL_NONE -//#define EXTERNAL_POTENTIAL_POINTMASS -//#define EXTERNAL_POTENTIAL_ISOTHERMALPOTENTIAL -//#define EXTERNAL_POTENTIAL_SOFTENED_ISOTHERMAL_POTENTIAL -//#define EXTERNAL_POTENTIAL_DISC_PATCH - /* Source terms */ #define SOURCETERMS_NONE //#define SOURCETERMS_SN_FEEDBACK -/* Cooling properties */ -#define COOLING_NONE -//#define COOLING_CONST_DU -//#define COOLING_CONST_LAMBDA -//#define COOLING_GRACKLE - -/* Are we debugging ? */ -//#define SWIFT_DEBUG_CHECKS - #endif /* SWIFT_CONST_H */ diff --git a/src/cooling.h b/src/cooling.h index 1b326f6dc4fdf796dd1587e73e9b591f0f500ccb..f0f227a619182af90d48c9416182f7a2132fd08c 100644 --- a/src/cooling.h +++ b/src/cooling.h @@ -27,9 +27,6 @@ /* Config parameters. */ #include "../config.h" -/* Local headers. */ -#include "const.h" - /* Import the right cooling definition */ #if defined(COOLING_NONE) #include "./cooling/none/cooling.h" diff --git a/src/dimension.h b/src/dimension.h index 0fae2c5602b87622ff67f6f5feb325efc6422472..f81f953f664c458f426a83e345e91921b28a55b8 100644 --- a/src/dimension.h +++ b/src/dimension.h @@ -29,7 +29,6 @@ #include "../config.h" /* Local headers. */ -#include "const.h" #include "inline.h" #include "vector.h" diff --git a/src/equation_of_state.h b/src/equation_of_state.h index 5b19f99ab85d8a2b4e5e6f0b4eeb542925b4ee50..5e570fc6343f11eb2c71720cfd51afe52161ff02 100644 --- a/src/equation_of_state.h +++ b/src/equation_of_state.h @@ -34,7 +34,6 @@ /* Local headers. */ #include "adiabatic_index.h" -#include "const.h" #include "debug.h" #include "inline.h" diff --git a/src/hydro.h b/src/hydro.h index 9e02c2009e307f0623ffb535ff9068603c2d4147..4345c9a979fbd169a25594b46b35ea8efe39eba0 100644 --- a/src/hydro.h +++ b/src/hydro.h @@ -20,7 +20,6 @@ #define SWIFT_HYDRO_H /* Includes. */ -#include "const.h" #include "hydro_properties.h" #include "kernel_hydro.h" #include "part.h" diff --git a/src/kernel_hydro.h b/src/kernel_hydro.h index a2eb065d60beb1ea624f0e2387bc0b0f3f01c3f5..8f38fc0d2b98988a48fe36edcbd2f9419d237d41 100644 --- a/src/kernel_hydro.h +++ b/src/kernel_hydro.h @@ -35,7 +35,6 @@ #include <math.h> /* Local headers. */ -#include "const.h" #include "dimension.h" #include "error.h" #include "inline.h" diff --git a/src/part.h b/src/part.h index 6832e0c6c2e0f2c324d90629447cf6a5e809d6fb..0bf4359f891619b0900f8aa9f17b2a2a71127579 100644 --- a/src/part.h +++ b/src/part.h @@ -32,7 +32,6 @@ /* Local headers. */ #include "align.h" -#include "const.h" /* Some constants. */ #define part_align 128 diff --git a/src/potential.h b/src/potential.h index f7fdd0072c502641d36f229337f4616b9033cbda..c462806e206e0e0455bf7094708ab003b7ca9682 100644 --- a/src/potential.h +++ b/src/potential.h @@ -27,17 +27,14 @@ /* Config parameters. */ #include "../config.h" -/* Local includes. */ -#include "const.h" - /* Import the right external potential definition */ #if defined(EXTERNAL_POTENTIAL_NONE) #include "./potential/none/potential.h" #elif defined(EXTERNAL_POTENTIAL_POINTMASS) #include "./potential/point_mass/potential.h" -#elif defined(EXTERNAL_POTENTIAL_ISOTHERMALPOTENTIAL) +#elif defined(EXTERNAL_POTENTIAL_ISOTHERMAL) #include "./potential/isothermal/potential.h" -#elif defined(EXTERNAL_POTENTIAL_SOFTENED_ISOTHERMAL_POTENTIAL) +#elif defined(EXTERNAL_POTENTIAL_SOFTENED_ISOTHERMAL) #include "./potential/softened_isothermal/potential.h" #elif defined(EXTERNAL_POTENTIAL_DISC_PATCH) #include "./potential/disc_patch/potential.h"