Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SWIFTsim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SWIFT
SWIFTsim
Commits
1fec6d18
Commit
1fec6d18
authored
6 years ago
by
Matthieu Schaller
Browse files
Options
Downloads
Patches
Plain Diff
Apply the entropy floor after the kick operation.
parent
839eaf56
No related branches found
No related tags found
2 merge requests
!720
Implement EAGLE-like entropy floor
,
!705
Star formation following Schaye08
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/hydro/Gadget2/hydro.h
+19
-4
19 additions, 4 deletions
src/hydro/Gadget2/hydro.h
src/kick.h
+8
-0
8 additions, 0 deletions
src/kick.h
src/runner.c
+5
-3
5 additions, 3 deletions
src/runner.c
with
32 additions
and
7 deletions
src/hydro/Gadget2/hydro.h
+
19
−
4
View file @
1fec6d18
...
...
@@ -306,10 +306,11 @@ hydro_get_physical_internal_energy_dt(const struct part *restrict p,
* We assume a constant density for the conversion to entropy.
*
* @param p The particle of interest.
* @param du_dt The new time derivative of the internal energy.
* @param du_dt The new time derivative of the
comoving
internal energy.
*/
__attribute__
((
always_inline
))
INLINE
static
void
hydro_set_comoving_internal_energy_dt
(
struct
part
*
restrict
p
,
float
du_dt
)
{
hydro_set_comoving_internal_energy_dt
(
struct
part
*
restrict
p
,
const
float
du_dt
)
{
p
->
entropy_dt
=
gas_entropy_from_internal_energy
(
p
->
rho
,
du_dt
);
}
...
...
@@ -321,15 +322,29 @@ hydro_set_comoving_internal_energy_dt(struct part *restrict p, float du_dt) {
*
* @param p The particle of interest.
* @param cosmo Cosmology data structure
* @param du_dt The time derivative of the internal energy.
* @param du_dt The time derivative of the
physical
internal energy.
*/
__attribute__
((
always_inline
))
INLINE
static
void
hydro_set_physical_internal_energy_dt
(
struct
part
*
restrict
p
,
const
struct
cosmology
*
restrict
cosmo
,
float
du_dt
)
{
const
float
du_dt
)
{
p
->
entropy_dt
=
gas_entropy_from_internal_energy
(
p
->
rho
*
cosmo
->
a3_inv
,
du_dt
);
}
/**
* @brief Sets the physical entropy of a particle
*
* @param p The particle of interest.
* @param cosmo Cosmology data structure
* @param s The physical entropy
*/
__attribute__
((
always_inline
))
INLINE
static
void
hydro_set_physical_entropy
(
struct
part
*
p
,
struct
xpart
*
xp
,
const
struct
cosmology
*
cosmo
,
const
float
entropy
)
{
/* Note there is no conversion from physical to comoving entropy */
xp
->
entropy_full
=
entropy
;
}
/**
* @brief Computes the hydro time-step of a given particle
...
...
This diff is collapsed.
Click to expand it.
src/kick.h
+
8
−
0
View file @
1fec6d18
...
...
@@ -79,6 +79,7 @@ __attribute__((always_inline)) INLINE static void kick_part(
struct
part
*
restrict
p
,
struct
xpart
*
restrict
xp
,
double
dt_kick_hydro
,
double
dt_kick_grav
,
double
dt_kick_therm
,
double
dt_kick_corr
,
const
struct
cosmology
*
cosmo
,
const
struct
hydro_props
*
hydro_props
,
const
struct
entropy_floor_properties
*
entropy_floor_props
,
integertime_t
ti_start
,
integertime_t
ti_end
)
{
#ifdef SWIFT_DEBUG_CHECKS
...
...
@@ -114,6 +115,13 @@ __attribute__((always_inline)) INLINE static void kick_part(
hydro_kick_extra
(
p
,
xp
,
dt_kick_therm
,
dt_kick_grav
,
dt_kick_hydro
,
dt_kick_corr
,
cosmo
,
hydro_props
);
if
(
p
->
gpart
!=
NULL
)
gravity_kick_extra
(
p
->
gpart
,
dt_kick_grav
);
/* Verify that the particle is not below the entropy floor */
const
float
floor
=
entropy_floor
(
p
,
cosmo
,
entropy_floor_props
);
if
(
hydro_get_physical_entropy
(
p
,
xp
,
cosmo
)
<
floor
)
{
hydro_set_physical_entropy
(
p
,
xp
,
cosmo
,
floor
);
hydro_set_physical_internal_energy_dt
(
p
,
cosmo
,
0
.
f
);
}
}
/**
...
...
This diff is collapsed.
Click to expand it.
src/runner.c
+
5
−
3
View file @
1fec6d18
...
...
@@ -1679,6 +1679,7 @@ void runner_do_kick1(struct runner *r, struct cell *c, int timer) {
const
struct
engine
*
e
=
r
->
e
;
const
struct
cosmology
*
cosmo
=
e
->
cosmology
;
const
struct
hydro_props
*
hydro_props
=
e
->
hydro_properties
;
const
struct
entropy_floor_properties
*
entropy_floor
=
e
->
entropy_floor
;
const
int
with_cosmology
=
(
e
->
policy
&
engine_policy_cosmology
);
struct
part
*
restrict
parts
=
c
->
hydro
.
parts
;
struct
xpart
*
restrict
xparts
=
c
->
hydro
.
xparts
;
...
...
@@ -1746,7 +1747,7 @@ void runner_do_kick1(struct runner *r, struct cell *c, int timer) {
/* do the kick */
kick_part
(
p
,
xp
,
dt_kick_hydro
,
dt_kick_grav
,
dt_kick_therm
,
dt_kick_corr
,
cosmo
,
hydro_props
,
ti_begin
,
dt_kick_corr
,
cosmo
,
hydro_props
,
entropy_floor
,
ti_begin
,
ti_begin
+
ti_step
/
2
);
/* Update the accelerations to be used in the drift for hydro */
...
...
@@ -1853,6 +1854,7 @@ void runner_do_kick2(struct runner *r, struct cell *c, int timer) {
const
struct
engine
*
e
=
r
->
e
;
const
struct
cosmology
*
cosmo
=
e
->
cosmology
;
const
struct
hydro_props
*
hydro_props
=
e
->
hydro_properties
;
const
struct
entropy_floor_properties
*
entropy_floor
=
e
->
entropy_floor
;
const
int
with_cosmology
=
(
e
->
policy
&
engine_policy_cosmology
);
const
int
count
=
c
->
hydro
.
count
;
const
int
gcount
=
c
->
grav
.
count
;
...
...
@@ -1916,8 +1918,8 @@ void runner_do_kick2(struct runner *r, struct cell *c, int timer) {
/* Finish the time-step with a second half-kick */
kick_part
(
p
,
xp
,
dt_kick_hydro
,
dt_kick_grav
,
dt_kick_therm
,
dt_kick_corr
,
cosmo
,
hydro_props
,
ti_begin
+
ti_step
/
2
,
ti_begin
+
ti_step
);
dt_kick_corr
,
cosmo
,
hydro_props
,
entropy_floor
,
ti_begin
+
ti_step
/
2
,
ti_begin
+
ti_step
);
#ifdef SWIFT_DEBUG_CHECKS
/* Check that kick and the drift are synchronized */
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment