1 #ifndef VERTEXCFD_CLOSURE_SOLIDELECTRICPOTENTIALDIFFUSIONFLUX_IMPL_HPP
2 #define VERTEXCFD_CLOSURE_SOLIDELECTRICPOTENTIALDIFFUSIONFLUX_IMPL_HPP
4 #include <Panzer_HierarchicParallelism.hpp>
10 namespace ClosureModel
13 template<
class EvalType,
class Traits>
14 SolidElectricPotentialDiffusionFlux<EvalType, Traits>::
15 SolidElectricPotentialDiffusionFlux(
const panzer::IntegrationRule& ir,
16 const std::string& flux_prefix,
17 const std::string& gradient_prefix)
18 : _electric_potential_flux(
19 flux_prefix +
"ELECTRIC_POTENTIAL_FLUX_electric_potential_equation",
21 , _grad_electric_potential(gradient_prefix +
"GRAD_electric_potential",
23 , _sigma(
"solid_electric_conductivity", ir.dl_scalar)
24 , _num_grad_dim(ir.spatial_dimension)
27 this->addEvaluatedField(_electric_potential_flux);
30 this->addDependentField(_grad_electric_potential);
31 this->addDependentField(_sigma);
33 this->setName(
"Solid Electric Potential Diffusion Flux "
34 + std::to_string(_num_grad_dim) +
"D");
38 template<
class EvalType,
class Traits>
39 void SolidElectricPotentialDiffusionFlux<EvalType, Traits>::evaluateFields(
40 typename Traits::EvalData workset)
42 auto policy = panzer::HP::inst().teamPolicy<scalar_type, PHX::Device>(
44 Kokkos::parallel_for(this->getName(), policy, *
this);
48 template<
class EvalType,
class Traits>
49 KOKKOS_INLINE_FUNCTION
void
50 SolidElectricPotentialDiffusionFlux<EvalType, Traits>::operator()(
51 const Kokkos::TeamPolicy<PHX::exec_space>::member_type& team)
const
53 const int cell = team.league_rank();
54 const int num_point = _electric_potential_flux.extent(1);
57 Kokkos::TeamThreadRange(team, 0, num_point), [&](
const int point) {
58 for (
int dim = 0; dim < _num_grad_dim; ++dim)
60 _electric_potential_flux(cell, point, dim)
61 = -_sigma(cell, point)
62 * _grad_electric_potential(cell, point, dim);
72 #endif // end VERTEXCFD_CLOSURE_SOLIDELECTRICPOTENTIALDIFFUSIONFLUX_IMPL_HPP