www.mooseframework.org
StressBasedChemicalPotential.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
3 /* */
4 /* All contents are licensed under LGPL V2.1 */
5 /* See LICENSE for full restrictions */
6 /****************************************************************/
8 
9 template <>
10 InputParameters
12 {
13  InputParameters params = validParams<Material>();
14  params.addClassDescription("Chemical potential from stress");
15  params.addRequiredParam<MaterialPropertyName>("property_name",
16  "Name of stress based chemical potential");
17  params.addRequiredParam<MaterialPropertyName>("stress_name", "Name of stress property variable");
18  params.addRequiredParam<MaterialPropertyName>("direction_tensor_name",
19  "Name of direction tensor variable");
20  params.addRequiredParam<MaterialPropertyName>("prefactor_name", "Name of prefactor variable");
21  params.addCoupledVar("c", "Concentration variable");
22  return params;
23 }
24 
26  : DerivativeMaterialInterface<Material>(parameters),
27  _chemical_potential(declareProperty<Real>(getParam<MaterialPropertyName>("property_name"))),
28  _stress_old(getMaterialPropertyOld<RankTwoTensor>("stress_name")),
29  _direction_tensor(getMaterialProperty<RealTensorValue>("direction_tensor_name")),
30  _prefactor(getMaterialProperty<Real>("prefactor_name")),
31  _has_coupled_c(isCoupled("c"))
32 {
33  if (_has_coupled_c)
34  {
35  _dchemical_potential = &declarePropertyDerivative<Real>(
36  getParam<MaterialPropertyName>("property_name"), getVar("c", 0)->name());
37  _dprefactor_dc = &getMaterialPropertyDerivative<Real>("prefactor_name", getVar("c", 0)->name());
38  }
39 }
40 
41 void
43 {
44  _chemical_potential[_qp] = 0.0;
45 
46  if (_has_coupled_c)
47  (*_dchemical_potential)[_qp] = 0.0;
48 }
49 
50 void
52 {
53  RankTwoTensor direction_tensor_rank_two = _direction_tensor[_qp];
54  _chemical_potential[_qp] =
55  -_stress_old[_qp].doubleContraction(direction_tensor_rank_two) * _prefactor[_qp];
56 
57  if (_has_coupled_c)
58  (*_dchemical_potential)[_qp] =
59  -_stress_old[_qp].doubleContraction(direction_tensor_rank_two) * (*_dprefactor_dc)[_qp];
60 }
const MaterialProperty< Real > * _dprefactor_dc
MaterialProperty< Real > * _dchemical_potential
InputParameters validParams< StressBasedChemicalPotential >()
StressBasedChemicalPotential(const InputParameters &parameters)
const MaterialProperty< RealTensorValue > & _direction_tensor
const MaterialProperty< RankTwoTensor > & _stress_old
MaterialProperty< Real > & _chemical_potential
const MaterialProperty< Real > & _prefactor