https://mooseframework.inl.gov
CoupledMaterialDerivative.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 
11 
13 
16 {
18  params.addClassDescription("Kernel that implements the first derivative of a function material "
19  "property with respect to a coupled variable.");
20  params.addRequiredCoupledVar("v", "Variable to take the derivative with respect to");
21  params.addParam<MaterialPropertyName>("f_name",
22  "F",
23  "Function material to take the derivative of (should "
24  "provide derivative properties - such as a "
25  "DerivativeParsedMaterial)");
26  return params;
27 }
28 
31  _v_name(coupledName("v", 0)),
32  _v_var(coupled("v")),
33  _dFdv(getMaterialPropertyDerivative<Real>("f_name", _v_name)),
34  _d2Fdvdu(getMaterialPropertyDerivative<Real>("f_name", _v_name, _var.name())),
35  _d2Fdvdarg(_n_args)
36 {
37  // Get material property derivatives for all coupled variables
38  for (unsigned int i = 0; i < _n_args; ++i)
39  _d2Fdvdarg[i] = &getMaterialPropertyDerivative<Real>("f_name", _v_name, i);
40 }
41 
42 void
44 {
45  validateNonlinearCoupling<Real>("f_name");
46 }
47 
48 Real
50 {
51  return _dFdv[_qp] * _test[_i][_qp];
52 }
53 
54 Real
56 {
57  return _d2Fdvdu[_qp] * _test[_i][_qp] * _phi[_j][_qp];
58 }
59 
60 Real
62 {
63  const unsigned int cvar = mapJvarToCvar(jvar);
64  return (*_d2Fdvdarg[cvar])[_qp] * _test[_i][_qp] * _phi[_j][_qp];
65 }
virtual Real computeQpOffDiagJacobian(unsigned int jvar) override
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
const MaterialProperty< Real > & _d2Fdvdu
2nd order material property derivative w.r.t. v then u
This kernel adds the term (dFdv, test), where v is a coupled variable.
std::string _v_name
name of the coupled variable the derivative is taken with respect to
static InputParameters validParams()
virtual void initialSetup() override
const std::string name
Definition: Setup.h:20
static InputParameters validParams()
virtual Real computeQpResidual() override
CoupledMaterialDerivative(const InputParameters &parameters)
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual Real computeQpJacobian() override
void addClassDescription(const std::string &doc_string)
registerMooseObject("PhaseFieldApp", CoupledMaterialDerivative)
std::vector< const MaterialProperty< Real > * > _d2Fdvdarg
2nd order material property derivatives w.r.t. v and then all other coupled variables ...
const MaterialProperty< Real > & _dFdv
Material property derivative w.r.t. v.