Commit c707ab6b authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Properties of the self-gravity scheme are now read from the YAML file. They...

Properties of the self-gravity scheme are now read from the YAML file. They are printed to stdout and to snapshots.
parent 7d79c8be
......@@ -333,10 +333,10 @@ int main(int argc, char *argv[]) {
MPI_Bcast(params, sizeof(struct swift_params), MPI_BYTE, 0, MPI_COMM_WORLD);
#endif
/* Prepare the domain decomposition scheme */
enum repartition_type reparttype = REPART_NONE;
/* Prepare the domain decomposition scheme */
#ifdef WITH_MPI
struct partition initial_partition;
enum repartition_type reparttype;
partition_init(&initial_partition, &reparttype, params, nr_nodes);
/* Let's report what we did */
......@@ -514,9 +514,8 @@ int main(int argc, char *argv[]) {
if (myrank == 0) clocks_gettime(&tic);
struct engine e;
engine_init(&e, &s, params, nr_nodes, myrank, nr_threads, with_aff,
engine_policies, talking, reparttype, &us, &prog_const,
&hydro_properties, &gravity_properties, &potential, &cooling_func,
&sourceterms);
engine_policies, talking, &us, &prog_const, &hydro_properties,
&gravity_properties, &potential, &cooling_func, &sourceterms);
if (myrank == 0) {
clocks_gettime(&toc);
message("engine_init took %.3f %s.", clocks_diff(&tic, &toc),
......@@ -590,6 +589,11 @@ int main(int argc, char *argv[]) {
/* Main simulation loop */
for (int j = 0; !engine_is_done(&e) && e.step != nsteps; j++) {
/* Repartition the space amongst the nodes? */
#ifdef WITH_MPI
if (j % 100 == 2) e.forcerepart = reparttype;
#endif
/* Reset timers */
timers_reset(timers_mask_all);
......@@ -691,7 +695,6 @@ int main(int argc, char *argv[]) {
#endif
/* Write final output. */
engine_drift_all(&e);
engine_dump_snapshot(&e);
#ifdef WITH_MPI
......
......@@ -3704,7 +3704,7 @@ void engine_init(struct engine *e, struct space *s,
/* Print information about the hydro scheme */
if (e->policy & engine_policy_self_gravity)
if (e->nodeID == 0) gravity_props_print(e->gravity_properties);
/* Check we have sensible time bounds */
if (e->timeBegin >= e->timeEnd)
error(
......
......@@ -751,19 +751,19 @@ void write_output_parallel(struct engine* e, const char* baseName,
io_write_code_description(h_file);
/* Print the SPH parameters */
if(e->policy & engine_policy_hydro){
h_grp =
H5Gcreate(h_file, "/HydroScheme", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if (e->policy & engine_policy_hydro) {
h_grp = H5Gcreate(h_file, "/HydroScheme", H5P_DEFAULT, H5P_DEFAULT,
H5P_DEFAULT);
if (h_grp < 0) error("Error while creating SPH group");
hydro_props_print_snapshot(h_grp, e->hydro_properties);
writeSPHflavour(h_grp);
H5Gclose(h_grp);
}
/* Print the gravity parameters */
if(e->policy & engine_policy_self_gravity) {
if (e->policy & engine_policy_self_gravity) {
h_grp = H5Gcreate(h_file, "/GravityScheme", H5P_DEFAULT, H5P_DEFAULT,
H5P_DEFAULT);
H5P_DEFAULT);
if (h_grp < 0) error("Error while creating gravity group");
gravity_props_print_snapshot(h_grp, e->gravity_properties);
H5Gclose(h_grp);
......
......@@ -823,9 +823,9 @@ void write_output_serial(struct engine* e, const char* baseName,
io_write_code_description(h_file);
/* Print the SPH parameters */
if(e->policy & engine_policy_hydro) {
if (e->policy & engine_policy_hydro) {
h_grp = H5Gcreate(h_file, "/HydroScheme", H5P_DEFAULT, H5P_DEFAULT,
H5P_DEFAULT);
H5P_DEFAULT);
if (h_grp < 0) error("Error while creating SPH group");
hydro_props_print_snapshot(h_grp, e->hydro_properties);
writeSPHflavour(h_grp);
......@@ -833,9 +833,9 @@ void write_output_serial(struct engine* e, const char* baseName,
}
/* Print the gravity parameters */
if(e->policy & engine_policy_self_gravity) {
if (e->policy & engine_policy_self_gravity) {
h_grp = H5Gcreate(h_file, "/GravityScheme", H5P_DEFAULT, H5P_DEFAULT,
H5P_DEFAULT);
H5P_DEFAULT);
if (h_grp < 0) error("Error while creating gravity group");
gravity_props_print_snapshot(h_grp, e->gravity_properties);
H5Gclose(h_grp);
......
......@@ -673,9 +673,9 @@ void write_output_single(struct engine* e, const char* baseName,
io_write_code_description(h_file);
/* Print the SPH parameters */
if(e->policy & engine_policy_hydro) {
h_grp =
H5Gcreate(h_file, "/HydroScheme", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if (e->policy & engine_policy_hydro) {
h_grp = H5Gcreate(h_file, "/HydroScheme", H5P_DEFAULT, H5P_DEFAULT,
H5P_DEFAULT);
if (h_grp < 0) error("Error while creating SPH group");
hydro_props_print_snapshot(h_grp, e->hydro_properties);
writeSPHflavour(h_grp);
......@@ -683,9 +683,9 @@ void write_output_single(struct engine* e, const char* baseName,
}
/* Print the gravity parameters */
if(e->policy & engine_policy_self_gravity) {
if (e->policy & engine_policy_self_gravity) {
h_grp = H5Gcreate(h_file, "/GravityScheme", H5P_DEFAULT, H5P_DEFAULT,
H5P_DEFAULT);
H5P_DEFAULT);
if (h_grp < 0) error("Error while creating gravity group");
gravity_props_print_snapshot(h_grp, e->gravity_properties);
H5Gclose(h_grp);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment