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
cee9ab8a
Commit
cee9ab8a
authored
Jun 06, 2018
by
Matthieu Schaller
Browse files
Always use 4-digits for the output of gravity force checks. Documentation fixes.
parent
ad54b220
Changes
5
Hide whitespace changes
Inline
Side-by-side
examples/ZeldovichPancake_3D/zeldovichPancake.yml
View file @
cee9ab8a
...
...
@@ -15,7 +15,7 @@ TimeIntegration:
Snapshots
:
basename
:
zeldovichPancake
# Common part of the name of output files
time_first
:
0.
# Time of the first output (in internal units)
delta_time
:
1.0
4
# Time difference between consecutive outputs (in internal units)
delta_time
:
1.0
1
# Time difference between consecutive outputs (in internal units)
scale_factor_first
:
0.00991
# Parameters governing the conserved quantities statistics
...
...
@@ -47,6 +47,6 @@ Gravity:
mesh_side_length
:
16
eta
:
0.025
theta
:
0.85
r_cut_max
:
5
.
r_cut_max
:
6
.
comoving_softening
:
0.0001
max_physical_softening
:
0.0001
examples/plot_gravity_checks.py
View file @
cee9ab8a
...
...
@@ -46,21 +46,21 @@ step = int(sys.argv[1])
periodic
=
int
(
sys
.
argv
[
2
])
# Find the files for the different expansion orders
order_list
=
glob
.
glob
(
"gravity_checks_swift_step%d_order*.dat"
%
step
)
order_list
=
glob
.
glob
(
"gravity_checks_swift_step%
.4
d_order*.dat"
%
step
)
num_order
=
len
(
order_list
)
# Get the multipole orders
order
=
np
.
zeros
(
num_order
)
for
i
in
range
(
num_order
):
order
[
i
]
=
int
(
order_list
[
i
][
3
2
])
order
[
i
]
=
int
(
order_list
[
i
][
3
5
])
order
=
sorted
(
order
)
order_list
=
sorted
(
order_list
)
# Read the exact accelerations first
if
periodic
:
data
=
np
.
loadtxt
(
'gravity_checks_exact_periodic_step%d.dat'
%
step
)
data
=
np
.
loadtxt
(
'gravity_checks_exact_periodic_step%
.4
d.dat'
%
step
)
else
:
data
=
np
.
loadtxt
(
'gravity_checks_exact_step%d.dat'
%
step
)
data
=
np
.
loadtxt
(
'gravity_checks_exact_step%
.4
d.dat'
%
step
)
exact_ids
=
data
[:,
0
]
exact_pos
=
data
[:,
1
:
4
]
exact_a
=
data
[:,
4
:
7
]
...
...
@@ -303,5 +303,5 @@ plt.ylim(0,1.75)
plt
.
savefig
(
"gravity_checks_step%d.png"
%
step
,
dpi
=
200
)
plt
.
savefig
(
"gravity_checks_step%d.pdf"
%
step
,
dpi
=
200
)
plt
.
savefig
(
"gravity_checks_step%
.4
d.png"
%
step
,
dpi
=
200
)
plt
.
savefig
(
"gravity_checks_step%
.4
d.pdf"
%
step
,
dpi
=
200
)
src/engine.c
View file @
cee9ab8a
...
...
@@ -5436,6 +5436,7 @@ void engine_unpin(void) {
* @param cosmo The #cosmology used for this run.
* @param hydro The #hydro_props used for this run.
* @param gravity The #gravity_props used for this run.
* @param mesh The #pm_mesh used for the long-range periodic forces.
* @param potential The properties of the external potential.
* @param cooling_func The properties of the cooling function.
* @param chemistry The chemistry information.
...
...
src/gravity.c
View file @
cee9ab8a
...
...
@@ -416,9 +416,9 @@ int gravity_exact_force_file_exits(const struct engine *e) {
/* File name */
char
file_name
[
100
];
if
(
e
->
s
->
periodic
)
sprintf
(
file_name
,
"gravity_checks_exact_periodic_step%d.dat"
,
e
->
step
);
sprintf
(
file_name
,
"gravity_checks_exact_periodic_step%
.4
d.dat"
,
e
->
step
);
else
sprintf
(
file_name
,
"gravity_checks_exact_step%d.dat"
,
e
->
step
);
sprintf
(
file_name
,
"gravity_checks_exact_step%
.4
d.dat"
,
e
->
step
);
/* Does the file exist ? */
if
(
access
(
file_name
,
R_OK
|
W_OK
)
==
0
)
{
...
...
@@ -647,7 +647,7 @@ void gravity_exact_force_check(struct space *s, const struct engine *e,
/* File name */
char
file_name_swift
[
100
];
sprintf
(
file_name_swift
,
"gravity_checks_swift_step%d_order%d.dat"
,
e
->
step
,
sprintf
(
file_name_swift
,
"gravity_checks_swift_step%
.4
d_order%d.dat"
,
e
->
step
,
SELF_GRAVITY_MULTIPOLE_ORDER
);
/* Creare files and write header */
...
...
@@ -703,10 +703,10 @@ void gravity_exact_force_check(struct space *s, const struct engine *e,
char
file_name_exact
[
100
];
if
(
s
->
periodic
)
sprintf
(
file_name_exact
,
"gravity_checks_exact_periodic_step%d.dat"
,
sprintf
(
file_name_exact
,
"gravity_checks_exact_periodic_step%
.4
d.dat"
,
e
->
step
);
else
sprintf
(
file_name_exact
,
"gravity_checks_exact_step%d.dat"
,
e
->
step
);
sprintf
(
file_name_exact
,
"gravity_checks_exact_step%
.4
d.dat"
,
e
->
step
);
FILE
*
file_exact
=
fopen
(
file_name_exact
,
"w"
);
fprintf
(
file_exact
,
"# Gravity accuracy test - EXACT FORCES
\n
"
);
...
...
src/mesh_gravity.c
View file @
cee9ab8a
...
...
@@ -479,7 +479,7 @@ void pm_mesh_compute_potential(struct pm_mesh* mesh, const struct engine* e) {
* @param mesh The #pm_mesh (containing the potential) to interpolate from.
* @param e The #engine (to check active status).
* @param gparts The #gpart to interpolate to.
* @param gcount The number of #gpart
s
.
* @param gcount The number of #gpart.
*/
void
pm_mesh_interpolate_forces
(
const
struct
pm_mesh
*
mesh
,
const
struct
engine
*
e
,
struct
gpart
*
gparts
,
...
...
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