www.mooseframework.org
StressBasedChemicalPotential.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 
15 
16 InputParameters
18 {
19  InputParameters params = Material::validParams();
20  params.addClassDescription("Chemical potential from stress");
21  params.addRequiredParam<MaterialPropertyName>("property_name",
22  "Name of stress based chemical potential");
23  params.addRequiredParam<MaterialPropertyName>("stress_name", "Name of stress property variable");
24  params.addRequiredParam<MaterialPropertyName>("direction_tensor_name",
25  "Name of direction tensor variable");
26  params.addRequiredParam<MaterialPropertyName>("prefactor_name", "Name of prefactor variable");
27  params.addCoupledVar("c", "Concentration variable");
28  return params;
29 }
30 
32  : DerivativeMaterialInterface<Material>(parameters),
33  _chemical_potential(declareProperty<Real>(getParam<MaterialPropertyName>("property_name"))),
34  _stress_old(getMaterialPropertyOld<RankTwoTensor>("stress_name")),
35  _direction_tensor(getMaterialProperty<RealTensorValue>("direction_tensor_name")),
36  _prefactor(getMaterialProperty<Real>("prefactor_name")),
37  _has_coupled_c(isCoupled("c"))
38 {
39  if (_has_coupled_c)
40  {
41  _dchemical_potential = &declarePropertyDerivative<Real>(
42  getParam<MaterialPropertyName>("property_name"), getVar("c", 0)->name());
43  _dprefactor_dc = &getMaterialPropertyDerivative<Real>("prefactor_name", getVar("c", 0)->name());
44  }
45 }
46 
47 void
49 {
50  _chemical_potential[_qp] = 0.0;
51 
52  if (_has_coupled_c)
53  (*_dchemical_potential)[_qp] = 0.0;
54 }
55 
56 void
58 {
59  RankTwoTensor direction_tensor_rank_two = _direction_tensor[_qp];
60  _chemical_potential[_qp] =
61  -_stress_old[_qp].doubleContraction(direction_tensor_rank_two) * _prefactor[_qp];
62 
63  if (_has_coupled_c)
64  (*_dchemical_potential)[_qp] =
65  -_stress_old[_qp].doubleContraction(direction_tensor_rank_two) * (*_dprefactor_dc)[_qp];
66 }
StressBasedChemicalPotential::_direction_tensor
const MaterialProperty< RealTensorValue > & _direction_tensor
Definition: StressBasedChemicalPotential.h:41
StressBasedChemicalPotential::_stress_old
const MaterialProperty< RankTwoTensor > & _stress_old
Definition: StressBasedChemicalPotential.h:40
StressBasedChemicalPotential::_has_coupled_c
bool _has_coupled_c
Definition: StressBasedChemicalPotential.h:44
StressBasedChemicalPotential::StressBasedChemicalPotential
StressBasedChemicalPotential(const InputParameters &parameters)
Definition: StressBasedChemicalPotential.C:31
StressBasedChemicalPotential.h
StressBasedChemicalPotential::_dprefactor_dc
const MaterialProperty< Real > * _dprefactor_dc
Definition: StressBasedChemicalPotential.h:43
StressBasedChemicalPotential
StressBasedChemicalPotential computes chemical potential based on stress and a direction tensor Fores...
Definition: StressBasedChemicalPotential.h:26
StressBasedChemicalPotential::_prefactor
const MaterialProperty< Real > & _prefactor
Definition: StressBasedChemicalPotential.h:42
StressBasedChemicalPotential::initQpStatefulProperties
virtual void initQpStatefulProperties()
Definition: StressBasedChemicalPotential.C:48
validParams
InputParameters validParams()
name
const std::string name
Definition: Setup.h:21
defineLegacyParams
defineLegacyParams(StressBasedChemicalPotential)
StressBasedChemicalPotential::_dchemical_potential
MaterialProperty< Real > * _dchemical_potential
Definition: StressBasedChemicalPotential.h:38
StressBasedChemicalPotential::computeQpProperties
virtual void computeQpProperties()
Definition: StressBasedChemicalPotential.C:57
RankTwoTensorTempl< Real >
StressBasedChemicalPotential::validParams
static InputParameters validParams()
Definition: StressBasedChemicalPotential.C:17
registerMooseObject
registerMooseObject("TensorMechanicsApp", StressBasedChemicalPotential)
StressBasedChemicalPotential::_chemical_potential
MaterialProperty< Real > & _chemical_potential
Definition: StressBasedChemicalPotential.h:37