Skip to content

Commit

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

* Remove unnecessary variable
  • Loading branch information
emorway-usgs authored Oct 12, 2023
1 parent b1f4027 commit f67f101
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 34 deletions.
8 changes: 4 additions & 4 deletions make/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ $(OBJDIR)/IdmLoad.o \
$(OBJDIR)/BoundaryPackage.o \
$(OBJDIR)/VirtualBase.o \
$(OBJDIR)/BaseModel.o \
$(OBJDIR)/PrintSaveManager.o \
$(OBJDIR)/PackageBudget.o \
$(OBJDIR)/HeadFileReader.o \
$(OBJDIR)/BudgetObject.o \
Expand All @@ -191,8 +192,8 @@ $(OBJDIR)/VirtualDataLists.o \
$(OBJDIR)/VirtualDataContainer.o \
$(OBJDIR)/SimStages.o \
$(OBJDIR)/NumericalModel.o \
$(OBJDIR)/OutputControlData.o \
$(OBJDIR)/FlowModelInterface.o \
$(OBJDIR)/PrintSaveManager.o \
$(OBJDIR)/Xt3dAlgorithm.o \
$(OBJDIR)/gwf3tvbase8.o \
$(OBJDIR)/gwf3sfr8.o \
Expand All @@ -206,11 +207,11 @@ $(OBJDIR)/gwf3drn8.o \
$(OBJDIR)/IndexMap.o \
$(OBJDIR)/VirtualModel.o \
$(OBJDIR)/BaseExchange.o \
$(OBJDIR)/OutputControl.o \
$(OBJDIR)/gwf3ic8.o \
$(OBJDIR)/tsp1fmi1.o \
$(OBJDIR)/TspAdvOptions.o \
$(OBJDIR)/UzfCellGroup.o \
$(OBJDIR)/OutputControlData.o \
$(OBJDIR)/Xt3dInterface.o \
$(OBJDIR)/gwf3tvk8.o \
$(OBJDIR)/gwf3vsc8.o \
Expand All @@ -221,6 +222,7 @@ $(OBJDIR)/ImsLinearSettings.o \
$(OBJDIR)/ConvergenceSummary.o \
$(OBJDIR)/CellWithNbrs.o \
$(OBJDIR)/NumericalExchange.o \
$(OBJDIR)/tsp1oc1.o \
$(OBJDIR)/tsp1ic1.o \
$(OBJDIR)/tsp1adv1.o \
$(OBJDIR)/gwf3disv8.o \
Expand All @@ -229,7 +231,6 @@ $(OBJDIR)/gwf3dis8.o \
$(OBJDIR)/gwf3uzf8.o \
$(OBJDIR)/gwt1apt1.o \
$(OBJDIR)/GwtSpc.o \
$(OBJDIR)/OutputControl.o \
$(OBJDIR)/gwt1mst1.o \
$(OBJDIR)/GwtDspOptions.o \
$(OBJDIR)/gwf3npf8.o \
Expand All @@ -252,7 +253,6 @@ $(OBJDIR)/gwt1uzt1.o \
$(OBJDIR)/gwt1ssm1.o \
$(OBJDIR)/gwt1src1.o \
$(OBJDIR)/gwt1sft1.o \
$(OBJDIR)/gwt1oc1.o \
$(OBJDIR)/gwt1obs1.o \
$(OBJDIR)/gwt1mwt1.o \
$(OBJDIR)/gwt1mvt1.o \
Expand Down
4 changes: 2 additions & 2 deletions msvs/mf6core.vfproj
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@
<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\gwt1oc1.f90"/>
<File RelativePath="..\src\Model\GroundWaterTransport\gwt1sft1.f90"/>
<File RelativePath="..\src\Model\GroundWaterTransport\gwt1src1.f90"/>
<File RelativePath="..\src\Model\GroundWaterTransport\gwt1ssm1.f90"/>
Expand Down Expand Up @@ -208,7 +207,8 @@
<File RelativePath="..\src\Model\TransportModel\tsp1.f90"/>
<File RelativePath="..\src\Model\TransportModel\tsp1adv1.f90"/>
<File RelativePath="..\src\Model\TransportModel\tsp1fmi1.f90"/>
<File RelativePath="..\src\Model\TransportModel\tsp1ic1.f90"/></Filter>
<File RelativePath="..\src\Model\TransportModel\tsp1ic1.f90"/>
<File RelativePath="..\src\Model\TransportModel\tsp1oc1.f90"/></Filter>
<File RelativePath="..\src\Model\BaseModel.f90"/>
<File RelativePath="..\src\Model\ExplicitModel.f90"/>
<File RelativePath="..\src\Model\NumericalModel.f90"/>
Expand Down
2 changes: 1 addition & 1 deletion src/Model/GroundWaterFlow/gwf3oc8.f90
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ end subroutine oc_cr
!<
subroutine oc_ar(this, head, dis, dnodata)
! -- dummy
class(GwfOcType) :: this !< GwtOcType object
class(GwfOcType) :: this !< GwfOcType object
real(DP), dimension(:), pointer, contiguous, intent(in) :: head !< model head
class(DisBaseType), pointer, intent(in) :: dis !< model discretization package
real(DP), intent(in) :: dnodata !< no data value
Expand Down
11 changes: 0 additions & 11 deletions src/Model/GroundWaterTransport/gwt1.f90
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,10 @@ module GwtModule
use TransportModelModule, only: TransportModelType
use BaseModelModule, only: BaseModelType
use BndModule, only: BndType, AddBndToList, GetBndFromList
use TspFmiModule, only: TspFmiType
use GwtDspModule, only: GwtDspType
use GwtSsmModule, only: GwtSsmType
use GwtMvtModule, only: GwtMvtType
use GwtMstModule, only: GwtMstType
use GwtOcModule, only: GwtOcType
use GwtObsModule, only: GwtObsType
use BudgetModule, only: BudgetType
use MatrixBaseModule
Expand All @@ -41,13 +39,11 @@ module GwtModule
type(GwtDspType), pointer :: dsp => null() ! dispersion package
type(GwtSsmType), pointer :: ssm => null() ! source sink mixing package
type(GwtMvtType), pointer :: mvt => null() ! mover transport package
type(GwtOcType), pointer :: oc => null() ! output control 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 :: inssm => null() ! unit number SSM
integer(I4B), pointer :: inoc => null() ! unit number OC
integer(I4B), pointer :: inobs => null() ! unit number OBS

contains
Expand Down Expand Up @@ -885,7 +881,6 @@ subroutine gwt_da(this)
call mem_deallocate(this%inssm)
call mem_deallocate(this%inmst)
call mem_deallocate(this%inmvt)
call mem_deallocate(this%inoc)
call mem_deallocate(this%inobs)
!
! -- Parent class members
Expand Down Expand Up @@ -974,14 +969,12 @@ subroutine allocate_scalars(this, modelname)
call mem_allocate(this%inmst, 'INMST', this%memoryPath)
call mem_allocate(this%indsp, 'INDSP', this%memoryPath)
call mem_allocate(this%inssm, 'INSSM', this%memoryPath)
call mem_allocate(this%inoc, 'INOC ', this%memoryPath)
call mem_allocate(this%inobs, 'INOBS', this%memoryPath)
!
this%inmvt = 0
this%inmst = 0
this%indsp = 0
this%inssm = 0
this%inoc = 0
this%inobs = 0
!
! -- Return
Expand Down Expand Up @@ -1152,7 +1145,6 @@ subroutine create_gwt_packages(this, indis)
use GwtDspModule, only: dsp_cr
use GwtSsmModule, only: ssm_cr
use GwtMvtModule, only: mvt_cr
use GwtOcModule, only: oc_cr
use GwtObsModule, only: gwt_obs_cr
! -- dummy
class(GwtModelType) :: this
Expand Down Expand Up @@ -1203,8 +1195,6 @@ subroutine create_gwt_packages(this, indis)
mempathdsp = mempath
case ('SSM6')
this%inssm = inunit
case ('OC6')
this%inoc = inunit
case ('OBS6')
this%inobs = inunit
case ('CNC6', 'SRC6', 'LKT6', 'SFT6', &
Expand All @@ -1222,7 +1212,6 @@ subroutine create_gwt_packages(this, indis)
this%fmi)
call ssm_cr(this%ssm, this%name, this%inssm, this%iout, this%fmi)
call mvt_cr(this%mvt, this%name, this%inmvt, this%iout, this%fmi)
call oc_cr(this%oc, this%name, this%inoc, this%iout)
call gwt_obs_cr(this%obs, this%inobs)
!
! -- Check to make sure that required ftype's have been specified
Expand Down
11 changes: 11 additions & 0 deletions src/Model/TransportModel/tsp1.f90
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ module TransportModelModule
use TspIcModule, only: TspIcType
use TspFmiModule, only: TspFmiType
use TspAdvModule, only: TspAdvType
use TspOcModule, only: TspOcType
use BudgetModule, only: BudgetType
use MatrixBaseModule

Expand All @@ -28,10 +29,12 @@ 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(TspOcType), pointer :: oc => null() !< output control 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 :: inoc => null() !< unit number OC
real(DP), pointer :: eqnsclfac => null() !< constant factor by which all terms in the model's governing equation are scaled (divided) for formulation and solution
! Labels that will be defined
character(len=LENVARNAME) :: tsptype = '' !< "solute" or "heat"
Expand Down Expand Up @@ -285,11 +288,13 @@ subroutine allocate_tsp_scalars(this, modelname)
call mem_allocate(this%inic, 'INIC', this%memoryPath)
call mem_allocate(this%infmi, 'INFMI', this%memoryPath)
call mem_allocate(this%inadv, 'INADV', 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%inadv = 0
this%inoc = 0
this%eqnsclfac = DZERO
!
! -- Return
Expand Down Expand Up @@ -340,6 +345,7 @@ subroutine tsp_da(this)
call mem_deallocate(this%inic)
call mem_deallocate(this%infmi)
call mem_deallocate(this%inadv)
call mem_deallocate(this%inoc)
call mem_deallocate(this%eqnsclfac)
!
! -- Return
Expand Down Expand Up @@ -495,6 +501,7 @@ subroutine create_tsp_packages(this, indis)
use TspIcModule, only: ic_cr
use TspFmiModule, only: fmi_cr
use TspAdvModule, only: adv_cr
use TspOcModule, only: oc_cr
! -- dummy
class(TransportModelType) :: this
integer(I4B), intent(inout) :: indis ! DIS enabled flag
Expand Down Expand Up @@ -551,6 +558,8 @@ subroutine create_tsp_packages(this, indis)
this%infmi = inunit
case ('ADV6')
this%inadv = inunit
case ('OC6')
this%inoc = inunit
end select
end do
!
Expand All @@ -561,6 +570,8 @@ subroutine create_tsp_packages(this, indis)
this%depvartype)
call adv_cr(this%adv, this%name, this%inadv, this%iout, this%fmi, &
this%eqnsclfac)
call oc_cr(this%oc, this%name, this%inoc, this%iout)

!
! -- Return
return
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module GwtOcModule
module TspOcModule

use BaseDisModule, only: DisBaseType
use KindModule, only: DP, I4B
Expand All @@ -8,29 +8,28 @@ module GwtOcModule

implicit none
private
public GwtOcType, oc_cr
public TspOcType, oc_cr

!> @ brief Output control for GWT
!> @ brief Output control
!!
!! Concrete implementation of OutputControlType for the
!! GWT Model
!! Concrete implementation of OutputControlType for a
!! Transport Model
!<
type, extends(OutputControlType) :: GwtOcType
type, extends(OutputControlType) :: TspOcType
contains
procedure :: oc_ar
end type GwtOcType
end type TspOcType

contains

!> @ brief Create GwtOcType
!> @ brief Create TspOcType
!!
!! Create by allocating a new GwtOcType object and initializing
!! Create by allocating a new TspOcType object and initializing
!! member variables.
!!
!<
subroutine oc_cr(ocobj, name_model, inunit, iout)
! -- dummy
type(GwtOcType), pointer :: ocobj !< GwtOcType object
type(TspOcType), pointer :: ocobj !< TspOcType object
character(len=*), intent(in) :: name_model !< name of the model
integer(I4B), intent(in) :: inunit !< unit number for input
integer(I4B), intent(in) :: iout !< unit number for output
Expand All @@ -52,14 +51,13 @@ subroutine oc_cr(ocobj, name_model, inunit, iout)
return
end subroutine oc_cr

!> @ brief Allocate and read GwtOcType
!> @ brief Allocate and read TspOcType
!!
!! Setup concentration and budget as output control variables.
!!
!<
subroutine oc_ar(this, conc, dis, dnodata)
! -- dummy
class(GwtOcType) :: this !< GwtOcType object
class(TspOcType) :: this !< TspOcType object
real(DP), dimension(:), pointer, contiguous, intent(in) :: conc !< model concentration
class(DisBaseType), pointer, intent(in) :: dis !< model discretization package
real(DP), intent(in) :: dnodata !< no data value
Expand Down Expand Up @@ -97,4 +95,4 @@ subroutine oc_ar(this, conc, dis, dnodata)
return
end subroutine oc_ar

end module GwtOcModule
end module TspOcModule
2 changes: 1 addition & 1 deletion src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ modflow_sources = files(
'Model' / 'GroundWaterTransport' / 'gwt1mvt1.f90',
'Model' / 'GroundWaterTransport' / 'gwt1mwt1.f90',
'Model' / 'GroundWaterTransport' / 'gwt1obs1.f90',
'Model' / 'GroundWaterTransport' / 'gwt1oc1.f90',
'Model' / 'GroundWaterTransport' / 'gwt1sft1.f90',
'Model' / 'GroundWaterTransport' / 'gwt1src1.f90',
'Model' / 'GroundWaterTransport' / 'gwt1ssm1.f90',
Expand Down Expand Up @@ -134,6 +133,7 @@ modflow_sources = files(
'Model' / 'TransportModel' / 'tsp1adv1.f90',
'Model' / 'TransportModel' / 'tsp1fmi1.f90',
'Model' / 'TransportModel' / 'tsp1ic1.f90',
'Model' / 'TransportModel' / 'tsp1oc1.f90',
'Model' / 'BaseModel.f90',
'Model' / 'ExplicitModel.f90',
'Model' / 'NumericalModel.f90',
Expand Down

0 comments on commit f67f101

Please sign in to comment.