Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=r64), | intent(in) | :: | OldTimeStep | |||
real(kind=r64), | intent(in) | :: | NewTimeStep | |||
real(kind=r64), | intent(inout) | :: | oldVal0 | |||
real(kind=r64), | intent(inout) | :: | oldVal1 | |||
real(kind=r64), | intent(inout) | :: | oldVal2 | |||
real(kind=r64), | intent(inout) | :: | oldVal3 | |||
real(kind=r64), | intent(inout) | :: | oldVal4 | |||
real(kind=r64), | intent(inout) | :: | newVal0 | |||
real(kind=r64), | intent(inout) | :: | newVal1 | |||
real(kind=r64), | intent(inout) | :: | newVal2 | |||
real(kind=r64), | intent(inout) | :: | newVal3 | |||
real(kind=r64), | intent(inout) | :: | newVal4 |
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed arrows point from an interface to procedures which implement that interface. This could include the module procedures in a generic interface or the implementation in a submodule of an interface in a parent module. Where possible, edges connecting nodes are given different colours to make them easier to distinguish in large graphs.
SUBROUTINE DownInterpolate4HistoryValues ( OldTimeStep, NewTimeStep, &
oldVal0, oldVal1, oldVal2, oldVal3, oldVal4, &
newVal0, newVal1, newVal2, newVal3, newVal4)
! SUBROUTINE INFORMATION:
! AUTHOR Brent Griffith
! DATE WRITTEN Feb 2008
! MODIFIED na
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! provide a reusable routine for the various places that need to
! interpolate a new set of history values on a different time scale
! Once the systemtimestep has shortened, the new history terms need to be interpolated
!
! METHODOLOGY EMPLOYED:
! This routine assumes that the direction is to a shorter timestep.
! The down step ratio, DSRatio = OldTimeStep/ NewTimeStep
! is expected to be roughly integer-valued and near 2.0 or 3.0 or 4.0 or more.
!
! REFERENCES:
! na
! USE STATEMENTS:
! na
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! SUBROUTINE ARGUMENT DEFINITIONS:
REAL(r64), INTENT(IN) :: OldTimeStep
REAL(r64), INTENT(IN) :: NewTimeStep
REAL(r64), INTENT(INOUT) :: oldVal0
REAL(r64), INTENT(INOUT) :: oldVal1
REAL(r64), INTENT(INOUT) :: oldVal2
REAL(r64), INTENT(INOUT) :: oldVal3
REAL(r64), INTENT(INOUT) :: oldVal4
REAL(r64), INTENT(INOUT) :: newVal0
REAL(r64), INTENT(INOUT) :: newVal1
REAL(r64), INTENT(INOUT) :: newVal2
REAL(r64), INTENT(INOUT) :: newVal3 ! unused 1208
REAL(r64), INTENT(INOUT) :: newVal4 ! unused 1208
! SUBROUTINE PARAMETER DEFINITIONS:
! na
! INTERFACE BLOCK SPECIFICATIONS:
! na
! DERIVED TYPE DEFINITIONS:
! na
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
REAL(r64) :: oldTime0
REAL(r64) :: oldTime1
REAL(r64) :: oldTime2
REAL(r64) :: oldTime3
REAL(r64) :: oldTime4
REAL(r64) :: newTime0
REAL(r64) :: newTime1
REAL(r64) :: newTime2
REAL(r64) :: newTime3
REAL(r64) :: newTime4
REAL(r64) :: DSRatio
! first construct data on timestamps for interpolating with later
oldTime0 = 0.0D0
oldTime1 = oldTime0 - OldTimeStep
oldTime2 = oldTime1 - OldTimeStep
oldTime3 = oldTime2 - OldTimeStep
oldTime4 = oldTime3 - OldTimeStep
newTime0 = 0.0D0
newTime1 = newTime0 - NewTimeStep
newTime2 = newTime1 - NewTimeStep
newTime3 = newTime2 - NewTimeStep
newTime4 = newTime3 - NewTimeStep
DSRatio = OldTimeStep/ NewTimeStep ! should pretty much be an integer value 2, 3, 4, etc.
newVal0 = oldVal0
IF (ABS(DSRatio - 2.0D0) < 0.01D0) THEN ! DSRatio = 2
! first two points lie between oldVal0 and oldVal1
newVal1 = oldVal0 + (oldVal1 - oldVal0) * ((oldTime0 - newTime1) / (OldTimeStep))
newVal2 = oldVal0 + (oldVal1 - oldVal0) * ((oldTime0 - newTime2) / (OldTimeStep))
! last two points lie between oldVal1 and oldVal2
newVal3 = oldVal1 + (oldVal2 - oldVal1) * ((oldTime1 - newTime3)/ (OldTimeStep))
newVal4 = oldVal1 + (oldVal2 - oldVal1) * ((oldTime1 - newTime4)/ (OldTimeStep))
ELSE IF (ABS(DSRatio - 3.0D0) < 0.01D0) THEN ! DSRatio = 3
! first three points lie between oldVal0 and oldVal1
newVal1 = oldVal0 + (oldVal1 - oldVal0) * ((oldTime0 - newTime1) / (OldTimeStep))
newVal2 = oldVal0 + (oldVal1 - oldVal0) * ((oldTime0 - newTime2) / (OldTimeStep))
newVal3 = oldVal0 + (oldVal1 - oldVal0) * ((oldTime0 - newTime3) / (OldTimeStep))
! last point lie between oldVal1 and oldVal2
newVal4 = oldVal1 + (oldVal2 - oldVal1) * ((oldTime1 - newTime4)/ (OldTimeStep))
ELSE IF (DSRatio > 3.99D0) THEN ! DSRatio = 4 or more
!all new points lie between oldVal0 and oldVal1
newVal1 = oldVal0 + (oldVal1 - oldVal0) * ((oldTime0 - newTime1) / (OldTimeStep))
newVal2 = oldVal0 + (oldVal1 - oldVal0) * ((oldTime0 - newTime2) / (OldTimeStep))
newVal3 = oldVal0 + (oldVal1 - oldVal0) * ((oldTime0 - newTime3) / (OldTimeStep))
newVal4 = oldVal0 + (oldVal1 - oldVal0) * ((oldTime0 - newTime4) / (OldTimeStep))
ENDIF
RETURN
END SUBROUTINE DownInterpolate4HistoryValues