LCOV - code coverage report
Current view: top level - src/materials - INSADStabilized3Eqn.C (source / functions) Hit Total Coverage
Test: idaholab/moose navier_stokes: 9fc4b0 Lines: 34 36 94.4 %
Date: 2025-08-14 10:14:56 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             : // Navier-Stokes includes
      11             : #include "INSADStabilized3Eqn.h"
      12             : 
      13             : registerMooseObject("NavierStokesApp", INSADStabilized3Eqn);
      14             : 
      15             : InputParameters
      16        1698 : INSADStabilized3Eqn::validParams()
      17             : {
      18        1698 :   InputParameters params = INSADTauMaterialTempl<INSAD3Eqn>::validParams();
      19        1698 :   params.addClassDescription("This is the material class used to compute the stabilization "
      20             :                              "parameter tau for momentum and tau_energy for the energy equation.");
      21        3396 :   params.addParam<MaterialPropertyName>(
      22             :       "k_name", "k", "the name of the thermal conductivity material property");
      23        3396 :   params.addParam<MaterialPropertyName>(
      24             :       "grad_k_name",
      25             :       "grad_k",
      26             :       "the name of the gradient of the thermal conductivity material property");
      27        1698 :   return params;
      28           0 : }
      29             : 
      30        1332 : INSADStabilized3Eqn::INSADStabilized3Eqn(const InputParameters & parameters)
      31             :   : INSADTauMaterialTempl<INSAD3Eqn>(parameters),
      32        1332 :     _second_temperature(adCoupledSecond("temperature")),
      33        2664 :     _k(getADMaterialProperty<Real>("k_name")),
      34        1332 :     _grad_k(hasADMaterialProperty<RealVectorValue>("grad_k_name")
      35        1332 :                 ? &getADMaterialProperty<RealVectorValue>("grad_k_name")
      36             :                 : nullptr),
      37        1332 :     _tau_energy(declareADProperty<Real>("tau_energy")),
      38        2664 :     _temperature_strong_residual(declareADProperty<Real>("temperature_strong_residual"))
      39             : {
      40        1332 : }
      41             : 
      42             : void
      43    14142520 : INSADStabilized3Eqn::computeQpProperties()
      44             : {
      45    14142520 :   INSADTauMaterialTempl<INSAD3Eqn>::computeQpProperties();
      46             : 
      47    28285040 :   const auto dissipation_coefficient = _k[_qp] / (_rho[_qp] * _cp[_qp]);
      48    14142520 :   const auto transient_part = _has_energy_transient ? 4. / (_dt * _dt) : 0.;
      49    14142520 :   _tau_energy[_qp] =
      50    42427560 :       _alpha / std::sqrt(transient_part + (2. * _speed / _hmax) * (2. * _speed / _hmax) +
      51    28285040 :                          9. * (4. * dissipation_coefficient / (_hmax * _hmax)) *
      52    42427560 :                              (4. * dissipation_coefficient / (_hmax * _hmax)));
      53             : 
      54             :   // Start with the conductive term
      55    28285040 :   _temperature_strong_residual[_qp] = -_k[_qp] * _second_temperature[_qp].tr();
      56    14142520 :   if (_grad_k)
      57           0 :     _temperature_strong_residual[_qp] -= (*_grad_k)[_qp] * _grad_temperature[_qp];
      58             : 
      59             :   // advective
      60    14142520 :   _temperature_strong_residual[_qp] += _temperature_advective_strong_residual[_qp];
      61             : 
      62    14142520 :   if (_has_energy_transient)
      63     1341448 :     _temperature_strong_residual[_qp] += _temperature_td_strong_residual[_qp];
      64             : 
      65    14142520 :   if (_has_ambient_convection)
      66      248832 :     _temperature_strong_residual[_qp] += _temperature_ambient_convection_strong_residual[_qp];
      67             : 
      68    14142520 :   if (_has_heat_source)
      69      331776 :     _temperature_strong_residual[_qp] += _temperature_source_strong_residual[_qp];
      70             : 
      71    14142520 :   if (_has_advected_mesh)
      72      690184 :     _temperature_strong_residual[_qp] += _temperature_advected_mesh_strong_residual[_qp];
      73    14142520 : }

Generated by: LCOV version 1.14