https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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{
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
45void
47{
48 _chemical_potential[_qp] = 0.0;
49
51 (*_dchemical_potential)[_qp] = 0.0;
52}
53
54void
56{
57 RankTwoTensor direction_tensor_rank_two = _direction_tensor[_qp];
59 -_stress_old[_qp].doubleContraction(direction_tensor_rank_two) * _prefactor[_qp];
60
62 (*_dchemical_potential)[_qp] =
63 -_stress_old[_qp].doubleContraction(direction_tensor_rank_two) * (*_dprefactor_dc)[_qp];
64}
registerMooseObject("SolidMechanicsApp", StressBasedChemicalPotential)
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
void addCoupledVar(const std::string &name, const std::string &doc_string)
static InputParameters validParams()
StressBasedChemicalPotential computes chemical potential based on stress and a direction tensor Fores...
MaterialProperty< Real > & _chemical_potential
const MaterialProperty< Real > & _prefactor
MaterialProperty< Real > * _dchemical_potential
StressBasedChemicalPotential(const InputParameters &parameters)
const MaterialProperty< RankTwoTensor > & _stress_old
The old stress tensor.
const MaterialProperty< Real > * _dprefactor_dc
const MaterialProperty< RealTensorValue > & _direction_tensor