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
a8008abe
Commit
a8008abe
authored
Aug 06, 2016
by
Matthieu Schaller
Browse files
Added setter functions to modify the internal thermal state of particles
parent
8e2b479e
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/const.h
View file @
a8008abe
...
...
@@ -42,8 +42,8 @@
//#define HYDRO_GAMMA_2_1
/* Equation of state choice */
#define IDEAL_GAS
//#define ISOTHERMAL_GAS
#define
EOS_
IDEAL_GAS
//#define
EOS_
ISOTHERMAL_GAS
/* Kernel function to use */
#define CUBIC_SPLINE_KERNEL
...
...
src/equation_of_state.h
View file @
a8008abe
...
...
@@ -32,7 +32,7 @@
#include
"inline.h"
/* ------------------------------------------------------------------------- */
#if defined(IDEAL_GAS)
#if defined(
EOS_
IDEAL_GAS)
/**
* @brief Returns the internal energy given density and entropy
...
...
@@ -120,7 +120,7 @@ gas_soundspeed_from_internal_energy(float density, float u) {
}
/* ------------------------------------------------------------------------- */
#elif defined(ISOTHERMAL_GAS)
#elif defined(
EOS_
ISOTHERMAL_GAS)
/**
* @brief Returns the internal energy given density and entropy
...
...
src/hydro/Default/hydro.h
View file @
a8008abe
...
...
@@ -71,6 +71,37 @@ __attribute__((always_inline)) INLINE static float hydro_get_soundspeed(
return
p
->
force
.
soundspeed
;
}
/**
* @brief Modifies the thermal state of a particle to the imposed internal
* energy
*
* This overrides the current state of the particle but does not change the
* time-derivatives
*
* @param p The particle
* @param u The new internal energy
*/
__attribute__
((
always_inline
))
INLINE
static
void
hydro_set_internal_energy
(
struct
part
*
restrict
p
,
float
u
)
{
p
->
u
=
u
;
}
/**
* @brief Modifies the thermal state of a particle to the imposed entropy
*
* This overrides the current state of the particle but does not change the
* time-derivatives
*
* @param p The particle
* @param S The new entropy
*/
__attribute__
((
always_inline
))
INLINE
static
void
hydro_set_entropy
(
struct
part
*
restrict
p
,
float
S
)
{
p
->
u
=
gas_internal_energy_from_entropy
(
p
->
rho
,
S
);
}
/**
* @brief Computes the hydro time-step of a given particle
*
...
...
src/hydro/Gadget2/hydro.h
View file @
a8008abe
...
...
@@ -72,6 +72,37 @@ __attribute__((always_inline)) INLINE static float hydro_get_soundspeed(
return
p
->
force
.
soundspeed
;
}
/**
* @brief Modifies the thermal state of a particle to the imposed internal
* energy
*
* This overrides the current state of the particle but does *not* change its
* time-derivatives
*
* @param p The particle
* @param u The new internal energy
*/
__attribute__
((
always_inline
))
INLINE
static
void
hydro_set_internal_energy
(
struct
part
*
restrict
p
,
float
u
)
{
p
->
entropy
=
gas_entropy_from_internal_energy
(
p
->
rho
,
u
);
}
/**
* @brief Modifies the thermal state of a particle to the imposed entropy
*
* This overrides the current state of the particle but does *not* change its
* time-derivatives
*
* @param p The particle
* @param S The new entropy
*/
__attribute__
((
always_inline
))
INLINE
static
void
hydro_set_entropy
(
struct
part
*
restrict
p
,
float
S
)
{
p
->
entropy
=
S
;
}
/**
* @brief Computes the hydro time-step of a given particle
*
...
...
src/hydro/Minimal/hydro.h
View file @
a8008abe
...
...
@@ -77,6 +77,37 @@ __attribute__((always_inline)) INLINE static float hydro_get_soundspeed(
return
gas_soundspeed_from_internal_energy
(
p
->
rho
,
p
->
u
);
}
/**
* @brief Modifies the thermal state of a particle to the imposed internal
* energy
*
* This overrides the current state of the particle but does *not* change its
* time-derivatives
*
* @param p The particle
* @param u The new internal energy
*/
__attribute__
((
always_inline
))
INLINE
static
void
hydro_set_internal_energy
(
struct
part
*
restrict
p
,
float
u
)
{
p
->
u
=
u
;
}
/**
* @brief Modifies the thermal state of a particle to the imposed entropy
*
* This overrides the current state of the particle but does *not* change its
* time-derivatives
*
* @param p The particle
* @param S The new entropy
*/
__attribute__
((
always_inline
))
INLINE
static
void
hydro_set_entropy
(
struct
part
*
restrict
p
,
float
S
)
{
p
->
u
=
gas_internal_energy_from_entropy
(
p
->
rho
,
S
);
}
/**
* @brief Computes the hydro time-step of a given particle
*
...
...
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