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!