LCOV - code coverage report
Current view: top level - src/kernels - OneDHeatFluxBase.C (source / functions) Hit Total Coverage
Test: idaholab/moose thermal_hydraulics: #30301 (3b550b) with base 2ad78d Lines: 0 36 0.0 %
Date: 2025-07-30 13:02:48 Functions: 0 4 0.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 "OneDHeatFluxBase.h"
      11             : #include "HeatFluxFromHeatStructureBaseUserObject.h"
      12             : #include "HeatConductionModel.h"
      13             : #include "Assembly.h"
      14             : 
      15             : InputParameters
      16           0 : OneDHeatFluxBase::validParams()
      17             : {
      18           0 :   InputParameters params = Kernel::validParams();
      19           0 :   params.addClassDescription(
      20             :       "Base class for a one-dimensional heat flux term in an energy equation");
      21           0 :   params.addRequiredParam<UserObjectName>(
      22             :       "q_uo", "The name of the user object that computed the heat flux");
      23           0 :   return params;
      24           0 : }
      25             : 
      26           0 : OneDHeatFluxBase::OneDHeatFluxBase(const InputParameters & parameters)
      27             :   : Kernel(parameters),
      28           0 :     _phi_neighbor(_assembly.phiNeighbor(_var)),
      29           0 :     _q_uo(getUserObject<HeatFluxFromHeatStructureBaseUserObject>("q_uo"))
      30             : {
      31           0 : }
      32             : 
      33             : void
      34           0 : OneDHeatFluxBase::computeJacobian()
      35             : {
      36           0 :   Kernel::computeJacobian();
      37           0 : }
      38             : 
      39             : void
      40           0 : OneDHeatFluxBase::computeOffDiagJacobian(const unsigned int jvar_num)
      41             : {
      42           0 :   Kernel::computeOffDiagJacobian(jvar_num);
      43             : 
      44           0 :   if (jvar_num == _var.number())
      45             :   {
      46             :     // when doing the diagonal part, also take care of the off-diag jacobian
      47             :     // wrt the heat structure side
      48           0 :     std::vector<dof_id_type> idofs = _var.dofIndices();
      49             : 
      50           0 :     const dof_id_type & hs_elem_id = _q_uo.getNearestElem(_current_elem->id());
      51           0 :     const Elem * neighbor = _mesh.elemPtr(hs_elem_id);
      52             : 
      53           0 :     _assembly.setCurrentNeighborSubdomainID(neighbor->subdomain_id());
      54           0 :     _assembly.reinitNeighborAtPhysical(neighbor, _q_point.stdVector());
      55             : 
      56           0 :     std::vector<std::string> var_names = {HeatConductionModel::TEMPERATURE};
      57           0 :     for (std::size_t i = 0; i < var_names.size(); i++)
      58             :     {
      59           0 :       MooseVariableFEBase & jvar = _fe_problem.getVariable(_tid, var_names[i]);
      60             :       unsigned int jvar_num = jvar.number();
      61           0 :       jvar.prepareNeighbor();
      62           0 :       _assembly.copyNeighborShapes(jvar_num);
      63             : 
      64           0 :       auto & jdofs = jvar.dofIndicesNeighbor();
      65           0 :       DenseMatrix<Number> Ke(_test.size(), jvar.phiNeighborSize());
      66           0 :       for (_qp = 0; _qp < _qrule->n_points(); _qp++)
      67           0 :         for (_i = 0; _i < _test.size(); _i++)
      68           0 :           for (_j = 0; _j < jvar.phiNeighborSize(); _j++)
      69           0 :             Ke(_i, _j) += _JxW[_qp] * _coord[_qp] * computeQpOffDiagJacobianNeighbor(jvar_num);
      70             : 
      71           0 :       addJacobian(_assembly, Ke, idofs, jdofs, _var.scalingFactor());
      72           0 :     }
      73           0 :   }
      74           0 : }

Generated by: LCOV version 1.14