#----------------------------------------------------------------------------- # pfset: flat_map #----------------------------------------------------------------------------- pfset_test.pfset( flat_map={ 'Phase.Saturation.Type': 'VanGenuchten', 'Phase.Saturation.GeomNames': 'domain', }) pfset_test.Phase.pfset(flat_map={ 'RelPerm.Type': 'VanGenuchten', 'RelPerm.GeomNames': 'domain', }) #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- pfset_test.validate() generatedFile, runFile = pfset_test.write(file_format='yaml') # Prevent regression with open(generatedFile) as new, open( get_absolute_path( '$PF_SRC/test/correct_output/pfset_test.yaml.ref')) as ref: if new.read() == ref.read(): print('Success we have the same file') else: print('Files are different') sys.exit(1)
#----------------------------------------------------------------------------- # Exact solution specification for error calculations #----------------------------------------------------------------------------- drich.KnownSolution = 'NoKnownSolution' #----------------------------------------------------------------------------- # Set solver parameters #----------------------------------------------------------------------------- drich.Solver = 'Richards' drich.Solver.MaxIter = 5 drich.Solver.Nonlinear.MaxIter = -10 drich.Solver.Nonlinear.ResidualTol = 1e-9 drich.Solver.Nonlinear.EtaChoice = 'EtaConstant' drich.Solver.Nonlinear.EtaValue = 1e-5 drich.Solver.Nonlinear.UseJacobian = True drich.Solver.Nonlinear.DerivativeEpsilon = 1e-2 drich.Solver.Linear.KrylovDimension = 10 drich.Solver.Linear.Preconditioner = 'PFMG' #----------------------------------------------------------------------------- # Run ParFlow #----------------------------------------------------------------------------- drich.validate(verbose=False)
# Diffusive formulation #----------------------------------------------------------------------------- #run with Jacobian False overland_FlatICP.Patch.z_upper.BCPressure.Type = 'OverlandDiffusive' #----------------------------------------------------------------------------- # Testing version compatibility #----------------------------------------------------------------------------- print('=' * 80) print('Test with version 1.0.0 of ParFlow') print('=' * 80) set_parflow_version('1.0.0') nb_error_v1 = overland_FlatICP.validate() #----------------------------------------------------------------------------- print('=' * 80) print('Test with version 3.6.0 of ParFlow') print('=' * 80) set_parflow_version('3.6.0') nb_error_v3 = overland_FlatICP.validate() print('=' * 80) #----------------------------------------------------------------------------- # Asserts #-----------------------------------------------------------------------------
#--------------------------------------------------------- # Testing Python clone function #--------------------------------------------------------- import sys import os from parflow import Run from parflow.tools.fs import get_absolute_path test = Run('full_clone', __file__) test.pfset(yamlFile='$PF_SRC/test/correct_output/full_clone.yaml.ref', exit_if_undefined=True) #----------------------------------------------------------------------------- test.validate() generatedFile, runFile = test.write(file_format='yaml') # Prevent regression with open(generatedFile) as new, open(get_absolute_path('$PF_SRC/test/correct_output/full_clone.yaml.ref')) as ref: if new.read() == ref.read(): print('Success we have the same file') else: print('Files are different') sys.exit(1)
dover.Solver.Linear.KrylovDimension = 20 dover.Solver.Linear.MaxRestart = 2 dover.Solver.Linear.Preconditioner = 'PFMGOctree' dover.Solver.PrintSubsurf = False dover.Solver.Drop = 1E-20 dover.Solver.AbsTol = 1E-9 dover.Solver.WriteSiloSubsurfData = True dover.Solver.WriteSiloPressure = True dover.Solver.WriteSiloSaturation = True dover.Solver.WriteSiloConcentration = True #--------------------------------------------------------- # Initial conditions: water pressure #--------------------------------------------------------- # set water table to be at the bottom of the domain, the top layer is initially dry dover.ICPressure.Type = 'HydroStaticPatch' dover.ICPressure.GeomNames = 'domain' dover.Geom.domain.ICPressure.Value = -3.0 dover.Geom.domain.ICPressure.RefGeom = 'domain' dover.Geom.domain.ICPressure.RefPatch = 'z-upper' #----------------------------------------------------------------------------- # Run and Unload the ParFlow output files #----------------------------------------------------------------------------- dover.validate()
# Initial conditions: water pressure #--------------------------------------------------------- drich.ICPressure.Type = 'HydroStaticPatch' drich.ICPressure.GeomNames = 'domain' drich.Geom.domain.ICPressure.Value = 3.0 drich.Geom.domain.ICPressure.RefGeom = 'domain' drich.Geom.domain.ICPressure.RefPatch = 'bottom' #----------------------------------------------------------------------------- # Exact solution specification for error calculations #----------------------------------------------------------------------------- drich.KnownSolution = 'NoKnownSolution' #----------------------------------------------------------------------------- # Run ParFlow #----------------------------------------------------------------------------- drich.validate() drich.write(file_format='yaml') with open(get_absolute_path('drich.yaml')) as new, \ open(get_absolute_path('../../correct_output/default_richards.yaml.ref')) as ref: if new.read() == ref.read(): print('Success we have the same file') else: print('Files are different') sys.exit(1)