https://mooseframework.inl.gov
Loading...
Searching...
No Matches
GradientComponent.C
Go to the documentation of this file.
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
13
16{
19 "Set the kernel variable to a specified component of the gradient of a coupled variable.");
20 params.addRequiredCoupledVar("v", "Coupled variable to match gradient component of");
21 params.addRequiredParam<unsigned int>("component",
22 "Component of the gradient of the coupled variable v");
23 return params;
24}
25
27 : Kernel(parameters),
28 _v_var(coupled("v")),
29 _grad_v(coupledGradient("v")),
30 _component(getParam<unsigned int>("component"))
31{
32 if (_component >= LIBMESH_DIM)
33 paramError("component", "Component too large for LIBMESH_DIM");
34}
35
36Real
41
42Real
47
48Real
50{
51 if (jvar == _v_var)
52 return -_grad_phi[_j][_qp](_component) * _test[_i][_qp];
53 return 0.0;
54}
registerMooseObject("PhaseFieldApp", GradientComponent)
void ErrorVector unsigned int
virtual Real computeQpResidual()
static InputParameters validParams()
const unsigned int _v_var
Identity of the coupled variable.
const unsigned int _component
Component of the gradient vector to match.
virtual Real computeQpJacobian()
const VariableGradient & _grad_v
Gradient of the coupled variable.
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
GradientComponent(const InputParameters &parameters)
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
unsigned int _qp
unsigned int _j
unsigned int _i
const VariablePhiValue & _phi
const VariableTestValue & _test
static InputParameters validParams()
const VariablePhiGradient & _grad_phi
const VariableValue & _u
void paramError(const std::string &param, Args... args) const