Panzer Version of the Day
Loading...
Searching...
No Matches
Panzer_ScatterDirichletResidual_Epetra_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_EPETRA_DECL_HPP
44#define PANZER_EVALUATOR_SCATTER_DIRICHLET_RESIDUAL_EPETRA_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"
56
58
59class Epetra_Vector;
60
61namespace panzer {
62
63class EpetraLinearObjContainer;
64class GlobalIndexer;
65
74template<typename EvalT, typename TRAITS,typename LO,typename GO> class ScatterDirichletResidual_Epetra;
75
76// **************************************************************
77// **************************************************************
78// * Specializations
79// **************************************************************
80// **************************************************************
81
82
83// **************************************************************
84// Residual
85// **************************************************************
86template<typename TRAITS,typename LO,typename GO>
88 : public panzer::EvaluatorWithBaseImpl<TRAITS>,
89 public PHX::EvaluatorDerived<panzer::Traits::Residual, TRAITS>,
91
92public:
93 ScatterDirichletResidual_Epetra(const Teuchos::RCP<const GlobalIndexer> & indexer,
94 const Teuchos::RCP<const panzer::GlobalIndexer> & /* cIndexer=Teuchos::null */)
95 : globalIndexer_(indexer) {}
96
97 ScatterDirichletResidual_Epetra(const Teuchos::RCP<const GlobalIndexer> & indexer,
98 const Teuchos::RCP<const panzer::GlobalIndexer> & cIndexer,
99 const Teuchos::ParameterList& p);
100
101 void postRegistrationSetup(typename TRAITS::SetupData d,
103
104 void preEvaluate(typename TRAITS::PreEvalData d);
105
106 void evaluateFields(typename TRAITS::EvalData workset);
107
108 virtual Teuchos::RCP<CloneableEvaluator> clone(const Teuchos::ParameterList & pl) const
109 { return Teuchos::rcp(new ScatterDirichletResidual_Epetra<panzer::Traits::Residual,TRAITS,LO,GO>(globalIndexer_,Teuchos::null,pl)); }
110
111private:
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<Epetra_Vector> dirichletCounter_;
139
140 std::string globalDataKey_; // what global data does this fill?
141 Teuchos::RCP<const EpetraLinearObjContainer> epetraContainer_;
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>
158 : public panzer::EvaluatorWithBaseImpl<TRAITS>,
159 public PHX::EvaluatorDerived<panzer::Traits::Tangent, TRAITS>,
161
162public:
163 ScatterDirichletResidual_Epetra(const Teuchos::RCP<const GlobalIndexer> & indexer,
164 const Teuchos::RCP<const panzer::GlobalIndexer> & /* cIndexer=Teuchos::null */)
165 : globalIndexer_(indexer) {}
166
167 ScatterDirichletResidual_Epetra(const Teuchos::RCP<const GlobalIndexer> & indexer,
168 const Teuchos::RCP<const panzer::GlobalIndexer> & cIndexer,
169 const Teuchos::ParameterList& p);
170
171 void postRegistrationSetup(typename TRAITS::SetupData d,
173
174 void preEvaluate(typename TRAITS::PreEvalData d);
175
176 void evaluateFields(typename TRAITS::EvalData workset);
177
178 virtual Teuchos::RCP<CloneableEvaluator> clone(const Teuchos::ParameterList & pl) const
179 { return Teuchos::rcp(new ScatterDirichletResidual_Epetra<panzer::Traits::Tangent,TRAITS,LO,GO>(globalIndexer_,Teuchos::null,pl)); }
180
181private:
183
184 // dummy field so that the evaluator will have something to do
185 Teuchos::RCP<PHX::FieldTag> scatterHolder_;
186
187 // fields that need to be scattered will be put in this vector
188 std::vector< PHX::MDField<const ScalarT,Cell,NODE> > scatterFields_;
189
190 // maps the local (field,element,basis) triplet to a global ID
191 // for scattering
192 Teuchos::RCP<const panzer::GlobalIndexer> globalIndexer_;
193 std::vector<int> fieldIds_; // field IDs needing mapping
194
195 // This maps the scattered field names to the DOF manager field
196 // For instance a Navier-Stokes map might look like
197 // fieldMap_["RESIDUAL_Velocity"] --> "Velocity"
198 // fieldMap_["RESIDUAL_Pressure"] --> "Pressure"
199 Teuchos::RCP<const std::map<std::string,std::string> > fieldMap_;
200
201 std::vector<Teuchos::RCP<Epetra_Vector> > dfdp_vectors_;
202
203 std::size_t num_nodes;
204
205 std::size_t side_subcell_dim_;
206 std::size_t local_side_id_;
207
209
210 Teuchos::RCP<Epetra_Vector> dirichletCounter_;
211
212 std::string globalDataKey_; // what global data does this fill?
213 Teuchos::RCP<const EpetraLinearObjContainer> epetraContainer_;
214
217
218 // If set to true, scattering an initial condition
220
221 // Allows runtime disabling of dirichlet BCs on node-by-node basis
222 std::vector< PHX::MDField<const bool,Cell,NODE> > applyBC_;
223};
224
225// **************************************************************
226// Jacobian
227// **************************************************************
228template<typename TRAITS,typename LO,typename GO>
230 : public panzer::EvaluatorWithBaseImpl<TRAITS>,
231 public PHX::EvaluatorDerived<panzer::Traits::Jacobian, TRAITS>,
233
234public:
235 ScatterDirichletResidual_Epetra(const Teuchos::RCP<const GlobalIndexer> & indexer,
236 const Teuchos::RCP<const panzer::GlobalIndexer> & cIndexer=Teuchos::null)
237 : globalIndexer_(indexer), colGlobalIndexer_(cIndexer) {}
238
239 ScatterDirichletResidual_Epetra(const Teuchos::RCP<const GlobalIndexer> & indexer,
240 const Teuchos::RCP<const panzer::GlobalIndexer> & cIndexer,
241 const Teuchos::ParameterList& p);
242
243 void preEvaluate(typename TRAITS::PreEvalData d);
244
245 void postRegistrationSetup(typename TRAITS::SetupData d,
247
248 void evaluateFields(typename TRAITS::EvalData workset);
249
250 virtual Teuchos::RCP<CloneableEvaluator> clone(const Teuchos::ParameterList & pl) const
251 { return Teuchos::rcp(new ScatterDirichletResidual_Epetra<panzer::Traits::Jacobian,TRAITS,LO,GO>(globalIndexer_,colGlobalIndexer_,pl)); }
252
253private:
254
256
257 // dummy field so that the evaluator will have something to do
258 Teuchos::RCP<PHX::FieldTag> scatterHolder_;
259
260 // fields that need to be scattered will be put in this vector
261 std::vector< PHX::MDField<const ScalarT,Cell,NODE> > scatterFields_;
262
263 // maps the local (field,element,basis) triplet to a global ID
264 // for scattering
265 Teuchos::RCP<const panzer::GlobalIndexer> globalIndexer_, colGlobalIndexer_;
266 std::vector<int> fieldIds_; // field IDs needing mapping
267
268 // This maps the scattered field names to the DOF manager field
269 // For instance a Navier-Stokes map might look like
270 // fieldMap_["RESIDUAL_Velocity"] --> "Velocity"
271 // fieldMap_["RESIDUAL_Pressure"] --> "Pressure"
272 Teuchos::RCP<const std::map<std::string,std::string> > fieldMap_;
273
274 std::size_t num_nodes;
275 std::size_t num_eq;
276
277 std::size_t side_subcell_dim_;
278 std::size_t local_side_id_;
279
280 Teuchos::RCP<Epetra_Vector> dirichletCounter_;
281
282 std::string globalDataKey_; // what global data does this fill?
283 Teuchos::RCP<const EpetraLinearObjContainer> epetraContainer_;
284
286
289
290 // Allows runtime disabling of dirichlet BCs on node-by-node basis
291 std::vector< PHX::MDField<const bool,Cell,NODE> > applyBC_;
292
294};
295
296}
297
298// optionally include hessian support
299#ifdef Panzer_BUILD_HESSIAN_SUPPORT
301#endif
302
303// **************************************************************
304#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.
virtual Teuchos::RCP< CloneableEvaluator > clone(const Teuchos::ParameterList &pl) const
ScatterDirichletResidual_Epetra(const Teuchos::RCP< const GlobalIndexer > &indexer, const Teuchos::RCP< const panzer::GlobalIndexer > &cIndexer=Teuchos::null)
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.
ScatterDirichletResidual_Epetra(const Teuchos::RCP< const GlobalIndexer > &indexer, const Teuchos::RCP< const panzer::GlobalIndexer > &)
ScatterDirichletResidual_Epetra(const Teuchos::RCP< const GlobalIndexer > &indexer, const Teuchos::RCP< const panzer::GlobalIndexer > &)
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.