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
70e8162c
Commit
70e8162c
authored
7 years ago
by
Josh Borrow
Browse files
Options
Downloads
Patches
Plain Diff
Added new functions required by code; hydro_set_mass, and hydro_set_init_internal_energy
parent
0fa621b1
No related branches found
No related tags found
1 merge request
!540
Add Pressure-Energy (P-U) SPH
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/hydro/PressureEnergy/hydro.h
+36
-3
36 additions, 3 deletions
src/hydro/PressureEnergy/hydro.h
with
36 additions
and
3 deletions
src/hydro/PressureEnergy/hydro.h
+
36
−
3
View file @
70e8162c
...
...
@@ -198,6 +198,18 @@ __attribute__((always_inline)) INLINE static float hydro_get_mass(
return
p
->
mass
;
}
/**
* @brief Sets the mass of a particle
*
* @param p The particle of interest
* @param m The mass to set.
*/
__attribute__
((
always_inline
))
INLINE
static
void
hydro_set_mass
(
struct
part
*
restrict
p
,
float
m
)
{
p
->
mass
=
m
;
}
/**
* @brief Returns the velocities drifted to the current time of a particle.
*
...
...
@@ -233,7 +245,7 @@ __attribute__((always_inline)) INLINE static float hydro_get_internal_energy_dt(
}
/**
* @brief
R
et
urn
s the time derivative of internal energy of a particle
* @brief
S
ets the time derivative of internal energy of a particle
*
* We assume a constant density.
*
...
...
@@ -245,6 +257,7 @@ __attribute__((always_inline)) INLINE static void hydro_set_internal_energy_dt(
p
->
u_dt
=
du_dt
;
}
/**
* @brief Computes the hydro time-step of a given particle
*
...
...
@@ -525,7 +538,9 @@ __attribute__((always_inline)) INLINE static void hydro_end_force(
* @param dt_therm The time-step for this kick (for thermodynamic quantities).
*/
__attribute__
((
always_inline
))
INLINE
static
void
hydro_kick_extra
(
struct
part
*
restrict
p
,
struct
xpart
*
restrict
xp
,
float
dt_therm
)
{
struct
part
*
restrict
p
,
struct
xpart
*
restrict
xp
,
float
dt_therm
,
const
struct
cosmology
*
cosmo
,
const
struct
hydro_props
*
restrict
hydro_properties
)
{
/* Do not decrease the energy by more than a factor of 2*/
if
(
dt_therm
>
0
.
&&
p
->
u_dt
*
dt_therm
<
-
0
.
5
f
*
xp
->
u_full
)
{
...
...
@@ -555,7 +570,8 @@ __attribute__((always_inline)) INLINE static void hydro_kick_extra(
* @param xp The extended particle to act upon
*/
__attribute__
((
always_inline
))
INLINE
static
void
hydro_convert_quantities
(
struct
part
*
restrict
p
,
struct
xpart
*
restrict
xp
)
{
struct
part
*
restrict
p
,
struct
xpart
*
restrict
xp
,
const
struct
cosmology
*
cosmo
)
{
/* Compute the pressure */
const
float
pressure
=
gas_pressure_from_internal_energy
(
p
->
rho
,
p
->
u
);
...
...
@@ -593,4 +609,21 @@ __attribute__((always_inline)) INLINE static void hydro_first_init_part(
hydro_init_part
(
p
,
NULL
);
}
/**
* @brief Overwrite the initial internal energy of a particle.
*
* Note that in the cases where the thermodynamic variable is not
* internal energy but gets converted later, we must overwrite that
* field. The conversion to the actual variable happens later after
* the initial fake time-step.
*
* @param p The #part to write to.
* @param u_init The new initial internal energy.
*/
__attribute__
((
always_inline
))
INLINE
static
void
hydro_set_init_internal_energy
(
struct
part
*
p
,
float
u_init
)
{
p
->
u
=
u_init
;
}
#endif
/* SWIFT_MINIMAL_HYDRO_H */
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