Skip to content
Snippets Groups Projects
Commit 95b5e0d7 authored by Josh Borrow's avatar Josh Borrow
Browse files

Fixed testSelectOutput to work with new scheme

parent cfc435a4
No related branches found
No related tags found
1 merge request!1088Io selection changes
SelectOutput: Default:
# Particle Type 0 # Particle Type 0
Coordinates_Gas: 1 # check if written when specified Coordinates_Gas: on # check if written when specified
Velocities_Gas: 0 # check if not written when specified Velocities_Gas: off # check if not written when specified
Masses_Gas: -5 # check warning if not 0 or 1 and if written Pot_Gas: on # check warning if wrong name
Pot_Gas: 1 # check warning if wrong name
# Density_Gas: 1 # check if written when not specified # Density_Gas: 1 # check if written when not specified
# 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).
CFL_condition: 0.1 # Courant-Friedrich-Levy condition for time integration.
# 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).
CFL_condition: 0.1 # Courant-Friedrich-Levy condition for time integration.
Snapshots:
select_output_on: 1
select_output: selectOutput.yml
...@@ -26,12 +26,14 @@ ...@@ -26,12 +26,14 @@
void select_output_engine_init(struct engine *e, struct space *s, void select_output_engine_init(struct engine *e, struct space *s,
struct cosmology *cosmo, struct cosmology *cosmo,
struct swift_params *params, struct swift_params *params,
struct output_options *output,
struct cooling_function_data *cooling, struct cooling_function_data *cooling,
struct hydro_props *hydro_properties) { struct hydro_props *hydro_properties) {
/* set structures */ /* set structures */
e->s = s; e->s = s;
e->cooling_func = cooling; e->cooling_func = cooling;
e->parameter_file = params; e->parameter_file = params;
e->output_options = output;
e->cosmology = cosmo; e->cosmology = cosmo;
e->policy = engine_policy_hydro; e->policy = engine_policy_hydro;
e->hydro_properties = hydro_properties; e->hydro_properties = hydro_properties;
...@@ -96,9 +98,12 @@ int main(int argc, char *argv[]) { ...@@ -96,9 +98,12 @@ int main(int argc, char *argv[]) {
/* parse parameters */ /* parse parameters */
message("Reading parameters."); message("Reading parameters.");
struct swift_params param_file; struct swift_params param_file;
const char *input_file = "selectOutput.yml"; const char *input_file = "selectOutputParameters.yml";
parser_read_file(input_file, &param_file); parser_read_file(input_file, &param_file);
struct output_options output_options;
output_options_init(&param_file, 0, &output_options);
/* Default unit system */ /* Default unit system */
message("Initialization of the unit system."); message("Initialization of the unit system.");
struct unit_system us; struct unit_system us;
...@@ -149,14 +154,14 @@ int main(int argc, char *argv[]) { ...@@ -149,14 +154,14 @@ int main(int argc, char *argv[]) {
e.physical_constants = &prog_const; e.physical_constants = &prog_const;
sprintf(e.snapshot_base_name, "testSelectOutput"); sprintf(e.snapshot_base_name, "testSelectOutput");
sprintf(e.run_name, "Select Output Test"); sprintf(e.run_name, "Select Output Test");
select_output_engine_init(&e, &s, &cosmo, &param_file, &cooling, select_output_engine_init(&e, &s, &cosmo, &param_file, &output_options,
&hydro_properties); &cooling, &hydro_properties);
/* check output selection */ /* check output selection */
message("Checking output parameters."); message("Checking output parameters.");
long long N_total[swift_type_count] = { long long N_total[swift_type_count] = {
(long long)Ngas, (long long)Ngpart, 0, 0, (long long)Nspart, 0}; (long long)Ngas, (long long)Ngpart, 0, 0, (long long)Nspart, 0};
io_check_output_fields(&param_file, N_total, /*with_cosmology=*/1); io_check_output_fields(&param_file, N_total, /*with_cosmology=*/0);
/* write output file */ /* write output file */
message("Writing output."); message("Writing output.");
......
############################################################################### ###############################################################################
# This file is part of SWIFT. # This file is part of SWIFT.
# Copyright (c) 2015 Bert Vandenbroucke (bert.vandenbroucke@ugent.be) # Copyright (c) 2015 Bert Vandenbroucke (bert.vandenbroucke@ugent.be)
# Matthieu Schaller (matthieu.schaller@durham.ac.uk) # Matthieu Schaller (matthieu.schaller@durham.ac.uk)
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published # it under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either version 3 of the License, or # by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version. # (at your option) any later version.
# #
# This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
# #
# You should have received a copy of the GNU Lesser General Public License # You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
############################################################################## ##############################################################################
# Check the output done with swift # Check the output done with swift
...@@ -47,8 +47,8 @@ if "Densities" not in part0: ...@@ -47,8 +47,8 @@ if "Densities" not in part0:
with open(log_filename, "r") as f: with open(log_filename, "r") as f:
data = f.read() data = f.read()
if "SelectOutput:Masses_Gas" not in data: if "Default:Masses_Gas" not in data:
raise Exception("Input error in `SelectOuput:Masses_Gas` not detected") raise Exception("Input error in `Default:Masses_Gas` not detected")
if "SelectOutput:Pot_Gas" not in data: if "Default:Pot_Gas" not in data:
raise Exception("Parameter name error not detected for `SelectOutput:Pot_Gas`") raise Exception("Parameter name error not detected for `SelectOutput:Pot_Gas`")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment