private void CalculateStrains(IElement element, double[][] tx_i) { IReadOnlyList <double[]> shapeFunctions = Interpolation.EvaluateFunctionsAtGaussPoints(QuadratureForStiffness); IReadOnlyList <Matrix> shapeFunctionsDerivatives = Interpolation.EvaluateNaturalGradientsAtGaussPoints(QuadratureForStiffness); (Matrix[] ll1, Matrix[] J_0a) = JacobianShell8Calculations.Getll1AndJ_0a(QuadratureForStiffness, tk, shapeFunctions, shapeFunctionsDerivatives); (Matrix[] J_0inv, double[] detJ_0) = JacobianShell8Calculations.GetJ_0invAndDetJ_0(J_0a, element.Nodes, oVn_i, nGaussPoints); Matrix[] J_1 = JacobianShell8Calculations.Get_J_1(nGaussPoints, tx_i, tU, J_0a); Matrix[] DefGradTr; Matrix[] GL; DefGradTr = new Matrix[nGaussPoints]; GL = new Matrix[nGaussPoints]; for (int j = 0; j < nGaussPoints; j++) { DefGradTr[j] = Matrix.CreateZero(3, 3); GL[j] = Matrix.CreateZero(3, 3); } GLvec = new double[nGaussPoints][]; for (int j = 0; j < nGaussPoints; j++) { DefGradTr[j] = J_0inv[j] * J_1[j]; GL[j] = DefGradTr[j] * DefGradTr[j].Transpose(); for (int k = 0; k < 3; k++) { GL[j][k, k] = GL[j][k, k] - 1; } GL[j].ScaleIntoThis(0.5); GLvec[j] = new double[6]; for (int k = 0; k < 3; k++) { GLvec[j][k] = GL[j][k, k]; } GLvec[j][3] = 2 * GL[j][0, 1]; GLvec[j][4] = 2 * GL[j][1, 2]; GLvec[j][5] = 2 * GL[j][2, 0]; } }
private Matrix UpdateKmatrices(IElement element) { double[][] kck; // 1 per node and (one per Gauss point+1 for the addition) -->[GP][8 dofs_per_node*nodes] Matrix[] KNL; Matrix[] KL; double[][] BL01plus1_2tSPKvec; IReadOnlyList <double[]> shapeFunctions = Interpolation.EvaluateFunctionsAtGaussPoints(QuadratureForStiffness); IReadOnlyList <Matrix> shapeFunctionsDerivatives = Interpolation.EvaluateNaturalGradientsAtGaussPoints(QuadratureForStiffness); (Matrix[] ll1, Matrix[] J_0a) = JacobianShell8Calculations.Getll1AndJ_0a(QuadratureForStiffness, tk, shapeFunctions, shapeFunctionsDerivatives); (Matrix[] J_0inv, double[] detJ_0) = JacobianShell8Calculations.GetJ_0invAndDetJ_0(J_0a, element.Nodes, oVn_i, nGaussPoints); Matrix[] BNL1; BNL1 = GetBNL1(J_0inv); Matrix[] BL13; BL13 = GetBL13(shapeFunctionsDerivatives, tUvec, J_0a); //TODO: maybe cached from calcForces for problems of normal memory requirements double[][,] ck; ck = CalculateCk(J_0a, tU); // Matrix[] BL11a; //TODO: maybe cached from calcForces for problems of normal memory BL11a = GetBL11a(J_0inv); Matrix[] BL12; BL12 = GetBL12(J_0inv); // Matrix[] BL; //TODO: maybe cached from calcForces for problems of normal memory BL = new Matrix[nGaussPoints]; Matrix[] BL01plus1_2; BL01plus1_2 = new Matrix[nGaussPoints]; for (int j = 0; j < nGaussPoints; j++) { BL[j] = Matrix.CreateZero(6, 40); BL01plus1_2[j] = Matrix.CreateZero(6, 9); } // var ll2 = Matrix.CreateZero(24, 3); for (int j = 0; j < 8; j++) { for (int k = 0; k < 3; k++) { ll2[3 * j + 0, k] = tU[j][k]; ll2[3 * j + 1, k] = tU[j][3 + k]; ll2[3 * j + 2, k] = oVn_i[j][k]; } } Matrix[] l_circumflex; l_circumflex = new Matrix[nGaussPoints]; for (int j = 0; j < nGaussPoints; j++) { l_circumflex[j] = Matrix.CreateZero(3, 3); } for (int j = 0; j < nGaussPoints; j++) { l_circumflex[j] = ll1[j] * ll2; } Matrix[] BL11b; BL11b = new Matrix[nGaussPoints]; for (int j = 0; j < nGaussPoints; j++) { BL11b[j] = Matrix.CreateZero(9, 9); } for (int j = 0; j < nGaussPoints; j++) { for (int k = 0; k < 3; k++) { for (int l = 0; l < 3; l++) { for (int m = 0; m < 3; m++) { BL11b[j][3 * k + l, 3 * k + m] = l_circumflex[j][l, m]; } } } } Matrix[] BL11; BL11 = new Matrix[nGaussPoints]; for (int j = 0; j < nGaussPoints; j++) { BL11[j] = Matrix.CreateZero(6, 9); } for (int j = 0; j < nGaussPoints; j++) { BL11[j] = BL11a[j] * BL11b[j]; } Matrix[] BL1_2; BL1_2 = new Matrix[nGaussPoints]; for (int j = 0; j < nGaussPoints; j++) { BL1_2[j] = Matrix.CreateZero(6, 9); } for (int j = 0; j < nGaussPoints; j++) { BL1_2[j] = BL11[j] * BL12[j]; for (int k = 0; k < 6; k++) { for (int l = 0; l < 9; l++) { BL01plus1_2[j][k, l] = BL1_2[j][k, l] + BL11a[j][k, l]; } } BL[j] = BL01plus1_2[j] * BL13[j]; } KL = new Matrix[nGaussPoints + 1]; KNL = new Matrix[nGaussPoints + 1]; kck = new double[nGaussPoints + 1][]; BL01plus1_2tSPKvec = new double[nGaussPoints][]; for (int j = 0; j < nGaussPoints + 1; j++) { KL[j] = Matrix.CreateZero(40, 40); KNL[j] = Matrix.CreateZero(40, 40); } for (int j = 0; j < nGaussPoints; j++) { var SPK_circumflex = Matrix.CreateZero(9, 9); for (int k = 0; k < 3; k++) { for (int l = 0; l < 3; l++) { SPK_circumflex[3 * k + l, 3 * k + l] = materialsAtGaussPoints[j].Stresses[l]; } SPK_circumflex[3 * k, 3 * k + 1] = materialsAtGaussPoints[j].Stresses[3]; SPK_circumflex[3 * k, 3 * k + 2] = materialsAtGaussPoints[j].Stresses[5]; SPK_circumflex[3 * k + 1, 3 * k + 2] = materialsAtGaussPoints[j].Stresses[4]; SPK_circumflex[3 * k + 1, 3 * k] = materialsAtGaussPoints[j].Stresses[3]; SPK_circumflex[3 * k + 2, 3 * k] = materialsAtGaussPoints[j].Stresses[5]; SPK_circumflex[3 * k + 2, 3 * k + 1] = materialsAtGaussPoints[j].Stresses[4]; } var BNL = BNL1[j] * BL13[j]; BL01plus1_2tSPKvec[j] = new double[9]; for (int k = 0; k < 9; k++) { for (int m = 0; m < 6; m++) { BL01plus1_2tSPKvec[j][k] += BL01plus1_2[j][m, k] * materialsAtGaussPoints[j].Stresses[m]; } } kck[j] = new double[8]; for (int k = 0; k < 8; k++) { for (int m = 0; m < 9; m++) { kck[j][k] += ck[j][k, m] * BL01plus1_2tSPKvec[j][m]; } } var ConsBL = Matrix.CreateZero(6, 40); for (int k = 0; k < 6; k++) { for (int l = 0; l < 40; l++) { for (int m = 0; m < 6; m++) { ConsBL[k, l] += materialsAtGaussPoints[j].ConstitutiveMatrix[k, m] * BL[j][m, l]; } } } var S_BNL = SPK_circumflex * BNL; KNL[j] = BNL.Transpose() * S_BNL; KL[j] = BL[j].Transpose() * ConsBL; } var Kt = Matrix.CreateZero(40, 40); for (int j = 0; j < nGaussPoints; j++) { for (int k = 0; k < 40; k++) { for (int l = 0; l < 40; l++) { Kt[k, l] += integrationCoefficient[j] * (KL[j][k, l] + KNL[j][k, l]); } } for (int l = 0; l < 8; l++) { Kt[5 * l + 3, 5 * l + 3] += integrationCoefficient[j] * kck[j][l]; Kt[5 * l + 4, 5 * l + 4] += integrationCoefficient[j] * kck[j][l]; } } return(Kt); }
private double[] UpdateForces(IElement element) { IReadOnlyList <double[]> shapeFunctions = Interpolation.EvaluateFunctionsAtGaussPoints(QuadratureForStiffness); IReadOnlyList <Matrix> shapeFunctionsDerivatives = Interpolation.EvaluateNaturalGradientsAtGaussPoints(QuadratureForStiffness); (Matrix[] ll1, Matrix[] J_0a) = JacobianShell8Calculations.Getll1AndJ_0a(QuadratureForStiffness, tk, shapeFunctions, shapeFunctionsDerivatives); //BL11a etc. are not cached currently(declare here) (Matrix[] J_0inv, double[] detJ_0) = JacobianShell8Calculations.GetJ_0invAndDetJ_0(J_0a, element.Nodes, oVn_i, nGaussPoints); Matrix[] BL11a; BL11a = GetBL11a(J_0inv); Matrix[] BL12; BL12 = GetBL12(J_0inv); Matrix[] BL13; BL13 = GetBL13(shapeFunctionsDerivatives, tUvec, J_0a); Matrix[] BL; BL = new Matrix[nGaussPoints]; Matrix[] BL01plus1_2; BL01plus1_2 = new Matrix[nGaussPoints]; for (int j = 0; j < nGaussPoints; j++) { BL[j] = Matrix.CreateZero(6, 40); BL01plus1_2[j] = Matrix.CreateZero(6, 9); } double[][] Fxk = new double[nGaussPoints + 1][]; for (int j = 0; j < nGaussPoints + 1; j++) { Fxk[j] = new double[40]; } Matrix ll2; ll2 = Matrix.CreateZero(24, 3); for (int j = 0; j < 8; j++) { for (int k = 0; k < 3; k++) { ll2[3 * j + 0, k] = tU[j][k]; ll2[3 * j + 1, k] = tU[j][3 + k]; ll2[3 * j + 2, k] = oVn_i[j][k]; } } Matrix[] l_circumflex; l_circumflex = new Matrix[nGaussPoints]; for (int j = 0; j < nGaussPoints; j++) { l_circumflex[j] = Matrix.CreateZero(3, 3); } for (int j = 0; j < nGaussPoints; j++) { l_circumflex[j] = ll1[j] * ll2; } Matrix[] BL11b; BL11b = new Matrix[nGaussPoints]; for (int j = 0; j < nGaussPoints; j++) { BL11b[j] = Matrix.CreateZero(9, 9); } for (int j = 0; j < nGaussPoints; j++) { for (int k = 0; k < 3; k++) { for (int l = 0; l < 3; l++) { for (int m = 0; m < 3; m++) { BL11b[j][3 * k + l, 3 * k + m] = l_circumflex[j][l, m]; } //don;t change that } } } Matrix[] BL11; BL11 = new Matrix[nGaussPoints]; for (int j = 0; j < nGaussPoints; j++) { BL11[j] = BL11a[j] * BL11b[j]; } Matrix[] BL1_2; BL1_2 = new Matrix[nGaussPoints]; for (int j = 0; j < nGaussPoints; j++) { BL1_2[j] = BL11[j] * BL12[j]; for (int k = 0; k < 6; k++) { for (int l = 0; l < 9; l++) { BL01plus1_2[j][k, l] = BL1_2[j][k, l] + BL11a[j][k, l]; } } BL[j] = BL01plus1_2[j] * BL13[j]; } for (int j = 0; j < nGaussPoints; j++) { for (int k = 0; k < 40; k++) { Fxk[j][k] = 0; for (int m = 0; m < 6; m++) { Fxk[j][k] += BL[j][m, k] * materialsAtGaussPoints[j].Stresses[m]; } } } for (int k = 0; k < 40; k++) { Fxk[nGaussPoints][k] = 0; for (int j = 0; j < nGaussPoints; j++) { Fxk[nGaussPoints][k] += integrationCoefficient[j] * Fxk[j][k]; } } return(Fxk[nGaussPoints]); }
private void CalculateInitialConfigurationData(IElement element, out double[][] tx_i) { double[] E; double[] ni; IReadOnlyList <double[]> shapeFunctions = Interpolation.EvaluateFunctionsAtGaussPoints(QuadratureForStiffness); IReadOnlyList <Matrix> shapeFunctionsDerivatives = Interpolation.EvaluateNaturalGradientsAtGaussPoints(QuadratureForStiffness); (Matrix[] ll1, Matrix[] J_0a) = JacobianShell8Calculations.Getll1AndJ_0a( QuadratureForStiffness, tk, shapeFunctions, shapeFunctionsDerivatives); //TODO J_0, J_0b etc. can be cached for not large scale models tx_i = new double[8][]; (tU, tUvec) = Shell8DirectionVectorUtilities.GetInitialDirectionVectorValues(oVn_i); double[][] oV1_i = new double[8][]; //tangent vector ''1'' initial configuration for (int j = 0; j < 8; j++) { tx_i[j] = new double[] { element.Nodes[j].X, element.Nodes[j].Y, element.Nodes[j].Z, }; oV1_i[j] = new double[3]; oV1_i[j][0] = tUvec[j][0]; oV1_i[j][1] = tUvec[j][1]; oV1_i[j][2] = tUvec[j][2]; } (Matrix[] J_0inv, double[] detJ_0) = JacobianShell8Calculations.GetJ_0invAndDetJ_0(J_0a, element.Nodes, oVn_i, nGaussPoints); for (int j = 0; j < nGaussPoints; j++) { double[] V3 = new double[3]; double V3_norm; double[] V1 = new double[3]; double V1_norm; for (int k = 0; k < 3; k++) { V3[k] = 0; V1[k] = 0; /* V2[k] = 0; */ } for (int k = 0; k < 8; k++) { for (int l = 0; l < 3; l++) { V3[l] += shapeFunctions[j][k] * oVn_i[k][l]; V1[l] += shapeFunctions[j][k] * oV1_i[k][l]; } } V3_norm = Math.Sqrt(V3[0] * V3[0] + V3[1] * V3[1] + V3[2] * V3[2]); V1_norm = Math.Sqrt(V1[0] * V1[0] + V1[1] * V1[1] + V1[2] * V1[2]); for (int l = 0; l < 3; l++) { V3[l] = V3[l] / V3_norm; V1[l] = V1[l] / V1_norm; } materialsAtGaussPoints[j].NormalVectorV3 = V3; materialsAtGaussPoints[j].TangentVectorV1 = V1; } integrationCoefficient = new double[nGaussPoints]; for (int j = 0; j < nGaussPoints; j++) { integrationCoefficient[j] += QuadratureForStiffness.IntegrationPoints[j].Weight * detJ_0[j]; } }