<commit_before>/****************************************************************/
/* MOOSE - Multiphysics Object Oriented Simulation Environment  */
/*                                                              */
/*          All contents are licensed under LGPL V2.1           */
/*             See LICENSE for full restrictions                */
/****************************************************************/
#include "GradientComponent.h"

template<>
InputParameters validParams<GradientComponent>()
{
  InputParameters params = validParams<Kernel>();
  params.addClassDescription("Set the kernel variable to a specified component of the gradient of a coupled variable.");
  params.addRequiredCoupledVar("v", "Coupled variable to match gradient component of");
  params.addRequiredParam<unsigned int>("component", "Component of the gradient of the coupled variable v");
  return params;
}

GradientComponent::GradientComponent(const InputParameters & parameters) :
    Kernel(parameters),
    _grad_v(coupledGradient("v")),
    _component(getParam<unsigned int>("component"))
{
  if (_component >= LIBMESH_DIM)
    mooseError("Component too large for LIBMESH_DIM");
}

Real
GradientComponent::computeQpResidual()
{
  return (_u[_qp] - _grad_v[_qp](_component)) * _test[_i][_qp];
}

Real
GradientComponent::computeQpJacobian()
{
  return (_phi[_j][_qp] - _grad_v[_qp](_component)) * _test[_i][_qp];
}
<commit_msg>Corrected bug in computeQpJacobian refs #5631<commit_after>/****************************************************************/
/* MOOSE - Multiphysics Object Oriented Simulation Environment  */
/*                                                              */
/*          All contents are licensed under LGPL V2.1           */
/*             See LICENSE for full restrictions                */
/****************************************************************/
#include "GradientComponent.h"

template<>
InputParameters validParams<GradientComponent>()
{
  InputParameters params = validParams<Kernel>();
  params.addClassDescription("Set the kernel variable to a specified component of the gradient of a coupled variable.");
  params.addRequiredCoupledVar("v", "Coupled variable to match gradient component of");
  params.addRequiredParam<unsigned int>("component", "Component of the gradient of the coupled variable v");
  return params;
}

GradientComponent::GradientComponent(const InputParameters & parameters) :
    Kernel(parameters),
    _grad_v(coupledGradient("v")),
    _component(getParam<unsigned int>("component"))
{
  if (_component >= LIBMESH_DIM)
    mooseError("Component too large for LIBMESH_DIM");
}

Real
GradientComponent::computeQpResidual()
{
  return (_u[_qp] - _grad_v[_qp](_component)) * _test[_i][_qp];
}

Real
GradientComponent::computeQpJacobian()
{
  return _phi[_j][_qp] * _test[_i][_qp];
}

{'fraction_non_alphanumeric': 0.19332161687170474, 'fraction_numerical': 0.00281195079086116, 'mean_word_length': 4.03716814159292, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '670891', 'n_tokens_mistral': 748, 'n_tokens_neox': 709, 'n_words': 184}