From 02052a9c2eb111e7d4b501db2cf030212e1657c9 Mon Sep 17 00:00:00 2001 From: mjreno Date: Wed, 3 Apr 2024 09:16:42 -0400 Subject: [PATCH] feat(input): add package export option for layered input parameters (#1557) * add echo file option for layered input params * some naming adjustments * use per package export option to control writing variable layer array files * restore mf6ivar.py * silently create export files * post rebase definition update * add release note for export files --------- Co-authored-by: mjreno Co-authored-by: mjreno --- doc/ReleaseNotes/develop.tex | 2 +- doc/mf6io/mf6ivar/dfn/gwe-cnd.dfn | 9 + doc/mf6io/mf6ivar/dfn/gwe-dis.dfn | 8 + doc/mf6io/mf6ivar/dfn/gwe-disv.dfn | 9 + doc/mf6io/mf6ivar/dfn/gwe-ic.dfn | 11 + doc/mf6io/mf6ivar/dfn/gwf-dis.dfn | 8 + doc/mf6io/mf6ivar/dfn/gwf-disv.dfn | 9 + doc/mf6io/mf6ivar/dfn/gwf-ic.dfn | 11 + doc/mf6io/mf6ivar/dfn/gwf-npf.dfn | 9 + doc/mf6io/mf6ivar/dfn/gwt-dis.dfn | 8 + doc/mf6io/mf6ivar/dfn/gwt-disv.dfn | 9 + doc/mf6io/mf6ivar/dfn/gwt-dsp.dfn | 9 + doc/mf6io/mf6ivar/dfn/gwt-ic.dfn | 11 + doc/mf6io/mf6ivar/dfn/prt-dis.dfn | 8 + doc/mf6io/mf6ivar/dfn/prt-disv.dfn | 9 + doc/mf6io/mf6ivar/dfn/prt-mip.dfn | 9 + doc/mf6io/mf6ivar/dfn/swf-dis2d.dfn | 8 + doc/mf6io/mf6ivar/dfn/swf-disv.dfn | 9 + doc/mf6io/mf6ivar/dfn/swf-ic.dfn | 13 +- src/Idm/gwe-cndidm.f90 | 19 ++ src/Idm/gwe-disidm.f90 | 19 ++ src/Idm/gwe-disvidm.f90 | 19 ++ src/Idm/gwe-icidm.f90 | 19 ++ src/Idm/gwf-disidm.f90 | 19 ++ src/Idm/gwf-disvidm.f90 | 19 ++ src/Idm/gwf-icidm.f90 | 19 ++ src/Idm/gwf-npfidm.f90 | 19 ++ src/Idm/gwt-disidm.f90 | 19 ++ src/Idm/gwt-disvidm.f90 | 19 ++ src/Idm/gwt-dspidm.f90 | 19 ++ src/Idm/gwt-icidm.f90 | 19 ++ src/Idm/prt-disidm.f90 | 19 ++ src/Idm/prt-disvidm.f90 | 19 ++ src/Idm/prt-mipidm.f90 | 19 ++ src/Idm/swf-dis2didm.f90 | 19 ++ src/Idm/swf-disidm.f90 | 19 ++ src/Idm/swf-disvidm.f90 | 19 ++ src/Idm/swf-icidm.f90 | 19 ++ src/Utilities/Idm/IdmLogger.f90 | 240 ++++++++++++++++++ .../Idm/mf6blockfile/LoadMf6File.f90 | 78 +++++- 40 files changed, 832 insertions(+), 16 deletions(-) diff --git a/doc/ReleaseNotes/develop.tex b/doc/ReleaseNotes/develop.tex index 2c84d5886a8..fbab15b296b 100644 --- a/doc/ReleaseNotes/develop.tex +++ b/doc/ReleaseNotes/develop.tex @@ -6,7 +6,7 @@ \underline{NEW FUNCTIONALITY} \begin{itemize} \item A new Groundwater Energy (GWE) transport model is introduced to the code base for simulating heat transport in the subsurface. Additional information for activating the GWE model type within a MODFLOW 6 simulation is available within the mf6io.pdf document. New example problems have been developed for testing and demonstrating GWE capabilities (in addition to other internal tests that help verify the accuracy of GWE); however, additional changes to the code and input may be necessary in response to user needs and further testing. - % \item xxx + \item A new capability has been introduced to create parameter layer export files of user input data for packages including DIS, DISV, IC, NPF, DSP(GWT), MIP(PRT), and CND(GWE). The number of supported packages is expected to increase in the future. The capability can be turned on with the package EXPORT\_ARRAY\_ASCII option. The package parameter export set is pre-defined and currently focuses on griddata. The number of parameters per package may also increase in the future. % \item xxx \end{itemize} diff --git a/doc/mf6io/mf6ivar/dfn/gwe-cnd.dfn b/doc/mf6io/mf6ivar/dfn/gwe-cnd.dfn index e49626edf32..28d0865f51a 100644 --- a/doc/mf6io/mf6ivar/dfn/gwe-cnd.dfn +++ b/doc/mf6io/mf6ivar/dfn/gwe-cnd.dfn @@ -18,6 +18,15 @@ optional true longname xt3d on right-hand side description add xt3d terms to right-hand side, when possible. This option uses less memory, but may require more iterations. +block options +name export_array_ascii +type keyword +reader urword +optional true +mf6internal export_ascii +longname export array variables to layered ascii files. +description keyword that specifies input grid arrays, which already support the layered keyword, should be written to layered ascii output files. + # --------------------- gwe cnd griddata --------------------- block griddata diff --git a/doc/mf6io/mf6ivar/dfn/gwe-dis.dfn b/doc/mf6io/mf6ivar/dfn/gwe-dis.dfn index bb77bac782e..c3284d4a918 100644 --- a/doc/mf6io/mf6ivar/dfn/gwe-dis.dfn +++ b/doc/mf6io/mf6ivar/dfn/gwe-dis.dfn @@ -40,6 +40,14 @@ optional true longname rotation angle description counter-clockwise rotation angle (in degrees) of the lower-left corner of the model grid. If not specified, then a default value of 0.0 is assigned. The value for ANGROT does not affect the model simulation, but it is written to the binary grid file so that postprocessors can locate the grid in space. +block options +name export_array_ascii +type keyword +reader urword +optional true +mf6internal export_ascii +longname export array variables to layered ascii files. +description keyword that specifies input grid arrays, which already support the layered keyword, should be written to layered ascii output files. # --------------------- gwe dis dimensions --------------------- diff --git a/doc/mf6io/mf6ivar/dfn/gwe-disv.dfn b/doc/mf6io/mf6ivar/dfn/gwe-disv.dfn index b752a40b03c..05b46f96241 100644 --- a/doc/mf6io/mf6ivar/dfn/gwe-disv.dfn +++ b/doc/mf6io/mf6ivar/dfn/gwe-disv.dfn @@ -40,6 +40,15 @@ optional true longname rotation angle description counter-clockwise rotation angle (in degrees) of the model grid coordinate system relative to a real-world coordinate system. If not specified, then a default value of 0.0 is assigned. The value for ANGROT does not affect the model simulation, but it is written to the binary grid file so that postprocessors can locate the grid in space. +block options +name export_array_ascii +type keyword +reader urword +optional true +mf6internal export_ascii +longname export array variables to layered ascii files. +description keyword that specifies input grid arrays, which already support the layered keyword, should be written to layered ascii output files. + # --------------------- gwe disv dimensions --------------------- block dimensions diff --git a/doc/mf6io/mf6ivar/dfn/gwe-ic.dfn b/doc/mf6io/mf6ivar/dfn/gwe-ic.dfn index 0cda10416ba..1b3d08ec490 100644 --- a/doc/mf6io/mf6ivar/dfn/gwe-ic.dfn +++ b/doc/mf6io/mf6ivar/dfn/gwe-ic.dfn @@ -1,3 +1,14 @@ +# --------------------- gwe ic options --------------------- + +block options +name export_array_ascii +type keyword +reader urword +optional true +mf6internal export_ascii +longname export array variables to layered ascii files. +description keyword that specifies input grid arrays, which already support the layered keyword, should be written to layered ascii output files. + # --------------------- gwe ic griddata --------------------- block griddata diff --git a/doc/mf6io/mf6ivar/dfn/gwf-dis.dfn b/doc/mf6io/mf6ivar/dfn/gwf-dis.dfn index aa3316f38e3..26569f3d701 100644 --- a/doc/mf6io/mf6ivar/dfn/gwf-dis.dfn +++ b/doc/mf6io/mf6ivar/dfn/gwf-dis.dfn @@ -40,6 +40,14 @@ optional true longname rotation angle description counter-clockwise rotation angle (in degrees) of the lower-left corner of the model grid. If not specified, then a default value of 0.0 is assigned. The value for ANGROT does not affect the model simulation, but it is written to the binary grid file so that postprocessors can locate the grid in space. +block options +name export_array_ascii +type keyword +reader urword +optional true +mf6internal export_ascii +longname export array variables to layered ascii files. +description keyword that specifies input grid arrays, which already support the layered keyword, should be written to layered ascii output files. # --------------------- gwf dis dimensions --------------------- diff --git a/doc/mf6io/mf6ivar/dfn/gwf-disv.dfn b/doc/mf6io/mf6ivar/dfn/gwf-disv.dfn index c6bab33389e..ec685f7ba84 100644 --- a/doc/mf6io/mf6ivar/dfn/gwf-disv.dfn +++ b/doc/mf6io/mf6ivar/dfn/gwf-disv.dfn @@ -40,6 +40,15 @@ optional true longname rotation angle description counter-clockwise rotation angle (in degrees) of the model grid coordinate system relative to a real-world coordinate system. If not specified, then a default value of 0.0 is assigned. The value for ANGROT does not affect the model simulation, but it is written to the binary grid file so that postprocessors can locate the grid in space. +block options +name export_array_ascii +type keyword +reader urword +optional true +mf6internal export_ascii +longname export array variables to layered ascii files. +description keyword that specifies input grid arrays, which already support the layered keyword, should be written to layered ascii output files. + # --------------------- gwf disv dimensions --------------------- block dimensions diff --git a/doc/mf6io/mf6ivar/dfn/gwf-ic.dfn b/doc/mf6io/mf6ivar/dfn/gwf-ic.dfn index be93d342caa..dd4560f6ccb 100644 --- a/doc/mf6io/mf6ivar/dfn/gwf-ic.dfn +++ b/doc/mf6io/mf6ivar/dfn/gwf-ic.dfn @@ -1,3 +1,14 @@ +# --------------------- gwf ic options --------------------- + +block options +name export_array_ascii +type keyword +reader urword +optional true +mf6internal export_ascii +longname export array variables to layered ascii files. +description keyword that specifies input grid arrays, which already support the layered keyword, should be written to layered ascii output files. + # --------------------- gwf ic griddata --------------------- block griddata diff --git a/doc/mf6io/mf6ivar/dfn/gwf-npf.dfn b/doc/mf6io/mf6ivar/dfn/gwf-npf.dfn index 8da4e40e484..f35b3527877 100644 --- a/doc/mf6io/mf6ivar/dfn/gwf-npf.dfn +++ b/doc/mf6io/mf6ivar/dfn/gwf-npf.dfn @@ -224,6 +224,15 @@ tagged false longname file name of TVK information description defines a time-varying hydraulic conductivity (TVK) input file. Records in the TVK file can be used to change hydraulic conductivity properties at specified times or stress periods. +block options +name export_array_ascii +type keyword +reader urword +optional true +mf6internal export_ascii +longname export array variables to layered ascii files. +description keyword that specifies input grid arrays, which already support the layered keyword, should be written to layered ascii output files. + # dev options block options diff --git a/doc/mf6io/mf6ivar/dfn/gwt-dis.dfn b/doc/mf6io/mf6ivar/dfn/gwt-dis.dfn index d36f24ed837..4c8a94de344 100644 --- a/doc/mf6io/mf6ivar/dfn/gwt-dis.dfn +++ b/doc/mf6io/mf6ivar/dfn/gwt-dis.dfn @@ -40,6 +40,14 @@ optional true longname rotation angle description counter-clockwise rotation angle (in degrees) of the lower-left corner of the model grid. If not specified, then a default value of 0.0 is assigned. The value for ANGROT does not affect the model simulation, but it is written to the binary grid file so that postprocessors can locate the grid in space. +block options +name export_array_ascii +type keyword +reader urword +optional true +mf6internal export_ascii +longname export array variables to layered ascii files. +description keyword that specifies input grid arrays, which already support the layered keyword, should be written to layered ascii output files. # --------------------- gwt dis dimensions --------------------- diff --git a/doc/mf6io/mf6ivar/dfn/gwt-disv.dfn b/doc/mf6io/mf6ivar/dfn/gwt-disv.dfn index 376c0e2d532..062fb01f169 100644 --- a/doc/mf6io/mf6ivar/dfn/gwt-disv.dfn +++ b/doc/mf6io/mf6ivar/dfn/gwt-disv.dfn @@ -40,6 +40,15 @@ optional true longname rotation angle description counter-clockwise rotation angle (in degrees) of the model grid coordinate system relative to a real-world coordinate system. If not specified, then a default value of 0.0 is assigned. The value for ANGROT does not affect the model simulation, but it is written to the binary grid file so that postprocessors can locate the grid in space. +block options +name export_array_ascii +type keyword +reader urword +optional true +mf6internal export_ascii +longname export array variables to layered ascii files. +description keyword that specifies input grid arrays, which already support the layered keyword, should be written to layered ascii output files. + # --------------------- gwt disv dimensions --------------------- block dimensions diff --git a/doc/mf6io/mf6ivar/dfn/gwt-dsp.dfn b/doc/mf6io/mf6ivar/dfn/gwt-dsp.dfn index ff97e20f478..1ec2fec57a7 100644 --- a/doc/mf6io/mf6ivar/dfn/gwt-dsp.dfn +++ b/doc/mf6io/mf6ivar/dfn/gwt-dsp.dfn @@ -18,6 +18,15 @@ optional true longname xt3d on right-hand side description add xt3d terms to right-hand side, when possible. This option uses less memory, but may require more iterations. +block options +name export_array_ascii +type keyword +reader urword +optional true +mf6internal export_ascii +longname export array variables to layered ascii files. +description keyword that specifies input grid arrays, which already support the layered keyword, should be written to layered ascii output files. + # --------------------- gwt dsp griddata --------------------- block griddata diff --git a/doc/mf6io/mf6ivar/dfn/gwt-ic.dfn b/doc/mf6io/mf6ivar/dfn/gwt-ic.dfn index 35dc565f24e..51605cefdd8 100644 --- a/doc/mf6io/mf6ivar/dfn/gwt-ic.dfn +++ b/doc/mf6io/mf6ivar/dfn/gwt-ic.dfn @@ -1,3 +1,14 @@ +# --------------------- gwt ic options --------------------- + +block options +name export_array_ascii +type keyword +reader urword +optional true +mf6internal export_ascii +longname export array variables to layered ascii files. +description keyword that specifies input grid arrays, which already support the layered keyword, should be written to layered ascii output files. + # --------------------- gwt ic griddata --------------------- block griddata diff --git a/doc/mf6io/mf6ivar/dfn/prt-dis.dfn b/doc/mf6io/mf6ivar/dfn/prt-dis.dfn index c749650c064..9a37d7a4f61 100644 --- a/doc/mf6io/mf6ivar/dfn/prt-dis.dfn +++ b/doc/mf6io/mf6ivar/dfn/prt-dis.dfn @@ -40,6 +40,14 @@ optional true longname rotation angle description counter-clockwise rotation angle (in degrees) of the lower-left corner of the model grid. If not specified, then a default value of 0.0 is assigned. The value for ANGROT does not affect the model simulation, but it is written to the binary grid file so that postprocessors can locate the grid in space. +block options +name export_array_ascii +type keyword +reader urword +optional true +mf6internal export_ascii +longname export array variables to layered ascii files. +description keyword that specifies input grid arrays, which already support the layered keyword, should be written to layered ascii output files. # --------------------- prt dis dimensions --------------------- diff --git a/doc/mf6io/mf6ivar/dfn/prt-disv.dfn b/doc/mf6io/mf6ivar/dfn/prt-disv.dfn index 8ff2a422132..d2f238c644c 100644 --- a/doc/mf6io/mf6ivar/dfn/prt-disv.dfn +++ b/doc/mf6io/mf6ivar/dfn/prt-disv.dfn @@ -40,6 +40,15 @@ optional true longname rotation angle description counter-clockwise rotation angle (in degrees) of the model grid coordinate system relative to a real-world coordinate system. If not specified, then a default value of 0.0 is assigned. The value for ANGROT does not affect the model simulation, but it is written to the binary grid file so that postprocessors can locate the grid in space. +block options +name export_array_ascii +type keyword +reader urword +optional true +mf6internal export_ascii +longname export array variables to layered ascii files. +description keyword that specifies input grid arrays, which already support the layered keyword, should be written to layered ascii output files. + # --------------------- prt disv dimensions --------------------- block dimensions diff --git a/doc/mf6io/mf6ivar/dfn/prt-mip.dfn b/doc/mf6io/mf6ivar/dfn/prt-mip.dfn index 34f0e6048a9..a993a10d410 100644 --- a/doc/mf6io/mf6ivar/dfn/prt-mip.dfn +++ b/doc/mf6io/mf6ivar/dfn/prt-mip.dfn @@ -8,6 +8,15 @@ optional true longname zero method description the root finding algorithm to solve ternary subcells. 0 euler, 1 brent, 2 chandrupatla, 3 test. +block options +name export_array_ascii +type keyword +reader urword +optional true +mf6internal export_ascii +longname export array variables to layered ascii files. +description keyword that specifies input grid arrays, which already support the layered keyword, should be written to layered ascii output files. + # --------------------- prt mip griddata --------------------- block griddata diff --git a/doc/mf6io/mf6ivar/dfn/swf-dis2d.dfn b/doc/mf6io/mf6ivar/dfn/swf-dis2d.dfn index 02b82dc0b2c..b82e31abc93 100644 --- a/doc/mf6io/mf6ivar/dfn/swf-dis2d.dfn +++ b/doc/mf6io/mf6ivar/dfn/swf-dis2d.dfn @@ -40,6 +40,14 @@ optional true longname rotation angle description counter-clockwise rotation angle (in degrees) of the lower-left corner of the model grid. If not specified, then a default value of 0.0 is assigned. The value for ANGROT does not affect the model simulation, but it is written to the binary grid file so that postprocessors can locate the grid in space. +block options +name export_array_ascii +type keyword +reader urword +optional true +mf6internal export_ascii +longname export array variables to layered ascii files. +description keyword that specifies input grid arrays, which already support the layered keyword, should be written to layered ascii output files. # --------------------- swf dis2d dimensions --------------------- diff --git a/doc/mf6io/mf6ivar/dfn/swf-disv.dfn b/doc/mf6io/mf6ivar/dfn/swf-disv.dfn index 376c0e2d532..062fb01f169 100644 --- a/doc/mf6io/mf6ivar/dfn/swf-disv.dfn +++ b/doc/mf6io/mf6ivar/dfn/swf-disv.dfn @@ -40,6 +40,15 @@ optional true longname rotation angle description counter-clockwise rotation angle (in degrees) of the model grid coordinate system relative to a real-world coordinate system. If not specified, then a default value of 0.0 is assigned. The value for ANGROT does not affect the model simulation, but it is written to the binary grid file so that postprocessors can locate the grid in space. +block options +name export_array_ascii +type keyword +reader urword +optional true +mf6internal export_ascii +longname export array variables to layered ascii files. +description keyword that specifies input grid arrays, which already support the layered keyword, should be written to layered ascii output files. + # --------------------- gwt disv dimensions --------------------- block dimensions diff --git a/doc/mf6io/mf6ivar/dfn/swf-ic.dfn b/doc/mf6io/mf6ivar/dfn/swf-ic.dfn index 9cff10a3247..a06580e3ed8 100644 --- a/doc/mf6io/mf6ivar/dfn/swf-ic.dfn +++ b/doc/mf6io/mf6ivar/dfn/swf-ic.dfn @@ -1,4 +1,15 @@ -# --------------------- gwt ic griddata --------------------- +# --------------------- swf ic options --------------------- + +block options +name export_array_ascii +type keyword +reader urword +optional true +mf6internal export_ascii +longname export array variables to layered ascii files. +description keyword that specifies input grid arrays, which already support the layered keyword, should be written to layered ascii output files. + +# --------------------- swf ic griddata --------------------- block griddata name strt diff --git a/src/Idm/gwe-cndidm.f90 b/src/Idm/gwe-cndidm.f90 index 9757a46bcc1..43beafaa1c6 100644 --- a/src/Idm/gwe-cndidm.f90 +++ b/src/Idm/gwe-cndidm.f90 @@ -13,6 +13,7 @@ module GweCndInputModule type GweCndParamFoundType logical :: xt3d_off = .false. logical :: xt3d_rhs = .false. + logical :: export_ascii = .false. logical :: alh = .false. logical :: alv = .false. logical :: ath1 = .false. @@ -58,6 +59,23 @@ module GweCndInputModule .false. & ! timeseries ) + type(InputParamDefinitionType), parameter :: & + gwecnd_export_ascii = InputParamDefinitionType & + ( & + 'GWE', & ! component + 'CND', & ! subcomponent + 'OPTIONS', & ! block + 'EXPORT_ARRAY_ASCII', & ! tag name + 'EXPORT_ASCII', & ! fortran variable + 'KEYWORD', & ! type + '', & ! shape + .false., & ! required + .false., & ! multi-record + .false., & ! preserve case + .false., & ! layered + .false. & ! timeseries + ) + type(InputParamDefinitionType), parameter :: & gwecnd_alh = InputParamDefinitionType & ( & @@ -182,6 +200,7 @@ module GweCndInputModule [ & gwecnd_xt3d_off, & gwecnd_xt3d_rhs, & + gwecnd_export_ascii, & gwecnd_alh, & gwecnd_alv, & gwecnd_ath1, & diff --git a/src/Idm/gwe-disidm.f90 b/src/Idm/gwe-disidm.f90 index cda16809731..b9c538328fe 100644 --- a/src/Idm/gwe-disidm.f90 +++ b/src/Idm/gwe-disidm.f90 @@ -16,6 +16,7 @@ module GweDisInputModule logical :: xorigin = .false. logical :: yorigin = .false. logical :: angrot = .false. + logical :: export_ascii = .false. logical :: nlay = .false. logical :: nrow = .false. logical :: ncol = .false. @@ -113,6 +114,23 @@ module GweDisInputModule .false. & ! timeseries ) + type(InputParamDefinitionType), parameter :: & + gwedis_export_ascii = InputParamDefinitionType & + ( & + 'GWE', & ! component + 'DIS', & ! subcomponent + 'OPTIONS', & ! block + 'EXPORT_ARRAY_ASCII', & ! tag name + 'EXPORT_ASCII', & ! fortran variable + 'KEYWORD', & ! type + '', & ! shape + .false., & ! required + .false., & ! multi-record + .false., & ! preserve case + .false., & ! layered + .false. & ! timeseries + ) + type(InputParamDefinitionType), parameter :: & gwedis_nlay = InputParamDefinitionType & ( & @@ -257,6 +275,7 @@ module GweDisInputModule gwedis_xorigin, & gwedis_yorigin, & gwedis_angrot, & + gwedis_export_ascii, & gwedis_nlay, & gwedis_nrow, & gwedis_ncol, & diff --git a/src/Idm/gwe-disvidm.f90 b/src/Idm/gwe-disvidm.f90 index e109482271f..bf36ed545a6 100644 --- a/src/Idm/gwe-disvidm.f90 +++ b/src/Idm/gwe-disvidm.f90 @@ -16,6 +16,7 @@ module GweDisvInputModule logical :: xorigin = .false. logical :: yorigin = .false. logical :: angrot = .false. + logical :: export_ascii = .false. logical :: nlay = .false. logical :: ncpl = .false. logical :: nvert = .false. @@ -119,6 +120,23 @@ module GweDisvInputModule .false. & ! timeseries ) + type(InputParamDefinitionType), parameter :: & + gwedisv_export_ascii = InputParamDefinitionType & + ( & + 'GWE', & ! component + 'DISV', & ! subcomponent + 'OPTIONS', & ! block + 'EXPORT_ARRAY_ASCII', & ! tag name + 'EXPORT_ASCII', & ! fortran variable + 'KEYWORD', & ! type + '', & ! shape + .false., & ! required + .false., & ! multi-record + .false., & ! preserve case + .false., & ! layered + .false. & ! timeseries + ) + type(InputParamDefinitionType), parameter :: & gwedisv_nlay = InputParamDefinitionType & ( & @@ -365,6 +383,7 @@ module GweDisvInputModule gwedisv_xorigin, & gwedisv_yorigin, & gwedisv_angrot, & + gwedisv_export_ascii, & gwedisv_nlay, & gwedisv_ncpl, & gwedisv_nvert, & diff --git a/src/Idm/gwe-icidm.f90 b/src/Idm/gwe-icidm.f90 index 95dd79e256d..ba5694bb75f 100644 --- a/src/Idm/gwe-icidm.f90 +++ b/src/Idm/gwe-icidm.f90 @@ -11,11 +11,29 @@ module GweIcInputModule public gwe_ic_multi_package type GweIcParamFoundType + logical :: export_ascii = .false. logical :: strt = .false. end type GweIcParamFoundType logical :: gwe_ic_multi_package = .false. + type(InputParamDefinitionType), parameter :: & + gweic_export_ascii = InputParamDefinitionType & + ( & + 'GWE', & ! component + 'IC', & ! subcomponent + 'OPTIONS', & ! block + 'EXPORT_ARRAY_ASCII', & ! tag name + 'EXPORT_ASCII', & ! fortran variable + 'KEYWORD', & ! type + '', & ! shape + .false., & ! required + .false., & ! multi-record + .false., & ! preserve case + .false., & ! layered + .false. & ! timeseries + ) + type(InputParamDefinitionType), parameter :: & gweic_strt = InputParamDefinitionType & ( & @@ -36,6 +54,7 @@ module GweIcInputModule type(InputParamDefinitionType), parameter :: & gwe_ic_param_definitions(*) = & [ & + gweic_export_ascii, & gweic_strt & ] diff --git a/src/Idm/gwf-disidm.f90 b/src/Idm/gwf-disidm.f90 index 35a4db3f326..358df5e544b 100644 --- a/src/Idm/gwf-disidm.f90 +++ b/src/Idm/gwf-disidm.f90 @@ -16,6 +16,7 @@ module GwfDisInputModule logical :: xorigin = .false. logical :: yorigin = .false. logical :: angrot = .false. + logical :: export_ascii = .false. logical :: nlay = .false. logical :: nrow = .false. logical :: ncol = .false. @@ -113,6 +114,23 @@ module GwfDisInputModule .false. & ! timeseries ) + type(InputParamDefinitionType), parameter :: & + gwfdis_export_ascii = InputParamDefinitionType & + ( & + 'GWF', & ! component + 'DIS', & ! subcomponent + 'OPTIONS', & ! block + 'EXPORT_ARRAY_ASCII', & ! tag name + 'EXPORT_ASCII', & ! fortran variable + 'KEYWORD', & ! type + '', & ! shape + .false., & ! required + .false., & ! multi-record + .false., & ! preserve case + .false., & ! layered + .false. & ! timeseries + ) + type(InputParamDefinitionType), parameter :: & gwfdis_nlay = InputParamDefinitionType & ( & @@ -257,6 +275,7 @@ module GwfDisInputModule gwfdis_xorigin, & gwfdis_yorigin, & gwfdis_angrot, & + gwfdis_export_ascii, & gwfdis_nlay, & gwfdis_nrow, & gwfdis_ncol, & diff --git a/src/Idm/gwf-disvidm.f90 b/src/Idm/gwf-disvidm.f90 index 657d138186f..5f028cd764a 100644 --- a/src/Idm/gwf-disvidm.f90 +++ b/src/Idm/gwf-disvidm.f90 @@ -16,6 +16,7 @@ module GwfDisvInputModule logical :: xorigin = .false. logical :: yorigin = .false. logical :: angrot = .false. + logical :: export_ascii = .false. logical :: nlay = .false. logical :: ncpl = .false. logical :: nvert = .false. @@ -119,6 +120,23 @@ module GwfDisvInputModule .false. & ! timeseries ) + type(InputParamDefinitionType), parameter :: & + gwfdisv_export_ascii = InputParamDefinitionType & + ( & + 'GWF', & ! component + 'DISV', & ! subcomponent + 'OPTIONS', & ! block + 'EXPORT_ARRAY_ASCII', & ! tag name + 'EXPORT_ASCII', & ! fortran variable + 'KEYWORD', & ! type + '', & ! shape + .false., & ! required + .false., & ! multi-record + .false., & ! preserve case + .false., & ! layered + .false. & ! timeseries + ) + type(InputParamDefinitionType), parameter :: & gwfdisv_nlay = InputParamDefinitionType & ( & @@ -365,6 +383,7 @@ module GwfDisvInputModule gwfdisv_xorigin, & gwfdisv_yorigin, & gwfdisv_angrot, & + gwfdisv_export_ascii, & gwfdisv_nlay, & gwfdisv_ncpl, & gwfdisv_nvert, & diff --git a/src/Idm/gwf-icidm.f90 b/src/Idm/gwf-icidm.f90 index f943a35dc98..ec39a109cc6 100644 --- a/src/Idm/gwf-icidm.f90 +++ b/src/Idm/gwf-icidm.f90 @@ -11,11 +11,29 @@ module GwfIcInputModule public gwf_ic_multi_package type GwfIcParamFoundType + logical :: export_ascii = .false. logical :: strt = .false. end type GwfIcParamFoundType logical :: gwf_ic_multi_package = .false. + type(InputParamDefinitionType), parameter :: & + gwfic_export_ascii = InputParamDefinitionType & + ( & + 'GWF', & ! component + 'IC', & ! subcomponent + 'OPTIONS', & ! block + 'EXPORT_ARRAY_ASCII', & ! tag name + 'EXPORT_ASCII', & ! fortran variable + 'KEYWORD', & ! type + '', & ! shape + .false., & ! required + .false., & ! multi-record + .false., & ! preserve case + .false., & ! layered + .false. & ! timeseries + ) + type(InputParamDefinitionType), parameter :: & gwfic_strt = InputParamDefinitionType & ( & @@ -36,6 +54,7 @@ module GwfIcInputModule type(InputParamDefinitionType), parameter :: & gwf_ic_param_definitions(*) = & [ & + gwfic_export_ascii, & gwfic_strt & ] diff --git a/src/Idm/gwf-npfidm.f90 b/src/Idm/gwf-npfidm.f90 index 1915c11a9f3..0587978e09f 100644 --- a/src/Idm/gwf-npfidm.f90 +++ b/src/Idm/gwf-npfidm.f90 @@ -35,6 +35,7 @@ module GwfNpfInputModule logical :: tvk6 = .false. logical :: filein = .false. logical :: tvk6_filename = .false. + logical :: export_ascii = .false. logical :: inewton = .false. logical :: satomega = .false. logical :: icelltype = .false. @@ -457,6 +458,23 @@ module GwfNpfInputModule .false. & ! timeseries ) + type(InputParamDefinitionType), parameter :: & + gwfnpf_export_ascii = InputParamDefinitionType & + ( & + 'GWF', & ! component + 'NPF', & ! subcomponent + 'OPTIONS', & ! block + 'EXPORT_ARRAY_ASCII', & ! tag name + 'EXPORT_ASCII', & ! fortran variable + 'KEYWORD', & ! type + '', & ! shape + .false., & ! required + .false., & ! multi-record + .false., & ! preserve case + .false., & ! layered + .false. & ! timeseries + ) + type(InputParamDefinitionType), parameter :: & gwfnpf_inewton = InputParamDefinitionType & ( & @@ -654,6 +672,7 @@ module GwfNpfInputModule gwfnpf_tvk6, & gwfnpf_filein, & gwfnpf_tvk6_filename, & + gwfnpf_export_ascii, & gwfnpf_inewton, & gwfnpf_satomega, & gwfnpf_icelltype, & diff --git a/src/Idm/gwt-disidm.f90 b/src/Idm/gwt-disidm.f90 index 9a0330c9461..90ee1241e21 100644 --- a/src/Idm/gwt-disidm.f90 +++ b/src/Idm/gwt-disidm.f90 @@ -16,6 +16,7 @@ module GwtDisInputModule logical :: xorigin = .false. logical :: yorigin = .false. logical :: angrot = .false. + logical :: export_ascii = .false. logical :: nlay = .false. logical :: nrow = .false. logical :: ncol = .false. @@ -113,6 +114,23 @@ module GwtDisInputModule .false. & ! timeseries ) + type(InputParamDefinitionType), parameter :: & + gwtdis_export_ascii = InputParamDefinitionType & + ( & + 'GWT', & ! component + 'DIS', & ! subcomponent + 'OPTIONS', & ! block + 'EXPORT_ARRAY_ASCII', & ! tag name + 'EXPORT_ASCII', & ! fortran variable + 'KEYWORD', & ! type + '', & ! shape + .false., & ! required + .false., & ! multi-record + .false., & ! preserve case + .false., & ! layered + .false. & ! timeseries + ) + type(InputParamDefinitionType), parameter :: & gwtdis_nlay = InputParamDefinitionType & ( & @@ -257,6 +275,7 @@ module GwtDisInputModule gwtdis_xorigin, & gwtdis_yorigin, & gwtdis_angrot, & + gwtdis_export_ascii, & gwtdis_nlay, & gwtdis_nrow, & gwtdis_ncol, & diff --git a/src/Idm/gwt-disvidm.f90 b/src/Idm/gwt-disvidm.f90 index 615cc025374..96b1d58bb37 100644 --- a/src/Idm/gwt-disvidm.f90 +++ b/src/Idm/gwt-disvidm.f90 @@ -16,6 +16,7 @@ module GwtDisvInputModule logical :: xorigin = .false. logical :: yorigin = .false. logical :: angrot = .false. + logical :: export_ascii = .false. logical :: nlay = .false. logical :: ncpl = .false. logical :: nvert = .false. @@ -119,6 +120,23 @@ module GwtDisvInputModule .false. & ! timeseries ) + type(InputParamDefinitionType), parameter :: & + gwtdisv_export_ascii = InputParamDefinitionType & + ( & + 'GWT', & ! component + 'DISV', & ! subcomponent + 'OPTIONS', & ! block + 'EXPORT_ARRAY_ASCII', & ! tag name + 'EXPORT_ASCII', & ! fortran variable + 'KEYWORD', & ! type + '', & ! shape + .false., & ! required + .false., & ! multi-record + .false., & ! preserve case + .false., & ! layered + .false. & ! timeseries + ) + type(InputParamDefinitionType), parameter :: & gwtdisv_nlay = InputParamDefinitionType & ( & @@ -365,6 +383,7 @@ module GwtDisvInputModule gwtdisv_xorigin, & gwtdisv_yorigin, & gwtdisv_angrot, & + gwtdisv_export_ascii, & gwtdisv_nlay, & gwtdisv_ncpl, & gwtdisv_nvert, & diff --git a/src/Idm/gwt-dspidm.f90 b/src/Idm/gwt-dspidm.f90 index 8b7a4e74332..ccab6b36aef 100644 --- a/src/Idm/gwt-dspidm.f90 +++ b/src/Idm/gwt-dspidm.f90 @@ -13,6 +13,7 @@ module GwtDspInputModule type GwtDspParamFoundType logical :: xt3d_off = .false. logical :: xt3d_rhs = .false. + logical :: export_ascii = .false. logical :: diffc = .false. logical :: alh = .false. logical :: alv = .false. @@ -57,6 +58,23 @@ module GwtDspInputModule .false. & ! timeseries ) + type(InputParamDefinitionType), parameter :: & + gwtdsp_export_ascii = InputParamDefinitionType & + ( & + 'GWT', & ! component + 'DSP', & ! subcomponent + 'OPTIONS', & ! block + 'EXPORT_ARRAY_ASCII', & ! tag name + 'EXPORT_ASCII', & ! fortran variable + 'KEYWORD', & ! type + '', & ! shape + .false., & ! required + .false., & ! multi-record + .false., & ! preserve case + .false., & ! layered + .false. & ! timeseries + ) + type(InputParamDefinitionType), parameter :: & gwtdsp_diffc = InputParamDefinitionType & ( & @@ -164,6 +182,7 @@ module GwtDspInputModule [ & gwtdsp_xt3d_off, & gwtdsp_xt3d_rhs, & + gwtdsp_export_ascii, & gwtdsp_diffc, & gwtdsp_alh, & gwtdsp_alv, & diff --git a/src/Idm/gwt-icidm.f90 b/src/Idm/gwt-icidm.f90 index a2fa79f8d63..91a37592efc 100644 --- a/src/Idm/gwt-icidm.f90 +++ b/src/Idm/gwt-icidm.f90 @@ -11,11 +11,29 @@ module GwtIcInputModule public gwt_ic_multi_package type GwtIcParamFoundType + logical :: export_ascii = .false. logical :: strt = .false. end type GwtIcParamFoundType logical :: gwt_ic_multi_package = .false. + type(InputParamDefinitionType), parameter :: & + gwtic_export_ascii = InputParamDefinitionType & + ( & + 'GWT', & ! component + 'IC', & ! subcomponent + 'OPTIONS', & ! block + 'EXPORT_ARRAY_ASCII', & ! tag name + 'EXPORT_ASCII', & ! fortran variable + 'KEYWORD', & ! type + '', & ! shape + .false., & ! required + .false., & ! multi-record + .false., & ! preserve case + .false., & ! layered + .false. & ! timeseries + ) + type(InputParamDefinitionType), parameter :: & gwtic_strt = InputParamDefinitionType & ( & @@ -36,6 +54,7 @@ module GwtIcInputModule type(InputParamDefinitionType), parameter :: & gwt_ic_param_definitions(*) = & [ & + gwtic_export_ascii, & gwtic_strt & ] diff --git a/src/Idm/prt-disidm.f90 b/src/Idm/prt-disidm.f90 index ff9c3ffc1c7..c178966bee7 100644 --- a/src/Idm/prt-disidm.f90 +++ b/src/Idm/prt-disidm.f90 @@ -16,6 +16,7 @@ module PrtDisInputModule logical :: xorigin = .false. logical :: yorigin = .false. logical :: angrot = .false. + logical :: export_ascii = .false. logical :: nlay = .false. logical :: nrow = .false. logical :: ncol = .false. @@ -113,6 +114,23 @@ module PrtDisInputModule .false. & ! timeseries ) + type(InputParamDefinitionType), parameter :: & + prtdis_export_ascii = InputParamDefinitionType & + ( & + 'PRT', & ! component + 'DIS', & ! subcomponent + 'OPTIONS', & ! block + 'EXPORT_ARRAY_ASCII', & ! tag name + 'EXPORT_ASCII', & ! fortran variable + 'KEYWORD', & ! type + '', & ! shape + .false., & ! required + .false., & ! multi-record + .false., & ! preserve case + .false., & ! layered + .false. & ! timeseries + ) + type(InputParamDefinitionType), parameter :: & prtdis_nlay = InputParamDefinitionType & ( & @@ -257,6 +275,7 @@ module PrtDisInputModule prtdis_xorigin, & prtdis_yorigin, & prtdis_angrot, & + prtdis_export_ascii, & prtdis_nlay, & prtdis_nrow, & prtdis_ncol, & diff --git a/src/Idm/prt-disvidm.f90 b/src/Idm/prt-disvidm.f90 index 69cfdcc58bf..e1f2f3fe063 100644 --- a/src/Idm/prt-disvidm.f90 +++ b/src/Idm/prt-disvidm.f90 @@ -16,6 +16,7 @@ module PrtDisvInputModule logical :: xorigin = .false. logical :: yorigin = .false. logical :: angrot = .false. + logical :: export_ascii = .false. logical :: nlay = .false. logical :: ncpl = .false. logical :: nvert = .false. @@ -119,6 +120,23 @@ module PrtDisvInputModule .false. & ! timeseries ) + type(InputParamDefinitionType), parameter :: & + prtdisv_export_ascii = InputParamDefinitionType & + ( & + 'PRT', & ! component + 'DISV', & ! subcomponent + 'OPTIONS', & ! block + 'EXPORT_ARRAY_ASCII', & ! tag name + 'EXPORT_ASCII', & ! fortran variable + 'KEYWORD', & ! type + '', & ! shape + .false., & ! required + .false., & ! multi-record + .false., & ! preserve case + .false., & ! layered + .false. & ! timeseries + ) + type(InputParamDefinitionType), parameter :: & prtdisv_nlay = InputParamDefinitionType & ( & @@ -365,6 +383,7 @@ module PrtDisvInputModule prtdisv_xorigin, & prtdisv_yorigin, & prtdisv_angrot, & + prtdisv_export_ascii, & prtdisv_nlay, & prtdisv_ncpl, & prtdisv_nvert, & diff --git a/src/Idm/prt-mipidm.f90 b/src/Idm/prt-mipidm.f90 index 6548c358481..d7fbb1b6bc7 100644 --- a/src/Idm/prt-mipidm.f90 +++ b/src/Idm/prt-mipidm.f90 @@ -12,6 +12,7 @@ module PrtMipInputModule type PrtMipParamFoundType logical :: zero_method = .false. + logical :: export_ascii = .false. logical :: porosity = .false. logical :: retfactor = .false. logical :: izone = .false. @@ -36,6 +37,23 @@ module PrtMipInputModule .false. & ! timeseries ) + type(InputParamDefinitionType), parameter :: & + prtmip_export_ascii = InputParamDefinitionType & + ( & + 'PRT', & ! component + 'MIP', & ! subcomponent + 'OPTIONS', & ! block + 'EXPORT_ARRAY_ASCII', & ! tag name + 'EXPORT_ASCII', & ! fortran variable + 'KEYWORD', & ! type + '', & ! shape + .false., & ! required + .false., & ! multi-record + .false., & ! preserve case + .false., & ! layered + .false. & ! timeseries + ) + type(InputParamDefinitionType), parameter :: & prtmip_porosity = InputParamDefinitionType & ( & @@ -91,6 +109,7 @@ module PrtMipInputModule prt_mip_param_definitions(*) = & [ & prtmip_zero_method, & + prtmip_export_ascii, & prtmip_porosity, & prtmip_retfactor, & prtmip_izone & diff --git a/src/Idm/swf-dis2didm.f90 b/src/Idm/swf-dis2didm.f90 index 48026dafad9..38857f34ab8 100644 --- a/src/Idm/swf-dis2didm.f90 +++ b/src/Idm/swf-dis2didm.f90 @@ -16,6 +16,7 @@ module SwfDis2DInputModule logical :: xorigin = .false. logical :: yorigin = .false. logical :: angrot = .false. + logical :: export_ascii = .false. logical :: nrow = .false. logical :: ncol = .false. logical :: delr = .false. @@ -111,6 +112,23 @@ module SwfDis2DInputModule .false. & ! timeseries ) + type(InputParamDefinitionType), parameter :: & + swfdis2d_export_ascii = InputParamDefinitionType & + ( & + 'SWF', & ! component + 'DIS2D', & ! subcomponent + 'OPTIONS', & ! block + 'EXPORT_ARRAY_ASCII', & ! tag name + 'EXPORT_ASCII', & ! fortran variable + 'KEYWORD', & ! type + '', & ! shape + .false., & ! required + .false., & ! multi-record + .false., & ! preserve case + .false., & ! layered + .false. & ! timeseries + ) + type(InputParamDefinitionType), parameter :: & swfdis2d_nrow = InputParamDefinitionType & ( & @@ -221,6 +239,7 @@ module SwfDis2DInputModule swfdis2d_xorigin, & swfdis2d_yorigin, & swfdis2d_angrot, & + swfdis2d_export_ascii, & swfdis2d_nrow, & swfdis2d_ncol, & swfdis2d_delr, & diff --git a/src/Idm/swf-disidm.f90 b/src/Idm/swf-disidm.f90 index 5f903c4b5ed..1433a6bf4bc 100644 --- a/src/Idm/swf-disidm.f90 +++ b/src/Idm/swf-disidm.f90 @@ -16,6 +16,7 @@ module SwfDisInputModule logical :: xorigin = .false. logical :: yorigin = .false. logical :: angrot = .false. + logical :: export_ascii = .false. logical :: nlay = .false. logical :: nrow = .false. logical :: ncol = .false. @@ -113,6 +114,23 @@ module SwfDisInputModule .false. & ! timeseries ) + type(InputParamDefinitionType), parameter :: & + swfdis_export_ascii = InputParamDefinitionType & + ( & + 'SWF', & ! component + 'DIS', & ! subcomponent + 'OPTIONS', & ! block + 'EXPORT_ARRAY_ASCII', & ! tag name + 'EXPORT_ASCII', & ! fortran variable + 'KEYWORD', & ! type + '', & ! shape + .false., & ! required + .false., & ! multi-record + .false., & ! preserve case + .false., & ! layered + .false. & ! timeseries + ) + type(InputParamDefinitionType), parameter :: & swfdis_nlay = InputParamDefinitionType & ( & @@ -257,6 +275,7 @@ module SwfDisInputModule swfdis_xorigin, & swfdis_yorigin, & swfdis_angrot, & + swfdis_export_ascii, & swfdis_nlay, & swfdis_nrow, & swfdis_ncol, & diff --git a/src/Idm/swf-disvidm.f90 b/src/Idm/swf-disvidm.f90 index 8a368e23f3d..0896e9b410c 100644 --- a/src/Idm/swf-disvidm.f90 +++ b/src/Idm/swf-disvidm.f90 @@ -16,6 +16,7 @@ module SwfDisvInputModule logical :: xorigin = .false. logical :: yorigin = .false. logical :: angrot = .false. + logical :: export_ascii = .false. logical :: nlay = .false. logical :: ncpl = .false. logical :: nvert = .false. @@ -119,6 +120,23 @@ module SwfDisvInputModule .false. & ! timeseries ) + type(InputParamDefinitionType), parameter :: & + swfdisv_export_ascii = InputParamDefinitionType & + ( & + 'SWF', & ! component + 'DISV', & ! subcomponent + 'OPTIONS', & ! block + 'EXPORT_ARRAY_ASCII', & ! tag name + 'EXPORT_ASCII', & ! fortran variable + 'KEYWORD', & ! type + '', & ! shape + .false., & ! required + .false., & ! multi-record + .false., & ! preserve case + .false., & ! layered + .false. & ! timeseries + ) + type(InputParamDefinitionType), parameter :: & swfdisv_nlay = InputParamDefinitionType & ( & @@ -365,6 +383,7 @@ module SwfDisvInputModule swfdisv_xorigin, & swfdisv_yorigin, & swfdisv_angrot, & + swfdisv_export_ascii, & swfdisv_nlay, & swfdisv_ncpl, & swfdisv_nvert, & diff --git a/src/Idm/swf-icidm.f90 b/src/Idm/swf-icidm.f90 index 3de7dc50ebe..1cc90e5bdfb 100644 --- a/src/Idm/swf-icidm.f90 +++ b/src/Idm/swf-icidm.f90 @@ -11,11 +11,29 @@ module SwfIcInputModule public swf_ic_multi_package type SwfIcParamFoundType + logical :: export_ascii = .false. logical :: strt = .false. end type SwfIcParamFoundType logical :: swf_ic_multi_package = .false. + type(InputParamDefinitionType), parameter :: & + swfic_export_ascii = InputParamDefinitionType & + ( & + 'SWF', & ! component + 'IC', & ! subcomponent + 'OPTIONS', & ! block + 'EXPORT_ARRAY_ASCII', & ! tag name + 'EXPORT_ASCII', & ! fortran variable + 'KEYWORD', & ! type + '', & ! shape + .false., & ! required + .false., & ! multi-record + .false., & ! preserve case + .false., & ! layered + .false. & ! timeseries + ) + type(InputParamDefinitionType), parameter :: & swfic_strt = InputParamDefinitionType & ( & @@ -36,6 +54,7 @@ module SwfIcInputModule type(InputParamDefinitionType), parameter :: & swf_ic_param_definitions(*) = & [ & + swfic_export_ascii, & swfic_strt & ] diff --git a/src/Utilities/Idm/IdmLogger.f90 b/src/Utilities/Idm/IdmLogger.f90 index b5a52f6cdf5..908c347fa4f 100644 --- a/src/Utilities/Idm/IdmLogger.f90 +++ b/src/Utilities/Idm/IdmLogger.f90 @@ -16,6 +16,7 @@ module IdmLoggerModule public :: idm_log_close public :: idm_log_period_header public :: idm_log_period_close + public :: idm_export public :: idm_log_var interface idm_log_var @@ -27,6 +28,12 @@ module IdmLoggerModule idm_log_var_ts end interface idm_log_var + interface idm_export + module procedure idm_export_int1d, idm_export_int2d, & + idm_export_int3d, idm_export_dbl1d, & + idm_export_dbl2d, idm_export_dbl3d + end interface idm_export + contains !> @ brief log a header message @@ -324,4 +331,237 @@ subroutine idm_log_var_str(p_mem, varname, mempath, iout) end if end subroutine idm_log_var_str + !> @brief Create export file int1d + !! + !! export layered int1d parameters with NODES shape + !! + !< + subroutine idm_export_int1d(p_mem, varname, mempath, iout) + use SimVariablesModule, only: idm_context + use ConstantsModule, only: LENMEMPATH, LENCOMPONENTNAME + use MemoryManagerModule, only: mem_setptr + use MemoryHelperModule, only: create_mem_path, split_mem_path + integer(I4B), dimension(:), contiguous, intent(in) :: p_mem !< 1d integer array + character(len=*), intent(in) :: varname !< variable name + character(len=*), intent(in) :: mempath !< variable memory path + integer(I4B), intent(in) :: iout + ! -- dummy + integer(I4B), dimension(:), pointer, contiguous :: model_shape + integer(I4B), dimension(:, :, :), pointer, contiguous :: int3d + integer(I4B), dimension(:, :), pointer, contiguous :: int2d + integer(I4B), dimension(3) :: dis_shape + integer(I4B), dimension(2) :: disv_shape + character(LENMEMPATH) :: input_mempath + character(LENCOMPONENTNAME) :: comp, subcomp + integer(I4B) :: i, j, k, inunit + ! + call split_mem_path(mempath, comp, subcomp) + input_mempath = create_mem_path(component=comp, context=idm_context) + call mem_setptr(model_shape, 'MODEL_SHAPE', input_mempath) + ! + if (size(model_shape) == 3) then + dis_shape(1) = model_shape(3) + dis_shape(2) = model_shape(2) + dis_shape(3) = model_shape(1) + allocate (int3d(dis_shape(1), dis_shape(2), dis_shape(3))) + int3d = reshape(p_mem, dis_shape) + do k = 1, dis_shape(3) + inunit = create_export_file(varname, mempath, k, iout) + do i = 1, model_shape(2) + write (inunit, '(*(i0, " "))') (int3d(j, i, k), j=1, & + dis_shape(1)) + end do + close (inunit) + end do + deallocate (int3d) + else if (size(model_shape) == 2) then + disv_shape(1) = model_shape(2) + disv_shape(2) = model_shape(1) + allocate (int2d(disv_shape(1), disv_shape(2))) + int2d = reshape(p_mem, disv_shape) + do i = 1, disv_shape(2) + inunit = create_export_file(varname, mempath, i, iout) + write (inunit, '(*(i0, " "))') (int2d(j, i), j=1, disv_shape(1)) + close (inunit) + end do + else if (size(model_shape) == 1) then + inunit = create_export_file(varname, mempath, 0, iout) + write (inunit, '(*(i0, " "))') p_mem + close (inunit) + end if + end subroutine idm_export_int1d + + !> @brief Create export file int2d + !< + subroutine idm_export_int2d(p_mem, varname, mempath, iout) + integer(I4B), dimension(:, :), contiguous, intent(in) :: p_mem !< 2d dbl array + character(len=*), intent(in) :: varname !< variable name + character(len=*), intent(in) :: mempath !< variable memory path + integer(I4B), intent(in) :: iout + ! -- dummy + integer(I4B) :: i, j, inunit + ! + do i = 1, size(p_mem, dim=2) + inunit = create_export_file(varname, mempath, i, iout) + write (inunit, '(*(i0, " "))') (p_mem(j, i), j=1, size(p_mem, dim=1)) + close (inunit) + end do + end subroutine idm_export_int2d + + !> @brief Create export file int3d + !< + subroutine idm_export_int3d(p_mem, varname, mempath, iout) + integer(I4B), dimension(:, :, :), contiguous, intent(in) :: p_mem !< 2d dbl array + character(len=*), intent(in) :: varname !< variable name + character(len=*), intent(in) :: mempath !< variable memory path + integer(I4B), intent(in) :: iout + ! -- dummy + integer(I4B) :: i, j, k, inunit + ! + do k = 1, size(p_mem, dim=3) + inunit = create_export_file(varname, mempath, k, iout) + do i = 1, size(p_mem, dim=2) + write (inunit, '(*(i0, " "))') (p_mem(j, i, k), j=1, size(p_mem, dim=1)) + end do + close (inunit) + end do + end subroutine idm_export_int3d + + !> @brief Create export file dbl1d + !! + !! export layered dbl1d parameters with NODES shape + !! + !< + subroutine idm_export_dbl1d(p_mem, varname, mempath, iout) + use SimVariablesModule, only: idm_context + use ConstantsModule, only: LENMEMPATH, LENCOMPONENTNAME + use MemoryManagerModule, only: mem_setptr + use MemoryHelperModule, only: create_mem_path, split_mem_path + real(DP), dimension(:), contiguous, intent(in) :: p_mem !< 1d dbl array + character(len=*), intent(in) :: varname !< variable name + character(len=*), intent(in) :: mempath !< variable memory path + integer(I4B), intent(in) :: iout + ! -- dummy + integer(I4B), dimension(:), pointer, contiguous :: model_shape + real(DP), dimension(:, :, :), pointer, contiguous :: dbl3d + real(DP), dimension(:, :), pointer, contiguous :: dbl2d + integer(I4B), dimension(3) :: dis_shape + integer(I4B), dimension(2) :: disv_shape + character(LENMEMPATH) :: input_mempath + character(LENCOMPONENTNAME) :: comp, subcomp + integer(I4B) :: i, j, k, inunit + ! + call split_mem_path(mempath, comp, subcomp) + input_mempath = create_mem_path(component=comp, context=idm_context) + call mem_setptr(model_shape, 'MODEL_SHAPE', input_mempath) + ! + if (size(model_shape) == 3) then + dis_shape(1) = model_shape(3) + dis_shape(2) = model_shape(2) + dis_shape(3) = model_shape(1) + allocate (dbl3d(dis_shape(1), dis_shape(2), dis_shape(3))) + dbl3d = reshape(p_mem, dis_shape) + do k = 1, dis_shape(3) + inunit = create_export_file(varname, mempath, k, iout) + do i = 1, model_shape(2) + write (inunit, '(*(G0.10, " "))') (dbl3d(j, i, k), j=1, & + dis_shape(1)) + end do + close (inunit) + end do + deallocate (dbl3d) + else if (size(model_shape) == 2) then + disv_shape(1) = model_shape(2) + disv_shape(2) = model_shape(1) + allocate (dbl2d(disv_shape(1), disv_shape(2))) + dbl2d = reshape(p_mem, disv_shape) + do i = 1, disv_shape(2) + inunit = create_export_file(varname, mempath, i, iout) + write (inunit, '(*(G0.10, " "))') (dbl2d(j, i), j=1, disv_shape(1)) + close (inunit) + end do + else if (size(model_shape) == 1) then + inunit = create_export_file(varname, mempath, 0, iout) + write (inunit, '(*(G0.10, " "))') p_mem + close (inunit) + end if + end subroutine idm_export_dbl1d + + !> @brief Create export file dbl2d + !< + subroutine idm_export_dbl2d(p_mem, varname, mempath, iout) + real(DP), dimension(:, :), contiguous, intent(in) :: p_mem !< 2d dbl array + character(len=*), intent(in) :: varname !< variable name + character(len=*), intent(in) :: mempath !< variable memory path + integer(I4B), intent(in) :: iout + ! -- dummy + integer(I4B) :: i, j, inunit + ! + do i = 1, size(p_mem, dim=2) + inunit = create_export_file(varname, mempath, i, iout) + write (inunit, '(*(G0.10, " "))') (p_mem(j, i), j=1, size(p_mem, dim=1)) + close (inunit) + end do + end subroutine idm_export_dbl2d + + !> @brief Create export file dbl3d + !< + subroutine idm_export_dbl3d(p_mem, varname, mempath, iout) + real(DP), dimension(:, :, :), contiguous, intent(in) :: p_mem !< 2d dbl array + character(len=*), intent(in) :: varname !< variable name + character(len=*), intent(in) :: mempath !< variable memory path + integer(I4B), intent(in) :: iout + ! -- dummy + integer(I4B) :: i, j, k, inunit + ! + do k = 1, size(p_mem, dim=3) + inunit = create_export_file(varname, mempath, k, iout) + do i = 1, size(p_mem, dim=2) + write (inunit, '(*(G0.10, " "))') (p_mem(j, i, k), j=1, & + size(p_mem, dim=1)) + end do + close (inunit) + end do + end subroutine idm_export_dbl3d + + !> @brief Create export file + !! + !! Name format: -.varname.[layer].txt + !! + !< + function create_export_file(varname, mempath, layer, iout) result(inunit) + use ConstantsModule, only: LENCOMPONENTNAME, LENVARNAME + use InputOutputModule, only: openfile, getunit + use InputOutputModule, only: upcase, lowcase + use MemoryHelperModule, only: create_mem_path, split_mem_path + character(len=*), intent(in) :: varname !< variable name + character(len=*), intent(in) :: mempath !< variable memory path + integer(I4B), intent(in) :: layer + integer(I4B), intent(in) :: iout + integer(I4B) :: inunit + ! -- dummy + character(len=LENCOMPONENTNAME) :: comp, subcomp + character(len=LINELENGTH) :: filename, suffix + ! + ! -- split the mempath + call split_mem_path(mempath, comp, subcomp) + call lowcase(comp) + call lowcase(subcomp) + ! + ! -- build suffix + suffix = varname + call lowcase(suffix) + if (layer > 0) then + write (suffix, '(a,i0)') trim(suffix)//'.l', layer + end if + suffix = trim(suffix)//'.txt' + ! + ! -- set filename + filename = trim(comp)//'-'//trim(subcomp)//'.'//trim(suffix) + ! + ! -- silently create the array file + inunit = getunit() + call openfile(inunit, 0, filename, 'EXPORT', filstat_opt='REPLACE') + end function create_export_file + end module IdmLoggerModule diff --git a/src/Utilities/Idm/mf6blockfile/LoadMf6File.f90 b/src/Utilities/Idm/mf6blockfile/LoadMf6File.f90 index d1a682b06bf..bd06ac99dc9 100644 --- a/src/Utilities/Idm/mf6blockfile/LoadMf6File.f90 +++ b/src/Utilities/Idm/mf6blockfile/LoadMf6File.f90 @@ -30,7 +30,8 @@ module LoadMf6FileModule use MemoryManagerModule, only: mem_allocate, mem_setptr use MemoryHelperModule, only: create_mem_path use StructArrayModule, only: StructArrayType - use IdmLoggerModule, only: idm_log_var, idm_log_header, idm_log_close + use IdmLoggerModule, only: idm_log_var, idm_log_header, idm_log_close, & + idm_export implicit none private @@ -49,6 +50,7 @@ module LoadMf6FileModule type(ModflowInputType) :: mf6_input !< description of input character(len=LINELENGTH) :: filename !< name of ascii input file logical(LGP) :: ts_active !< is timeseries active + logical(LGP) :: export !< is array export active integer(I4B) :: iout !< inunit for list log contains procedure :: load @@ -126,6 +128,7 @@ subroutine init(this, parser, mf6_input, filename, iout) this%mf6_input = mf6_input this%filename = filename this%ts_active = .false. + this%export = .false. this%iout = iout ! call get_isize('MODEL_SHAPE', mf6_input%component_mempath, isize) @@ -212,7 +215,7 @@ subroutine block_post_process(this, iblk) integer(I4B), intent(in) :: iblk ! -- local type(InputParamDefinitionType), pointer :: idt - integer(I4B) :: iparam, ts6_size + integer(I4B) :: iparam, ts6_size, export_size ! select case (this%mf6_input%block_dfns(iblk)%blockname) case ('OPTIONS') @@ -234,6 +237,13 @@ subroutine block_post_process(this, iblk) this%ts_active = .true. end if ! + ! -- determine if EXPORT options were provided + call get_isize('EXPORT_ASCII', this%mf6_input%mempath, export_size) + ! + if (export_size > 0) then + this%export = .true. + end if + ! case ('DIMENSIONS') ! -- set model shape if discretization dimensions have been read if (this%mf6_input%pkgtype(1:3) == 'DIS') then @@ -462,24 +472,24 @@ recursive subroutine parse_tag(this, iblk, recursive_call) call load_integer_type(this%parser, idt, this%mf6_input%mempath, this%iout) case ('INTEGER1D') call load_integer1d_type(this%parser, idt, this%mf6_input%mempath, & - this%mshape, this%iout) + this%mshape, this%export, this%iout) case ('INTEGER2D') call load_integer2d_type(this%parser, idt, this%mf6_input%mempath, & - this%mshape, this%iout) + this%mshape, this%export, this%iout) case ('INTEGER3D') call load_integer3d_type(this%parser, idt, this%mf6_input%mempath, & - this%mshape, this%iout) + this%mshape, this%export, this%iout) case ('DOUBLE') call load_double_type(this%parser, idt, this%mf6_input%mempath, this%iout) case ('DOUBLE1D') call load_double1d_type(this%parser, idt, this%mf6_input%mempath, & - this%mshape, this%iout) + this%mshape, this%export, this%iout) case ('DOUBLE2D') call load_double2d_type(this%parser, idt, this%mf6_input%mempath, & - this%mshape, this%iout) + this%mshape, this%export, this%iout) case ('DOUBLE3D') call load_double3d_type(this%parser, idt, this%mf6_input%mempath, & - this%mshape, this%iout) + this%mshape, this%export, this%iout) case default write (errmsg, '(a,a)') 'Failure reading data for tag: ', trim(tag) call store_error(errmsg) @@ -751,12 +761,13 @@ end subroutine load_integer_type !> @brief load type 1d integer !< - subroutine load_integer1d_type(parser, idt, memoryPath, mshape, iout) + subroutine load_integer1d_type(parser, idt, memoryPath, mshape, export, iout) use SourceCommonModule, only: get_shape_from_string type(BlockParserType), intent(inout) :: parser !< block parser type(InputParamDefinitionType), intent(in) :: idt !< input data type object describing this record character(len=*), intent(in) :: memoryPath !< memorypath to put loaded information integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape !< model shape + logical(LGP), intent(in) :: export !< export to ascii layer files integer(I4B), intent(in) :: iout !< unit number for output integer(I4B), dimension(:), pointer, contiguous :: int1d !integer(I4B), pointer :: nsize1 @@ -794,17 +805,24 @@ subroutine load_integer1d_type(parser, idt, memoryPath, mshape, iout) ! log information on the loaded array to the list file call idm_log_var(int1d, idt%tagname, memoryPath, iout) + + ! create export file for layered parameters if optioned + if (export .and. idt%layered) then + call idm_export(int1d, idt%tagname, memoryPath, iout) + end if + return end subroutine load_integer1d_type !> @brief load type 2d integer !< - subroutine load_integer2d_type(parser, idt, memoryPath, mshape, iout) + subroutine load_integer2d_type(parser, idt, memoryPath, mshape, export, iout) use SourceCommonModule, only: get_shape_from_string type(BlockParserType), intent(inout) :: parser !< block parser type(InputParamDefinitionType), intent(in) :: idt !< input data type object describing this record character(len=*), intent(in) :: memoryPath !< memorypath to put loaded information integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape !< model shape + logical(LGP), intent(in) :: export !< export to ascii layer files integer(I4B), intent(in) :: iout !< unit number for output integer(I4B), dimension(:, :), pointer, contiguous :: int2d integer(I4B) :: nlay @@ -838,17 +856,24 @@ subroutine load_integer2d_type(parser, idt, memoryPath, mshape, iout) ! log information on the loaded array to the list file call idm_log_var(int2d, idt%tagname, memoryPath, iout) + + ! create export file for layered parameters if optioned + if (export .and. idt%layered) then + call idm_export(int2d, idt%tagname, memoryPath, iout) + end if + return end subroutine load_integer2d_type !> @brief load type 3d integer !< - subroutine load_integer3d_type(parser, idt, memoryPath, mshape, iout) + subroutine load_integer3d_type(parser, idt, memoryPath, mshape, export, iout) use SourceCommonModule, only: get_shape_from_string type(BlockParserType), intent(inout) :: parser !< block parser type(InputParamDefinitionType), intent(in) :: idt !< input data type object describing this record character(len=*), intent(in) :: memoryPath !< memorypath to put loaded information integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape !< model shape + logical(LGP), intent(in) :: export !< export to ascii layer files integer(I4B), intent(in) :: iout !< unit number for output integer(I4B), dimension(:, :, :), pointer, contiguous :: int3d integer(I4B) :: nlay @@ -888,6 +913,11 @@ subroutine load_integer3d_type(parser, idt, memoryPath, mshape, iout) ! log information on the loaded array to the list file call idm_log_var(int3d, idt%tagname, memoryPath, iout) + ! create export file for layered parameters if optioned + if (export .and. idt%layered) then + call idm_export(int3d, idt%tagname, memoryPath, iout) + end if + return end subroutine load_integer3d_type @@ -907,12 +937,13 @@ end subroutine load_double_type !> @brief load type 1d double !< - subroutine load_double1d_type(parser, idt, memoryPath, mshape, iout) + subroutine load_double1d_type(parser, idt, memoryPath, mshape, export, iout) use SourceCommonModule, only: get_shape_from_string type(BlockParserType), intent(inout) :: parser !< block parser type(InputParamDefinitionType), intent(in) :: idt !< input data type object describing this record character(len=*), intent(in) :: memoryPath !< memorypath to put loaded information integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape !< model shape + logical(LGP), intent(in) :: export !< export to ascii layer files integer(I4B), intent(in) :: iout !< unit number for output real(DP), dimension(:), pointer, contiguous :: dbl1d !integer(I4B), pointer :: nsize1 @@ -949,17 +980,24 @@ subroutine load_double1d_type(parser, idt, memoryPath, mshape, iout) ! log information on the loaded array to the list file call idm_log_var(dbl1d, idt%tagname, memoryPath, iout) + + ! create export file for layered parameters if optioned + if (export .and. idt%layered) then + call idm_export(dbl1d, idt%tagname, memoryPath, iout) + end if + return end subroutine load_double1d_type !> @brief load type 2d double !< - subroutine load_double2d_type(parser, idt, memoryPath, mshape, iout) + subroutine load_double2d_type(parser, idt, memoryPath, mshape, export, iout) use SourceCommonModule, only: get_shape_from_string type(BlockParserType), intent(inout) :: parser !< block parser type(InputParamDefinitionType), intent(in) :: idt !< input data type object describing this record character(len=*), intent(in) :: memoryPath !< memorypath to put loaded information integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape !< model shape + logical(LGP), intent(in) :: export !< export to ascii layer files integer(I4B), intent(in) :: iout !< unit number for output real(DP), dimension(:, :), pointer, contiguous :: dbl2d integer(I4B) :: nlay @@ -993,17 +1031,24 @@ subroutine load_double2d_type(parser, idt, memoryPath, mshape, iout) ! log information on the loaded array to the list file call idm_log_var(dbl2d, idt%tagname, memoryPath, iout) + + ! create export file for layered parameters if optioned + if (export .and. idt%layered) then + call idm_export(dbl2d, idt%tagname, memoryPath, iout) + end if + return end subroutine load_double2d_type !> @brief load type 3d double !< - subroutine load_double3d_type(parser, idt, memoryPath, mshape, iout) + subroutine load_double3d_type(parser, idt, memoryPath, mshape, export, iout) use SourceCommonModule, only: get_shape_from_string type(BlockParserType), intent(inout) :: parser !< block parser type(InputParamDefinitionType), intent(in) :: idt !< input data type object describing this record character(len=*), intent(in) :: memoryPath !< memorypath to put loaded information integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape !< model shape + logical(LGP), intent(in) :: export !< export to ascii layer files integer(I4B), intent(in) :: iout !< unit number for output real(DP), dimension(:, :, :), pointer, contiguous :: dbl3d integer(I4B) :: nlay @@ -1043,6 +1088,11 @@ subroutine load_double3d_type(parser, idt, memoryPath, mshape, iout) ! log information on the loaded array to the list file call idm_log_var(dbl3d, idt%tagname, memoryPath, iout) + ! create export file for layered parameters if optioned + if (export .and. idt%layered) then + call idm_export(dbl3d, idt%tagname, memoryPath, iout) + end if + return end subroutine load_double3d_type