|
Tempus Version of the Day
Time Integration
|
Functions | |
| AdjointResponseType | parseResponseType (const std::string &name) |
| Convert the "Response Type" parameter value to the enum. | |
| template<class Scalar> | |
| std::vector< Scalar > | parseTimeList (const std::string &str) |
| template<class Scalar> | |
| Scalar | timeTolerance (const Scalar t_init, const Scalar t_final, const Teuchos::ParameterList *sensPL=nullptr) |
| Tolerance for comparing times of a time integration on [t_init, t_final], e.g., the times of a "Sum Over Times" response with the times of the time steps: | |
| template<class Scalar> | |
| void | evalResponseGradientX (const Thyra::ModelEvaluator< Scalar > &model, const int g_index, const Thyra::ModelEvaluatorBase::InArgs< Scalar > &inArgs, Thyra::MultiVectorBase< Scalar > &dgdx, const bool dgdx_dot_check, const std::string &caller) |
| Evaluate dg/dx^T (gradient form, x_space x num_g) of response g_index at the given inArgs. | |
| template<class Scalar> | |
| void | evalResponseGradientP (const Thyra::ModelEvaluator< Scalar > &model, const int g_index, const int p_index, const Thyra::ModelEvaluatorBase::InArgs< Scalar > &inArgs, Thyra::MultiVectorBase< Scalar > &dgdp) |
| Evaluate dg/dp^T (gradient form, p_space x num_g) of response g_index with respect to parameter p_index at the given inArgs. | |
| template<class Scalar> | |
| void | applyDfDpTranspose (const Thyra::ModelEvaluator< Scalar > &model, const int p_index, const Thyra::ModelEvaluatorBase::InArgs< Scalar > &inArgs, const Thyra::MultiVectorBase< Scalar > &v, Thyra::MultiVectorBase< Scalar > &y, const Scalar alpha, const Scalar beta, Teuchos::RCP< Thyra::LinearOpBase< Scalar > > &dfdp_op, Teuchos::RCP< Thyra::MultiVectorBase< Scalar > > &dfdp_mv) |
| Compute y = alpha * df/dp^T * v + beta * y. | |
| template<class Scalar> | |
| Teuchos::RCP< Thyra::LinearOpWithSolveBase< Scalar > > | createAdjointLinearOpWithSolve (const Thyra::ModelEvaluator< Scalar > &adjoint_model, const Thyra::ModelEvaluatorBase::InArgs< Scalar > &inArgs, const Scalar alpha, const Scalar beta) |
| Create a solver for the adjoint model's W = (alpha*df/dx_dot + beta*df/dx)^T at inArgs. | |
| template<class Scalar> | |
| void | addResponseTimeEvents (TimeStepControl< Scalar > &tsc, const std::vector< Scalar > ×) |
| Add the response times to the time step control as time events on which the time steps land exactly. | |
|
inline |
Convert the "Response Type" parameter value to the enum.
Definition at line 54 of file Tempus_AdjointSensitivityUtils.hpp.
| std::vector< Scalar > Tempus::AdjointSensitivityUtils::parseTimeList | ( | const std::string & | str | ) |
Convert a comma-separated list of times (as in "Output Time List") to a sorted vector.
Definition at line 71 of file Tempus_AdjointSensitivityUtils.hpp.
| Scalar Tempus::AdjointSensitivityUtils::timeTolerance | ( | const Scalar | t_init, |
| const Scalar | t_final, | ||
| const Teuchos::ParameterList * | sensPL = nullptr ) |
Tolerance for comparing times of a time integration on [t_init, t_final], e.g., the times of a "Sum Over Times" response with the times of the time steps:
tol = max(relTol * max(|t_init|, |t_final|), absTol),
with relTol and absTol the parameters "Response Time Relative Tolerance" (default 1e-9) and "Response Time Absolute Tolerance" (default 1e-15) of the "Sensitivities" parameters sensPL (the defaults if sensPL is null or does not set them).
Tempus::IntegratorAdjointSensitivity uses the tolerances of its "Sensitivities" parameters: codes that compare times with those of a Tempus adjoint integration (e.g., to check response times against a time grid) should pass the same parameters.
Definition at line 132 of file Tempus_AdjointSensitivityUtils.hpp.
| void Tempus::AdjointSensitivityUtils::evalResponseGradientX | ( | const Thyra::ModelEvaluator< Scalar > & | model, |
| const int | g_index, | ||
| const Thyra::ModelEvaluatorBase::InArgs< Scalar > & | inArgs, | ||
| Thyra::MultiVectorBase< Scalar > & | dgdx, | ||
| const bool | dgdx_dot_check, | ||
| const std::string & | caller ) |
Evaluate dg/dx^T (gradient form, x_space x num_g) of response g_index at the given inArgs.
If dgdx_dot_check is true and the model supports dg/dx_dot in gradient form, dg/dx_dot is evaluated in the same call and an exception is thrown if it is nonzero, since the adjoint formulation requires responses that do not depend on x_dot.
Definition at line 157 of file Tempus_AdjointSensitivityUtils.hpp.
| void Tempus::AdjointSensitivityUtils::evalResponseGradientP | ( | const Thyra::ModelEvaluator< Scalar > & | model, |
| const int | g_index, | ||
| const int | p_index, | ||
| const Thyra::ModelEvaluatorBase::InArgs< Scalar > & | inArgs, | ||
| Thyra::MultiVectorBase< Scalar > & | dgdp ) |
Evaluate dg/dp^T (gradient form, p_space x num_g) of response g_index with respect to parameter p_index at the given inArgs.
Models that only provide the Jacobian form are supported by transposing, as done for the final-time response.
Definition at line 204 of file Tempus_AdjointSensitivityUtils.hpp.
| void Tempus::AdjointSensitivityUtils::applyDfDpTranspose | ( | const Thyra::ModelEvaluator< Scalar > & | model, |
| const int | p_index, | ||
| const Thyra::ModelEvaluatorBase::InArgs< Scalar > & | inArgs, | ||
| const Thyra::MultiVectorBase< Scalar > & | v, | ||
| Thyra::MultiVectorBase< Scalar > & | y, | ||
| const Scalar | alpha, | ||
| const Scalar | beta, | ||
| Teuchos::RCP< Thyra::LinearOpBase< Scalar > > & | dfdp_op, | ||
| Teuchos::RCP< Thyra::MultiVectorBase< Scalar > > & | dfdp_mv ) |
Compute y = alpha * df/dp^T * v + beta * y.
v is a multivector in the residual (f) space and y a multivector in the space of parameter p_index, with the same number of columns. df/dp is evaluated at inArgs in the form supported by the model (linear operator, Jacobian or gradient multivector). dfdp_op and dfdp_mv cache the derivative objects between calls (pass null RCPs on the first call).
Definition at line 244 of file Tempus_AdjointSensitivityUtils.hpp.
| Teuchos::RCP< Thyra::LinearOpWithSolveBase< Scalar > > Tempus::AdjointSensitivityUtils::createAdjointLinearOpWithSolve | ( | const Thyra::ModelEvaluator< Scalar > & | adjoint_model, |
| const Thyra::ModelEvaluatorBase::InArgs< Scalar > & | inArgs, | ||
| const Scalar | alpha, | ||
| const Scalar | beta ) |
Create a solver for the adjoint model's W = (alpha*df/dx_dot + beta*df/dx)^T at inArgs.
Uses the W out-arg of the adjoint model if supported, otherwise its W_op, its W_factory, and the preconditioner of the W_factory (or of the model).
Definition at line 287 of file Tempus_AdjointSensitivityUtils.hpp.
| void Tempus::AdjointSensitivityUtils::addResponseTimeEvents | ( | TimeStepControl< Scalar > & | tsc, |
| const std::vector< Scalar > & | times ) |
Add the response times to the time step control as time events on which the time steps land exactly.
This only adjusts the time steps for "Step Type" = "Variable"; with "Constant" time steps the response times must be on the time grid. The time steps are not flagged for output.
Definition at line 357 of file Tempus_AdjointSensitivityUtils.hpp.