Commit 7f822cf4 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Renamed 'cooling_data' to 'cooling_function_data' everywhere.

parent f94cf453
......@@ -439,9 +439,9 @@ int main(int argc, char *argv[]) {
if (with_external_gravity && myrank == 0) potential_print(&potential);
/* Initialise the cooling function properties */
struct cooling_data cooling;
if (with_cooling) cooling_init(params, &us, &prog_const, &cooling);
if (with_cooling && myrank == 0) cooling_print(&cooling);
struct cooling_function_data cooling_func;
if (with_cooling) cooling_init(params, &us, &prog_const, &cooling_func);
if (with_cooling && myrank == 0) cooling_print(&cooling_func);
/* Construct the engine policy */
int engine_policies = ENGINE_POLICY | engine_policy_steal;
......@@ -457,7 +457,7 @@ int main(int argc, char *argv[]) {
struct engine e;
engine_init(&e, &s, params, nr_nodes, myrank, nr_threads, with_aff,
engine_policies, talking, &us, &prog_const, &hydro_properties,
&potential, &cooling);
&potential, &cooling_func);
if (myrank == 0) {
clocks_gettime(&toc);
message("engine_init took %.3f %s.", clocks_diff(&tic, &toc),
......
......@@ -36,7 +36,7 @@
void cooling_init(const struct swift_params* parameter_file,
const struct UnitSystem* us,
const struct phys_const* phys_const,
struct cooling_data* cooling) {
struct cooling_function_data* cooling) {
cooling_init_backend(parameter_file, us, phys_const, cooling);
}
......@@ -48,7 +48,7 @@ void cooling_init(const struct swift_params* parameter_file,
*
* @param cooling The properties of the cooling function.
*/
void cooling_print(const struct cooling_data* cooling) {
void cooling_print(const struct cooling_function_data* cooling) {
cooling_print_backend(cooling);
}
......@@ -47,8 +47,8 @@
void cooling_init(const struct swift_params* parameter_file,
const struct UnitSystem* us,
const struct phys_const* phys_const,
struct cooling_data* cooling);
struct cooling_function_data* cooling);
void cooling_print(const struct cooling_data* cooling);
void cooling_print(const struct cooling_function_data* cooling);
#endif /* SWIFT_COOLING_H */
......@@ -45,7 +45,7 @@
/**
* @brief Properties of the cooling function.
*/
struct cooling_data {
struct cooling_function_data {
/*! Cooling rate in internal units. du_dt = -cooling_rate */
float cooling_rate;
......@@ -65,15 +65,15 @@ struct cooling_data {
*
* @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 cooling The #cooling_function_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) {
const struct cooling_function_data* restrict cooling,
struct part* restrict p, float dt) {
/* Get current internal energy (dt=0) */
const float u_old = hydro_get_internal_energy(p, 0.f);
......@@ -101,13 +101,13 @@ __attribute__((always_inline)) INLINE static void cooling_cool_part(
* This is used to compute the time-step of the particle. Cooling functions
* that are solved implicitly can simply return FLT_MAX here.
*
* @param cooling The #cooling_data used in the run.
* @param cooling The #cooling_function_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 cooling_function_data* restrict cooling,
const struct phys_const* restrict phys_const,
const struct UnitSystem* restrict us, const struct part* restrict p) {
......@@ -126,7 +126,8 @@ __attribute__((always_inline)) INLINE static float cooling_timestep(
*/
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) {
const struct phys_const* phys_const,
struct cooling_function_data* cooling) {
cooling->cooling_rate =
parser_get_param_double(parameter_file, "ConstCooling:cooling_rate");
......@@ -141,7 +142,8 @@ static INLINE void cooling_init_backend(
*
* @param cooling The properties of the cooling function.
*/
static INLINE void cooling_print_backend(const struct cooling_data* cooling) {
static INLINE void cooling_print_backend(
const struct cooling_function_data* cooling) {
message("Cooling function is 'Constant cooling' with rate %f and floor %f.",
cooling->cooling_rate, cooling->min_energy);
......
......@@ -36,7 +36,7 @@
#include "units.h"
/* Cooling Properties */
struct cooling_data {
struct cooling_function_data {
/*! Cooling rate in cgs units. Defined by 'rho * du/dt = -lambda * n_H^2'*/
float lambda;
......@@ -63,12 +63,12 @@ struct cooling_data {
*
* @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 cooling The #cooling_function_data used in the run.
* @param p Pointer to the particle data..
*/
__attribute__((always_inline)) INLINE static float cooling_rate(
const struct phys_const* const phys_const, const struct UnitSystem* us,
const struct cooling_data* cooling, const struct part* p) {
const struct cooling_function_data* cooling, const struct part* p) {
/* Get particle properties */
/* Density */
......@@ -101,15 +101,15 @@ __attribute__((always_inline)) INLINE static float cooling_rate(
*
* @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 cooling The #cooling_function_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) {
const struct cooling_function_data* restrict cooling,
struct part* restrict p, float dt) {
/* Get current internal energy (dt=0) */
const float u_old = hydro_get_internal_energy(p, 0.f);
......@@ -142,13 +142,13 @@ __attribute__((always_inline)) INLINE static void cooling_cool_part(
/**
* @brief Computes the time-step due to cooling
*
* @param cooling The #cooling_data used in the run.
* @param cooling The #cooling_function_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 cooling_function_data* restrict cooling,
const struct phys_const* restrict phys_const,
const struct UnitSystem* restrict us, const struct part* restrict p) {
......@@ -171,7 +171,8 @@ __attribute__((always_inline)) INLINE static float cooling_timestep(
*/
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) {
const struct phys_const* phys_const,
struct cooling_function_data* cooling) {
cooling->lambda =
parser_get_param_double(parameter_file, "LambdaCooling:lambda");
......@@ -201,7 +202,8 @@ static INLINE void cooling_init_backend(
*
* @param cooling The properties of the cooling function.
*/
static INLINE void cooling_print_backend(const struct cooling_data* cooling) {
static INLINE void cooling_print_backend(
const struct cooling_function_data* cooling) {
message(
"Cooling function is 'Constant lambda' with "
......
......@@ -39,7 +39,7 @@
/**
* @brief Properties of the cooling function.
*/
struct cooling_data {};
struct cooling_function_data {};
/**
* @brief Apply the cooling function to a particle.
......@@ -48,28 +48,28 @@ struct cooling_data {};
*
* @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 cooling The #cooling_function_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) {}
const struct cooling_function_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 cooling The #cooling_function_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 cooling_function_data* restrict cooling,
const struct phys_const* restrict phys_const,
const struct UnitSystem* restrict us, const struct part* restrict p) {
......@@ -88,14 +88,16 @@ __attribute__((always_inline)) INLINE static float cooling_timestep(
*/
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) {}
const struct phys_const* phys_const,
struct cooling_function_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) {
static INLINE void cooling_print_backend(
const struct cooling_function_data* cooling) {
message("Cooling function is 'No cooling'.");
}
......
......@@ -3146,7 +3146,7 @@ void engine_unpin() {
* @param physical_constants The #phys_const used for this run.
* @param hydro The #hydro_props used for this run.
* @param potential The properties of the external potential.
* @param cooling The properties of the cooling function.
* @param cooling_func The properties of the cooling function.
*/
void engine_init(struct engine *e, struct space *s,
const struct swift_params *params, int nr_nodes, int nodeID,
......@@ -3155,7 +3155,7 @@ void engine_init(struct engine *e, struct space *s,
const struct phys_const *physical_constants,
const struct hydro_props *hydro,
const struct external_potential *potential,
const struct cooling_data *cooling) {
const struct cooling_function_data *cooling_func) {
/* Clean-up everything */
bzero(e, sizeof(struct engine));
......@@ -3207,7 +3207,7 @@ void engine_init(struct engine *e, struct space *s,
e->physical_constants = physical_constants;
e->hydro_properties = hydro;
e->external_potential = potential;
e->cooling_data = cooling;
e->cooling_func = cooling_func;
e->parameter_file = params;
engine_rank = nodeID;
......
......@@ -205,7 +205,7 @@ struct engine {
const struct external_potential *external_potential;
/* Properties of the cooling scheme */
const struct cooling_data *cooling_data;
const struct cooling_function_data *cooling_func;
/* The (parsed) parameter file */
const struct swift_params *parameter_file;
......@@ -223,7 +223,7 @@ void engine_init(struct engine *e, struct space *s,
const struct phys_const *physical_constants,
const struct hydro_props *hydro,
const struct external_potential *potential,
const struct cooling_data *cooling);
const struct cooling_function_data *cooling);
void engine_launch(struct engine *e, int nr_runners, unsigned int mask,
unsigned int submask);
void engine_prepare(struct engine *e, int nodrift);
......
......@@ -172,7 +172,7 @@ void runner_do_cooling(struct runner *r, struct cell *c, int timer) {
struct part *restrict parts = c->parts;
const int count = c->count;
const int ti_current = r->e->ti_current;
const struct cooling_data *cooling = r->e->cooling_data;
const struct cooling_function_data *cooling_func = r->e->cooling_func;
const struct phys_const *constants = r->e->physical_constants;
const struct UnitSystem *us = r->e->internalUnits;
const double timeBase = r->e->timeBase;
......@@ -201,7 +201,7 @@ void runner_do_cooling(struct runner *r, struct cell *c, int timer) {
const double dt = (p->ti_end - p->ti_begin) * timeBase;
cooling_cool_part(constants, us, cooling, p, dt);
cooling_cool_part(constants, us, cooling_func, p, dt);
}
}
......
......@@ -104,7 +104,7 @@ __attribute__((always_inline)) INLINE static int get_part_timestep(
/* Compute the next timestep (cooling condition) */
float new_dt_cooling = FLT_MAX;
if (e->policy & engine_policy_cooling)
new_dt_cooling = cooling_timestep(e->cooling_data, e->physical_constants,
new_dt_cooling = cooling_timestep(e->cooling_func, e->physical_constants,
e->internalUnits, p);
/* Compute the next timestep (gravity condition) */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment