Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(RootFinderDataType), | intent(inout) | :: | RootFinderData | |||
real(kind=r64), | intent(in) | :: | XMin | |||
real(kind=r64), | intent(in) | :: | XMax |
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 InitializeRootFinder( RootFinderData, XMin, XMax )
! SUBROUTINE INFORMATION:
! AUTHOR Dimitri Curtil (LBNL)
! DATE WRITTEN February 2006
! MODIFIED
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! This subroutine initializes the min and max for the root finder before
! finding a new root.
! METHODOLOGY EMPLOYED:
! na
! REFERENCES:
! na
! USE STATEMENTS:
! na
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! SUBROUTINE ARGUMENT DEFINITIONS:
TYPE(RootFinderDataType), INTENT(INOUT) :: RootFinderData ! Data used by root finding algorithm
REAL(r64), INTENT(IN) :: XMin ! Minimum X value allowed
REAL(r64), INTENT(IN) :: XMax ! Maximum X value allowed
! SUBROUTINE PARAMETER DEFINITIONS:
! na
! INTERFACE BLOCK SPECIFICATIONS
! na
! DERIVED TYPE DEFINITIONS
! na
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
REAL(r64) :: SavedXCandidate
REAL(r64) :: XMinReset
! FLOW:
XMinReset = XMin
IF ( XMin > XMax) THEN
IF (XMax == 0.0d0) THEN
XMinReset = XMax
ELSE
CALL ShowFatalError( &
'InitializeRootFinder: Invalid min/max bounds '// &
'XMin='// TRIM(TrimSigDigits(XMin,6))//' must be smaller than '// &
'XMax='// TRIM(TrimSigDigits(XMax,6)) &
)
END IF
END IF
! First save current candidate value before it is overriden in ResetRootFinder()
SavedXCandidate = RootFinderData%XCandidate
! Reset internal data for root finder with actual min and max values
!
! NOTE: This resets the value of RootFinderData%XCandidate to zero
CALL ResetRootFinder( RootFinderData, XMinReset, XMax )
! Enforce min/max constraints on previous candidate if available
!
! NOTE: If XMin == XMax then this forces the value of XCandidateto the desired solution
RootFinderData%XCandidate = MIN( RootFinderData%MaxPoint%X, &
MAX( SavedXCandidate, &
RootFinderData%MinPoint%X ) )
RETURN
END SUBROUTINE InitializeRootFinder