1 #ifndef VERTEXCFD_CLOSURE_ELECTRICPOTENTIALCROSSPRODUCTFLUX_IMPL_HPP
2 #define VERTEXCFD_CLOSURE_ELECTRICPOTENTIALCROSSPRODUCTFLUX_IMPL_HPP
4 #include <utils/VertexCFD_Utils_VectorField.hpp>
6 #include <Panzer_HierarchicParallelism.hpp>
12 namespace ClosureModel
15 template<
class EvalType,
class Traits,
int NumSpaceDim>
16 ElectricPotentialCrossProductFlux<EvalType, Traits, NumSpaceDim>::
17 ElectricPotentialCrossProductFlux(
const panzer::IntegrationRule& ir,
18 const std::string& flux_prefix,
19 const std::string& field_prefix)
20 : _electric_potential_flux(
21 flux_prefix +
"ELECTRIC_POTENTIAL_FLUX_electric_potential_equation",
23 , _sigma(
"electrical_conductivity", ir.dl_scalar)
26 this->addContributedField(_electric_potential_flux);
29 this->addDependentField(_sigma);
30 Utils::addDependentVectorField(
31 *
this, ir.dl_scalar, _velocity, field_prefix +
"velocity_");
32 Utils::addDependentVectorField(
33 *
this, ir.dl_scalar, _ext_magn_field,
"external_magnetic_field_");
35 this->setName(
"Electric Potential Cross Product Flux "
36 + std::to_string(num_space_dim) +
"D");
40 template<
class EvalType,
class Traits,
int NumSpaceDim>
41 void ElectricPotentialCrossProductFlux<EvalType, Traits, NumSpaceDim>::evaluateFields(
42 typename Traits::EvalData workset)
44 auto policy = panzer::HP::inst().teamPolicy<scalar_type, PHX::Device>(
46 Kokkos::parallel_for(this->getName(), policy, *
this);
50 template<
class EvalType,
class Traits,
int NumSpaceDim>
51 KOKKOS_INLINE_FUNCTION
void
52 ElectricPotentialCrossProductFlux<EvalType, Traits, NumSpaceDim>::operator()(
53 const Kokkos::TeamPolicy<PHX::exec_space>::member_type& team)
const
55 const int cell = team.league_rank();
56 const int num_point = _electric_potential_flux.extent(1);
59 Kokkos::TeamThreadRange(team, 0, num_point), [&](
const int point) {
61 _electric_potential_flux(cell, point, 0)
62 += _sigma(cell, point) * _velocity[1](cell, point)
63 * _ext_magn_field[2](cell, point);
64 _electric_potential_flux(cell, point, 1)
65 -= _sigma(cell, point) * _velocity[0](cell, point)
66 * _ext_magn_field[2](cell, point);
69 if (num_space_dim == 3)
72 _electric_potential_flux(cell, point, 0)
73 -= _sigma(cell, point) * _velocity[2](cell, point)
74 * _ext_magn_field[1](cell, point);
76 _electric_potential_flux(cell, point, 1)
77 += _sigma(cell, point) * _velocity[2](cell, point)
78 * _ext_magn_field[0](cell, point);
80 _electric_potential_flux(cell, point, 2)
81 += _sigma(cell, point)
82 * (_velocity[0](cell, point)
83 * _ext_magn_field[1](cell, point)
84 - _velocity[1](cell, point)
85 * _ext_magn_field[0](cell, point));
95 #endif // end VERTEXCFD_CLOSURE_ELECTRICPOTENTIALCROSSPRODUCTFLUX_IMPL_HPP