cooling.h 4.52 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
/*******************************************************************************
 * 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 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.
46
 * @param cosmo The current cosmological model.
47
 * @param cooling The #cooling_function_data used in the run.
48
 * @param p Pointer to the particle data.
49
 * @param xp Pointer to the extended particle data.
50 51 52 53
 * @param dt The time-step of this particle.
 */
__attribute__((always_inline)) INLINE static void cooling_cool_part(
    const struct phys_const* restrict phys_const,
54
    const struct unit_system* restrict us,
55
    const struct cosmology* restrict cosmo,
56
    const struct cooling_function_data* restrict cooling,
57
    struct part* restrict p, struct xpart* restrict xp, float dt) {}
58 59 60 61 62 63

/**
 * @brief Computes the cooling time-step.
 *
 * We return FLT_MAX so as to impose no limit on the time-step.
 *
64
 * @param cooling The #cooling_function_data used in the run.
65
 * @param phys_const The physical constants in internal units.
66
 * @param cosmo The current cosmological model.
67 68 69 70
 * @param us The internal system of units.
 * @param p Pointer to the particle data.
 */
__attribute__((always_inline)) INLINE static float cooling_timestep(
71
    const struct cooling_function_data* restrict cooling,
72
    const struct phys_const* restrict phys_const,
73
    const struct cosmology* restrict cosmo,
74
    const struct unit_system* restrict us, const struct part* restrict p) {
75 76 77 78

  return FLT_MAX;
}

79 80 81 82 83 84
/**
 * @brief Sets the cooling properties of the (x-)particles to a valid start
 * state.
 *
 * Nothing to do here.
 *
85 86 87 88
 * @param phys_const The physical constant in internal units.
 * @param us The unit system.
 * @param cosmo The current cosmological model.
 * @param data The properties of the cooling function.
89 90 91
 * @param p Pointer to the particle data.
 * @param xp Pointer to the extended particle data.
 */
92
__attribute__((always_inline)) INLINE static void cooling_first_init_part(
93 94 95
    const struct phys_const* restrict phys_const,
    const struct unit_system* restrict us,
    const struct cosmology* restrict cosmo,
Matthieu Schaller's avatar
Matthieu Schaller committed
96 97
    const struct cooling_function_data* data, const struct part* restrict p,
    struct xpart* restrict xp) {}
98

99 100 101 102 103 104 105 106 107 108 109 110 111
/**
 * @brief Returns the total radiated energy by this particle.
 *
 * No cooling, so return 0.
 *
 * @param xp The extended particle data
 */
__attribute__((always_inline)) INLINE static float cooling_get_radiated_energy(
    const struct xpart* restrict xp) {

  return 0.f;
}

112 113 114 115 116 117 118 119 120 121 122
/**
 * @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(
123
    const struct swift_params* parameter_file, const struct unit_system* us,
124 125
    const struct phys_const* phys_const,
    struct cooling_function_data* cooling) {}
126 127 128 129 130 131

/**
 * @brief Prints the properties of the cooling model to stdout.
 *
 * @param cooling The properties of the cooling function.
 */
132 133
static INLINE void cooling_print_backend(
    const struct cooling_function_data* cooling) {
134 135 136 137 138

  message("Cooling function is 'No cooling'.");
}

#endif /* SWIFT_COOLING_NONE_H */