diff --git a/src/const.h b/src/const.h index 552d49c8f1e4dd9f4fa2855e5fed548acd5c0b3f..1082bccc0bd514316c1457d67ea3f1023943c9e5 100644 --- a/src/const.h +++ b/src/const.h @@ -95,8 +95,9 @@ //#define EXTERNAL_POTENTIAL_DISK_PATCH /* Cooling properties */ +#define COOLING_NONE //#define COOLING_CONST_DU -#define COOLING_CONST_LAMBDA +//#define COOLING_CONST_LAMBDA //#define COOLING_GRACKLE /* Are we debugging ? */ diff --git a/src/cooling.h b/src/cooling.h index 034ee2329d91b17b875932bc4eb40d0d80a05111..ff9b505fa6c9877055ded13f842e1298912112e8 100644 --- a/src/cooling.h +++ b/src/cooling.h @@ -31,7 +31,9 @@ #include "const.h" /* Import the right cooling definition */ -#if defined(COOLING_CONST_DU) +#if defined(COOLING_NONE) +#include "./cooling/none/cooling.h" +#elif defined(COOLING_CONST_DU) #include "./cooling/const_du/cooling.h" #elif defined(COOLING_CONST_LAMBDA) #include "./cooling/const_lambda/cooling.h" diff --git a/src/cooling/const_du/cooling.h b/src/cooling/const_du/cooling.h index 70f704ae457c5ec71335ed6cba9758b53457cbb6..9374f17d9bb131a856481f5e1eb80a82b60bd259 100644 --- a/src/cooling/const_du/cooling.h +++ b/src/cooling/const_du/cooling.h @@ -106,7 +106,7 @@ __attribute__((always_inline)) INLINE static void cooling_cool_part( * @param us The internal system of units. * @param p Pointer to the particle data. */ -__attribute__((always_inline)) INLINE static double cooling_timestep( +__attribute__((always_inline)) INLINE static float cooling_timestep( const struct cooling_data* restrict cooling, const struct phys_const* restrict phys_const, const struct UnitSystem* restrict us, const struct part* restrict p) { @@ -143,7 +143,7 @@ static INLINE void cooling_init_backend( */ static INLINE void cooling_print_backend(const struct cooling_data* cooling) { - message("Cooling function is 'Constant cooling' with rate %f and floor %f", + message("Cooling function is 'Constant cooling' with rate %f and floor %f.", cooling->cooling_rate, cooling->min_energy); } diff --git a/src/cooling/none/cooling.h b/src/cooling/none/cooling.h new file mode 100644 index 0000000000000000000000000000000000000000..b296e1244df07470493530cebc64710ef8673505 --- /dev/null +++ b/src/cooling/none/cooling.h @@ -0,0 +1,103 @@ +/******************************************************************************* + * This file is part of SWIFT. + * Copyright (c) 2016 Matthieu Schaller (matthieu.schaller@durham.ac.uk) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + ******************************************************************************/ +#ifndef SWIFT_COOLING_NONE_H +#define SWIFT_COOLING_NONE_H + +/** + * @file src/cooling/none/cooling.h + * @brief Empty infrastructure for the cases without cooling function + */ + +/* Some standard headers. */ +#include <float.h> +#include <math.h> + +/* Local includes. */ +#include "error.h" +#include "hydro.h" +#include "parser.h" +#include "part.h" +#include "physical_constants.h" +#include "units.h" + +/** + * @brief Properties of the cooling function. + */ +struct cooling_data {}; + +/** + * @brief Apply the cooling function to a particle. + * + * We do nothing. + * + * @param phys_const The physical constants in internal units. + * @param us The internal system of units. + * @param cooling The #cooling_data used in the run. + * @param p Pointer to the particle data. + * @param dt The time-step of this particle. + */ +__attribute__((always_inline)) INLINE static void cooling_cool_part( + const struct phys_const* restrict phys_const, + const struct UnitSystem* restrict us, + const struct cooling_data* restrict cooling, struct part* restrict p, + float dt) {} + +/** + * @brief Computes the cooling time-step. + * + * We return FLT_MAX so as to impose no limit on the time-step. + * + * @param cooling The #cooling_data used in the run. + * @param phys_const The physical constants in internal units. + * @param us The internal system of units. + * @param p Pointer to the particle data. + */ +__attribute__((always_inline)) INLINE static float cooling_timestep( + const struct cooling_data* restrict cooling, + const struct phys_const* restrict phys_const, + const struct UnitSystem* restrict us, const struct part* restrict p) { + + return FLT_MAX; +} + +/** + * @brief Initialises the cooling properties. + * + * Nothing to do here. + * + * @param parameter_file The parsed parameter file. + * @param us The current internal system of units. + * @param phys_const The physical constants in internal units. + * @param cooling The cooling properties to initialize + */ +static INLINE void cooling_init_backend( + const struct swift_params* parameter_file, const struct UnitSystem* us, + const struct phys_const* phys_const, struct cooling_data* cooling) {} + +/** + * @brief Prints the properties of the cooling model to stdout. + * + * @param cooling The properties of the cooling function. + */ +static INLINE void cooling_print_backend(const struct cooling_data* cooling) { + + message("Cooling function is 'No cooling'."); +} + +#endif /* SWIFT_COOLING_NONE_H */