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//
4// Panzer: A partial differential equation assembly
5// engine for strongly coupled complex multiphysics systems
6// Copyright (2011) Sandia Corporation
7//
8// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
9// the U.S. Government retains certain rights in this software.
10//
11// Redistribution and use in source and binary forms, with or without
12// modification, are permitted provided that the following conditions are
13// met:
14//
15// 1. Redistributions of source code must retain the above copyright
16// notice, this list of conditions and the following disclaimer.
17//
18// 2. Redistributions in binary form must reproduce the above copyright
19// notice, this list of conditions and the following disclaimer in the
20// documentation and/or other materials provided with the distribution.
21//
22// 3. Neither the name of the Corporation nor the names of the
23// contributors may be used to endorse or promote products derived from
24// this software without specific prior written permission.
25//
26// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
27// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
30// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37//
38// Questions? Contact Roger P. Pawlowski (rppawlo@sandia.gov) and
39// Eric C. Cyr (eccyr@sandia.gov)
40// ***********************************************************************
41// @HEADER
42
43#ifndef PANZER_EVALUATOR_SCATTER_DIRICHLET_RESIDUAL_TPETRA_DECL_HPP
44#define PANZER_EVALUATOR_SCATTER_DIRICHLET_RESIDUAL_TPETRA_DECL_HPP
45
46#include "Phalanx_config.hpp"
47#include "Phalanx_Evaluator_Macros.hpp"
48#include "Phalanx_MDField.hpp"
49
50#include "Teuchos_ParameterList.hpp"
51
52#include "PanzerDiscFE_config.hpp"
53#include "Panzer_Dimension.hpp"
54#include "Panzer_Traits.hpp"
57
58#include "Panzer_NodeType.hpp"
59
61
62namespace panzer {
63
64class GlobalIndexer;
65
74template<typename EvalT, typename Traits,typename LO,typename GO,typename NodeT=panzer::TpetraNodeType>
76
77// **************************************************************
78// **************************************************************
79// * Specializations
80// **************************************************************
81// **************************************************************
82
83
84// **************************************************************
85// Residual
86// **************************************************************
87template<typename TRAITS,typename LO,typename GO,typename NodeT>
89 : public panzer::EvaluatorWithBaseImpl<TRAITS>,
90 public PHX::EvaluatorDerived<panzer::Traits::Residual, TRAITS>,
92
93public:
94 ScatterDirichletResidual_Tpetra(const Teuchos::RCP<const GlobalIndexer> & indexer)
95 : globalIndexer_(indexer) {}
96
97 ScatterDirichletResidual_Tpetra(const Teuchos::RCP<const GlobalIndexer> & indexer,
98 const Teuchos::ParameterList& p);
99
100 void postRegistrationSetup(typename TRAITS::SetupData d,
102
103 void preEvaluate(typename TRAITS::PreEvalData d);
104
105 void evaluateFields(typename TRAITS::EvalData workset);
106
107 virtual Teuchos::RCP<CloneableEvaluator> clone(const Teuchos::ParameterList & pl) const
108 { return Teuchos::rcp(new ScatterDirichletResidual_Tpetra<panzer::Traits::Residual,TRAITS,LO,GO>(globalIndexer_,pl)); }
109
110private:
113
114 // dummy field so that the evaluator will have something to do
115 Teuchos::RCP<PHX::FieldTag> scatterHolder_;
116
117 // fields that need to be scattered will be put in this vector
118 std::vector< PHX::MDField<const ScalarT,Cell,NODE> > scatterFields_;
119
120 // maps the local (field,element,basis) triplet to a global ID
121 // for scattering
122 Teuchos::RCP<const panzer::GlobalIndexer> globalIndexer_;
123 std::vector<int> fieldIds_; // field IDs needing mapping
124
125 // This maps the scattered field names to the DOF manager field
126 // For instance a Navier-Stokes map might look like
127 // fieldMap_["RESIDUAL_Velocity"] --> "Velocity"
128 // fieldMap_["RESIDUAL_Pressure"] --> "Pressure"
129 Teuchos::RCP<const std::map<std::string,std::string> > fieldMap_;
130
131 std::size_t num_nodes;
132
133 std::size_t side_subcell_dim_;
134 std::size_t local_side_id_;
135
137
138 Teuchos::RCP<typename LOC::VectorType> dirichletCounter_;
139
140 std::string globalDataKey_; // what global data does this fill?
141 Teuchos::RCP<const LOC> tpetraContainer_;
142
145
146 // If set to true, scattering an initial condition
148
149 // Allows runtime disabling of dirichlet BCs on node-by-node basis
150 std::vector< PHX::MDField<const bool,Cell,NODE> > applyBC_;
151};
152
153// **************************************************************
154// Tangent
155// **************************************************************
156template<typename TRAITS,typename LO,typename GO,typename NodeT>
158 : public panzer::EvaluatorWithBaseImpl<TRAITS>,
159 public PHX::EvaluatorDerived<panzer::Traits::Tangent, TRAITS>,
161
162public:
163 ScatterDirichletResidual_Tpetra(const Teuchos::RCP<const GlobalIndexer> & indexer)
164 : globalIndexer_(indexer) {}
165
166 ScatterDirichletResidual_Tpetra(const Teuchos::RCP<const GlobalIndexer> & indexer,
167 const Teuchos::ParameterList& p);
168
169 void postRegistrationSetup(typename TRAITS::SetupData d,
171
172 void preEvaluate(typename TRAITS::PreEvalData d);
173
174 void evaluateFields(typename TRAITS::EvalData workset);
175
176 virtual Teuchos::RCP<CloneableEvaluator> clone(const Teuchos::ParameterList & pl) const
177 { return Teuchos::rcp(new ScatterDirichletResidual_Tpetra<panzer::Traits::Tangent,TRAITS,LO,GO>(globalIndexer_,pl)); }
178
179private:
182
183 // dummy field so that the evaluator will have something to do
184 Teuchos::RCP<PHX::FieldTag> scatterHolder_;
185
186 // fields that need to be scattered will be put in this vector
187 std::vector< PHX::MDField<const ScalarT,Cell,NODE> > scatterFields_;
188
189 // maps the local (field,element,basis) triplet to a global ID
190 // for scattering
191 Teuchos::RCP<const panzer::GlobalIndexer> globalIndexer_;
192 std::vector<int> fieldIds_; // field IDs needing mapping
193
194 // This maps the scattered field names to the DOF manager field
195 // For instance a Navier-Stokes map might look like
196 // fieldMap_["RESIDUAL_Velocity"] --> "Velocity"
197 // fieldMap_["RESIDUAL_Pressure"] --> "Pressure"
198 Teuchos::RCP<const std::map<std::string,std::string> > fieldMap_;
199
200 std::size_t num_nodes;
201
202 std::size_t side_subcell_dim_;
203 std::size_t local_side_id_;
204
206
207 Teuchos::RCP<typename LOC::VectorType> dirichletCounter_;
208
209 std::string globalDataKey_; // what global data does this fill?
210 Teuchos::RCP<const LOC> tpetraContainer_;
211 std::vector< Teuchos::ArrayRCP<double> > dfdp_vectors_;
212
215
216 // If set to true, scattering an initial condition
218
219 // Allows runtime disabling of dirichlet BCs on node-by-node basis
220 std::vector< PHX::MDField<const bool,Cell,NODE> > applyBC_;
221};
222
223// **************************************************************
224// Jacobian
225// **************************************************************
226template<typename TRAITS,typename LO,typename GO,typename NodeT>
228 : public panzer::EvaluatorWithBaseImpl<TRAITS>,
229 public PHX::EvaluatorDerived<panzer::Traits::Jacobian, TRAITS>,
231
232public:
233 ScatterDirichletResidual_Tpetra(const Teuchos::RCP<const GlobalIndexer> & indexer)
234 : globalIndexer_(indexer) {}
235
236 ScatterDirichletResidual_Tpetra(const Teuchos::RCP<const GlobalIndexer> & indexer,
237 const Teuchos::ParameterList& p);
238
239 void preEvaluate(typename TRAITS::PreEvalData d);
240
241 void postRegistrationSetup(typename TRAITS::SetupData d,
243
244 void evaluateFields(typename TRAITS::EvalData workset);
245
246 virtual Teuchos::RCP<CloneableEvaluator> clone(const Teuchos::ParameterList & pl) const
247 { return Teuchos::rcp(new ScatterDirichletResidual_Tpetra<panzer::Traits::Jacobian,TRAITS,LO,GO>(globalIndexer_,pl)); }
248
249private:
250
253
254 // dummy field so that the evaluator will have something to do
255 Teuchos::RCP<PHX::FieldTag> scatterHolder_;
256
257 // fields that need to be scattered will be put in this vector
258 std::vector< PHX::MDField<const ScalarT,Cell,NODE> > scatterFields_;
259
260 // maps the local (field,element,basis) triplet to a global ID
261 // for scattering
262 Teuchos::RCP<const panzer::GlobalIndexer> globalIndexer_;
263 std::vector<int> fieldIds_; // field IDs needing mapping
264
265 // This maps the scattered field names to the DOF manager field
266 // For instance a Navier-Stokes map might look like
267 // fieldMap_["RESIDUAL_Velocity"] --> "Velocity"
268 // fieldMap_["RESIDUAL_Pressure"] --> "Pressure"
269 Teuchos::RCP<const std::map<std::string,std::string> > fieldMap_;
270
271 std::size_t num_nodes;
272 std::size_t num_eq;
273
274 std::size_t side_subcell_dim_;
275 std::size_t local_side_id_;
276
277 Teuchos::RCP<typename LOC::VectorType> dirichletCounter_;
278
280
281 std::string globalDataKey_; // what global data does this fill?
282 Teuchos::RCP<const TpetraLinearObjContainer<double,LO,GO,NodeT> > tpetraContainer_;
283
286
287 // Allows runtime disabling of dirichlet BCs on node-by-node basis
288 std::vector< PHX::MDField<const bool,Cell,NODE> > applyBC_;
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.
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
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.