Panzer Version of the Day
Loading...
Searching...
No Matches
Panzer_ScatterDirichletResidual_BlockedEpetra_decl.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_EVALUATOR_SCATTER_DIRICHLET_RESIDUAL_BLOCKEDEPETRA_DECL_HPP
12#define PANZER_EVALUATOR_SCATTER_DIRICHLET_RESIDUAL_BLOCKEDEPETRA_DECL_HPP
13
14#include "Phalanx_config.hpp"
15#include "Phalanx_Evaluator_Macros.hpp"
16#include "Phalanx_MDField.hpp"
17
18#include "Teuchos_ParameterList.hpp"
19
20#include "PanzerDiscFE_config.hpp"
21#include "Panzer_Dimension.hpp"
22#include "Panzer_Traits.hpp"
25
27
28namespace Thyra {
29 template <typename ScalarT> class ProductVectorBase;
30 template <typename ScalarT> class BlockedLinearOpBase;
31}
32
33namespace panzer {
34
35class GlobalIndexer;
36
45template<typename EvalT, typename TRAITS,typename LO,typename GO> class ScatterDirichletResidual_BlockedEpetra
46 : public panzer::EvaluatorWithBaseImpl<TRAITS>,
47 public PHX::EvaluatorDerived<panzer::Traits::Residual, TRAITS>,
49public:
50 typedef typename EvalT::ScalarT ScalarT;
51
52 ScatterDirichletResidual_BlockedEpetra(const Teuchos::ParameterList& p) {}
53
54 virtual Teuchos::RCP<CloneableEvaluator> clone(const Teuchos::ParameterList & pl) const
56
57 void postRegistrationSetup(typename TRAITS::SetupData d, PHX::FieldManager<TRAITS>& vm)
58 { }
59 void evaluateFields(typename TRAITS::EvalData d)
60 { std::cout << "unspecialized version of \"ScatterDirichletResidual_BlockedEpetra::evaluateFields\" on \""+PHX::print<EvalT>()+"\" should not be used!" << std::endl;
61 TEUCHOS_ASSERT(false); }
62};
63
64// **************************************************************
65// **************************************************************
66// * Specializations
67// **************************************************************
68// **************************************************************
69
70
71// **************************************************************
72// Residual
73// **************************************************************
74template<typename TRAITS,typename LO,typename GO>
76 : public panzer::EvaluatorWithBaseImpl<TRAITS>,
77 public PHX::EvaluatorDerived<panzer::Traits::Residual, TRAITS>,
79
80public:
81
82 ScatterDirichletResidual_BlockedEpetra(const std::vector<Teuchos::RCP<const GlobalIndexer> > & rIndexers,
83 const std::vector<Teuchos::RCP<const GlobalIndexer> > & /* cIndexers */)
84 : rowIndexers_(rIndexers) {}
85
86 ScatterDirichletResidual_BlockedEpetra(const std::vector<Teuchos::RCP<const GlobalIndexer> > & rIndexers,
87 const std::vector<Teuchos::RCP<const GlobalIndexer> > & cIndexers,
88 const Teuchos::ParameterList& p,
89 bool useDiscreteAdjoint=false);
90
91 void postRegistrationSetup(typename TRAITS::SetupData d,
93
94 void preEvaluate(typename TRAITS::PreEvalData d);
95
96 void evaluateFields(typename TRAITS::EvalData workset);
97
98 virtual Teuchos::RCP<CloneableEvaluator> clone(const Teuchos::ParameterList & pl) const
99 { return Teuchos::rcp(new ScatterDirichletResidual_BlockedEpetra<panzer::Traits::Residual,TRAITS,LO,GO>(rowIndexers_,colIndexers_,pl)); }
100
101private:
103 using BCFieldType = PHX::MDField<const bool,Cell,NODE>;
104
105 // dummy field so that the evaluator will have something to do
106 Teuchos::RCP<PHX::FieldTag> scatterHolder_;
107
108 // fields that need to be scattered will be put in this vector
109 std::vector< PHX::MDField<const ScalarT,Cell,NODE> > scatterFields_;
110
111 std::vector<Teuchos::RCP<const GlobalIndexer> > rowIndexers_;
112 std::vector<Teuchos::RCP<const GlobalIndexer> > colIndexers_;
113
114 std::vector<int> indexerIds_; // block index
115 std::vector<int> subFieldIds_; // sub field numbers
116
117 // This maps the scattered field names to the DOF manager field
118 // For instance a Navier-Stokes map might look like
119 // fieldMap_["RESIDUAL_Velocity"] --> "Velocity"
120 // fieldMap_["RESIDUAL_Pressure"] --> "Pressure"
121 Teuchos::RCP<const std::map<std::string,std::string> > fieldMap_;
122
123 std::size_t num_nodes;
124
125 std::size_t side_subcell_dim_;
126 std::size_t local_side_id_;
127
128 Teuchos::RCP<Thyra::ProductVectorBase<double> > dirichletCounter_;
129 Teuchos::RCP<Thyra::ProductVectorBase<double> > r_;
130 std::string globalDataKey_; // what global data does this fill?
131
134
135 // If set to true, scattering an initial condition
137
138 // Allows runtime disabling of dirichlet BCs on node-by-node basis
139 std::vector< BCFieldType > applyBC_;
140
142};
143
144// **************************************************************
145// Tangent
146// **************************************************************
147template<typename TRAITS,typename LO,typename GO>
149 : public panzer::EvaluatorWithBaseImpl<TRAITS>,
150 public PHX::EvaluatorDerived<panzer::Traits::Tangent, TRAITS>,
152
153public:
154
155 ScatterDirichletResidual_BlockedEpetra(const std::vector<Teuchos::RCP<const GlobalIndexer> > & rIndexers,
156 const std::vector<Teuchos::RCP<const GlobalIndexer> > & /* cIndexers */)
157 : rowIndexers_(rIndexers) {}
158
159 ScatterDirichletResidual_BlockedEpetra(const std::vector<Teuchos::RCP<const GlobalIndexer> > & rIndexers,
160 const std::vector<Teuchos::RCP<const GlobalIndexer> > & cIndexers,
161 const Teuchos::ParameterList& p,
162 bool useDiscreteAdjoint=false);
163
164 void postRegistrationSetup(typename TRAITS::SetupData d,
166
167 void preEvaluate(typename TRAITS::PreEvalData d);
168
169 void evaluateFields(typename TRAITS::EvalData workset);
170
171 virtual Teuchos::RCP<CloneableEvaluator> clone(const Teuchos::ParameterList & pl) const
172 { return Teuchos::rcp(new ScatterDirichletResidual_BlockedEpetra<panzer::Traits::Tangent,TRAITS,LO,GO>(rowIndexers_,colIndexers_,pl)); }
173
174private:
176 using BCFieldType = PHX::MDField<const bool,Cell,NODE>;
177
178 // dummy field so that the evaluator will have something to do
179 Teuchos::RCP<PHX::FieldTag> scatterHolder_;
180
181 // fields that need to be scattered will be put in this vector
182 std::vector< PHX::MDField<const ScalarT,Cell,NODE> > scatterFields_;
183
184 std::vector<Teuchos::RCP<const GlobalIndexer> > rowIndexers_;
185 std::vector<Teuchos::RCP<const GlobalIndexer> > colIndexers_;
186
187 std::vector<int> indexerIds_; // block index
188 std::vector<int> subFieldIds_; // sub field numbers
189
190 // This maps the scattered field names to the DOF manager field
191 // For instance a Navier-Stokes map might look like
192 // fieldMap_["RESIDUAL_Velocity"] --> "Velocity"
193 // fieldMap_["RESIDUAL_Pressure"] --> "Pressure"
194 Teuchos::RCP<const std::map<std::string,std::string> > fieldMap_;
195
196 std::size_t num_nodes;
197
198 std::size_t side_subcell_dim_;
199 std::size_t local_side_id_;
200
201 Teuchos::RCP<Thyra::ProductVectorBase<double> > dirichletCounter_;
202 Teuchos::RCP<Thyra::ProductVectorBase<double> > r_;
203 std::string globalDataKey_; // what global data does this fill?
204
207
208 // If set to true, scattering an initial condition
210
211 // Allows runtime disabling of dirichlet BCs on node-by-node basis
212 std::vector< BCFieldType > applyBC_;
213
215};
216
217// **************************************************************
218// Jacobian
219// **************************************************************
220template<typename TRAITS,typename LO,typename GO>
222 : public panzer::EvaluatorWithBaseImpl<TRAITS>,
223 public PHX::EvaluatorDerived<panzer::Traits::Jacobian, TRAITS>,
225
226public:
227
228 ScatterDirichletResidual_BlockedEpetra(const std::vector<Teuchos::RCP<const GlobalIndexer> > & rIndexers,
229 const std::vector<Teuchos::RCP<const GlobalIndexer> > & cIndexers)
230 : rowIndexers_(rIndexers), colIndexers_(cIndexers) {}
231
232 ScatterDirichletResidual_BlockedEpetra(const std::vector<Teuchos::RCP<const GlobalIndexer> > & rIndexers,
233 const std::vector<Teuchos::RCP<const GlobalIndexer> > & cIndexers,
234 const Teuchos::ParameterList& p,
235 bool useDiscreteAdjoint=false);
236
237 void preEvaluate(typename TRAITS::PreEvalData d);
238
239 void postRegistrationSetup(typename TRAITS::SetupData d,
241
242 void evaluateFields(typename TRAITS::EvalData workset);
243
244 virtual Teuchos::RCP<CloneableEvaluator> clone(const Teuchos::ParameterList & pl) const
245 { return Teuchos::rcp(new ScatterDirichletResidual_BlockedEpetra<panzer::Traits::Jacobian,TRAITS,LO,GO>(rowIndexers_,colIndexers_,pl)); }
246
247private:
248
250 using BCFieldType = PHX::MDField<const bool,Cell,NODE>;
251
252 // dummy field so that the evaluator will have something to do
253 Teuchos::RCP<PHX::FieldTag> scatterHolder_;
254
255 // fields that need to be scattered will be put in this vector
256 std::vector< PHX::MDField<const ScalarT,Cell,NODE> > scatterFields_;
257
258 std::vector<Teuchos::RCP<const GlobalIndexer> > rowIndexers_;
259 std::vector<Teuchos::RCP<const GlobalIndexer> > colIndexers_;
260
261 std::vector<int> indexerIds_; // block index
262 std::vector<int> subFieldIds_; // sub field numbers
263
264 // This maps the scattered field names to the DOF manager field
265 // For instance a Navier-Stokes map might look like
266 // fieldMap_["RESIDUAL_Velocity"] --> "Velocity"
267 // fieldMap_["RESIDUAL_Pressure"] --> "Pressure"
268 Teuchos::RCP<const std::map<std::string,std::string> > fieldMap_;
269
270 std::size_t num_nodes;
271 std::size_t num_eq;
272
273 std::size_t side_subcell_dim_;
274 std::size_t local_side_id_;
275
276 Teuchos::RCP<Thyra::ProductVectorBase<double> > dirichletCounter_;
277 std::string globalDataKey_; // what global data does this fill?
278
279 Teuchos::RCP<Thyra::ProductVectorBase<double> > r_;
280 Teuchos::RCP<Thyra::BlockedLinearOpBase<double> > Jac_;
281
284
285 // Allows runtime disabling of dirichlet BCs on node-by-node basis
286 std::vector< BCFieldType > applyBC_;
287
289};
290
291}
292
293// optionally include hessian support
294#ifdef Panzer_BUILD_HESSIAN_SUPPORT
296#endif
297
298// **************************************************************
299#endif
Non-templated empty base class for template managers.
Wrapper to PHX::EvaluatorWithBaseImpl that implements Panzer-specific helpers.
bool checkApplyBC_
If set to true, allows runtime disabling of dirichlet BCs on node-by-node basis.
ScatterDirichletResidual_BlockedEpetra(const std::vector< Teuchos::RCP< const GlobalIndexer > > &rIndexers, const std::vector< Teuchos::RCP< const GlobalIndexer > > &cIndexers)
bool checkApplyBC_
If set to true, allows runtime disabling of dirichlet BCs on node-by-node basis.
ScatterDirichletResidual_BlockedEpetra(const std::vector< Teuchos::RCP< const GlobalIndexer > > &rIndexers, const std::vector< Teuchos::RCP< const GlobalIndexer > > &)
bool checkApplyBC_
If set to true, allows runtime disabling of dirichlet BCs on node-by-node basis.
ScatterDirichletResidual_BlockedEpetra(const std::vector< Teuchos::RCP< const GlobalIndexer > > &rIndexers, const std::vector< Teuchos::RCP< const GlobalIndexer > > &)
Pushes residual values into the residual vector for a Newton-based solve.
virtual Teuchos::RCP< CloneableEvaluator > clone(const Teuchos::ParameterList &pl) const
void postRegistrationSetup(typename TRAITS::SetupData d, PHX::FieldManager< TRAITS > &vm)
Evaluation type for computing the residual and its Jacobian, using FadType as the scalar type.
Evaluation type for computing the residual only, using RealType as the scalar type.
Evaluation type for computing directional derivatives (e.g. parameter sensitivities),...