LCOV - code coverage report
Current view: top level - src/materials - SemiconductorLinearConductivity.C (source / functions) Hit Total Coverage
Test: idaholab/moose heat_transfer: #31405 (292dce) with base fef103 Lines: 26 27 96.3 %
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 "SemiconductorLinearConductivity.h"
      11             : #include "libmesh/quadrature.h"
      12             : 
      13             : registerMooseObject("HeatTransferApp", SemiconductorLinearConductivity);
      14             : 
      15             : InputParameters
      16          85 : SemiconductorLinearConductivity::validParams()
      17             : {
      18          85 :   InputParameters params = Material::validParams();
      19         170 :   params.addRequiredCoupledVar("temp", "Variable for temperature in Kelvin.");
      20         170 :   params.addParam<std::string>("base_name", "Material property base name");
      21         170 :   params.addRequiredParam<Real>("sh_coeff_A", "Steinhart_Hart coefficient A of the material");
      22         170 :   params.addRequiredRangeCheckedParam<Real>(
      23             :       "sh_coeff_B", "sh_coeff_B != 0", "Steinhart_Hart coefficient B of the material.");
      24             : 
      25          85 :   params.addClassDescription(
      26             :       "Calculates electrical conductivity of a semiconductor from temperature");
      27             : 
      28          85 :   return params;
      29           0 : }
      30             : 
      31          66 : SemiconductorLinearConductivity::SemiconductorLinearConductivity(const InputParameters & parameters)
      32             :   : DerivativeMaterialInterface<Material>(parameters),
      33          66 :     _sh_coeff_A(getParam<Real>("sh_coeff_A")),
      34         132 :     _sh_coeff_B(getParam<Real>("sh_coeff_B")),
      35          66 :     _T(coupledValue("temp")),
      36         132 :     _base_name(isParamValid("base_name") ? getParam<std::string>("base_name") + "_" : ""),
      37          66 :     _electric_conductivity(declareProperty<Real>(_base_name + "electrical_conductivity")),
      38          66 :     _delectric_conductivity_dT(
      39          66 :         isCoupledConstant("temp")
      40          66 :             ? nullptr
      41         264 :             : &declarePropertyDerivative<Real>(_base_name + "electrical_conductivity",
      42         330 :                                                coupledName("temp", 0)))
      43             : {
      44          66 : }
      45             : 
      46             : void
      47       74400 : SemiconductorLinearConductivity::computeQpProperties()
      48             : {
      49             :   mooseAssert(MooseUtils::absoluteFuzzyGreaterThan(_T[_qp], 0.0),
      50             :               "Encountered zero or negative temperature in SemiconductorLinearConductivity");
      51             : 
      52             :   mooseAssert(_sh_coeff_B != 0, "Divided by zero as _sh_coeff_B = 0");
      53             : 
      54       74400 :   _electric_conductivity[_qp] = exp((_sh_coeff_A - 1 / _T[_qp]) / _sh_coeff_B);
      55       74400 :   if (_delectric_conductivity_dT)
      56       74400 :     (*_delectric_conductivity_dT)[_qp] =
      57       74400 :         _electric_conductivity[_qp] / (_sh_coeff_B * _T[_qp] * _T[_qp]);
      58       74400 : }

Generated by: LCOV version 1.14