1 #ifndef VERTEXCFD_CLOSURE_CONDUCTIONERRORNORMS_IMPL_HPP
2 #define VERTEXCFD_CLOSURE_CONDUCTIONERRORNORMS_IMPL_HPP
4 #include "utils/VertexCFD_Utils_VectorField.hpp"
6 #include "Panzer_GlobalIndexer.hpp"
7 #include "Panzer_PureBasis.hpp"
8 #include "Panzer_Workset_Utilities.hpp"
9 #include <Panzer_HierarchicParallelism.hpp>
11 #include <Teuchos_Array.hpp>
18 namespace ClosureModel
21 template<
class EvalType,
class Traits,
int NumSpaceDim>
23 const panzer::IntegrationRule& ir)
24 : _L1_error_continuity(
"L1_Error_continuity", ir.dl_scalar)
25 , _L1_error_energy(
"L1_Error_energy", ir.dl_scalar)
26 , _L2_error_continuity(
"L2_Error_continuity", ir.dl_scalar)
27 , _L2_error_energy(
"L2_Error_energy", ir.dl_scalar)
28 , _volume(
"volume", ir.dl_scalar)
29 , _exact_temperature(
"Exact_temperature", ir.dl_scalar)
30 , _temperature(
"temperature", ir.dl_scalar)
33 this->addDependentField(_exact_temperature);
36 this->addDependentField(_temperature);
40 Utils::addEvaluatedVectorField(
43 Utils::addEvaluatedVectorField(
48 this->addEvaluatedField(
_volume);
50 this->setName(
"Conduction Error Norms " + std::to_string(
num_space_dim)
55 template<
class EvalType,
class Traits,
int NumSpaceDim>
57 typename Traits::EvalData workset)
59 auto policy = panzer::HP::inst().teamPolicy<
scalar_type, PHX::Device>(
61 Kokkos::parallel_for(this->getName(), policy, *
this);
65 template<
class EvalType,
class Traits,
int NumSpaceDim>
66 KOKKOS_INLINE_FUNCTION
void
68 const Kokkos::TeamPolicy<PHX::exec_space>::member_type& team)
const
70 const int cell = team.league_rank();
71 const int num_point = _temperature.extent(1);
74 Kokkos::TeamThreadRange(team, 0, num_point), [&](
const int point) {
80 _L1_error_energy(cell, point) = abs(
81 _temperature(cell, point) - _exact_temperature(cell, point));
83 _L2_error_energy(cell, point) = pow(
84 _temperature(cell, point) - _exact_temperature(cell, point), 2);
86 _L1_error_continuity(cell, point) = 0.0;
88 _L2_error_continuity(cell, point) = 0.0;
90 for (
int i = 0; i < num_space_dim; ++i)
92 _L1_error_momentum[i](cell, point) = 0.0;
93 _L2_error_momentum[i](cell, point) = 0.0;
96 _volume(cell, point) = 1.0;
105 #endif // VERTEXCFD_CLOSURE_CONDUCTIONERRORNORMS_IMPL_HPP
PHX::MDField< scalar_type, panzer::Cell, panzer::Point > _L1_error_continuity
L1 error of the continuity equation (scalar field).
Definition: VertexCFD_Closure_ConductionErrorNorms.hpp:73
Definition: tstMethodManufacturedSolutionBC.cpp:23
Kokkos::Array< PHX::MDField< scalar_type, panzer::Cell, panzer::Point >, num_space_dim > _L1_error_momentum
L1 error of the momentum equations (vector field).
Definition: VertexCFD_Closure_ConductionErrorNorms.hpp:82
PHX::MDField< scalar_type, panzer::Cell, panzer::Point > _L2_error_continuity
L2 error of the continuity equation (scalar field).
Definition: VertexCFD_Closure_ConductionErrorNorms.hpp:88
ConductionErrorNorms(const panzer::IntegrationRule &ir)
Constructor.
Definition: VertexCFD_Closure_ConductionErrorNorms_impl.hpp:22
PHX::MDField< scalar_type, panzer::Cell, panzer::Point > _L1_error_energy
L1 error of the energy equation (scalar field).
Definition: VertexCFD_Closure_ConductionErrorNorms.hpp:85
typename EvalType::ScalarT scalar_type
Alias for the scalar type used by the evaluation type.
Definition: VertexCFD_Closure_ConductionErrorNorms.hpp:37
PHX::MDField< scalar_type, panzer::Cell, panzer::Point > _L2_error_energy
L2 error of the energy equation (scalar field).
Definition: VertexCFD_Closure_ConductionErrorNorms.hpp:96
static constexpr int num_space_dim
Number of spatial dimensions (compile‑time constant).
Definition: VertexCFD_Closure_ConductionErrorNorms.hpp:40
KOKKOS_INLINE_FUNCTION void operator()(const Kokkos::TeamPolicy< PHX::exec_space >::member_type &team) const
Kokkos functor invoked for each team of threads.
Definition: VertexCFD_Closure_ConductionErrorNorms_impl.hpp:67
Kokkos::Array< PHX::MDField< scalar_type, panzer::Cell, panzer::Point >, num_space_dim > _L2_error_momentum
L2 error of the momentum equations (vector field).
Definition: VertexCFD_Closure_ConductionErrorNorms.hpp:93
PHX::MDField< scalar_type, panzer::Cell, panzer::Point > _volume
Cell volume at each integration point (used for weighting).
Definition: VertexCFD_Closure_ConductionErrorNorms.hpp:99
void evaluateFields(typename Traits::EvalData workset) override
Evaluate the error norm fields over the workset.
Definition: VertexCFD_Closure_ConductionErrorNorms_impl.hpp:56