/// <inheritdoc /> public override Matrix GetGlobalStifnessMatrix() { int[] newOrder; UpdateGeoMatrix(); var E = GetConstitutive(); var b = GetB(out newOrder); var V = Math.Abs(det) / 6; var buf = b.Transpose() * E * b; buf.MultiplyByConstant(V); var currentOrder = new Elo[12]; for (var i = 0; i < 4; i++) { currentOrder[3 * i + 0] = new Elo(newOrder[i], DoF.Dx); currentOrder[3 * i + 1] = new Elo(newOrder[i], DoF.Dy); currentOrder[3 * i + 2] = new Elo(newOrder[i], DoF.Dz); } var bufEx = ElementPermuteHelper.FullyExpand(buf, currentOrder, 4); return(bufEx); }
public Matrix GetGlobalStifnessMatrix_old() { //Code ported from D3_TETRAH.m from fem_toolbox UpdateGeoMatrix(); var J = new Matrix(4, 4); for (var i = 0; i < 4; i++) { J[0, i] = 1; J[1, i] = nodes[i].Location.X; J[2, i] = nodes[i].Location.Y; J[3, i] = nodes[i].Location.Z; } var detJ = J.Determinant(); var V = detJ / 6; var Q = detJ * J.Inverse(); double a1 = a[0]; double b1 = b[0]; double c1 = c[0]; double d1 = d[0]; double a2 = a[1]; double b2 = b[1]; double c2 = c[1]; double d2 = d[1]; double a3 = a[2]; double b3 = b[2]; double c3 = c[2]; double d3 = d[2]; double a4 = a[3]; double b4 = b[3]; double c4 = c[3]; double d4 = d[3]; var B = new Matrix(6, 12);//transpose of b B.FillMatrixRowise( b1, 0, 0, b2, 0, 0, b3, 0, 0, b4, 0, 0, 0, c1, 0, 0, c2, 0, 0, c3, 0, 0, c4, 0, 0, 0, d1, 0, 0, d2, 0, 0, d3, 0, 0, d4, c1, b1, 0, c2, b2, 0, c3, b3, 0, c4, b4, 0, 0, d1, c1, 0, d2, c2, 0, d3, c3, 0, d4, c4, d1, 0, b1, d2, 0, b2, d3, 0, b3, d4, 0, b4); B.MultiplyByConstant(1 / (2 * V)); var miu = this.Nu; var s = (1 - miu); var E = new Matrix(6, 6); E.FillMatrixRowise(1, miu / s, miu / s, 0, 0, 0, miu / s, 1, miu / s, 0, 0, 0, miu / s, miu / s, 1, 0, 0, 0, 0, 0, 0, (1 - 2 * miu) / (2 * s), 0, 0, 0, 0, 0, 0, (1 - 2 * miu) / (2 * s), 0, 0, 0, 0, 0, 0, (1 - 2 * miu) / (2 * s)); E.MultiplyByConstant(this.E * (1 - miu) / ((1 + miu) * (1 - 2 * miu))); var buf = B.Transpose() * E * B; buf.MultiplyByConstant(V); var currentOrder = new Elo[12]; for (var i = 0; i < 4; i++) { currentOrder[3 * i + 0] = new Elo(i, DoF.Dx); currentOrder[3 * i + 1] = new Elo(i, DoF.Dy); currentOrder[3 * i + 2] = new Elo(i, DoF.Dz); } var bufEx = ElementPermuteHelper.FullyExpand(buf, currentOrder, 4); var tmp2 = GetGlobalStifnessMatrix_old(); return(tmp2); }