LCOV - code coverage report
Current view: top level - src/materials - ThermalSolidPropertiesMaterial.C (source / functions) Hit Total Coverage
Test: idaholab/moose solid_properties: #31405 (292dce) with base fef103 Lines: 21 22 95.5 %
Date: 2025-09-04 07:57:33 Functions: 6 6 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 "ThermalSolidPropertiesMaterial.h"
      11             : #include "ThermalSolidProperties.h"
      12             : #include "SolidPropertiesNames.h"
      13             : 
      14             : registerMooseObject("SolidPropertiesApp", ThermalSolidPropertiesMaterial);
      15             : registerMooseObject("SolidPropertiesApp", ADThermalSolidPropertiesMaterial);
      16             : 
      17             : template <bool is_ad>
      18             : InputParameters
      19         401 : ThermalSolidPropertiesMaterialTempl<is_ad>::validParams()
      20             : {
      21         401 :   InputParameters params = Material::validParams();
      22         802 :   params.addRequiredCoupledVar("temperature", "Temperature");
      23         802 :   params.addRequiredParam<UserObjectName>("sp", "The name of the user object for solid properties");
      24         401 :   params.addParam<std::string>(SolidPropertiesNames::specific_heat,
      25             :                                SolidPropertiesNames::specific_heat,
      26             :                                "Name to be used for the isobaric specific heat");
      27         401 :   params.addParam<std::string>(SolidPropertiesNames::thermal_conductivity,
      28             :                                SolidPropertiesNames::thermal_conductivity,
      29             :                                "Name to be used for the thermal conductivity");
      30         401 :   params.addParam<std::string>(SolidPropertiesNames::density,
      31             :                                SolidPropertiesNames::density,
      32             :                                "Name to be used for the density");
      33         401 :   params.addClassDescription("Computes solid thermal properties as a function of temperature");
      34         401 :   return params;
      35           0 : }
      36             : 
      37             : template <bool is_ad>
      38         309 : ThermalSolidPropertiesMaterialTempl<is_ad>::ThermalSolidPropertiesMaterialTempl(
      39             :     const InputParameters & parameters)
      40             :   : Material(parameters),
      41         309 :     _temperature(coupledGenericValue<is_ad>("temperature")),
      42             : 
      43         618 :     _cp(declareGenericProperty<Real, is_ad>(
      44             :         getParam<std::string>(SolidPropertiesNames::specific_heat))),
      45         309 :     _k(declareGenericProperty<Real, is_ad>(
      46             :         getParam<std::string>(SolidPropertiesNames::thermal_conductivity))),
      47         309 :     _rho(declareGenericProperty<Real, is_ad>(getParam<std::string>(SolidPropertiesNames::density))),
      48             : 
      49         618 :     _sp(getUserObject<ThermalSolidProperties>("sp"))
      50             : {
      51         309 : }
      52             : 
      53             : template <bool is_ad>
      54             : void
      55      115000 : ThermalSolidPropertiesMaterialTempl<is_ad>::computeQpProperties()
      56             : {
      57      115000 :   _cp[_qp] = _sp.cp_from_T(_temperature[_qp]);
      58      115000 :   _k[_qp] = _sp.k_from_T(_temperature[_qp]);
      59      115000 :   _rho[_qp] = _sp.rho_from_T(_temperature[_qp]);
      60      115000 : }
      61             : 
      62             : template class ThermalSolidPropertiesMaterialTempl<false>;
      63             : template class ThermalSolidPropertiesMaterialTempl<true>;

Generated by: LCOV version 1.14