LCOV - code coverage report
Current view: top level - src/kernels - GradientComponent.C (source / functions) Hit Total Coverage
Test: idaholab/moose phase_field: #31405 (292dce) with base fef103 Lines: 0 21 0.0 %
Date: 2025-09-04 07:55:36 Functions: 0 5 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 "GradientComponent.h"
      11             : 
      12             : registerMooseObject("PhaseFieldApp", GradientComponent);
      13             : 
      14             : InputParameters
      15           0 : GradientComponent::validParams()
      16             : {
      17           0 :   InputParameters params = Kernel::validParams();
      18           0 :   params.addClassDescription(
      19             :       "Set the kernel variable to a specified component of the gradient of a coupled variable.");
      20           0 :   params.addRequiredCoupledVar("v", "Coupled variable to match gradient component of");
      21           0 :   params.addRequiredParam<unsigned int>("component",
      22             :                                         "Component of the gradient of the coupled variable v");
      23           0 :   return params;
      24           0 : }
      25             : 
      26           0 : GradientComponent::GradientComponent(const InputParameters & parameters)
      27             :   : Kernel(parameters),
      28           0 :     _v_var(coupled("v")),
      29           0 :     _grad_v(coupledGradient("v")),
      30           0 :     _component(getParam<unsigned int>("component"))
      31             : {
      32           0 :   if (_component >= LIBMESH_DIM)
      33           0 :     paramError("component", "Component too large for LIBMESH_DIM");
      34           0 : }
      35             : 
      36             : Real
      37           0 : GradientComponent::computeQpResidual()
      38             : {
      39           0 :   return (_u[_qp] - _grad_v[_qp](_component)) * _test[_i][_qp];
      40             : }
      41             : 
      42             : Real
      43           0 : GradientComponent::computeQpJacobian()
      44             : {
      45           0 :   return _phi[_j][_qp] * _test[_i][_qp];
      46             : }
      47             : 
      48             : Real
      49           0 : GradientComponent::computeQpOffDiagJacobian(unsigned int jvar)
      50             : {
      51           0 :   if (jvar == _v_var)
      52           0 :     return -_grad_phi[_j][_qp](_component) * _test[_i][_qp];
      53             :   return 0.0;
      54             : }

Generated by: LCOV version 1.14