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

Added a 'none' cooling function that just contains the minimally required infrastructure.

parent f769a31b
Branches
Tags
1 merge request!247Radiated energy
......@@ -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 ? */
......
......@@ -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"
......
......@@ -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);
}
......
/*******************************************************************************
* 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 */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment