Skip to content

Commit

Permalink
refactor(tsp): Elevate MVT to generalized transport class (#1399)
Browse files Browse the repository at this point in the history
* refactor(tsp): Elevate MVT to generalized transport class

* remove errant comment

* fprettify
  • Loading branch information
emorway-usgs authored Oct 13, 2023
1 parent c00b23d commit d3108a2
Show file tree
Hide file tree
Showing 7 changed files with 111 additions and 185 deletions.
2 changes: 1 addition & 1 deletion make/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ $(OBJDIR)/CellWithNbrs.o \
$(OBJDIR)/NumericalExchange.o \
$(OBJDIR)/tsp1ssm1.o \
$(OBJDIR)/tsp1oc1.o \
$(OBJDIR)/tsp1mvt1.o \
$(OBJDIR)/tsp1ic1.o \
$(OBJDIR)/tsp1adv1.o \
$(OBJDIR)/gwf3disv8.o \
Expand Down Expand Up @@ -255,7 +256,6 @@ $(OBJDIR)/gwt1src1.o \
$(OBJDIR)/gwt1sft1.o \
$(OBJDIR)/gwt1obs1.o \
$(OBJDIR)/gwt1mwt1.o \
$(OBJDIR)/gwt1mvt1.o \
$(OBJDIR)/gwt1lkt1.o \
$(OBJDIR)/gwt1ist1.o \
$(OBJDIR)/gwt1dsp1.o \
Expand Down
2 changes: 1 addition & 1 deletion msvs/mf6core.vfproj
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@
<File RelativePath="..\src\Model\GroundWaterTransport\gwt1ist1.f90"/>
<File RelativePath="..\src\Model\GroundWaterTransport\gwt1lkt1.f90"/>
<File RelativePath="..\src\Model\GroundWaterTransport\gwt1mst1.f90"/>
<File RelativePath="..\src\Model\GroundWaterTransport\gwt1mvt1.f90"/>
<File RelativePath="..\src\Model\GroundWaterTransport\gwt1mwt1.f90"/>
<File RelativePath="..\src\Model\GroundWaterTransport\gwt1obs1.f90"/>
<File RelativePath="..\src\Model\GroundWaterTransport\gwt1sft1.f90"/>
Expand Down Expand Up @@ -207,6 +206,7 @@
<File RelativePath="..\src\Model\TransportModel\tsp1adv1.f90"/>
<File RelativePath="..\src\Model\TransportModel\tsp1fmi1.f90"/>
<File RelativePath="..\src\Model\TransportModel\tsp1ic1.f90"/>
<File RelativePath="..\src\Model\TransportModel\tsp1mvt1.f90"/>
<File RelativePath="..\src\Model\TransportModel\tsp1oc1.f90"/>
<File RelativePath="..\src\Model\TransportModel\tsp1ssm1.f90"/></Filter>
<File RelativePath="..\src\Model\BaseModel.f90"/>
Expand Down
7 changes: 4 additions & 3 deletions src/Exchange/GwtGwtExchange.f90
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module GwtGwtExchangeModule
use VirtualModelModule, only: get_virtual_model
use DisConnExchangeModule, only: DisConnExchangeType
use GwtModule, only: GwtModelType
use GwtMvtModule, only: GwtMvtType
use TspMvtModule, only: TspMvtType
use ObserveModule, only: ObserveType
use ObsModule, only: ObsType
use SimModule, only: count_errors, store_error, &
Expand Down Expand Up @@ -66,7 +66,7 @@ module GwtGwtExchangeModule
!
! -- Mover transport package
integer(I4B), pointer :: inmvt => null() !< unit number for mover transport (0 if off)
type(GwtMvtType), pointer :: mvt => null() !< water mover object
type(TspMvtType), pointer :: mvt => null() !< water mover object
!
! -- Observation package
integer(I4B), pointer :: inobs => null() !< unit number for GWT-GWT observations
Expand Down Expand Up @@ -937,7 +937,7 @@ end function parse_option
!<
subroutine read_mvt(this, iout)
! -- modules
use GwtMvtModule, only: mvt_cr
use TspMvtModule, only: mvt_cr
! -- dummy
class(GwtExchangeType) :: this !< GwtExchangeType
integer(I4B), intent(in) :: iout
Expand All @@ -947,6 +947,7 @@ subroutine read_mvt(this, iout)
! for gwtmodel1 so that a call to save flows has an associated dis
! object.
call mvt_cr(this%mvt, this%name, this%inmvt, iout, this%gwtmodel1%fmi, &
this%gwtmodel1%eqnsclfac, &
gwfmodelname1=this%gwfmodelname1, &
gwfmodelname2=this%gwfmodelname2, &
fmi2=this%gwtmodel2%fmi)
Expand Down
13 changes: 1 addition & 12 deletions src/Model/GroundWaterTransport/gwt1.f90
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ module GwtModule
use BaseModelModule, only: BaseModelType
use BndModule, only: BndType, AddBndToList, GetBndFromList
use GwtDspModule, only: GwtDspType
use TspSsmModule, only: TspSsmType
use GwtMvtModule, only: GwtMvtType
use GwtMstModule, only: GwtMstType
use GwtObsModule, only: GwtObsType
use BudgetModule, only: BudgetType
Expand All @@ -37,9 +35,7 @@ module GwtModule

type(GwtMstType), pointer :: mst => null() ! mass storage and transfer package
type(GwtDspType), pointer :: dsp => null() ! dispersion package
type(GwtMvtType), pointer :: mvt => null() ! mover transport package
type(GwtObsType), pointer :: obs => null() ! observation package
integer(I4B), pointer :: inmvt => null() ! unit number MVT
integer(I4B), pointer :: inmst => null() ! unit number MST
integer(I4B), pointer :: indsp => null() ! DSP enabled flag
integer(I4B), pointer :: inobs => null() ! unit number OBS
Expand Down Expand Up @@ -877,7 +873,6 @@ subroutine gwt_da(this)
! -- Scalars
call mem_deallocate(this%indsp)
call mem_deallocate(this%inmst)
call mem_deallocate(this%inmvt)
call mem_deallocate(this%inobs)
!
! -- Parent class members
Expand Down Expand Up @@ -962,12 +957,10 @@ subroutine allocate_scalars(this, modelname)
call this%allocate_tsp_scalars(modelname)
!
! -- allocate members that are part of model class
call mem_allocate(this%inmvt, 'INMVT', this%memoryPath)
call mem_allocate(this%inmst, 'INMST', this%memoryPath)
call mem_allocate(this%indsp, 'INDSP', this%memoryPath)
call mem_allocate(this%inobs, 'INOBS', this%memoryPath)
!
this%inmvt = 0
this%inmst = 0
this%indsp = 0
this%inobs = 0
Expand Down Expand Up @@ -1138,7 +1131,6 @@ subroutine create_gwt_packages(this, indis)
use SimVariablesModule, only: idm_context
use GwtMstModule, only: mst_cr
use GwtDspModule, only: dsp_cr
use GwtMvtModule, only: mvt_cr
use GwtObsModule, only: gwt_obs_cr
! -- dummy
class(GwtModelType) :: this
Expand Down Expand Up @@ -1178,10 +1170,8 @@ subroutine create_gwt_packages(this, indis)
mempath = mempaths(n)
inunit => inunits(n)
!
! -- create dis package first as it is a prerequisite for other packages
! -- create dis package as it is a prerequisite for other packages
select case (pkgtype)
case ('MVT6')
this%inmvt = inunit
case ('MST6')
this%inmst = inunit
case ('DSP6')
Expand All @@ -1204,7 +1194,6 @@ subroutine create_gwt_packages(this, indis)
call mst_cr(this%mst, this%name, this%inmst, this%iout, this%fmi)
call dsp_cr(this%dsp, this%name, mempathdsp, this%indsp, this%iout, &
this%fmi)
call mvt_cr(this%mvt, this%name, this%inmvt, this%iout, this%fmi)
call gwt_obs_cr(this%obs, this%inobs)
!
! -- Check to make sure that required ftype's have been specified
Expand Down
21 changes: 11 additions & 10 deletions src/Model/TransportModel/tsp1.f90
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ module TransportModelModule
use TspFmiModule, only: TspFmiType
use TspAdvModule, only: TspAdvType
use TspSsmModule, only: TspSsmType
use TspMvtModule, only: TspMvtType
use TspOcModule, only: TspOcType
use BudgetModule, only: BudgetType
use MatrixBaseModule
Expand All @@ -30,12 +31,14 @@ module TransportModelModule
type(TspFmiType), pointer :: fmi => null() ! flow model interface
type(TspAdvType), pointer :: adv => null() !< advection package
type(TspIcType), pointer :: ic => null() !< initial conditions package
type(TspMvtType), pointer :: mvt => null() !< mover transport package
type(TspOcType), pointer :: oc => null() !< output control package
type(TspSsmType), pointer :: ssm => null() !< source sink mixing package
type(BudgetType), pointer :: budget => null() !< budget object
integer(I4B), pointer :: infmi => null() ! unit number FMI
integer(I4B), pointer :: inadv => null() !< unit number ADV
integer(I4B), pointer :: inic => null() !< unit number IC
integer(I4B), pointer :: inmvt => null() !< unit number MVT
integer(I4B), pointer :: inoc => null() !< unit number OC

integer(I4B), pointer :: inssm => null() !< unit number SSM
Expand Down Expand Up @@ -135,7 +138,6 @@ subroutine tsp_ac(this, sparse)
class(TransportModelType) :: this
type(sparsematrix), intent(inout) :: sparse
! -- local
! ------------------------------------------------------------------------------
!
! -- Return
return
Expand All @@ -152,7 +154,6 @@ subroutine tsp_mc(this, matrix_sln)
class(TransportModelType) :: this
class(MatrixBaseType), pointer :: matrix_sln !< global system matrix
! -- local
! ------------------------------------------------------------------------------
!
! -- Return
return
Expand All @@ -167,7 +168,6 @@ end subroutine tsp_mc
subroutine tsp_ar(this)
! -- dummy variables
class(TransportModelType) :: this
! ------------------------------------------------------------------------------
!
! -- Return
return
Expand All @@ -181,7 +181,6 @@ end subroutine tsp_ar
subroutine tsp_rp(this)
! -- dummy variables
class(TransportModelType) :: this
! ------------------------------------------------------------------------------
!
! -- Return
return
Expand All @@ -195,7 +194,6 @@ end subroutine tsp_rp
subroutine tsp_ad(this)
! -- dummy variables
class(TransportModelType) :: this
! ------------------------------------------------------------------------------
!
! -- Return
return
Expand All @@ -212,7 +210,6 @@ subroutine tsp_fc(this, kiter, matrix_sln, inwtflag)
integer(I4B), intent(in) :: kiter
class(MatrixBaseType), pointer :: matrix_sln
integer(I4B), intent(in) :: inwtflag
! ------------------------------------------------------------------------------
!
! -- Return
return
Expand All @@ -234,7 +231,6 @@ subroutine tsp_cc(this, innertot, kiter, iend, icnvgmod, cpak, ipak, dpak)
integer(I4B), intent(inout) :: ipak
real(DP), intent(inout) :: dpak
! -- local
! ------------------------------------------------------------------------------
!
! -- Return
return
Expand All @@ -251,7 +247,6 @@ subroutine tsp_cq(this, icnvg, isuppress_output)
integer(I4B), intent(in) :: icnvg
integer(I4B), intent(in) :: isuppress_output
! -- local
! ------------------------------------------------------------------------------
!
! -- Return
return
Expand All @@ -267,7 +262,6 @@ subroutine tsp_bd(this, icnvg, isuppress_output)
class(TransportModelType) :: this
integer(I4B), intent(in) :: icnvg
integer(I4B), intent(in) :: isuppress_output
! ------------------------------------------------------------------------------
!
! -- Return
return
Expand All @@ -283,21 +277,22 @@ subroutine allocate_tsp_scalars(this, modelname)
! -- dummy
class(TransportModelType) :: this
character(len=*), intent(in) :: modelname
! ------------------------------------------------------------------------------
!
! -- allocate members from (grand)parent class
call this%NumericalModelType%allocate_scalars(modelname)
!
! -- allocate members that are part of model class
call mem_allocate(this%inic, 'INIC', this%memoryPath)
call mem_allocate(this%infmi, 'INFMI', this%memoryPath)
call mem_allocate(this%inmvt, 'INMVT', this%memoryPath)
call mem_allocate(this%inadv, 'INADV', this%memoryPath)
call mem_allocate(this%inssm, 'INSSM', this%memoryPath)
call mem_allocate(this%inoc, 'INOC ', this%memoryPath)
call mem_allocate(this%eqnsclfac, 'EQNSCLFAC', this%memoryPath)
!
this%inic = 0
this%infmi = 0
this%inmvt = 0
this%inadv = 0
this%inssm = 0
this%inoc = 0
Expand Down Expand Up @@ -352,6 +347,7 @@ subroutine tsp_da(this)
call mem_deallocate(this%infmi)
call mem_deallocate(this%inadv)
call mem_deallocate(this%inssm)
call mem_deallocate(this%inmvt)
call mem_deallocate(this%inoc)
call mem_deallocate(this%eqnsclfac)
!
Expand Down Expand Up @@ -509,6 +505,7 @@ subroutine create_tsp_packages(this, indis)
use TspFmiModule, only: fmi_cr
use TspAdvModule, only: adv_cr
use TspSsmModule, only: ssm_cr
use TspMvtModule, only: mvt_cr
use TspOcModule, only: oc_cr
! -- dummy
class(TransportModelType) :: this
Expand Down Expand Up @@ -564,6 +561,8 @@ subroutine create_tsp_packages(this, indis)
this%inic = inunit
case ('FMI6')
this%infmi = inunit
case ('MVT6')
this%inmvt = inunit
case ('ADV6')
this%inadv = inunit
case ('SSM6')
Expand All @@ -582,6 +581,8 @@ subroutine create_tsp_packages(this, indis)
this%eqnsclfac)
call ssm_cr(this%ssm, this%name, this%inssm, this%iout, this%fmi, &
this%eqnsclfac, this%depvartype)
call mvt_cr(this%mvt, this%name, this%inmvt, this%iout, this%fmi, &
this%eqnsclfac)
call oc_cr(this%oc, this%name, this%inoc, this%iout)

!
Expand Down
Loading

0 comments on commit d3108a2

Please sign in to comment.