11 #include "MooseVariableScalar.h"
13 #include "RankTwoTensor.h"
14 #include "RankFourTensor.h"
23 params.addClassDescription(
24 "Class for calculating off-diagonal Jacobian corresponding to "
25 "coupling between displacements (or temperature) and scalar out-of-plane strain for "
26 "generalized plane strain using OSPD formulation");
28 params.addCoupledVar(
"scalar_out_of_plane_strain",
29 "Scalar variable for strain in the out-of-plane direction");
35 const InputParameters & parameters)
37 _bond_dfdE_ij(getMaterialProperty<Real>(
"bond_dfdE_ij")),
38 _bond_dfdE_i_j(getMaterialProperty<Real>(
"bond_dfdE_i_j")),
39 _alpha(getMaterialProperty<Real>(
"thermal_expansion_coeff")),
41 _scalar_out_of_plane_strain_var_num(coupledScalar(
"scalar_out_of_plane_strain"))
45 mooseError(
"GeneralizedPlaneStrain only works for two dimensional case!");
55 if (_var.number() ==
_disp_var[0]->number())
56 if (_use_full_jacobian)
60 else if (_var.number() ==
_disp_var[1]->number())
61 if (_use_full_jacobian)
72 unsigned int jvar_num)
75 DenseMatrix<Number> & ken = _assembly.jacobianBlock(_var.number(), jvar_num);
76 DenseMatrix<Number> & kne = _assembly.jacobianBlock(jvar_num, _var.number());
77 MooseVariableScalar & jvar = _sys.getScalarVariable(_tid, jvar_num);
81 for (_i = 0; _i < _test.size(); _i++)
82 for (_j = 0; _j < jvar.order(); _j++)
87 std::vector<dof_id_type> ivardofs(_nnodes), neighbors(_nnodes), bonds(_nnodes);
90 std::vector<RankTwoTensor> shape(_nnodes), dgrad(_nnodes);
92 for (
unsigned int cur_nd = 0; cur_nd < _nnodes; cur_nd++)
95 shape[cur_nd](2, 2) = dgrad[cur_nd](2, 2) = 1.0;
99 neighbors = _pdmesh.getNeighbors(_current_elem->node_id(cur_nd));
100 bonds = _pdmesh.getBonds(_current_elem->node_id(cur_nd));
101 for (
unsigned int k = 0; k < neighbors.size(); k++)
103 Node * node_k = _pdmesh.nodePtr(neighbors[k]);
104 ivardofs[1 - cur_nd] = node_k->dof_number(_sys.number(), _var.number(), 0);
105 Real vol_k = _pdmesh.getPDNodeVolume(neighbors[k]);
108 RealGradient origin_ori_k = *node_k - *_pdmesh.nodePtr(_current_elem->node_id(cur_nd));
111 for (
unsigned int j = 0; j < _dim; j++)
112 current_ori_k(j) = origin_ori_k(j) +
_disp_var[j]->getNodalValue(*node_k) -
113 _disp_var[j]->getNodalValue(*_current_elem->node_ptr(cur_nd));
115 Real origin_len_k = origin_ori_k.norm();
116 Real current_len_k = current_ori_k.norm();
119 Real bond_status_k = _bond_status_var->getElementalValue(_pdmesh.elemPtr(bonds[k]));
122 for (
unsigned int m = 0; m < _dim; m++)
123 for (
unsigned int n = 0; n < _dim; n++)
125 shape[cur_nd](m, n) += vol_k * _horiz_rad[cur_nd] / origin_len_k * origin_ori_k(m) *
126 origin_ori_k(n) * bond_status_k;
127 dgrad[cur_nd](m, n) += vol_k * _horiz_rad[cur_nd] / origin_len_k * current_ori_k(m) *
128 origin_ori_k(n) * bond_status_k;
132 _local_ke.resize(ken.m(), ken.n());
134 _local_ke(0, 0) = (cur_nd == 0 ? -1 : 1) * current_ori_k(
component) / current_len_k *
137 _local_ke(1, 0) = (cur_nd == 0 ? 1 : -1) * current_ori_k(
component) / current_len_k *
141 _assembly.cacheJacobianBlock(_local_ke, ivardofs, jvar.dofIndices(), _var.scalingFactor());
145 if (MooseUtils::absoluteFuzzyEqual(shape[cur_nd].det(), 0.0))
147 shape[cur_nd] = delta;
148 dgrad[cur_nd] = delta;
153 shape[cur_nd] = shape[cur_nd].inverse();
155 dgrad[cur_nd] = dgrad[cur_nd] * shape[cur_nd];
160 Real dEidUi = -_vols_ij[1] * _horiz_rad[0] / _origin_vec_ij.norm() *
162 (_origin_vec_ij(0) * shape[0](0, 0) + _origin_vec_ij(1) * shape[0](1, 0)) *
165 (_origin_vec_ij(0) * shape[0](0, 1) + _origin_vec_ij(1) * shape[0](1, 1)) *
167 Real dEjdUj = _vols_ij[0] * _horiz_rad[1] / _origin_vec_ij.norm() *
169 (_origin_vec_ij(0) * shape[1](0, 0) + _origin_vec_ij(1) * shape[1](1, 0)) *
172 (_origin_vec_ij(0) * shape[1](0, 1) + _origin_vec_ij(1) * shape[1](1, 1)) *
176 kne(0, 0) += (dEidUi * _vols_ij[0] - dEjdUj * _vols_ij[1]) * _bond_status_ij;
177 kne(0, 1) += (dEjdUj * _vols_ij[1] - dEidUi * _vols_ij[0]) * _bond_status_ij;
182 unsigned int jvar_num)
184 DenseMatrix<Number> & ken = _assembly.jacobianBlock(_var.number(), jvar_num);
185 DenseMatrix<Number> & kne = _assembly.jacobianBlock(jvar_num, _var.number());
186 MooseVariableScalar & jvar = _sys.getScalarVariable(_tid, jvar_num);
189 for (_i = 0; _i < _test.size(); _i++)
190 for (_j = 0; _j < jvar.order(); _j++)
204 DenseMatrix<Number> & kne = _assembly.jacobianBlock(jvar_num, _var.number());
207 unsigned int nn_i = _pdmesh.getNeighbors(_current_elem->node_id(0)).size();
208 unsigned int nn_j = _pdmesh.getNeighbors(_current_elem->node_id(1)).size();