void CreateD(float elasticModulus, float poissonsRatio) { d = new float[3, 3]; float koeff = elasticModulus / (1 - poissonsRatio * poissonsRatio); d[0, 0] = 1; d[0, 1] = poissonsRatio; d[0, 2] = 0; d[1, 0] = poissonsRatio; d[1, 1] = 1; d[1, 2] = 0; d[2, 0] = 0; d[2, 1] = 0; d[2, 2] = (1 - poissonsRatio) / 2; d = MatrixHelper.MultiplicationMatrixAndNumber(d, koeff); }
void CreateB() { b = new float[3, 6]; b = MatrixHelper.MatrixMultiplication(q, a_1); }
private void buttonSolve_Click(object sender, EventArgs e) { gr.Clear(Color.Linen); elasticModulus = Convert.ToSingle(textBoxElasticModulus.Text); poissonsRatio = Convert.ToSingle(textBoxPoissonsRatio.Text); force2 = Convert.ToSingle(textBoxForce.Text); force1 = force1 + force2; for (int i = 0; i < elements.Count; i++) { elements[i].CreateMatrix(thickness, elasticModulus, poissonsRatio); } globalK = new float[nodes.Count * 2, nodes.Count * 2 + 1]; int[] listIndex = new int[3]; for (int i = 0; i < elements.Count; i++) { listIndex[0] = elements[i].N1.Index; listIndex[1] = elements[i].N2.Index; listIndex[2] = elements[i].N3.Index; for (int j = 0; j < 3; j++) { for (int k = 0; k < 3; k++) { globalK[2 * listIndex[j], 2 * listIndex[k]] = globalK[2 * listIndex[j], 2 * listIndex[k]] + elements[i].K[j * 2, k * 2]; globalK[2 * listIndex[j] + 1, 2 * listIndex[k]] = globalK[2 * listIndex[j] + 1, 2 * listIndex[k]] + elements[i].K[j * 2 + 1, k * 2]; globalK[2 * listIndex[j], 2 * listIndex[k] + 1] = globalK[2 * listIndex[j], 2 * listIndex[k] + 1] + elements[i].K[j * 2, k * 2 + 1]; globalK[2 * listIndex[j] + 1, 2 * listIndex[k] + 1] = globalK[2 * listIndex[j] + 1, 2 * listIndex[k] + 1] + elements[i].K[j * 2 + 1, k * 2 + 1]; } } } for (int i = 0; i < indexNodes1.Length; i++) { globalK[indexNodes1[i] * 2, nodes.Count * 2] = force1; } for (int i = 0; i < indexNodes2.Length; i++) { globalK[indexNodes2[i] * 2 + 1, nodes.Count * 2] = force2; } for (int i = 0; i < nodes.Count; i++) { if (nodes[i].Fixation) { for (int j = 0; j < nodes.Count * 2; j++) { globalK[2 * i, j] = 0; globalK[2 * i + 1, j] = 0; globalK[j, 2 * i] = 0; globalK[j, 2 * i + 1] = 0; } globalK[2 * i, 2 * i] = 1; globalK[2 * i + 1, 2 * i + 1] = 1; } } globalK = MatrixHelper.Gaus(nodes, globalK); for (int i = 0; i < elements.Count; i++) { elements[i].Sig[0, 0] = globalK[2 * elements[i].N1.Index, 2 * nodes.Count]; elements[i].Sig[1, 0] = globalK[2 * elements[i].N1.Index + 1, 2 * nodes.Count]; elements[i].Sig[2, 0] = globalK[2 * elements[i].N2.Index, 2 * nodes.Count]; elements[i].Sig[3, 0] = globalK[2 * elements[i].N2.Index + 1, 2 * nodes.Count]; elements[i].Sig[4, 0] = globalK[2 * elements[i].N3.Index, 2 * nodes.Count]; elements[i].Sig[5, 0] = globalK[2 * elements[i].N3.Index + 1, 2 * nodes.Count]; } for (int i = 0; i < elements.Count; i++) { elements[i].SolveStress(); } MaxDeformationXAndY(); if (maxStress > dopStress) { labelStresOk.Text = "нет"; } else { labelStresOk.Text = "да"; } }