43 #ifndef PANZER_WEAKDIRICHLET_RESIDUAL_IMPL_HPP
44 #define PANZER_WEAKDIRICHLET_RESIDUAL_IMPL_HPP
51 #include "Intrepid2_FunctionSpaceTools.hpp"
57 template<
typename EvalT,
typename Traits>
62 std::string residual_name = p.
get<std::string>(
"Residual Name");
63 std::string flux_name = p.
get<std::string>(
"Flux Name");
64 std::string normal_name = p.
get<std::string>(
"Normal Name");
65 std::string normal_dot_flux_name = normal_name +
" dot " + flux_name;
66 std::string dof_name = p.
get<std::string>(
"DOF Name");
67 std::string value_name = p.
get<std::string>(
"Value Name");
68 std::string sigma_name = p.
get<std::string>(
"Sigma Name");
77 residual = PHX::MDField<ScalarT>(residual_name, basis->functional);
78 normal_dot_flux_plus_pen = PHX::MDField<ScalarT>(normal_dot_flux_name, ir->dl_scalar);
79 flux = PHX::MDField<const ScalarT>(flux_name, ir->dl_vector);
80 normal = PHX::MDField<const ScalarT>(normal_name, ir->dl_vector);
81 dof = PHX::MDField<const ScalarT>(dof_name, ir->dl_scalar);
82 value = PHX::MDField<const ScalarT>(value_name, ir->dl_scalar);
83 sigma = PHX::MDField<const ScalarT>(sigma_name, ir->dl_scalar);
85 this->addEvaluatedField(residual);
86 this->addEvaluatedField(normal_dot_flux_plus_pen);
87 this->addDependentField(normal);
88 this->addDependentField(flux);
89 this->addDependentField(dof);
90 this->addDependentField(value);
91 this->addDependentField(sigma);
95 std::string n =
"Weak Dirichlet Residual Evaluator";
100 template<
typename EvalT,
typename Traits>
107 num_ip = flux.extent(1);
108 num_dim = flux.extent(2);
117 template<
typename EvalT,
typename Traits>
123 for (index_t cell = 0; cell < workset.
num_cells; ++cell) {
124 for (std::size_t ip = 0; ip < num_ip; ++ip) {
125 normal_dot_flux_plus_pen(cell,ip) =
ScalarT(0.0);
126 for (std::size_t dim = 0; dim < num_dim; ++dim) {
127 normal_dot_flux_plus_pen(cell,ip) += normal(cell,ip,dim) * flux(cell,ip,dim);
129 normal_dot_flux_plus_pen(cell,ip) += sigma(cell,ip) * (dof(cell,ip) - value(cell,ip));
134 Intrepid2::FunctionSpaceTools<PHX::exec_space>::
135 integrate(residual.get_view(),
136 normal_dot_flux_plus_pen.get_view(),
137 (this->wda(workset).bases[basis_index])->weighted_basis_scalar.get_view());
WeakDirichletResidual(const Teuchos::ParameterList &p)
T & get(const std::string &name, T def_value)
void postRegistrationSetup(typename Traits::SetupData d, PHX::FieldManager< Traits > &fm)
Teuchos::RCP< panzer::BasisIRLayout > basisIRLayout(std::string basis_type, const int basis_order, const PointRule &pt_rule)
Nonmember constructor.
void evaluateFields(typename Traits::EvalData d)
std::vector< std::string >::size_type getBasisIndex(std::string basis_name, const panzer::Workset &workset, WorksetDetailsAccessor &wda)
Returns the index in the workset bases for a particular BasisIRLayout name.
#define TEUCHOS_ASSERT(assertion_test)
typename EvalT::ScalarT ScalarT
Teuchos::RCP< const std::vector< panzer::Workset > > worksets_