Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SWIFT
SWIFTsim
Commits
f94cf453
Commit
f94cf453
authored
Sep 07, 2016
by
Matthieu Schaller
Browse files
Added a 'none' cooling function that just contains the minimally required infrastructure.
parent
f769a31b
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/const.h
View file @
f94cf453
...
...
@@ -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 ? */
...
...
src/cooling.h
View file @
f94cf453
...
...
@@ -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"
...
...
src/cooling/const_du/cooling.h
View file @
f94cf453
...
...
@@ -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
);
}
...
...
src/cooling/none/cooling.h
0 → 100644
View file @
f94cf453
/*******************************************************************************
* 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 */
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment