NOX Development
Loading...
Searching...
No Matches
NOX::StatusTest::Factory Class Reference

Factory to build a set of status tests from a parameter list. More...

#include <NOX_StatusTest_Factory.H>

Public Member Functions

 Factory ()
 Constructor.
virtual ~Factory ()
 Destructor.
Teuchos::RCP< NOX::StatusTest::GenericbuildStatusTests (const std::string &file_name, const NOX::Utils &utils, std::map< std::string, Teuchos::RCP< NOX::StatusTest::Generic > > *tagged_tests=nullptr) const
 Returns a status test set from a parameter list xml file.
Teuchos::RCP< NOX::StatusTest::GenericbuildStatusTests (Teuchos::ParameterList &p, const NOX::Utils &utils, std::map< std::string, Teuchos::RCP< NOX::StatusTest::Generic > > *tagged_tests=nullptr) const
 Returns a status test set from a parameter list.

(Note that these are not member symbols.)

Teuchos::RCP< NOX::StatusTest::GenericbuildStatusTests (const std::string &file_name, const NOX::Utils &utils, std::map< std::string, Teuchos::RCP< NOX::StatusTest::Generic > > *tagged_tests=nullptr)
 Nonmember helper function for the NOX::StatusTest::Factory.
Teuchos::RCP< NOX::StatusTest::GenericbuildStatusTests (Teuchos::ParameterList &p, const NOX::Utils &utils, std::map< std::string, Teuchos::RCP< NOX::StatusTest::Generic > > *tagged_tests=nullptr)
 Nonmember helper function for the NOX::StatusTest::Factory.
Teuchos::RCP< LOCA::StatusTest::AbstractbuildStatusTests (const std::string &file_name, const Teuchos::RCP< const LOCA::GlobalData > &globalData, std::map< std::string, Teuchos::RCP< LOCA::StatusTest::Abstract > > *tagged_tests=0)
 Nonmember helper function for the NOX::StatusTest::Factory.
Teuchos::RCP< LOCA::StatusTest::AbstractbuildStatusTests (Teuchos::ParameterList &p, const Teuchos::RCP< const LOCA::GlobalData > &globalData, std::map< std::string, Teuchos::RCP< LOCA::StatusTest::Abstract > > *tagged_tests=0)
 Nonmember helper function for the NOX::StatusTest::Factory.

Detailed Description

Factory to build a set of status tests from a parameter list.

This object takes either an xml file name or a Teuchos::ParameterList and generates an entire set (a tree) of status tests for use in a NOX::Solver derived object.

The tagged_tests field in the constructors allows users to store tests from the tree in a flat list in case they want to change the tolerance values during a run. The tagged_tests flag is optional.

Please use the related nonmember functions instead of calling the factory directly (See example below).

Valid parameters are as follows:

Additional parameters valid for a Combo test (NOX::StatusTest::Combo):

  • "Combo Type" <std:string> Type of combo to use. Valid options are:

    • "AND"
    • "OR"

  • "Number of Tests" <int> Number of sublists that contain tests to be added to this combo test. The sublists must be named "Test X" where "X" represents the test number starting with 0 and preceeding to "Number of Tests - 1".

  • "Test X" <Teuchos::ParameterList> A sublist containing a test to add to the current combo test. The "X" represents the number of the test. the numbering starts with 0 and is valid through "Number of Tests - 1" tests.

Additional parameters valid for a Norm F test (NOX::StatusTest::NormF):

  • "Tolerance" <double> required tolerance for the test to return a converged status. (default = 1.0e-8)
  • "Norm Type" <std::string> Type of norm to use. Valid options are:
    • "Two Norm" (default)
    • "One Norm"
    • "Max Norm"
  • "Scale Type" <std::string> Type of scaling to use. Valid options are:
    • "Unscaled" (default)
    • "Scaled"
  • "Initial Guess" < Teuchos::RCP<NOX::Abstract::Group> > If present, a relative tolerance will be used where the group passed in will be used to compute $F_0$.

Additional parameters valid for a Norm Update test (NOX::StatusTest::NormUpdate):

  • "Tolerance" <double> required tolerance for the test to return a converged status. (default = 1.0e-3)
  • "Norm Type" <std::string> Type of norm to use. Valid options are:
    • "Two Norm" (default)
    • "One Norm"
    • "Max Norm"
  • "Scale Type" <std::string> Type of scaling to use. Valid options are:
    • "Unscaled" (default)
    • "Scaled"

Additional parameters valid for a Norm WRMS test (NOX::StatusTest::NormWRMS):

  • "Tolerance" <double> (default = 1.0)
  • "Relative Tolerance" <double> (default = 1.0e-5)
  • "Absolute Tolerance" <double> or < Teuchos::RCP<const NOX::Abstract::Vector> > (default = 1.0e-8)
  • "BDF Multiplier" <double> (default = 1.0)
  • "Alpha" <double> (default = 1.0)
  • "Beta" <double> (default = 0.5)

Additional parameters valid for a Maximum Iterations test (NOX::StatusTest::MaxIters):

  • "Maximum Iterations" <int>

Additional parameters valid for a Finite Value test (NOX::StatusTest::FiniteValue):

  • "Vector Type" <std::string> Type of vector to check. Valid options are:
    • "F Vector" (default)
    • "Solution Vector"
  • "Norm Type" <std::string> Type of norm to use. Valid options are:
    • "Two Norm" (default)
    • "One Norm"
    • "Max Norm"

Additional parameters valid for a Divergence test (NOX::StatusTest::Divergence):

  • "Tolerance" <double> (default = 1.0e+12)
  • "Consecutive Iterations" <int> (default = 1)

Additional parameters valid for a Stagnation test (NOX::StatusTest::Stagnation):

  • "Tolerance" <double> (default = 1.0e+12)
  • "Consecutive Iterations" <int> (default = 1)

Additional parameters valid for a RelativeNormF test (NOX::StatusTest::RelativeNormF):

  • "Tolerance" <double> required tolerance for the test to return a converged status. (default = 1.0e-8)
  • "Scale Norms by Length" <bool> if set to true, the norms are scaled by the length of the vector. (default = false)

Additional parameters valid for a NStep test (NOX::StatusTest::NStep):

  • "Number of Nonlinear Iterations" <int> Number of nonlinear iterations to take until convergence (default = 1)
  • "Number of Initial Ramping Steps" <int> Number of nonlinear solves in an initial ramping phase (default = 0)
  • "Number of Nonlinear Iterations in Ramping Phase" <int> Number of nonlinear iterations to take until convergence in ramping phase (default = 10)

Additional parameters valid for a "User Defined" test:

  • "User Status Test" < Teuchos::RCP<NOX::StatusTest::Generic> > A status test suppied by the user. It is very important that when registering this status test, that the user set it as a "Generic" object since there is no implicit casting on the ParameterList's get method. See the example below.

Example usage:

Teuchos::ParameterList stl;
stl.set("Test Type", "Combo");
stl.set("Combo Type", "OR");
stl.set("Number of Tests", 5);
Teuchos::ParameterList& conv = stl.sublist("Test 0");
Teuchos::ParameterList& fv = stl.sublist("Test 1");
Teuchos::ParameterList& divergence = stl.sublist("Test 2");
Teuchos::ParameterList& stagnation = stl.sublist("Test 3");
Teuchos::ParameterList& maxiters = stl.sublist("Test 4");
conv.set("Test Type", "Combo");
conv.set("Combo Type", "AND");
conv.set("Number of Tests", 4);
Teuchos::ParameterList& normF = conv.sublist("Test 0");
Teuchos::ParameterList& normWRMS = conv.sublist("Test 1");
Teuchos::ParameterList& normUpdate = conv.sublist("Test 2");
Teuchos::ParameterList& userDefined = conv.sublist("Test 3");
normF.set("Test Type", "NormF");
normF.set("Tolerance", 1.0e-12);
normF.set("Norm Type", "Two Norm");
normF.set("Scale Type", "Unscaled");
normWRMS.set("Test Type", "NormWRMS");
normWRMS.set("Absolute Tolerance", 1.0e-8);
normWRMS.set("Relative Tolerance", 1.0e-5);
normWRMS.set("Tolerance", 1.0);
normWRMS.set("BDF Multiplier", 1.0);
normWRMS.set("Alpha", 1.0);
normWRMS.set("Beta", 0.5);
normUpdate.set("Test Type", "NormUpdate");
normUpdate.set("Norm Type", "One Norm");
normUpdate.set("Scale Type", "Scaled");
userDefined.set("Test Type", "User Defined");
Teuchos::RCP<NOX::StatusTest::Generic> myTest =
Teuchos::rcp(new MyTest(1.0e-3));
userDefined.set("User Status Test", myTest);
fv.set("Test Type", "FiniteValue");
fv.set("Vector Type", "F Vector");
fv.set("Norm Type", "Two Norm");
divergence.set("Test Type", "Divergence");
divergence.set("Tolerance", 1.0e+20);
divergence.set("Consecutive Iterations", 3);
stagnation.set("Test Type", "Stagnation");
stagnation.set("Tolerance", 1.0);
stagnation.set("Consecutive Iterations", 5);
maxiters.set("Test Type", "MaxIters");
maxiters.set("Maximum Iterations", 20);
Teuchos::RCP<NOX::StatusTest::Generic> status_tests =
Teuchos::RCP< NOX::StatusTest::Generic > buildStatusTests(const std::string &file_name, const NOX::Utils &utils, std::map< std::string, Teuchos::RCP< NOX::StatusTest::Generic > > *tagged_tests=nullptr)
Nonmember helper function for the NOX::StatusTest::Factory.
Author
Roger Pawlowski (SNL 1416)

The documentation for this class was generated from the following files: