Panzer Version of the Day
Loading...
Searching...
No Matches
Panzer_PhysicsBlock.cpp
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#include "Teuchos_RCP.hpp"
44#include "Teuchos_ParameterList.hpp"
45#include "Teuchos_Assert.hpp"
46
47#include "Phalanx_FieldManager.hpp"
48#include "Phalanx_Evaluator_Factory.hpp"
49#include "Panzer_Traits.hpp"
51#include "Panzer_PureBasis.hpp"
54#include "Shards_CellTopology.hpp"
55
56// *******************************************************************
57
58void panzer::buildPhysicsBlocks(const std::map<std::string,std::string>& block_ids_to_physics_ids,
59 const std::map<std::string,Teuchos::RCP<const shards::CellTopology> > & block_ids_to_cell_topo,
60 const Teuchos::RCP<Teuchos::ParameterList>& physics_blocks_plist,
61 const int default_integration_order,
62 const std::size_t workset_size,
63 const Teuchos::RCP<const panzer::EquationSetFactory>& eqset_factory,
64 const Teuchos::RCP<panzer::GlobalData>& global_data,
65 const bool build_transient_support,
66 std::vector<Teuchos::RCP<panzer::PhysicsBlock> > & physicsBlocks,
67 const std::vector<std::string>& tangent_param_names)
68{
69 using Teuchos::RCP;
70 using Teuchos::rcp;
71 using std::map;
72 using std::string;
73
74 TEUCHOS_ASSERT(nonnull(physics_blocks_plist));
75
76 // Create a physics block for each element block
77 map<string,string>::const_iterator itr;
78 for (itr = block_ids_to_physics_ids.begin(); itr!=block_ids_to_physics_ids.end();++itr) {
79 string element_block_id = itr->first;
80 string physics_block_id = itr->second;
81
82 map<string,RCP<const shards::CellTopology> >::const_iterator ct_itr =
83 block_ids_to_cell_topo.find(element_block_id);
84 TEUCHOS_TEST_FOR_EXCEPTION(ct_itr==block_ids_to_cell_topo.end(),
85 std::runtime_error,
86 "Falied to find CellTopology for element block id: \""
87 << element_block_id << "\"!");
88 RCP<const shards::CellTopology> cellTopo = ct_itr->second;
89
90 const panzer::CellData volume_cell_data(workset_size,cellTopo);
91
92 // find physics block parameter sublist
93 TEUCHOS_TEST_FOR_EXCEPTION(!physics_blocks_plist->isSublist(physics_block_id),
94 std::runtime_error,
95 "Failed to find physics id: \""
96 << physics_block_id
97 << "\" requested by element block: \""
98 << element_block_id << "\"!");
99
100 RCP<panzer::PhysicsBlock> pb = rcp(new panzer::PhysicsBlock(Teuchos::sublist(physics_blocks_plist,physics_block_id,true),
101 element_block_id,
102 default_integration_order,
103 volume_cell_data,
104 eqset_factory,
105 global_data,
106 build_transient_support,
107 tangent_param_names
108 ));
109 physicsBlocks.push_back(pb);
110 }
111}
112
113void panzer::readPhysicsBlocks(const std::map<std::string,std::string>& block_ids_to_physics_ids,
114 const Teuchos::RCP<Teuchos::ParameterList>& physics_blocks_plist,
115 std::vector<Teuchos::RCP<panzer::PhysicsBlock> > & physicsBlocks)
116{
117 using Teuchos::RCP;
118 using Teuchos::rcp;
119 using std::map;
120 using std::string;
121
122 TEUCHOS_ASSERT(nonnull(physics_blocks_plist));
123
124 // Create a physics block for each element block
125 map<string,string>::const_iterator itr;
126 for (itr = block_ids_to_physics_ids.begin(); itr!=block_ids_to_physics_ids.end();++itr) {
127 string element_block_id = itr->first;
128 string physics_block_id = itr->second;
129
130 // find physics block parameter sublist
131 TEUCHOS_TEST_FOR_EXCEPTION(!physics_blocks_plist->isSublist(physics_block_id),
132 std::runtime_error,
133 "Failed to find physics id: \""
134 << physics_block_id
135 << "\" requested by element block: \""
136 << element_block_id << "\"!");
137
138 RCP<panzer::PhysicsBlock> pb = rcp(new panzer::PhysicsBlock(Teuchos::sublist(physics_blocks_plist,physics_block_id,true),
139 element_block_id));
140 physicsBlocks.push_back(pb);
141 }
142}
143
144// *******************************************************************
145Teuchos::RCP<panzer::PhysicsBlock> panzer::findPhysicsBlock(const std::string element_block_id,
146 const std::vector<Teuchos::RCP<panzer::PhysicsBlock> > & physics_blocks,
147 bool throw_on_failure)
148{
149 std::vector<Teuchos::RCP<panzer::PhysicsBlock> >::const_iterator pb = physics_blocks.begin();
150
151 while (pb != physics_blocks.end()) {
152 if ((*pb)->elementBlockID() == element_block_id)
153 return *pb;
154
155 ++pb;
156 }
157
158 TEUCHOS_TEST_FOR_EXCEPTION(throw_on_failure,std::runtime_error,"Error: panzer::findPhysicsBlock(): The requested physics block for element block\"" << element_block_id << "\" was not found in the vecotr of physics blocks!");
159
160 Teuchos::RCP<panzer::PhysicsBlock> null_pb;
161 return null_pb;
162}
163
164// *******************************************************************
166PhysicsBlock(const Teuchos::RCP<Teuchos::ParameterList>& physics_block_plist,
167 const std::string & element_block_id,
168 const int default_integration_order,
169 const panzer::CellData & cell_data,
170 const Teuchos::RCP<const panzer::EquationSetFactory>& factory,
171 const Teuchos::RCP<panzer::GlobalData>& global_data,
172 const bool build_transient_support,
173 const std::vector<std::string>& tangent_param_names) :
174 m_element_block_id(element_block_id),
175 m_default_integration_order(default_integration_order),
176 m_cell_data(cell_data),
177 m_input_parameters(physics_block_plist),
178 m_build_transient_support(build_transient_support),
179 m_global_data(global_data),
180 m_eqset_factory(factory),
181 m_active_evaluation_types(Sacado::mpl::size<panzer::Traits::EvalTypes>::value,true)
182{
183 TEUCHOS_ASSERT(nonnull(physics_block_plist));
184 TEUCHOS_ASSERT(nonnull(factory));
185 TEUCHOS_ASSERT(nonnull(global_data));
186
187 m_physics_id = physics_block_plist->name();
188
193 build_transient_support,
194 tangent_param_names);
195}
196
197// *******************************************************************
199PhysicsBlock(const Teuchos::RCP<Teuchos::ParameterList>& physics_block_plist,
200 const std::string & element_block_id) :
201 m_element_block_id(element_block_id),
202 m_default_integration_order(1),
203 m_input_parameters(physics_block_plist),
204 m_build_transient_support(false),
205 m_active_evaluation_types(Sacado::mpl::size<panzer::Traits::EvalTypes>::value,true)
206{
207}
208
209// *******************************************************************
211PhysicsBlock(const std::string & element_block_id,
212 const std::string & physics_block_id,
213 const int integration_order,
214 const panzer::CellData & cell_data,
215 const Teuchos::RCP<panzer::GlobalData>& global_data,
216 const Teuchos::RCP<panzer::PureBasis> & basis) :
217 m_physics_id(physics_block_id),
218 m_element_block_id(element_block_id),
219 m_default_integration_order(integration_order),
220 m_cell_data(cell_data),
221 m_input_parameters(Teuchos::null),
222 m_build_transient_support(false),
223 m_global_data(global_data),
224 m_eqset_factory(Teuchos::null),
225 m_active_evaluation_types(Sacado::mpl::size<panzer::Traits::EvalTypes>::value,true)
226{
227 using Teuchos::RCP;
228 using Teuchos::ParameterList;
229
230 // there will be no equation sets
231 m_equation_sets.clear();
232
233
234 // Generate list of dof names
235 m_dof_names.push_back("FAKE");
236
237 // Generate dof name (string) / basis pairs
238 m_provided_dofs.push_back(std::make_pair("FAKE",basis));
239
240 // Generate unique list of bases
241 m_bases[basis->name()] = basis;
242
243 // Get a unique list of point rules. NOTE: This assumes that the
244 // same point rules are used for all evaluation types. In the
245 // future we could easily change this by adding another level here
246 // to differentiate the point rules for each evaluation type.
247 // This would require some refactoring of the phsyics block
248 // registration routines and the workset builder to support all
249 // combinations of bases and point rules for each evaluation type.
250 m_integration_rules[integration_order] = Teuchos::rcp(new panzer::IntegrationRule(integration_order,cell_data));
251
252 // build up field library
253 m_field_lib = Teuchos::rcp(new FieldLibrary);
254 for(std::vector<StrPureBasisPair>::const_iterator itr=m_provided_dofs.begin();
255 itr!=m_provided_dofs.end();++itr)
256 m_field_lib->addFieldAndBasis(itr->first,itr->second);
257}
258
259// *******************************************************************
262 const panzer::CellData & cell_data) :
263 m_physics_id(pb.m_physics_id),
264 m_element_block_id(pb.m_element_block_id),
265 m_default_integration_order(pb.m_default_integration_order),
266 m_cell_data(cell_data), // NOT copied from pb
267 m_input_parameters(pb.m_input_parameters),
268 m_build_transient_support(pb.m_build_transient_support),
269 m_global_data(pb.m_global_data),
270 m_eqset_factory(pb.m_eqset_factory),
271 m_active_evaluation_types(Sacado::mpl::size<panzer::Traits::EvalTypes>::value,true)
272{
278}
279
280// *******************************************************************
281void panzer::PhysicsBlock::initialize(const int default_integration_order,
282 const bool build_transient_support,
283 const panzer::CellData & cell_data,
284 const Teuchos::RCP<const panzer::EquationSetFactory>& eqset_factory,
285 const Teuchos::RCP<panzer::GlobalData>& global_data,
286 const std::vector<std::string>& tangent_param_names)
287{
288 m_default_integration_order = default_integration_order;
289 m_build_transient_support = build_transient_support;
290 m_cell_data = cell_data;
291 m_global_data = global_data;
292 m_eqset_factory = eqset_factory;
293
294 initialize(m_input_parameters,
295 m_default_integration_order,
296 m_element_block_id,
297 m_cell_data,
298 m_build_transient_support,
299 tangent_param_names);
300}
301
302// *******************************************************************
303void panzer::PhysicsBlock::initialize(const Teuchos::RCP<Teuchos::ParameterList>& input_parameters,
304 const int& default_integration_order,
305 const std::string & element_block_id,
306 const panzer::CellData & cell_data,
307 const bool build_transient_support,
308 const std::vector<std::string>& tangent_param_names)
309{
310 using Teuchos::RCP;
311 using Teuchos::ParameterList;
312
313 TEUCHOS_TEST_FOR_EXCEPTION(input_parameters->numParams() < 1, std::runtime_error,
314 "The physics block \"" << input_parameters->name()
315 << "\" required by element block \"" << element_block_id
316 << "\" does not have any equation sets associated with it."
317 << " Please add at least one equation set to this physics block!");
318
319 m_equation_sets.clear();
320
321 // Loop over equation sets
322 typedef ParameterList::ConstIterator pl_iter;
323 for (pl_iter eq = input_parameters->begin(); eq != input_parameters->end(); ++eq) {
324
325 TEUCHOS_TEST_FOR_EXCEPTION( !(eq->second.isList()), std::logic_error,
326 "All entries in the physics block \"" << m_physics_id
327 << "\" must be an equation set sublist!" );
328
329 RCP<ParameterList> eq_set_pl = Teuchos::sublist(input_parameters,eq->first,true);
330
331 RCP<panzer::EquationSet_TemplateManager<panzer::Traits> > eq_set
332 = m_eqset_factory->buildEquationSet(eq_set_pl, default_integration_order, cell_data, m_global_data, build_transient_support);
333
334 // Set tangent parameter names for each equation set
335 for (auto eq_it = eq_set->begin(); eq_it != eq_set->end(); ++eq_it) {
336 eq_it->setTangentParamNames(tangent_param_names);
337 }
338
339 // add this equation set in
340 m_equation_sets.push_back(eq_set);
341
342 // Interrogate DOFs
343 const std::vector<StrPureBasisPair> & sbNames = eq_set->begin()->getProvidedDOFs();
344 for(std::size_t j=0;j<sbNames.size();j++) {
345
346 // Generate list of dof names
347 m_dof_names.push_back(sbNames[j].first);
348
349 // Generate dof name (string) / basis pairs
350 m_provided_dofs.push_back(sbNames[j]);
351
352 // Generate unique list of bases
353 m_bases[sbNames[j].second->name()] = sbNames[j].second;
354
355 // Generate tangent field names
356 for (std::size_t k=0; k<tangent_param_names.size(); ++k)
357 m_tangent_fields.push_back( StrPureBasisPair( sbNames[j].first + " SENSITIVITY " + tangent_param_names[k],
358 sbNames[j].second ) );
359
360 }
361
362 // add coordinate dofs to physics block
363 const std::vector<std::vector<std::string> > & coord_dofs = eq_set->begin()->getCoordinateDOFs();
364 m_coordinate_dofs.insert(m_coordinate_dofs.begin(),coord_dofs.begin(),coord_dofs.end());
365
366 // Get a unique list of point rules. NOTE: This assumes that the
367 // same point rules are used for all evaluation types. In the
368 // future we could easily change this by adding another level here
369 // to differentiate the point rules for each evaluation type.
370 // This would require some refactoring of the phsyics block
371 // registration routines and the workset builder to support all
372 // combinations of bases and point rules for each evaluation type.
373 const std::map<int,Teuchos::RCP<panzer::IntegrationRule> > & ir_map = eq_set->begin()->getIntegrationRules();
374 for(std::map<int,Teuchos::RCP<panzer::IntegrationRule> >::const_iterator ir = ir_map.begin();
375 ir != ir_map.end(); ++ir)
376 m_integration_rules[ir->second->order()] = ir->second;
377
378 }
379
380 // build up field library
381 m_field_lib = Teuchos::rcp(new FieldLibrary);
382 for(std::vector<StrPureBasisPair>::const_iterator itr=m_provided_dofs.begin();
383 itr!=m_provided_dofs.end();++itr)
384 m_field_lib->addFieldAndBasis(itr->first,itr->second);
385
386 // setup element blocks: loop over each evaluation type
387 for(std::size_t eq_i=0;eq_i<m_equation_sets.size();eq_i++) {
388 RCP<panzer::EquationSet_TemplateManager<panzer::Traits> > eq_set = m_equation_sets[eq_i];
390 itr!=eq_set->end();++itr) {
391 itr->setElementBlockId(element_block_id);
392 }
393 }
394
395}
396
397// *******************************************************************
398void panzer::PhysicsBlock::setActiveEvaluationTypes(const std::vector<bool>& aet)
399{
400 TEUCHOS_ASSERT(aet.size() == std::size_t(Sacado::mpl::size<panzer::Traits::EvalTypes>::value));
401 m_active_evaluation_types = aet;
402}
403
404// *******************************************************************
406{
407 for (auto&& t : m_active_evaluation_types)
408 t = true;
409}
410
411// *******************************************************************
414 const Teuchos::ParameterList& user_data) const
415{
416 using namespace std;
417 using namespace panzer;
418 using namespace Teuchos;
419
420 // Loop over equation set template managers
421 vector< RCP<EquationSet_TemplateManager<panzer::Traits> > >::const_iterator
422 eq_set = m_equation_sets.begin();
423 for (;eq_set != m_equation_sets.end(); ++eq_set) {
424
425 // Loop over evaluation types
428 eqstm.begin();
429 int idx = 0;
430 for (; eval_type != eqstm.end(); ++eval_type,++idx) {
431 if (m_active_evaluation_types[idx]) {
432 // Do not loop over integration rules. Only call this for the
433 // ir that the residual is integrated over. Otherwise the
434 // residual gets contributions from multiple integrations of the
435 // same cell! This ir is only known by equaiton set.
436 const int di = eval_type->setDetailsIndex(this->getDetailsIndex());
437 eval_type->buildAndRegisterEquationSetEvaluators(fm, *m_field_lib, user_data);
438 eval_type->setDetailsIndex(di);
439 }
440 }
441 }
442}
443
444// *******************************************************************
448 const Teuchos::ParameterList& user_data) const
449{
450 using namespace std;
451 using namespace panzer;
452 using namespace Teuchos;
453
454 // Loop over equation set template managers
455 vector< RCP<EquationSet_TemplateManager<panzer::Traits> > >::const_iterator
456 eq_set = m_equation_sets.begin();
457 for (;eq_set != m_equation_sets.end(); ++eq_set) {
458
459 // Loop over evaluation types
462 eqstm.begin();
463 int idx = 0;
464 for (; eval_type != eqstm.end(); ++eval_type,++idx) {
465 if (m_active_evaluation_types[idx]) {
466 const int di = eval_type->setDetailsIndex(this->getDetailsIndex());
467 eval_type->buildAndRegisterGatherAndOrientationEvaluators(fm, *m_field_lib, lof, user_data);
468 eval_type->setDetailsIndex(di);
469 }
470 }
471 }
472}
473
474// *******************************************************************
477 const Teuchos::Ptr<const panzer::LinearObjFactory<panzer::Traits> > & lof,
478 const Teuchos::ParameterList& user_data) const
479{
480 using namespace std;
481 using namespace panzer;
482 using namespace Teuchos;
483
484 // Loop over equation set template managers
485 vector< RCP<EquationSet_TemplateManager<panzer::Traits> > >::const_iterator
486 eq_set = m_equation_sets.begin();
487 for (;eq_set != m_equation_sets.end(); ++eq_set) {
488
489 // Loop over evaluation types
492 eqstm.begin();
493 int idx = 0;
494 for (; eval_type != eqstm.end(); ++eval_type,++idx) {
495 if (m_active_evaluation_types[idx]) {
496
497 // Loop over integration rules
498 for (std::map<int,Teuchos::RCP<panzer::IntegrationRule> >::const_iterator ir_iter = m_integration_rules.begin();
499 ir_iter != m_integration_rules.end(); ++ ir_iter) {
500
501 Teuchos::RCP<panzer::IntegrationRule> ir = ir_iter->second;
502
503 const int di = eval_type->setDetailsIndex(this->getDetailsIndex());
504 eval_type->buildAndRegisterDOFProjectionsToIPEvaluators(fm, *m_field_lib->buildFieldLayoutLibrary(*ir), ir, lof, user_data);
505 eval_type->setDetailsIndex(di);
506 }
507 }
508 }
509 }
510}
511
512// *******************************************************************
516 const Teuchos::ParameterList& user_data) const
517{
518 using namespace std;
519 using namespace panzer;
520 using namespace Teuchos;
521
522 // Loop over equation set template managers
523 vector< RCP<EquationSet_TemplateManager<panzer::Traits> > >::const_iterator
524 eq_set = m_equation_sets.begin();
525 for (;eq_set != m_equation_sets.end(); ++eq_set) {
526
527 // Loop over evaluation types
530 eqstm.begin();
531 int idx = 0;
532 for (; eval_type != eqstm.end(); ++eval_type,++idx) {
533 if (m_active_evaluation_types[idx]) {
534 const int di = eval_type->setDetailsIndex(this->getDetailsIndex());
535 eval_type->buildAndRegisterScatterEvaluators(fm, *m_field_lib, lof, user_data);
536 eval_type->setDetailsIndex(di);
537 }
538 }
539 }
540}
541
542// *******************************************************************
546 const Teuchos::ParameterList& models,
547 const Teuchos::ParameterList& user_data) const
548{
549 using namespace std;
550 using namespace panzer;
551 using namespace Teuchos;
552
553 // Loop over equation set template managers
554 vector< RCP<EquationSet_TemplateManager<panzer::Traits> > >::const_iterator
555 eq_set = m_equation_sets.begin();
556 for (;eq_set != m_equation_sets.end(); ++eq_set) {
557
558 // Loop over evaluation types
561 eqstm.begin();
562 int idx = 0;
563 for (; eval_type != eqstm.end(); ++eval_type,++idx) {
564 if (m_active_evaluation_types[idx]) {
565
566 // Loop over integration rules
567 for (std::map<int,Teuchos::RCP<panzer::IntegrationRule> >::const_iterator ir_iter = m_integration_rules.begin();
568 ir_iter != m_integration_rules.end(); ++ ir_iter) {
569
570 Teuchos::RCP<panzer::IntegrationRule> ir = ir_iter->second;
571
572 const int di = eval_type->setDetailsIndex(this->getDetailsIndex());
573 eval_type->buildAndRegisterClosureModelEvaluators(fm, *m_field_lib->buildFieldLayoutLibrary(*ir), ir, factory, models, user_data);
574 eval_type->setDetailsIndex(di);
575 }
576 }
577 }
578 }
579}
580
581// *******************************************************************
582
586 const std::string& model_name,
587 const Teuchos::ParameterList& models,
588 const Teuchos::ParameterList& user_data) const
589{
590 using namespace std;
591 using namespace panzer;
592 using namespace Teuchos;
593
594 // Loop over equation set template managers
595 vector< RCP<EquationSet_TemplateManager<panzer::Traits> > >::const_iterator
596 eq_set = m_equation_sets.begin();
597 for (;eq_set != m_equation_sets.end(); ++eq_set) {
598
599 // Loop over evaluation types
602 eqstm.begin();
603 int idx = 0;
604 for (; eval_type != eqstm.end(); ++eval_type,++idx) {
605 if (m_active_evaluation_types[idx]) {
606
607 // Loop over integration rules
608 for (std::map<int,Teuchos::RCP<panzer::IntegrationRule> >::const_iterator ir_iter = m_integration_rules.begin();
609 ir_iter != m_integration_rules.end(); ++ ir_iter) {
610
611 Teuchos::RCP<panzer::IntegrationRule> ir = ir_iter->second;
612 const int di = eval_type->setDetailsIndex(this->getDetailsIndex());
613 eval_type->buildAndRegisterClosureModelEvaluators(fm, *m_field_lib->buildFieldLayoutLibrary(*ir), ir, factory, model_name, models, user_data);
614 eval_type->setDetailsIndex(di);
615 }
616 }
617 }
618 }
619
620 // if there are no equation sets call the closure model directly
621 if(m_equation_sets.size()==0) {
623 int idx = 0;
624 for (;eval_type != factory.end(); ++eval_type,++idx) {
625 if (m_active_evaluation_types[idx]) {
626
627 // setup some place holder parameter list, lets hope no one needs is!
628 Teuchos::ParameterList plist;
629
630 // Loop over integration rules
631 for (std::map<int,Teuchos::RCP<panzer::IntegrationRule> >::const_iterator ir_iter = m_integration_rules.begin();
632 ir_iter != m_integration_rules.end(); ++ ir_iter) {
633
634 Teuchos::RCP<panzer::IntegrationRule> ir = ir_iter->second;
635
636 // call directly to the closure models
637 Teuchos::RCP< std::vector< Teuchos::RCP<PHX::Evaluator<panzer::Traits> > > > evaluators =
638 eval_type->buildClosureModels(model_name,
639 models,
640 *m_field_lib->buildFieldLayoutLibrary(*ir),
641 ir,
642 plist,
643 user_data,
644 this->globalData(),
645 fm);
646
647 // register the constructed evaluators
648 const int di = eval_type->setDetailsIndex(this->getDetailsIndex());
649 eval_type->registerEvaluators(*evaluators,fm);
650 eval_type->setDetailsIndex(di);
651 }
652 }
653 }
654 }
655}
656
657// *******************************************************************
661 const std::string& model_name,
662 const Teuchos::ParameterList& models,
664 const Teuchos::ParameterList& user_data) const
665{
666 using namespace std;
667 using namespace panzer;
668 using namespace Teuchos;
669
670 // Only use the <Residual> evaluation type, so pass through to type specific call
671 this->buildAndRegisterInitialConditionEvaluatorsForType<panzer::Traits::Residual>(fm, factory, model_name, models, lof, user_data);
672}
673
674
675// *******************************************************************
676const std::vector<std::string>& panzer::PhysicsBlock::getDOFNames() const
677{
678 return m_dof_names;
679}
680
681// *******************************************************************
682const std::vector<panzer::StrPureBasisPair>& panzer::PhysicsBlock::getProvidedDOFs() const
683{
684 return m_provided_dofs;
685}
686
687// *******************************************************************
688const std::vector<std::vector<std::string> >& panzer::PhysicsBlock::getCoordinateDOFs() const
689{
690 return m_coordinate_dofs;
691}
692
693// *******************************************************************
694const std::vector<panzer::StrPureBasisPair>& panzer::PhysicsBlock::getTangentFields() const
695{
696 return m_tangent_fields;
697}
698
699// *******************************************************************
701{
703
704 needs.cellData = this->cellData();
705 const std::map<int,Teuchos::RCP<panzer::IntegrationRule> >& int_rules = this->getIntegrationRules();
706 for (std::map<int,Teuchos::RCP<panzer::IntegrationRule> >::const_iterator ir_itr = int_rules.begin();
707 ir_itr != int_rules.end(); ++ir_itr)
708 needs.int_rules.push_back(ir_itr->second);
709
710 const std::map<std::string,Teuchos::RCP<panzer::PureBasis> >& bases= this->getBases();
711 const std::vector<StrPureBasisPair>& fieldToBasis = getProvidedDOFs();
712 for(std::map<std::string,Teuchos::RCP<panzer::PureBasis> >::const_iterator b_itr = bases.begin();
713 b_itr != bases.end(); ++b_itr) {
714
715 needs.bases.push_back(b_itr->second);
716
717 bool found = false;
718 for(std::size_t d=0;d<fieldToBasis.size();d++) {
719 if(fieldToBasis[d].second->name()==b_itr->second->name()) {
720 // add representative basis for this field
721 needs.rep_field_name.push_back(fieldToBasis[d].first);
722 found = true;
723
724 break;
725 }
726 }
727
728 // this should always work if physics blocks are correctly constructed
729 TEUCHOS_ASSERT(found);
730 }
731
732 return needs;
733}
734
735// *******************************************************************
736const std::map<std::string,Teuchos::RCP<panzer::PureBasis> >&
738{
739 return m_bases;
740}
741
742// *******************************************************************
743const std::map<int,Teuchos::RCP<panzer::IntegrationRule> >&
745{
746 return m_integration_rules;
747}
748
749// *******************************************************************
750const shards::CellTopology panzer::PhysicsBlock::getBaseCellTopology() const
751{
752 TEUCHOS_TEST_FOR_EXCEPTION(m_bases.size() == 0, std::runtime_error,
753 "Cannot return a basis since none exist in this physics block.");
754 return m_bases.begin()->second->getIntrepid2Basis()->getBaseCellTopology();
755}
756
757// *******************************************************************
759{
760 return m_physics_id;
761}
762
763// *******************************************************************
765{
766 return m_element_block_id;
767}
768
769// *******************************************************************
771{
772 return m_cell_data;
773}
774
775// *******************************************************************
776Teuchos::RCP<panzer::PhysicsBlock> panzer::PhysicsBlock::copyWithCellData(const panzer::CellData & cell_data) const
777{
778 return Teuchos::rcp(new panzer::PhysicsBlock(*this,cell_data));
779}
780
781// *******************************************************************
782Teuchos::RCP<panzer::GlobalData> panzer::PhysicsBlock::globalData() const
783{
784 return m_global_data;
785}
786
787// *******************************************************************
Data for determining cell topology and dimensionality.
Object that contains information on the physics and discretization of a block of elements with the SA...
void initialize(const int default_integration_order, const bool build_transient_support, const panzer::CellData &cell_data, const Teuchos::RCP< const panzer::EquationSetFactory > &factory, const Teuchos::RCP< panzer::GlobalData > &global_data, const std::vector< std::string > &tangent_param_names=std::vector< std::string >())
const std::vector< StrPureBasisPair > & getTangentFields() const
Returns list of tangent fields from DOFs and tangent param names.
Teuchos::RCP< FieldLibrary > m_field_lib
const std::map< int, Teuchos::RCP< panzer::IntegrationRule > > & getIntegrationRules() const
Returns the unique set of point rules, key is the unique panzer::PointRule::name()
std::string elementBlockID() const
void buildAndRegisterEquationSetEvaluators(PHX::FieldManager< panzer::Traits > &fm, const Teuchos::ParameterList &user_data) const
std::vector< StrPureBasisPair > m_provided_dofs
void buildAndRegisterGatherAndOrientationEvaluators(PHX::FieldManager< panzer::Traits > &fm, const panzer::LinearObjFactory< panzer::Traits > &lof, const Teuchos::ParameterList &user_data) const
void buildAndRegisterInitialConditionEvaluators(PHX::FieldManager< panzer::Traits > &fm, const panzer::ClosureModelFactory_TemplateManager< panzer::Traits > &factory, const std::string &model_name, const Teuchos::ParameterList &models, const panzer::LinearObjFactory< panzer::Traits > &lof, const Teuchos::ParameterList &user_data) const
std::vector< std::string > m_dof_names
std::vector< Teuchos::RCP< panzer::EquationSet_TemplateManager< panzer::Traits > > > m_equation_sets
Teuchos::RCP< PhysicsBlock > copyWithCellData(const panzer::CellData &cell_data) const
WorksetNeeds getWorksetNeeds() const
const shards::CellTopology getBaseCellTopology() const
Teuchos::RCP< panzer::GlobalData > globalData() const
void buildAndRegisterScatterEvaluators(PHX::FieldManager< panzer::Traits > &fm, const panzer::LinearObjFactory< panzer::Traits > &lof, const Teuchos::ParameterList &user_data) const
const std::vector< std::string > & getDOFNames() const
Teuchos::RCP< Teuchos::ParameterList > m_input_parameters
store the input parameter list for copy ctors
void buildAndRegisterClosureModelEvaluators(PHX::FieldManager< panzer::Traits > &fm, const panzer::ClosureModelFactory_TemplateManager< panzer::Traits > &factory, const Teuchos::ParameterList &models, const Teuchos::ParameterList &user_data) const
void setActiveEvaluationTypes(const std::vector< bool > &aet)
Used to save memory by disabling unneeded evaluation types.
const std::map< std::string, Teuchos::RCP< panzer::PureBasis > > & getBases() const
Returns the unique set of bases, key is the unique panzer::PureBasis::name() of the basis.
void activateAllEvaluationTypes()
Used to reactivate all evaluation types if some were temporarily disabled with a call to setActiveEva...
std::map< std::string, Teuchos::RCP< panzer::PureBasis > > m_bases
map of unique bases, key is the panzer::PureBasis::name() corresponding to its value
const panzer::CellData & cellData() const
void buildAndRegisterDOFProjectionsToIPEvaluators(PHX::FieldManager< panzer::Traits > &fm, const Teuchos::Ptr< const panzer::LinearObjFactory< panzer::Traits > > &lof, const Teuchos::ParameterList &user_data) const
const std::vector< StrPureBasisPair > & getProvidedDOFs() const
std::map< int, Teuchos::RCP< panzer::IntegrationRule > > m_integration_rules
map of unique integration rules, key is panzer::IntegrationRule::order() corresponding to its value
std::string physicsBlockID() const
const std::vector< std::vector< std::string > > & getCoordinateDOFs() const
std::pair< std::string, Teuchos::RCP< panzer::PureBasis > > StrPureBasisPair
std::vector< Teuchos::RCP< const IntegrationRule > > int_rules
std::vector< std::string > rep_field_name
std::vector< Teuchos::RCP< const PureBasis > > bases