예제 #1
0
def shellmound_tmr_model_setup(shellmound_tmr_cfg_path):
    m = MF6model.setup_from_yaml(shellmound_tmr_cfg_path)
    m.write_input()
    #if hasattr(m, 'sfr'):
    #    sfr_package_filename = os.path.join(m.model_ws, m.sfr.filename)
    #    m.sfrdata.write_package(sfr_package_filename,
    #                                version='mf6',
    #                                options=['save_flows',
    #                                         'BUDGET FILEOUT {}.sfr.cbc'.format(m.name),
    #                                         'STAGE FILEOUT {}.sfr.stage.bin'.format(m.name),
    #                                         # 'OBS6 FILEIN {}'.format(sfr_obs_filename)
    #                                         # location of obs6 file relative to sfr package file (same folder)
    #                                         ]
    #                                )
    return m
def pleasant_mf6_setup_from_yaml(pleasant_mf6_test_cfg_path):
    m = MF6model.setup_from_yaml(pleasant_mf6_test_cfg_path)
    m.write_input()
    if hasattr(m, 'sfr'):
        sfr_package_filename = os.path.join(m.model_ws, m.sfr.filename)
        m.sfrdata.write_package(
            sfr_package_filename,
            version='mf6',
            idomain=m.idomain,
            options=[
                'save_flows',
                'BUDGET FILEOUT shellmound.sfr.cbc',
                'STAGE FILEOUT shellmound.sfr.stage.bin',
                # 'OBS6 FILEIN {}'.format(sfr_obs_filename)
                # location of obs6 file relative to sfr package file (same folder)
            ])
    return m
예제 #3
0
def test_solver_defaults(test_data_path, tmpdir):
    """Verify that default values aren't applied to solver
    packages if the simplified settings options are used
    (e.g. simple/moderate/complex)"""

    # modflow-6 IMS package
    mf6_model_config = test_data_path / 'pleasant_mf6_test.yml'
    cfg = MF6model.load_cfg(mf6_model_config)
    keep_keys = {
        'simulation', 'model', 'parent', 'setup_grid', 'dis', 'tdis',
        'intermediate_data', 'postprocessing'
    }
    new_cfg = {k: v for k, v in cfg.items() if k in keep_keys}
    new_cfg['model']['packages'] = ['dis']
    new_cfg['ims'] = {'options': {'complexity': 'moderate'}}
    temp_yaml = Path(tmpdir) / 'junk.yml'
    dump(temp_yaml, new_cfg)
    m = MF6model.setup_from_yaml(temp_yaml)
    assert 'nonlinear' not in m.cfg['ims']
    assert 'linear' not in m.cfg['ims']

    # modflow-nwt NWT package
    mfnwt_model_config = test_data_path / 'pleasant_nwt_test.yml'
    cfg = MFnwtModel.load_cfg(mfnwt_model_config)
    keep_keys = {
        'simulation', 'model', 'parent', 'setup_grid', 'dis', 'bas6',
        'intermediate_data', 'postprocessing'
    }
    new_cfg = {k: v for k, v in cfg.items() if k in keep_keys}
    new_cfg['model']['packages'] = ['dis', 'bas6']
    new_cfg['nwt'] = {'options': 'moderate'}
    temp_yaml = Path(tmpdir) / 'junk.yml'
    dump(temp_yaml, new_cfg)
    m = MFnwtModel.setup_from_yaml(temp_yaml)
    expected_keys = {
        'headtol', 'fluxtol', 'maxiterout', 'thickfact', 'linmeth', 'iprnwt',
        'ibotav', 'Continue', 'use_existing_file', 'options'
    }
    assert not set(m.cfg['nwt'].keys()).difference(expected_keys)
    assert m.cfg['nwt']['options'] == 'moderate'