Convert file types in Parflow - Wei64380/Parflow-CLM GitHub Wiki

  1. #Import the ParFlow TCL package

  2. lappend auto_path $env(PARFLOW_DIR)/bin

  3. package require parflow

  4. namespace import Parflow::*

  5. set tcl_precision 16

  6. #-----------------------------------------------------------------------------

  7. #File input version number

  8. #-----------------------------------------------------------------------------

  9. pfset FileVersion 4

  10. set runname LW

  11. #-----------------------------------------------------------------------------

  12. #Process Topology

  13. #-----------------------------------------------------------------------------

  14. pfset Process.Topology.P 2

  15. pfset Process.Topology.Q 1

  16. pfset Process.Topology.R 1

  17. #-----------------------------------------------------------------------------

  18. #Computational Grid

  19. #-----------------------------------------------------------------------------

  20. pfset ComputationalGrid.Lower.X 0.0

  21. pfset ComputationalGrid.Lower.Y 0.0

  22. pfset ComputationalGrid.Lower.Z 0.0

  23. pfset ComputationalGrid.DX 1000.0

  24. pfset ComputationalGrid.DY 1000.0

  25. pfset ComputationalGrid.DZ 2.0

  26. pfset ComputationalGrid.NX 41

  27. pfset ComputationalGrid.NY 41

  28. pfset ComputationalGrid.NZ 50

  29. #-----------------------------------------------------------------------------

  30. #Names of the GeomInputs

  31. #-----------------------------------------------------------------------------

  32. pfset GeomInput.Names "box_input indi_input"

  33. #-----------------------------------------------------------------------------

  34. #Domain Geometry Input

  35. #-----------------------------------------------------------------------------

  36. pfset GeomInput.box_input.InputType Box

  37. pfset GeomInput.box_input.GeomName domain

  38. #-----------------------------------------------------------------------------

  39. #Domain Geometry

  40. #-----------------------------------------------------------------------------

  41. pfset Geom.domain.Lower.X 0.0

  42. pfset Geom.domain.Lower.Y 0.0

  43. pfset Geom.domain.Lower.Z 0.0

  44. pfset Geom.domain.Upper.X 41000.0

  45. pfset Geom.domain.Upper.Y 41000.0

  46. pfset Geom.domain.Upper.Z 100.0

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

  48. #-----------------------------------------------------------------------------

  49. Domain

  50. #-----------------------------------------------------------------------------

  51. pfset Domain.GeomName "domain"

  52. pfundist $runname

  53. pfundist $runname.out.manning.pfb

  54. set mask [pfload $runname.out.mask.pfb]

  55. set slope_x [pfload LW.slopex.pfb]

  56. set slope_y [pfload LW.slopey.pfb]

  57. set top [Parflow::pfcomputetop $mask]

  58. set bottom [Parflow::pfcomputebottom $mask]

  59. set silonamemask [format "%s.mask.silo" $runname]

  60. set silonameslopex [format "%s.xslope.silo" $runname]

  61. set silonameslopey [format "%s.yslope.silo" $runname]

  62. pfsave $mask -silo $silonamemask

  63. pfsave $slope_x -silo $silonameslopex

  64. pfsave $slope_y -silo $silonameslopey

  65. set runnumb 73

  66. set verbose 1

  67. for {set i 1} {$i <= $runnumb} {incr i*5} {

  68. set pfbnamesaturation [format "%s.out.satur.%05d.pfb" $runname $i]

  69. set silonamesaturation [format "%s.out.satur.%05d.silo" $runname $i]

  70. set topsilonamesaturation [format "%s.out.satur.top.%05d.silo" $runname $i]

  71. set bottomsilonamesaturation [format "%s.out.satur.bottom.%05d.silo" $runname $i]

  72. set toptextsaturation [format "%s.out.satur.top.%05d.txt" $runname $i]

  73. set bottomtextsaturation [format "%s.out.satur.bottom.%05d.txt" $runname $i]

  74. set saturation [pfload $pfbnamesaturation]

  75. pfsave $saturation -silo $silonamesaturation

  76. set top_saturation [Parflow::pfextracttop $top $saturation]

  77. set bottom_saturation [Parflow::pfcomputebottom $bottom $saturation]

  78. pfsave $top_saturation -silo $topsilonamesaturation

  79. pfsave $bottom_saturation -silo $bottomsilonamesaturation

  80. pfsave $top_saturation -sa $toptextsaturation

  81. pfsave $bottom_saturation -sa $bottomtextsaturation

  82. }