1 #ifndef VERTEXCFD_CLOSURE_MAGNETICCORRECTIONDAMPINGSOURCE_IMPL_HPP
2 #define VERTEXCFD_CLOSURE_MAGNETICCORRECTIONDAMPINGSOURCE_IMPL_HPP
4 #include <Panzer_HierarchicParallelism.hpp>
11 template<
class EvalType,
class Traits>
12 MagneticCorrectionDampingSource<EvalType, Traits>::MagneticCorrectionDampingSource(
13 const panzer::IntegrationRule& ir,
14 const MHDProperties::FullInductionMHDProperties& mhd_props)
15 : _damping_potential_source(
"DAMPING_SOURCE_magnetic_correction_potential",
17 , _alpha(mhd_props.magneticCorrectionDampingFactor())
18 , _scalar_magnetic_potential(
"scalar_magnetic_potential", ir.dl_scalar)
21 this->addEvaluatedField(_damping_potential_source);
24 this->addDependentField(_scalar_magnetic_potential);
26 this->setName(
"Magnetic Correction Damping Source");
30 template<
class EvalType,
class Traits>
31 void MagneticCorrectionDampingSource<EvalType, Traits>::evaluateFields(
32 typename Traits::EvalData workset)
34 auto policy = panzer::HP::inst().teamPolicy<scalar_type, PHX::Device>(
36 Kokkos::parallel_for(this->getName(), policy, *
this);
40 template<
class EvalType,
class Traits>
41 KOKKOS_INLINE_FUNCTION
void
42 MagneticCorrectionDampingSource<EvalType, Traits>::operator()(
43 const Kokkos::TeamPolicy<PHX::exec_space>::member_type& team)
const
45 const int cell = team.league_rank();
46 const int num_point = _scalar_magnetic_potential.extent(1);
49 Kokkos::TeamThreadRange(team, 0, num_point), [&](
const int point) {
50 _damping_potential_source(cell, point)
51 = -_alpha * _scalar_magnetic_potential(cell, point);
60 #endif // end VERTEXCFD_CLOSURE_MAGNETICCORRECTIONDAMPINGSOURCE_IMPL_HPP