Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(tsp1.f90): move code from gwt1.f90 to tsp1.f90 #1445

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 6 additions & 32 deletions src/Model/GroundWaterTransport/gwt1.f90
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ subroutine gwt_cr(filename, id, modelname)
use ConstantsModule, only: LINELENGTH, LENPACKAGENAME
use MemoryHelperModule, only: create_mem_path
use MemoryManagerExtModule, only: mem_set_value
use SimVariablesModule, only: idm_context
use GwtNamInputModule, only: GwtNamParamFoundType
use BudgetModule, only: budget_cr
! -- dummy
Expand All @@ -113,9 +112,6 @@ subroutine gwt_cr(filename, id, modelname)
integer(I4B) :: indis
type(GwtModelType), pointer :: this
class(BaseModelType), pointer :: model
character(len=LENMEMPATH) :: input_mempath
character(len=LINELENGTH) :: lst_fname
type(GwtNamParamFoundType) :: found
!
! -- Allocate a new GWT Model (this)
allocate (this)
Expand All @@ -132,33 +128,8 @@ subroutine gwt_cr(filename, id, modelname)
model => this
call AddBaseModelToList(basemodellist, model)
!
! -- Assign values
this%filename = filename
this%name = modelname
this%macronym = 'GWT'
this%id = id
!
! -- set input model namfile memory path
input_mempath = create_mem_path(modelname, 'NAM', idm_context)
!
! -- copy option params from input context
call mem_set_value(lst_fname, 'LIST', input_mempath, found%list)
call mem_set_value(this%iprpak, 'PRINT_INPUT', input_mempath, &
found%print_input)
call mem_set_value(this%iprflow, 'PRINT_FLOWS', input_mempath, &
found%print_flows)
call mem_set_value(this%ipakcb, 'SAVE_FLOWS', input_mempath, found%save_flows)
!
! -- activate save_flows if found
if (found%save_flows) then
this%ipakcb = -1
end if
!
! -- Create utility objects
call budget_cr(this%budget, this%name)
!
! -- Call parent class routine
call this%tsp_cr(filename, id, modelname, indis)
call this%tsp_cr(filename, id, modelname, 'GWT', indis)
!
! -- create model packages
call this%create_packages(indis)
Expand Down Expand Up @@ -190,7 +161,8 @@ subroutine gwt_df(this)
if (this%indsp > 0) call this%dsp%dsp_df(this%dis)
if (this%inssm > 0) call this%ssm%ssm_df()
call this%oc%oc_df()
call this%budget%budget_df(NIUNIT_GWT, 'MASS', 'M')
call this%budget%budget_df(NIUNIT_GWT, this%depvarunit, &
this%depvarunitabbrev)
!
! -- Check for SSM package
if (this%inssm == 0) then
Expand Down Expand Up @@ -317,7 +289,7 @@ subroutine gwt_ar(this)
!call this%dis%dis_ar(this%npf%icelltype)
!
! -- set up output control
call this%oc%oc_ar(this%x, this%dis, DHNOFLO)
call this%oc%oc_ar(this%x, this%dis, DHNOFLO, this%depvartype)
call this%budget%set_ibudcsv(this%oc%ibudcsv)
!
! -- Package input files now open, so allocate and read
Expand Down Expand Up @@ -512,6 +484,8 @@ subroutine gwt_cc(this, innertot, kiter, iend, icnvgmod, cpak, ipak, dpak)
character(len=LENPAKLOC), intent(inout) :: cpak
integer(I4B), intent(inout) :: ipak
real(DP), intent(inout) :: dpak
! -- local
! -- formats
!
! -- If mover is on, then at least 2 outers required
if (this%inmvt > 0) call this%mvt%mvt_cc(kiter, iend, icnvgmod, cpak, dpak)
Expand Down
29 changes: 28 additions & 1 deletion src/Model/TransportModel/tsp1.f90
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,11 @@ module TransportModelModule
!!
!! Create a new transport model that will be further refined into GWT or GWE
!<
subroutine tsp_cr(this, filename, id, modelname, indis)
subroutine tsp_cr(this, filename, id, modelname, macronym, indis)
! -- modules
use MemoryHelperModule, only: create_mem_path
use MemoryManagerExtModule, only: mem_set_value
use SimVariablesModule, only: idm_context
use GwfNamInputModule, only: GwfNamParamFoundType
use BudgetModule, only: budget_cr
! -- dummy
Expand All @@ -101,13 +104,37 @@ subroutine tsp_cr(this, filename, id, modelname, indis)
integer(I4B), intent(in) :: id
integer(I4B), intent(inout) :: indis
character(len=*), intent(in) :: modelname
character(len=*), intent(in) :: macronym
! -- local
character(len=LENMEMPATH) :: input_mempath
character(len=LINELENGTH) :: lst_fname
type(GwfNamParamFoundType) :: found
!
! -- Assign values
this%filename = filename
this%name = modelname
this%id = id
this%macronym = macronym
!
! -- set input model namfile memory path
input_mempath = create_mem_path(modelname, 'NAM', idm_context)
!
! -- copy option params from input context
call mem_set_value(lst_fname, 'LIST', input_mempath, found%list)
call mem_set_value(this%iprpak, 'PRINT_INPUT', input_mempath, &
found%print_input)
call mem_set_value(this%iprflow, 'PRINT_FLOWS', input_mempath, &
found%print_flows)
call mem_set_value(this%ipakcb, 'SAVE_FLOWS', input_mempath, found%save_flows)
!
! -- create the list file
call this%create_lstfile(lst_fname, filename, found%list)
!
! -- activate save_flows if found
if (found%save_flows) then
this%ipakcb = -1
end if
!
! -- log set options
if (this%iout > 0) then
call this%log_namfile_options(found)
Expand Down
11 changes: 7 additions & 4 deletions src/Model/TransportModel/tsp1oc1.f90
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,15 @@ end subroutine oc_cr

!> @ brief Allocate and read TspOcType
!!
!! Setup concentration and budget as output control variables.
!! Setup dependent variable (e.g., concentration or temperature)
!! and budget as output control variables.
!!
!<
subroutine oc_ar(this, conc, dis, dnodata)
subroutine oc_ar(this, depvar, dis, dnodata, dvname)
! -- dummy
class(TspOcType) :: this !< TspOcType object
real(DP), dimension(:), pointer, contiguous, intent(in) :: conc !< model concentration
real(DP), dimension(:), pointer, contiguous, intent(in) :: depvar !< model concentration
character(len=*), intent(in) :: dvname !< name of dependent variable solved by generalized transport model (concentration, temperature)
class(DisBaseType), pointer, intent(in) :: dis !< model discretization package
real(DP), intent(in) :: dnodata !< no data value
! -- local
Expand All @@ -78,7 +81,7 @@ subroutine oc_ar(this, conc, dis, dnodata)
'COLUMNS 10 WIDTH 11 DIGITS 4 GENERAL ', &
this%iout, dnodata)
case (2)
call ocdobjptr%init_dbl('CONCENTRATION', conc, dis, 'PRINT LAST ', &
call ocdobjptr%init_dbl(trim(dvname), depvar, dis, 'PRINT LAST ', &
'COLUMNS 10 WIDTH 11 DIGITS 4 GENERAL ', &
this%iout, dnodata)
end select
Expand Down
Loading