LCOV - code coverage report
Current view: top level - src/dgkernels - HeatConduction3EqnDGKernel.C (source / functions) Hit Total Coverage
Test: idaholab/moose thermal_hydraulics: #32971 (54bef8) with base c6cf66 Lines: 24 25 96.0 %
Date: 2026-05-29 20:41:18 Functions: 3 3 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //* This file is part of the MOOSE framework
       2             : //* https://mooseframework.inl.gov
       3             : //*
       4             : //* All rights reserved, see COPYRIGHT for full restrictions
       5             : //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
       6             : //*
       7             : //* Licensed under LGPL 2.1, please see LICENSE for details
       8             : //* https://www.gnu.org/licenses/lgpl-2.1.html
       9             : 
      10             : #include "HeatConduction3EqnDGKernel.h"
      11             : 
      12             : registerMooseObject("ThermalHydraulicsApp", HeatConduction3EqnDGKernel);
      13             : 
      14             : InputParameters
      15          39 : HeatConduction3EqnDGKernel::validParams()
      16             : {
      17          39 :   InputParameters params = ADDGKernel::validParams();
      18             : 
      19          78 :   params.addRequiredParam<MaterialPropertyName>("k", "Thermal conductivity");
      20          78 :   params.addRequiredParam<MaterialPropertyName>("T", "Temperature");
      21          78 :   params.addRequiredCoupledVar("A", "Cross-sectional area");
      22          78 :   params.addRequiredParam<MaterialPropertyName>("direction", "Direction of the flow channel");
      23             : 
      24          39 :   params.addClassDescription("Adds heat conduction for the single-phase flow model.");
      25             : 
      26          39 :   return params;
      27           0 : }
      28             : 
      29          20 : HeatConduction3EqnDGKernel::HeatConduction3EqnDGKernel(const InputParameters & parameters)
      30             :   : ADDGKernel(parameters),
      31          20 :     _k_elem(getADMaterialProperty<Real>("k")),
      32          40 :     _k_neig(getNeighborADMaterialProperty<Real>("k")),
      33          40 :     _T_elem(getADMaterialProperty<Real>("T")),
      34          40 :     _T_neig(getNeighborADMaterialProperty<Real>("T")),
      35          20 :     _A(adCoupledValue("A")),
      36          60 :     _dir(getMaterialProperty<RealVectorValue>("direction"))
      37             : {
      38          20 : }
      39             : 
      40             : ADReal
      41       15042 : HeatConduction3EqnDGKernel::computeQpResidual(Moose::DGResidualType type)
      42             : {
      43       45126 :   const ADReal k_avg = 0.5 * (_k_elem[_qp] + _k_neig[_qp]);
      44             : 
      45       15042 :   const Point x_elem = _current_elem->vertex_average();
      46       15042 :   const Point x_neig = _neighbor_elem->vertex_average();
      47       15042 :   const Real dx = (x_neig - x_elem) * _dir[_qp];
      48       15042 :   const ADReal dTdx = (_T_neig[_qp] - _T_elem[_qp]) / dx;
      49             : 
      50       15042 :   const ADReal flux = k_avg * dTdx * _A[_qp];
      51             : 
      52       15042 :   return type == Moose::Element ? -flux * _test[_i][_qp] : flux * _test_neighbor[_i][_qp];
      53             : }

Generated by: LCOV version 1.14