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
4781b563
Commit
4781b563
authored
Jun 26, 2017
by
Matthieu Schaller
Browse files
Also modified the Minimal and Pressure-Entropy schemes.
parent
cf3d11cf
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/hydro/Minimal/hydro.h
View file @
4781b563
...
...
@@ -219,12 +219,34 @@ __attribute__((always_inline)) INLINE static void hydro_end_density(
p
->
rho
+=
p
->
mass
*
kernel_root
;
p
->
density
.
rho_dh
-=
hydro_dimension
*
p
->
mass
*
kernel_root
;
p
->
density
.
wcount
+=
kernel_root
;
p
->
density
.
wcount_dh
-=
hydro_dimension
*
kernel_root
;
/* Finish the calculation by inserting the missing h-factors */
p
->
rho
*=
h_inv_dim
;
p
->
density
.
rho_dh
*=
h_inv_dim_plus_one
;
p
->
density
.
wcount
*=
kernel_norm
;
p
->
density
.
wcount_dh
*=
h_inv
*
kernel_gamma
*
kernel_norm
;
p
->
density
.
wcount_dh
*=
h_inv_dim_plus_one
;
}
/**
* @brief Sets all particle fields to sensible values when the #part has 0 ngbs.
*
* @param p The particle to act upon
* @param xp The extended particle data to act upon
*/
__attribute__
((
always_inline
))
INLINE
static
void
hydro_part_has_no_neighbours
(
struct
part
*
restrict
p
,
struct
xpart
*
restrict
xp
)
{
/* Some smoothing length multiples. */
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 */
/* Re-set problematic values */
p
->
rho
=
p
->
mass
*
kernel_root
*
h_inv_dim
;
p
->
density
.
wcount
=
kernel_root
*
kernel_norm
*
h_inv_dim
;
p
->
density
.
rho_dh
=
0
.
f
;
p
->
density
.
wcount_dh
=
0
.
f
;
}
/**
...
...
src/hydro/Minimal/hydro_iact.h
View file @
4781b563
...
...
@@ -51,23 +51,23 @@ __attribute__((always_inline)) INLINE static void runner_iact_density(
/* Compute density of pi. */
const
float
hi_inv
=
1
.
f
/
hi
;
const
float
x
i
=
r
*
hi_inv
;
kernel_deval
(
x
i
,
&
wi
,
&
wi_dx
);
const
float
u
i
=
r
*
hi_inv
;
kernel_deval
(
u
i
,
&
wi
,
&
wi_dx
);
pi
->
rho
+=
mj
*
wi
;
pi
->
density
.
rho_dh
-=
mj
*
(
hydro_dimension
*
wi
+
x
i
*
wi_dx
);
pi
->
density
.
rho_dh
-=
mj
*
(
hydro_dimension
*
wi
+
u
i
*
wi_dx
);
pi
->
density
.
wcount
+=
wi
;
pi
->
density
.
wcount_dh
-=
x
i
*
wi_dx
;
pi
->
density
.
wcount_dh
-=
(
hydro_dimension
*
wi
+
u
i
*
wi_dx
)
;
/* Compute density of pj. */
const
float
hj_inv
=
1
.
f
/
hj
;
const
float
x
j
=
r
*
hj_inv
;
kernel_deval
(
x
j
,
&
wj
,
&
wj_dx
);
const
float
u
j
=
r
*
hj_inv
;
kernel_deval
(
u
j
,
&
wj
,
&
wj_dx
);
pj
->
rho
+=
mi
*
wj
;
pj
->
density
.
rho_dh
-=
mi
*
(
hydro_dimension
*
wj
+
x
j
*
wj_dx
);
pj
->
density
.
rho_dh
-=
mi
*
(
hydro_dimension
*
wj
+
u
j
*
wj_dx
);
pj
->
density
.
wcount
+=
wj
;
pj
->
density
.
wcount_dh
-=
x
j
*
wj_dx
;
pj
->
density
.
wcount_dh
-=
(
hydro_dimension
*
wj
+
u
j
*
wj_dx
)
;
}
/**
...
...
@@ -96,13 +96,13 @@ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_density(
const
float
r
=
sqrtf
(
r2
);
const
float
h_inv
=
1
.
f
/
hi
;
const
float
x
i
=
r
*
h_inv
;
kernel_deval
(
x
i
,
&
wi
,
&
wi_dx
);
const
float
u
i
=
r
*
h_inv
;
kernel_deval
(
u
i
,
&
wi
,
&
wi_dx
);
pi
->
rho
+=
mj
*
wi
;
pi
->
density
.
rho_dh
-=
mj
*
(
hydro_dimension
*
wi
+
x
i
*
wi_dx
);
pi
->
density
.
rho_dh
-=
mj
*
(
hydro_dimension
*
wi
+
u
i
*
wi_dx
);
pi
->
density
.
wcount
+=
wi
;
pi
->
density
.
wcount_dh
-=
x
i
*
wi_dx
;
pi
->
density
.
wcount_dh
-=
(
hydro_dimension
*
wi
+
u
i
*
wi_dx
)
;
}
/**
...
...
src/hydro/PressureEntropy/hydro.h
View file @
4781b563
...
...
@@ -236,6 +236,34 @@ __attribute__((always_inline)) INLINE static void hydro_end_density(
p
->
density
.
div_v
*=
h_inv_dim_plus_one
*
rho_inv
;
}
/**
* @brief Sets all particle fields to sensible values when the #part has 0 ngbs.
*
* @param p The particle to act upon
* @param xp The extended particle data to act upon
*/
__attribute__
((
always_inline
))
INLINE
static
void
hydro_part_has_no_neighbours
(
struct
part
*
restrict
p
,
struct
xpart
*
restrict
xp
)
{
/* Some smoothing length multiples. */
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 */
/* Re-set problematic values */
p
->
rho
=
p
->
mass
*
kernel_root
*
h_inv_dim
;
p
->
rho_bar
=
p
->
mass
*
kernel_root
*
h_inv_dim
;
p
->
density
.
wcount
=
kernel_root
*
kernel_norm
*
h_inv_dim
;
p
->
density
.
rho_dh
=
0
.
f
;
p
->
density
.
wcount_dh
=
0
.
f
;
p
->
density
.
pressure_dh
=
0
.
f
;
p
->
density
.
div_v
=
0
.
f
;
p
->
density
.
rot_v
[
0
]
=
0
.
f
;
p
->
density
.
rot_v
[
1
]
=
0
.
f
;
p
->
density
.
rot_v
[
2
]
=
0
.
f
;
}
/**
* @brief Prepare a particle for the force calculation.
*
...
...
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