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
87d7aa95
Commit
87d7aa95
authored
May 22, 2016
by
Matthieu Schaller
Browse files
Time between statistics output is to be specified in the parameter file
parent
7ff5c094
Changes
4
Hide whitespace changes
Inline
Side-by-side
examples/SedovBlast/sedov.yml
View file @
87d7aa95
...
...
@@ -32,6 +32,9 @@ Snapshots:
UnitCurrent_in_cgs
:
1
# Amperes
UnitTemp_in_cgs
:
1
# Kelvin
Statistics
:
delta_time
:
1e-3
# Parameters for the hydrodynamics scheme
SPH
:
resolution_eta
:
1.2348
# Target smoothing length in units of the mean inter-particle separation (1.2348 == 48Ngbs with the cubic spline kernel).
...
...
examples/SodShock/sodShock.yml
View file @
87d7aa95
...
...
@@ -32,6 +32,9 @@ Snapshots:
UnitCurrent_in_cgs
:
1
# Amperes
UnitTemp_in_cgs
:
1
# Kelvin
Statistics
:
delta_time
:
1e-2
# Time between statistics output
# Parameters for the hydrodynamics scheme
SPH
:
resolution_eta
:
1.2348
# Target smoothing length in units of the mean inter-particle separation (1.2348 == 48Ngbs with the cubic spline kernel).
...
...
src/engine.c
View file @
87d7aa95
...
...
@@ -1919,7 +1919,7 @@ void engine_collect_drift(struct cell *c) {
engine_collect_drift
(
cp
);
/* And update */
mass
+=
cp
->
mass
;
mass
+=
cp
->
mass
;
e_kin
+=
cp
->
e_kin
;
e_int
+=
cp
->
e_int
;
e_pot
+=
cp
->
e_pot
;
...
...
@@ -2008,11 +2008,14 @@ void engine_print_stats(struct engine *e) {
const
double
e_tot
=
e_kin
+
e_int
+
e_pot
;
/* Print info */
fprintf
(
e
->
file_stats
,
" %6d %14e %14e %14e %14e %14e %14e %14e %14e %14e %14e %14e %14e
\n
"
,
e
->
step
,
e
->
time
,
mass
,
e_tot
,
e_kin
,
e_int
,
e_pot
,
mom
[
0
],
mom
[
1
],
mom
[
2
],
ang_mom
[
0
],
ang_mom
[
1
],
ang_mom
[
2
]);
fflush
(
e
->
file_stats
);
if
(
e
->
nodeID
==
0
)
{
fprintf
(
e
->
file_stats
,
" %6d %14e %14e %14e %14e %14e %14e %14e %14e %14e %14e %14e %14e
\n
"
,
e
->
step
,
e
->
time
,
mass
,
e_tot
,
e_kin
,
e_int
,
e_pot
,
mom
[
0
],
mom
[
1
],
mom
[
2
],
ang_mom
[
0
],
ang_mom
[
1
],
ang_mom
[
2
]);
fflush
(
e
->
file_stats
);
}
}
/**
...
...
@@ -2193,7 +2196,10 @@ void engine_step(struct engine *e) {
}
/* Save some statistics */
engine_print_stats
(
e
);
if
(
e
->
time
-
e
->
timeLastStatistics
>=
e
->
deltaTimeStatistics
)
{
engine_print_stats
(
e
);
e
->
timeLastStatistics
+=
e
->
deltaTimeStatistics
;
}
/* Re-distribute the particles amongst the nodes? */
if
(
e
->
forcerepart
!=
REPART_NONE
)
engine_repartition
(
e
);
...
...
@@ -2564,6 +2570,9 @@ void engine_init(struct engine *e, struct space *s,
e
->
dt_min
=
parser_get_param_double
(
params
,
"TimeIntegration:dt_min"
);
e
->
dt_max
=
parser_get_param_double
(
params
,
"TimeIntegration:dt_max"
);
e
->
file_stats
=
NULL
;
e
->
deltaTimeStatistics
=
parser_get_param_double
(
params
,
"Statistics:delta_time"
);
e
->
timeLastStatistics
=
e
->
timeBegin
-
e
->
deltaTimeStatistics
;
e
->
verbose
=
verbose
;
e
->
count_step
=
0
;
e
->
wallclock_time
=
0
.
f
;
...
...
@@ -2666,10 +2675,11 @@ void engine_init(struct engine *e, struct space *s,
/* Open some files */
if
(
e
->
nodeID
==
0
)
{
e
->
file_stats
=
fopen
(
"energy.txt"
,
"w"
);
fprintf
(
e
->
file_stats
,
"# %6s %14s %14s %14s %14s %14s %14s %14s %14s %14s %14s %14s %14s
\n
"
,
"Step"
,
"Time"
,
"Mass"
,
"E_tot"
,
"E_kin"
,
"E_int"
,
"E_pot"
,
"p_x"
,
"p_y"
,
"p_z"
,
"ang_x"
,
"ang_y"
,
"ang_z"
);
fprintf
(
e
->
file_stats
,
"# %6s %14s %14s %14s %14s %14s %14s %14s %14s %14s %14s %14s %14s
\n
"
,
"Step"
,
"Time"
,
"Mass"
,
"E_tot"
,
"E_kin"
,
"E_int"
,
"E_pot"
,
"p_x"
,
"p_y"
,
"p_z"
,
"ang_x"
,
"ang_y"
,
"ang_z"
);
fflush
(
e
->
file_stats
);
}
...
...
src/engine.h
View file @
87d7aa95
...
...
@@ -147,8 +147,10 @@ struct engine {
char
snapshotBaseName
[
200
];
struct
UnitSystem
*
snapshotUnits
;
/*
File for statistics
*/
/*
Statistics information
*/
FILE
*
file_stats
;
double
timeLastStatistics
;
double
deltaTimeStatistics
;
/* The current step number. */
int
step
;
...
...
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