https://mooseframework.inl.gov
Loading...
Searching...
No Matches
GrandPotentialTensorMaterial.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
12// libMesh includes
13#include "libmesh/quadrature.h"
14
16
19{
21 params.addClassDescription("Diffusion and mobility parameters for grand potential model "
22 "governing equations. Uses a tensor diffusivity");
23 params.addRequiredParam<Real>("int_width",
24 "The interfacial width in the lengthscale of the problem");
25 params.addParam<MaterialPropertyName>("chi", "Coefficient to multiply by D");
26 params.addParam<Real>("GBmob0", 0.0, "Grain boundary mobility prefactor");
27 params.addRequiredParam<Real>("Q", "Grain boundary migration activation energy in eV");
28 params.addParam<Real>(
29 "GBMobility", -1, "GB mobility input that overrides the temperature dependent calculation");
30 params.addParam<std::string>("f_name", "chiD", "Name for the mobility material property");
31 params.addRequiredParam<MaterialPropertyName>("surface_energy", "Surface energy of material");
32 params.addParam<std::string>("solid_mobility", "L", "Name of grain mobility for solid phase");
33 params.addParam<std::string>("void_mobility", "Lv", "Name of void phase mobility");
34 return params;
35}
36
39 _chiD_name(getParam<std::string>("f_name")),
40 _chiD(declareProperty<RealTensorValue>(_chiD_name)),
41 _dchiDdc(isCoupledConstant(_c_name)
42 ? nullptr
43 : &declarePropertyDerivative<RealTensorValue>(_chiD_name, _c_name)),
44 _dchiDdgradc(isCoupledConstant(_c_name)
45 ? nullptr
46 : &declarePropertyDerivative<RankThreeTensor>(_chiD_name, "gradc")),
47 _Ls_name(getParam<std::string>("solid_mobility")),
48 _Ls(declareProperty<Real>(_Ls_name)),
49 _Lv_name(getParam<std::string>("void_mobility")),
50 _Lv(declareProperty<Real>(_Lv_name)),
51 _chiDmag(declareProperty<Real>(_chiD_name + "_mag")),
52 _sigma_s(getMaterialProperty<Real>("surface_energy")),
53 _int_width(getParam<Real>("int_width")),
54 _chi_name(getParam<MaterialPropertyName>("chi")),
55 _chi(getMaterialProperty<Real>(_chi_name)),
56 _dchidc(getMaterialPropertyDerivative<Real>(_chi_name, _c_name)),
57 _dchideta(_op_num),
58 _dchiDdeta(_op_num),
59 _dchiDdgradeta(_op_num),
60 _GBMobility(getParam<Real>("GBMobility")),
61 _GBmob0(getParam<Real>("GBmob0")),
62 _Q(getParam<Real>("Q"))
63{
64 for (unsigned int i = 0; i < _op_num; ++i)
65 {
66 _dchideta[i] = &getMaterialPropertyDerivative<Real>(_chi_name, _vals_name[i]);
67 if (!isCoupledConstant(_vals_name[i]))
68 _dchiDdeta[i] = &declarePropertyDerivative<RealTensorValue>(_chiD_name, _vals_name[i]);
69 if (!isCoupledConstant(_vals_name[i]))
71 &declarePropertyDerivative<RankThreeTensor>(_chiD_name, ("grad" + _vals_name[i]));
72 }
73}
74
75void
77{
79
80 for (_qp = 0; _qp < _qrule->n_points(); ++_qp)
81 {
82 _chiD[_qp] = _D[_qp] * _chi[_qp];
83 if (_dchiDdc)
84 (*_dchiDdc)[_qp] = (*_dDdc)[_qp] * _chi[_qp] + _D[_qp] * _dchidc[_qp];
85 if (_dchiDdgradc)
86 (*_dchiDdgradc)[_qp] = (*_dDdgradc)[_qp] * _chi[_qp];
87 for (unsigned int i = 0; i < _op_num; ++i)
88 {
89 if (_dchiDdeta[i])
90 (*_dchiDdeta[i])[_qp] = _D[_qp] * (*_dchideta[i])[_qp] + (*_dDdeta[i])[_qp] * _chi[_qp];
91 if (_dchiDdgradeta[i])
92 (*_dchiDdgradeta[i])[_qp] = (*_dDdgradeta[i])[_qp] * _chi[_qp];
93 }
94
95 _chiDmag[_qp] = _chiD[_qp].norm();
96
97 Real GBmob;
98 if (_GBMobility < 0)
99 GBmob = _GBmob0 * std::exp(-_Q / (_kb * _T[_qp]));
100 else
101 GBmob = _GBMobility;
102
103 _Ls[_qp] = 4.0 / 3.0 * GBmob / _int_width;
104 _Lv[_qp] = 40 * _Ls[_qp];
105 }
106}
registerMooseObject("PhaseFieldApp", GrandPotentialTensorMaterial)
Calculates mobilities for grand potential model.
std::vector< const MaterialProperty< Real > * > _dchideta
const MaterialPropertyName _chi_name
susceptibility
std::vector< MaterialProperty< RankThreeTensor > * > _dchiDdgradeta
MaterialProperty< RealTensorValue > & _chiD
const MaterialProperty< Real > & _chi
std::vector< MaterialProperty< RealTensorValue > * > _dchiDdeta
MaterialProperty< RankThreeTensor > * _dchiDdgradc
MaterialProperty< RealTensorValue > * _dchiDdc
MaterialProperty< Real > & _chiDmag
magnitude of mobility tensor
GrandPotentialTensorMaterial(const InputParameters &parameters)
const MaterialProperty< Real > & _dchidc
void addRequiredParam(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)
Generates a diffusion tensor to distinguish between the bulk, grain boundary, and surface diffusion r...
std::vector< NonlinearVariableName > _vals_name
solid phase order parameters
MaterialProperty< RealTensorValue > & _D
std::vector< MaterialProperty< RealTensorValue > * > _dDdeta
std::vector< MaterialProperty< RankThreeTensor > * > _dDdgradeta