www.mooseframework.org
ACInterfaceStress.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
3 /* */
4 /* All contents are licensed under LGPL V2.1 */
5 /* See LICENSE for full restrictions */
6 /****************************************************************/
7 #include "ACInterfaceStress.h"
8 #include "RankTwoTensor.h"
9 
10 template <>
11 InputParameters
13 {
14  InputParameters params = validParams<Kernel>();
15  params.addClassDescription("Interface stress driving force Allen-Cahn Kernel");
16  params.addParam<MaterialPropertyName>("mob_name", "L", "The mobility used with the kernel");
17  params.addParam<std::string>("base_name", "Material property base name");
18  params.addRequiredParam<Real>("stress", "Planar stress");
19  params.addRangeCheckedParam<Real>("op_range",
20  1.0,
21  "op_range > 0.0",
22  "Range over which order parameters change across an "
23  "interface. By default order parameters are assumed to "
24  "vary from 0 to 1");
25  return params;
26 }
27 
28 ACInterfaceStress::ACInterfaceStress(const InputParameters & parameters)
29  : Kernel(parameters),
30  _L(getMaterialProperty<Real>("mob_name")),
31  _base_name(isParamValid("base_name") ? getParam<std::string>("base_name") + "_" : ""),
32  _strain(getMaterialPropertyByName<RankTwoTensor>(_base_name + "elastic_strain")),
33  _stress(getParam<Real>("stress") / getParam<Real>("op_range"))
34 {
35 }
36 
37 Real
39 {
40  // no interface, return zero stress
41  const Real grad_norm_sq = _grad_u[_qp].norm_sq();
42  if (grad_norm_sq < libMesh::TOLERANCE)
43  return 0.0;
44 
45  const Real grad_norm = std::sqrt(grad_norm_sq);
46 
47  const Real nx = _grad_u[_qp](0);
48  const Real ny = _grad_u[_qp](1);
49  const Real nz = _grad_u[_qp](2);
50 
51  const Real s = _stress / grad_norm;
52  const Real ds = -_stress / (grad_norm * grad_norm_sq);
53  const Real dsx = ds * nx;
54  const Real dsy = ds * ny;
55  const Real dsz = ds * nz;
56 
57  // d/d(grad eta)_x
58  _dS(0, 0, 0) = (ny * ny + nz * nz) * dsx; // (ny * ny + nz * nz) * s;
59  _dS(0, 1, 0) = _dS(0, 0, 1) = -ny * s - nx * ny * dsx; // -nx * ny * s;
60  _dS(0, 1, 1) = 2.0 * nx * s + (nx * nx + nz * nz) * dsx; // (nx * nx + nz * nz) * s;
61  _dS(0, 2, 0) = _dS(0, 0, 2) = -nz * s - nx * nz * dsx; // -nx * nz * s;
62  _dS(0, 2, 1) = _dS(0, 1, 2) = -ny * nz * dsx; // -ny * nz * s;
63  _dS(0, 2, 2) = 2.0 * nx * s + (nx * nx + ny * ny) * dsx; // (nx * nx + ny * ny) * s;
64 
65  // d/d(grad eta)_y
66  _dS(1, 0, 0) = 2.0 * ny * s + (ny * ny + nz * nz) * dsy; // (ny * ny + nz * nz) * s;
67  _dS(1, 1, 0) = _dS(1, 0, 1) = -nx * s - nx * ny * dsy; // -nx * ny * s;
68  _dS(1, 1, 1) = (nx * nx + nz * nz) * dsy; // (nx * nx + nz * nz) * s;
69  _dS(1, 2, 0) = _dS(1, 0, 2) = -nx * nz * dsy; // -nx * nz * s;
70  _dS(1, 2, 1) = _dS(1, 1, 2) = -nz * s - ny * nz * dsy; // -ny * nz * s;
71  _dS(1, 2, 2) = 2.0 * ny * s + (nx * nx + ny * ny) * dsy; // (nx * nx + ny * ny) * s;
72 
73  // d/d(grad eta)_z
74  _dS(2, 0, 0) = 2.0 * nz * s + (ny * ny + nz * nz) * dsz; // (ny * ny + nz * nz) * s;
75  _dS(2, 1, 0) = _dS(2, 0, 1) = -nx * ny * dsz; // -nx * ny * s;
76  _dS(2, 1, 1) = 2.0 * nz * s + (nx * nx + nz * nz) * dsz; // (nx * nx + nz * nz) * s;
77  _dS(2, 2, 0) = _dS(2, 0, 2) = -nx * s - nx * nz * dsz; // -nx * nz * s;
78  _dS(2, 2, 1) = _dS(2, 1, 2) = -ny * s - ny * nz * dsz; // -ny * nz * s;
79  _dS(2, 2, 2) = (nx * nx + ny * ny) * dsz; // (nx * nx + ny * ny) * s;
80 
81  return _L[_qp] * 0.5 * _dS.doubleContraction(_strain[_qp]) * _grad_test[_i][_qp];
82 }
83 
84 Real
86 {
87  // no interface, return zero stress
88  const Real grad_norm_sq = _grad_u[_qp].norm_sq();
89  if (grad_norm_sq < libMesh::TOLERANCE)
90  return 0.0;
91 
92  const Real grad_norm = std::sqrt(grad_norm_sq);
93 
94  const Real nx = _grad_u[_qp](0);
95  const Real ny = _grad_u[_qp](1);
96  const Real nz = _grad_u[_qp](2);
97 
98  const Real px = _grad_phi[_j][_qp](0);
99  const Real py = _grad_phi[_j][_qp](1);
100  const Real pz = _grad_phi[_j][_qp](2);
101 
102  const Real s = _stress / grad_norm;
103  const Real ds = -_stress / (grad_norm * grad_norm_sq);
104  const Real dsx = ds * nx;
105  const Real dsy = ds * ny;
106  const Real dsz = ds * nz;
107 
108  const Real dus = ds * (nx * px + ny * py + pz * nz);
109 
110  const Real b = -3.0 * nx * px - 3.0 * ny * py - 3.0 * nz * pz;
111  const Real dudsx = ds * nx / grad_norm_sq * b + ds * px;
112  const Real dudsy = ds * ny / grad_norm_sq * b + ds * py;
113  const Real dudsz = ds * nz / grad_norm_sq * b + ds * pz;
114 
115  // d/du d/d(grad eta)_x
116  _ddS(0, 0, 0) = (2.0 * ny * py + 2.0 * nz * pz) * dsx + (ny * ny + nz * nz) * dudsx;
117  _ddS(0, 1, 0) = _ddS(0, 0, 1) =
118  -py * s - ny * dus - px * ny * dsx - nx * py * dsx - nx * ny * dudsx;
119  _ddS(0, 1, 1) = 2.0 * px * s + 2.0 * nx * dus + (2.0 * nx * px + 2.0 * nz * pz) * dsx +
120  (nx * nx + nz * nz) * dudsx;
121  _ddS(0, 2, 0) = _ddS(0, 0, 2) =
122  -pz * s - nz * dus - px * nz * dsx - nx * pz * dsx - nx * nz * dudsx;
123  _ddS(0, 2, 1) = _ddS(0, 1, 2) = -py * nz * dsx - ny * pz * dsx - ny * nz * dudsx;
124  _ddS(0, 2, 2) = 2.0 * px * s + 2.0 * nx * dus + (2.0 * nx * px + 2.0 * ny * py) * dsx +
125  (nx * nx + ny * ny) * dudsx;
126 
127  // d/du d/d(grad eta)_y
128  _ddS(1, 0, 0) = 2.0 * py * s + 2.0 * ny * dus + (2.0 * ny * py + 2.0 * nz * pz) * dsy +
129  (ny * ny + nz * nz) * dudsy;
130  _ddS(1, 1, 0) = _ddS(1, 0, 1) =
131  -px * s - nx * dus - px * ny * dsy - nx * py * dsy - nx * ny * dudsy;
132  _ddS(1, 1, 1) = (2.0 * nx * px + 2.0 * nz * pz) * dsy + (nx * nx + nz * nz) * dudsy;
133  _ddS(1, 2, 0) = _ddS(1, 0, 2) = -px * nz * dsy - nx * pz * dsy - nx * nz * dudsy;
134  _ddS(1, 2, 1) = _ddS(1, 1, 2) =
135  -pz * s - nz * dus - py * nz * dsy - ny * pz * dsy - ny * nz * dudsy;
136  _ddS(1, 2, 2) = 2.0 * py * s + 2.0 * ny * dus + (2.0 * nx * px + 2.0 * ny * py) * dsy +
137  (nx * nx + ny * ny) * dudsy;
138 
139  // d/du d/d(grad eta)_z
140  _ddS(2, 0, 0) = 2.0 * pz * s + 2.0 * nz * dus + (2.0 * ny * py + 2.0 * nz * pz) * dsz +
141  (ny * ny + nz * nz) * dudsz;
142  _ddS(2, 1, 0) = _ddS(2, 0, 1) = -px * ny * dsz - nx * py * dsz - nx * ny * dudsz;
143  _ddS(2, 1, 1) = 2.0 * pz * s + 2.0 * nz * dus + (2.0 * nx * px + 2.0 * nz * pz) * dsz +
144  (nx * nx + nz * nz) * dudsz;
145  _ddS(2, 2, 0) = _ddS(2, 0, 2) =
146  -px * s - nx * dus - px * nz * dsz - nx * pz * dsz - nx * nz * dudsz;
147  _ddS(2, 2, 1) = _ddS(2, 1, 2) =
148  -py * s - ny * dus - py * nz * dsz - ny * pz * dsz - ny * nz * dudsz;
149  _ddS(2, 2, 2) = (2.0 * nx * px + 2.0 * ny * py) * dsz + (nx * nx + ny * ny) * dudsz;
150 
151  return _L[_qp] * 0.5 * _ddS.doubleContraction(_strain[_qp]) * _grad_test[_i][_qp];
152 }
InputParameters validParams< ACInterfaceStress >()
ACInterfaceStress(const InputParameters &parameters)
const MaterialProperty< Real > & _L
Mobility.
virtual Real computeQpJacobian() override
RankThreeTensor _dS
d sigma/d(grad eta), derivative of interface stress tensor with order parameter gradient ...
virtual Real computeQpResidual() override
const Real _stress
interface stress
RankThreeTensor _ddS
derivative of _dS w.r.t. the finite element coefficients for the Jacobian calculation ...
const MaterialProperty< RankTwoTensor > & _strain