| 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 |
#include "Teuchos_ParameterList.hpp" |
| 12 |
#include "Teuchos_RCP.hpp" |
| 13 |
#include "Teuchos_Assert.hpp" |
| 14 |
#include "Phalanx_DataLayout_MDALayout.hpp" |
| 15 |
#include "Phalanx_FieldManager.hpp" |
| 16 |
#include "Panzer_PhysicsBlock.hpp" |
| 17 |
|
| 18 |
#include "Panzer_BasisIRLayout.hpp" |
| 19 |
|
| 20 |
// Evaluators |
| 21 |
#include "Panzer_ConstantFlux.hpp" |
| 22 |
|
| 23 |
#include "Phalanx_MDField.hpp" |
| 24 |
#include "Phalanx_DataLayout.hpp" |
| 25 |
#include "Phalanx_DataLayout_MDALayout.hpp" |
| 26 |
|
| 27 |
// *********************************************************************** |
| 28 |
template <typename EvalT> |
| 29 |
user_app::BCStrategy_Neumann_Constant<EvalT>:: |
| 30 |
BCStrategy_Neumann_Constant(const panzer::BC& bc, const Teuchos::RCP<panzer::GlobalData>& global_data) : |
| 31 |
panzer::BCStrategy_Neumann_DefaultImpl<EvalT>(bc,global_data) |
| 32 |
{ |
| 33 |
|
| 34 |
} |
| 35 |
|
| 36 |
// *********************************************************************** |
| 37 |
template <typename EvalT> |
| 38 |
void user_app::BCStrategy_Neumann_Constant<EvalT>:: |
| 39 |
setup(const panzer::PhysicsBlock& side_pb, |
| 40 |
const Teuchos::ParameterList& /* user_data */) |
| 41 |
{ |
| 42 |
// need the dof value to form the residual |
| 43 |
this->requireDOFGather(this->m_bc.equationSetName()); |
| 44 |
|
| 45 |
const std::string residual_name = "Residual_" + this->m_bc.identifier(); |
| 46 |
const std::string dof_name = this->m_bc.equationSetName(); |
| 47 |
const std::string flux_name = "Constant_" + this->m_bc.equationSetName(); |
| 48 |
const int integration_order = this->m_bc.params()->template get<int>("Integration Order"); |
| 49 |
|
| 50 |
this->addResidualContribution(residual_name,dof_name,flux_name,integration_order,side_pb); |
| 51 |
} |
| 52 |
|
| 53 |
// *********************************************************************** |
| 54 |
template <typename EvalT> |
| 55 |
void user_app::BCStrategy_Neumann_Constant<EvalT>:: |
| 56 |
buildAndRegisterEvaluators(PHX::FieldManager<panzer::Traits>& fm, |
| 57 |
const panzer::PhysicsBlock& /* pb */, |
| 58 |
const panzer::ClosureModelFactory_TemplateManager<panzer::Traits>& /* factory */, |
| 59 |
const Teuchos::ParameterList& /* models */, |
| 60 |
const Teuchos::ParameterList& /* user_data */) const |
| 61 |
{ |
| 62 |
using Teuchos::ParameterList; |
| 63 |
using Teuchos::RCP; |
| 64 |
using Teuchos::rcp; |
| 65 |
|
| 66 |
const std::vector<std::tuple<std::string,std::string,std::string,int,Teuchos::RCP<panzer::PureBasis>,Teuchos::RCP<panzer::IntegrationRule> > > data = this->getResidualContributionData(); |
| 67 |
|
| 68 |
std::string flux_name = std::get<2>(data[0]); |
| 69 |
Teuchos::RCP<panzer::IntegrationRule> ir = std::get<5>(data[0]); |
| 70 |
|
| 71 |
// provide a constant flux target value to map into residual |
| 72 |
{ |
| 73 |
ParameterList p("BC Constant Neumann"); |
| 74 |
p.set("Flux Field Name", flux_name); |
| 75 |
p.set("Data Layout", ir->dl_vector); |
| 76 |
TEUCHOS_ASSERT(this->m_bc.params()->isSublist("Flux Values")); |
| 77 |
p.sublist("Flux Values") = this->m_bc.params()->sublist("Flux Values"); |
| 78 |
|
| 79 |
RCP< PHX::Evaluator<panzer::Traits> > op = |
| 80 |
rcp(new panzer::ConstantFlux<EvalT,panzer::Traits>(p)); |
| 81 |
|
| 82 |
this->template registerEvaluator<EvalT>(fm, op); |
| 83 |
} |
| 84 |
|
| 85 |
} |
| 86 |
|
| 87 |
// *********************************************************************** |
| 88 |
template <typename EvalT> |
| 89 |
void user_app::BCStrategy_Neumann_Constant<EvalT>:: |
| 90 |
postRegistrationSetup(typename panzer::Traits::SetupData /* d */, |
| 91 |
PHX::FieldManager<panzer::Traits>& /* vm */) |
| 92 |
{ |
| 93 |
|
| 94 |
} |
| 95 |
|
| 96 |
|
| 97 |
// *********************************************************************** |
| 98 |
template <typename EvalT> |
| 99 |
void user_app::BCStrategy_Neumann_Constant<EvalT>:: |
| 100 |
evaluateFields(typename panzer::Traits::EvalData /* d */) |
| 101 |
{ |
| 102 |
|
| 103 |
} |