def test_clmin_round_trip(clm): path = Path(get_absolute_path('drv_clmin.dat')) if path.exists(): path.unlink() CLMExporter(clm).write_input() new_clm = Run('clm', __file__) CLMImporter(new_clm).input_file(path) verify_clmin_data(new_clm)
def test_vegp_round_trip(clm): path = Path(get_absolute_path('drv_vegp.dat')) if path.exists(): path.unlink() CLMExporter(clm).write_parameters() new_clm = Run('clm', __file__) veg_params = new_clm.Solver.CLM.Vegetation.Parameters # Set the land cover items veg_params.LandNames = veg_params.LandNames CLMImporter(new_clm).parameters_file(path) verify_vegp_data(new_clm)
# Import the ParFlow package # from parflow import Run import os import shutil #preliminaries os.chdir('output') # copy CLM files shutil.copyfile('../inputs/drv_clmin.dat', 'drv_clmin.dat') shutil.copyfile('../inputs/drv_vegm.dat', 'drv_vegm.dat') shutil.copyfile('../inputs/drv_vegp.dat', 'drv_vegp.dat') # Set our Run Name PFCLM_SC = Run("PFCLM_SC", __file__) stopt = 8760 #----------------------------------------------------------------------------- # File input version number #----------------------------------------------------------------------------- PFCLM_SC.FileVersion = 4 #----------------------------------------------------------------------------- # Process Topology #----------------------------------------------------------------------------- PFCLM_SC.Process.Topology.P = 1 PFCLM_SC.Process.Topology.Q = 1 PFCLM_SC.Process.Topology.R = 1
import sys from parflow import Run yamlHierarchy = Run('hierarchical', __file__) generatedFile, runFile = yamlHierarchy.write(file_format='yaml') with open(generatedFile) as new, open(f'{generatedFile}.ref') as ref: if new.read() == ref.read(): print('Success we have the same file') else: print('Files are different') sys.exit(1)
#-------------------------------------------------------------- # This runs the a Little Washita Test Problem with variable dz # and a constant rain forcing. The full Jacobian is use and there is no dampening in the # overland flow. #-------------------------------------------------------------- from parflow import Run from parflow.tools.fs import cp, mkdir, chdir, get_absolute_path LWvdz = Run("LWvdz", __file__) #--------------------------------------------------------- # Copying slope files #--------------------------------------------------------- dir_name = get_absolute_path('test_output/LWvdz') mkdir(dir_name) chdir(dir_name) cp('$PF_SRC/test/input/lw.1km.slope_x.10x.pfb') cp('$PF_SRC/test/input/lw.1km.slope_y.10x.pfb') #--------------------------------------------------------- LWvdz.FileVersion = 4 LWvdz.Process.Topology.P = 1 LWvdz.Process.Topology.Q = 1 LWvdz.Process.Topology.R = 1 #---------------------------------------------------------
#running different configuraitons of tilted V tcl_precision = 17 # Import the ParFlow TCL package # from parflow import Run overland_tiltedV_DWE = Run("overland_tiltedV_DWE", __file__) overland_tiltedV_DWE.FileVersion = 4 overland_tiltedV_DWE.Process.Topology.P = 1 overland_tiltedV_DWE.Process.Topology.Q = 1 overland_tiltedV_DWE.Process.Topology.R = 1 #--------------------------------------------------------- # Computational Grid #--------------------------------------------------------- overland_tiltedV_DWE.ComputationalGrid.Lower.X = 0.0 overland_tiltedV_DWE.ComputationalGrid.Lower.Y = 0.0 overland_tiltedV_DWE.ComputationalGrid.Lower.Z = 0.0 overland_tiltedV_DWE.ComputationalGrid.NX = 5 overland_tiltedV_DWE.ComputationalGrid.NY = 5 overland_tiltedV_DWE.ComputationalGrid.NZ = 1 overland_tiltedV_DWE.ComputationalGrid.DX = 10.0 overland_tiltedV_DWE.ComputationalGrid.DY = 10.0 overland_tiltedV_DWE.ComputationalGrid.DZ = .05
# This runs a test case with the Richards' solver # with simple flow domains, like a wall or a fault. # set runname richards_FBx tcl_precision = 17 # Import the ParFlow TCL package # from parflow import Run richards_FBx = Run("richards_FBx", __file__) richards_FBx.FileVersion = 4 richards_FBx.Process.Topology.P = 1 richards_FBx.Process.Topology.Q = 1 richards_FBx.Process.Topology.R = 1 #--------------------------------------------------------- # Computational Grid #--------------------------------------------------------- richards_FBx.ComputationalGrid.Lower.X = 0.0 richards_FBx.ComputationalGrid.Lower.Y = 0.0 richards_FBx.ComputationalGrid.Lower.Z = 0.0 richards_FBx.ComputationalGrid.DX = 1.0 richards_FBx.ComputationalGrid.DY = 1.0 richards_FBx.ComputationalGrid.DZ = 1.0 richards_FBx.ComputationalGrid.NX = 20 richards_FBx.ComputationalGrid.NY = 20 richards_FBx.ComputationalGrid.NZ = 20
'DispHeight': 11.0 }, 'water': { 'WaterType': 3, 'StemAI': 2.0, 'RoughLength': 0.002, 'StemTransNir': -99.0 } } for name, item in check_list.items(): for key, val in item.items(): assert veg_params[name][key] == val if __name__ == '__main__': clm = Run('clm', __file__) clm.ComputationalGrid.NX = 5 clm.ComputationalGrid.NY = 5 test_clmin_key_setting(clm) test_clmin_file_setting(clm) test_vegm_file_setting(clm) test_vegp_file_setting(clm) # Test export then loading the file back in test_clmin_round_trip(clm) test_vegm_round_trip(clm) test_vegp_round_trip(clm) # Make sure things are working for fewer land names
#----------------------------------------------------------------------------- # Testing various methods that use locations for selections #----------------------------------------------------------------------------- from parflow import Run from parflow.tools.fs import get_absolute_path run = Run("run", __file__) run.pfset(pfidb_file=get_absolute_path( '$PF_SRC/test/correct_output/dsingle.pfidb.ref')) # Some modifications for testing run.Solver = 'Richards' # select() tests porosity = run.Geom.Porosity assert run.Geom.Porosity.select('.')[0] is porosity assert porosity.select('.')[0] is porosity assert porosity.select()[0] is porosity assert porosity.select('..')[0] is run.Geom assert porosity.select('GeomNames')[0] is porosity.GeomNames assert porosity.select('./GeomNames')[0] is porosity.GeomNames assert run.Geom.select('Porosity/GeomNames')[0] is porosity.GeomNames assert porosity.select('/')[0] is run assert porosity.select('/Geom')[0] is run.Geom assert porosity.select('/Geom/Porosity')[0] is porosity assert porosity.select('../../Solver/../Geom/./Porosity/..')[0] is run.Geom assert porosity.select('../..')[0] is run assert run.Geom.select('.Porosity.GeomNames')[0] is porosity.GeomNames
# This runs the basic default_richards test case. # This run, as written in this input file, should take # 3 nonlinear iterations. # # Import the ParFlow TCL package # from parflow import Run default_richards_with_silopmpio = Run("default_richards_with_silopmpio", __file__) # Examples of compression options for SILO # Note compression only works for HDF5 #pfset SILO.Filetype "HDF5" #pfset SILO.CompressionOptions "METHOD=GZIP" #pfset SILO.CompressionOptions "METHOD=SZIP" #pfset SILO.CompressionOptions "METHOD=FPZIP" #pfset SILO.CompressionOptions "ERRMODE=FALLBACK METHOD=GZIP" default_richards_with_silopmpio.FileVersion = 4 default_richards_with_silopmpio.Process.Topology.P = 1 default_richards_with_silopmpio.Process.Topology.Q = 1 default_richards_with_silopmpio.Process.Topology.R = 2 #--------------------------------------------------------- # Computational Grid #--------------------------------------------------------- default_richards_with_silopmpio.ComputationalGrid.Lower.X = -10.0 default_richards_with_silopmpio.ComputationalGrid.Lower.Y = 10.0 default_richards_with_silopmpio.ComputationalGrid.Lower.Z = 1.0
# This runs the tilted-v catchment problem # similar to that in Kollet and Maxwell (2006) AWR # # Import the ParFlow TCL package # from parflow import Run BC_test = Run("BC_test", __file__) BC_test.FileVersion = 4 BC_test.Process.Topology.P = 1 BC_test.Process.Topology.Q = 2 BC_test.Process.Topology.R = 1 #--------------------------------------------------------- # Computational Grid #--------------------------------------------------------- BC_test.ComputationalGrid.Lower.X = 0.0 BC_test.ComputationalGrid.Lower.Y = 0.0 BC_test.ComputationalGrid.Lower.Z = 0.0 BC_test.ComputationalGrid.NX = 30 BC_test.ComputationalGrid.NY = 30 BC_test.ComputationalGrid.NZ = 30 BC_test.ComputationalGrid.DX = 10.0 BC_test.ComputationalGrid.DY = 10.0 BC_test.ComputationalGrid.DZ = .05 #---------------------------------------------------------
#--------------------------------------------------------- # Flux on the top surface #--------------------------------------------------------- rain_flux = -0.05 rec_flux = 0.0 #--------------------------------------------------------- # Import ParFlow #--------------------------------------------------------- from parflow import Run from parflow.tools.fs import mkdir, get_absolute_path wbx = Run("wbx", __file__) #--------------------------------------------------------- wbx.FileVersion = 4 #--------------------------------------------------------- # Processor topology #--------------------------------------------------------- wbx.Process.Topology.P = 1 wbx.Process.Topology.Q = 1 wbx.Process.Topology.R = 1 #--------------------------------------------------------- # Computational Grid
# This runs the tilted-v catchment problem # similar to that in Kollet and Maxwell (2006) AWR tcl_precision = 17 # set runname default_overland # # Import the ParFlow TCL package # from parflow import Run default_overland_pfmg_octree_jac = Run("default_overland_pfmg_octree_jac", __file__) default_overland_pfmg_octree_jac.FileVersion = 4 default_overland_pfmg_octree_jac.Process.Topology.P = 1 default_overland_pfmg_octree_jac.Process.Topology.Q = 1 default_overland_pfmg_octree_jac.Process.Topology.R = 1 #--------------------------------------------------------- # Computational Grid #--------------------------------------------------------- default_overland_pfmg_octree_jac.ComputationalGrid.Lower.X = 0.0 default_overland_pfmg_octree_jac.ComputationalGrid.Lower.Y = 0.0 default_overland_pfmg_octree_jac.ComputationalGrid.Lower.Z = 0.0 default_overland_pfmg_octree_jac.ComputationalGrid.NX = 30 default_overland_pfmg_octree_jac.ComputationalGrid.NY = 30 default_overland_pfmg_octree_jac.ComputationalGrid.NZ = 30 default_overland_pfmg_octree_jac.ComputationalGrid.DX = 10.0
#--------------------------------------------------------- # This runs a test case with the Richards' solver # with simple flow domains, like a wall or a fault. #--------------------------------------------------------- from parflow import Run from parflow.tools.fs import mkdir, get_absolute_path rbp = Run("rbp", __file__) #--------------------------------------------------------- rbp.FileVersion = 4 rbp.Process.Topology.P = 1 rbp.Process.Topology.Q = 1 rbp.Process.Topology.R = 1 #--------------------------------------------------------- # Computational Grid #--------------------------------------------------------- rbp.ComputationalGrid.Lower.X = 0.0 rbp.ComputationalGrid.Lower.Y = 0.0 rbp.ComputationalGrid.Lower.Z = 0.0 rbp.ComputationalGrid.DX = 1.0 rbp.ComputationalGrid.DY = 1.0 rbp.ComputationalGrid.DZ = 1.0 rbp.ComputationalGrid.NX = 20
#------------------------------------------------------------------ # This runs the basic pfmg test case based off of default richards # This run, as written in this input file, should take # 3 nonlinear iterations. #------------------------------------------------------------------ from parflow import Run from parflow.tools.fs import mkdir, get_absolute_path pfmg = Run("pfmg_octree", __file__) #------------------------------------------------------------------ pfmg.FileVersion = 4 pfmg.Process.Topology.P = 1 pfmg.Process.Topology.Q = 1 pfmg.Process.Topology.R = 1 #--------------------------------------------------------- # Computational Grid #--------------------------------------------------------- pfmg.ComputationalGrid.Lower.X = -10.0 pfmg.ComputationalGrid.Lower.Y = 10.0 pfmg.ComputationalGrid.Lower.Z = 1.0 pfmg.ComputationalGrid.DX = 8.8888888888888893 pfmg.ComputationalGrid.DY = 10.666666666666666 pfmg.ComputationalGrid.DZ = 1.0
# This runs a test case with the Richards' solver # with a simple flow domain and different BCs on the top. # The domain geometry is purposefully smaller than the computational grid # making more than 1/2 the domain inactive in Y. When run with topology # 1 2 1 this will test PF behavior for inactive processors, for different BCs # and solver configurations. # set runname richards_ptest_vdz tcl_precision = 17 # Import the ParFlow TCL package # from parflow import Run richards_box_proctest_vardz = Run("richards_box_proctest_vardz", __file__) richards_box_proctest_vardz.FileVersion = 4 richards_box_proctest_vardz.Process.Topology.P = 1 richards_box_proctest_vardz.Process.Topology.Q = 1 richards_box_proctest_vardz.Process.Topology.R = 1 #--------------------------------------------------------- # Computational Grid #--------------------------------------------------------- richards_box_proctest_vardz.ComputationalGrid.Lower.X = 0.0 richards_box_proctest_vardz.ComputationalGrid.Lower.Y = 0.0 richards_box_proctest_vardz.ComputationalGrid.Lower.Z = 0.0 richards_box_proctest_vardz.ComputationalGrid.DX = 1.0 richards_box_proctest_vardz.ComputationalGrid.DY = 1.0 richards_box_proctest_vardz.ComputationalGrid.DZ = 1.0
# Runs a simple sand draining problem, rectangular domain # with variable dz and a heterogenous subsurface with different K the top and bottom layers # Import the ParFlow TCL package # from parflow import Run var_dz_1D = Run("var_dz_1D", __file__) var_dz_1D.FileVersion = 4 var_dz_1D.Process.Topology.P = 1 var_dz_1D.Process.Topology.Q = 1 var_dz_1D.Process.Topology.R = 1 #--------------------------------------------------------- # Computational Grid #--------------------------------------------------------- var_dz_1D.ComputationalGrid.Lower.X = 0.0 var_dz_1D.ComputationalGrid.Lower.Y = 0.0 var_dz_1D.ComputationalGrid.Lower.Z = 0.0 var_dz_1D.ComputationalGrid.DX = 1.0 var_dz_1D.ComputationalGrid.DY = 1.0 var_dz_1D.ComputationalGrid.DZ = 0.1 var_dz_1D.ComputationalGrid.NX = 1 var_dz_1D.ComputationalGrid.NY = 1 var_dz_1D.ComputationalGrid.NZ = 14 #--------------------------------------------------------- # The Names of the GeomInputs
def test_fewer_land_names(clm): vegm_file = Path(get_absolute_path('drv_vegm.dat')) vegp_file = Path(get_absolute_path('drv_vegp.dat')) for path in (vegm_file, vegp_file): if path.exists(): path.unlink() CLMExporter(clm).write_map().write_parameters() new_clm = Run('clm', __file__) veg_params = new_clm.Solver.CLM.Vegetation.Parameters veg_map = new_clm.Solver.CLM.Vegetation.Map # Set only two land cover items veg_params.LandNames = 'forest_en forest_eb' CLMImporter(new_clm) \ .map_file(vegm_file) \ .parameters_file(vegp_file) assert veg_params.LandNames == ['forest_en', 'forest_eb'] assert 'water' not in veg_params.keys() assert 'water' not in veg_map.keys() veg_map.LandFrac.forest_en.Value = 0.6 veg_map.LandFrac.forest_eb.Value = 0.4 veg_map.LandFrac.forest_en.Type = 'Constant' veg_map.LandFrac.forest_eb.Type = 'Constant' new_clm.ComputationalGrid.NX = 5 new_clm.ComputationalGrid.NY = 5 CLMExporter(new_clm).write_map().write_parameters() vegm_data = read_clm(vegm_file, type='vegm') vegp_data = read_clm(vegp_file, type='vegp') # These should be 0.6 and 0.4 shape = vegm_data.shape[:2] assert np.array_equal(vegm_data[:, :, 5], np.full(shape, 0.6)) assert np.array_equal(vegm_data[:, :, 6], np.full(shape, 0.4)) # All of the vegm data after the 2 land types should be zero last_land_ind = 6 zeros = np.zeros(shape) for i in range(last_land_ind + 1, vegm_data.shape[2]): assert np.array_equal(vegm_data[:, :, i], zeros) # All of the vegp data after the second land type should be equal # to the default default_vegp = CLMExporter(new_clm)._default_vegp_values for key, val in vegp_data.items(): for i in range(2, len(val)): assert val[i] == default_vegp[key] # Make sure at least one of the other values is correct key = 'z0m' ind = 1 val = 2.2 assert vegp_data[key][ind] != default_vegp[key] assert vegp_data[key][ind] == val
# 0 = flat top (no overland flow) # 1 = slope to upper-y #--------------------------------------------------------- use_slopes = 1 #--------------------------------------------------------- # Flux on the top surface #--------------------------------------------------------- rain_flux = -0.05 rec_flux = 0.0 #--------------------------------------------------------- # Import the ParFlow TCL package #--------------------------------------------------------- from parflow import Run water_balance_y = Run("water_balance_y", __file__) #--------------------------------------------------------- # Name of the run #--------------------------------------------------------- # set runname water_balance water_balance_y.FileVersion = 4 #--------------------------------------------------------- # Processor topology #--------------------------------------------------------- water_balance_y.Process.Topology.P = 1 water_balance_y.Process.Topology.Q = 1 water_balance_y.Process.Topology.R = 1
#----------------------------------------------------------------------------- # Testing pfset with a .pfidb file #----------------------------------------------------------------------------- from pathlib import Path from parflow import Run from parflow.tools.fs import get_absolute_path dsingle = Run("dsingle", __file__) dsingle.pfset(pfidb_file=get_absolute_path( '$PF_SRC/test/correct_output/dsingle.pfidb.ref')) # Test pfidb generated, _ = dsingle.write() old_text = Path(generated).read_text() dsingle2 = Run.from_definition(generated) generated, _ = dsingle2.write() new_text = Path(generated).read_text() assert old_text and new_text assert old_text == new_text # Test yaml generated, _ = dsingle.write(file_format='yaml') old_text = Path(generated).read_text()
#----------------------------------------------------------------------------- # Test CLM with multiple reuse values for input. The same test is run # with different timesteps and reuse values set to match. E.G. 1s = reuse 1, 0.1s = reuse 10. #----------------------------------------------------------------------------- from parflow import Run from parflow.tools.fs import cp, mkdir, get_absolute_path clm = Run("clm_reuse", __file__) #----------------------------------------------------------------------------- # Copying input files #----------------------------------------------------------------------------- dir_name = get_absolute_path('test_output/clm_reuse') mkdir(dir_name) cp('$PF_SRC/test/tcl/clm/clm-reuse/drv_clmin.dat', dir_name) cp('$PF_SRC/test/tcl/clm/clm-reuse/drv_vegm.dat', dir_name) cp('$PF_SRC/test/tcl/clm/clm-reuse/drv_vegp.dat', dir_name) cp('$PF_SRC/test/tcl/clm/clm-reuse/forcing_1.txt', dir_name) #----------------------------------------------------------------------------- # Setting test variables #----------------------------------------------------------------------------- # Total runtime of simulation stopt = 100 # Reuse values to run with reuseValues = [1, 4]
#--------------------------------------------------------- # Testing overland flow diffusive wave # Running a parking lot sloping slab pointed in 8 directions # With diffusive BC options #--------------------------------------------------------- from parflow import Run from parflow.tools.fs import mkdir, get_absolute_path overland = Run("overland_slopingslab_DWE", __file__) #--------------------------------------------------------- overland.FileVersion = 4 overland.Process.Topology.P = 1 overland.Process.Topology.Q = 1 overland.Process.Topology.R = 1 #--------------------------------------------------------- # Computational Grid #--------------------------------------------------------- overland.ComputationalGrid.Lower.X = 0.0 overland.ComputationalGrid.Lower.Y = 0.0 overland.ComputationalGrid.Lower.Z = 0.0 overland.ComputationalGrid.NX = 5 overland.ComputationalGrid.NY = 5 overland.ComputationalGrid.NZ = 1
#--------------------------------------------------------- # This runs the tilted-v catchment problem # similar to that in Kollet and Maxwell (2006) AWR #--------------------------------------------------------- from parflow import Run from parflow.tools.fs import mkdir, get_absolute_path dover = Run("default_overland_pfmg_jac", __file__) #--------------------------------------------------------- dover.FileVersion = 4 dover.Process.Topology.P = 1 dover.Process.Topology.Q = 1 dover.Process.Topology.R = 1 #--------------------------------------------------------- # Computational Grid #--------------------------------------------------------- dover.ComputationalGrid.Lower.X = 0.0 dover.ComputationalGrid.Lower.Y = 0.0 dover.ComputationalGrid.Lower.Z = 0.0 dover.ComputationalGrid.NX = 30 dover.ComputationalGrid.NY = 30 dover.ComputationalGrid.NZ = 30 dover.ComputationalGrid.DX = 10.0
#----------------------------------------------------------------------------- # This runs the basic default_richards test case. # This run, as written in this input file, should take # 3 nonlinear iterations. #----------------------------------------------------------------------------- from parflow import Run from parflow.tools.fs import mkdir, get_absolute_path drich = Run("default_richards_wells", __file__) #--------------------------------------------------------- drich.FileVersion = 4 drich.Process.Topology.P = 1 drich.Process.Topology.Q = 1 drich.Process.Topology.R = 1 #--------------------------------------------------------- # Computational Grid #--------------------------------------------------------- drich.ComputationalGrid.Lower.X = -10.0 drich.ComputationalGrid.Lower.Y = 10.0 drich.ComputationalGrid.Lower.Z = 1.0 drich.ComputationalGrid.DX = 8.8888888888888893 drich.ComputationalGrid.DY = 10.666666666666666 drich.ComputationalGrid.DZ = 1.0
# This runs the basic default_richards test case. # This run, as written in this input file, should take # 3 nonlinear iterations. from parflow import Run from parflow.tools.fs import mkdir, get_absolute_path octree = Run("octree_simple", __file__) #--------------------------------------------------------- octree.FileVersion = 4 octree.Process.Topology.P = 1 octree.Process.Topology.Q = 1 octree.Process.Topology.R = 1 #----------------------------------------------------------------------------- # Computational Grid #----------------------------------------------------------------------------- octree.ComputationalGrid.Lower.X = -10.0 octree.ComputationalGrid.Lower.Y = 10.0 octree.ComputationalGrid.Lower.Z = 1.0 octree.ComputationalGrid.DX = 20.0 octree.ComputationalGrid.DY = 20.0 octree.ComputationalGrid.DZ = 1.0 octree.ComputationalGrid.NX = 8 octree.ComputationalGrid.NY = 8
#--------------------------------------------------------- # This runs a Little Washita test problem with variable dz # in spinup mode with overland dampening turned on #--------------------------------------------------------- from parflow import Run from parflow.tools.fs import cp, mkdir, chdir, get_absolute_path LWvdz = Run("LW_var_dz_spinup", __file__) #--------------------------------------------------------- # Copying slope files #--------------------------------------------------------- dir_name = get_absolute_path('test_output/LWvdz_s') mkdir(dir_name) chdir(dir_name) cp('$PF_SRC/test/input/lw.1km.slope_x.10x.pfb') cp('$PF_SRC/test/input/lw.1km.slope_y.10x.pfb') #--------------------------------------------------------- LWvdz.FileVersion = 4 LWvdz.Process.Topology.P = 1 LWvdz.Process.Topology.Q = 1 LWvdz.Process.Topology.R = 1 #--------------------------------------------------------- # Computational Grid
# This runs the basic default_richards test case. # This run, as written in this input file, should take # 3 nonlinear iterations. # # Import the ParFlow TCL package # from parflow import Run octree_simple = Run("octree_simple", __file__) octree_simple.FileVersion = 4 octree_simple.Process.Topology.P = 1 octree_simple.Process.Topology.Q = 1 octree_simple.Process.Topology.R = 1 #--------------------------------------------------------- # Computational Grid #--------------------------------------------------------- #----------------------------------------------------------------------------- # Computational Grid #----------------------------------------------------------------------------- octree_simple.ComputationalGrid.Lower.X = -10.0 octree_simple.ComputationalGrid.Lower.Y = 10.0 octree_simple.ComputationalGrid.Lower.Z = 1.0 octree_simple.ComputationalGrid.DX = 20.0 octree_simple.ComputationalGrid.DY = 20.0 octree_simple.ComputationalGrid.DZ = 1.0
tcl_precision = 17 # # Import the ParFlow TCL package # from parflow import Run extract_plane_z_equal_zero = Run("extract_plane_z_equal_zero", __file__) in_filename = [lindex $::argv 0] out_filename = [lindex $::argv 1] in_file = [pfload $in_filename] code = [catch {eval pfgetgrid $in_file} grid] # Extract grid size information dimension = [lindex $grid 0] origin = [lindex $grid 1] interval = [lindex $grid 2] nx = [lindex $dimension 0] ny = [lindex $dimension 1] nz = [lindex $dimension 2] x = [lindex $origin 0] y = [lindex $origin 1] z = [lindex $origin 2] dx = [lindex $interval 0] dy = [lindex $interval 1]
#----------------------------------------------------------------------------- # Testing pfset python function for setting keys that aren't in the library #----------------------------------------------------------------------------- import sys from parflow import Run from parflow.tools.fs import get_absolute_path pfset_test = Run('pfset_test', __file__) #----------------------------------------------------------------------------- # Domain #----------------------------------------------------------------------------- pfset_test.Domain.GeomName = 'domain' #--------------------------------------------------------- # The Names of the GeomInputs #--------------------------------------------------------- pfset_test.GeomInput.Names = "domain_input background_input source_region_input concen_region_input" #--------------------------------------------------------- # Domain Geometry Input #--------------------------------------------------------- pfset_test.GeomInput.domain_input.InputType = 'Box' pfset_test.GeomInput.domain_input.GeomName = 'domain' #--------------------------------------------------------- # Background Geometry Input #--------------------------------------------------------- pfset_test.GeomInput.background_input.InputType = 'Box' pfset_test.GeomInput.background_input.GeomName = 'background'
#----------------------------------------------------------------------------- # example for pfsol generation # Testing pfb to mask generation #----------------------------------------------------------------------------- from parflow import Run from parflow.tools.fs import get_absolute_path from parflow.tools.io import load_patch_matrix_from_pfb_file from parflow.tools.builders import SolidFileBuilder sabino = Run("sabino", __file__) #----------------------------------------------------------------------------- # Set Processor topology #----------------------------------------------------------------------------- sabino.Process.Topology.P = 1 sabino.Process.Topology.Q = 1 sabino.Process.Topology.R = 1 #----------------------------------------------------------------------------- # Computational Grid #----------------------------------------------------------------------------- sabino.ComputationalGrid.Lower.X = 0.0 sabino.ComputationalGrid.Lower.Y = 0.0 sabino.ComputationalGrid.Lower.Z = 0.0 sabino.ComputationalGrid.DX = 90.0 sabino.ComputationalGrid.DY = 90.0 sabino.ComputationalGrid.DZ = 100.0