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
53b97792
Commit
53b97792
authored
Mar 03, 2017
by
Bert Vandenbroucke
Browse files
Formatting of previous commit.
parent
7902e818
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/hydro/Gizmo/hydro.h
View file @
53b97792
...
...
@@ -23,8 +23,8 @@
#include
"approx_math.h"
#include
"equation_of_state.h"
#include
"hydro_gradients.h"
#include
"riemann.h"
#include
"minmax.h"
#include
"riemann.h"
/**
* @brief Computes the hydro time-step of a given particle
...
...
@@ -240,7 +240,8 @@ __attribute__((always_inline)) INLINE static void hydro_end_density(
p
->
primitives
.
v
[
2
]
=
momentum
[
2
]
/
m
;
#ifdef EOS_ISOTHERMAL_GAS
p
->
primitives
.
P
=
const_isothermal_soundspeed
*
const_isothermal_soundspeed
*
p
->
primitives
.
rho
;
p
->
primitives
.
P
=
const_isothermal_soundspeed
*
const_isothermal_soundspeed
*
p
->
primitives
.
rho
;
#else
float
energy
=
p
->
conserved
.
energy
;
...
...
@@ -623,7 +624,8 @@ __attribute__((always_inline)) INLINE static float hydro_get_soundspeed(
if
(
p
->
primitives
.
rho
>
0
.)
{
#ifdef EOS_ISOTHERMAL_GAS
return
sqrtf
(
const_isothermal_internal_energy
*
hydro_gamma
*
hydro_gamma_minus_one
);
return
sqrtf
(
const_isothermal_internal_energy
*
hydro_gamma
*
hydro_gamma_minus_one
);
#else
return
sqrtf
(
hydro_gamma
*
p
->
primitives
.
P
/
p
->
primitives
.
rho
);
#endif
...
...
src/hydro/Gizmo/hydro_gradients.h
View file @
53b97792
...
...
@@ -150,19 +150,25 @@ __attribute__((always_inline)) INLINE static void hydro_gradients_predict(
Wi
[
0
]
*
(
pi
->
primitives
.
gradients
.
v
[
0
][
0
]
+
pi
->
primitives
.
gradients
.
v
[
1
][
1
]
+
pi
->
primitives
.
gradients
.
v
[
2
][
2
]));
dWi
[
1
]
-=
0
.
5
*
mindt
*
(
Wi
[
1
]
*
pi
->
primitives
.
gradients
.
v
[
0
][
0
]
+
Wi
[
2
]
*
pi
->
primitives
.
gradients
.
v
[
0
][
1
]
+
Wi
[
3
]
*
pi
->
primitives
.
gradients
.
v
[
0
][
2
]
+
const_isothermal_soundspeed
*
const_isothermal_soundspeed
*
pi
->
primitives
.
gradients
.
rho
[
0
]
/
Wi
[
0
]);
dWi
[
2
]
-=
0
.
5
*
mindt
*
(
Wi
[
1
]
*
pi
->
primitives
.
gradients
.
v
[
1
][
0
]
+
Wi
[
2
]
*
pi
->
primitives
.
gradients
.
v
[
1
][
1
]
+
Wi
[
3
]
*
pi
->
primitives
.
gradients
.
v
[
1
][
2
]
+
const_isothermal_soundspeed
*
const_isothermal_soundspeed
*
pi
->
primitives
.
gradients
.
rho
[
1
]
/
Wi
[
0
]);
dWi
[
3
]
-=
0
.
5
*
mindt
*
(
Wi
[
1
]
*
pi
->
primitives
.
gradients
.
v
[
2
][
0
]
+
Wi
[
2
]
*
pi
->
primitives
.
gradients
.
v
[
2
][
1
]
+
Wi
[
3
]
*
pi
->
primitives
.
gradients
.
v
[
2
][
2
]
+
const_isothermal_soundspeed
*
const_isothermal_soundspeed
*
pi
->
primitives
.
gradients
.
rho
[
2
]
/
Wi
[
0
]);
/* we don't care about P in this case */
dWi
[
1
]
-=
0
.
5
*
mindt
*
(
Wi
[
1
]
*
pi
->
primitives
.
gradients
.
v
[
0
][
0
]
+
Wi
[
2
]
*
pi
->
primitives
.
gradients
.
v
[
0
][
1
]
+
Wi
[
3
]
*
pi
->
primitives
.
gradients
.
v
[
0
][
2
]
+
const_isothermal_soundspeed
*
const_isothermal_soundspeed
*
pi
->
primitives
.
gradients
.
rho
[
0
]
/
Wi
[
0
]);
dWi
[
2
]
-=
0
.
5
*
mindt
*
(
Wi
[
1
]
*
pi
->
primitives
.
gradients
.
v
[
1
][
0
]
+
Wi
[
2
]
*
pi
->
primitives
.
gradients
.
v
[
1
][
1
]
+
Wi
[
3
]
*
pi
->
primitives
.
gradients
.
v
[
1
][
2
]
+
const_isothermal_soundspeed
*
const_isothermal_soundspeed
*
pi
->
primitives
.
gradients
.
rho
[
1
]
/
Wi
[
0
]);
dWi
[
3
]
-=
0
.
5
*
mindt
*
(
Wi
[
1
]
*
pi
->
primitives
.
gradients
.
v
[
2
][
0
]
+
Wi
[
2
]
*
pi
->
primitives
.
gradients
.
v
[
2
][
1
]
+
Wi
[
3
]
*
pi
->
primitives
.
gradients
.
v
[
2
][
2
]
+
const_isothermal_soundspeed
*
const_isothermal_soundspeed
*
pi
->
primitives
.
gradients
.
rho
[
2
]
/
Wi
[
0
]);
/* we don't care about P in this case */
#else
dWi
[
0
]
-=
0
.
5
*
mindt
*
(
Wi
[
1
]
*
pi
->
primitives
.
gradients
.
rho
[
0
]
+
Wi
[
2
]
*
pi
->
primitives
.
gradients
.
rho
[
1
]
+
...
...
@@ -200,18 +206,24 @@ __attribute__((always_inline)) INLINE static void hydro_gradients_predict(
Wj
[
0
]
*
(
pj
->
primitives
.
gradients
.
v
[
0
][
0
]
+
pj
->
primitives
.
gradients
.
v
[
1
][
1
]
+
pj
->
primitives
.
gradients
.
v
[
2
][
2
]));
dWj
[
1
]
-=
0
.
5
*
mindt
*
(
Wj
[
1
]
*
pj
->
primitives
.
gradients
.
v
[
0
][
0
]
+
Wj
[
2
]
*
pj
->
primitives
.
gradients
.
v
[
0
][
1
]
+
Wj
[
3
]
*
pj
->
primitives
.
gradients
.
v
[
0
][
2
]
+
const_isothermal_soundspeed
*
const_isothermal_soundspeed
*
pj
->
primitives
.
gradients
.
rho
[
0
]
/
Wj
[
0
]);
dWj
[
2
]
-=
0
.
5
*
mindt
*
(
Wj
[
1
]
*
pj
->
primitives
.
gradients
.
v
[
1
][
0
]
+
Wj
[
2
]
*
pj
->
primitives
.
gradients
.
v
[
1
][
1
]
+
Wj
[
3
]
*
pj
->
primitives
.
gradients
.
v
[
1
][
2
]
+
const_isothermal_soundspeed
*
const_isothermal_soundspeed
*
pj
->
primitives
.
gradients
.
rho
[
1
]
/
Wj
[
0
]);
dWj
[
3
]
-=
0
.
5
*
mindt
*
(
Wj
[
1
]
*
pj
->
primitives
.
gradients
.
v
[
2
][
0
]
+
Wj
[
2
]
*
pj
->
primitives
.
gradients
.
v
[
2
][
1
]
+
Wj
[
3
]
*
pj
->
primitives
.
gradients
.
v
[
2
][
2
]
+
const_isothermal_soundspeed
*
const_isothermal_soundspeed
*
pj
->
primitives
.
gradients
.
rho
[
2
]
/
Wj
[
0
]);
dWj
[
1
]
-=
0
.
5
*
mindt
*
(
Wj
[
1
]
*
pj
->
primitives
.
gradients
.
v
[
0
][
0
]
+
Wj
[
2
]
*
pj
->
primitives
.
gradients
.
v
[
0
][
1
]
+
Wj
[
3
]
*
pj
->
primitives
.
gradients
.
v
[
0
][
2
]
+
const_isothermal_soundspeed
*
const_isothermal_soundspeed
*
pj
->
primitives
.
gradients
.
rho
[
0
]
/
Wj
[
0
]);
dWj
[
2
]
-=
0
.
5
*
mindt
*
(
Wj
[
1
]
*
pj
->
primitives
.
gradients
.
v
[
1
][
0
]
+
Wj
[
2
]
*
pj
->
primitives
.
gradients
.
v
[
1
][
1
]
+
Wj
[
3
]
*
pj
->
primitives
.
gradients
.
v
[
1
][
2
]
+
const_isothermal_soundspeed
*
const_isothermal_soundspeed
*
pj
->
primitives
.
gradients
.
rho
[
1
]
/
Wj
[
0
]);
dWj
[
3
]
-=
0
.
5
*
mindt
*
(
Wj
[
1
]
*
pj
->
primitives
.
gradients
.
v
[
2
][
0
]
+
Wj
[
2
]
*
pj
->
primitives
.
gradients
.
v
[
2
][
1
]
+
Wj
[
3
]
*
pj
->
primitives
.
gradients
.
v
[
2
][
2
]
+
const_isothermal_soundspeed
*
const_isothermal_soundspeed
*
pj
->
primitives
.
gradients
.
rho
[
2
]
/
Wj
[
0
]);
#else
dWj
[
0
]
-=
0
.
5
*
mindt
*
(
Wj
[
1
]
*
pj
->
primitives
.
gradients
.
rho
[
0
]
+
Wj
[
2
]
*
pj
->
primitives
.
gradients
.
rho
[
1
]
+
...
...
src/hydro/Gizmo/hydro_iact.h
View file @
53b97792
...
...
@@ -233,7 +233,7 @@ __attribute__((always_inline)) INLINE static void runner_iact_fluxes_common(
/* calculate the maximal signal velocity */
if
(
Wi
[
0
]
>
0
.
0
f
&&
Wj
[
0
]
>
0
.
0
f
)
{
#ifdef EOS_ISOTHERMAL_GAS
vmax
=
2
.
*
const_isothermal_soundspeed
;
vmax
=
2
.
*
const_isothermal_soundspeed
;
#else
vmax
=
sqrtf
(
hydro_gamma
*
Wi
[
4
]
/
Wi
[
0
])
+
sqrtf
(
hydro_gamma
*
Wj
[
4
]
/
Wj
[
0
]);
...
...
src/hydro/Gizmo/hydro_io.h
View file @
53b97792
...
...
@@ -70,7 +70,7 @@ void hydro_read_particles(struct part* parts, struct io_props* list,
* @return Internal energy of the particle
*/
float
convert_u
(
struct
engine
*
e
,
struct
part
*
p
)
{
if
(
p
->
primitives
.
rho
>
0
.){
if
(
p
->
primitives
.
rho
>
0
.)
{
#ifdef EOS_ISOTHERMAL_GAS
return
const_isothermal_internal_energy
;
#else
...
...
@@ -89,9 +89,9 @@ float convert_u(struct engine* e, struct part* p) {
* @return Entropic function of the particle
*/
float
convert_A
(
struct
engine
*
e
,
struct
part
*
p
)
{
if
(
p
->
primitives
.
rho
>
0
.){
return
p
->
primitives
.
P
/
pow_gamma
(
p
->
primitives
.
rho
);
}
else
{
if
(
p
->
primitives
.
rho
>
0
.)
{
return
p
->
primitives
.
P
/
pow_gamma
(
p
->
primitives
.
rho
);
}
else
{
return
0
.;
}
}
...
...
@@ -158,9 +158,8 @@ void hydro_write_particles(struct part* parts, struct io_props* list,
list
[
12
]
=
io_make_output_field_convert_part
(
"TotEnergy"
,
FLOAT
,
1
,
UNIT_CONV_ENERGY
,
parts
,
conserved
.
energy
,
convert_Etot
);
list
[
13
]
=
io_make_output_field
(
"GravAcceleration"
,
FLOAT
,
3
,
UNIT_CONV_ACCELERATION
,
parts
,
gravity
.
old_a
);
list
[
13
]
=
io_make_output_field
(
"GravAcceleration"
,
FLOAT
,
3
,
UNIT_CONV_ACCELERATION
,
parts
,
gravity
.
old_a
);
}
/**
...
...
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