Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(RootFinderDataType), | intent(in) | :: | RootFinderData |
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.
LOGICAL FUNCTION CheckNonSingularity( RootFinderData )
! FUNCTION INFORMATION:
! AUTHOR Dimitri Curtil (LBNL)
! DATE WRITTEN February 2006
! MODIFIED
! RE-ENGINEERED na
! PURPOSE OF THIS FUNCTION:
! This function checks whether the min and max points define a locally, singular
! equation system. In a 1-dimensional system, "singularity" is detected if the
! min and max points have the same y-values, thereby producing a zero slope
! across the min/max range.
!
! Returns TRUE if the function satisfies the non-singularity condition.
! Returns FALSE otherwise (i.e., F(X) essentially displays a zero slope
! between the min and max points) .
!
! PRECONDITION:
! - Function assumes that both the min and max points are defined.
!
! POSTCONDITION:
! - RootFinderData is NOT changed by this function.
!
! METHODOLOGY EMPLOYED:
! na
! REFERENCES:
! na
! USE STATEMENTS:
! na
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! FUNCTION ARGUMENT DEFINITIONS:
TYPE(RootFinderDataType), INTENT(IN) :: RootFinderData ! Data used by root finding algorithm
! FUNCTION PARAMETER DEFINITIONS:
! Safety factor used to detect a singular residual function between the min and max
! points.
!
! NOTE: Requesting exactly the same value is obtained by setting SafetyFactor = 0.0
REAL(r64), PARAMETER :: SafetyFactor = 0.1d0
! INTERFACE BLOCK SPECIFICATIONS
! na
! DERIVED TYPE DEFINITIONS
! na
! FUNCTION LOCAL VARIABLE DECLARATIONS:
REAL(r64) :: DeltaY ! Difference between min and max Y-values
REAL(r64) :: ATolY ! Absolute tolerance used to detected equal min and max Y-values
! FLOW:
! Added this check based on an absolute tolerance test for y values to avoid incorrectly detecting
! functions with bad slope due to numerical noise.
!
! Typically, this takes care of situations where the controlled equipment in ManageControllers()
! would be misdiagnosed as displaying the "wrong slope" instead of being treated as "singular"
! (i.e. in inactive mode).
DeltaY = ABS(RootFinderData%MinPoint%Y - RootFinderData%MaxPoint%Y)
ATolY = SafetyFactor * RootFinderData%Controls%ATolY
IF ( ABS(DeltaY) <= ATolY ) THEN
CheckNonSingularity = .FALSE.
ELSE
CheckNonSingularity = .TRUE.
END IF
RETURN
END FUNCTION CheckNonSingularity