https://mooseframework.inl.gov
Functions
small_strain_tri_uel.C File Reference

Go to the source code of this file.

Functions

void uel_ (double RHS[], double AMATRX[], double [], double [], int *, int *, int *, double PROPS[], int *NPROPS, double COORDS[], int *, int *, double U_[], double DU_[], double [], double [], int *, double [], double *, int *, int *, int *JELEM, double [], int *, int [], double [], double [], int *, int [], int *, double [], int *, double *, int [], int *, double *)
 

Function Documentation

◆ uel_()

void uel_ ( double  RHS[],
double  AMATRX[],
double  [],
double  [],
int ,
int ,
int ,
double  PROPS[],
int NPROPS,
double  COORDS[],
int ,
int ,
double  U_[],
double  DU_[],
double  [],
double  [],
int ,
double  [],
double *  ,
int ,
int ,
int JELEM,
double  [],
int ,
int  [],
double  [],
double  [],
int ,
int  [],
int ,
double  [],
int ,
double *  ,
int  [],
int ,
double *   
)

Definition at line 23 of file small_strain_tri_uel.C.

59 {
60  if (*NPROPS != 2)
61  mooseError("Wrong number of properties passed in.");
62 
63  // solution at the beginning of the increment
64  Eigen::Matrix<Real, 6, 1> u;
65  u << U_[0], U_[1], U_[2], U_[3], U_[4], U_[5];
66 
67  // current solution increment
68  Eigen::Matrix<Real, 6, 1> du;
69  du << DU_[0], DU_[1], DU_[2], DU_[3], DU_[4], DU_[5];
70 
71  // current solution
72  u += du;
73 
74  const auto & x1 = COORDS[0];
75  const auto & y1 = COORDS[1];
76  const auto & x2 = COORDS[2];
77  const auto & y2 = COORDS[3];
78  const auto & x3 = COORDS[4];
79  const auto & y3 = COORDS[5];
80 
81  const auto x13 = x1 - x3;
82  const auto x21 = x2 - x1;
83  const auto y12 = y1 - y2;
84  const auto y21 = y2 - y1;
85  const auto x31 = x3 - x1;
86  const auto y31 = y3 - y1;
87  const auto x32 = x3 - x2;
88  const auto y23 = y2 - y3;
89 
90  // Element Jacobian
91  Eigen::Matrix<Real, 2, 2> J;
92  J << x21, y21, //
93  x31, y31; //
94 
95  const auto Jdet = J.determinant();
96  if (Jdet <= 0)
97  mooseError("Negative Jacobian in element ", *JELEM);
98 
99  // const auto Jinv = J.inverse();
100 
101  // Area
102  const auto A = Jdet / 2.0;
103 
104  Eigen::Matrix<Real, 3, 6> B;
105  B << y23, 0.0, y31, 0.0, y12, 0.0, //
106  0.0, x32, 0.0, x13, 0.0, x21, //
107  x32, y23, x13, y31, x21, y12;
108  B *= 1.0 / Jdet;
109 
110  const auto Bt = B.transpose();
111 
112  // element thickness
113  const Real t = 1.0;
114 
115  // Young's Modulus
116  const auto Y = PROPS[0];
117 
118  // Poisson's ratio
119  const auto nu = PROPS[1];
120 
121  Eigen::Matrix<Real, 3, 3> E;
122 
123  // plane stress
124  // E << 1.0, nu, 0.0, //
125  // nu, 1.0, 0.0, //
126  // 0.0, 0.0, (1.0 - nu) / 2.0;
127  // E *= Y / (1.0 - nu * nu);
128 
129  // plane strain
130  E << 1.0 - nu, nu, 0.0, //
131  nu, 1.0 - nu, 0.0, //
132  0.0, 0.0, (1.0 - 2.0 * nu) / 2.0;
133  E *= Y / (1.0 + nu) / (1.0 - 2.0 * nu);
134 
135  // integrating the CST to obtain the Element characteristic matrix (6,6)
136  const auto ke = Bt * E * B * t * A;
137 
138  // nodal forces
139  const auto re = ke * u;
140 
141  // copy residual (nodal forces) and Jacobian (Element characteristic matrix)
142  for (const auto i : make_range(6))
143  {
144  RHS[i] = -re(i);
145  for (const auto j : make_range(6))
146  AMATRX[i * 6 + j] = -ke(i, j);
147  }
148 }
void mooseError(Args &&... args)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
IntRange< T > make_range(T beg, T end)
static const std::complex< double > j(0, 1)
Complex number "j" (also known as "i")