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
9610ab37
Commit
9610ab37
authored
Mar 16, 2018
by
Matthieu Schaller
Browse files
Also write the gravitational potential of parts in the snapshots, not just the potential of gparts.
parent
df10732a
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/hydro/Default/hydro_io.h
View file @
9610ab37
...
...
@@ -101,6 +101,15 @@ void convert_part_vel(const struct engine* e, const struct part* p,
ret
[
2
]
*=
cosmo
->
a2_inv
;
}
void
convert_part_potential
(
const
struct
engine
*
e
,
const
struct
part
*
p
,
const
struct
xpart
*
xp
,
float
*
ret
)
{
if
(
p
->
gpart
!=
NULL
)
ret
[
0
]
=
gravity_get_comoving_potential
(
p
->
gpart
);
else
ret
[
0
]
=
0
.
f
;
}
/**
* @brief Specifies which particle fields to write to a dataset
*
...
...
@@ -111,7 +120,7 @@ void convert_part_vel(const struct engine* e, const struct part* p,
void
hydro_write_particles
(
const
struct
part
*
parts
,
const
struct
xpart
*
xparts
,
struct
io_props
*
list
,
int
*
num_fields
)
{
*
num_fields
=
7
;
*
num_fields
=
8
;
/* List what we want to write */
list
[
0
]
=
io_make_output_field_convert_part
(
"Coordinates"
,
DOUBLE
,
3
,
...
...
@@ -129,6 +138,9 @@ void hydro_write_particles(const struct part* parts, const struct xpart* xparts,
UNIT_CONV_NO_UNITS
,
parts
,
id
);
list
[
6
]
=
io_make_output_field
(
"Density"
,
FLOAT
,
1
,
UNIT_CONV_DENSITY
,
parts
,
rho
);
list
[
7
]
=
io_make_output_field_convert_part
(
"Potential"
,
FLOAT
,
1
,
UNIT_CONV_POTENTIAL
,
parts
,
xparts
,
convert_part_potential
);
}
/**
...
...
src/hydro/Gadget2/hydro_io.h
View file @
9610ab37
...
...
@@ -115,6 +115,15 @@ void convert_part_vel(const struct engine* e, const struct part* p,
ret
[
2
]
*=
cosmo
->
a2_inv
;
}
void
convert_part_potential
(
const
struct
engine
*
e
,
const
struct
part
*
p
,
const
struct
xpart
*
xp
,
float
*
ret
)
{
if
(
p
->
gpart
!=
NULL
)
ret
[
0
]
=
gravity_get_comoving_potential
(
p
->
gpart
);
else
ret
[
0
]
=
0
.
f
;
}
/**
* @brief Specifies which particle fields to write to a dataset
*
...
...
@@ -125,7 +134,7 @@ void convert_part_vel(const struct engine* e, const struct part* p,
void
hydro_write_particles
(
const
struct
part
*
parts
,
const
struct
xpart
*
xparts
,
struct
io_props
*
list
,
int
*
num_fields
)
{
*
num_fields
=
9
;
*
num_fields
=
10
;
/* List what we want to write */
list
[
0
]
=
io_make_output_field_convert_part
(
"Coordinates"
,
DOUBLE
,
3
,
...
...
@@ -149,6 +158,10 @@ void hydro_write_particles(const struct part* parts, const struct xpart* xparts,
list
[
8
]
=
io_make_output_field_convert_part
(
"Pressure"
,
FLOAT
,
1
,
UNIT_CONV_PRESSURE
,
parts
,
xparts
,
convert_part_P
);
list
[
9
]
=
io_make_output_field_convert_part
(
"Potential"
,
FLOAT
,
1
,
UNIT_CONV_POTENTIAL
,
parts
,
xparts
,
convert_part_potential
);
#ifdef DEBUG_INTERACTIONS_SPH
list
+=
*
num_fields
;
...
...
src/hydro/Gizmo/hydro_io.h
View file @
9610ab37
...
...
@@ -160,6 +160,15 @@ void convert_part_vel(const struct engine* e, const struct part* p,
ret
[
2
]
*=
cosmo
->
a2_inv
;
}
void
convert_part_potential
(
const
struct
engine
*
e
,
const
struct
part
*
p
,
const
struct
xpart
*
xp
,
float
*
ret
)
{
if
(
p
->
gpart
!=
NULL
)
ret
[
0
]
=
gravity_get_comoving_potential
(
p
->
gpart
);
else
ret
[
0
]
=
0
.
f
;
}
/**
* @brief Specifies which particle fields to write to a dataset
*
...
...
@@ -170,7 +179,7 @@ void convert_part_vel(const struct engine* e, const struct part* p,
void
hydro_write_particles
(
const
struct
part
*
parts
,
const
struct
xpart
*
xparts
,
struct
io_props
*
list
,
int
*
num_fields
)
{
*
num_fields
=
1
0
;
*
num_fields
=
1
1
;
/* List what we want to write */
list
[
0
]
=
io_make_output_field_convert_part
(
"Coordinates"
,
DOUBLE
,
3
,
...
...
@@ -196,6 +205,10 @@ void hydro_write_particles(const struct part* parts, const struct xpart* xparts,
parts
,
primitives
.
P
);
list
[
9
]
=
io_make_output_field_convert_part
(
"TotEnergy"
,
FLOAT
,
1
,
UNIT_CONV_ENERGY
,
parts
,
xparts
,
convert_Etot
);
list
[
10
]
=
io_make_output_field_convert_part
(
"Potential"
,
FLOAT
,
1
,
UNIT_CONV_POTENTIAL
,
parts
,
xparts
,
convert_part_potential
);
}
/**
...
...
src/hydro/Minimal/hydro_io.h
View file @
9610ab37
...
...
@@ -129,6 +129,15 @@ void convert_part_vel(const struct engine* e, const struct part* p,
ret
[
2
]
*=
cosmo
->
a2_inv
;
}
void
convert_part_potential
(
const
struct
engine
*
e
,
const
struct
part
*
p
,
const
struct
xpart
*
xp
,
float
*
ret
)
{
if
(
p
->
gpart
!=
NULL
)
ret
[
0
]
=
gravity_get_comoving_potential
(
p
->
gpart
);
else
ret
[
0
]
=
0
.
f
;
}
/**
* @brief Specifies which particle fields to write to a dataset
*
...
...
@@ -140,7 +149,7 @@ void convert_part_vel(const struct engine* e, const struct part* p,
void
hydro_write_particles
(
const
struct
part
*
parts
,
const
struct
xpart
*
xparts
,
struct
io_props
*
list
,
int
*
num_fields
)
{
*
num_fields
=
9
;
*
num_fields
=
10
;
/* List what we want to write */
list
[
0
]
=
io_make_output_field_convert_part
(
"Coordinates"
,
DOUBLE
,
3
,
...
...
@@ -163,6 +172,10 @@ void hydro_write_particles(const struct part* parts, const struct xpart* xparts,
parts
,
xparts
,
convert_S
);
list
[
8
]
=
io_make_output_field_convert_part
(
"Pressure"
,
FLOAT
,
1
,
UNIT_CONV_PRESSURE
,
parts
,
xparts
,
convert_P
);
list
[
9
]
=
io_make_output_field_convert_part
(
"Potential"
,
FLOAT
,
1
,
UNIT_CONV_POTENTIAL
,
parts
,
xparts
,
convert_part_potential
);
}
/**
...
...
src/hydro/PressureEntropy/hydro_io.h
View file @
9610ab37
...
...
@@ -127,6 +127,15 @@ void convert_part_vel(const struct engine* e, const struct part* p,
ret
[
2
]
*=
cosmo
->
a2_inv
;
}
void
convert_part_potential
(
const
struct
engine
*
e
,
const
struct
part
*
p
,
const
struct
xpart
*
xp
,
float
*
ret
)
{
if
(
p
->
gpart
!=
NULL
)
ret
[
0
]
=
gravity_get_comoving_potential
(
p
->
gpart
);
else
ret
[
0
]
=
0
.
f
;
}
/**
* @brief Specifies which particle fields to write to a dataset
*
...
...
@@ -137,7 +146,7 @@ void convert_part_vel(const struct engine* e, const struct part* p,
void
hydro_write_particles
(
const
struct
part
*
parts
,
const
struct
xpart
*
xparts
,
struct
io_props
*
list
,
int
*
num_fields
)
{
*
num_fields
=
1
0
;
*
num_fields
=
1
1
;
/* List what we want to write */
list
[
0
]
=
io_make_output_field_convert_part
(
"Coordinates"
,
DOUBLE
,
3
,
...
...
@@ -162,6 +171,9 @@ void hydro_write_particles(const struct part* parts, const struct xpart* xparts,
"Pressure"
,
FLOAT
,
1
,
UNIT_CONV_PRESSURE
,
parts
,
xparts
,
convert_P
);
list
[
9
]
=
io_make_output_field
(
"WeightedDensity"
,
FLOAT
,
1
,
UNIT_CONV_DENSITY
,
parts
,
rho_bar
);
list
[
10
]
=
io_make_output_field_convert_part
(
"Potential"
,
FLOAT
,
1
,
UNIT_CONV_POTENTIAL
,
parts
,
xparts
,
convert_part_potential
);
}
/**
...
...
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