rich_fbx.FBx.Type = 'PFBFile' rich_fbx.Geom.domain.FBx.FileName = 'Flow_Barrier_X.pfb' ## write flow boundary file FBx_data = np.full((20, 20, 20), 1.0) for i in range(20): for j in range(20): # from cell 10 (index 9) to cell 11 # reduction of 1E-3 FBx_data[i, j, 9] = 0.001 FBx_data_pfb = PFData(FBx_data) FBx_data_pfb.writeFile(get_absolute_path('Flow_Barrier_X.pfb')) FBx_data_pfb.close() rich_fbx.dist('Flow_Barrier_X.pfb') #----------------------------------------------------------------------------- # Wells #----------------------------------------------------------------------------- rich_fbx.Wells.Names = '' #----------------------------------------------------------------------------- # Time Cycles #----------------------------------------------------------------------------- rich_fbx.Cycle.Names = 'constant' rich_fbx.Cycle.constant.Names = 'alltime' rich_fbx.Cycle.constant.alltime.Length = 1 rich_fbx.Cycle.constant.Repeat = -1
LWvdz.TopoSlopesX.GeomNames = 'domain' LWvdz.TopoSlopesX.FileName = 'lw.1km.slope_x.10x.pfb' #--------------------------------------------------------- # Topo slopes in y-direction #--------------------------------------------------------- LWvdz.TopoSlopesY.Type = 'PFBFile' LWvdz.TopoSlopesY.GeomNames = 'domain' LWvdz.TopoSlopesY.FileName = 'lw.1km.slope_y.10x.pfb' #--------------------------------------------------------- # Distribute slopes #--------------------------------------------------------- LWvdz.dist('lw.1km.slope_x.10x.pfb') LWvdz.dist('lw.1km.slope_y.10x.pfb') #--------------------------------------------------------- # Mannings coefficient #--------------------------------------------------------- LWvdz.Mannings.Type = 'Constant' LWvdz.Mannings.GeomNames = 'domain' LWvdz.Mannings.Geom.domain.Value = 0.00005 #----------------------------------------------------------------------------- # Phase sources: #----------------------------------------------------------------------------- LWvdz.PhaseSources.water.Type = 'Constant'
rich_fby.FBy.Type = 'PFBFile' rich_fby.Geom.domain.FBy.FileName = 'Flow_Barrier_Y.pfb' ## write flow barrier file FBy_data = np.full((20, 20, 20), 1.0) for i in range(20): for j in range(20): # from cell 10 (index 9) to cell 11 # reduction of 1E-3 FBy_data[i, 9, j] = 0.001 FBy_data_pfb = PFData(FBy_data) FBy_data_pfb.writeFile(get_absolute_path('Flow_Barrier_Y.pfb')) FBy_data_pfb.close() rich_fby.dist('Flow_Barrier_Y.pfb') #----------------------------------------------------------------------------- # Wells #----------------------------------------------------------------------------- rich_fby.Wells.Names = '' #----------------------------------------------------------------------------- # Time Cycles #----------------------------------------------------------------------------- rich_fby.Cycle.Names = 'constant' rich_fby.Cycle.constant.Names = 'alltime' rich_fby.Cycle.constant.alltime.Length = 1 rich_fby.Cycle.constant.Repeat = -1
# Initial conditions: water pressure # ----------------------------------------------------------------------------- if reset == 1: sandtank.ICPressure.Type = 'HydroStaticPatch' sandtank.ICPressure.GeomNames = 'domain' sandtank.Geom.domain.ICPressure.Value = 30.0 sandtank.Geom.domain.ICPressure.RefGeom = 'domain' sandtank.Geom.domain.ICPressure.RefPatch = 'z_lower' else: fname_ic = f'./sandtank.out.press.{"{:0>5}".format(StartNumber)}.pfb' print(f'Initial Conditions: {fname_ic}') sandtank.ICPressure.Type = 'PFBFile' sandtank.ICPressure.GeomNames = 'domain' sandtank.Geom.domain.ICPressure.FileName = fname_ic sandtank.dist(fname_ic) # ----------------------------------------------------------------------------- # Generating random boundary conditions to run ensemble # ----------------------------------------------------------------------------- sandtank.dist('SandTank_Indicator.pfb') hleft_list = random.sample(range(0, 50), 10) hright_list = random.sample(range(0, 50), 10) for i in range(len(hleft_list)): new_name = f's_l{"{:0>2}".format(hleft_list[i])}_r' \ f'{"{:0>2}".format(hright_list[i])}' new_run = sandtank.clone(new_name) new_run.Patch.x_lower.BCPressure.alltime.Value = hleft_list[i]
ifield.Solver.PrintPressure = False ifield.Solver.PrintSaturation = False ifield.Solver.PrintConcentration = False ifield.Solver.WriteSiloSubsurfData = True ifield.Solver.WriteSiloPressure = True ifield.Solver.WriteSiloSaturation = True ifield.Solver.WriteSiloConcentration = True #----------------------------------------------------------------------------- # Ensure generated pfidb match our expectation #----------------------------------------------------------------------------- generatedFile, runId = ifield.write() # Prevent regression with open(generatedFile) as new, open( get_absolute_path( '$PF_SRC/test/correct_output/indicator_field.pfidb.ref')) as ref: if new.read() != ref.read(): print('Generated PFIDB does not match our expectation') sys.exit(1) #----------------------------------------------------------------------------- # Run and Unload the ParFlow output files #----------------------------------------------------------------------------- ifield.dist('small_domain_indicator_field.pfb') ifield.run()
nldas_files = [ 'NLDAS.DSWR.000001_to_000024.pfb', 'NLDAS.DLWR.000001_to_000024.pfb', 'NLDAS.APCP.000001_to_000024.pfb', 'NLDAS.Temp.000001_to_000024.pfb', 'NLDAS.UGRD.000001_to_000024.pfb', 'NLDAS.VGRD.000001_to_000024.pfb', 'NLDAS.Press.000001_to_000024.pfb', 'NLDAS.SPFH.000001_to_000024.pfb' ] for file in nldas_files: cp('$PF_SRC/test/tcl/washita/NLDAS/' + file, dir_name) washita.dist(dir_name + '/' + file, R=24) #----------------------------------------------------------------------------- washita.FileVersion = 4 #----------------------------------------------------------------------------- # Set Processor topology #----------------------------------------------------------------------------- washita.Process.Topology.P = 1 washita.Process.Topology.Q = 1 washita.Process.Topology.R = 1 #----------------------------------------------------------------------------- # Computational Grid #-----------------------------------------------------------------------------
clm_veg.Solver.LSM = 'CLM' clm_veg.Solver.WriteSiloCLM = True clm_veg.Solver.CLM.MetForcing = '1D' clm_veg.Solver.CLM.MetFileName = 'narr_1hr.sc3.txt.0' clm_veg.Solver.CLM.MetFilePath = '.' clm_veg.Solver.CLM.ForceVegetation = True clm_veg.Solver.WriteSiloEvapTrans = True clm_veg.Solver.WriteSiloOverlandBCFlux = True clm_veg.Solver.PrintCLM = True #--------------------------------------------------------- # Initial conditions: water pressure #--------------------------------------------------------- clm_veg.ICPressure.Type = 'HydroStaticPatch' clm_veg.ICPressure.GeomNames = 'domain' clm_veg.Geom.domain.ICPressure.Value = -2.0 clm_veg.Geom.domain.ICPressure.RefGeom = 'domain' clm_veg.Geom.domain.ICPressure.RefPatch = 'z_upper' #----------------------------------------------------------------------------- # Run and Unload the ParFlow output files #----------------------------------------------------------------------------- clm_veg.dist('veg_map.pfb') clm_veg.run()