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
f4cd515f
Commit
f4cd515f
authored
Sep 12, 2016
by
Matthieu Schaller
Browse files
Better notation for some Gadget2-SPH variables.
parent
b9229a0a
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/hydro/Gadget2/hydro.h
View file @
f4cd515f
...
...
@@ -231,18 +231,18 @@ __attribute__((always_inline)) INLINE static void hydro_end_density(
p
->
density
.
wcount
*=
kernel_norm
;
p
->
density
.
wcount_dh
*=
h_inv
*
kernel_gamma
*
kernel_norm
;
const
float
i
rho
=
1
.
f
/
p
->
rho
;
const
float
rho
_inv
=
1
.
f
/
p
->
rho
;
/* Compute the derivative term */
p
->
rho_dh
=
1
.
f
/
(
1
.
f
+
hydro_dimension_inv
*
p
->
h
*
p
->
rho_dh
*
i
rho
);
p
->
rho_dh
=
1
.
f
/
(
1
.
f
+
hydro_dimension_inv
*
p
->
h
*
p
->
rho_dh
*
rho
_inv
);
/* Finish calculation of the velocity curl components */
p
->
density
.
rot_v
[
0
]
*=
h_inv_dim_plus_one
*
i
rho
;
p
->
density
.
rot_v
[
1
]
*=
h_inv_dim_plus_one
*
i
rho
;
p
->
density
.
rot_v
[
2
]
*=
h_inv_dim_plus_one
*
i
rho
;
p
->
density
.
rot_v
[
0
]
*=
h_inv_dim_plus_one
*
rho
_inv
;
p
->
density
.
rot_v
[
1
]
*=
h_inv_dim_plus_one
*
rho
_inv
;
p
->
density
.
rot_v
[
2
]
*=
h_inv_dim_plus_one
*
rho
_inv
;
/* Finish calculation of the velocity divergence */
p
->
density
.
div_v
*=
h_inv_dim_plus_one
*
i
rho
;
p
->
density
.
div_v
*=
h_inv_dim_plus_one
*
rho
_inv
;
}
/**
...
...
@@ -273,13 +273,13 @@ __attribute__((always_inline)) INLINE static void hydro_prepare_force(
const
float
half_dt
=
(
ti_current
-
(
p
->
ti_begin
+
p
->
ti_end
)
/
2
)
*
timeBase
;
const
float
pressure
=
hydro_get_pressure
(
p
,
half_dt
);
const
float
i
rho
=
1
.
f
/
p
->
rho
;
const
float
rho
_inv
=
1
.
f
/
p
->
rho
;
/* Divide the pressure by the density and density gradient */
const
float
P_over_rho2
=
pressure
*
i
rho
*
i
rho
*
p
->
rho_dh
;
const
float
P_over_rho2
=
pressure
*
rho
_inv
*
rho
_inv
*
p
->
rho_dh
;
/* Compute the sound speed */
const
float
soundspeed
=
sqrtf
(
hydro_gamma
*
pressure
*
i
rho
);
const
float
soundspeed
=
sqrtf
(
hydro_gamma
*
pressure
*
rho
_inv
);
/* Compute the Balsara switch */
const
float
balsara
=
...
...
@@ -349,13 +349,13 @@ __attribute__((always_inline)) INLINE static void hydro_predict_extra(
const
float
dt_entr
=
(
t1
-
(
p
->
ti_begin
+
p
->
ti_end
)
/
2
)
*
timeBase
;
const
float
pressure
=
hydro_get_pressure
(
p
,
dt_entr
);
const
float
i
rho
=
1
.
f
/
p
->
rho
;
const
float
rho
_inv
=
1
.
f
/
p
->
rho
;
/* Divide the pressure by the density and density gradient */
const
float
P_over_rho2
=
pressure
*
i
rho
*
i
rho
*
p
->
rho_dh
;
const
float
P_over_rho2
=
pressure
*
rho
_inv
*
rho
_inv
*
p
->
rho_dh
;
/* Compute the new sound speed */
const
float
soundspeed
=
sqrtf
(
hydro_gamma
*
pressure
*
i
rho
);
const
float
soundspeed
=
sqrtf
(
hydro_gamma
*
pressure
*
rho
_inv
);
/* Update variables */
p
->
force
.
P_over_rho2
=
P_over_rho2
;
...
...
src/hydro/Gadget2/hydro_iact.h
View file @
f4cd515f
...
...
@@ -248,17 +248,17 @@ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_density(
const
float
ri
=
1
.
0
f
/
r
;
/* Compute the kernel function */
const
float
h_inv
=
1
.
0
f
/
hi
;
const
float
u
=
r
*
h_inv
;
kernel_deval
(
u
,
&
wi
,
&
wi_dx
);
const
float
h
i
_inv
=
1
.
0
f
/
hi
;
const
float
u
i
=
r
*
h
i
_inv
;
kernel_deval
(
u
i
,
&
wi
,
&
wi_dx
);
/* Compute contribution to the density */
pi
->
rho
+=
mj
*
wi
;
pi
->
rho_dh
-=
mj
*
(
hydro_dimension
*
wi
+
u
*
wi_dx
);
pi
->
rho_dh
-=
mj
*
(
hydro_dimension
*
wi
+
u
i
*
wi_dx
);
/* Compute contribution to the number of neighbours */
pi
->
density
.
wcount
+=
wi
;
pi
->
density
.
wcount_dh
-=
u
*
wi_dx
;
pi
->
density
.
wcount_dh
-=
u
i
*
wi_dx
;
const
float
fac
=
mj
*
wi_dx
*
ri
;
...
...
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