LCOV - code coverage report
Current view: top level - src/materials - ThermalMaterialBaseBPD.C (source / functions) Hit Total Coverage
Test: idaholab/moose peridynamics: #31405 (292dce) with base fef103 Lines: 26 27 96.3 %
Date: 2025-09-04 07:55:08 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 "ThermalMaterialBaseBPD.h"
      11             : #include "MooseVariable.h"
      12             : #include "Function.h"
      13             : #include "Assembly.h"
      14             : 
      15             : #include "libmesh/quadrature.h"
      16             : 
      17             : InputParameters
      18         369 : ThermalMaterialBaseBPD::validParams()
      19             : {
      20         369 :   InputParameters params = PeridynamicsMaterialBase::validParams();
      21         369 :   params.addClassDescription("Base class for bond-based peridynamic thermal models");
      22             : 
      23         738 :   params.addRequiredCoupledVar("temperature", "Nonlinear variable name for the temperature");
      24         738 :   params.addRequiredParam<MaterialPropertyName>(
      25             :       "thermal_conductivity", "Name of material property defining thermal conductivity");
      26             : 
      27         369 :   return params;
      28           0 : }
      29             : 
      30         291 : ThermalMaterialBaseBPD::ThermalMaterialBaseBPD(const InputParameters & parameters)
      31             :   : PeridynamicsMaterialBase(parameters),
      32         291 :     _temp_var(getVar("temperature", 0)),
      33         291 :     _temp(2),
      34         291 :     _bond_heat_flow(declareProperty<Real>("bond_heat_flow")),
      35         291 :     _bond_dQdT(declareProperty<Real>("bond_dQdT")),
      36         873 :     _thermal_conductivity(getMaterialProperty<Real>("thermal_conductivity"))
      37             : {
      38         291 : }
      39             : 
      40             : void
      41      581316 : ThermalMaterialBaseBPD::computeProperties()
      42             : {
      43      581316 :   setupMeshRelatedData(); // function from base class
      44             : 
      45             :   Real ave_thermal_conductivity = 0.0;
      46     1743948 :   for (unsigned int qp = 0; qp < _qrule->n_points(); ++qp)
      47     1162632 :     ave_thermal_conductivity += _thermal_conductivity[qp] * _JxW[qp] * _coord[qp];
      48             : 
      49      581316 :   ave_thermal_conductivity /= _assembly.elemVolume();
      50             : 
      51             :   // nodal temperature
      52      581316 :   _temp[0] = _temp_var->getNodalValue(*_current_elem->node_ptr(0));
      53      581316 :   _temp[1] = _temp_var->getNodalValue(*_current_elem->node_ptr(1));
      54             : 
      55             :   // compute peridynamic micro-conductivity: _Kij
      56      581316 :   computePeridynamicsParams(ave_thermal_conductivity);
      57             : 
      58     1743948 :   for (unsigned int nd = 0; nd < _nnodes; ++nd)
      59             :   {
      60             :     // residual term
      61     1162632 :     _bond_heat_flow[nd] =
      62     1162632 :         _Kij * (_temp[1] - _temp[0]) / _origin_vec.norm() * _node_vol[0] * _node_vol[1];
      63             : 
      64             :     // derivative of the residual term
      65     1162632 :     _bond_dQdT[nd] = -_Kij / _origin_vec.norm() * _node_vol[0] * _node_vol[1];
      66             :   }
      67      581316 : }

Generated by: LCOV version 1.14