Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(RootFinderDataType), | intent(inout) | :: | RootFinderData | |||
integer, | intent(in) | :: | SlopeType | |||
integer, | intent(in) | :: | MethodType | |||
real(kind=r64), | intent(in) | :: | TolX | |||
real(kind=r64), | intent(in) | :: | ATolX | |||
real(kind=r64), | intent(in) | :: | ATolY |
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 SetupRootFinder( RootFinderData, SlopeType, MethodType, TolX, ATolX, ATolY )
! SUBROUTINE INFORMATION:
! AUTHOR Dimitri Curtil (LBNL)
! DATE WRITTEN February 2006
! MODIFIED
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! This subroutine loads the numerical controls for the root finder.
! 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
INTEGER, INTENT(IN) :: SlopeType ! Either iSlopeIncreasing or iSlopeDecreasing
INTEGER, INTENT(IN) :: MethodType ! Any of the iMethod<name> code but iMethodNone
REAL(r64), INTENT(IN) :: TolX ! Relative tolerance for X variables
REAL(r64), INTENT(IN) :: ATolX ! Absolute tolerance for X variables
REAL(r64), INTENT(IN) :: ATolY ! Absolute tolerance for Y variables
! SUBROUTINE PARAMETER DEFINITIONS:
! na
! INTERFACE BLOCK SPECIFICATIONS
! na
! DERIVED TYPE DEFINITIONS
! na
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
! na
! FLOW:
! Load assumed action for underlying function F(X)
IF ( SlopeType /= iSlopeIncreasing .AND. SlopeType /= iSlopeDecreasing ) THEN
CALL ShowSevereError('SetupRootFinder: Invalid function slope specification. Valid choices are:' )
CALL ShowContinueError('SetupRootFinder: iSlopeIncreasing='//TRIM(TrimSigDigits(iSlopeIncreasing)))
CALL ShowContinueError('SetupRootFinder: iSlopeDecreasing='//TRIM(TrimSigDigits(iSlopeDecreasing)))
CALL ShowFatalError('SetupRootFinder: Preceding error causes program termination.')
END IF
RootFinderData%Controls%SlopeType = SlopeType
! Load solution method
IF ( MethodType /= iMethodBisection .AND. &
MethodType /= iMethodFalsePosition .AND. &
MethodType /= iMethodSecant .AND. &
MethodType /= iMethodBrent ) THEN
CALL ShowSevereError('SetupRootFinder: Invalid solution method specification. Valid choices are:' )
CALL ShowContinueError('SetupRootFinder: iMethodBisection='//TRIM(TrimSigDigits(iMethodBisection)))
CALL ShowContinueError('SetupRootFinder: iMethodFalsePosition='//TRIM(TrimSigDigits(iMethodFalsePosition)))
CALL ShowContinueError('SetupRootFinder: iMethodSecant='//TRIM(TrimSigDigits(iMethodSecant)))
CALL ShowContinueError('SetupRootFinder: iMethodBrent='//TRIM(TrimSigDigits(iMethodBrent)))
CALL ShowFatalError('SetupRootFinder: Preceding error causes program termination.')
END IF
RootFinderData%Controls%MethodType = MethodType
! Load relative tolerance parameter for X variables
IF ( TolX < 0.0d0 ) THEN
CALL ShowFatalError('SetupRootFinder: Invalid tolerance specification for X variables. TolX >= 0')
END IF
RootFinderData%Controls%TolX = TolX
! Load absolute tolerance parameter for X variables
IF ( ATolX < 0.0d0 ) THEN
CALL ShowFatalError('SetupRootFinder: Invalid absolute tolerance specification for X variables. ATolX >= 0')
END IF
RootFinderData%Controls%ATolX = ATolX
! Load absolute tolerance parameter for Y variables
IF ( ATolY < 0.0d0 ) THEN
CALL ShowFatalError('SetupRootFinder: Invalid absolute tolerance specification for Y variables. ATolY >= 0')
END IF
RootFinderData%Controls%ATolY = ATolY
! Reset internal data for root finder with fictive min and max values
CALL ResetRootFinder( RootFinderData, constant_zero, constant_zero )
RETURN
END SUBROUTINE SetupRootFinder