Saturday, August 30, 2008

patch order and solid files...

I've gotten a few emails regarding patch order and pfsolid files so I figured it was time to post something here. Solid files provide a lot of flexibility in boundary conditions but a few rules need to be followed. The order in which the patches are specified in the solid file needs to correspond to the order in which the patch names are specified in the tcl script. This is important because ParFlow does not know the names or attach any meaning to them; a bc could be named X1, x-upper, front or Cole and ParFlow really only knows it as "patch 0" -- the names are for our benefit.

If you use the pf_solid_file_create.f90 program I wrote in the /helper_codes directory, it has a specific patch order which is as follows (these are comments from the code starting at line 114):
! notes:
! patch(1,:) = upper surface (z = zmax)
! patch(2,:) = lower surface (z = z0)
! patch(3,:) = x = x0
! patch(4,:) = x = xmax
! patch(5,:) = y = y0
! patch(6,:) = y = ymax

This patch order corresponds to an input block in your tcl script and these need to match exactly as follows:
#---------------------------------------------------------
# The Names of the GeomInputs
#---------------------------------------------------------
pfset GeomInput.Names "solidinput"

pfset GeomInput.solidinput.InputType SolidFile
pfset GeomInput.solidinput.GeomNames domain
pfset GeomInput.solidinput.FileName mysolidfile.pfsol

pfset Geom.domain.Patches "z-upper z-lower x-lower x-upper y-lower y-upper"

The last line is the important one here as the names get assigned to a numbered list, z-upper is patch(1:) in the F90 code, z-lower is patch(2:), etc. This is the only connection between the solid file and ParFlow BC's, so it needs to be set up correctly. Once it is set up these named boundary pataches can be used to define initial and boundary states for the simulation.

Happy modeling!

-Reed

2 comments:

Laura said...

I am curious, how would a person use .pfsol files to create complicated boundary conditions (or not so complicated I guess). For instance, how would I impose two different recharge rates to the z-upper patch (even as simple as splitting z-upper in half, and applying one rate to one half and another rate to the other half)?

Reed Maxwell said...

The way to do this is to assign more than one patch to the upper surface. For example, the Forsyth2.tcl and Crater2D.tcl examples both use pfsolid files that have two patches on the upper surface. Once these patches are included and named (e.g. "infiltration", in the forsyth case) they need separate boundary condition information. In these cases there are seven, not six, boundary conditions needed. These BCs can be time dependent, of different type, etc-- very flexible.
If you look at the pfsolid files for one of these two cases (e.g. fors2_hf.pfsol you can just edit it as a text file) and use the file format described in manual on p77 (Sec 5.4) it is pretty easy to understand the points, triangles and patches. For relatively simple domains, such as rectangular but with multiple patches, it should be pretty easy to modify one of the example solid files by hand to fit your problem. There is also a fortran program to generate more complicated solid files in the helper directory.