Ejemplo n.º 1
0
            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 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);
        }
        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);
        }
Ejemplo n.º 4
0
        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 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 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);
                    }
                }
            }