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
9c3ace73
Commit
9c3ace73
authored
7 years ago
by
Josh Borrow
Browse files
Options
Downloads
Patches
Plain Diff
Changed to using custom sound speed
parent
4ad67114
No related branches found
No related tags found
1 merge request
!540
Add Pressure-Energy (P-U) SPH
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/hydro/PressureEnergy/hydro.h
+8
-22
8 additions, 22 deletions
src/hydro/PressureEnergy/hydro.h
src/hydro/PressureEnergy/hydro_part.h
+1
-4
1 addition, 4 deletions
src/hydro/PressureEnergy/hydro_part.h
with
9 additions
and
26 deletions
src/hydro/PressureEnergy/hydro.h
+
8
−
22
View file @
9c3ace73
...
...
@@ -151,7 +151,9 @@ __attribute__((always_inline)) INLINE static float hydro_get_physical_entropy(
__attribute__
((
always_inline
))
INLINE
static
float
hydro_get_comoving_soundspeed
(
const
struct
part
*
restrict
p
)
{
return
p
->
force
.
soundspeed
;
/* Compute the sound speed -- see theory section for justification */
/* IDEAL GAS ONLY -- P-U does not work with generic EoS. */
return
sqrtf
(
p
->
u
*
p
->
u
*
p
->
rho
/
p
->
pressure_bar
);
}
/**
...
...
@@ -440,11 +442,8 @@ __attribute__((always_inline)) INLINE static void hydro_prepare_force(
/* Compute the norm of div v */
const
float
abs_div_v
=
fabsf
(
p
->
density
.
div_v
);
/* Compute the pressure */
const
float
pressure
=
gas_pressure_from_internal_energy
(
p
->
rho
,
p
->
u
);
/* Compute the sound speed */
const
float
soundspeed
=
gas_soundspeed_from_pressure
(
p
->
rho
,
pressure
);
/* Compute the sound speed -- see theory section for justification */
const
float
soundspeed
=
hydro_get_comoving_soundspeed
(
p
);
/* Compute the Balsara switch */
const
float
balsara
=
...
...
@@ -459,7 +458,6 @@ __attribute__((always_inline)) INLINE static void hydro_prepare_force(
/* Update variables. */
p
->
force
.
f
=
grad_h_term
;
p
->
force
.
pressure
=
pressure
;
p
->
force
.
soundspeed
=
soundspeed
;
p
->
force
.
balsara
=
balsara
;
}
...
...
@@ -547,13 +545,9 @@ __attribute__((always_inline)) INLINE static void hydro_predict_extra(
/* Predict the internal energy */
p
->
u
+=
p
->
u_dt
*
dt_therm
;
/* Compute the new pressure */
const
float
pressure
=
gas_pressure_from_internal_energy
(
p
->
rho
,
p
->
u
);
/* Compute the new sound speed */
const
float
soundspeed
=
gas_soundspeed_from_pressure
(
p
->
rho
,
pressure
);
const
float
soundspeed
=
hydro_get_comoving_soundspeed
(
p
);
p
->
force
.
pressure
=
pressure
;
p
->
force
.
soundspeed
=
soundspeed
;
}
...
...
@@ -596,13 +590,9 @@ __attribute__((always_inline)) INLINE static void hydro_kick_extra(
}
xp
->
u_full
+=
p
->
u_dt
*
dt_therm
;
/* Compute the pressure */
const
float
pressure
=
gas_pressure_from_internal_energy
(
p
->
rho
,
xp
->
u_full
);
/* Compute the sound speed */
const
float
soundspeed
=
gas_soundspeed_from_internal_energy
(
p
->
rho
,
p
->
u
);
const
float
soundspeed
=
hydro_get_comoving_soundspeed
(
p
);
p
->
force
.
pressure
=
pressure
;
p
->
force
.
soundspeed
=
soundspeed
;
}
...
...
@@ -621,13 +611,9 @@ __attribute__((always_inline)) INLINE static void hydro_convert_quantities(
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
);
/* Compute the sound speed */
const
float
soundspeed
=
gas_soundspeed_from_internal_energy
(
p
->
rho
,
p
->
u
);
const
float
soundspeed
=
hydro_get_comoving_soundspeed
(
p
);
p
->
force
.
pressure
=
pressure
;
p
->
force
.
soundspeed
=
soundspeed
;
}
...
...
This diff is collapsed.
Click to expand it.
src/hydro/PressureEnergy/hydro_part.h
+
1
−
4
View file @
9c3ace73
...
...
@@ -145,12 +145,9 @@ struct part {
*/
struct
{
/*! "Grad h" term */
/*! "Grad h" term
-- only partial in P-U
*/
float
f
;
/*! Particle pressure. */
float
pressure
;
/*! Particle soundspeed. */
float
soundspeed
;
...
...
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