From 8ce29a3e4ad8676a243a1dff535520e0deed3e7f Mon Sep 17 00:00:00 2001 From: wpbonelli Date: Sat, 4 Nov 2023 10:00:14 -0400 Subject: [PATCH] revisions --- src/Model/GroundWaterFlow/gwf3.f90 | 4 +- src/Model/GroundWaterFlow/gwf3ic8.f90 | 54 ++++++++++++++----------- src/Model/GroundWaterTransport/gwt1.f90 | 2 +- 3 files changed, 33 insertions(+), 27 deletions(-) diff --git a/src/Model/GroundWaterFlow/gwf3.f90 b/src/Model/GroundWaterFlow/gwf3.f90 index 17cc29f6dac..8871a49cb18 100644 --- a/src/Model/GroundWaterFlow/gwf3.f90 +++ b/src/Model/GroundWaterFlow/gwf3.f90 @@ -309,8 +309,8 @@ subroutine gwf_ar(this) class(BndType), pointer :: packobj ! ------------------------------------------------------------------------------ ! - ! -- Load modules attached to model - if (this%inic > 0) call this%ic%ic_load(this%x) + ! -- Allocate and read modules attached to model + if (this%inic > 0) call this%ic%ic_ar(this%x) if (this%innpf > 0) call this%npf%npf_ar(this%ic, this%vsc, this%ibound, & this%x) if (this%invsc > 0) call this%vsc%vsc_ar(this%ibound) diff --git a/src/Model/GroundWaterFlow/gwf3ic8.f90 b/src/Model/GroundWaterFlow/gwf3ic8.f90 index 7d2448e32b1..e75de23bba2 100644 --- a/src/Model/GroundWaterFlow/gwf3ic8.f90 +++ b/src/Model/GroundWaterFlow/gwf3ic8.f90 @@ -14,8 +14,9 @@ module GwfIcModule type, extends(NumericalPackageType) :: GwfIcType real(DP), dimension(:), pointer, contiguous :: strt => null() ! starting head contains - procedure :: ic_load + procedure :: ic_ar procedure :: ic_da + procedure, private :: ic_load procedure, private :: allocate_arrays procedure, private :: source_griddata end type GwfIcType @@ -37,50 +38,54 @@ subroutine ic_cr(ic, name_model, input_mempath, inunit, iout, dis) character(len=*), parameter :: fmtic = & "(1x, /1x, 'IC -- Initial Conditions Package, Version 8, 3/28/2015', & &' input read from mempath: ', A, //)" - ! + ! -- create IC object allocate (ic) - ! + ! -- create name and memory path call ic%set_names(1, name_model, 'IC', 'IC', input_mempath) - ! + ! -- allocate scalars call ic%allocate_scalars() - ! + ! -- set variables ic%inunit = inunit ic%iout = iout - ! - ! -- set points + + ! -- set pointers ic%dis => dis - ! - ! -- if package is enabled, print message identifying it - if (inunit > 0) & + + ! -- check if pkg is enabled, + if (inunit > 0) then + ! print message identifying pkg write (ic%iout, fmtic) input_mempath + end if end subroutine ic_cr - !> @brief Load initial conditions - subroutine ic_load(this, x) - ! -- modules + !> @brief Load data from IDM into package + subroutine ic_load(this) use BaseDisModule, only: DisBaseType - use SimModule, only: store_error - ! -- dummy + class(GwfIcType) :: this + call this%source_griddata() + end subroutine ic_load + + !> @brief Allocate arrays, load from IDM, and assign head. + subroutine ic_ar(this, x) class(GwfIcType) :: this real(DP), dimension(:), intent(inout) :: x - ! -- locals integer(I4B) :: n - ! + ! -- allocate arrays call this%allocate_arrays(this%dis%nodes) - ! - ! -- read grid data - call this%source_griddata() - ! + + ! -- load from IDM + call this%ic_load() + ! -- assign starting head do n = 1, this%dis%nodes x(n) = this%strt(n) end do - end subroutine ic_load + end subroutine ic_ar !> @brief Deallocate subroutine ic_da(this) @@ -116,7 +121,7 @@ end subroutine allocate_arrays !> @brief Copy grid data from IDM into package subroutine source_griddata(this) ! -- modules - use SimModule, only: store_error + use SimModule, only: store_error, store_error_filename use MemoryManagerExtModule, only: mem_set_value use GwfIcInputModule, only: GwfIcParamFoundType ! -- dummy @@ -136,7 +141,8 @@ subroutine source_griddata(this) ! -- ensure STRT was found if (.not. found%strt) then write (errmsg, '(a)') 'Error in GRIDDATA block: STRT not found.' - call store_error(errmsg) + call store_error(errmsg, terminate=.false.) + call store_error_filename(this%input_fname) else if (this%iout > 0) then write (this%iout, '(4x,a)') 'STRT set from input file' end if diff --git a/src/Model/GroundWaterTransport/gwt1.f90 b/src/Model/GroundWaterTransport/gwt1.f90 index b9a491cf82d..d8bbc3ff975 100644 --- a/src/Model/GroundWaterTransport/gwt1.f90 +++ b/src/Model/GroundWaterTransport/gwt1.f90 @@ -269,7 +269,7 @@ subroutine gwt_ar(this) ! -- Allocate and read modules attached to model call this%fmi%fmi_ar(this%ibound) if (this%inmvt > 0) call this%mvt%mvt_ar() - if (this%inic > 0) call this%ic%ic_load(this%x) + if (this%inic > 0) call this%ic%ic_ar(this%x) if (this%inmst > 0) call this%mst%mst_ar(this%dis, this%ibound) if (this%inadv > 0) call this%adv%adv_ar(this%dis, this%ibound) if (this%indsp > 0) call this%dsp%dsp_ar(this%ibound, this%mst%thetam)