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
aab19f15
Commit
aab19f15
authored
Sep 16, 2016
by
Matthieu Schaller
Browse files
Applied Pedro's improvements
parent
e6632efb
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/cell.c
View file @
aab19f15
...
...
@@ -698,7 +698,7 @@ void cell_sanitize(struct cell *c) {
float
h_min
=
FLT_MAX
,
h_max
=
0
.
f
;
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
const
float
h
=
log
10
f
(
parts
[
i
].
h
);
const
float
h
=
logf
(
parts
[
i
].
h
);
h_mean
+=
h
;
h_mean2
+=
h
*
h
;
h_max
=
max
(
h_max
,
h
);
...
...
@@ -707,24 +707,28 @@ void cell_sanitize(struct cell *c) {
h_mean
/=
count
;
h_mean2
/=
count
;
const
float
h_var
=
h_mean2
-
h_mean
*
h_mean
;
const
float
h_std
=
sqrtf
(
h_var
)
;
const
float
h_std
=
(
h_var
>
0
.
f
)
?
sqrtf
(
h_var
)
:
0
.
1
f
*
h_mean
;
/* Choose a cut */
const
float
h_limit
=
pow
(
10
.
f
,
h_mean
+
4
.
f
*
h_std
);
const
float
h_limit
=
expf
(
h_mean
+
4
.
f
*
h_std
);
/* Be verbose this is not innocuous */
message
(
"Cell properties: h_min= %f h_max= %f geometric mean= %f"
,
powf
(
10
.
f
,
h_min
),
powf
(
10
.
f
,
h_max
),
powf
(
10
.
f
,
h_mean
));
message
(
"Cell properties: h_min= %f h_max= %f geometric mean= %f
.
"
,
expf
(
h_min
),
expf
(
h_max
),
expf
(
h_mean
));
if
(
c
->
h_max
>
h_limit
)
{
message
(
"Smoothing lengths will be limited to (mean + 4sigma)= %f"
,
message
(
"Smoothing lengths will be limited to (mean + 4sigma)= %f
.
"
,
h_limit
);
/* Apply the cut */
for
(
int
i
=
0
;
i
<
count
;
++
i
)
parts
->
h
=
min
(
parts
[
i
].
h
,
h_limit
);
c
->
h_max
=
h_limit
;
}
else
{
message
(
"Smoothing lengths will not be limited."
);
}
}
...
...
src/space.c
View file @
aab19f15
...
...
@@ -233,7 +233,7 @@ void space_regrid(struct space *s, double cell_max, int verbose) {
"followings:
\n
"
" - too few particles to generate a sensible grid,
\n
"
" - the initial value of 'SPH:max_smoothing_length' is too large,
\n
"
" - the (minimal) time-step is too large leading to particle with "
" - the (minimal) time-step is too large leading to particle
s
with "
"predicted smoothing lengths too large for the box size,
\n
"
" - particle with velocities so large that they move by more than two "
"box sizes per time-step.
\n
"
);
...
...
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