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
ef07487e
Commit
ef07487e
authored
8 months ago
by
boson112358
Browse files
Options
Downloads
Patches
Plain Diff
add entropy floor in kick and drift extra
parent
b4243314
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/hydro/REMIX/hydro.h
+29
-23
29 additions, 23 deletions
src/hydro/REMIX/hydro.h
with
29 additions
and
23 deletions
src/hydro/REMIX/hydro.h
+
29
−
23
View file @
ef07487e
...
@@ -796,12 +796,6 @@ __attribute__((always_inline)) INLINE static void hydro_predict_extra(
...
@@ -796,12 +796,6 @@ __attribute__((always_inline)) INLINE static void hydro_predict_extra(
const
float
floor_rho
=
p
->
mass
*
kernel_root
*
h_inv_dim
;
const
float
floor_rho
=
p
->
mass
*
kernel_root
*
h_inv_dim
;
p
->
rho_evol
=
max
(
p
->
rho_evol
,
floor_rho
);
p
->
rho_evol
=
max
(
p
->
rho_evol
,
floor_rho
);
/* Check against absolute minimum */
const
float
min_u
=
hydro_props
->
minimal_internal_energy
/
cosmo
->
a_factor_internal_energy
;
p
->
u
=
max
(
p
->
u
,
min_u
);
/* Predict smoothing length */
/* Predict smoothing length */
const
float
w1
=
p
->
force
.
h_dt
*
h_inv
*
dt_drift
;
const
float
w1
=
p
->
force
.
h_dt
*
h_inv
*
dt_drift
;
if
(
fabsf
(
w1
)
<
0
.
2
f
)
if
(
fabsf
(
w1
)
<
0
.
2
f
)
...
@@ -818,8 +812,17 @@ __attribute__((always_inline)) INLINE static void hydro_predict_extra(
...
@@ -818,8 +812,17 @@ __attribute__((always_inline)) INLINE static void hydro_predict_extra(
p
->
rho
=
p
->
rho_evol
;
p
->
rho
=
p
->
rho_evol
;
const
float
floor_u
=
FLT_MIN
;
/* Check against entropy floor - explicitly do this after drifting the
* density as this has a density dependence. */
const
float
floor_A
=
entropy_floor
(
p
,
cosmo
,
floor_props
);
const
float
floor_u
=
gas_internal_energy_from_entropy
(
p
->
rho
,
floor_A
);
/* Check against absolute minimum */
const
float
min_u
=
hydro_props
->
minimal_internal_energy
/
cosmo
->
a_factor_internal_energy
;
p
->
u
=
max
(
p
->
u
,
floor_u
);
p
->
u
=
max
(
p
->
u
,
floor_u
);
p
->
u
=
max
(
p
->
u
,
min_u
);
/* Compute the new pressure */
/* Compute the new pressure */
const
float
pressure
=
const
float
pressure
=
...
@@ -876,16 +879,34 @@ __attribute__((always_inline)) INLINE static void hydro_kick_extra(
...
@@ -876,16 +879,34 @@ __attribute__((always_inline)) INLINE static void hydro_kick_extra(
const
struct
cosmology
*
cosmo
,
const
struct
hydro_props
*
hydro_props
,
const
struct
cosmology
*
cosmo
,
const
struct
hydro_props
*
hydro_props
,
const
struct
entropy_floor_properties
*
floor_props
)
{
const
struct
entropy_floor_properties
*
floor_props
)
{
const
float
delta_rho
=
p
->
drho_dt
*
dt_therm
;
xp
->
rho_evol_full
=
max
(
xp
->
rho_evol_full
+
delta_rho
,
0
.
5
f
*
xp
->
rho_evol_full
);
/* Minimum SPH quantities */
const
float
h
=
p
->
h
;
const
float
h_inv
=
1
.
0
f
/
h
;
/* 1/h */
const
float
h_inv_dim
=
pow_dimension
(
h_inv
);
/* 1/h^d */
const
float
floor_rho
=
p
->
mass
*
kernel_root
*
h_inv_dim
;
if
(
xp
->
rho_evol_full
<
floor_rho
)
{
xp
->
rho_evol_full
=
floor_rho
;
p
->
drho_dt
=
0
.
f
;
}
/* Integrate the internal energy forward in time */
/* Integrate the internal energy forward in time */
const
float
delta_u
=
p
->
u_dt
*
dt_therm
;
const
float
delta_u
=
p
->
u_dt
*
dt_therm
;
/* Do not decrease the energy by more than a factor of 2*/
/* Do not decrease the energy by more than a factor of 2*/
xp
->
u_full
=
max
(
xp
->
u_full
+
delta_u
,
0
.
5
f
*
xp
->
u_full
);
xp
->
u_full
=
max
(
xp
->
u_full
+
delta_u
,
0
.
5
f
*
xp
->
u_full
);
/* Check against entropy floor */
const
float
floor_A
=
entropy_floor
(
p
,
cosmo
,
floor_props
);
const
float
floor_u
=
gas_internal_energy_from_entropy
(
p
->
rho
,
floor_A
);
/* Check against absolute minimum */
/* Check against absolute minimum */
const
float
min_u
=
const
float
min_u
=
hydro_props
->
minimal_internal_energy
/
cosmo
->
a_factor_internal_energy
;
hydro_props
->
minimal_internal_energy
/
cosmo
->
a_factor_internal_energy
;
const
float
floor_u
=
FLT_MIN
;
/* Take highest of both limits */
/* Take highest of both limits */
const
float
energy_min
=
max
(
min_u
,
floor_u
);
const
float
energy_min
=
max
(
min_u
,
floor_u
);
...
@@ -894,21 +915,6 @@ __attribute__((always_inline)) INLINE static void hydro_kick_extra(
...
@@ -894,21 +915,6 @@ __attribute__((always_inline)) INLINE static void hydro_kick_extra(
xp
->
u_full
=
energy_min
;
xp
->
u_full
=
energy_min
;
p
->
u_dt
=
0
.
f
;
p
->
u_dt
=
0
.
f
;
}
}
const
float
delta_rho
=
p
->
drho_dt
*
dt_therm
;
xp
->
rho_evol_full
=
max
(
xp
->
rho_evol_full
+
delta_rho
,
0
.
5
f
*
xp
->
rho_evol_full
);
/* Minimum SPH quantities */
const
float
h
=
p
->
h
;
const
float
h_inv
=
1
.
0
f
/
h
;
/* 1/h */
const
float
h_inv_dim
=
pow_dimension
(
h_inv
);
/* 1/h^d */
const
float
floor_rho
=
p
->
mass
*
kernel_root
*
h_inv_dim
;
if
(
xp
->
rho_evol_full
<
floor_rho
)
{
xp
->
rho_evol_full
=
floor_rho
;
p
->
drho_dt
=
0
.
f
;
}
}
}
/**
/**
...
...
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