Panzer Version of the Day
Loading...
Searching...
No Matches
Panzer_ScatterDirichletResidual_Tpetra_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_TPETRA_DECL_HPP
12#define PANZER_EVALUATOR_SCATTER_DIRICHLET_RESIDUAL_TPETRA_DECL_HPP
13
14#include "Phalanx_config.hpp"
15#include "Phalanx_Evaluator_Macros.hpp"
16#include "Phalanx_MDField.hpp"
17#include "Phalanx_KokkosViewOfViews.hpp"
18
19#include "Teuchos_ParameterList.hpp"
20
21#include "PanzerDiscFE_config.hpp"
22#include "Panzer_Dimension.hpp"
23#include "Panzer_Traits.hpp"
26
27#include "Panzer_NodeType.hpp"
28
30
31namespace panzer {
32
33class GlobalIndexer;
34
43template<typename EvalT, typename Traits,typename LO,typename GO,typename NodeT=panzer::TpetraNodeType>
45
46// **************************************************************
47// **************************************************************
48// * Specializations
49// **************************************************************
50// **************************************************************
51
52
53// **************************************************************
54// Residual
55// **************************************************************
56template<typename TRAITS,typename LO,typename GO,typename NodeT>
58 : public panzer::EvaluatorWithBaseImpl<TRAITS>,
59 public PHX::EvaluatorDerived<panzer::Traits::Residual, TRAITS>,
61
62public:
63 ScatterDirichletResidual_Tpetra(const Teuchos::RCP<const GlobalIndexer> & indexer)
64 : globalIndexer_(indexer) {}
65
66 ScatterDirichletResidual_Tpetra(const Teuchos::RCP<const GlobalIndexer> & indexer,
67 const Teuchos::ParameterList& p);
68
69 void postRegistrationSetup(typename TRAITS::SetupData d,
71
72 void preEvaluate(typename TRAITS::PreEvalData d);
73
74 void evaluateFields(typename TRAITS::EvalData workset);
75
76 virtual Teuchos::RCP<CloneableEvaluator> clone(const Teuchos::ParameterList & pl) const
77 { return Teuchos::rcp(new ScatterDirichletResidual_Tpetra<panzer::Traits::Residual,TRAITS,LO,GO>(globalIndexer_,pl)); }
78
79private:
82
83 // dummy field so that the evaluator will have something to do
84 Teuchos::RCP<PHX::FieldTag> scatterHolder_;
85
86 // fields that need to be scattered will be put in this vector
87 std::vector< PHX::MDField<const ScalarT,Cell,NODE> > scatterFields_;
88
89 // maps the local (field,element,basis) triplet to a global ID
90 // for scattering
91 Teuchos::RCP<const panzer::GlobalIndexer> globalIndexer_;
92 std::vector<int> fieldIds_; // field IDs needing mapping
93
94 // This maps the scattered field names to the DOF manager field
95 // For instance a Navier-Stokes map might look like
96 // fieldMap_["RESIDUAL_Velocity"] --> "Velocity"
97 // fieldMap_["RESIDUAL_Pressure"] --> "Pressure"
98 Teuchos::RCP<const std::map<std::string,std::string> > fieldMap_;
99
100 std::size_t side_subcell_dim_;
101 std::size_t local_side_id_;
102
104
105 Teuchos::RCP<typename LOC::VectorType> dirichletCounter_;
106
107 std::string globalDataKey_; // what global data does this fill?
108 Teuchos::RCP<const LOC> tpetraContainer_;
109
112
113 // If set to true, scattering an initial condition
115
116 // Allows runtime disabling of dirichlet BCs on node-by-node basis
117 std::vector< PHX::MDField<const bool,Cell,NODE> > applyBC_;
118
119 PHX::View<int**> scratch_lids_;
120 std::vector<PHX::View<int*> > scratch_offsets_;
121 std::vector<PHX::View<int*> > scratch_basisIds_;
122};
123
124// **************************************************************
125// Tangent
126// **************************************************************
127template<typename TRAITS,typename LO,typename GO,typename NodeT>
129 : public panzer::EvaluatorWithBaseImpl<TRAITS>,
130 public PHX::EvaluatorDerived<panzer::Traits::Tangent, TRAITS>,
132
133public:
134 ScatterDirichletResidual_Tpetra(const Teuchos::RCP<const GlobalIndexer> & indexer)
135 : globalIndexer_(indexer) {}
136
137 ScatterDirichletResidual_Tpetra(const Teuchos::RCP<const GlobalIndexer> & indexer,
138 const Teuchos::ParameterList& p);
139
140 void postRegistrationSetup(typename TRAITS::SetupData d,
142
143 void preEvaluate(typename TRAITS::PreEvalData d);
144
145 void evaluateFields(typename TRAITS::EvalData workset);
146
147 virtual Teuchos::RCP<CloneableEvaluator> clone(const Teuchos::ParameterList & pl) const
148 { return Teuchos::rcp(new ScatterDirichletResidual_Tpetra<panzer::Traits::Tangent,TRAITS,LO,GO>(globalIndexer_,pl)); }
149
150private:
154
155 // dummy field so that the evaluator will have something to do
156 Teuchos::RCP<PHX::FieldTag> scatterHolder_;
157
158 // fields that need to be scattered will be put in this vector
159 std::vector< PHX::MDField<const ScalarT,Cell,NODE> > scatterFields_;
160
161 // maps the local (field,element,basis) triplet to a global ID
162 // for scattering
163 Teuchos::RCP<const panzer::GlobalIndexer> globalIndexer_;
164 std::vector<int> fieldIds_; // field IDs needing mapping
165
166 // This maps the scattered field names to the DOF manager field
167 // For instance a Navier-Stokes map might look like
168 // fieldMap_["RESIDUAL_Velocity"] --> "Velocity"
169 // fieldMap_["RESIDUAL_Pressure"] --> "Pressure"
170 Teuchos::RCP<const std::map<std::string,std::string> > fieldMap_;
171
172 std::size_t side_subcell_dim_;
173 std::size_t local_side_id_;
174
176
177 Teuchos::RCP<typename LOC::VectorType> dirichletCounter_;
178
179 std::string globalDataKey_; // what global data does this fill?
180 Teuchos::RCP<const LOC> tpetraContainer_;
181 std::vector< Teuchos::ArrayRCP<double> > dfdp_vectors_;
182
185
186 // If set to true, scattering an initial condition
188
189 // Allows runtime disabling of dirichlet BCs on node-by-node basis
190 std::vector< PHX::MDField<const bool,Cell,NODE> > applyBC_;
191
192 PHX::View<int**> scratch_lids_;
193 std::vector<PHX::View<int*> > scratch_offsets_;
194 std::vector<PHX::View<int*> > scratch_basisIds_;
195
197 PHX::ViewOfViews<1,Kokkos::View<RealT**,Kokkos::LayoutLeft,PHX::Device>> dfdpFieldsVoV_;
198};
199
200// **************************************************************
201// Jacobian
202// **************************************************************
203template<typename TRAITS,typename LO,typename GO,typename NodeT>
205 : public panzer::EvaluatorWithBaseImpl<TRAITS>,
206 public PHX::EvaluatorDerived<panzer::Traits::Jacobian, TRAITS>,
208
209public:
210 ScatterDirichletResidual_Tpetra(const Teuchos::RCP<const GlobalIndexer> & indexer)
211 : globalIndexer_(indexer) {}
212
213 ScatterDirichletResidual_Tpetra(const Teuchos::RCP<const GlobalIndexer> & indexer,
214 const Teuchos::ParameterList& p);
215
216 void preEvaluate(typename TRAITS::PreEvalData d);
217
218 void postRegistrationSetup(typename TRAITS::SetupData d,
220
221 void evaluateFields(typename TRAITS::EvalData workset);
222
223 virtual Teuchos::RCP<CloneableEvaluator> clone(const Teuchos::ParameterList & pl) const
224 { return Teuchos::rcp(new ScatterDirichletResidual_Tpetra<panzer::Traits::Jacobian,TRAITS,LO,GO>(globalIndexer_,pl)); }
225
226private:
227
230
231 // dummy field so that the evaluator will have something to do
232 Teuchos::RCP<PHX::FieldTag> scatterHolder_;
233
234 // fields that need to be scattered will be put in this vector
235 std::vector< PHX::MDField<const ScalarT,Cell,NODE> > scatterFields_;
236
237 // maps the local (field,element,basis) triplet to a global ID
238 // for scattering
239 Teuchos::RCP<const panzer::GlobalIndexer> globalIndexer_;
240 std::vector<int> fieldIds_; // field IDs needing mapping
241
242 // This maps the scattered field names to the DOF manager field
243 // For instance a Navier-Stokes map might look like
244 // fieldMap_["RESIDUAL_Velocity"] --> "Velocity"
245 // fieldMap_["RESIDUAL_Pressure"] --> "Pressure"
246 Teuchos::RCP<const std::map<std::string,std::string> > fieldMap_;
247
248 std::size_t num_nodes;
249 std::size_t num_eq;
250
251 std::size_t side_subcell_dim_;
252 std::size_t local_side_id_;
253
254 Teuchos::RCP<typename LOC::VectorType> dirichletCounter_;
255
257
258 std::string globalDataKey_; // what global data does this fill?
259 Teuchos::RCP<const TpetraLinearObjContainer<double,LO,GO,NodeT> > tpetraContainer_;
260
263
264 // Allows runtime disabling of dirichlet BCs on node-by-node basis
265 std::vector< PHX::MDField<const bool,Cell,NODE> > applyBC_;
266};
267
268}
269
270// optionally include hessian support
271#ifdef Panzer_BUILD_HESSIAN_SUPPORT
273#endif
274
275// **************************************************************
276#endif
Non-templated empty base class for template managers.
Wrapper to PHX::EvaluatorWithBaseImpl that implements Panzer-specific helpers.
virtual Teuchos::RCP< CloneableEvaluator > clone(const Teuchos::ParameterList &pl) const
bool checkApplyBC_
If set to true, allows runtime disabling of dirichlet BCs on node-by-node basis.
virtual Teuchos::RCP< CloneableEvaluator > clone(const Teuchos::ParameterList &pl) const
bool checkApplyBC_
If set to true, allows runtime disabling of dirichlet BCs on node-by-node basis.
virtual Teuchos::RCP< CloneableEvaluator > clone(const Teuchos::ParameterList &pl) const
PHX::ViewOfViews< 1, Kokkos::View< RealT **, Kokkos::LayoutLeft, PHX::Device > > dfdpFieldsVoV_
Storage for the tangent data.
bool checkApplyBC_
If set to true, allows runtime disabling of dirichlet BCs on node-by-node basis.
Pushes residual values into the residual vector for a Newton-based solve.