Panzer Version of the Day
Loading...
Searching...
No Matches
Panzer_ExplicitModelEvaluator.hpp
Go to the documentation of this file.
1// @HEADER
2// *****************************************************************************
3// Panzer: A partial differential equation assembly
4// engine for strongly coupled complex multiphysics systems
5//
6// Copyright 2011 NTESS and the Panzer contributors.
7// SPDX-License-Identifier: BSD-3-Clause
8// *****************************************************************************
9// @HEADER
10
11#ifndef PANZER_EXPLICIT_MODEL_EVALUATOR_HPP
12#define PANZER_EXPLICIT_MODEL_EVALUATOR_HPP
13
14#include "PanzerDiscFE_config.hpp"
15
16#include "Thyra_ModelEvaluatorDelegatorBase.hpp"
17#include "Thyra_BlockedLinearOpBase.hpp"
18
20
21#ifdef PANZER_HAVE_EPETRA_STACK
23#endif
24
26
27namespace panzer {
28
34template<typename Scalar>
36 : public Thyra::ModelEvaluatorDelegatorBase<Scalar>,
38public:
39
42
46 ExplicitModelEvaluator(const Teuchos::RCP<Thyra::ModelEvaluator<Scalar> > & model,
47 bool constantMassMatrix,
48 bool useLumpedMass,
49 bool applyMassInverse=true);
50
52
54 Thyra::ModelEvaluatorBase::InArgs<Scalar> getNominalValues() const;
55
57 Thyra::ModelEvaluatorBase::InArgs<Scalar> createInArgs() const;
58
60 Thyra::ModelEvaluatorBase::OutArgs<Scalar> createOutArgs() const;
61
63 Teuchos::RCP<panzer::ModelEvaluator<Scalar> > getPanzerUnderlyingModel();
64
65 virtual void applyInverseMassMatrix(const Teuchos::RCP<Thyra::MultiVectorBase<Scalar> > input, const Teuchos::RCP<Thyra::MultiVectorBase<Scalar> > output) const
66 {
67 Thyra::apply(*invMassMatrix_,Thyra::NOTRANS,*input,output.ptr());
68 }
69
70 virtual void applyMassMatrix(const Teuchos::RCP<Thyra::MultiVectorBase<Scalar> > input, const Teuchos::RCP<Thyra::MultiVectorBase<Scalar> > output) const
71 {
72 Thyra::apply(*mass_,Thyra::NOTRANS,*input,output.ptr());
73 }
74
75private: // data members
76
80 void applyDirichletBCs(const Teuchos::RCP<Thyra::VectorBase<Scalar> > & x,
81 const Teuchos::RCP<Thyra::VectorBase<Scalar> > & f) const
82 {
83 if(panzerModel_!=Teuchos::null) { panzerModel_->applyDirichletBCs(x,f); return; }
84#ifdef PANZER_HAVE_EPETRA_STACK
85 if(panzerEpetraModel_!=Teuchos::null) { panzerEpetraModel_->applyDirichletBCs(x,f); return; }
86#endif
87
88 TEUCHOS_ASSERT(false);
89 }
90
94 void buildInverseMassMatrix(const Thyra::ModelEvaluatorBase::InArgs<Scalar> &inArgs) const;
95
98
101
103 void evalModelImpl(const Thyra::ModelEvaluatorBase::InArgs<Scalar> &inArgs,
104 const Thyra::ModelEvaluatorBase::OutArgs<Scalar> &outArgs) const;
105
107
115 void setOneTimeDirichletBeta(double beta,const Thyra::ModelEvaluator<Scalar> & me) const;
116
119
122
124 Teuchos::RCP<const panzer::ModelEvaluator<Scalar> > panzerModel_;
125
126#ifdef PANZER_HAVE_EPETRA_STACK
128 Teuchos::RCP<const panzer::ModelEvaluator_Epetra> panzerEpetraModel_;
129#endif
130
131 mutable Teuchos::RCP<Thyra::LinearOpBase<Scalar> > mass_;
132 mutable Teuchos::RCP<const Thyra::LinearOpBase<Scalar> > invMassMatrix_;
133 mutable Teuchos::RCP<Thyra::VectorBase<Scalar> > scrap_f_;
134 mutable Teuchos::RCP<Thyra::VectorBase<Scalar> > zero_;
135
136 // build prototype in/out args
137 Thyra::ModelEvaluatorBase::InArgs<Scalar> prototypeInArgs_;
138 Thyra::ModelEvaluatorBase::OutArgs<Scalar> prototypeOutArgs_;
139
140 // hide the default constructor
142
143};
144
145} // end namespace panzer
146
147#endif
Teuchos::RCP< const panzer::ModelEvaluator< Scalar > > panzerModel_
Access to the panzer model evaluator pointer (thyra version)
Thyra::ModelEvaluatorBase::OutArgs< Scalar > prototypeOutArgs_
Teuchos::RCP< Thyra::VectorBase< Scalar > > zero_
void evalModelImpl(const Thyra::ModelEvaluatorBase::InArgs< Scalar > &inArgs, const Thyra::ModelEvaluatorBase::OutArgs< Scalar > &outArgs) const
Evaluation of model, applies the mass matrix to the RHS.
Teuchos::RCP< const Thyra::LinearOpBase< Scalar > > invMassMatrix_
void applyDirichletBCs(const Teuchos::RCP< Thyra::VectorBase< Scalar > > &x, const Teuchos::RCP< Thyra::VectorBase< Scalar > > &f) const
void setOneTimeDirichletBeta(double beta, const Thyra::ModelEvaluator< Scalar > &me) const
Teuchos::RCP< Thyra::LinearOpBase< Scalar > > mass_
Thyra::ModelEvaluatorBase::InArgs< Scalar > getNominalValues() const
Build the nominal values, modifies the underlying models in args slightly.
void buildInverseMassMatrix(const Thyra::ModelEvaluatorBase::InArgs< Scalar > &inArgs) const
Teuchos::RCP< Thyra::VectorBase< Scalar > > scrap_f_
Thyra::ModelEvaluatorBase::InArgs< Scalar > prototypeInArgs_
virtual void applyInverseMassMatrix(const Teuchos::RCP< Thyra::MultiVectorBase< Scalar > > input, const Teuchos::RCP< Thyra::MultiVectorBase< Scalar > > output) const
virtual void applyMassMatrix(const Teuchos::RCP< Thyra::MultiVectorBase< Scalar > > input, const Teuchos::RCP< Thyra::MultiVectorBase< Scalar > > output) const
Thyra::ModelEvaluatorBase::OutArgs< Scalar > createOutArgs() const
Build the out args, modifies the underlying models in args slightly.
Teuchos::RCP< panzer::ModelEvaluator< Scalar > > getPanzerUnderlyingModel()
Get the underlying panzer::ModelEvaluator.
bool constantMassMatrix_
Is the mass matrix constant.
bool massLumping_
Use mass lumping, or a full solve.
void buildArgsPrototypes()
Build prototype in/out args.
Thyra::ModelEvaluatorBase::InArgs< Scalar > createInArgs() const
Build the in args, modifies the underlying models in args slightly.