https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
42void
44{
45 validateNonlinearCoupling<Real>("f_name");
46}
47
48Real
50{
51 return _dFdv[_qp] * _test[_i][_qp];
52}
53
54Real
56{
57 return _d2Fdvdu[_qp] * _test[_i][_qp] * _phi[_j][_qp];
58}
59
60Real
62{
63 const unsigned int cvar = mapJvarToCvar(jvar);
64 return (*_d2Fdvdarg[cvar])[_qp] * _test[_i][_qp] * _phi[_j][_qp];
65}
registerMooseObject("PhaseFieldApp", CoupledMaterialDerivative)
const std::string name
Definition Setup.h:21
This kernel adds the term (dFdv, test), where v is a coupled variable.
const MaterialProperty< Real > & _dFdv
Material property derivative w.r.t. v.
std::string _v_name
name of the coupled variable the derivative is taken with respect to
const MaterialProperty< Real > & _d2Fdvdu
2nd order material property derivative w.r.t. v then u
static InputParameters validParams()
virtual Real computeQpOffDiagJacobian(unsigned int jvar) override
std::vector< const MaterialProperty< Real > * > _d2Fdvdarg
2nd order material property derivatives w.r.t. v and then all other coupled variables
virtual Real computeQpResidual() override
CoupledMaterialDerivative(const InputParameters &parameters)
virtual Real computeQpJacobian() override
virtual void initialSetup() override
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
static InputParameters validParams()