1 #ifndef VERTEXCFD_BOUNDARYSTATE_ELECTRICPOTENTIALINSULATINGWALL_IMPL_HPP
2 #define VERTEXCFD_BOUNDARYSTATE_ELECTRICPOTENTIALINSULATINGWALL_IMPL_HPP
4 #include <Panzer_HierarchicParallelism.hpp>
8 namespace BoundaryCondition
11 template<
class EvalType,
class Traits>
12 ElectricPotentialInsulatingWall<EvalType, Traits>::ElectricPotentialInsulatingWall(
13 const panzer::IntegrationRule& ir)
14 : _boundary_electric_potential(
"BOUNDARY_electric_potential", ir.dl_scalar)
15 , _boundary_grad_electric_potential(
"BOUNDARY_GRAD_electric_potential",
17 , _electric_potential(
"electric_potential", ir.dl_scalar)
18 , _grad_electric_potential(
"GRAD_electric_potential", ir.dl_vector)
19 , _normals(
"Side Normal", ir.dl_vector)
21 this->addDependentField(_electric_potential);
22 this->addEvaluatedField(_boundary_electric_potential);
23 this->addDependentField(_grad_electric_potential);
24 this->addEvaluatedField(_boundary_grad_electric_potential);
26 this->addDependentField(_normals);
28 this->setName(
"Boundary State Electric Potential Insulating Wall");
32 template<
class EvalType,
class Traits>
33 void ElectricPotentialInsulatingWall<EvalType, Traits>::evaluateFields(
34 typename Traits::EvalData workset)
36 auto policy = panzer::HP::inst().teamPolicy<scalar_type, PHX::Device>(
38 Kokkos::parallel_for(this->getName(), policy, *
this);
42 template<
class EvalType,
class Traits>
43 KOKKOS_INLINE_FUNCTION
void
44 ElectricPotentialInsulatingWall<EvalType, Traits>::operator()(
45 const Kokkos::TeamPolicy<PHX::exec_space>::member_type& team)
const
47 const int cell = team.league_rank();
48 const int num_point = _electric_potential.extent(1);
49 const int num_grad_dim = _normals.extent(2);
52 Kokkos::TeamThreadRange(team, 0, num_point), [&](
const int point) {
54 scalar_type grad_phi_dot_n = 0.0;
55 for (
int dim = 0; dim < num_grad_dim; ++dim)
57 grad_phi_dot_n += _grad_electric_potential(cell, point, dim)
58 * _normals(cell, point, dim);
61 _boundary_electric_potential(cell, point)
62 = _electric_potential(cell, point);
65 for (
int dim = 0; dim < num_grad_dim; ++dim)
67 _boundary_grad_electric_potential(cell, point, dim)
68 = _grad_electric_potential(cell, point, dim)
69 - grad_phi_dot_n * _normals(cell, point, dim);
79 #endif // VERTEXCFD_BOUNDARYSTATE_ELECTRICPOTENTIALINSULATINGWALL_IMPL_HPP