Skip to content

Commit

Permalink
Remove unused/untested conditional pathways in forwardstep
Browse files Browse the repository at this point in the history
Also removed unused private procedure for setting time integrator with
integers.

Meant to improve diff hit for PR #59
  • Loading branch information
fluidnumerics-joe committed Oct 5, 2024
1 parent 3be2b7a commit e06f152
Showing 1 changed file with 17 additions and 73 deletions.
90 changes: 17 additions & 73 deletions src/SELF_Model.f90
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,7 @@ module SELF_Model
procedure(WriteModel),deferred :: WriteModel
procedure(WriteTecplot),deferred :: WriteTecplot

generic :: SetTimeIntegrator => SetTimeIntegrator_withInt, &
SetTimeIntegrator_withChar
procedure,private :: SetTimeIntegrator_withInt
generic :: SetTimeIntegrator => SetTimeIntegrator_withChar
procedure,private :: SetTimeIntegrator_withChar

procedure :: SetSimulationTime
Expand Down Expand Up @@ -593,42 +591,13 @@ pure function pbc3d_Prescribed_Model(this,x,t) result(extDsdx)

endfunction pbc3d_Prescribed_Model

subroutine SetTimeIntegrator_withInt(this,integrator)
!! Sets the time integrator method, using an integer flag
!!
!! Valid options for are
!!
!! SELF_EULER
!! SELF_RK3
!! SELF_RK4
!!
implicit none
class(Model),intent(inout) :: this
integer,intent(in) :: integrator

select case(integrator)

case(SELF_EULER)
this%timeIntegrator => Euler_timeIntegrator
case(SELF_RK2)
this%timeIntegrator => LowStorageRK2_timeIntegrator
case(SELF_RK3)
this%timeIntegrator => LowStorageRK3_timeIntegrator
case(SELF_RK4)
this%timeIntegrator => LowStorageRK4_timeIntegrator
case DEFAULT
this%timeIntegrator => LowStorageRK3_timeIntegrator

endselect

endsubroutine SetTimeIntegrator_withInt

subroutine SetTimeIntegrator_withChar(this,integrator)
!! Sets the time integrator method, using a character input
!!
!! Valid options for integrator are
!!
!! "euler"
!! "rk2"
!! "rk3"
!! "rk4"
!!
Expand Down Expand Up @@ -683,16 +652,6 @@ subroutine SetSimulationTime(this,t)

endsubroutine SetSimulationTime

subroutine SetInitialConditions_Model(this)
#undef __FUNC__
#define __FUNC__ "SetInitialConditions"
implicit none
class(Model),intent(inout) :: this

print*,__FILE__//" : No model, so nothing to set"

endsubroutine SetInitialConditions_Model

subroutine CalculateEntropy_Model(this)
!! Base method for calculating entropy of a model
!! When this method is not overridden, the entropy
Expand Down Expand Up @@ -752,42 +711,27 @@ subroutine ForwardStep_Model(this,tn,dt,ioInterval)
!! is reached
implicit none
class(Model),intent(inout) :: this
real(prec),optional,intent(in) :: tn
real(prec),optional,intent(in) :: dt
real(prec),optional,intent(in) :: ioInterval
real(prec),intent(in) :: tn
real(prec),intent(in) :: dt
real(prec),intent(in) :: ioInterval
! Local
real(prec) :: targetTime,tNext
integer :: i,nIO

if(present(dt)) then
this%dt = dt
endif

if(present(tn)) then
targetTime = tn
else
targetTime = this%t+this%dt
endif

if(present(ioInterval)) then
nIO = int((targetTime-this%t)/ioInterval)
do i = 1,nIO
tNext = this%t+ioInterval
call this%timeIntegrator(tNext)
this%t = tNext
call this%WriteModel()
call this%WriteTecplot()
call this%IncrementIOCounter()
call this%CalculateEntropy()
call this%ReportEntropy()
enddo

else
call this%timeIntegrator(targetTime)
this%t = targetTime
this%dt = dt
targetTime = tn

nIO = int((targetTime-this%t)/ioInterval)
do i = 1,nIO
tNext = this%t+ioInterval
call this%timeIntegrator(tNext)
this%t = tNext
call this%WriteModel()
call this%WriteTecplot()
call this%IncrementIOCounter()
call this%CalculateEntropy()
call this%ReportEntropy()
endif
enddo

endsubroutine ForwardStep_Model

Expand Down

0 comments on commit e06f152

Please sign in to comment.