Skip to content

Commit

Permalink
refactor(exchanges): print use of dev option to list file (once) (#1559)
Browse files Browse the repository at this point in the history
  • Loading branch information
mjr-deltares authored Jan 19, 2024
1 parent 6d2c7a0 commit 5778e22
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 16 deletions.
18 changes: 2 additions & 16 deletions src/Model/Connection/ConnectionBuilder.f90
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ module ConnectionBuilderModule
private

type, public :: ConnectionBuilderType
logical(LGP) :: dev_always_ifmod = .false. !< development option: force interface model on all exchanges
contains
procedure, pass(this) :: processSolution
procedure, private, pass(this) :: processExchanges
Expand Down Expand Up @@ -78,7 +79,6 @@ end subroutine processSolution
!<
subroutine processExchanges(this, exchanges, newConnections)
use ListsModule, only: baseconnectionlist, baseexchangelist
use VersionModule, only: IDEVELOPMODE
class(ConnectionBuilderType) :: this !< the connection builder object
type(ListType), pointer, intent(in) :: exchanges !< the list of exchanges to process
type(ListType), intent(inout) :: newConnections !< the newly created connections
Expand All @@ -88,20 +88,6 @@ subroutine processExchanges(this, exchanges, newConnections)
integer(I4B) :: iex, ibasex
class(SpatialModelConnectionType), pointer :: modelConnection
logical(LGP) :: isPeriodic
integer(I4B) :: status
logical(LGP) :: dev_always_ifmod
character(len=16) :: envvar

! Force use of the interface model
dev_always_ifmod = .false.
if (IDEVELOPMODE == 1) then
call get_environment_variable('DEV_ALWAYS_USE_IFMOD', &
value=envvar, status=status)
if (status == 0 .and. envvar == '1') then
dev_always_ifmod = .true.
write (*, '(a,/)') "### Experimental: forcing interface model ###"
end if
end if

do iex = 1, exchanges%Count()
conEx => GetDisConnExchangeFromList(exchanges, iex)
Expand All @@ -113,7 +99,7 @@ subroutine processExchanges(this, exchanges, newConnections)
! for now, if we have XT3D on the interface, we use a connection,
! (this will be more generic in the future)
if (conEx%use_interface_model() .or. conEx%dev_ifmod_on &
.or. dev_always_ifmod) then
.or. this%dev_always_ifmod) then

! we should not get period connections here
isPeriodic = (conEx%v_model1 == conEx%v_model2)
Expand Down
12 changes: 12 additions & 0 deletions src/mf6core.f90
Original file line number Diff line number Diff line change
Expand Up @@ -437,9 +437,12 @@ end subroutine simulation_ar
subroutine connections_cr()
use ConnectionBuilderModule
use SimVariablesModule, only: iout
use VersionModule, only: IDEVELOPMODE
integer(I4B) :: isol
type(ConnectionBuilderType) :: connectionBuilder
class(BaseSolutionType), pointer :: sol => null()
integer(I4B) :: status
character(len=16) :: envvar

write (iout, '(/a)') 'PROCESSING MODEL CONNECTIONS'

Expand All @@ -449,6 +452,15 @@ subroutine connections_cr()
return
end if

if (IDEVELOPMODE == 1) then
call get_environment_variable('DEV_ALWAYS_USE_IFMOD', &
value=envvar, status=status)
if (status == 0 .and. envvar == '1') then
connectionBuilder%dev_always_ifmod = .true.
write (iout, '(/a)') "Development option: forcing interface model"
end if
end if

do isol = 1, basesolutionlist%Count()
sol => GetBaseSolutionFromList(basesolutionlist, isol)
call connectionBuilder%processSolution(sol)
Expand Down

0 comments on commit 5778e22

Please sign in to comment.