Exemple #1
0
def test_run_by_setting_attributes():
    """Test running a HydroTrend simulation."""
    d = Dakota(method="vector_parameter_study", plugin="hydrotrend")
    d.template_file = os.path.join(data_dir, "HYDRO.IN.dtmpl")
    d.auxiliary_files = os.path.join(data_dir, "HYDRO0.HYPS")
    d.variables.descriptors = [
        "starting_mean_annual_temperature",
        "total_annual_precipitation",
    ]
    d.variables.initial_point = [10.0, 1.5]
    d.method.final_point = [20.0, 2.5]
    d.method.n_steps = 5
    d.responses.response_descriptors = ["Qs_median", "Q_mean"]
    d.responses.response_files = ["HYDROASCII.QS", "HYDROASCII.Q"]
    d.responses.response_statistics = ["median", "mean"]
    d.setup()
    assert_true(os.path.exists(d.input_file))
    if is_dakota_installed() and is_hydrotrend_installed():
        d.run()
        assert_true(os.path.exists(d.output_file))
Exemple #2
0
def test_setup():
    """Test the setup method."""
    k = Dakota(method="vector_parameter_study")
    k.setup()
    assert_true(os.path.exists(k.configuration_file))
    assert_true(filecmp.cmp(known_file, input_file))