Skip to content
GitLab
Menu
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
ec7014d2
Commit
ec7014d2
authored
Jul 18, 2016
by
Matthieu Schaller
Browse files
Be verbose about unit conversion when writing snapshots
parent
136c2a48
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/parallel_io.c
View file @
ec7014d2
...
...
@@ -39,9 +39,9 @@
#include
"common_io.h"
#include
"engine.h"
#include
"error.h"
#include
"hydro_properties.h"
#include
"gravity_io.h"
#include
"hydro_io.h"
#include
"hydro_properties.h"
#include
"io_properties.h"
#include
"kernel_hydro.h"
#include
"part.h"
...
...
@@ -706,6 +706,39 @@ void write_output_parallel(struct engine* e, const char* baseName,
/* Print the system of Units used internally */
writeUnitSystem
(
h_file
,
internal_units
,
"InternalCodeUnits"
);
/* Tell the user if a conversion will be needed */
if
(
e
->
verbose
&&
mpi_rank
==
0
)
{
if
(
units_are_equal
(
snapshot_units
,
internal_units
))
{
message
(
"Snapshot and internal units match. No conversion needed."
);
}
else
{
message
(
"Conversion needed from:"
);
message
(
"(Snapshot) Unit system: U_M = %e g."
,
snapshot_units
->
UnitMass_in_cgs
);
message
(
"(Snapshot) Unit system: U_L = %e cm."
,
snapshot_units
->
UnitLength_in_cgs
);
message
(
"(Snapshot) Unit system: U_t = %e s."
,
snapshot_units
->
UnitTime_in_cgs
);
message
(
"(Snapshot) Unit system: U_I = %e A."
,
snapshot_units
->
UnitCurrent_in_cgs
);
message
(
"(Snapshot) Unit system: U_T = %e K."
,
snapshot_units
->
UnitTemperature_in_cgs
);
message
(
"to:"
);
message
(
"(internal) Unit system: U_M = %e g."
,
internal_units
->
UnitMass_in_cgs
);
message
(
"(internal) Unit system: U_L = %e cm."
,
internal_units
->
UnitLength_in_cgs
);
message
(
"(internal) Unit system: U_t = %e s."
,
internal_units
->
UnitTime_in_cgs
);
message
(
"(internal) Unit system: U_I = %e A."
,
internal_units
->
UnitCurrent_in_cgs
);
message
(
"(internal) Unit system: U_T = %e K."
,
internal_units
->
UnitTemperature_in_cgs
);
}
}
/* Loop over all particle types */
for
(
int
ptype
=
0
;
ptype
<
NUM_PARTICLE_TYPES
;
ptype
++
)
{
...
...
src/serial_io.c
View file @
ec7014d2
...
...
@@ -39,9 +39,9 @@
#include
"common_io.h"
#include
"engine.h"
#include
"error.h"
#include
"hydro_properties.h"
#include
"gravity_io.h"
#include
"hydro_io.h"
#include
"hydro_properties.h"
#include
"io_properties.h"
#include
"kernel_hydro.h"
#include
"part.h"
...
...
@@ -764,6 +764,39 @@ void write_output_serial(struct engine* e, const char* baseName,
/* Print the system of Units used internally */
writeUnitSystem
(
h_file
,
internal_units
,
"InternalCodeUnits"
);
/* Tell the user if a conversion will be needed */
if
(
e
->
verbose
)
{
if
(
units_are_equal
(
snapshot_units
,
internal_units
))
{
message
(
"Snapshot and internal units match. No conversion needed."
);
}
else
{
message
(
"Conversion needed from:"
);
message
(
"(Snapshot) Unit system: U_M = %e g."
,
snapshot_units
->
UnitMass_in_cgs
);
message
(
"(Snapshot) Unit system: U_L = %e cm."
,
snapshot_units
->
UnitLength_in_cgs
);
message
(
"(Snapshot) Unit system: U_t = %e s."
,
snapshot_units
->
UnitTime_in_cgs
);
message
(
"(Snapshot) Unit system: U_I = %e A."
,
snapshot_units
->
UnitCurrent_in_cgs
);
message
(
"(Snapshot) Unit system: U_T = %e K."
,
snapshot_units
->
UnitTemperature_in_cgs
);
message
(
"to:"
);
message
(
"(internal) Unit system: U_M = %e g."
,
internal_units
->
UnitMass_in_cgs
);
message
(
"(internal) Unit system: U_L = %e cm."
,
internal_units
->
UnitLength_in_cgs
);
message
(
"(internal) Unit system: U_t = %e s."
,
internal_units
->
UnitTime_in_cgs
);
message
(
"(internal) Unit system: U_I = %e A."
,
internal_units
->
UnitCurrent_in_cgs
);
message
(
"(internal) Unit system: U_T = %e K."
,
internal_units
->
UnitTemperature_in_cgs
);
}
}
/* Loop over all particle types */
for
(
int
ptype
=
0
;
ptype
<
NUM_PARTICLE_TYPES
;
ptype
++
)
{
...
...
src/single_io.c
View file @
ec7014d2
...
...
@@ -38,9 +38,9 @@
#include
"common_io.h"
#include
"engine.h"
#include
"error.h"
#include
"hydro_properties.h"
#include
"gravity_io.h"
#include
"hydro_io.h"
#include
"hydro_properties.h"
#include
"io_properties.h"
#include
"kernel_hydro.h"
#include
"part.h"
...
...
@@ -610,6 +610,39 @@ void write_output_single(struct engine* e, const char* baseName,
/* Print the system of Units used internally */
writeUnitSystem
(
h_file
,
internal_units
,
"InternalCodeUnits"
);
/* Tell the user if a conversion will be needed */
if
(
e
->
verbose
)
{
if
(
units_are_equal
(
snapshot_units
,
internal_units
))
{
message
(
"Snapshot and internal units match. No conversion needed."
);
}
else
{
message
(
"Conversion needed from:"
);
message
(
"(Snapshot) Unit system: U_M = %e g."
,
snapshot_units
->
UnitMass_in_cgs
);
message
(
"(Snapshot) Unit system: U_L = %e cm."
,
snapshot_units
->
UnitLength_in_cgs
);
message
(
"(Snapshot) Unit system: U_t = %e s."
,
snapshot_units
->
UnitTime_in_cgs
);
message
(
"(Snapshot) Unit system: U_I = %e A."
,
snapshot_units
->
UnitCurrent_in_cgs
);
message
(
"(Snapshot) Unit system: U_T = %e K."
,
snapshot_units
->
UnitTemperature_in_cgs
);
message
(
"to:"
);
message
(
"(internal) Unit system: U_M = %e g."
,
internal_units
->
UnitMass_in_cgs
);
message
(
"(internal) Unit system: U_L = %e cm."
,
internal_units
->
UnitLength_in_cgs
);
message
(
"(internal) Unit system: U_t = %e s."
,
internal_units
->
UnitTime_in_cgs
);
message
(
"(internal) Unit system: U_I = %e A."
,
internal_units
->
UnitCurrent_in_cgs
);
message
(
"(internal) Unit system: U_T = %e K."
,
internal_units
->
UnitTemperature_in_cgs
);
}
}
/* Loop over all particle types */
for
(
int
ptype
=
0
;
ptype
<
NUM_PARTICLE_TYPES
;
ptype
++
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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