LCOV - code coverage report
Current view: top level - src/kernels - KernelBase.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 419b9d Lines: 30 32 93.8 %
Date: 2025-08-08 20:01:16 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 "KernelBase.h"
      11             : #include "Assembly.h"
      12             : #include "MooseVariableFE.h"
      13             : #include "Problem.h"
      14             : #include "SubProblem.h"
      15             : #include "SystemBase.h"
      16             : #include "NonlinearSystem.h"
      17             : 
      18             : #include "libmesh/threads.h"
      19             : 
      20             : InputParameters
      21     2457848 : KernelBase::validParams()
      22             : {
      23     2457848 :   auto params = ResidualObject::validParams();
      24     2457848 :   params += BlockRestrictable::validParams();
      25     2457848 :   params += MaterialPropertyInterface::validParams();
      26     2457848 :   params.registerSystemAttributeName("Kernel");
      27             : 
      28     2457848 :   params.addParam<std::vector<AuxVariableName>>(
      29             :       "save_in",
      30             :       {},
      31             :       "The name of auxiliary variables to save this Kernel's residual contributions to. "
      32             :       " Everything about that variable must match everything about this variable (the "
      33             :       "type, what blocks it's on, etc.)");
      34     2457848 :   params.addParam<std::vector<AuxVariableName>>(
      35             :       "diag_save_in",
      36             :       {},
      37             :       "The name of auxiliary variables to save this Kernel's diagonal Jacobian "
      38             :       "contributions to. Everything about that variable must match everything "
      39             :       "about this variable (the type, what blocks it's on, etc.)");
      40             : 
      41     7373544 :   params.addParam<bool>("use_displaced_mesh",
      42     4915696 :                         false,
      43             :                         "Whether or not this object should use the "
      44             :                         "displaced mesh for computation. Note that in "
      45             :                         "the case this is true but no displacements "
      46             :                         "are provided in the Mesh block the "
      47             :                         "undisplaced mesh will still be used.");
      48             : 
      49     2457848 :   params.addParamNamesToGroup("diag_save_in save_in use_displaced_mesh", "Advanced");
      50     2457848 :   params.addCoupledVar("displacements", "The displacements");
      51             : 
      52             :   // Kernels always couple within their element
      53     2457848 :   params.addRelationshipManager("ElementSideNeighborLayers",
      54             :                                 Moose::RelationshipManagerType::COUPLING,
      55           0 :                                 [](const InputParameters &, InputParameters & rm_params)
      56      247455 :                                 { rm_params.set<unsigned short>("layers") = 0; });
      57     2457848 :   return params;
      58           0 : }
      59             : 
      60       90732 : KernelBase::KernelBase(const InputParameters & parameters)
      61             :   : ResidualObject(parameters),
      62             :     BlockRestrictable(this),
      63             :     CoupleableMooseVariableDependencyIntermediateInterface(this, false),
      64             :     MaterialPropertyInterface(this, blockIDs(), Moose::EMPTY_BOUNDARY_IDS),
      65             :     GeometricSearchInterface(this),
      66             :     ElementIDInterface(this),
      67      181360 :     _current_elem(_assembly.elem()),
      68       90680 :     _current_elem_volume(_assembly.elemVolume()),
      69       90680 :     _q_point(_assembly.qPoints()),
      70       90680 :     _qrule(_assembly.qRule()),
      71       90680 :     _JxW(_assembly.JxW()),
      72       90680 :     _coord(_assembly.coordTransformation()),
      73       90680 :     _has_save_in(false),
      74       90680 :     _save_in_strings(parameters.get<std::vector<AuxVariableName>>("save_in")),
      75       90680 :     _has_diag_save_in(false),
      76       90680 :     _diag_save_in_strings(parameters.get<std::vector<AuxVariableName>>("diag_save_in")),
      77      362772 :     _use_displaced_mesh(getParam<bool>("use_displaced_mesh"))
      78             : {
      79       90680 :   auto num_disp = coupledComponents("displacements");
      80       92826 :   for (decltype(num_disp) i = 0; i < num_disp; ++i)
      81        2146 :     _displacements.push_back(coupled("displacements", i));
      82       90680 : }

Generated by: LCOV version 1.14