10#ifndef Tempus_Stepper_ErrorNorm_impl_hpp
11#define Tempus_Stepper_ErrorNorm_impl_hpp
13#include "Teuchos_ScalarTraitsDecl.hpp"
14#include "Thyra_DefaultSerialDenseLinearOpWithSolve_decl.hpp"
15#include "Thyra_MultiVectorStdOps_decl.hpp"
16#include "Thyra_VectorSpaceBase_decl.hpp"
17#include "Thyra_VectorStdOps_decl.hpp"
23template <
class Scalar>
29template <
class Scalar>
36template <
class Scalar>
45 if (
u_ == Teuchos::null)
u_ = Thyra::createMember(x->space());
47 if (
uNext_ == Teuchos::null)
uNext_ = Thyra::createMember(x->space());
50 Thyra::abs(*x,
u_.ptr());
51 Thyra::abs(*xNext,
uNext_.ptr());
59 Thyra::add_scalar(absTol,
uNext_.ptr());
63 Teuchos::ScalarTraits<Scalar>::zero());
64 Thyra::ele_wise_divide(Teuchos::as<Scalar>(1.0), *err, *
uNext_,
67 const auto space_dim = err->space()->dim();
68 Scalar err_norm = Thyra::norm(*
errorWeightVector_) / std::sqrt(
static_cast<Scalar
>(space_dim));
72template <
class Scalar>
90 Thyra::ele_wise_divide(Teuchos::as<Scalar>(1.0), *x, *
scratchVector_,
Scalar computeWRMSNorm(const Teuchos::RCP< const Thyra::VectorBase< Scalar > > &x, const Teuchos::RCP< const Thyra::VectorBase< Scalar > > &xNext, const Teuchos::RCP< const Thyra::VectorBase< Scalar > > &err)
Compute the weigthed root mean square norm.
Teuchos::RCP< Thyra::VectorBase< Scalar > > errorWeightVector_
Teuchos::RCP< Thyra::VectorBase< Scalar > > u_
Teuchos::RCP< Thyra::VectorBase< Scalar > > uNext_
Scalar errorNorm(const Teuchos::RCP< const Thyra::VectorBase< Scalar > > &x)
Compute the error Norm.
Stepper_ErrorNorm()
Default Constructor.
Teuchos::RCP< Thyra::VectorBase< Scalar > > scratchVector_
bool approxZero(Scalar value, Scalar tol=Teuchos::ScalarTraits< Scalar >::sfmin())
Test if value is approximately zero within tolerance.
const Scalar numericalTol()
Numerical Tolerance (approx. max. significant digits minus two).