https://mooseframework.inl.gov
StressBasedChemicalPotential.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("Chemical potential from stress");
19  params.addRequiredParam<MaterialPropertyName>("property_name",
20  "Name of stress based chemical potential");
21  params.addRequiredParam<MaterialPropertyName>("stress_name", "Name of stress property variable");
22  params.addRequiredParam<MaterialPropertyName>("direction_tensor_name",
23  "Name of direction tensor variable");
24  params.addRequiredParam<MaterialPropertyName>("prefactor_name", "Name of prefactor variable");
25  params.addCoupledVar("c", "Concentration variable");
26  return params;
27 }
28 
31  _chemical_potential(declareProperty<Real>(getParam<MaterialPropertyName>("property_name"))),
32  _stress_old(getMaterialPropertyOld<RankTwoTensor>("stress_name")),
33  _direction_tensor(getMaterialProperty<RealTensorValue>("direction_tensor_name")),
34  _prefactor(getMaterialProperty<Real>("prefactor_name")),
35  _has_coupled_c(isCoupled("c") && !isCoupledConstant("c"))
36 {
37  if (_has_coupled_c)
38  {
39  _dchemical_potential = &declarePropertyDerivative<Real>(
40  getParam<MaterialPropertyName>("property_name"), coupledName("c", 0));
41  _dprefactor_dc = &getMaterialPropertyDerivative<Real>("prefactor_name", coupledName("c", 0));
42  }
43 }
44 
45 void
47 {
48  _chemical_potential[_qp] = 0.0;
49 
50  if (_has_coupled_c)
51  (*_dchemical_potential)[_qp] = 0.0;
52 }
53 
54 void
56 {
57  RankTwoTensor direction_tensor_rank_two = _direction_tensor[_qp];
59  -_stress_old[_qp].doubleContraction(direction_tensor_rank_two) * _prefactor[_qp];
60 
61  if (_has_coupled_c)
62  (*_dchemical_potential)[_qp] =
63  -_stress_old[_qp].doubleContraction(direction_tensor_rank_two) * (*_dprefactor_dc)[_qp];
64 }
const MaterialProperty< Real > * _dprefactor_dc
MaterialProperty< Real > * _dchemical_potential
StressBasedChemicalPotential(const InputParameters &parameters)
VariableName coupledName(const std::string &var_name, unsigned int comp=0) const
void addRequiredParam(const std::string &name, const std::string &doc_string)
TensorValue< Real > RealTensorValue
static InputParameters validParams()
const MaterialProperty< RealTensorValue > & _direction_tensor
const MaterialProperty< RankTwoTensor > & _stress_old
The old stress tensor.
MaterialProperty< Real > & _chemical_potential
registerMooseObject("SolidMechanicsApp", StressBasedChemicalPotential)
void addCoupledVar(const std::string &name, const std::string &doc_string)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const MaterialProperty< Real > & _prefactor
StressBasedChemicalPotential computes chemical potential based on stress and a direction tensor Fores...
void addClassDescription(const std::string &doc_string)