From 22f1f6857dad885a4bfd364c58caf6a14fa8c5dc Mon Sep 17 00:00:00 2001 From: Matthieu Schaller <matthieu.schaller@durham.ac.uk> Date: Sun, 27 Nov 2016 19:39:16 +0000 Subject: [PATCH] Also moved the Riemann solver choice to the configuration script. --- configure.ac | 29 +++++++++++++++++++++++++++-- src/const.h | 5 ----- src/hydro.h | 6 ++++-- src/riemann.h | 12 +++--------- src/riemann/riemann_exact.h | 8 +++++++- src/riemann/riemann_hllc.h | 8 ++++++++ src/riemann/riemann_trrs.h | 10 +++++++++- 7 files changed, 58 insertions(+), 20 deletions(-) diff --git a/configure.ac b/configure.ac index 3cb4679da3..c29c74859a 100644 --- a/configure.ac +++ b/configure.ac @@ -559,7 +559,6 @@ case "$with_hydro" in ;; esac - # SPH Kernel function AC_ARG_WITH([kernel], [AS_HELP_STRING([--with-kernel=<kernel>], @@ -592,7 +591,6 @@ case "$with_kernel" in ;; esac - # Dimensionality of the hydro scheme. AC_ARG_WITH([hydro-dimension], [AS_HELP_STRING([--with-hydro-dimension=<dim>], @@ -662,6 +660,32 @@ case "$with_gamma" in ;; esac +# Riemann solver +AC_ARG_WITH([riemann-solver], + [AS_HELP_STRING([--with-riemann-solver=<solver>], + [riemann solver (gizmo-sph only) @<:@none, exact, trrs, hllc, default: none@:>@] + )], + [with_riemann="$withval"], + [with_riemann="none"] +) +case "$with_riemann" in + none) + AC_DEFINE([RIEMANN_SOLVER_NONE], [1], [No Riemann solver]) + ;; + exact) + AC_DEFINE([RIEMANN_SOLVER_EXACT], [1], [Exact Riemann solver]) + ;; + trrs) + AC_DEFINE([RIEMANN_SOLVER_TRRS], [1], [Two Rarefaction Riemann Solver]) + ;; + hllc) + AC_DEFINE([RIEMANN_SOLVER_HLLC], [1], [Harten-Lax-van Leer-Contact Riemann solver]) + ;; + *) + AC_MSG_ERROR([Unknown Riemann solver: $with_riemann]) + ;; +esac + # Cooling function AC_ARG_WITH([cooling], [AS_HELP_STRING([--with-cooling=<function>], @@ -760,6 +784,7 @@ AC_MSG_RESULT([ Kernel function : $with_kernel Equation of state : $with_eos Adiabatic index : $with_gamma + Riemann solver : $with_riemann Cooling function : $with_cooling External potential : $with_potential Task debugging : $enable_task_debugging diff --git a/src/const.h b/src/const.h index 8f8d25f93e..c290a3e73a 100644 --- a/src/const.h +++ b/src/const.h @@ -45,11 +45,6 @@ #define const_gravity_r_cut 4.5f #define const_gravity_eta 0.025f -/* Riemann solver to use (GIZMO_SPH only) */ -#define RIEMANN_SOLVER_EXACT -//#define RIEMANN_SOLVER_TRRS -//#define RIEMANN_SOLVER_HLLC - /* Type of gradients to use (GIZMO_SPH only) */ /* If no option is chosen, no gradients are used (first order scheme) */ //#define GRADIENTS_SPH diff --git a/src/hydro.h b/src/hydro.h index 4345c9a979..3dce6df074 100644 --- a/src/hydro.h +++ b/src/hydro.h @@ -19,10 +19,12 @@ #ifndef SWIFT_HYDRO_H #define SWIFT_HYDRO_H -/* Includes. */ +/* Config parameters. */ +#include "../config.h" + +/* Local headers. */ #include "hydro_properties.h" #include "kernel_hydro.h" -#include "part.h" /* Import the right functions */ #if defined(MINIMAL_SPH) diff --git a/src/riemann.h b/src/riemann.h index 69e1a038fc..685d40708e 100644 --- a/src/riemann.h +++ b/src/riemann.h @@ -19,13 +19,8 @@ #ifndef SWIFT_RIEMANN_H #define SWIFT_RIEMANN_H -/* gives us const_hydro_gamma and tells us which floating point type to use */ -#include "const.h" -#include "error.h" -#include "float.h" -#include "math.h" -#include "stdio.h" -#include "stdlib.h" +/* Config parameters. */ +#include "../config.h" #if defined(RIEMANN_SOLVER_EXACT) @@ -35,8 +30,7 @@ #elif defined(EOS_ISOTHERMAL_GAS) #include "riemann/riemann_exact_isothermal.h" #else -#error \ - "The Exact Riemann solver is incompatible with the selected equation of state!" +#error "The Exact Riemann solver is incompatible with this equation of state!" #endif #elif defined(RIEMANN_SOLVER_TRRS) diff --git a/src/riemann/riemann_exact.h b/src/riemann/riemann_exact.h index 10dfe56ef3..4a20561def 100644 --- a/src/riemann/riemann_exact.h +++ b/src/riemann/riemann_exact.h @@ -25,12 +25,18 @@ * Dynamics, Springer (2009, 3rd edition) * ******************************************************************************/ - #ifndef SWIFT_RIEMANN_EXACT_H #define SWIFT_RIEMANN_EXACT_H +/* Some standard headers. */ #include <float.h> +#include <math.h> +#include <stdio.h> +#include <stdlib.h> + +/* Local headers. */ #include "adiabatic_index.h" +#include "error.h" #include "minmax.h" #include "riemann_vacuum.h" diff --git a/src/riemann/riemann_hllc.h b/src/riemann/riemann_hllc.h index 962fb8380a..e9a32cb936 100644 --- a/src/riemann/riemann_hllc.h +++ b/src/riemann/riemann_hllc.h @@ -20,7 +20,15 @@ #ifndef SWIFT_RIEMANN_HLLC_H #define SWIFT_RIEMANN_HLLC_H +/* Some standard headers. */ +#include <float.h> +#include <math.h> +#include <stdio.h> +#include <stdlib.h> + +/* Local headers. */ #include "adiabatic_index.h" +#include "error.h" #include "minmax.h" #include "riemann_vacuum.h" diff --git a/src/riemann/riemann_trrs.h b/src/riemann/riemann_trrs.h index be56b93583..44fbe6ffb8 100644 --- a/src/riemann/riemann_trrs.h +++ b/src/riemann/riemann_trrs.h @@ -16,11 +16,19 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * ******************************************************************************/ - #ifndef SWIFT_RIEMANN_TRRS_H #define SWIFT_RIEMANN_TRRS_H +/* Some standard headers. */ +#include <float.h> +#include <math.h> +#include <stdio.h> +#include <stdlib.h> + +/* Local headers. */ #include "adiabatic_index.h" +#include "error.h" +#include "minmax.h" #include "riemann_vacuum.h" #ifndef EOS_IDEAL_GAS -- GitLab