www.mooseframework.org
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
KKSXeVacSolidMaterial Class Reference

#include <KKSXeVacSolidMaterial.h>

Inheritance diagram for KKSXeVacSolidMaterial:
[legend]

Public Member Functions

 KKSXeVacSolidMaterial (const InputParameters &parameters)
 

Protected Member Functions

virtual unsigned int expectedNumArgs ()
 
virtual Real computeF ()
 Override this method to provide the free energy function. More...
 
virtual Real computeDF (unsigned int arg)
 Override this method for calculating the first derivatives. More...
 
virtual Real computeD2F (unsigned int arg1, unsigned int arg2)
 Override this method to calculate the second derivatives. More...
 
virtual void computeProperties ()
 
virtual void initialSetup ()
 Check if we got the right number of components in the 'args' coupled variable vector. More...
 
virtual Real computeD3F (unsigned int, unsigned int, unsigned int)
 Override this method to calculate the third derivatives. More...
 
unsigned int argIndex (unsigned int i_var) const
 FunctionMaterialBase keeps an internal list of all the variables the derivatives are taken w.r.t. More...
 

Protected Attributes

bool _third_derivatives
 Calculate (and allocate memory for) the third derivatives of the free energy. More...
 
std::vector< MaterialProperty< Real > * > _prop_dF
 Material properties to store the derivatives of f with respect to arg[i]. More...
 
std::vector< std::vector< MaterialProperty< Real > * > > _prop_d2F
 Material properties to store the second derivatives. More...
 
std::vector< std::vector< std::vector< MaterialProperty< Real > * > > > _prop_d3F
 Material properties to store the third derivatives. More...
 
std::vector< const VariableValue * > _args
 Coupled variables for function arguments. More...
 
std::string _F_name
 Name of the function value material property and used as a base name to concatenate the material property names for the derivatives. More...
 
bool _mapping_is_unique
 Flag that indicates if exactly one linear variable is coupled per input file coupling parameter. More...
 
unsigned int _nargs
 Number of coupled arguments. More...
 
std::vector< std::string > _arg_names
 String vector of all argument names. More...
 
std::vector< unsigned int > _arg_numbers
 Vector of all argument MOOSE variable numbers. More...
 
std::vector< std::string > _arg_param_names
 String vector of the input file coupling parameter name for each argument. More...
 
std::vector< std::string > _arg_constant_defaults
 coupled variables with default values More...
 
MaterialProperty< Real > * _prop_F
 Material property to store the function value. More...
 

Private Member Functions

Real cLogC (Real c)
 

Private Attributes

const Real _T
 Temperature in [K]. More...
 
const Real _Omega
 Atomic volume in [Ang^3]. More...
 
const Real _kB
 Bolzmann constant. More...
 
const Real _Efv
 Formation energy of a tri-vacancy in UO2. More...
 
const Real _Efg
 Formation energy of a Xenon Atom in a tri-vacancy (TODO: if cmg>cmv consider interstitial Xe) More...
 
const VariableValue & _cmg
 
unsigned int _cmg_var
 
const VariableValue & _cmv
 
unsigned int _cmv_var
 

Detailed Description

Definition at line 18 of file KKSXeVacSolidMaterial.h.

Constructor & Destructor Documentation

KKSXeVacSolidMaterial::KKSXeVacSolidMaterial ( const InputParameters &  parameters)

Definition at line 21 of file KKSXeVacSolidMaterial.C.

22  : DerivativeFunctionMaterialBase(parameters),
23  _T(getParam<Real>("T")),
24  _Omega(2.53),
25  _kB(8.6173324e-5),
26  _Efv(3.0),
27  _Efg(3.0),
28  _cmg(coupledValue("cmg")),
29  _cmg_var(coupled("cmg")),
30  _cmv(coupledValue("cmv")),
31  _cmv_var(coupled("cmv"))
32 {
33 }
DerivativeFunctionMaterialBase(const InputParameters &parameters)
const Real _Omega
Atomic volume in [Ang^3].
const Real _Efg
Formation energy of a Xenon Atom in a tri-vacancy (TODO: if cmg>cmv consider interstitial Xe) ...
const Real _Efv
Formation energy of a tri-vacancy in UO2.
const Real _T
Temperature in [K].
const VariableValue & _cmg
const VariableValue & _cmv
const Real _kB
Bolzmann constant.

Member Function Documentation

unsigned int FunctionMaterialBase::argIndex ( unsigned int  i_var) const
inlineprotectedinherited

FunctionMaterialBase keeps an internal list of all the variables the derivatives are taken w.r.t.

We provide the MOOSE variable bames in _arg_names, the libMesh variable numbers in _arg_numbers, and the input file parameter names in _arg_param_names. All are indexed by the argument index. This method returns the argument index for a given the libMesh variable number.

This mapping is necessary for internal classes which maintain lists of derivatives indexed by argument index and need to pull from those lists from the computeDF, computeD2F, and computeD3F methods, which receive libMesh variable numbers as parameters.

Definition at line 43 of file FunctionMaterialBase.h.

Referenced by DerivativeMultiPhaseMaterial::computeD2F(), ElasticEnergyMaterial::computeD2F(), DerivativeTwoPhaseMaterial::computeD2F(), DerivativeMultiPhaseMaterial::computeD3F(), DerivativeTwoPhaseMaterial::computeD3F(), DerivativeMultiPhaseMaterial::computeDF(), ElasticEnergyMaterial::computeDF(), DerivativeTwoPhaseMaterial::computeDF(), DerivativeMultiPhaseBase::DerivativeMultiPhaseBase(), and DiscreteNucleation::DiscreteNucleation().

44  {
45  const unsigned int idx = libMeshVarNumberRemap(i_var);
46  mooseAssert(idx < _arg_index.size() && _arg_numbers[_arg_index[idx]] == i_var,
47  "Requesting argIndex() for a derivative w.r.t. a variable not coupled to.");
48  return _arg_index[idx];
49  }
std::vector< unsigned int > _arg_index
Vector to look up the internal coupled variable index into arg* through the libMesh variable number...
unsigned int libMeshVarNumberRemap(unsigned int var) const
map the variable numbers to an even/odd interspersed pattern
std::vector< unsigned int > _arg_numbers
Vector of all argument MOOSE variable numbers.
Real KKSXeVacSolidMaterial::cLogC ( Real  c)
private

Definition at line 37 of file KKSXeVacSolidMaterial.C.

Referenced by computeF().

38 {
39  return c <= 0.0 ? 0.0 : c * std::log(c);
40 }
Real KKSXeVacSolidMaterial::computeD2F ( unsigned int  arg1,
unsigned int  arg2 
)
protectedvirtual

Override this method to calculate the second derivatives.

\( \frac{d^2F}{dc_{arg1} dc_{arg2}} \)

Parameters
arg1The variable the first derivative is taken of
arg2The variable the second derivative is taken of

Reimplemented from DerivativeFunctionMaterialBase.

Definition at line 76 of file KKSXeVacSolidMaterial.C.

77 {
78  if (i_var != j_var)
79  return 0.0;
80 
81  const Real tol = 1e-10;
82  Real cmg = _cmg[_qp] < tol ? tol : (_cmg[_qp] > (1.0 - tol) ? (1.0 - tol) : _cmg[_qp]);
83  Real cmv = _cmv[_qp] < tol ? tol : (_cmv[_qp] > (1.0 - tol) ? (1.0 - tol) : _cmv[_qp]);
84 
85  if (i_var == _cmg_var)
86  return 1.0 / _Omega * _kB * _T * (1.0 / (1.0 - cmg) + 1.0 / cmg);
87 
88  if (i_var == _cmv_var)
89  return 1.0 / _Omega * _kB * _T * (1.0 / (1.0 - cmv) + 1.0 / cmv);
90 
91  mooseError("Unknown derivative requested");
92 }
const Real _Omega
Atomic volume in [Ang^3].
const Real _T
Temperature in [K].
const VariableValue & _cmg
static const double tol
Definition: XFEMFuncs.h:26
const VariableValue & _cmv
const Real _kB
Bolzmann constant.
virtual Real DerivativeFunctionMaterialBase::computeD3F ( unsigned int  ,
unsigned int  ,
unsigned int   
)
inlineprotectedvirtualinherited

Override this method to calculate the third derivatives.

Note
The implementation of this method is optional. It is only evaluated when the 'third_derivatives' parameter is set to true.

Reimplemented in DerivativeTwoPhaseMaterial, MathFreeEnergy, and DerivativeMultiPhaseMaterial.

Definition at line 95 of file DerivativeFunctionMaterialBase.h.

Referenced by DerivativeFunctionMaterialBase::computeProperties().

95 { return 0.0; }
Real KKSXeVacSolidMaterial::computeDF ( unsigned int  arg)
protectedvirtual

Override this method for calculating the first derivatives.

The parameter is the libMesh variable number of the coupled variable. These numbers can be obtained using the coupled() method for each coupled variable.

Parameters
argThe index of the function argument the derivative is taken of

Reimplemented from DerivativeFunctionMaterialBase.

Definition at line 59 of file KKSXeVacSolidMaterial.C.

60 {
61  const Real tol = 1e-10;
62  Real cmg = _cmg[_qp] < tol ? tol : (_cmg[_qp] > (1.0 - tol) ? (1.0 - tol) : _cmg[_qp]);
63  Real cmv = _cmv[_qp] < tol ? tol : (_cmv[_qp] > (1.0 - tol) ? (1.0 - tol) : _cmv[_qp]);
64 
65  if (i_var == _cmg_var)
66  return 1.0 / _Omega * (_Efg + _kB * _T * (std::log(cmg) - std::log(-cmg + 1.0)));
67 
68  if (i_var == _cmv_var)
69  return 1.0 / _Omega * (_Efv + _kB * _T * (std::log(cmv) - std::log(-cmv + 1.0)));
70 
71  mooseError("Unknown derivative requested");
72 }
const Real _Omega
Atomic volume in [Ang^3].
const Real _Efg
Formation energy of a Xenon Atom in a tri-vacancy (TODO: if cmg>cmv consider interstitial Xe) ...
const Real _Efv
Formation energy of a tri-vacancy in UO2.
const Real _T
Temperature in [K].
const VariableValue & _cmg
static const double tol
Definition: XFEMFuncs.h:26
const VariableValue & _cmv
const Real _kB
Bolzmann constant.
Real KKSXeVacSolidMaterial::computeF ( )
protectedvirtual

Override this method to provide the free energy function.

Reimplemented from DerivativeFunctionMaterialBase.

Definition at line 51 of file KKSXeVacSolidMaterial.C.

52 {
53  return 1.0 / _Omega * (_kB * _T * (cLogC(_cmv[_qp]) + cLogC(1.0 - _cmv[_qp])) + _Efv * _cmv[_qp] +
54  _kB * _T * (cLogC(_cmg[_qp]) + cLogC(1.0 - _cmg[_qp])) + _Efg * _cmg[_qp]);
55 }
const Real _Omega
Atomic volume in [Ang^3].
const Real _Efg
Formation energy of a Xenon Atom in a tri-vacancy (TODO: if cmg>cmv consider interstitial Xe) ...
const Real _Efv
Formation energy of a tri-vacancy in UO2.
const Real _T
Temperature in [K].
const VariableValue & _cmg
const VariableValue & _cmv
const Real _kB
Bolzmann constant.
void DerivativeFunctionMaterialBase::computeProperties ( )
protectedvirtualinherited

Reimplemented in DiscreteNucleation, and DerivativeSumMaterial.

Definition at line 124 of file DerivativeFunctionMaterialBase.C.

125 {
126  for (_qp = 0; _qp < _qrule->n_points(); _qp++)
127  {
128  // set function value
129  if (_prop_F)
130  (*_prop_F)[_qp] = computeF();
131 
132  for (unsigned int i = 0; i < _nargs; ++i)
133  {
134  // set first derivatives
135  if (_prop_dF[i])
136  (*_prop_dF[i])[_qp] = computeDF(_arg_numbers[i]);
137 
138  // second derivatives
139  for (unsigned int j = i; j < _nargs; ++j)
140  {
141  if (_prop_d2F[i][j])
142  (*_prop_d2F[i][j])[_qp] = computeD2F(_arg_numbers[i], _arg_numbers[j]);
143 
144  // third derivatives
145  if (_third_derivatives)
146  {
147  for (unsigned int k = j; k < _nargs; ++k)
148  if (_prop_d3F[i][j][k])
149  (*_prop_d3F[i][j][k])[_qp] =
151  }
152  }
153  }
154  }
155 }
std::vector< std::vector< MaterialProperty< Real > * > > _prop_d2F
Material properties to store the second derivatives.
virtual Real computeD2F(unsigned int arg1, unsigned int arg2)
Override this method to calculate the second derivatives.
std::vector< std::vector< std::vector< MaterialProperty< Real > * > > > _prop_d3F
Material properties to store the third derivatives.
MaterialProperty< Real > * _prop_F
Material property to store the function value.
virtual Real computeD3F(unsigned int, unsigned int, unsigned int)
Override this method to calculate the third derivatives.
virtual Real computeF()
Override this method to provide the free energy function.
bool _third_derivatives
Calculate (and allocate memory for) the third derivatives of the free energy.
unsigned int _nargs
Number of coupled arguments.
std::vector< MaterialProperty< Real > * > _prop_dF
Material properties to store the derivatives of f with respect to arg[i].
virtual Real computeDF(unsigned int arg)
Override this method for calculating the first derivatives.
std::vector< unsigned int > _arg_numbers
Vector of all argument MOOSE variable numbers.
unsigned int KKSXeVacSolidMaterial::expectedNumArgs ( )
protectedvirtual

Definition at line 44 of file KKSXeVacSolidMaterial.C.

45 {
46  return 2;
47 }
void DerivativeFunctionMaterialBase::initialSetup ( )
protectedvirtualinherited

Check if we got the right number of components in the 'args' coupled variable vector.

Reimplemented in DerivativeMultiPhaseBase, DerivativeTwoPhaseMaterial, ElasticEnergyMaterial, and DerivativeSumMaterial.

Definition at line 81 of file DerivativeFunctionMaterialBase.C.

82 {
83  // set the _prop_* pointers of all material properties that are not beeing used back to NULL
84  bool needs_third_derivatives = false;
85 
86  if (!_fe_problem.isMatPropRequested(_F_name))
87  _prop_F = NULL;
88 
89  for (unsigned int i = 0; i < _nargs; ++i)
90  {
91  if (!_fe_problem.isMatPropRequested(propertyNameFirst(_F_name, _arg_names[i])))
92  _prop_dF[i] = NULL;
93 
94  // second derivatives
95  for (unsigned int j = i; j < _nargs; ++j)
96  {
97  if (!_fe_problem.isMatPropRequested(
98  propertyNameSecond(_F_name, _arg_names[i], _arg_names[j])))
99  _prop_d2F[i][j] = _prop_d2F[j][i] = NULL;
100 
101  // third derivatives
102  if (_third_derivatives)
103  {
104  for (unsigned int k = j; k < _nargs; ++k)
105  {
106  if (!_fe_problem.isMatPropRequested(
107  propertyNameThird(_F_name, _arg_names[i], _arg_names[j], _arg_names[k])))
108  _prop_d3F[i][j][k] = _prop_d3F[k][i][j] = _prop_d3F[j][k][i] = _prop_d3F[k][j][i] =
109  _prop_d3F[j][i][k] = _prop_d3F[i][k][j] = NULL;
110  else
111  needs_third_derivatives = true;
112  }
113 
114  if (!needs_third_derivatives)
115  mooseWarning("This simulation does not actually need the third derivatives of "
116  "DerivativeFunctionMaterialBase " +
117  name());
118  }
119  }
120  }
121 }
std::vector< std::vector< MaterialProperty< Real > * > > _prop_d2F
Material properties to store the second derivatives.
std::vector< std::vector< std::vector< MaterialProperty< Real > * > > > _prop_d3F
Material properties to store the third derivatives.
MaterialProperty< Real > * _prop_F
Material property to store the function value.
bool _third_derivatives
Calculate (and allocate memory for) the third derivatives of the free energy.
unsigned int _nargs
Number of coupled arguments.
std::vector< MaterialProperty< Real > * > _prop_dF
Material properties to store the derivatives of f with respect to arg[i].
std::string _F_name
Name of the function value material property and used as a base name to concatenate the material prop...
std::vector< std::string > _arg_names
String vector of all argument names.

Member Data Documentation

std::vector<std::string> FunctionMaterialBase::_arg_constant_defaults
protectedinherited

coupled variables with default values

Definition at line 76 of file FunctionMaterialBase.h.

Referenced by FunctionMaterialBase::FunctionMaterialBase(), and ParsedMaterialHelper::functionParse().

std::vector<std::string> FunctionMaterialBase::_arg_names
protectedinherited
std::vector<unsigned int> FunctionMaterialBase::_arg_numbers
protectedinherited

Vector of all argument MOOSE variable numbers.

Definition at line 70 of file FunctionMaterialBase.h.

Referenced by FunctionMaterialBase::argIndex(), DerivativeFunctionMaterialBase::computeProperties(), and FunctionMaterialBase::FunctionMaterialBase().

std::vector<std::string> FunctionMaterialBase::_arg_param_names
protectedinherited

String vector of the input file coupling parameter name for each argument.

Definition at line 73 of file FunctionMaterialBase.h.

Referenced by FunctionMaterialBase::FunctionMaterialBase(), and ParsedMaterialHelper::functionParse().

std::vector<const VariableValue *> FunctionMaterialBase::_args
protectedinherited
const VariableValue& KKSXeVacSolidMaterial::_cmg
private

Definition at line 47 of file KKSXeVacSolidMaterial.h.

Referenced by computeD2F(), computeDF(), and computeF().

unsigned int KKSXeVacSolidMaterial::_cmg_var
private

Definition at line 48 of file KKSXeVacSolidMaterial.h.

Referenced by computeD2F(), and computeDF().

const VariableValue& KKSXeVacSolidMaterial::_cmv
private

Definition at line 49 of file KKSXeVacSolidMaterial.h.

Referenced by computeD2F(), computeDF(), and computeF().

unsigned int KKSXeVacSolidMaterial::_cmv_var
private

Definition at line 50 of file KKSXeVacSolidMaterial.h.

Referenced by computeD2F(), and computeDF().

const Real KKSXeVacSolidMaterial::_Efg
private

Formation energy of a Xenon Atom in a tri-vacancy (TODO: if cmg>cmv consider interstitial Xe)

Definition at line 45 of file KKSXeVacSolidMaterial.h.

Referenced by computeDF(), and computeF().

const Real KKSXeVacSolidMaterial::_Efv
private

Formation energy of a tri-vacancy in UO2.

Definition at line 41 of file KKSXeVacSolidMaterial.h.

Referenced by computeDF(), and computeF().

std::string FunctionMaterialBase::_F_name
protectedinherited

Name of the function value material property and used as a base name to concatenate the material property names for the derivatives.

Definition at line 58 of file FunctionMaterialBase.h.

Referenced by DerivativeParsedMaterialHelper::assembleDerivatives(), DerivativeFunctionMaterialBase::DerivativeFunctionMaterialBase(), and DerivativeFunctionMaterialBase::initialSetup().

const Real KKSXeVacSolidMaterial::_kB
private

Bolzmann constant.

Definition at line 38 of file KKSXeVacSolidMaterial.h.

Referenced by computeD2F(), computeDF(), and computeF().

bool FunctionMaterialBase::_mapping_is_unique
protectedinherited

Flag that indicates if exactly one linear variable is coupled per input file coupling parameter.

Definition at line 61 of file FunctionMaterialBase.h.

Referenced by FunctionMaterialBase::FunctionMaterialBase(), and ParsedMaterialHelper::functionParse().

unsigned int FunctionMaterialBase::_nargs
protectedinherited
const Real KKSXeVacSolidMaterial::_Omega
private

Atomic volume in [Ang^3].

Definition at line 35 of file KKSXeVacSolidMaterial.h.

Referenced by computeD2F(), computeDF(), and computeF().

std::vector<std::vector<MaterialProperty<Real> *> > DerivativeFunctionMaterialBase::_prop_d2F
protectedinherited
std::vector<std::vector<std::vector<MaterialProperty<Real> *> > > DerivativeFunctionMaterialBase::_prop_d3F
protectedinherited
std::vector<MaterialProperty<Real> *> DerivativeFunctionMaterialBase::_prop_dF
protectedinherited
MaterialProperty<Real>* FunctionMaterialBase::_prop_F
protectedinherited
const Real KKSXeVacSolidMaterial::_T
private

Temperature in [K].

Definition at line 32 of file KKSXeVacSolidMaterial.h.

Referenced by computeD2F(), computeDF(), and computeF().

bool DerivativeFunctionMaterialBase::_third_derivatives
protectedinherited

The documentation for this class was generated from the following files: