LCOV - code coverage report
Current view: top level - src/auxkernels - JouleHeatingHeatGeneratedAux.C (source / functions) Hit Total Coverage
Test: idaholab/moose heat_transfer: #31405 (292dce) with base fef103 Lines: 25 26 96.2 %
Date: 2025-09-04 07:53:51 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 "JouleHeatingHeatGeneratedAux.h"
      11             : 
      12             : registerMooseObject("HeatTransferApp", JouleHeatingHeatGeneratedAux);
      13             : 
      14             : InputParameters
      15          82 : JouleHeatingHeatGeneratedAux::validParams()
      16             : {
      17          82 :   InputParameters params = AuxKernel::validParams();
      18          82 :   params.addClassDescription("Compute heat generated from Joule heating.");
      19         164 :   params.addParam<MaterialPropertyName>(
      20             :       "heating_term", "electric_field_heating", "Material property providing the Joule heating.");
      21         164 :   params.addCoupledVar("elec", "Electric potential for Joule heating.");
      22         164 :   params.addParam<MaterialPropertyName>(
      23             :       "electrical_conductivity",
      24             :       "electrical_conductivity",
      25             :       "Material property providing electrical conductivity of the material.");
      26          82 :   return params;
      27           0 : }
      28             : 
      29          44 : JouleHeatingHeatGeneratedAux::JouleHeatingHeatGeneratedAux(const InputParameters & parameters)
      30             :   : AuxKernel(parameters),
      31          44 :     _supplied_potential(isParamValid("elec")),
      32             : 
      33          44 :     _grad_elec(coupledGradient("elec")),
      34          44 :     _elec_cond(_supplied_potential ? (hasMaterialProperty<Real>("electrical_conductivity")
      35          44 :                                           ? &getMaterialProperty<Real>("electrical_conductivity")
      36             :                                           : nullptr)
      37             :                                    : nullptr),
      38          44 :     _ad_elec_cond(
      39          44 :         _supplied_potential
      40          66 :             ? (!_elec_cond ? &getADMaterialProperty<Real>("electrical_conductivity") : nullptr)
      41             :             : nullptr),
      42             : 
      43          44 :     _heating_residual(_supplied_potential ? getGenericZeroMaterialProperty<Real, true>()
      44         110 :                                           : getADMaterialProperty<Real>("heating_term"))
      45             : {
      46          44 :   if (_supplied_potential)
      47          22 :     mooseDeprecated(
      48             :         "Directly coupling an electrostatic potential will be deprecated in the near future "
      49             :         "(10/01/2025). Please use the material object 'ElectromagneticHeatingMaterial' to coupled "
      50             :         "either the electrostatic or electromagnetic field for Joule heating.");
      51          44 : }
      52             : 
      53             : Real
      54      484800 : JouleHeatingHeatGeneratedAux::computeValue()
      55             : {
      56             :   /*
      57             :    * NOTE: Coupling in the gradient of the potential will be deprecated in the
      58             :    *       near future (10/01/2025). After the deprecation, the residual contribution of this kernel
      59             :    * will be solely provided by the 'ElectromagneticHeatingMaterial' material object.
      60             :    */
      61      484800 :   if (_supplied_potential)
      62             :   {
      63             :     const Real elec_coef =
      64      242400 :         _elec_cond ? (*_elec_cond)[_qp] : MetaPhysicL::raw_value((*_ad_elec_cond)[_qp]);
      65      242400 :     return elec_coef * _grad_elec[_qp] * _grad_elec[_qp];
      66             :   }
      67             :   else
      68      242400 :     return MetaPhysicL::raw_value(_heating_residual[_qp]);
      69             : }

Generated by: LCOV version 1.14