Skip to content

Commit

Permalink
refactor(tsp): Elevate FMI to generalized transport class (MODFLOW-US…
Browse files Browse the repository at this point in the history
…GS#1386)

* refactor(tsp): Elevate FMI to generalized transport class

* fprettify

* Some missing ADV code as a result of not elevating it with this PR

* more spruce up in ADV

* Missing a deallocation in GwtInterfaceModel

* Thought I ran build_makefiles.py, but maybe not
  • Loading branch information
emorway-usgs authored Oct 7, 2023
1 parent 2177e8d commit c50ec80
Show file tree
Hide file tree
Showing 19 changed files with 806 additions and 323 deletions.
52 changes: 26 additions & 26 deletions make/makefile
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
# makefile created by pymake (version 1.2.9.dev0) for the 'mf6' executable.
# makefile created by pymake (version 1.2.7) for the 'mf6' executable.


include ./makedefaults

# Define the source file directories
SOURCEDIR1=../src
SOURCEDIR2=../src/Exchange
SOURCEDIR3=../src/Model
SOURCEDIR4=../src/Model/Geometry
SOURCEDIR5=../src/Model/TransportModel
SOURCEDIR6=../src/Model/ModelUtilities
SOURCEDIR7=../src/Model/Connection
SOURCEDIR2=../src/Distributed
SOURCEDIR3=../src/Exchange
SOURCEDIR4=../src/Model
SOURCEDIR5=../src/Model/Connection
SOURCEDIR6=../src/Model/Geometry
SOURCEDIR7=../src/Model/GroundWaterFlow
SOURCEDIR8=../src/Model/GroundWaterTransport
SOURCEDIR9=../src/Model/GroundWaterFlow
SOURCEDIR10=../src/Distributed
SOURCEDIR9=../src/Model/ModelUtilities
SOURCEDIR10=../src/Model/TransportModel
SOURCEDIR11=../src/Solution
SOURCEDIR12=../src/Solution/PETSc
SOURCEDIR13=../src/Solution/LinearMethods
SOURCEDIR12=../src/Solution/LinearMethods
SOURCEDIR13=../src/Solution/PETSc
SOURCEDIR14=../src/Timing
SOURCEDIR15=../src/Utilities
SOURCEDIR16=../src/Utilities/TimeSeries
SOURCEDIR17=../src/Utilities/Libraries
SOURCEDIR18=../src/Utilities/Libraries/rcm
SOURCEDIR19=../src/Utilities/Libraries/sparsekit
SOURCEDIR20=../src/Utilities/Libraries/sparskit2
SOURCEDIR16=../src/Utilities/ArrayRead
SOURCEDIR17=../src/Utilities/Idm
SOURCEDIR18=../src/Utilities/Idm/mf6blockfile
SOURCEDIR19=../src/Utilities/Idm/selector
SOURCEDIR20=../src/Utilities/Libraries
SOURCEDIR21=../src/Utilities/Libraries/blas
SOURCEDIR22=../src/Utilities/Libraries/daglib
SOURCEDIR23=../src/Utilities/Idm
SOURCEDIR24=../src/Utilities/Idm/selector
SOURCEDIR25=../src/Utilities/Idm/mf6blockfile
SOURCEDIR23=../src/Utilities/Libraries/rcm
SOURCEDIR24=../src/Utilities/Libraries/sparsekit
SOURCEDIR25=../src/Utilities/Libraries/sparskit2
SOURCEDIR26=../src/Utilities/Matrix
SOURCEDIR27=../src/Utilities/Vector
SOURCEDIR27=../src/Utilities/Memory
SOURCEDIR28=../src/Utilities/Observation
SOURCEDIR29=../src/Utilities/OutputControl
SOURCEDIR30=../src/Utilities/Memory
SOURCEDIR31=../src/Utilities/ArrayRead
SOURCEDIR30=../src/Utilities/TimeSeries
SOURCEDIR31=../src/Utilities/Vector

VPATH = \
${SOURCEDIR1} \
Expand Down Expand Up @@ -207,7 +207,7 @@ $(OBJDIR)/IndexMap.o \
$(OBJDIR)/VirtualModel.o \
$(OBJDIR)/BaseExchange.o \
$(OBJDIR)/UzfCellGroup.o \
$(OBJDIR)/gwt1fmi1.o \
$(OBJDIR)/tsp1fmi1.o \
$(OBJDIR)/OutputControlData.o \
$(OBJDIR)/gwf3ic8.o \
$(OBJDIR)/Xt3dInterface.o \
Expand All @@ -220,6 +220,9 @@ $(OBJDIR)/ImsLinearSettings.o \
$(OBJDIR)/ConvergenceSummary.o \
$(OBJDIR)/CellWithNbrs.o \
$(OBJDIR)/NumericalExchange.o \
$(OBJDIR)/gwf3disv8.o \
$(OBJDIR)/gwf3disu8.o \
$(OBJDIR)/gwf3dis8.o \
$(OBJDIR)/gwf3uzf8.o \
$(OBJDIR)/gwt1apt1.o \
$(OBJDIR)/GwtSpc.o \
Expand All @@ -240,7 +243,6 @@ $(OBJDIR)/SparseMatrix.o \
$(OBJDIR)/LinearSolverBase.o \
$(OBJDIR)/ims8reordering.o \
$(OBJDIR)/VirtualExchange.o \
$(OBJDIR)/gwf3disu8.o \
$(OBJDIR)/GridSorting.o \
$(OBJDIR)/DisConnExchange.o \
$(OBJDIR)/CsrUtils.o \
Expand All @@ -258,8 +260,6 @@ $(OBJDIR)/gwt1ist1.o \
$(OBJDIR)/gwt1dsp1.o \
$(OBJDIR)/gwt1cnc1.o \
$(OBJDIR)/gwt1adv1.o \
$(OBJDIR)/gwf3disv8.o \
$(OBJDIR)/gwf3dis8.o \
$(OBJDIR)/gwf3api8.o \
$(OBJDIR)/gwf3wel8.o \
$(OBJDIR)/gwf3rch8.o \
Expand Down
7 changes: 3 additions & 4 deletions msvs/mf6core.vfproj
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@
<File RelativePath="..\src\Model\GroundWaterTransport\gwt1disv1idm.f90"/>
<File RelativePath="..\src\Model\GroundWaterTransport\gwt1dsp1.f90"/>
<File RelativePath="..\src\Model\GroundWaterTransport\gwt1dsp1idm.f90"/>
<File RelativePath="..\src\Model\GroundWaterTransport\gwt1fmi1.f90"/>
<File RelativePath="..\src\Model\GroundWaterTransport\gwt1ic1.f90"/>
<File RelativePath="..\src\Model\GroundWaterTransport\gwt1idm.f90"/>
<File RelativePath="..\src\Model\GroundWaterTransport\gwt1ist1.f90"/>
Expand All @@ -184,8 +183,7 @@
<File RelativePath="..\src\Model\GroundWaterTransport\gwt1sft1.f90"/>
<File RelativePath="..\src\Model\GroundWaterTransport\gwt1src1.f90"/>
<File RelativePath="..\src\Model\GroundWaterTransport\gwt1ssm1.f90"/>
<File RelativePath="..\src\Model\GroundWaterTransport\gwt1uzt1.f90"/>
<File RelativePath="..\src\Model\TransportModel\tsp1.f90"/></Filter>
<File RelativePath="..\src\Model\GroundWaterTransport\gwt1uzt1.f90"/></Filter>
<Filter Name="ModelUtilities">
<File RelativePath="..\src\Model\ModelUtilities\BoundaryPackage.f90"/>
<File RelativePath="..\src\Model\ModelUtilities\BoundaryPackageExt.f90"/>
Expand All @@ -209,7 +207,8 @@
<File RelativePath="..\src\Model\ModelUtilities\Xt3dAlgorithm.f90"/>
<File RelativePath="..\src\Model\ModelUtilities\Xt3dInterface.f90"/></Filter>
<Filter Name="TransportModel">
<File RelativePath="..\src\Model\TransportModel\tsp1.f90"/></Filter>
<File RelativePath="..\src\Model\TransportModel\tsp1.f90"/>
<File RelativePath="..\src\Model\TransportModel\tsp1fmi1.f90"/></Filter>
<File RelativePath="..\src\Model\BaseModel.f90"/>
<File RelativePath="..\src\Model\ExplicitModel.f90"/>
<File RelativePath="..\src\Model\NumericalModel.f90"/>
Expand Down
14 changes: 11 additions & 3 deletions src/Model/Connection/GwtInterfaceModel.f90
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
module GwtInterfaceModelModule
use KindModule, only: I4B, DP
use ConstantsModule, only: DONE
use MemoryManagerModule, only: mem_allocate, mem_deallocate, mem_reallocate
use MemoryHelperModule, only: create_mem_path
use NumericalModelModule, only: NumericalModelType
use GwtModule, only: GwtModelType, CastAsGwtModel
use GwfDisuModule, only: disu_cr, CastAsDisuType
use GwtFmiModule, only: fmi_cr, GwtFmiType
use TspFmiModule, only: fmi_cr, TspFmiType
use GwtAdvModule, only: adv_cr, GwtAdvType
use GwtAdvOptionsModule, only: GwtAdvOptionsType
use GwtDspModule, only: dsp_cr, GwtDspType
Expand All @@ -25,6 +26,7 @@ module GwtInterfaceModelModule

integer(i4B), pointer :: iAdvScheme => null() !< the advection scheme: 0 = up, 1 = central, 2 = tvd
integer(i4B), pointer :: ixt3d => null() !< xt3d setting: 0 = off, 1 = lhs, 2 = rhs
real(DP), pointer :: ieqnsclfac => null() !< governing eqn scaling factor: 1: GWT, >1: GWE

class(GridConnectionType), pointer :: gridConnection => null() !< The grid connection class will provide the interface grid
class(GwtModelType), private, pointer :: owner => null() !< the real GWT model for which the exchange coefficients
Expand Down Expand Up @@ -59,6 +61,7 @@ subroutine gwtifmod_cr(this, name, iout, gridConn)
! defaults
this%iAdvScheme = 0
this%ixt3d = 0
this%ieqnsclfac = DONE

this%iout = iout
this%gridConnection => gridConn
Expand All @@ -79,8 +82,10 @@ subroutine gwtifmod_cr(this, name, iout, gridConn)

! create dis and packages
call disu_cr(this%dis, this%name, '', -1, this%iout)
call fmi_cr(this%fmi, this%name, 0, this%iout)
call adv_cr(this%adv, this%name, adv_unit, this%iout, this%fmi)
call fmi_cr(this%fmi, this%name, 0, this%iout, this%ieqnsclfac, &
this%depvartype)
call adv_cr(this%adv, this%name, adv_unit, this%iout, this%fmi, &
this%ieqnsclfac)
call dsp_cr(this%dsp, this%name, '', -dsp_unit, this%iout, this%fmi)
call gwt_obs_cr(this%obs, inobs)

Expand All @@ -94,6 +99,7 @@ subroutine allocate_scalars(this, modelname)

call mem_allocate(this%iAdvScheme, 'ADVSCHEME', this%memoryPath)
call mem_allocate(this%ixt3d, 'IXT3D', this%memoryPath)
call mem_allocate(this%ieqnsclfac, 'IEQNSCLFAC', this%memoryPath)

end subroutine allocate_scalars

Expand Down Expand Up @@ -192,6 +198,7 @@ subroutine gwtifmod_da(this)
! this
call mem_deallocate(this%iAdvScheme)
call mem_deallocate(this%ixt3d)
call mem_deallocate(this%ieqnsclfac)

! gwt packages
call this%dis%dis_da()
Expand Down Expand Up @@ -219,6 +226,7 @@ subroutine gwtifmod_da(this)
call mem_deallocate(this%inmvt)
call mem_deallocate(this%inoc)
call mem_deallocate(this%inobs)
call mem_deallocate(this%eqnsclfac)

! base
call this%NumericalModelType%model_da()
Expand Down
Loading

0 comments on commit c50ec80

Please sign in to comment.