Commit 95b5e0d7 authored by Josh Borrow's avatar Josh Borrow

Fixed testSelectOutput to work with new scheme

parent cfc435a4
SelectOutput:
Default:
# Particle Type 0
Coordinates_Gas: 1 # check if written when specified
Velocities_Gas: 0 # check if not written when specified
Masses_Gas: -5 # check warning if not 0 or 1 and if written
Pot_Gas: 1 # check warning if wrong name
Coordinates_Gas: on # check if written when specified
Velocities_Gas: off # check if not written when specified
Pot_Gas: on # check warning if wrong name
# 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 @@
void select_output_engine_init(struct engine *e, struct space *s,
struct cosmology *cosmo,
struct swift_params *params,
struct output_options *output,
struct cooling_function_data *cooling,
struct hydro_props *hydro_properties) {
/* set structures */
e->s = s;
e->cooling_func = cooling;
e->parameter_file = params;
e->output_options = output;
e->cosmology = cosmo;
e->policy = engine_policy_hydro;
e->hydro_properties = hydro_properties;
......@@ -96,9 +98,12 @@ int main(int argc, char *argv[]) {
/* parse parameters */
message("Reading parameters.");
struct swift_params param_file;
const char *input_file = "selectOutput.yml";
const char *input_file = "selectOutputParameters.yml";
parser_read_file(input_file, &param_file);
struct output_options output_options;
output_options_init(&param_file, 0, &output_options);
/* Default unit system */
message("Initialization of the unit system.");
struct unit_system us;
......@@ -149,14 +154,14 @@ int main(int argc, char *argv[]) {
e.physical_constants = &prog_const;
sprintf(e.snapshot_base_name, "testSelectOutput");
sprintf(e.run_name, "Select Output Test");
select_output_engine_init(&e, &s, &cosmo, &param_file, &cooling,
&hydro_properties);
select_output_engine_init(&e, &s, &cosmo, &param_file, &output_options,
&cooling, &hydro_properties);
/* check output selection */
message("Checking output parameters.");
long long N_total[swift_type_count] = {
(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 */
message("Writing output.");
......
###############################################################################
# This file is part of SWIFT.
# Copyright (c) 2015 Bert Vandenbroucke (bert.vandenbroucke@ugent.be)
# Matthieu Schaller (matthieu.schaller@durham.ac.uk)
#
# 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
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# 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/>.
#
##############################################################################
# This file is part of SWIFT.
# Copyright (c) 2015 Bert Vandenbroucke (bert.vandenbroucke@ugent.be)
# Matthieu Schaller (matthieu.schaller@durham.ac.uk)
#
# 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
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# 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/>.
#
##############################################################################
# Check the output done with swift
......@@ -47,8 +47,8 @@ if "Densities" not in part0:
with open(log_filename, "r") as f:
data = f.read()
if "SelectOutput:Masses_Gas" not in data:
raise Exception("Input error in `SelectOuput:Masses_Gas` not detected")
if "Default:Masses_Gas" not in data:
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`")
Markdown is supported
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