1 #ifndef VERTEXCFD_CLOSURE_INCOMPRESSIBLELSVOFSCALARCONVECTIVEFLUX_IMPL_HPP
2 #define VERTEXCFD_CLOSURE_INCOMPRESSIBLELSVOFSCALARCONVECTIVEFLUX_IMPL_HPP
4 #include "utils/VertexCFD_Utils_PhaseLayout.hpp"
5 #include "utils/VertexCFD_Utils_VectorField.hpp"
7 #include <Panzer_HierarchicParallelism.hpp>
13 namespace ClosureModel
16 template<
class EvalType,
class Traits,
int NumSpaceDim>
17 IncompressibleLSVOFScalarConvectiveFlux<EvalType, Traits, NumSpaceDim>::
18 IncompressibleLSVOFScalarConvectiveFlux(
const panzer::IntegrationRule& ir,
19 const int& phase_index,
20 const int& num_lsvof_dofs,
21 const std::string& equation_name,
22 const std::string& flux_prefix,
23 const std::string& field_prefix)
24 : _scalar_flux(flux_prefix +
"CONVECTIVE_FLUX_" + equation_name,
26 , _phase_index(phase_index)
27 , _phase_layout(Utils::buildPhaseLayout(ir.dl_scalar, num_lsvof_dofs))
28 , _volume_fractions(field_prefix +
"volume_fractions", _phase_layout)
31 this->addEvaluatedField(_scalar_flux);
34 this->addDependentField(_volume_fractions);
35 Utils::addDependentVectorField(
36 *
this, ir.dl_scalar, _velocity, field_prefix +
"velocity_");
38 this->setName(equation_name +
" Incompressible Convective Flux "
39 + std::to_string(num_space_dim) +
"D");
43 template<
class EvalType,
class Traits,
int NumSpaceDim>
44 void IncompressibleLSVOFScalarConvectiveFlux<EvalType, Traits, NumSpaceDim>::
45 evaluateFields(
typename Traits::EvalData workset)
47 auto policy = panzer::HP::inst().teamPolicy<scalar_type, PHX::Device>(
49 Kokkos::parallel_for(this->getName(), policy, *
this);
53 template<
class EvalType,
class Traits,
int NumSpaceDim>
54 KOKKOS_INLINE_FUNCTION
void
55 IncompressibleLSVOFScalarConvectiveFlux<EvalType, Traits, NumSpaceDim>::operator()(
56 const Kokkos::TeamPolicy<PHX::exec_space>::member_type& team)
const
58 const int cell = team.league_rank();
59 const int num_point = _scalar_flux.extent(1);
62 Kokkos::TeamThreadRange(team, 0, num_point), [&](
const int point) {
63 for (
int dim = 0; dim < num_space_dim; ++dim)
65 _scalar_flux(cell, point, dim)
66 = _volume_fractions(cell, point, _phase_index)
67 * _velocity[dim](cell, point);