LCOV - code coverage report
Current view: top level - src/kernels - ADJouleHeatingSource.C (source / functions) Hit Total Coverage
Test: idaholab/moose heat_transfer: #32971 (54bef8) with base c6cf66 Lines: 21 22 95.5 %
Date: 2026-05-29 20:37:03 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 "ADJouleHeatingSource.h"
      11             : 
      12             : registerMooseObject("HeatTransferApp", ADJouleHeatingSource);
      13             : 
      14             : InputParameters
      15          89 : ADJouleHeatingSource::validParams()
      16             : {
      17          89 :   InputParameters params = ADKernelValue::validParams();
      18         178 :   params.addCoupledVar("elec", "Electrostatic potential for joule heating.");
      19         178 :   params.addParam<MaterialPropertyName>(
      20             :       "heating_term", "electric_field_heating", "Material property providing the Joule heating.");
      21         178 :   params.addParam<MaterialPropertyName>(
      22             :       "electrical_conductivity",
      23             :       "electrical_conductivity",
      24             :       "Material property providing electrical conductivity of the material.");
      25          89 :   params.addClassDescription(
      26             :       "Calculates the heat source term corresponding to electrostatic or electromagnetic Joule "
      27             :       "heating, with Jacobian contributions calculated using the automatic "
      28             :       "differentiation system.");
      29          89 :   return params;
      30           0 : }
      31             : 
      32          47 : ADJouleHeatingSource::ADJouleHeatingSource(const InputParameters & parameters)
      33             :   : ADKernelValue(parameters),
      34          47 :     _supplied_potential(isParamValid("elec")),
      35             : 
      36          47 :     _grad_potential(_supplied_potential ? adCoupledGradient("elec") : _ad_grad_zero),
      37          94 :     _elec_cond(_supplied_potential ? getADMaterialProperty<Real>("electrical_conductivity")
      38          27 :                                    : getGenericZeroMaterialProperty<Real, true>()),
      39             : 
      40          47 :     _heating_residual(_supplied_potential ? getGenericZeroMaterialProperty<Real, true>()
      41         121 :                                           : getADMaterialProperty<Real>("heating_term"))
      42             : {
      43          47 :   if (_supplied_potential)
      44          20 :     mooseDeprecated(
      45             :         "Directly coupling an electrostatic potential will be deprecated in the near future "
      46             :         "(10/01/2025). Please use the material object 'ElectromagneticHeatingMaterial' to couple "
      47             :         "either the electrostatic or electromagnetic field for Joule heating.");
      48          47 : }
      49             : 
      50             : ADReal
      51      694400 : ADJouleHeatingSource::precomputeQpResidual()
      52             : {
      53             :   /*
      54             :    * NOTE: Coupling in the gradient of the potential will be deprecated in the
      55             :    *       near future (10/01/2025). After the deprecation, the residual contribution of this kernel
      56             :    * will be solely provided by the 'ElectromagneticHeatingMaterial' material object.
      57             :    */
      58      694400 :   if (_supplied_potential)
      59      297600 :     return -_elec_cond[_qp] * _grad_potential[_qp] * _grad_potential[_qp];
      60             :   else
      61      545600 :     return -_heating_residual[_qp];
      62             : }

Generated by: LCOV version 1.14