public ContinuumElement3D CreateElement(CellType cellType, IReadOnlyList<Node> nodes, ElasticMaterial3D commonMaterial, DynamicMaterial commonDynamicProperties) { int numGPs = integrationsForStiffness[cellType].IntegrationPoints.Count; var materialsAtGaussPoints = new ElasticMaterial3D[numGPs]; for (int gp = 0; gp < numGPs; ++gp) materialsAtGaussPoints[gp] = commonMaterial.Clone(); return CreateElement(cellType, nodes, materialsAtGaussPoints, commonDynamicProperties); }
public void ContinuumElement3DElasticMaterialDynamicConsistent() { IList <Node> nodes = new List <Node>(); // Create Model var model = new Model(); // Create Subdomain model.SubdomainsDictionary.Add(subdomainID, new Subdomain(subdomainID)); // Create Elastic Material var solidMaterial = new ElasticMaterial3D() { YoungModulus = youngModulus, PoissonRatio = poissonRatio, }; // Create Dynamic Material var dynamicMaterial = new DynamicMaterial(density, 0, 0, true); DefineContinuumElement3DLinear(model, solidMaterial, dynamicMaterial); BoundaryConditions(model); // Choose linear equation system solver var solverBuilder = new SkylineSolver.Builder(); SkylineSolver solver = solverBuilder.BuildSolver(model); // Choose the provider of the problem -> here a structural problem var provider = new ProblemStructural(model, solver); // Choose child analyzer -> Linear var childAnalyzer = new LinearAnalyzer(model, solver, provider); // Choose parent analyzer -> Parent: Static var parentAnalyzerBuilder = new NewmarkDynamicAnalyzer.Builder(model, solver, provider, childAnalyzer, 1.0, 100.0); parentAnalyzerBuilder.SetNewmarkParametersForConstantAcceleration(); NewmarkDynamicAnalyzer parentAnalyzer = parentAnalyzerBuilder.Build(); // Request output childAnalyzer.LogFactories[subdomainID] = new LinearAnalyzerLogFactory(new int[] { monitorDof }); // Run the analysis parentAnalyzer.Initialize(); parentAnalyzer.Solve(); // Check output DOFSLog log = (DOFSLog)childAnalyzer.Logs[subdomainID][0]; double computedValue = log.DOFValues[monitorDof]; double expectedValue = 0.531178; // consistent: 0.531178 // lumped: 0.894201 Assert.Equal(expectedValue, computedValue, 3); }
public static void EmbeddedElementsBuilder(Model model) { // define mechanical properties double youngModulus = 1.0; double shearModulus = 1.0; double poissonRatio = (youngModulus / (2 * shearModulus)) - 1; double area = 1776.65; // CNT(20,20)-LinearEBE-TBT-L = 10nm double inertiaY = 1058.55; double inertiaZ = 1058.55; double torsionalInertia = 496.38; double effectiveAreaY = area; double effectiveAreaZ = area; // Geometry model.NodesDictionary.Add(9, new Node(id: 9, x: 0.00, y: 0.00, z: 0.00)); model.NodesDictionary.Add(10, new Node(id: 10, x: 10.00, y: 0.00, z: 0.00)); // Create new 3D material var beamMaterial = new ElasticMaterial3D() { YoungModulus = youngModulus, PoissonRatio = poissonRatio, }; // Create new Beam3D section and element var beamSection = new BeamSection3D(area, inertiaY, inertiaZ, torsionalInertia, effectiveAreaY, effectiveAreaZ); // element nodes var elementNodes = new List <Node>(); elementNodes.Add(model.NodesDictionary[9]); elementNodes.Add(model.NodesDictionary[10]); var beam = new Beam3DCorotationalQuaternion(elementNodes, beamMaterial, 7.85, beamSection); var beamElement = new Element { ID = 2, ElementType = beam }; beamElement.NodesDictionary.Add(9, model.NodesDictionary[9]); beamElement.NodesDictionary.Add(10, model.NodesDictionary[10]); model.ElementsDictionary.Add(beamElement.ID, beamElement); model.SubdomainsDictionary[1].Elements.Add(beamElement); }
public static (double[], double[], double[], double[], IVector, IVector) Check05bStressIntegrationObje_Integration() { //Origin: SeparateCodeCheckingClass.Check05bStressIntegration //modifications: tha xrhsimopoithei h nea microstructure me obje kapoia subdomainCalculations double E_disp = 3.5; /*Gpa*/ double ni_disp = 0.4; // stather Poisson var material1 = new ElasticMaterial3D() { YoungModulus = E_disp, PoissonRatio = ni_disp, }; double[,] DGtr = new double[3, 3] { { 1.10, 0, 0 }, { 0, 1, 0 }, { 0, 0, 1 } }; double[] GLVec = Transform_DGtr_to_GLvec(DGtr); material1.UpdateMaterial(GLVec); //double[] stressesCheck1 = material1.Stresses; double[] stressesCheck1 = new double[6] { material1.Stresses[0], material1.Stresses[1], material1.Stresses[2], material1.Stresses[3], material1.Stresses[4], material1.Stresses[5] }; DGtr = new double[3, 3] { { 1.20, 0, 0 }, { 0, 1, 0 }, { 0, 0, 1 } }; GLVec = Transform_DGtr_to_GLvec(DGtr); material1.UpdateMaterial(GLVec); material1.SaveState(); double[] stressesCheck2 = material1.Stresses; //VectorExtensions.AssignTotalAffinityCount(); IRVEbuilder homogeneousRveBuilder1 = new HomogeneousRVEBuilderNonLinear(); //IRVEbuilder homogeneousRveBuilder1 = new HomogeneousRVEBuilderCheckEnaHexa(); //IContinuumMaterial3DDefGrad var microstructure3 = new MicrostructureDefGrad3D(homogeneousRveBuilder1, model => (new SkylineSolver.Builder()).BuildSolver(model), false, 1); //IContinuumMaterial3DDefGrad microstructure3copyConsCheck = new Microstructure3copyConsCheckEna(homogeneousRveBuilder1); double[,] consCheck1 = new double[6, 6]; for (int i1 = 0; i1 < 6; i1++) { for (int i2 = 0; i2 < 6; i2++) { consCheck1[i1, i2] = microstructure3.ConstitutiveMatrix[i1, i2]; } } microstructure3.UpdateMaterial(new double[9] { 1.10, 1, 1, 0, 0, 0, 0, 0, 0 }); double[] stressesCheck3 = microstructure3.Stresses; microstructure3.SaveState(); IVector uInitialFreeDOFs_state1 = microstructure3.uInitialFreeDOFDisplacementsPerSubdomain[1].Copy(); microstructure3.UpdateMaterial(new double[9] { 1.20, 1, 1, 0, 0, 0, 0, 0, 0 }); double[] stressesCheck4 = microstructure3.Stresses; IVector uInitialFreeDOFs_state2 = microstructure3.uInitialFreeDOFDisplacementsPerSubdomain[1].Copy(); //PrintUtilities.WriteToFileVector(uInitialFreeDOFs_state1.CopyToArray(), @"C:\Users\turbo-x\Desktop\notes_elegxoi\MSOLVE_output_2\uInitialFreeDOFs_state1.txt"); //PrintUtilities.WriteToFileVector(uInitialFreeDOFs_state2.CopyToArray(), @"C:\Users\turbo-x\Desktop\notes_elegxoi\MSOLVE_output_2\uInitialFreeDOFs_state2.txt"); return(stressesCheck1, stressesCheck2, stressesCheck3, stressesCheck4, uInitialFreeDOFs_state1, uInitialFreeDOFs_state2); }
private static void BuildCantileverModel(Model model, double load_value) { //xrhsimopoiithike to ParadeigmataElegxwnBuilder.HexaCantileverBuilder(Model model, double load_value) // allagh tou element kai tou material //ElasticMaterial3DTemp material1 = new ElasticMaterial3DTemp() //{ // YoungModulus = 1353000, // PoissonRatio = 0.3, //}; //VonMisesMaterial3D material1 = new VonMisesMaterial3D(1353000, 0.30, 1353000, 0.15); var material1 = new ElasticMaterial3D() { PoissonRatio = 0.3, YoungModulus = 1353000 }; double[,] nodeData = new double[, ] { { -0.250000, -0.250000, -1.000000 }, { 0.250000, -0.250000, -1.000000 }, { -0.250000, 0.250000, -1.000000 }, { 0.250000, 0.250000, -1.000000 }, { -0.250000, -0.250000, -0.500000 }, { 0.250000, -0.250000, -0.500000 }, { -0.250000, 0.250000, -0.500000 }, { 0.250000, 0.250000, -0.500000 }, { -0.250000, -0.250000, 0.000000 }, { 0.250000, -0.250000, 0.000000 }, { -0.250000, 0.250000, 0.000000 }, { 0.250000, 0.250000, 0.000000 }, { -0.250000, -0.250000, 0.500000 }, { 0.250000, -0.250000, 0.500000 }, { -0.250000, 0.250000, 0.500000 }, { 0.250000, 0.250000, 0.500000 }, { -0.250000, -0.250000, 1.000000 }, { 0.250000, -0.250000, 1.000000 }, { -0.250000, 0.250000, 1.000000 }, { 0.250000, 0.250000, 1.000000 } }; int[,] elementData = new int[, ] { { 1, 8, 7, 5, 6, 4, 3, 1, 2 }, { 2, 12, 11, 9, 10, 8, 7, 5, 6 }, { 3, 16, 15, 13, 14, 12, 11, 9, 10 }, { 4, 20, 19, 17, 18, 16, 15, 13, 14 }, }; // orismos shmeiwn double correction = 10;// +20; for (int nNode = 0; nNode < nodeData.GetLength(0); nNode++) { model.NodesDictionary.Add(nNode + 1, new Node(nNode + 1, nodeData[nNode, 0] + correction, nodeData[nNode, 1] + correction, nodeData[nNode, 2] + correction)); } // orismos elements Element e1; int subdomainID = Hexa8Continuum3DLinearCantilever.subdomainID; int[] ContinuumHexa8NodesNumbering = new int[8] { 7, 8, 5, 6, 3, 4, 1, 2 }; // { 2, 3, 7, 6, 1, 4, 8, 5 }; for (int nElement = 0; nElement < elementData.GetLength(0); nElement++) { DynamicMaterial DynamicMaterial = new DynamicMaterial(1, 0, 0); //Dictionary<int,Node3D > List <Node> nodeSet = new List <Node>(8); for (int j = 0; j < 8; j++) { int nodeID = elementData[nElement, j + 1]; nodeSet.Add((Node)model.NodesDictionary[nodeID]); } var factory = new ContinuumElement3DFactory(material1, DynamicMaterial); //e1 = factory.CreateElement(CellType3D.Hexa8, nodeSet); e1 = new Element() { ID = nElement + 1, ElementType = factory.CreateElement(CellType.Hexa8, nodeSet) // dixws to e. exoume sfalma enw sto beambuilding oxi//edw kaleitai me ena orisma to Hexa8 }; for (int j = 0; j < 8; j++) { int nodeID = elementData[nElement, j + 1]; e1.NodesDictionary.Add(nodeID, model.NodesDictionary[nodeID]); } model.ElementsDictionary.Add(e1.ID, e1); model.SubdomainsDictionary[subdomainID].Elements.Add(e1); } // constraint vashh opou z=-1 for (int k = 1; k < 5; k++) { model.NodesDictionary[k].Constraints.Add(new Constraint { DOF = StructuralDof.TranslationX }); model.NodesDictionary[k].Constraints.Add(new Constraint { DOF = StructuralDof.TranslationY }); model.NodesDictionary[k].Constraints.Add(new Constraint { DOF = StructuralDof.TranslationZ }); } // fortish korufhs Load load1; for (int k = 17; k < 21; k++) { load1 = new Load() { Node = model.NodesDictionary[k], DOF = StructuralDof.TranslationX, Amount = 1 * load_value }; model.Loads.Add(load1); } }
private static void BuildCantileverModel(Model model, double load_value) { var material1 = new ElasticMaterial3D() { PoissonRatio = 0.3, YoungModulus = 1353000 }; double[,] nodeData = new double[, ] { //{-0.250000,-0.250000,-1.000000}, {0.250000,-0.250000,-1.000000}, {-0.250000,0.250000,-1.000000}, {0.250000,0.250000,-1.000000}, //{-0.250000,-0.250000,-0.500000}, {0.250000,-0.250000,-0.500000}, {-0.250000,0.250000,-0.500000}, {0.250000,0.250000,-0.500000}, //{-0.250000,-0.250000,0.000000}, {0.250000,-0.250000,0.000000}, {-0.250000,0.250000,0.000000}, {0.250000,0.250000,0.000000}, //{-0.250000,-0.250000,0.500000}, {0.250000,-0.250000,0.500000}, {-0.250000,0.250000,0.500000}, {0.250000,0.250000,0.500000}, //{-0.250000,-0.250000,1.000000}, {0.250000,-0.250000,1.000000}, {-0.250000,0.250000,1.000000}, {0.250000,0.250000,1.000000}, //}; { -0.250000, -0.250000, -2.000000 }, { 0.250000, -0.250000, -2.000000 }, { -0.250000, 0.250000, -2.000000 }, { 0.250000, 0.250000, -2.000000 }, { -0.250000, -0.250000, -1.500000 }, { 0.250000, -0.250000, -1.500000 }, { -0.250000, 0.250000, -1.500000 }, { 0.250000, 0.250000, -1.500000 }, { -0.250000, -0.250000, -1.000000 }, { 0.250000, -0.250000, -1.000000 }, { -0.250000, 0.250000, -1.000000 }, { 0.250000, 0.250000, -1.000000 }, { -0.250000, -0.250000, -0.500000 }, { 0.250000, -0.250000, -0.500000 }, { -0.250000, 0.250000, -0.500000 }, { 0.250000, 0.250000, -0.500000 }, { -0.250000, -0.250000, 0.000000 }, { 0.250000, -0.250000, 0.000000 }, { -0.250000, 0.250000, 0.000000 }, { 0.250000, 0.250000, 0.000000 }, { -0.250000, -0.250000, 0.500000 }, { 0.250000, -0.250000, 0.500000 }, { -0.250000, 0.250000, 0.500000 }, { 0.250000, 0.250000, 0.500000 }, { -0.250000, -0.250000, 1.000000 }, { 0.250000, -0.250000, 1.000000 }, { -0.250000, 0.250000, 1.000000 }, { 0.250000, 0.250000, 1.000000 }, { -0.250000, -0.250000, 1.500000 }, { 0.250000, -0.250000, 1.500000 }, { -0.250000, 0.250000, 1.500000 }, { 0.250000, 0.250000, 1.500000 }, { -0.250000, -0.250000, 2.000000 }, { 0.250000, -0.250000, 2.000000 }, { -0.250000, 0.250000, 2.000000 }, { 0.250000, 0.250000, 2.000000 }, }; int[,] elementData = new int[, ] { //{1,8,7,5,6,4,3,1,2}, //{2,12,11,9,10,8,7,5,6}, //{3,16,15,13,14,12,11,9,10}, //{4,20,19,17,18,16,15,13,14}, { 1, 8, 7, 5, 6, 4, 3, 1, 2 }, { 2, 12, 11, 9, 10, 8, 7, 5, 6 }, { 3, 16, 15, 13, 14, 12, 11, 9, 10 }, { 4, 20, 19, 17, 18, 16, 15, 13, 14 }, { 5, 24, 23, 21, 22, 20, 19, 17, 18 }, { 6, 28, 27, 25, 26, 24, 23, 21, 22 }, { 7, 32, 31, 29, 30, 28, 27, 25, 26 }, { 8, 36, 35, 33, 34, 32, 31, 29, 30 }, }; // Put nodes and nodal coordinates in model for (int nNode = 0; nNode < nodeData.GetLength(0); nNode++) { model.NodesDictionary.Add(nNode + 1, new Node(id: nNode + 1, x: nodeData[nNode, 0], y: nodeData[nNode, 1], z: nodeData[nNode, 2])); } // Define elements Element e1; int subdomainID = Hexa8NonLinearCantilever.subdomainID; for (int nElement = 0; nElement < elementData.GetLength(0); nElement++) { e1 = new Element() { ID = nElement + 1, ElementType = new Hexa8NonLinear(material1, GaussLegendre3D.GetQuadratureWithOrder(3, 3, 3)) // dixws to e. exoume sfalma enw sto beambuilding oxi//edw kaleitai me ena orisma to Hexa8 }; for (int j = 0; j < 8; j++) { e1.NodesDictionary.Add(elementData[nElement, j + 1], model.NodesDictionary[elementData[nElement, j + 1]]); } model.ElementsDictionary.Add(e1.ID, e1); model.SubdomainsDictionary[subdomainID].Elements.Add(e1.ID, e1); } // Constrain nodes at z = -1 for (int k = 1; k <= 4; k++) { model.NodesDictionary[k].Constraints.Add(new Constraint { DOF = StructuralDof.TranslationX }); model.NodesDictionary[k].Constraints.Add(new Constraint { DOF = StructuralDof.TranslationY }); model.NodesDictionary[k].Constraints.Add(new Constraint { DOF = StructuralDof.TranslationZ }); } // Top load Load load1; //for (int k = 17; k <= 20; k++) for (int k = 33; k <= 36; k++) { load1 = new Load() { Node = model.NodesDictionary[k], DOF = StructuralDof.TranslationY, Amount = 1 * load_value }; model.Loads.Add(load1); } }
private static void BuildCantileverModel(Model model, double load_value) { //xrhsimopoiithike to ParadeigmataElegxwnBuilder.HexaCantileverBuilder(Model model, double load_value) // allagh tou element kai tou material //ElasticMaterial3DTemp material1 = new ElasticMaterial3DTemp() //{ // YoungModulus = 1353000, // PoissonRatio = 0.3, //}; //VonMisesMaterial3D material1 = new VonMisesMaterial3D(1353000, 0.30, 1353000, 0.15); var material1 = new ElasticMaterial3D() { PoissonRatio = 0.3, YoungModulus = 1353000 }; double[,] nodeData = new double[, ] { { -0.250000, -0.250000, -1.000000 }, { 0.250000, -0.250000, -1.000000 }, { -0.250000, 0.250000, -1.000000 }, { 0.250000, 0.250000, -1.000000 }, { -0.250000, -0.250000, -0.500000 }, { 0.250000, -0.250000, -0.500000 }, { -0.250000, 0.250000, -0.500000 }, { 0.250000, 0.250000, -0.500000 }, { -0.250000, -0.250000, 0.000000 }, { 0.250000, -0.250000, 0.000000 }, { -0.250000, 0.250000, 0.000000 }, { 0.250000, 0.250000, 0.000000 }, { -0.250000, -0.250000, 0.500000 }, { 0.250000, -0.250000, 0.500000 }, { -0.250000, 0.250000, 0.500000 }, { 0.250000, 0.250000, 0.500000 }, { -0.250000, -0.250000, 1.000000 }, { 0.250000, -0.250000, 1.000000 }, { -0.250000, 0.250000, 1.000000 }, { 0.250000, 0.250000, 1.000000 } }; int[,] elementData = new int[, ] { { 1, 8, 7, 5, 6, 4, 3, 1, 2 }, { 2, 12, 11, 9, 10, 8, 7, 5, 6 }, { 3, 16, 15, 13, 14, 12, 11, 9, 10 }, { 4, 20, 19, 17, 18, 16, 15, 13, 14 }, }; // orismos shmeiwn for (int nNode = 0; nNode < nodeData.GetLength(0); nNode++) { model.NodesDictionary.Add(nNode + 1, new Node(id: nNode + 1, x: nodeData[nNode, 0], y: nodeData[nNode, 1], z: nodeData[nNode, 2])); } // orismos elements Element e1; int subdomainID = Hexa8NonLinearCantilever.subdomainID; for (int nElement = 0; nElement < elementData.GetLength(0); nElement++) { e1 = new Element() { ID = nElement + 1, ElementType = new Hexa8NonLinear(material1, GaussLegendre3D.GetQuadratureWithOrder(3, 3, 3)) // dixws to e. exoume sfalma enw sto beambuilding oxi//edw kaleitai me ena orisma to Hexa8 }; for (int j = 0; j < 8; j++) { e1.NodesDictionary.Add(elementData[nElement, j + 1], model.NodesDictionary[elementData[nElement, j + 1]]); } model.ElementsDictionary.Add(e1.ID, e1); model.SubdomainsDictionary[subdomainID].Elements.Add(e1); } // constraint vashh opou z=-1 for (int k = 1; k < 5; k++) { model.NodesDictionary[k].Constraints.Add(new Constraint { DOF = StructuralDof.TranslationX }); model.NodesDictionary[k].Constraints.Add(new Constraint { DOF = StructuralDof.TranslationY }); model.NodesDictionary[k].Constraints.Add(new Constraint { DOF = StructuralDof.TranslationZ }); } // fortish korufhs Load load1; for (int k = 17; k < 21; k++) { load1 = new Load() { Node = model.NodesDictionary[k], DOF = StructuralDof.TranslationX, Amount = 1 * load_value }; model.Loads.Add(load1); } }
public static void CNT_4_4_DisplacementControl() { double youngModulus = 16710.0; double poissonRatio = 0.034; double nodalDisplacement = 23.73; double area = 5.594673861218848e-003; double inertiaY = 2.490804749753243e-006; double inertiaZ = 2.490804749753243e-006; double torsionalInertia = inertiaY / 2.0; double effectiveAreaY = area; double effectiveAreaZ = area; string workingDirectory = @"..\..\..\Resources\Beam3DInputFiles"; string geometryFileName = "CNT-4-4-L=25-Geometry.inp"; string connectivityFileName = "CNT-4-4-L=25-ConnMatr.inp"; int increments = 20; int nNodes = File.ReadLines(workingDirectory + '\\' + geometryFileName).Count(); int nElems = File.ReadLines(workingDirectory + '\\' + connectivityFileName).Count(); int monitorNode_1 = nNodes - 1; int monitorNode_2 = nNodes; // Create new 3D material var material_1 = new ElasticMaterial3D { YoungModulus = youngModulus, PoissonRatio = poissonRatio, }; var material_2 = new ElasticMaterial3D { YoungModulus = 100.0 * youngModulus, PoissonRatio = poissonRatio, }; // Model creation Model model = new Model(); // Subdomains model.SubdomainsDictionary.Add(1, new Subdomain(1)); // Node creation IList <Node> nodes = new List <Node>(); using (TextReader reader = File.OpenText(workingDirectory + '\\' + geometryFileName)) { for (int i = 0; i < nNodes; i++) { string text = reader.ReadLine(); string[] bits = text.Split(','); int nodeID = int.Parse(bits[0]); double nodeX = double.Parse(bits[1]); double nodeY = double.Parse(bits[2]); double nodeZ = double.Parse(bits[3]); nodes.Add(new Node(id: nodeID, x: nodeX, y: nodeY, z: nodeZ)); model.NodesDictionary.Add(nodeID, nodes[i]); } } // Constraints IList <Node> constraintsNodes = new List <Node>(); constraintsNodes.Add(nodes[1 - 1]); constraintsNodes.Add(nodes[2 - 1]); constraintsNodes.Add(nodes[617 - 1]); constraintsNodes.Add(nodes[618 - 1]); constraintsNodes.Add(nodes[1029 - 1]); constraintsNodes.Add(nodes[1030 - 1]); constraintsNodes.Add(nodes[1441 - 1]); constraintsNodes.Add(nodes[1442 - 1]); constraintsNodes.Add(nodes[1649 - 1]); for (int i = 0; i < 9; i++) { int iNode = constraintsNodes[i].ID; model.NodesDictionary[iNode].Constraints.Add(new Constraint { DOF = StructuralDof.TranslationX }); model.NodesDictionary[iNode].Constraints.Add(new Constraint { DOF = StructuralDof.TranslationY }); model.NodesDictionary[iNode].Constraints.Add(new Constraint { DOF = StructuralDof.TranslationZ }); model.NodesDictionary[iNode].Constraints.Add(new Constraint { DOF = StructuralDof.RotationX }); model.NodesDictionary[iNode].Constraints.Add(new Constraint { DOF = StructuralDof.RotationY }); model.NodesDictionary[iNode].Constraints.Add(new Constraint { DOF = StructuralDof.RotationZ }); } // Applied displacement model.NodesDictionary[monitorNode_2].Constraints.Add(new Constraint { DOF = StructuralDof.TranslationY, Amount = nodalDisplacement }); // Create new Beam3D section and element var beamSection = new BeamSection3D(area, inertiaY, inertiaZ, torsionalInertia, effectiveAreaY, effectiveAreaZ); // Generate elements using (TextReader reader = File.OpenText(workingDirectory + '\\' + connectivityFileName)) { for (int i = 0; i < (nElems - 16); i++) { string text = reader.ReadLine(); string[] bits = text.Split(','); int elementID = int.Parse(bits[0]); int node1 = int.Parse(bits[1]); int node2 = int.Parse(bits[2]); // element nodes IList <Node> elementNodes = new List <Node>(); elementNodes.Add(model.NodesDictionary[node1]); elementNodes.Add(model.NodesDictionary[node2]); // create element var beam_1 = new Beam3DCorotationalQuaternion(elementNodes, material_1, 7.85, beamSection); var element = new Element { ID = elementID, ElementType = beam_1 }; // Add nodes to the created element element.AddNode(model.NodesDictionary[node1]); element.AddNode(model.NodesDictionary[node2]); // beam stiffness matrix var a = beam_1.StiffnessMatrix(element); // Add beam element to the element and subdomains dictionary of the model model.ElementsDictionary.Add(element.ID, element); model.SubdomainsDictionary[1].Elements.Add(element); } for (int i = (nElems - 16); i < nElems; i++) { string text = reader.ReadLine(); string[] bits = text.Split(','); int elementID = int.Parse(bits[0]); int node1 = int.Parse(bits[1]); int node2 = int.Parse(bits[2]); // element nodes IList <Node> elementNodes = new List <Node>(); elementNodes.Add(model.NodesDictionary[node1]); elementNodes.Add(model.NodesDictionary[node2]); // create element var beam_2 = new Beam3DCorotationalQuaternion(elementNodes, material_2, 7.85, beamSection); var element = new Element { ID = elementID, ElementType = beam_2 }; // Add nodes to the created element element.AddNode(model.NodesDictionary[node1]); element.AddNode(model.NodesDictionary[node2]); // beam stiffness matrix var a = beam_2.StiffnessMatrix(element); // Add beam element to the element and subdomains dictionary of the model model.ElementsDictionary.Add(element.ID, element); model.SubdomainsDictionary[1].Elements.Add(element); } } // Choose linear equation system solver var solverBuilder = new SkylineSolver.Builder(); ISolver solver = solverBuilder.BuildSolver(model); // Choose the provider of the problem -> here a structural problem var provider = new ProblemStructural(model, solver); // Choose child analyzer -> Child: NewtonRaphsonNonLinearAnalyzer var subdomainUpdaters = new[] { new NonLinearSubdomainUpdater(model.SubdomainsDictionary[1]) }; var childAnalyzerBuilder = new DisplacementControlAnalyzer.Builder(model, solver, provider, increments); var childAnalyzer = childAnalyzerBuilder.Build(); // Choose parent analyzer -> Parent: Static var parentAnalyzer = new StaticAnalyzer(model, solver, provider, childAnalyzer); // Request output //int monDOF = linearSystems[1].Solution.Length - 5; //(6 * monitorNode_2 - 4); int monDOF = 9841; childAnalyzer.LogFactories[1] = new LinearAnalyzerLogFactory(new int[] { monDOF }); // Run the analysis parentAnalyzer.Initialize(); parentAnalyzer.Solve(); // Check output DOFSLog log = (DOFSLog)childAnalyzer.Logs[1][0]; //There is a list of logs for each subdomain and we want the first one Console.WriteLine($"dof = {monDOF}, u = {log.DOFValues[monDOF]}"); //Assert.Equal(-21.2328445476855, log.DOFValues[monDOF], 8); }
public static void MakeCantileverBeam(Model model, double startX, double startY, double startZ, int startNodeID, int startElementID, int subdomainID) { int nodeID = startNodeID; for (int j = 0; j < 4; j++) { if (nodeID % 2 == 0) { model.NodesDictionary.Add(nodeID, new Node(id: nodeID, x: startX, y: startY + 0.25, z: startZ + 0.25 * (j / 2))); } else { model.NodesDictionary.Add(nodeID, new Node(id: nodeID, x: startX, y: startY, z: startZ + 0.25 * (j / 2))); } model.NodesDictionary[nodeID].Constraints.Add(new Constraint { DOF = StructuralDof.TranslationX }); model.NodesDictionary[nodeID].Constraints.Add(new Constraint { DOF = StructuralDof.TranslationY }); model.NodesDictionary[nodeID].Constraints.Add(new Constraint { DOF = StructuralDof.TranslationZ }); nodeID++; } for (int i = 0; i < 4; i++) { for (int k = 0; k < 4; k++) { if (nodeID % 2 == 0) { model.NodesDictionary.Add(nodeID, new Node(id: nodeID, x: startX + 0.25 * (i + 1), y: startY + 0.25, z: startZ + 0.25 * (k / 2))); } else { model.NodesDictionary.Add(nodeID, new Node(id: nodeID, x: startX + 0.25 * (i + 1), y: startY, z: startZ + 0.25 * (k / 2))); } nodeID++; } } int elementID = startElementID; Element e; var material = new ElasticMaterial3D() { YoungModulus = 2.0e7, PoissonRatio = 0.3 }; for (int i = 0; i < 4; i++) { e = new Element() { ID = elementID, ElementType = new Hexa8(material) }; e.NodesDictionary.Add(startNodeID + 4 * i, model.NodesDictionary[startNodeID + 4 * i]); e.NodesDictionary.Add(startNodeID + 4 * i + 4, model.NodesDictionary[startNodeID + 4 * i + 4]); e.NodesDictionary.Add(startNodeID + 4 * i + 5, model.NodesDictionary[startNodeID + 4 * i + 5]); e.NodesDictionary.Add(startNodeID + 4 * i + 1, model.NodesDictionary[startNodeID + 4 * i + 1]); e.NodesDictionary.Add(startNodeID + 4 * i + 2, model.NodesDictionary[startNodeID + 4 * i + 2]); e.NodesDictionary.Add(startNodeID + 4 * i + 6, model.NodesDictionary[startNodeID + 4 * i + 6]); e.NodesDictionary.Add(startNodeID + 4 * i + 7, model.NodesDictionary[startNodeID + 4 * i + 7]); e.NodesDictionary.Add(startNodeID + 4 * i + 3, model.NodesDictionary[startNodeID + 4 * i + 3]); model.ElementsDictionary.Add(e.ID, e); model.SubdomainsDictionary[subdomainID].Elements.Add(e); elementID++; } }
public static (int[], int[], int[]) Check_Graphene_rve_parallel() //palio "Check_Graphene_rve_Obje_Integration()" { //Origin h methodos Check_Graphene_rve_serial() tou parontos //Origin: SeparateCodeCheckingClass4.Check_Graphene_rve_Obje_Integration apo to branch: example/ms_development_nl_elements_merge //modifications: update kai tha xrhsimopoithei o GrapheneReinforcedRVEBuilderExample35fe2boundstiffHostTestPostData //o opoios exei kai antistoixo ddm: GrapheneReinforcedRVEBuilderExample35fe2boundstiffHostTestPostDataDdm pou tha trexei akrivws apo katw //PROSOXH gia na elegxei kai h defterh iteration u_sunol_micro_2 prepei na valoume ston graphenebuilder Addgraphenesheet xwris to bondslip. //mporoun na ginoun delete: double E_disp = 3.5; /*Gpa*/ double ni_disp = 0.4; // stather Poisson ElasticMaterial3D material1 = new ElasticMaterial3D() { YoungModulus = E_disp, PoissonRatio = ni_disp, }; double[,] DGtr = new double[3, 3] { { 1.10, 0, 0 }, { 0, 1, 0 }, { 0, 0, 1 } }; double[] GLVec = Transform_DGtr_to_GLvec(DGtr); material1.UpdateMaterial(GLVec); //double[] stressesCheck1 = material1.Stresses; double[] stressesCheck1 = new double[6] { material1.Stresses[0], material1.Stresses[1], material1.Stresses[2], material1.Stresses[3], material1.Stresses[4], material1.Stresses[5] }; DGtr = new double[3, 3] { { 1.20, 0, 0 }, { 0, 1, 0 }, { 0, 0, 1 } }; GLVec = Transform_DGtr_to_GLvec(DGtr); material1.UpdateMaterial(GLVec); material1.SaveState(); double[] stressesCheck2 = material1.Stresses; // den xreiazetai poia VectorExtensions.AssignTotalAffinityCount(); var grapheneRveBuilder1 = new RveGrShMultipleSeparated(1); //IRVEbuilder homogeneousRveBuilder1 = new HomogeneousRVEBuilderCheckEnaHexa(); // pros to paron var ModelAndNodes = grapheneRveBuilder1.GetModelAndBoundaryNodes(); int[] hexaPrint = grapheneRveBuilder1.hexaPrint; int[] cohePrint = grapheneRveBuilder1.cohePrint; int[] shellPrint = grapheneRveBuilder1.shellPrint; return(hexaPrint, cohePrint, shellPrint); IContinuumMaterial3DDefGrad microstructure3 = new MicrostructureDefGrad3D(grapheneRveBuilder1, model => (new SkylineSolver.Builder()).BuildSolver(model), false, 1); //IContinuumMaterial3DDefGrad microstructure3copyConsCheck = new Microstructure3copyConsCheckEna(homogeneousRveBuilder1); double[,] consCheck1 = new double[6, 6]; for (int i1 = 0; i1 < 6; i1++) { for (int i2 = 0; i2 < 6; i2++) { consCheck1[i1, i2] = microstructure3.ConstitutiveMatrix[i1, i2]; } } microstructure3.UpdateMaterial(new double[9] { 1.05, 1, 1, 0, 0, 0, 0, 0, 0 }); double[] stressesCheck3 = microstructure3.Stresses; microstructure3.SaveState(); microstructure3.UpdateMaterial(new double[9] { 1.10, 1, 1, 0, 0, 0, 0, 0, 0 }); double[] stressesCheck4 = microstructure3.Stresses; }
public static (double[], double[], double[, ], IVector, IVector) Check_Graphene_rve_serial() //palio "Check_Graphene_rve_Obje_Integration()" { //Origin: SeparateCodeCheckingClass4.Check_Graphene_rve_Obje_Integration apo to branch: example/ms_development_nl_elements_merge //modifications: update kai tha xrhsimopoithei o GrapheneReinforcedRVEBuilderExample35fe2boundstiffHostTestPostData //o opoios exei kai antistoixo ddm: GrapheneReinforcedRVEBuilderExample35fe2boundstiffHostTestPostDataDdm pou tha trexei akrivws apo katw //PROSOXH gia na elegxei kai h defterh iteration u_sunol_micro_2 prepei na valoume ston graphenebuilder Addgraphenesheet xwris to bondslip. //mporoun na ginoun delete: double E_disp = 3.5; /*Gpa*/ double ni_disp = 0.4; // stather Poisson var material1 = new ElasticMaterial3D() { YoungModulus = E_disp, PoissonRatio = ni_disp, }; double[,] DGtr = new double[3, 3] { { 1.10, 0, 0 }, { 0, 1, 0 }, { 0, 0, 1 } }; double[] GLVec = Transform_DGtr_to_GLvec(DGtr); material1.UpdateMaterial(GLVec); //double[] stressesCheck1 = material1.Stresses; double[] stressesCheck1 = new double[6] { material1.Stresses[0], material1.Stresses[1], material1.Stresses[2], material1.Stresses[3], material1.Stresses[4], material1.Stresses[5] }; DGtr = new double[3, 3] { { 1.20, 0, 0 }, { 0, 1, 0 }, { 0, 0, 1 } }; GLVec = Transform_DGtr_to_GLvec(DGtr); material1.UpdateMaterial(GLVec); material1.SaveState(); double[] stressesCheck2 = material1.Stresses; // den xreiazetai poia VectorExtensions.AssignTotalAffinityCount(); IRVEbuilder homogeneousRveBuilder1 = new RveGrShMultiple(1); //IRVEbuilder homogeneousRveBuilder1 = new HomogeneousRVEBuilderCheckEnaHexa(); var microstructure3 = new MicrostructureDefGrad3D(homogeneousRveBuilder1, model => (new SkylineSolver.Builder()).BuildSolver(model), false, 1); //IContinuumMaterial3DDefGrad microstructure3copyConsCheck = new Microstructure3copyConsCheckEna(homogeneousRveBuilder1); double[,] consCheck1 = new double[6, 6]; for (int i1 = 0; i1 < 6; i1++) { for (int i2 = 0; i2 < 6; i2++) { consCheck1[i1, i2] = microstructure3.ConstitutiveMatrix[i1, i2]; } } microstructure3.UpdateMaterial(new double[9] { 1.05, 1, 1, 0, 0, 0, 0, 0, 0 }); double[] stressesCheck3 = microstructure3.Stresses; microstructure3.SaveState(); IVector uInitialFreeDOFs_state1 = microstructure3.uInitialFreeDOFDisplacementsPerSubdomain[1].Copy(); microstructure3.UpdateMaterial(new double[9] { 1.10, 1, 1, 0, 0, 0, 0, 0, 0 }); double[] stressesCheck4 = microstructure3.Stresses; IVector uInitialFreeDOFs_state2 = microstructure3.uInitialFreeDOFDisplacementsPerSubdomain[1].Copy(); //PrintUtilities.WriteToFileVector(stressesCheck3, @"C:\Users\turbo-x\Desktop\notes_elegxoi\MSOLVE_output_2\stressesCheck3.txt"); //PrintUtilities.WriteToFileVector(stressesCheck4, @"C:\Users\turbo-x\Desktop\notes_elegxoi\MSOLVE_output_2\stressesCheck4.txt"); //PrintUtilities.WriteToFile(consCheck1, @"C:\Users\turbo-x\Desktop\notes_elegxoi\MSOLVE_output_2\consCheck1.txt"); //PrintUtilities.WriteToFileVector(uInitialFreeDOFs_state1.CopyToArray(), @"C:\Users\turbo-x\Desktop\notes_elegxoi\MSOLVE_output_2\uInitialFreeDOFs_state1.txt"); //PrintUtilities.WriteToFileVector(uInitialFreeDOFs_state2.CopyToArray(), @"C:\Users\turbo-x\Desktop\notes_elegxoi\MSOLVE_output_2\uInitialFreeDOFs_state2.txt"); return(stressesCheck3, stressesCheck4, consCheck1, uInitialFreeDOFs_state1, uInitialFreeDOFs_state2); }
private static void BuildCantileverModel(Model model, double load_value) { //xrhsimopoiithike to ParadeigmataElegxwnBuilder.HexaCantileverBuilder(Model model, double load_value) // allagh tou element kai tou material //ElasticMaterial3DTemp material1 = new ElasticMaterial3DTemp() //{ // YoungModulus = 1353000, // PoissonRatio = 0.3, //}; //VonMisesMaterial3D material1 = new VonMisesMaterial3D(1353000, 0.30, 1353000, 0.15); var material1 = new ElasticMaterial3D() { PoissonRatio = 0.3, YoungModulus = 1353000 }; double[,] nodeData = new double[, ] { { -0.2500000000000000, 0.2500000000000000, -1.0000000000000000 }, { 0.2500000000000000, 0.2500000000000000, -1.0000000000000000 }, { 0.2500000000000000, -0.2500000000000000, -1.0000000000000000 }, { -0.2500000000000000, -0.2500000000000000, -1.0000000000000000 }, { -0.2500000000000000, 0.2500000000000000, 1.0000000000000000 }, { 0.2500000000000000, 0.2500000000000000, 1.0000000000000000 }, { 0.2500000000000000, -0.2500000000000000, 1.0000000000000000 }, { -0.2500000000000000, -0.2500000000000000, 1.0000000000000000 }, { -0.2500000000000000, 0.2500000000000000, 0.0000000000000000 }, { 0.2500000000000000, 0.2500000000000000, 0.0000000000000000 }, { 0.2500000000000000, -0.2500000000000000, 0.0000000000000000 }, { -0.2500000000000000, -0.2500000000000000, 0.0000000000000000 }, { 0.0000000000000000, 0.2500000000000000, -1.0000000000000000 }, { 0.2500000000000000, 0.0000000000000000, -1.0000000000000000 }, { 0.0000000000000000, -0.2500000000000000, -1.0000000000000000 }, { -0.2500000000000000, 0.0000000000000000, -1.0000000000000000 }, { 0.0000000000000000, 0.2500000000000000, 1.0000000000000000 }, { 0.2500000000000000, 0.0000000000000000, 1.0000000000000000 }, { 0.0000000000000000, -0.2500000000000000, 1.0000000000000000 }, { -0.2500000000000000, 0.0000000000000000, 1.0000000000000000 }, { 0.0000000000000000, 0.2500000000000000, 0.0000000000000000 }, { 0.2500000000000000, 0.0000000000000000, 0.0000000000000000 }, { 0.0000000000000000, -0.2500000000000000, 0.0000000000000000 }, { -0.2500000000000000, 0.0000000000000000, 0.0000000000000000 }, { -0.2500000000000000, 0.2500000000000000, -0.5000000000000000 }, { 0.2500000000000000, 0.2500000000000000, -0.5000000000000000 }, { 0.2500000000000000, -0.2500000000000000, -0.5000000000000000 }, { -0.2500000000000000, -0.2500000000000000, -0.5000000000000000 }, { -0.2500000000000000, 0.2500000000000000, 0.5000000000000000 }, { 0.2500000000000000, 0.2500000000000000, 0.5000000000000000 }, { 0.2500000000000000, -0.2500000000000000, 0.5000000000000000 }, { -0.2500000000000000, -0.2500000000000000, 0.5000000000000000 }, { 0.0000000000000000, 0.0000000000000000, -1.0000000000000000 }, { -0.1250000000000000, 0.1250000000000000, -1.0000000000000000 }, { 0.1250000000000000, 0.1250000000000000, -1.0000000000000000 }, { 0.1250000000000000, -0.1250000000000000, -1.0000000000000000 }, { -0.1250000000000000, -0.1250000000000000, -1.0000000000000000 }, { 0.0000000000000000, 0.0000000000000000, 1.0000000000000000 }, { -0.1250000000000000, 0.1250000000000000, 1.0000000000000000 }, { 0.1250000000000000, 0.1250000000000000, 1.0000000000000000 }, { 0.1250000000000000, -0.1250000000000000, 1.0000000000000000 }, { -0.1250000000000000, -0.1250000000000000, 1.0000000000000000 }, { 0.0000000000000000, 0.0000000000000000, 0.0000000000000000 }, { -0.1250000000000000, 0.1250000000000000, 0.0000000000000000 }, { 0.1250000000000000, 0.1250000000000000, 0.0000000000000000 }, { 0.1250000000000000, -0.1250000000000000, 0.0000000000000000 }, { -0.1250000000000000, -0.1250000000000000, 0.0000000000000000 }, { 0.0000000000000000, 0.2500000000000000, -0.5000000000000000 }, { 0.1250000000000000, 0.2500000000000000, -0.7500000000000000 }, { -0.1250000000000000, 0.2500000000000000, -0.7500000000000000 }, { -0.1250000000000000, 0.2500000000000000, -0.2500000000000000 }, { 0.1250000000000000, 0.2500000000000000, -0.2500000000000000 }, { 0.2500000000000000, 0.0000000000000000, -0.5000000000000000 }, { 0.2500000000000000, -0.1250000000000000, -0.7500000000000000 }, { 0.2500000000000000, 0.1250000000000000, -0.7500000000000000 }, { 0.2500000000000000, 0.1250000000000000, -0.2500000000000000 }, { 0.2500000000000000, -0.1250000000000000, -0.2500000000000000 }, { 0.0000000000000000, -0.2500000000000000, -0.5000000000000000 }, { -0.1250000000000000, -0.2500000000000000, -0.7500000000000000 }, { 0.1250000000000000, -0.2500000000000000, -0.7500000000000000 }, { 0.1250000000000000, -0.2500000000000000, -0.2500000000000000 }, { -0.1250000000000000, -0.2500000000000000, -0.2500000000000000 }, { -0.2500000000000000, 0.0000000000000000, -0.5000000000000000 }, { -0.2500000000000000, 0.1250000000000000, -0.7500000000000000 }, { -0.2500000000000000, -0.1250000000000000, -0.7500000000000000 }, { -0.2500000000000000, -0.1250000000000000, -0.2500000000000000 }, { -0.2500000000000000, 0.1250000000000000, -0.2500000000000000 }, { 0.0000000000000000, 0.2500000000000000, 0.5000000000000000 }, { 0.1250000000000000, 0.2500000000000000, 0.2500000000000000 }, { -0.1250000000000000, 0.2500000000000000, 0.2500000000000000 }, { -0.1250000000000000, 0.2500000000000000, 0.7500000000000000 }, { 0.1250000000000000, 0.2500000000000000, 0.7500000000000000 }, { 0.2500000000000000, 0.0000000000000000, 0.5000000000000000 }, { 0.2500000000000000, -0.1250000000000000, 0.2500000000000000 }, { 0.2500000000000000, 0.1250000000000000, 0.2500000000000000 }, { 0.2500000000000000, 0.1250000000000000, 0.7500000000000000 }, { 0.2500000000000000, -0.1250000000000000, 0.7500000000000000 }, { 0.0000000000000000, -0.2500000000000000, 0.5000000000000000 }, { -0.1250000000000000, -0.2500000000000000, 0.2500000000000000 }, { 0.1250000000000000, -0.2500000000000000, 0.2500000000000000 }, { 0.1250000000000000, -0.2500000000000000, 0.7500000000000000 }, { -0.1250000000000000, -0.2500000000000000, 0.7500000000000000 }, { -0.2500000000000000, 0.0000000000000000, 0.5000000000000000 }, { -0.2500000000000000, 0.1250000000000000, 0.2500000000000000 }, { -0.2500000000000000, -0.1250000000000000, 0.2500000000000000 }, { -0.2500000000000000, -0.1250000000000000, 0.7500000000000000 }, { -0.2500000000000000, 0.1250000000000000, 0.7500000000000000 }, { 0.0000000000000000, 0.0000000000000000, -0.5000000000000000 }, { -0.1250000000000000, 0.1250000000000000, -0.7500000000000000 }, { 0.1250000000000000, 0.1250000000000000, -0.7500000000000000 }, { 0.1250000000000000, -0.1250000000000000, -0.7500000000000000 }, { -0.1250000000000000, -0.1250000000000000, -0.7500000000000000 }, { -0.1250000000000000, 0.1250000000000000, -0.2500000000000000 }, { 0.1250000000000000, 0.1250000000000000, -0.2500000000000000 }, { 0.1250000000000000, -0.1250000000000000, -0.2500000000000000 }, { -0.1250000000000000, -0.1250000000000000, -0.2500000000000000 }, { 0.0000000000000000, 0.0000000000000000, -0.7500000000000000 }, { 0.0000000000000000, 0.1250000000000000, -0.5000000000000000 }, { 0.1250000000000000, 0.0000000000000000, -0.5000000000000000 }, { 0.0000000000000000, -0.1250000000000000, -0.5000000000000000 }, { -0.1250000000000000, 0.0000000000000000, -0.5000000000000000 }, { 0.0000000000000000, 0.0000000000000000, -0.2500000000000000 }, { 0.0000000000000000, 0.0000000000000000, 0.5000000000000000 }, { -0.1250000000000000, 0.1250000000000000, 0.2500000000000000 }, { 0.1250000000000000, 0.1250000000000000, 0.2500000000000000 }, { 0.1250000000000000, -0.1250000000000000, 0.2500000000000000 }, { -0.1250000000000000, -0.1250000000000000, 0.2500000000000000 }, { -0.1250000000000000, 0.1250000000000000, 0.7500000000000000 }, { 0.1250000000000000, 0.1250000000000000, 0.7500000000000000 }, { 0.1250000000000000, -0.1250000000000000, 0.7500000000000000 }, { -0.1250000000000000, -0.1250000000000000, 0.7500000000000000 }, { 0.0000000000000000, 0.0000000000000000, 0.2500000000000000 }, { 0.0000000000000000, 0.1250000000000000, 0.5000000000000000 }, { 0.1250000000000000, 0.0000000000000000, 0.5000000000000000 }, { 0.0000000000000000, -0.1250000000000000, 0.5000000000000000 }, { -0.1250000000000000, 0.0000000000000000, 0.5000000000000000 }, { 0.0000000000000000, 0.0000000000000000, 0.7500000000000000 }, }; //int[] take_msolve_nodes_from_adina_tade_nodes = new int[] { 2, 1, 3, 0, 5, 7, 8, 6, 9, 4 }; int[,] elementData = new int[, ] { { 33, 2, 1, 88, 35, 13, 34, 90, 89, 97 }, { 33, 3, 2, 88, 36, 14, 35, 91, 90, 97 }, { 33, 4, 3, 88, 37, 15, 36, 92, 91, 97 }, { 33, 1, 4, 88, 34, 16, 37, 89, 92, 97 }, { 48, 1, 2, 88, 50, 13, 49, 89, 90, 98 }, { 48, 2, 10, 88, 49, 26, 52, 90, 94, 98 }, { 48, 10, 9, 88, 52, 21, 51, 94, 93, 98 }, { 48, 9, 1, 88, 51, 25, 50, 93, 89, 98 }, { 53, 2, 3, 88, 55, 14, 54, 90, 91, 99 }, { 53, 3, 11, 88, 54, 27, 57, 91, 95, 99 }, { 53, 11, 10, 88, 57, 22, 56, 95, 94, 99 }, { 53, 10, 2, 88, 56, 26, 55, 94, 90, 99 }, { 58, 3, 4, 88, 60, 15, 59, 91, 92, 100 }, { 58, 11, 3, 88, 61, 27, 60, 95, 91, 100 }, { 58, 12, 11, 88, 62, 23, 61, 96, 95, 100 }, { 58, 4, 12, 88, 59, 28, 62, 92, 96, 100 }, { 63, 4, 1, 88, 65, 16, 64, 92, 89, 101 }, { 63, 12, 4, 88, 66, 28, 65, 96, 92, 101 }, { 63, 9, 12, 88, 67, 24, 66, 93, 96, 101 }, { 63, 1, 9, 88, 64, 25, 67, 89, 93, 101 }, { 43, 9, 10, 88, 44, 21, 45, 93, 94, 102 }, { 43, 10, 11, 88, 45, 22, 46, 94, 95, 102 }, { 43, 11, 12, 88, 46, 23, 47, 95, 96, 102 }, { 43, 12, 9, 88, 47, 24, 44, 96, 93, 102 }, { 43, 10, 9, 103, 45, 21, 44, 105, 104, 112 }, { 43, 11, 10, 103, 46, 22, 45, 106, 105, 112 }, { 43, 12, 11, 103, 47, 23, 46, 107, 106, 112 }, { 43, 9, 12, 103, 44, 24, 47, 104, 107, 112 }, { 68, 9, 10, 103, 70, 21, 69, 104, 105, 113 }, { 68, 10, 6, 103, 69, 30, 72, 105, 109, 113 }, { 68, 6, 5, 103, 72, 17, 71, 109, 108, 113 }, { 68, 5, 9, 103, 71, 29, 70, 108, 104, 113 }, { 73, 10, 11, 103, 75, 22, 74, 105, 106, 114 }, { 73, 11, 7, 103, 74, 31, 77, 106, 110, 114 }, { 73, 7, 6, 103, 77, 18, 76, 110, 109, 114 }, { 73, 6, 10, 103, 76, 30, 75, 109, 105, 114 }, { 78, 11, 12, 103, 80, 23, 79, 106, 107, 115 }, { 78, 7, 11, 103, 81, 31, 80, 110, 106, 115 }, { 78, 8, 7, 103, 82, 19, 81, 111, 110, 115 }, { 78, 12, 8, 103, 79, 32, 82, 107, 111, 115 }, { 83, 12, 9, 103, 85, 24, 84, 107, 104, 116 }, { 83, 8, 12, 103, 86, 32, 85, 111, 107, 116 }, { 83, 5, 8, 103, 87, 20, 86, 108, 111, 116 }, { 83, 9, 5, 103, 84, 29, 87, 104, 108, 116 }, { 38, 5, 6, 103, 39, 17, 40, 108, 109, 117 }, { 38, 6, 7, 103, 40, 18, 41, 109, 110, 117 }, { 38, 7, 8, 103, 41, 19, 42, 110, 111, 117 }, { 38, 8, 5, 103, 42, 20, 39, 111, 108, 117 }, }; // orismos shmeiwn for (int nNode = 0; nNode < nodeData.GetLength(0); nNode++) { model.NodesDictionary.Add(nNode + 1, new Node(id: nNode + 1, x: nodeData[nNode, 0], y: nodeData[nNode, 1], z: nodeData[nNode, 2])); } // orismos elements Element e1; var adinaOrder = new AdinaElementLocalNodeOrdering(); int subdomainID = Tet10ContinuumNonLinearCantilever.subdomainID; for (int nElement = 0; nElement < elementData.GetLength(0); nElement++) { DynamicMaterial DynamicMaterial = new DynamicMaterial(1, 0, 0); //Dictionary<int,Node3D > List <Node> nodeSet = new List <Node>(10); for (int j = 0; j < 10; j++) { int nodeID = elementData[nElement, j]; nodeSet.Add((Node)model.NodesDictionary[nodeID]); } var factory = new ContinuumElement3DFactory(material1, DynamicMaterial); var nodeSet1 = adinaOrder.ReorderNodes(nodeSet, CellType.Tet10); e1 = new Element() { ID = nElement + 1, ElementType = factory.CreateNonLinearElement(CellType.Tet10, nodeSet1, material1, DynamicMaterial) }; for (int j = 0; j < 10; j++) { int LocalNode = adinaOrder.GetNodeForLocalMsolveNode(j, CellType.Tet10); e1.NodesDictionary.Add(elementData[nElement, LocalNode], model.NodesDictionary[elementData[nElement, LocalNode]]); } model.ElementsDictionary.Add(e1.ID, e1); model.SubdomainsDictionary[subdomainID].Elements.Add(e1); } int[] constrainedIds = new int[] { 1, 2, 3, 4, 13, 14, 15, 16, 33, 34, 35, 36, 37 }; for (int k1 = 0; k1 < constrainedIds.Length; k1++) { int k = constrainedIds[k1]; model.NodesDictionary[k].Constraints.Add(new Constraint { DOF = StructuralDof.TranslationX }); model.NodesDictionary[k].Constraints.Add(new Constraint { DOF = StructuralDof.TranslationY }); model.NodesDictionary[k].Constraints.Add(new Constraint { DOF = StructuralDof.TranslationZ }); } // fortish korufhs Load load1; for (int k = 5; k < 9; k++) { load1 = new Load() { Node = model.NodesDictionary[k], DOF = StructuralDof.TranslationX, Amount = 1 * load_value }; model.Loads.Add(load1); } }
static void Main(string[] args) { VectorExtensions.AssignTotalAffinityCount(); double youngModulus = 200.0e06; double poissonRatio = 0.3; double nodalLoad = 25.0; // Create a new elastic 3D material ElasticMaterial3D material = new ElasticMaterial3D() { YoungModulus = youngModulus, PoissonRatio = poissonRatio, }; // Node creation IList <Node> nodes = CreateNodes(); // Model creation Model model = new Model(); // Add a single subdomain to the model model.SubdomainsDictionary.Add(1, new Subdomain() { ID = 1 }); // Add nodes to the nodes dictonary of the model for (int i = 0; i < nodes.Count; ++i) { model.NodesDictionary.Add(i + 1, nodes[i]); } // Constraint bottom nodes of the model model.NodesDictionary[1].Constraints.Add(DOFType.X); model.NodesDictionary[1].Constraints.Add(DOFType.Y); model.NodesDictionary[1].Constraints.Add(DOFType.Z); model.NodesDictionary[2].Constraints.Add(DOFType.X); model.NodesDictionary[2].Constraints.Add(DOFType.Y); model.NodesDictionary[2].Constraints.Add(DOFType.Z); model.NodesDictionary[3].Constraints.Add(DOFType.X); model.NodesDictionary[3].Constraints.Add(DOFType.Y); model.NodesDictionary[3].Constraints.Add(DOFType.Z); model.NodesDictionary[4].Constraints.Add(DOFType.X); model.NodesDictionary[4].Constraints.Add(DOFType.Y); model.NodesDictionary[4].Constraints.Add(DOFType.Z); // Create a new Hexa8 element var element = new Element() { ID = 1, ElementType = new Hexa8(material) }; // Add nodes to the created element element.AddNode(model.NodesDictionary[1]); element.AddNode(model.NodesDictionary[2]); element.AddNode(model.NodesDictionary[3]); element.AddNode(model.NodesDictionary[4]); element.AddNode(model.NodesDictionary[5]); element.AddNode(model.NodesDictionary[6]); element.AddNode(model.NodesDictionary[7]); element.AddNode(model.NodesDictionary[8]); // Add Hexa element to the element and subdomains dictionary of the model model.ElementsDictionary.Add(element.ID, element); model.SubdomainsDictionary[1].ElementsDictionary.Add(element.ID, element); // Add nodal load values at the top nodes of the model model.Loads.Add(new Load() { Amount = -nodalLoad, Node = model.NodesDictionary[5], DOF = DOFType.Z }); model.Loads.Add(new Load() { Amount = -nodalLoad, Node = model.NodesDictionary[6], DOF = DOFType.Z }); model.Loads.Add(new Load() { Amount = -nodalLoad, Node = model.NodesDictionary[7], DOF = DOFType.Z }); model.Loads.Add(new Load() { Amount = -nodalLoad, Node = model.NodesDictionary[8], DOF = DOFType.Z }); // Needed in order to make all the required data structures model.ConnectDataStructures(); // Choose linear equation system solver SolverSkyline solver = new SolverSkyline(model); // Choose the provider of the problem -> here a structural problem ProblemStructural provider = new ProblemStructural(model, solver.SubdomainsDictionary); // Choose parent and child analyzers -> Parent: Static, Child: Linear Analyzers.LinearAnalyzer childAnalyzer = new LinearAnalyzer(solver, solver.SubdomainsDictionary); StaticAnalyzer parentAnalyzer = new StaticAnalyzer(provider, childAnalyzer, solver.SubdomainsDictionary); // Choose dof types X, Y, Z to log for node 5 childAnalyzer.LogFactories[1] = new LinearAnalyzerLogFactory(new int[] { model.NodalDOFsDictionary[5][DOFType.X], model.NodalDOFsDictionary[5][DOFType.Y], model.NodalDOFsDictionary[5][DOFType.Z] }); // Analyze the problem parentAnalyzer.BuildMatrices(); parentAnalyzer.Initialize(); parentAnalyzer.Solve(); // Write results to console Console.WriteLine("Writing results for node 5"); Console.WriteLine("Dof and Values for Displacement X, Y, Z"); Console.WriteLine(childAnalyzer.Logs[1][0]); }
public static bool HexaCantileverBuilderDispControl(Model model, double load_value) { var material1 = new ElasticMaterial3D() { YoungModulus = 1353000, PoissonRatio = 0.3, }; double[,] nodeData = new double[, ] { { -0.250000, -0.250000, -1.000000 }, { 0.250000, -0.250000, -1.000000 }, { -0.250000, 0.250000, -1.000000 }, { 0.250000, 0.250000, -1.000000 }, { -0.250000, -0.250000, -0.500000 }, { 0.250000, -0.250000, -0.500000 }, { -0.250000, 0.250000, -0.500000 }, { 0.250000, 0.250000, -0.500000 }, { -0.250000, -0.250000, 0.000000 }, { 0.250000, -0.250000, 0.000000 }, { -0.250000, 0.250000, 0.000000 }, { 0.250000, 0.250000, 0.000000 }, { -0.250000, -0.250000, 0.500000 }, { 0.250000, -0.250000, 0.500000 }, { -0.250000, 0.250000, 0.500000 }, { 0.250000, 0.250000, 0.500000 }, { -0.250000, -0.250000, 1.000000 }, { 0.250000, -0.250000, 1.000000 }, { -0.250000, 0.250000, 1.000000 }, { 0.250000, 0.250000, 1.000000 } }; int[,] elementData = new int[, ] { { 1, 8, 7, 5, 6, 4, 3, 1, 2 }, { 2, 12, 11, 9, 10, 8, 7, 5, 6 }, { 3, 16, 15, 13, 14, 12, 11, 9, 10 }, { 4, 20, 19, 17, 18, 16, 15, 13, 14 }, }; // orismos shmeiwn for (int nNode = 0; nNode < nodeData.GetLength(0); nNode++) { model.NodesDictionary.Add(nNode + 1, new Node(id: nNode + 1, x: nodeData[nNode, 0], y: nodeData[nNode, 1], z: nodeData[nNode, 2])); } // orismos elements Element e1; int subdomainID = 1; for (int nElement = 0; nElement < elementData.GetLength(0); nElement++) { e1 = new Element() { ID = nElement + 1, ElementType = new Hexa8NonLinear(material1, GaussLegendre3D.GetQuadratureWithOrder(3, 3, 3)) // dixws to e. exoume sfalma enw sto beambuilding oxi//edw kaleitai me ena orisma to Hexa8 }; for (int j = 0; j < 8; j++) { e1.NodesDictionary.Add(elementData[nElement, j + 1], model.NodesDictionary[elementData[nElement, j + 1]]); } model.ElementsDictionary.Add(e1.ID, e1); model.SubdomainsDictionary[subdomainID].Elements.Add(e1); } // constraint vashh opou z=-1 for (int k = 1; k < 5; k++) { model.NodesDictionary[k].Constraints.Add(new Constraint { DOF = StructuralDof.TranslationX }); model.NodesDictionary[k].Constraints.Add(new Constraint { DOF = StructuralDof.TranslationY }); model.NodesDictionary[k].Constraints.Add(new Constraint { DOF = StructuralDof.TranslationZ }); } // thetoume constraint tous prescribed //Load load1; for (int k = 17; k < 21; k++) { //load1 = new Load() //{ // Node = model.NodesDictionary[k], // DOF = DOFType.X, // Amount = 1 * load_value //}; //model.Loads.Add(load1); model.NodesDictionary[k].Constraints.Add(new Constraint { DOF = StructuralDof.TranslationX }); } return(true); }
public static (double[], double[], double[, ], IVector, IVector) Check_Graphene_rve_Obje_Integration() { //Origin: SeparateCodeCheckingClass4.Check05bStressIntegrationObje_Integration parontos //modifications: tha xrhsimopoithei o GrapheneBuilder...35...v2 gia epilush enos paradeigmatos GrapheneReinforcedRVEBuilderCHECK //gia elegxo twn newn domwn //PROSOXH gia na elegxei kai h defterh iteration u_sunol_micro_2 prepei na valoume ston graphenebuilder Addgraphenesheet xwris to bondslip. double E_disp = 3.5; /*Gpa*/ double ni_disp = 0.4; // stather Poisson var material1 = new ElasticMaterial3D() { YoungModulus = E_disp, PoissonRatio = ni_disp, }; double[,] DGtr = new double[3, 3] { { 1.10, 0, 0 }, { 0, 1, 0 }, { 0, 0, 1 } }; double[] GLVec = Transform_DGtr_to_GLvec(DGtr); material1.UpdateMaterial(GLVec); //double[] stressesCheck1 = material1.Stresses; double[] stressesCheck1 = new double[6] { material1.Stresses[0], material1.Stresses[1], material1.Stresses[2], material1.Stresses[3], material1.Stresses[4], material1.Stresses[5] }; DGtr = new double[3, 3] { { 1.20, 0, 0 }, { 0, 1, 0 }, { 0, 0, 1 } }; GLVec = Transform_DGtr_to_GLvec(DGtr); material1.UpdateMaterial(GLVec); material1.SaveState(); double[] stressesCheck2 = material1.Stresses; //VectorExtensions.AssignTotalAffinityCount(); IRVEbuilder homogeneousRveBuilder1 = new RveGrShOne(1); //IRVEbuilder homogeneousRveBuilder1 = new HomogeneousRVEBuilderCheckEnaHexa(); //IContinuumMaterial3DDefGrad var microstructure3 = new MicrostructureDefGrad3D(homogeneousRveBuilder1, model => (new SkylineSolver.Builder()).BuildSolver(model), false, 1); //IContinuumMaterial3DDefGrad microstructure3copyConsCheck = new Microstructure3copyConsCheckEna(homogeneousRveBuilder1); double[,] consCheck1 = new double[6, 6]; for (int i1 = 0; i1 < 6; i1++) { for (int i2 = 0; i2 < 6; i2++) { consCheck1[i1, i2] = microstructure3.ConstitutiveMatrix[i1, i2]; } } microstructure3.UpdateMaterial(new double[9] { 1.05, 1, 1, 0, 0, 0, 0, 0, 0 }); double[] stressesCheck3 = microstructure3.Stresses; microstructure3.SaveState(); IVector uInitialFreeDOFs_state1 = microstructure3.uInitialFreeDOFDisplacementsPerSubdomain[1].Copy(); microstructure3.UpdateMaterial(new double[9] { 1.10, 1, 1, 0, 0, 0, 0, 0, 0 }); double[] stressesCheck4 = microstructure3.Stresses; IVector uInitialFreeDOFs_state2 = microstructure3.uInitialFreeDOFDisplacementsPerSubdomain[1].Copy(); //PrintUtilities.WriteToFileVector(stressesCheck3, @"C:\Users\turbo-x\Desktop\notes_elegxoi\MSOLVE_output_2\stressesCheck3.txt"); //PrintUtilities.WriteToFileVector(stressesCheck4, @"C:\Users\turbo-x\Desktop\notes_elegxoi\MSOLVE_output_2\stressesCheck4.txt"); //PrintUtilities.WriteToFile(consCheck1, @"C:\Users\turbo-x\Desktop\notes_elegxoi\MSOLVE_output_2\consCheck1.txt"); //PrintUtilities.WriteToFileVector(uInitialFreeDOFs_state1.CopyToArray(), @"C:\Users\turbo-x\Desktop\notes_elegxoi\MSOLVE_output_2\uInitialFreeDOFs_state1.txt"); //PrintUtilities.WriteToFileVector(uInitialFreeDOFs_state2.CopyToArray(), @"C:\Users\turbo-x\Desktop\notes_elegxoi\MSOLVE_output_2\uInitialFreeDOFs_state2.txt"); return(stressesCheck3, stressesCheck4, consCheck1, uInitialFreeDOFs_state1, uInitialFreeDOFs_state2); }
public static void MatrixModelBuilder(Model model) { string workingDirectory = @"E:\GEORGE_DATA\DESKTOP\input files"; //@"D:\George\Desktop\input files"; // string MatrixGeometryFileName = "MATRIX_3D-L_x=10-L_y=10-L_z=100-1x1x10-Geometry_EBE_MSolve.inp"; //"MATRIX_3D-L_x=30-L_y=30-L_z=100-3x3x10-Geometry_MSolve.inp"; //"MATRIX_3D-L_x=10-L_y=10-L_z=100-1x1x10-Geometry_EBE_MSolve.inp"; string MatrixGonnectivityFileName = "MATRIX_3D-L_x=10-L_y=10-L_z=100-1x1x10-ConnMatr_EBE_MSolve.inp"; //"MATRIX_3D-L_x=30-L_y=30-L_z=100-3x3x10-ConnMatr_MSolve.inp"; //"MATRIX_3D-L_x=10-L_y=10-L_z=100-1x1x10-ConnMatr_EBE_MSolve.inp"; int matrixNodes = File.ReadLines(workingDirectory + '\\' + MatrixGeometryFileName).Count(); int matrixElements = File.ReadLines(workingDirectory + '\\' + MatrixGonnectivityFileName).Count(); // Nodes Geometry using (TextReader reader = File.OpenText(workingDirectory + '\\' + MatrixGeometryFileName)) { for (int i = 0; i < matrixNodes; i++) { string text = reader.ReadLine(); string[] bits = text.Split(','); int nodeID = int.Parse(bits[0]); double nodeX = double.Parse(bits[1]); double nodeY = double.Parse(bits[2]); double nodeZ = double.Parse(bits[3]); model.NodesDictionary.Add(nodeID, new Node(id: nodeID, x: nodeX, y: nodeY, z: nodeZ)); } } // Create Material var solidMaterial = new ElasticMaterial3D() { YoungModulus = 1.00, PoissonRatio = 0.30, }; // Generate elements using (TextReader reader = File.OpenText(workingDirectory + '\\' + MatrixGonnectivityFileName)) { for (int i = 0; i < matrixElements; i++) { string text = reader.ReadLine(); string[] bits = text.Split(','); int elementID = int.Parse(bits[0]); int node1 = int.Parse(bits[1]); int node2 = int.Parse(bits[2]); int node3 = int.Parse(bits[3]); int node4 = int.Parse(bits[4]); int node5 = int.Parse(bits[5]); int node6 = int.Parse(bits[6]); int node7 = int.Parse(bits[7]); int node8 = int.Parse(bits[8]); // Hexa8NL element definition var hexa8NLelement = new Element() { ID = elementID, ElementType = new Hexa8NonLinear(solidMaterial, GaussLegendre3D.GetQuadratureWithOrder(3, 3, 3)) }; // Add nodes to the created element hexa8NLelement.AddNode(model.NodesDictionary[node1]); hexa8NLelement.AddNode(model.NodesDictionary[node2]); hexa8NLelement.AddNode(model.NodesDictionary[node3]); hexa8NLelement.AddNode(model.NodesDictionary[node4]); hexa8NLelement.AddNode(model.NodesDictionary[node5]); hexa8NLelement.AddNode(model.NodesDictionary[node6]); hexa8NLelement.AddNode(model.NodesDictionary[node7]); hexa8NLelement.AddNode(model.NodesDictionary[node8]); // Add Hexa element to the element and subdomains dictionary of the model model.ElementsDictionary.Add(hexa8NLelement.ID, hexa8NLelement); //model.SubdomainsDictionary[0].ElementsDictionary.Add(hexa8NLelement.ID, hexa8NLelement); model.SubdomainsDictionary[0].Elements.Add(hexa8NLelement); } } // Boundary Conditions - Left End [End-1] for (int iNode = 1; iNode <= 4; iNode++) { //model.NodesDictionary[iNode].Constraints.Add(new Constraint { DOF = DOFType.X }); //model.NodesDictionary[iNode].Constraints.Add(new Constraint { DOF = DOFType.Y }); model.NodesDictionary[iNode].Constraints.Add(new Constraint { DOF = StructuralDof.TranslationZ }); } // Boundary Conditions - Bottom End [End-3] for (int iNode = 1; iNode <= 41; iNode += 4) { for (int j = 0; j < 2; j++) { model.NodesDictionary[iNode + j].Constraints.Add(new Constraint { DOF = StructuralDof.TranslationY }); } } // Boundary Conditions - Bottom End [End-5] for (int iNode = 1; iNode <= 43; iNode += 2) { model.NodesDictionary[iNode].Constraints.Add(new Constraint { DOF = StructuralDof.TranslationX }); } // Boundary Conditions - Bottom End [End-6] for (int iNode = 2; iNode <= 44; iNode += 2) { model.NodesDictionary[iNode].Constraints.Add(new Constraint { DOF = StructuralDof.TranslationX }); } // Add nodal load values at the top nodes of the model //for (int iNode = 161; iNode <= 164; iNode++) //(int iNode = 338001; iNode <= 338026; iNode++) //(int iNode = 3601; iNode <= 3606; iNode++) //(int iNode = 2603551; iNode < 2603601; iNode++) //{ // model.Loads.Add(new Load() { Amount = nodalLoad, Node = model.NodesDictionary[iNode], DOF = DOFType.Y }); //} //model.Loads.Add(new Load() { Amount = nodalLoad, Node = model.NodesDictionary[1801], DOF = DOFType.Y }); //model.Loads.Add(new Load() { Amount = 2, Node = model.NodesDictionary[1802], DOF = DOFType.Y }); //model.Loads.Add(new Load() { Amount = 2, Node = model.NodesDictionary[1803], DOF = DOFType.Y }); //model.Loads.Add(new Load() { Amount = 2, Node = model.NodesDictionary[1804], DOF = DOFType.Y }); //model.Loads.Add(new Load() { Amount = 2, Node = model.NodesDictionary[1805], DOF = DOFType.Y }); //model.Loads.Add(new Load() { Amount = nodalLoad, Node = model.NodesDictionary[1806], DOF = DOFType.Y }); // Compression Loading double nodalLoad = -25.0; //0.40; for (int iNode = 41; iNode <= 44; iNode++) //[End-4] { model.Loads.Add(new Load() { Amount = nodalLoad, Node = model.NodesDictionary[iNode], DOF = StructuralDof.TranslationZ }); } //// Applied Displacements //double nodalDisplacement = -10.0; //for (int iNode = 41; iNode <= 44; iNode++) //[End-4] //{ // model.NodesDictionary[iNode].Constraints.Add(new Constraint { DOF = DOFType.Z, Amount = nodalDisplacement }); //} }
public static void EBEModelBuilder(Model model) { // define mechanical properties double youngModulus = 1.0; double shearModulus = 1.0; double poissonRatio = 0.034; //0.30; // (youngModulus / (2 * shearModulus)) - 1; double area = 694.77; //CNT(8,8)-LinearEBE-TBT-L=10nm //1218.11; //CNT(8,8)-LinearEBE-EBT-L=10nm //694.77; //CNT(8,8)-LinearEBE-TBT-L=10nm double inertiaY = 100.18; //CNT(8,8)-LinearEBE-TBT-L=10nm //177.51; //CNT(8,8)-LinearEBE-EBT-L=10nm //100.18; //CNT(8,8)-LinearEBE-TBT-L=10nm double inertiaZ = 100.18; //CNT(8,8)-LinearEBE-TBT-L=10nm //177.51; //CNT(8,8)-LinearEBE-EBT-L=10nm //100.18; //CNT(8,8)-LinearEBE-TBT-L=10nm double torsionalInertia = 68.77; //CNT(8,8)-LinearEBE-TBT-L=10nm //168.25; //CNT(8,8)-LinearEBE-EBT-L=10nm //68.77; //CNT(8,8)-LinearEBE-TBT-L=10nm double effectiveAreaY = area; double effectiveAreaZ = area; string workingDirectory = @"E:\GEORGE_DATA\DESKTOP\input files"; //@"D:\George\Desktop\input files"; // string CNTgeometryFileName = "EmbeddedCNT-8-8-L=100-h=3-k=1-EBE-L=10-NumberOfCNTs=1-Geometry_beam.inp"; string CNTconnectivityFileName = "EmbeddedCNT-8-8-L=100-h=3-k=1-EBE-L=10-NumberOfCNTs=1-ConnMatr_beam.inp"; int CNTNodes = File.ReadLines(workingDirectory + '\\' + CNTgeometryFileName).Count(); int CNTElems = File.ReadLines(workingDirectory + '\\' + CNTconnectivityFileName).Count(); // Geometry using (TextReader reader = File.OpenText(workingDirectory + '\\' + CNTgeometryFileName)) { for (int i = 0; i < CNTNodes; i++) { string text = reader.ReadLine(); string[] bits = text.Split(','); int nodeID = int.Parse(bits[0]) + 44; // matrixNodes double nodeX = double.Parse(bits[1]); double nodeY = double.Parse(bits[2]); double nodeZ = double.Parse(bits[3]); model.NodesDictionary.Add(nodeID, new Node(id: nodeID, x: nodeX, y: nodeY, z: nodeZ)); } } // Create new 3D material var beamMaterial = new ElasticMaterial3D { YoungModulus = youngModulus, PoissonRatio = poissonRatio, }; // Create new Beam3D section and element var beamSection = new BeamSection3D(area, inertiaY, inertiaZ, torsionalInertia, effectiveAreaY, effectiveAreaZ); // element nodes using (TextReader reader = File.OpenText(workingDirectory + '\\' + CNTconnectivityFileName)) { for (int i = 0; i < CNTElems; i++) { string text = reader.ReadLine(); string[] bits = text.Split(','); int elementID = int.Parse(bits[0]) + 10; // matrixElements int node1 = int.Parse(bits[1]) + 44; // matrixNodes int node2 = int.Parse(bits[2]) + 44; // matrixNodes // element nodes var elementNodes = new List <Node>(); elementNodes.Add(model.NodesDictionary[node1]); elementNodes.Add(model.NodesDictionary[node2]); // create element var beam_1 = new Beam3DCorotationalQuaternion(elementNodes, beamMaterial, 7.85, beamSection); var beamElement = new Element { ID = elementID, ElementType = beam_1 }; // Add nodes to the created element beamElement.AddNode(model.NodesDictionary[node1]); beamElement.AddNode(model.NodesDictionary[node2]); // beam stiffness matrix // var a = beam_1.StiffnessMatrix(beamElement); // Add beam element to the element and subdomains dictionary of the model model.ElementsDictionary.Add(beamElement.ID, beamElement); //model.SubdomainsDictionary[0].ElementsDictionary.Add(beamElement.ID, beamElement); model.SubdomainsDictionary[0].Elements.Add(beamElement); } } }
public ContinuumElement3DFactory(ElasticMaterial3D commonMaterial, DynamicMaterial commonDynamicProperties) { this.commonDynamicProperties = commonDynamicProperties; this.commonMaterial = commonMaterial; }
public static void WriteStiffnessOfContinuum3DStructure() { // _____ ____ // / / /| // /____/____/ | // | | | | // |____|____|/| // | | | / // |____|____|/ // // Model with 1 subdomain var model = new Model(); model.SubdomainsDictionary.Add(subdomainID, new Subdomain(subdomainID)); // Material var material = new ElasticMaterial3D() { YoungModulus = 2.1E7, PoissonRatio = 0.3 }; var dynamicProperties = new DynamicMaterial(1.0, 0.0, 0.0, true); // Generate mesh double lengthX = 2.0; double lengthY = 2.4; double lengthZ = 2.2; var meshGenerator = new UniformMeshGenerator3D <Node>(0.0, 0.0, 0.0, lengthX, lengthY, lengthZ, 10, 10, 10); (IReadOnlyList <Node> vertices, IReadOnlyList <CellConnectivity <Node> > cells) = meshGenerator.CreateMesh((id, x, y, z) => new Node(id: id, x: x, y: y, z: z)); // Add nodes to the model for (int n = 0; n < vertices.Count; ++n) { model.NodesDictionary.Add(n, vertices[n]); } // Add Quad4 elements to the model var factory = new ContinuumElement3DFactory(material, dynamicProperties); for (int e = 0; e < cells.Count; ++e) { ContinuumElement3D element = factory.CreateElement(cells[e].CellType, cells[e].Vertices); var elementWrapper = new Element() { ID = e, ElementType = element }; foreach (Node node in element.Nodes) { elementWrapper.AddNode(node); } model.ElementsDictionary.Add(e, elementWrapper); model.SubdomainsDictionary[subdomainID].Elements.Add(elementWrapper); } // Solver var solverBuilder = new SkylineSolver.Builder(); SkylineSolver solver = solverBuilder.BuildSolver(model); // Structural problem provider var provider = new ProblemStructural(model, solver); // Linear static analysis var childAnalyzer = new LinearAnalyzer(model, solver, provider); var parentAnalyzer = new StaticAnalyzer(model, solver, provider, childAnalyzer); // Run the analysis to build the stiffness matrix parentAnalyzer.Initialize(); parentAnalyzer.BuildMatrices(); // Print the stiffness matrix //var writer = new MatlabWriter(); var writer = new RawArraysWriter(); writer.WriteToMultipleFiles((SkylineMatrix)solver.LinearSystems[subdomainID].Matrix, outputDirectory + @"\hexa8_10x10x10_stiffness.txt"); }
public static void HostElementsBuilder(Model model) { // Nodes Geometry model.NodesDictionary.Add(1, new Node(id: 1, x: 10.00, y: 2.50, z: 2.50)); model.NodesDictionary.Add(2, new Node(id: 2, x: 0.00, y: 2.50, z: 2.50)); model.NodesDictionary.Add(3, new Node(id: 3, x: 0.00, y: -2.50, z: 2.50)); model.NodesDictionary.Add(4, new Node(id: 4, x: 10.00, y: -2.50, z: 2.50)); model.NodesDictionary.Add(5, new Node(id: 5, x: 10.00, y: 2.50, z: -2.50)); model.NodesDictionary.Add(6, new Node(id: 6, x: 0.00, y: 2.50, z: -2.50)); model.NodesDictionary.Add(7, new Node(id: 7, x: 0.00, y: -2.50, z: -2.50)); model.NodesDictionary.Add(8, new Node(id: 8, x: 10.00, y: -2.50, z: -2.50)); // Boundary Conditions model.NodesDictionary[2].Constraints.Add(new Constraint { DOF = StructuralDof.TranslationX }); model.NodesDictionary[2].Constraints.Add(new Constraint { DOF = StructuralDof.TranslationY }); model.NodesDictionary[2].Constraints.Add(new Constraint { DOF = StructuralDof.TranslationZ }); model.NodesDictionary[3].Constraints.Add(new Constraint { DOF = StructuralDof.TranslationX }); model.NodesDictionary[3].Constraints.Add(new Constraint { DOF = StructuralDof.TranslationY }); model.NodesDictionary[3].Constraints.Add(new Constraint { DOF = StructuralDof.TranslationZ }); model.NodesDictionary[6].Constraints.Add(new Constraint { DOF = StructuralDof.TranslationX }); model.NodesDictionary[6].Constraints.Add(new Constraint { DOF = StructuralDof.TranslationY }); model.NodesDictionary[6].Constraints.Add(new Constraint { DOF = StructuralDof.TranslationZ }); model.NodesDictionary[7].Constraints.Add(new Constraint { DOF = StructuralDof.TranslationX }); model.NodesDictionary[7].Constraints.Add(new Constraint { DOF = StructuralDof.TranslationY }); model.NodesDictionary[7].Constraints.Add(new Constraint { DOF = StructuralDof.TranslationZ }); // Create Material var solidMaterial = new ElasticMaterial3D() { YoungModulus = 3.76, PoissonRatio = 0.3779, }; // Hexa8NL element definition var hexa8NLelement = new Element() { ID = 1, ElementType = new Hexa8NonLinear(solidMaterial, GaussLegendre3D.GetQuadratureWithOrder(3, 3, 3)) }; // Add nodes to the created element hexa8NLelement.AddNode(model.NodesDictionary[1]); hexa8NLelement.AddNode(model.NodesDictionary[2]); hexa8NLelement.AddNode(model.NodesDictionary[3]); hexa8NLelement.AddNode(model.NodesDictionary[4]); hexa8NLelement.AddNode(model.NodesDictionary[5]); hexa8NLelement.AddNode(model.NodesDictionary[6]); hexa8NLelement.AddNode(model.NodesDictionary[7]); hexa8NLelement.AddNode(model.NodesDictionary[8]); // Add Hexa element to the element and subdomains dictionary of the model model.ElementsDictionary.Add(hexa8NLelement.ID, hexa8NLelement); model.SubdomainsDictionary[1].Elements.Add(hexa8NLelement); // Add nodal load values at the top nodes of the model model.Loads.Add(new Load() { Amount = 25, Node = model.NodesDictionary[1], DOF = StructuralDof.TranslationZ }); model.Loads.Add(new Load() { Amount = 25, Node = model.NodesDictionary[4], DOF = StructuralDof.TranslationZ }); model.Loads.Add(new Load() { Amount = 25, Node = model.NodesDictionary[5], DOF = StructuralDof.TranslationZ }); model.Loads.Add(new Load() { Amount = 25, Node = model.NodesDictionary[8], DOF = StructuralDof.TranslationZ }); }
public static void HostElementsBuilder(Model model) { // Nodes Geometry model.NodesDictionary.Add(1, new Node(id: 1, x: 10.00, y: 2.50, z: 2.50)); model.NodesDictionary.Add(2, new Node(id: 2, x: 0.00, y: 2.50, z: 2.50)); model.NodesDictionary.Add(3, new Node(id: 3, x: 0.00, y: -2.50, z: 2.50)); model.NodesDictionary.Add(4, new Node(id: 4, x: 10.00, y: -2.50, z: 2.50)); model.NodesDictionary.Add(5, new Node(id: 5, x: 10.00, y: 2.50, z: -2.50)); model.NodesDictionary.Add(6, new Node(id: 6, x: 0.00, y: 2.50, z: -2.50)); model.NodesDictionary.Add(7, new Node(id: 7, x: 0.00, y: -2.50, z: -2.50)); model.NodesDictionary.Add(8, new Node(id: 8, x: 10.00, y: -2.50, z: -2.50)); // Boundary Conditions model.NodesDictionary[2].Constraints.Add(new Constraint { DOF = StructuralDof.TranslationX }); model.NodesDictionary[2].Constraints.Add(new Constraint { DOF = StructuralDof.TranslationY }); model.NodesDictionary[2].Constraints.Add(new Constraint { DOF = StructuralDof.TranslationZ }); model.NodesDictionary[3].Constraints.Add(new Constraint { DOF = StructuralDof.TranslationX }); model.NodesDictionary[3].Constraints.Add(new Constraint { DOF = StructuralDof.TranslationY }); model.NodesDictionary[3].Constraints.Add(new Constraint { DOF = StructuralDof.TranslationZ }); model.NodesDictionary[6].Constraints.Add(new Constraint { DOF = StructuralDof.TranslationX }); model.NodesDictionary[6].Constraints.Add(new Constraint { DOF = StructuralDof.TranslationY }); model.NodesDictionary[6].Constraints.Add(new Constraint { DOF = StructuralDof.TranslationZ }); model.NodesDictionary[7].Constraints.Add(new Constraint { DOF = StructuralDof.TranslationX }); model.NodesDictionary[7].Constraints.Add(new Constraint { DOF = StructuralDof.TranslationY }); model.NodesDictionary[7].Constraints.Add(new Constraint { DOF = StructuralDof.TranslationZ }); // Create Material var solidMaterial = new ElasticMaterial3D() { YoungModulus = 3.76, PoissonRatio = 0.3779, }; DynamicMaterial DynamicMaterial = new DynamicMaterial(1, 0, 0); var factory = new ContinuumElement3DFactory(solidMaterial, DynamicMaterial); // Hexa8NL element definition List <Node> nodeSet = new List <Node>(8); for (int j = 1; j < 9; j++) { nodeSet.Add((Node)model.NodesDictionary[j]); } var hexa8NLelement = new Element() { ID = 1, ElementType = // factory.CreateNonLinearElement(CellType.Hexa8, nodeSet, solidMaterial, DynamicMaterial) new Hexa8NonLinear(solidMaterial, GaussLegendre3D.GetQuadratureWithOrder(3, 3, 3)) // = new ContinummElement3DNonLinear(nodeSet, solidMaterial, GaussLegendre3D.GetQuadratureWithOrder(3, 3, 3), ISAAR.MSolve.FEM.Interpolation.InterpolationHexa8.UniqueInstance) }; // Add nodes to the created element hexa8NLelement.AddNode(model.NodesDictionary[1]); hexa8NLelement.AddNode(model.NodesDictionary[2]); hexa8NLelement.AddNode(model.NodesDictionary[3]); hexa8NLelement.AddNode(model.NodesDictionary[4]); hexa8NLelement.AddNode(model.NodesDictionary[5]); hexa8NLelement.AddNode(model.NodesDictionary[6]); hexa8NLelement.AddNode(model.NodesDictionary[7]); hexa8NLelement.AddNode(model.NodesDictionary[8]); // Add Hexa element to the element and subdomains dictionary of the model model.ElementsDictionary.Add(hexa8NLelement.ID, hexa8NLelement); model.SubdomainsDictionary[1].Elements.Add(hexa8NLelement); // Add nodal load values at the top nodes of the model model.Loads.Add(new Load() { Amount = 25, Node = model.NodesDictionary[1], DOF = StructuralDof.TranslationZ }); model.Loads.Add(new Load() { Amount = 25, Node = model.NodesDictionary[4], DOF = StructuralDof.TranslationZ }); model.Loads.Add(new Load() { Amount = 25, Node = model.NodesDictionary[5], DOF = StructuralDof.TranslationZ }); model.Loads.Add(new Load() { Amount = 25, Node = model.NodesDictionary[8], DOF = StructuralDof.TranslationZ }); }
public static void HostElementsBuilder(Model model) { string workingDirectory = @"E:\GEORGE_DATA\DESKTOP\input files"; //"..\..\..\Resources\Beam3DInputFiles"; string MatrixGeometryFileName = "MATRIX_3D-L_x=10-L_y=10-L_z=100-9x9x100-Geometry_MSolve.inp"; //"MATRIX_3D-L_x=5-L_y=5-L_z=100-50x50x1000-Geometry_MSolve.inp"; //"MATRIX_3D-L_x=5-L_y=5-L_z=100-5x5x100-Geometry_MSolve.inp"; //"MATRIX_3D-L_x=5-L_y=5-L_z=100-25x25x500-Geometry_MSolve.inp"; //"MATRIX_3D-L_x=1-L_y=1-L_z=10-5x5x50-Geometry_MSolve.inp"; //"MATRIX_3D-L_x=30-L_y=30-L_z=100-3x3x10-Geometry_MSolve.inp"; //"MATRIX_3D-L_x=30-L_y=30-L_z=100-29x29x100-Geometry_MSolve.inp"; //"MATRIX_3D-L_x=10-L_y=10-L_z=100-19x19x200-Geometry_MSolve.inp"; //"MATRIX_3D-L_x=10-L_y=10-L_z=100-9x9x100-Geometry_MSolve.inp"; string MatrixGonnectivityFileName = "MATRIX_3D-L_x=10-L_y=10-L_z=100-9x9x100-ConnMatr_MSolve.inp"; //"MATRIX_3D-L_x=5-L_y=5-L_z=100-50x50x1000-ConnMatr_MSolve.inp"; //"MATRIX_3D-L_x=5-L_y=5-L_z=100-5x5x100-ConnMatr_MSolve.inp"; //"MATRIX_3D-L_x=5-L_y=5-L_z=100-25x25x500-ConnMatr_MSolve.inp"; //"MATRIX_3D-L_x=1-L_y=1-L_z=10-5x5x50-ConnMatr_MSolve.inp"; //"MATRIX_3D-L_x=30-L_y=30-L_z=100-3x3x10-ConnMatr_MSolve.inp"; //"MATRIX_3D-L_x=30-L_y=30-L_z=100-29x29x100-ConnMatr_MSolve.inp"; //"MATRIX_3D-L_x=10-L_y=10-L_z=100-19x19x200-ConnMatr_MSolve.inp"; //"MATRIX_3D-L_x=10-L_y=10-L_z=100-9x9x100-ConnMatr_MSolve.inp"; int matrixNodes = File.ReadLines(workingDirectory + '\\' + MatrixGeometryFileName).Count(); int matrixElements = File.ReadLines(workingDirectory + '\\' + MatrixGonnectivityFileName).Count(); // Nodes Geometry using (TextReader reader = File.OpenText(workingDirectory + '\\' + MatrixGeometryFileName)) { for (int i = 0; i < matrixNodes; i++) { string text = reader.ReadLine(); string[] bits = text.Split(','); int nodeID = int.Parse(bits[0]); double nodeX = double.Parse(bits[1]); double nodeY = double.Parse(bits[2]); double nodeZ = double.Parse(bits[3]); model.NodesDictionary.Add(nodeID, new Node(id: nodeID, x: nodeX, y: nodeY, z: nodeZ)); } } // Create Material var solidMaterial = new ElasticMaterial3D() { YoungModulus = 1.00, PoissonRatio = 0.30, }; // Generate elements using (TextReader reader = File.OpenText(workingDirectory + '\\' + MatrixGonnectivityFileName)) { for (int i = 0; i < matrixElements; i++) { string text = reader.ReadLine(); string[] bits = text.Split(','); int elementID = int.Parse(bits[0]); int node1 = int.Parse(bits[1]); int node2 = int.Parse(bits[2]); int node3 = int.Parse(bits[3]); int node4 = int.Parse(bits[4]); int node5 = int.Parse(bits[5]); int node6 = int.Parse(bits[6]); int node7 = int.Parse(bits[7]); int node8 = int.Parse(bits[8]); // Hexa8NL element definition var hexa8NLelement = new Element() { ID = elementID, ElementType = new Hexa8NonLinear(solidMaterial, GaussLegendre3D.GetQuadratureWithOrder(3, 3, 3)) }; // Add nodes to the created element hexa8NLelement.AddNode(model.NodesDictionary[node1]); hexa8NLelement.AddNode(model.NodesDictionary[node2]); hexa8NLelement.AddNode(model.NodesDictionary[node3]); hexa8NLelement.AddNode(model.NodesDictionary[node4]); hexa8NLelement.AddNode(model.NodesDictionary[node5]); hexa8NLelement.AddNode(model.NodesDictionary[node6]); hexa8NLelement.AddNode(model.NodesDictionary[node7]); hexa8NLelement.AddNode(model.NodesDictionary[node8]); // Add Hexa element to the element and subdomains dictionary of the model model.ElementsDictionary.Add(hexa8NLelement.ID, hexa8NLelement); //model.SubdomainsDictionary[0].ElementsDictionary.Add(hexa8NLelement.ID, hexa8NLelement); model.SubdomainsDictionary[0].Elements.Add(hexa8NLelement); } } }
private static void TestBeam3DElasticNonlinearNewmarkDynamicAnalysisExample() { double youngModulus = 21000.0; double poissonRatio = 0.3; double nodalLoad = 20000.0; double area = 91.04; double inertiaY = 2843.0; double inertiaZ = 8091.0; double torsionalInertia = 76.57; double effectiveAreaY = 91.04; double effectiveAreaZ = 91.04; double density = 7.85; int nNodes = 3; int nElems = 2; int monitorNode = 3; // Create new 3D material var material = new ElasticMaterial3D { YoungModulus = youngModulus, PoissonRatio = poissonRatio, }; // Node creation IList <Node> nodes = new List <Node>(); Node node1 = new Node(id: 1, x: 0.0, y: 0.0, z: 0.0); Node node2 = new Node(id: 2, x: 300.0, y: 0.0, z: 0.0); Node node3 = new Node(id: 3, x: 600.0, y: 0.0, z: 0.0); nodes.Add(node1); nodes.Add(node2); nodes.Add(node3); // Model creation Model model = new Model(); // Add a single subdomain to the model int subdomainID = 0; model.SubdomainsDictionary.Add(subdomainID, new Subdomain(subdomainID)); // Add nodes to the nodes dictonary of the model for (int i = 0; i < nodes.Count; ++i) { model.NodesDictionary.Add(i + 1, nodes[i]); } // Constrain bottom nodes of the model model.NodesDictionary[1].Constraints.Add(new Constraint { DOF = StructuralDof.TranslationX }); model.NodesDictionary[1].Constraints.Add(new Constraint { DOF = StructuralDof.TranslationY }); model.NodesDictionary[1].Constraints.Add(new Constraint { DOF = StructuralDof.TranslationZ }); model.NodesDictionary[1].Constraints.Add(new Constraint { DOF = StructuralDof.RotationX }); model.NodesDictionary[1].Constraints.Add(new Constraint { DOF = StructuralDof.RotationY }); model.NodesDictionary[1].Constraints.Add(new Constraint { DOF = StructuralDof.RotationZ }); // Generate elements of the structure int iNode = 1; for (int iElem = 0; iElem < nElems; iElem++) { // element nodes IList <Node> elementNodes = new List <Node>(); elementNodes.Add(model.NodesDictionary[iNode]); elementNodes.Add(model.NodesDictionary[iNode + 1]); // Create new Beam3D section and element var beamSection = new BeamSection3D(area, inertiaY, inertiaZ, torsionalInertia, effectiveAreaY, effectiveAreaZ); var beam = new Beam3DCorotationalQuaternion(elementNodes, material, density, beamSection); // Create elements var element = new Element() { ID = iElem + 1, ElementType = beam }; // Add nodes to the created element element.AddNode(model.NodesDictionary[iNode]); element.AddNode(model.NodesDictionary[iNode + 1]); var a = beam.StiffnessMatrix(element); var b = beam.MassMatrix(element); // Add beam element to the element and subdomains dictionary of the model model.ElementsDictionary.Add(element.ID, element); model.SubdomainsDictionary[subdomainID].Elements.Add(element); iNode++; } // Add nodal load values at the top nodes of the model model.Loads.Add(new Load() { Amount = nodalLoad, Node = model.NodesDictionary[monitorNode], DOF = StructuralDof.TranslationY }); // Solver var solverBuilder = new SkylineSolver.Builder(); ISolver solver = solverBuilder.BuildSolver(model); // Problem type var provider = new ProblemStructural(model, solver); // Analyzers int increments = 10; var childAnalyzerBuilder = new LoadControlAnalyzer.Builder(model, solver, provider, increments); childAnalyzerBuilder.MaxIterationsPerIncrement = 120; childAnalyzerBuilder.NumIterationsForMatrixRebuild = 500; //childAnalyzerBuilder.SubdomainUpdaters = new[] { new NonLinearSubdomainUpdater(model.SubdomainsDictionary[subdomainID]) }; // This is the default LoadControlAnalyzer childAnalyzer = childAnalyzerBuilder.Build(); var parentAnalyzerBuilder = new NewmarkDynamicAnalyzer.Builder(model, solver, provider, childAnalyzer, 0.28, 3.36); parentAnalyzerBuilder.SetNewmarkParametersForConstantAcceleration(); // Not necessary. This is the default NewmarkDynamicAnalyzer parentAnalyzer = parentAnalyzerBuilder.Build(); parentAnalyzer.Initialize(); parentAnalyzer.Solve(); Assert.Equal(148.936792350562, solver.LinearSystems[subdomainID].Solution[7], 12); }
public static void EmbeddedElementsBuilder(Model model) { // define mechanical properties double youngModulus = 16710.0; // 5490; // double shearModulus = 8080.0; // 871; // double poissonRatio = 2.15; // 0.034; //(youngModulus / (2 * shearModulus)) - 1; double area = 5.594673861218848d - 003; // CNT(20,20)-LinearEBE-TBT-L = 10nm double inertiaY = 2.490804749753243D - 006; //1058.55; double inertiaZ = 2.490804749753243D - 006; // 1058.55; double torsionalInertia = 4.981609499506486D - 006; //496.38; double effectiveAreaY = area; double effectiveAreaZ = area; string workingDirectory = @"E:\GEORGE_DATA\DESKTOP\input files"; //"..\..\..\Resources\Beam3DInputFiles"; string CNTgeometryFileName = "CNT-8-8-L=100-h=3-Geometry.inp"; //"CNT-8-8-L=100-Geometry-2.inp"; //"EmbeddedCNT-8-8-L=100-h=0-k=1-EBE-L=1-NumberOfCNTs=1-Geometry_beam.inp"; //"CNT-8-8-L=100-h=3-Geometry.inp"; string CNTconnectivityFileName = "CNT-8-8-L=100-h=3-ConnMatr.inp"; //"CNT-8-8-L=100-ConnMatr-2.inp"; //"EmbeddedCNT-8-8-L=100-h=0-k=1-EBE-L=1-NumberOfCNTs=1-ConnMatr_beam.inp"; //"CNT-8-8-L=100-h=3-ConnMatr.inp"; int CNTNodes = File.ReadLines(workingDirectory + '\\' + CNTgeometryFileName).Count(); int CNTElems = File.ReadLines(workingDirectory + '\\' + CNTconnectivityFileName).Count(); // Geometry using (TextReader reader = File.OpenText(workingDirectory + '\\' + CNTgeometryFileName)) { for (int i = 0; i < CNTNodes; i++) { string text = reader.ReadLine(); string[] bits = text.Split(','); int nodeID = int.Parse(bits[0]) + 10100; // matrixNodes double nodeX = double.Parse(bits[1]); double nodeY = double.Parse(bits[2]); double nodeZ = double.Parse(bits[3]); model.NodesDictionary.Add(nodeID, new Node(id: nodeID, x: nodeX, y: nodeY, z: nodeZ)); } } // Create new 3D material var beamMaterial = new ElasticMaterial3D { YoungModulus = youngModulus, PoissonRatio = poissonRatio, }; // Create new Beam3D section and element var beamSection = new BeamSection3D(area, inertiaY, inertiaZ, torsionalInertia, effectiveAreaY, effectiveAreaZ); // element nodes using (TextReader reader = File.OpenText(workingDirectory + '\\' + CNTconnectivityFileName)) { for (int i = 0; i < CNTElems; i++) { string text = reader.ReadLine(); string[] bits = text.Split(','); int elementID = int.Parse(bits[0]) + 8100; // matrixElements int node1 = int.Parse(bits[1]) + 10100; // matrixNodes int node2 = int.Parse(bits[2]) + 10100; // matrixNodes // element nodes var elementNodes = new List <Node>(); elementNodes.Add(model.NodesDictionary[node1]); elementNodes.Add(model.NodesDictionary[node2]); // create element var beam_1 = new Beam3DCorotationalQuaternion(elementNodes, beamMaterial, 7.85, beamSection); var beamElement = new Element { ID = elementID, ElementType = beam_1 }; // Add nodes to the created element beamElement.AddNode(model.NodesDictionary[node1]); beamElement.AddNode(model.NodesDictionary[node2]); // beam stiffness matrix // var a = beam_1.StiffnessMatrix(beamElement); // Add beam element to the element and subdomains dictionary of the model model.ElementsDictionary.Add(beamElement.ID, beamElement); //model.SubdomainsDictionary[0].ElementsDictionary.Add(beamElement.ID, beamElement); model.SubdomainsDictionary[0].Elements.Add(beamElement); } } }
public static void Check3DscaleTransitionsAndMicrostructure() { //Check05c2_3D_StressIntegration double E_disp = 3.5; /*Gpa*/ double ni_disp = 0.4; // stather Poisson var material1 = new ElasticMaterial3D() { YoungModulus = E_disp, PoissonRatio = ni_disp, }; double[] GLVec = new double[6] { 0.01, 0, 0, 0, 0, 0 }; material1.UpdateMaterial(GLVec); double[] stressesCheck1 = new double[6] { material1.Stresses[0], material1.Stresses[1], material1.Stresses[2], material1.Stresses[3], material1.Stresses[4], material1.Stresses[5] }; //material1.SaveState(); GLVec = new double[6] { 0, 0, 0, 0, 0.02, 0 }; material1.UpdateMaterial(GLVec); double[] stressesCheck2 = new double[6] { material1.Stresses[0], material1.Stresses[1], material1.Stresses[2], material1.Stresses[3], material1.Stresses[4], material1.Stresses[5] }; //VectorExtensions.AssignTotalAffinityCount(); IRVEbuilder homogeneousRveBuilder1 = new HomogeneousRVEBuilderLinear(); //IRVEbuilder homogeneousRveBuilder1 = new HomogeneousRVEBuilderCheckEnaHexa(); IContinuumMaterial3D microstructure3 = new Microstructure3D(homogeneousRveBuilder1, model => (new SkylineSolver.Builder()).BuildSolver(model), false, 1); //IContinuumMaterial3DDefGrad microstructure3copyConsCheck = new Microstructure3copyConsCheckEna(homogeneousRveBuilder1); double[,] consCheck1 = new double[6, 6]; for (int i1 = 0; i1 < 6; i1++) { for (int i2 = 0; i2 < 6; i2++) { consCheck1[i1, i2] = microstructure3.ConstitutiveMatrix[i1, i2]; } } microstructure3.UpdateMaterial(new double[6] { 0.010, 0, 0, 0, 0, 0 }); double[] stressesCheck3 = new double[6] { microstructure3.Stresses[0], microstructure3.Stresses[1], microstructure3.Stresses[2], microstructure3.Stresses[3], microstructure3.Stresses[4], microstructure3.Stresses[5] }; microstructure3.SaveState(); microstructure3.UpdateMaterial(new double[6] { 0, 0, 0, 0, 0.020, 0 }); double[] stressesCheck4 = new double[6] { microstructure3.Stresses[0], microstructure3.Stresses[1], microstructure3.Stresses[2], microstructure3.Stresses[3], microstructure3.Stresses[4], microstructure3.Stresses[5] }; microstructure3.SaveState(); microstructure3.UpdateMaterial(new double[6] { 0.030, 0, 0, 0, 0, 0 }); double[] stressesCheck5 = new double[6] { microstructure3.Stresses[0], microstructure3.Stresses[1], microstructure3.Stresses[2], microstructure3.Stresses[3], microstructure3.Stresses[4], microstructure3.Stresses[5] }; var Matrix1 = Matrix.CreateZero(3, 3); for (int i1 = 0; i1 < 3; i1++) { for (int i2 = 0; i2 < 3; i2++) { Matrix1[i1, i2] = microstructure3.ConstitutiveMatrix[i1, i2]; } } Assert.True(NRNLAnalyzerDevelopTest.AreDisplacementsSame(stressesCheck1, stressesCheck3)); Assert.True(NRNLAnalyzerDevelopTest.AreDisplacementsSame(stressesCheck2, stressesCheck4)); Assert.True(NRNLAnalyzerDevelopTest.AreDisplacementsSame(new double[6] { 3 * stressesCheck1[0], 3 * stressesCheck1[1], 3 * stressesCheck1[2], 3 * stressesCheck1[3], 3 * stressesCheck1[4], 3 * stressesCheck1[5] }, stressesCheck5)); Assert.True(AreDisplacementsSame(consCheck1, material1.ConstitutiveMatrix)); Assert.True(AreDisplacementsSame(Matrix1.CopyToArray2D(), material1.ConstitutiveMatrix)); }
public void ContinuumElement3DNonLinearElasticMaterialDynamicLumped() { IList <Node> nodes = new List <Node>(); // Create Model var model = new Model(); // Create Subdomain model.SubdomainsDictionary.Add(subdomainID, new Subdomain(subdomainID)); // Create Elastic Material var solidMaterial = new ElasticMaterial3D() { YoungModulus = youngModulus, PoissonRatio = poissonRatio, }; // Create Dynamic Material var dynamicMaterial = new DynamicMaterial(density, 0, 0, false); DefineContinuumElement3DNonLinear(model, solidMaterial, dynamicMaterial); BoundaryConditionsNLM(model); // Choose linear equation system solver var solverBuilder = new SkylineSolver.Builder(); SkylineSolver solver = solverBuilder.BuildSolver(model); // Choose the provider of the problem -> here a structural problem var provider = new ProblemStructural(model, solver); // Choose child analyzer -> Child: NewtonRaphson - LoadControl var subdomainUpdaters = new[] { new NonLinearSubdomainUpdater(model.SubdomainsDictionary[subdomainID]) }; var childAnalyzerBuilder = new LoadControlAnalyzer.Builder(model, solver, provider, increments) { MaxIterationsPerIncrement = 50, NumIterationsForMatrixRebuild = 1, ResidualTolerance = 1E-06, }; var childAnalyzer = childAnalyzerBuilder.Build(); // Choose parent analyzer -> Parent: Static var parentAnalyzerBuilder = new NewmarkDynamicAnalyzer.Builder(model, solver, provider, childAnalyzer, 1.0, 100.0); parentAnalyzerBuilder.SetNewmarkParametersForConstantAcceleration(); NewmarkDynamicAnalyzer parentAnalyzer = parentAnalyzerBuilder.Build(); // Request output childAnalyzer.LogFactories[subdomainID] = new LinearAnalyzerLogFactory(new int[] { monitorDof }); // Run the analysis parentAnalyzer.Initialize(); parentAnalyzer.Solve(); // Check output DOFSLog log = (DOFSLog)childAnalyzer.Logs[subdomainID][0]; double computedValue = log.DOFValues[monitorDof]; double expectedValue = 2.97084; Assert.Equal(expectedValue, computedValue, 3); }
public void CantileverYBeam3DQuaternionNonlinearTest() { double youngModulus = 21000.0; double poissonRatio = 0.3; double nodalLoad = 20000.0; double area = 91.04; double inertiaY = 2843.0; double inertiaZ = 8091.0; double torsionalInertia = 76.57; double effectiveAreaY = 91.04; double effectiveAreaZ = 91.04; int nNodes = 3; int nElems = 2; int monitorNode = 3; // Create new 3D material var material = new ElasticMaterial3D { YoungModulus = youngModulus, PoissonRatio = poissonRatio, }; // Node creation IList <Node> nodes = new List <Node>(); Node node1 = new Node(id: 1, x: 0.0, y: 0.0, z: 0.0); Node node2 = new Node(id: 2, x: 100.0, y: 0.0, z: 0.0); Node node3 = new Node(id: 3, x: 200.0, y: 0.0, z: 0.0); nodes.Add(node1); nodes.Add(node2); nodes.Add(node3); // Model creation Model model = new Model(); // Add a single subdomain to the model model.SubdomainsDictionary.Add(1, new Subdomain(1)); // Add nodes to the nodes dictonary of the model for (int i = 0; i < nodes.Count; ++i) { model.NodesDictionary.Add(i + 1, nodes[i]); } // Constrain bottom nodes of the model model.NodesDictionary[1].Constraints.Add(new Constraint { DOF = StructuralDof.TranslationX }); model.NodesDictionary[1].Constraints.Add(new Constraint { DOF = StructuralDof.TranslationY }); model.NodesDictionary[1].Constraints.Add(new Constraint { DOF = StructuralDof.TranslationZ }); model.NodesDictionary[1].Constraints.Add(new Constraint { DOF = StructuralDof.RotationX }); model.NodesDictionary[1].Constraints.Add(new Constraint { DOF = StructuralDof.RotationY }); model.NodesDictionary[1].Constraints.Add(new Constraint { DOF = StructuralDof.RotationZ }); // Generate elements of the structure int iNode = 1; for (int iElem = 0; iElem < nElems; iElem++) { // element nodes IList <Node> elementNodes = new List <Node>(); elementNodes.Add(model.NodesDictionary[iNode]); elementNodes.Add(model.NodesDictionary[iNode + 1]); // Create new Beam3D section and element var beamSection = new BeamSection3D(area, inertiaY, inertiaZ, torsionalInertia, effectiveAreaY, effectiveAreaZ); var beam = new Beam3DCorotationalQuaternion(elementNodes, material, 7.85, beamSection); // Create elements var element = new Element() { ID = iElem + 1, ElementType = beam }; // Add nodes to the created element element.AddNode(model.NodesDictionary[iNode]); element.AddNode(model.NodesDictionary[iNode + 1]); var a = beam.StiffnessMatrix(element); //var writer = new FullMatrixWriter(); //writer.WriteToFile(a, output); // Add beam element to the element and subdomains dictionary of the model model.ElementsDictionary.Add(element.ID, element); model.SubdomainsDictionary[1].Elements.Add(element); iNode++; } // Add nodal load values at the top nodes of the model model.Loads.Add(new Load() { Amount = nodalLoad, Node = model.NodesDictionary[monitorNode], DOF = StructuralDof.TranslationY }); // Solver var solverBuilder = new SkylineSolver.Builder(); ISolver solver = solverBuilder.BuildSolver(model); // Problem type var provider = new ProblemStructural(model, solver); // Analyzers int increments = 10; var childAnalyzerBuilder = new LoadControlAnalyzer.Builder(model, solver, provider, increments); childAnalyzerBuilder.ResidualTolerance = 1E-3; //childAnalyzerBuilder.SubdomainUpdaters = new[] { new NonLinearSubdomainUpdater(model.SubdomainsDictionary[subdomainID]) }; // This is the default LoadControlAnalyzer childAnalyzer = childAnalyzerBuilder.Build(); var parentAnalyzer = new StaticAnalyzer(model, solver, provider, childAnalyzer); // Request output childAnalyzer.LogFactories[1] = new LinearAnalyzerLogFactory(new int[] { 7 }); parentAnalyzer.Initialize(); parentAnalyzer.Solve(); // Check output DOFSLog log = (DOFSLog)childAnalyzer.Logs[1][0]; //There is a list of logs for each subdomain and we want the first one Assert.Equal(148.936792350562, log.DOFValues[7], 2); }
public static void MakeBeamBuilding(Model model, double startX, double startY, double startZ, double beamWidth, double beamHeight, int startNodeID, int startElementID, int subdomainID, int floors, bool isInHexaSoil, bool hasPiles) { const int nodesPerFloor = 18; int nodeID = startNodeID; // Construct node structure if (!isInHexaSoil) { for (int j = 0; j < 3; j++) { for (int k = 0; k < 5; k++) { model.NodesDictionary.Add(nodeID, new Node() { ID = nodeID, X = startX + k * beamWidth, Y = startY, Z = startZ + j * beamWidth }); model.NodesDictionary[nodeID].Constraints.Add(DOFType.X); model.NodesDictionary[nodeID].Constraints.Add(DOFType.Y); model.NodesDictionary[nodeID].Constraints.Add(DOFType.Z); model.NodesDictionary[nodeID].Constraints.Add(DOFType.RotX); model.NodesDictionary[nodeID].Constraints.Add(DOFType.RotY); model.NodesDictionary[nodeID].Constraints.Add(DOFType.RotZ); nodeID++; } } model.NodesDictionary.Add(nodeID, new Node() { ID = nodeID, X = startX + 2 * beamWidth, Y = startY, Z = startZ + 3 * beamWidth }); model.NodesDictionary[nodeID].Constraints.Add(DOFType.X); model.NodesDictionary[nodeID].Constraints.Add(DOFType.Y); model.NodesDictionary[nodeID].Constraints.Add(DOFType.Z); model.NodesDictionary[nodeID].Constraints.Add(DOFType.RotX); model.NodesDictionary[nodeID].Constraints.Add(DOFType.RotY); model.NodesDictionary[nodeID].Constraints.Add(DOFType.RotZ); nodeID++; model.NodesDictionary.Add(nodeID, new Node() { ID = nodeID, X = startX + 3 * beamWidth, Y = startY, Z = startZ + 3 * beamWidth }); model.NodesDictionary[nodeID].Constraints.Add(DOFType.X); model.NodesDictionary[nodeID].Constraints.Add(DOFType.Y); model.NodesDictionary[nodeID].Constraints.Add(DOFType.Z); model.NodesDictionary[nodeID].Constraints.Add(DOFType.RotX); model.NodesDictionary[nodeID].Constraints.Add(DOFType.RotY); model.NodesDictionary[nodeID].Constraints.Add(DOFType.RotZ); nodeID++; model.NodesDictionary.Add(nodeID, new Node() { ID = nodeID, X = startX + 4 * beamWidth, Y = startY, Z = startZ + 3 * beamWidth }); model.NodesDictionary[nodeID].Constraints.Add(DOFType.X); model.NodesDictionary[nodeID].Constraints.Add(DOFType.Y); model.NodesDictionary[nodeID].Constraints.Add(DOFType.Z); model.NodesDictionary[nodeID].Constraints.Add(DOFType.RotX); model.NodesDictionary[nodeID].Constraints.Add(DOFType.RotY); model.NodesDictionary[nodeID].Constraints.Add(DOFType.RotZ); nodeID++; } for (int i = 1; i <= floors; i++) { for (int j = 0; j < 3; j++) { for (int k = 0; k < 5; k++) { model.NodesDictionary.Add(nodeID, new Node() { ID = nodeID, X = startX + k * beamWidth, Y = startY + i * beamHeight, Z = startZ + j * beamWidth }); nodeID++; } } model.NodesDictionary.Add(nodeID, new Node() { ID = nodeID, X = startX + 2 * beamWidth, Y = startY + i * beamHeight, Z = startZ + 3 * beamWidth }); nodeID++; model.NodesDictionary.Add(nodeID, new Node() { ID = nodeID, X = startX + 3 * beamWidth, Y = startY + i * beamHeight, Z = startZ + 3 * beamWidth }); nodeID++; model.NodesDictionary.Add(nodeID, new Node() { ID = nodeID, X = startX + 4 * beamWidth, Y = startY + i * beamHeight, Z = startZ + 3 * beamWidth }); nodeID++; } List <Node> groundNodes = new List <Node>(); int elementID = startElementID; Element e; int fibers = 400; double b = 0.3; double h = 0.1; ElasticMaterial3D material = new ElasticMaterial3D() { YoungModulus = 2.1e5, PoissonRatio = 0.35, }; if (isInHexaSoil) { List <Node> sub1Nodes = new List <Node>(); List <Node> sub2Nodes = new List <Node>(); // Get ground and sub nodes for (int i = 0; i < nodesPerFloor; i++) { groundNodes.Add(GetNodeUnderNode(model, model.NodesDictionary[startNodeID + i])); sub1Nodes.Add(GetNodeUnderNode(model, groundNodes[i])); sub2Nodes.Add(GetNodeUnderNode(model, sub1Nodes[i])); } if (hasPiles) { // Create sub2 piles for (int i = 0; i < nodesPerFloor; i++) { Node[] sub1AdjacentNodes = GetAdjacentNodes(model, sub1Nodes[i]); Node[] sub2AdjacentNodes = GetAdjacentNodes(model, sub2Nodes[i]); e = new Element() { ID = elementID, ElementType = new Beam3D(material, sub2AdjacentNodes, sub1AdjacentNodes) { Density = 7.85, SectionArea = b * h, MomentOfInertiaY = b * b * b * h, MomentOfInertiaZ = b * h * h * h, } }; e.NodesDictionary.Add(sub2Nodes[i].ID, sub2Nodes[i]); e.NodesDictionary.Add(sub1Nodes[i].ID, sub1Nodes[i]); foreach (Node node in sub2AdjacentNodes) { e.NodesDictionary.Add(node.ID, node); } foreach (Node node in sub1AdjacentNodes) { e.NodesDictionary.Add(node.ID, node); } model.ElementsDictionary.Add(e.ID, e); model.SubdomainsDictionary[subdomainID].ElementsDictionary.Add(e.ID, e); elementID++; } // Create sub1 piles for (int i = 0; i < nodesPerFloor; i++) { Node[] sub1AdjacentNodes = GetAdjacentNodes(model, sub1Nodes[i]); Node[] groundAdjacentNodes = GetAdjacentNodes(model, groundNodes[i]); e = new Element() { ID = elementID, ElementType = new Beam3D(material, sub1AdjacentNodes, groundAdjacentNodes) { Density = 7.85, SectionArea = b * h, MomentOfInertiaY = b * b * b * h, MomentOfInertiaZ = b * h * h * h, } }; e.NodesDictionary.Add(sub1Nodes[i].ID, sub1Nodes[i]); e.NodesDictionary.Add(groundNodes[i].ID, groundNodes[i]); foreach (Node node in sub1AdjacentNodes) { e.NodesDictionary.Add(node.ID, node); } foreach (Node node in groundAdjacentNodes) { e.NodesDictionary.Add(node.ID, node); } model.ElementsDictionary.Add(e.ID, e); model.SubdomainsDictionary[subdomainID].ElementsDictionary.Add(e.ID, e); elementID++; } } } else { for (int i = 0; i < nodesPerFloor; i++) { groundNodes.Add(model.NodesDictionary[startNodeID + i]); } startNodeID += nodesPerFloor; } // Create ground-to-1st-floor beams for (int i = 0; i < nodesPerFloor; i++) { Node[] groundAdjacentNodes = GetAdjacentNodes(model, groundNodes[i]); e = new Element() { ID = elementID, ElementType = new Beam3D(material, isInHexaSoil ? groundAdjacentNodes : null, null) { Density = 7.85, SectionArea = b * h, MomentOfInertiaY = b * b * b * h, MomentOfInertiaZ = b * h * h * h, } }; e.NodesDictionary.Add(groundNodes[i].ID, groundNodes[i]); e.NodesDictionary.Add(startNodeID + i, model.NodesDictionary[startNodeID + i]); if (isInHexaSoil) { foreach (Node node in groundAdjacentNodes) { e.NodesDictionary.Add(node.ID, node); } } model.ElementsDictionary.Add(e.ID, e); model.SubdomainsDictionary[subdomainID].ElementsDictionary.Add(e.ID, e); elementID++; } for (int i = 0; i < floors; i++) { double dens = i == floors - 1 ? 10 : 7.85; // Horizontal elements for (int j = 0; j < 3; j++) { for (int k = 0; k < 4; k++) { e = new Element() { ID = elementID, ElementType = new Beam3D(material, null, null) { Density = dens, SectionArea = b * h, MomentOfInertiaY = b * b * b * h, MomentOfInertiaZ = b * h * h * h, } }; e.NodesDictionary.Add(startNodeID + i * nodesPerFloor + j * 5 + k, model.NodesDictionary[startNodeID + i * nodesPerFloor + j * 5 + k]); e.NodesDictionary.Add(startNodeID + i * nodesPerFloor + j * 5 + k + 1, model.NodesDictionary[startNodeID + i * nodesPerFloor + j * 5 + k + 1]); model.ElementsDictionary.Add(e.ID, e); model.SubdomainsDictionary[subdomainID].ElementsDictionary.Add(e.ID, e); elementID++; } } e = new Element() { ID = elementID, ElementType = new Beam3D(material, null, null) { Density = dens, SectionArea = b * h, MomentOfInertiaY = b * b * b * h, MomentOfInertiaZ = b * h * h * h, } }; e.NodesDictionary.Add(startNodeID + i * nodesPerFloor + 3 * 5, model.NodesDictionary[startNodeID + i * nodesPerFloor + 3 * 5]); e.NodesDictionary.Add(startNodeID + i * nodesPerFloor + 3 * 5 + 1, model.NodesDictionary[startNodeID + i * nodesPerFloor + 3 * 5 + 1]); model.ElementsDictionary.Add(e.ID, e); model.SubdomainsDictionary[subdomainID].ElementsDictionary.Add(e.ID, e); elementID++; e = new Element() { ID = elementID, ElementType = new Beam3D(material, null, null) { Density = dens, SectionArea = b * h, MomentOfInertiaY = b * b * b * h, MomentOfInertiaZ = b * h * h * h, } }; e.NodesDictionary.Add(startNodeID + i * nodesPerFloor + 3 * 5 + 1, model.NodesDictionary[startNodeID + i * nodesPerFloor + 3 * 5 + 1]); e.NodesDictionary.Add(startNodeID + i * nodesPerFloor + 3 * 5 + 2, model.NodesDictionary[startNodeID + i * nodesPerFloor + 3 * 5 + 2]); model.ElementsDictionary.Add(e.ID, e); model.SubdomainsDictionary[subdomainID].ElementsDictionary.Add(e.ID, e); elementID++; // Vertical elements for (int j = 0; j < 5; j++) { for (int k = 0; k < 2; k++) { e = new Element() { ID = elementID, ElementType = new Beam3D(material, null, null) { Density = dens, SectionArea = b * h, MomentOfInertiaY = b * b * b * h, MomentOfInertiaZ = b * h * h * h, } }; e.NodesDictionary.Add(startNodeID + i * nodesPerFloor + k * 5 + j, model.NodesDictionary[startNodeID + i * nodesPerFloor + k * 5 + j]); e.NodesDictionary.Add(startNodeID + i * nodesPerFloor + (k + 1) * 5 + j, model.NodesDictionary[startNodeID + i * nodesPerFloor + (k + 1) * 5 + j]); model.ElementsDictionary.Add(e.ID, e); model.SubdomainsDictionary[subdomainID].ElementsDictionary.Add(e.ID, e); elementID++; } } e = new Element() { ID = elementID, ElementType = new Beam3D(material, null, null) { Density = dens, SectionArea = b * h, MomentOfInertiaY = b * b * b * h, MomentOfInertiaZ = b * h * h * h, } }; e.NodesDictionary.Add(startNodeID + i * nodesPerFloor + 2 * 5 + 2, model.NodesDictionary[startNodeID + i * nodesPerFloor + 2 * 5 + 2]); e.NodesDictionary.Add(startNodeID + i * nodesPerFloor + 2 * 5 + 5, model.NodesDictionary[startNodeID + i * nodesPerFloor + 2 * 5 + 5]); model.ElementsDictionary.Add(e.ID, e); model.SubdomainsDictionary[subdomainID].ElementsDictionary.Add(e.ID, e); elementID++; e = new Element() { ID = elementID, ElementType = new Beam3D(material, null, null) { Density = dens, SectionArea = b * h, MomentOfInertiaY = b * b * b * h, MomentOfInertiaZ = b * h * h * h, } }; e.NodesDictionary.Add(startNodeID + i * nodesPerFloor + 2 * 5 + 3, model.NodesDictionary[startNodeID + i * nodesPerFloor + 2 * 5 + 3]); e.NodesDictionary.Add(startNodeID + i * nodesPerFloor + 2 * 5 + 6, model.NodesDictionary[startNodeID + i * nodesPerFloor + 2 * 5 + 6]); model.ElementsDictionary.Add(e.ID, e); model.SubdomainsDictionary[subdomainID].ElementsDictionary.Add(e.ID, e); elementID++; e = new Element() { ID = elementID, ElementType = new Beam3D(material, null, null) { Density = dens, SectionArea = b * h, MomentOfInertiaY = b * b * b * h, MomentOfInertiaZ = b * h * h * h, } }; e.NodesDictionary.Add(startNodeID + i * nodesPerFloor + 2 * 5 + 4, model.NodesDictionary[startNodeID + i * nodesPerFloor + 2 * 5 + 4]); e.NodesDictionary.Add(startNodeID + i * nodesPerFloor + 2 * 5 + 7, model.NodesDictionary[startNodeID + i * nodesPerFloor + 2 * 5 + 7]); model.ElementsDictionary.Add(e.ID, e); model.SubdomainsDictionary[subdomainID].ElementsDictionary.Add(e.ID, e); elementID++; // Floor-to-floor beams if (i == floors - 1) { continue; } for (int j = 0; j < nodesPerFloor; j++) { e = new Element() { ID = elementID, ElementType = new Beam3D(material, null, null) { Density = dens, SectionArea = b * h, MomentOfInertiaY = b * b * b * h, MomentOfInertiaZ = b * h * h * h, } }; e.NodesDictionary.Add(startNodeID + i * nodesPerFloor + j, model.NodesDictionary[startNodeID + i * nodesPerFloor + j]); e.NodesDictionary.Add(startNodeID + (i + 1) * nodesPerFloor + j, model.NodesDictionary[startNodeID + (i + 1) * nodesPerFloor + j]); model.ElementsDictionary.Add(e.ID, e); model.SubdomainsDictionary[subdomainID].ElementsDictionary.Add(e.ID, e); elementID++; } } }