www.mooseframework.org
AllenCahnElasticEnergyOffDiag.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 #include "MathUtils.h"
12 #include "RankTwoTensor.h"
13 
15 
16 template <>
17 InputParameters
19 {
20  InputParameters params = validParams<Kernel>();
21  params.addClassDescription("This kernel calculates off-diagonal Jacobian of elastic energy in "
22  "AllenCahn with respect to displacements");
23  params.addCoupledVar("displacements",
24  "The vector of displacements suitable for the problem statement");
25  params.addParam<MaterialPropertyName>(
26  "F_name", "E_el", "Name of material property storing the elastic energy");
27  params.addParam<MaterialPropertyName>("mob_name", "L", "The mobility used with the kernel");
28  return params;
29 }
30 
32  : DerivativeMaterialInterface<JvarMapKernelInterface<Kernel>>(parameters),
33  _L(getMaterialProperty<Real>("mob_name")),
34  _ndisp(coupledComponents("displacements")),
35  _disp_var(_ndisp),
36  _d2Fdcdstrain(getMaterialProperty<RankTwoTensor>("d2Fdcdstrain"))
37 {
38  for (unsigned int i = 0; i < _ndisp; ++i)
39  _disp_var[i] = coupled("displacements", i);
40 }
41 
42 Real
44 {
45  for (unsigned int c_comp = 0; c_comp < _ndisp; ++c_comp)
46  if (jvar == _disp_var[c_comp])
47  {
48  const Real dxddFdc = _L[_qp] * _test[_i][_qp];
49  const Real d2Fdcdstrain_comp =
50  (_d2Fdcdstrain[_qp].column(c_comp) + _d2Fdcdstrain[_qp].row(c_comp)) / 2.0 *
51  _grad_phi[_j][_qp];
52  return dxddFdc * d2Fdcdstrain_comp;
53  }
54 
55  return 0.0;
56 }
AllenCahnElasticEnergyOffDiag::_L
const MaterialProperty< Real > & _L
Mobility.
Definition: AllenCahnElasticEnergyOffDiag.h:41
validParams< AllenCahnElasticEnergyOffDiag >
InputParameters validParams< AllenCahnElasticEnergyOffDiag >()
Definition: AllenCahnElasticEnergyOffDiag.C:18
AllenCahnElasticEnergyOffDiag.h
AllenCahnElasticEnergyOffDiag::_ndisp
const unsigned int _ndisp
Displacement variables used for off-diagonal Jacobian.
Definition: AllenCahnElasticEnergyOffDiag.h:44
AllenCahnElasticEnergyOffDiag
This kernel computes the off-diagonal jacobian of elastic energy in AllenCahn respect to displacement...
Definition: AllenCahnElasticEnergyOffDiag.h:29
AllenCahnElasticEnergyOffDiag::_disp_var
std::vector< unsigned int > _disp_var
Definition: AllenCahnElasticEnergyOffDiag.h:45
AllenCahnElasticEnergyOffDiag::AllenCahnElasticEnergyOffDiag
AllenCahnElasticEnergyOffDiag(const InputParameters &parameters)
Definition: AllenCahnElasticEnergyOffDiag.C:31
registerMooseObject
registerMooseObject("PhaseFieldApp", AllenCahnElasticEnergyOffDiag)
RankTwoTensorTempl< Real >
AllenCahnElasticEnergyOffDiag::_d2Fdcdstrain
const MaterialProperty< RankTwoTensor > & _d2Fdcdstrain
Free energy material properties and derivatives.
Definition: AllenCahnElasticEnergyOffDiag.h:49
AllenCahnElasticEnergyOffDiag::computeQpOffDiagJacobian
virtual Real computeQpOffDiagJacobian(unsigned int jvar) override
Definition: AllenCahnElasticEnergyOffDiag.C:43