Tempus Version of the Day
Time Integration
Loading...
Searching...
No Matches
Tempus::AdjointDAEJumpSolver< Scalar > Class Template Reference

Solver for the adjoint jumps of an index-1 DAE. More...

#include <Tempus_AdjointDAEJumpSolver.hpp>

Public Types

typedef Thyra::VectorBase< Scalar > Vector
typedef Thyra::MultiVectorBase< Scalar > MultiVector
typedef Teuchos::ScalarTraits< Scalar >::magnitudeType Mag

Public Member Functions

 AdjointDAEJumpSolver (const Teuchos::RCP< const DAEStructure< Scalar > > &dae, const Teuchos::RCP< const Teuchos::ParameterList > &pl=Teuchos::null)
 Constructor. pl (optional) is the "Algebraic Jump Solver" sublist.
bool solve (const Thyra::ModelEvaluator< Scalar > &adjoint_model, const Thyra::ModelEvaluatorBase::InArgs< Scalar > &inArgs, const Scalar dt, const MultiVector &b, MultiVector &z) const
 Solve C^T z = b for each column of b.

Static Public Member Functions

static const std::string & sublistName ()
 Name of the "Sensitivities" sublist with the options of this solver.
static Teuchos::RCP< const Teuchos::ParameterList > getValidParameters ()

Private Member Functions

Mag residual (const Thyra::LinearOpBase< Scalar > &ET, const Thyra::LinearOpBase< Scalar > &AT, const MultiVector &b, const MultiVector &z, const Teuchos::Array< Mag > &b_norms, MultiVector &r) const

Private Attributes

Teuchos::RCP< const DAEStructure< Scalar > > dae_
double rel_tol_
int max_iters_
double alpha_factor_
double alpha_growth_
int max_alpha_increases_
double min_reduction_
bool verbose_

Detailed Description

template<class Scalar>
class Tempus::AdjointDAEJumpSolver< Scalar >

Solver for the adjoint jumps of an index-1 DAE.

For a "Final Time" or "Sum Over Times" response g, the adjoint of an index-1 DAE jumps at each response time t_k by the differential components of the solution z of C^T z = dg/dx^T, C = P_a A + P_d E, with E = df/dx_dot, A = df/dx at the forward state at t_k, and P_a, P_d the masks of the algebraic and differential equations (see DAEStructure), while its algebraic components give the term -df/dp^T (P_a z) of the sensitivity (see IntegratorAdjointSensitivity).

C is not assembled. The solver uses only evaluations of the adjoint model, which returns the transposed operators: E^T = W(1,0), A^T = W(0,1), and W(alpha,1) = (alpha E + A)^T. With D_alpha = P_a + P_d/alpha, W(alpha,1) D_alpha = C^T + A^T P_d / alpha, since the algebraic rows of E are zero. Hence P = W(alpha,1) D_alpha is a preconditioner of C^T, exact as alpha -> infinity (C is the limit of the row-scaled step matrix of backward Euler as the time step goes to zero), and the solver performs the preconditioned Richardson iterations z <- z + D_alpha^{-1} W(alpha,1)^{-1} (b - C^T z), with the linear solver of the adjoint model, starting from alpha = "Initial Alpha Factor" / dt, where dt is the time step size at t_k. The iteration matrix is P^{-1} A^T P_d / alpha: whenever an iteration reduces the residual by a factor larger than "Minimum Residual Reduction", alpha is multiplied by "Alpha Growth Factor" (and the solver of W(alpha,1) is rebuilt).

Options (sublist "Algebraic Jump Solver" of "Sensitivities"):

  • "Relative Tolerance" (default: 1e-10) on max_j |r_j|/|b_j| over the columns j.
  • "Maximum Iterations Per Alpha" (default: 20)
  • "Initial Alpha Factor" (default: 1.0)
  • "Alpha Growth Factor" (default: 10.0)
  • "Maximum Alpha Increases" (default: 8)
  • "Minimum Residual Reduction" (default: 0.5)
  • "Verbose" (default: false) Print the residual at each iteration.

Definition at line 72 of file Tempus_AdjointDAEJumpSolver.hpp.

Member Typedef Documentation

◆ Vector

template<class Scalar>
typedef Thyra::VectorBase<Scalar> Tempus::AdjointDAEJumpSolver< Scalar >::Vector

Definition at line 74 of file Tempus_AdjointDAEJumpSolver.hpp.

◆ MultiVector

template<class Scalar>
typedef Thyra::MultiVectorBase<Scalar> Tempus::AdjointDAEJumpSolver< Scalar >::MultiVector

Definition at line 75 of file Tempus_AdjointDAEJumpSolver.hpp.

◆ Mag

template<class Scalar>
typedef Teuchos::ScalarTraits<Scalar>::magnitudeType Tempus::AdjointDAEJumpSolver< Scalar >::Mag

Definition at line 76 of file Tempus_AdjointDAEJumpSolver.hpp.

Constructor & Destructor Documentation

◆ AdjointDAEJumpSolver()

template<class Scalar>
Tempus::AdjointDAEJumpSolver< Scalar >::AdjointDAEJumpSolver ( const Teuchos::RCP< const DAEStructure< Scalar > > & dae,
const Teuchos::RCP< const Teuchos::ParameterList > & pl = Teuchos::null )
inline

Constructor. pl (optional) is the "Algebraic Jump Solver" sublist.

Definition at line 101 of file Tempus_AdjointDAEJumpSolver.hpp.

Member Function Documentation

◆ sublistName()

template<class Scalar>
const std::string & Tempus::AdjointDAEJumpSolver< Scalar >::sublistName ( )
inlinestatic

Name of the "Sensitivities" sublist with the options of this solver.

Definition at line 79 of file Tempus_AdjointDAEJumpSolver.hpp.

◆ getValidParameters()

template<class Scalar>
Teuchos::RCP< const Teuchos::ParameterList > Tempus::AdjointDAEJumpSolver< Scalar >::getValidParameters ( )
inlinestatic

Definition at line 85 of file Tempus_AdjointDAEJumpSolver.hpp.

◆ solve()

template<class Scalar>
bool Tempus::AdjointDAEJumpSolver< Scalar >::solve ( const Thyra::ModelEvaluator< Scalar > & adjoint_model,
const Thyra::ModelEvaluatorBase::InArgs< Scalar > & inArgs,
const Scalar dt,
const MultiVector & b,
MultiVector & z ) const
inline

Solve C^T z = b for each column of b.

Parameters
adjoint_modelThe adjoint model (W_op returns the transpose)
inArgsForward state at the response time (x, x_dot, t)
dtTime step size at the response time
bRight-hand side, dg/dx^T (x space)
zSolution (residual space), overwritten

Returns true if the iterations converged.

Definition at line 140 of file Tempus_AdjointDAEJumpSolver.hpp.

◆ residual()

template<class Scalar>
Mag Tempus::AdjointDAEJumpSolver< Scalar >::residual ( const Thyra::LinearOpBase< Scalar > & ET,
const Thyra::LinearOpBase< Scalar > & AT,
const MultiVector & b,
const MultiVector & z,
const Teuchos::Array< Mag > & b_norms,
MultiVector & r ) const
inlineprivate

r = b - C^T z, C^T z = A^T (P_a z) + E^T (P_d z); returns max_j |r_j|/|b_j| over the columns with b_j != 0

Definition at line 229 of file Tempus_AdjointDAEJumpSolver.hpp.

Member Data Documentation

◆ dae_

template<class Scalar>
Teuchos::RCP<const DAEStructure<Scalar> > Tempus::AdjointDAEJumpSolver< Scalar >::dae_
private

Definition at line 252 of file Tempus_AdjointDAEJumpSolver.hpp.

◆ rel_tol_

template<class Scalar>
double Tempus::AdjointDAEJumpSolver< Scalar >::rel_tol_
private

Definition at line 253 of file Tempus_AdjointDAEJumpSolver.hpp.

◆ max_iters_

template<class Scalar>
int Tempus::AdjointDAEJumpSolver< Scalar >::max_iters_
private

Definition at line 254 of file Tempus_AdjointDAEJumpSolver.hpp.

◆ alpha_factor_

template<class Scalar>
double Tempus::AdjointDAEJumpSolver< Scalar >::alpha_factor_
private

Definition at line 255 of file Tempus_AdjointDAEJumpSolver.hpp.

◆ alpha_growth_

template<class Scalar>
double Tempus::AdjointDAEJumpSolver< Scalar >::alpha_growth_
private

Definition at line 256 of file Tempus_AdjointDAEJumpSolver.hpp.

◆ max_alpha_increases_

template<class Scalar>
int Tempus::AdjointDAEJumpSolver< Scalar >::max_alpha_increases_
private

Definition at line 257 of file Tempus_AdjointDAEJumpSolver.hpp.

◆ min_reduction_

template<class Scalar>
double Tempus::AdjointDAEJumpSolver< Scalar >::min_reduction_
private

Definition at line 258 of file Tempus_AdjointDAEJumpSolver.hpp.

◆ verbose_

template<class Scalar>
bool Tempus::AdjointDAEJumpSolver< Scalar >::verbose_
private

Definition at line 259 of file Tempus_AdjointDAEJumpSolver.hpp.


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