Exemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            PreprocessingModelling.getGaussianCoordinates(comboBox1.SelectedIndex);
            int NumbersOfNodes  = PreprocessingModelling.getElementNodesNumber();
            int DegreeOfFreedom = 3;

            PreprocessingModelling.removeExcessEtopol();
            int NumbersOfElements = PreprocessingModelling.getNumberOfElements();

            double[,] NodalCoordinates = Analysis.getNodalCoordinates();
            int GaussianNumber = MainInterface.XGaussianCoordinates.GetLength(0);

            double[,] ShapeFunctionDerivatives = Analysis.getShapeFunctionDerivatives(MainInterface.XGaussianCoordinates, MainInterface.YGaussianCoordinates, MainInterface.ZGaussianCoordinates);
            double[,] GlobalStiffnessMatrix    = new double[MainInterface.Nodes.Count() * DegreeOfFreedom, MainInterface.Nodes.Count() * DegreeOfFreedom]; //
            for (int i = 0; i < NumbersOfElements; i++)
            {
                double[,] StiffnessMatrix         = new double[NumbersOfNodes * DegreeOfFreedom, NumbersOfNodes *DegreeOfFreedom];
                double[,] ElementNodalCoordinates = Analysis.getElementNodalCoordinates(i, NodalCoordinates);
                double[,] Jacobian = Analysis.getJacobian(ElementNodalCoordinates);
                for (int j = 0; j < GaussianNumber; j++)
                {
                    double[,] GaussianJacobian = Analysis.getGaussianJacobian(j, Jacobian);
                    double JacobianDeterminant = Accord.Math.Matrix.Determinant(GaussianJacobian);
                    double[,] GaussianShapeFunctionDerivative       = Analysis.getGaussianShapeFunctionDerivatives(j, ShapeFunctionDerivatives);
                    double[,] ShapeFunctionDerivativeWRTCoordinates = Accord.Math.Matrix.Solve(GaussianJacobian, GaussianShapeFunctionDerivative);
                    double[,] StrainDisplacementMatrix = Analysis.getStrainDisplacementMatrix(ShapeFunctionDerivativeWRTCoordinates);
                    double[,] ConstitutiveMatrix       = Analysis.getConstitutiveMatrix(i);
                    StiffnessMatrix = Analysis.addStiffnessMatrix(StiffnessMatrix, StrainDisplacementMatrix, ConstitutiveMatrix, JacobianDeterminant, j);
                }
                GlobalStiffnessMatrix = Analysis.addGlobalStiffnessMatrix(i, GlobalStiffnessMatrix, StiffnessMatrix);
            }
            Analysis.calculateDisplacement(GlobalStiffnessMatrix);
            this.Close();
        }
Exemplo n.º 2
0
 public ElementCreation(int element_Type)
 {
     Nodes_Added   = 0;
     NumberOfNodes = PreprocessingModelling.getElementNodesNumber(element_Type);
     PreprocessingModelling.removeExcessEtopol(element_Type);
     InitializeComponent();
     dataGridView1.DataSource         = MainInterface.Nodes.Select(vector => new { X = vector.X, Y = vector.Y, Z = vector.Z }).ToList();
     this.dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
 }
Exemplo n.º 3
0
        public static double[,] getNodalCoordinates()
        {
            int NumbersOfNodes    = PreprocessingModelling.getElementNodesNumber();
            int NumbersOfElements = PreprocessingModelling.getNumberOfElements();

            double[,] NodalCoordinates = new double[NumbersOfElements * NumbersOfNodes, 3];
            for (int i = 0; i < NumbersOfElements * NumbersOfNodes; i++)
            {
                NodalCoordinates[i, 0] = MainInterface.Nodes[MainInterface.Etopol[i]].X;
                NodalCoordinates[i, 1] = MainInterface.Nodes[MainInterface.Etopol[i]].Y;
                NodalCoordinates[i, 2] = MainInterface.Nodes[MainInterface.Etopol[i]].Z;
            }
            return(NodalCoordinates);
        }
Exemplo n.º 4
0
        public static double[,] getElementNodalCoordinates(int elementBeingCalculated, double[,] nodalCoordinates)
        {
            int NumbersOfNodes = PreprocessingModelling.getElementNodesNumber();

            double[,] ElementNodalCoordinates = new double[NumbersOfNodes, 3];
            int j = 0;

            for (int i = elementBeingCalculated * NumbersOfNodes; i < (elementBeingCalculated + 1) * NumbersOfNodes; i++)
            {
                ElementNodalCoordinates[j, 0] = nodalCoordinates[i, 0];
                ElementNodalCoordinates[j, 1] = nodalCoordinates[i, 1];
                ElementNodalCoordinates[j, 2] = nodalCoordinates[i, 2];
                j += 1;
            }
            return(ElementNodalCoordinates);
        }
Exemplo n.º 5
0
        public static double[,] addGlobalStiffnessMatrix(int elementBeingCalculated, double[,] existingGlobalStiffnessMatrix, double[,] stiffnessMatrix)
        {
            int NumbersOfNodes           = PreprocessingModelling.getElementNodesNumber();
            int LocalStiffnessMatrixSize = stiffnessMatrix.GetLength(0);

            int[] GlobalStiffnessMatrixLocation = new int[LocalStiffnessMatrixSize];
            for (int i = 0; i < NumbersOfNodes; i++)
            {
                GlobalStiffnessMatrixLocation[i * 3]       = MainInterface.Etopol[(NumbersOfNodes * elementBeingCalculated) + i] * 3;
                GlobalStiffnessMatrixLocation[(i * 3) + 1] = GlobalStiffnessMatrixLocation[i * 3] + 1;
                GlobalStiffnessMatrixLocation[(i * 3) + 2] = GlobalStiffnessMatrixLocation[i * 3] + 2;
            }
            for (int i = 0; i < LocalStiffnessMatrixSize; i++)
            {
                for (int j = 0; j < LocalStiffnessMatrixSize; j++)
                {
                    existingGlobalStiffnessMatrix[GlobalStiffnessMatrixLocation[i], GlobalStiffnessMatrixLocation[j]] += stiffnessMatrix[i, j];
                }
            }
            return(existingGlobalStiffnessMatrix);
        }
Exemplo n.º 6
0
        public static double[,] getStrainDisplacementMatrix(double[,] shapeFunctionDerivativeWRTCoordinates)
        {
            int NumbersOfNodes  = PreprocessingModelling.getElementNodesNumber();
            int DegreeOfFreedom = 3;

            double[,] StrainDisplacementMatrix = new double[6, NumbersOfNodes *DegreeOfFreedom];  //TODO: Account for 9 rows situations and other cases too.
            for (int i = 0; i < NumbersOfNodes; i++)
            {
                int j = (3 * (i + 1)) - 3;
                StrainDisplacementMatrix[0, j]     = shapeFunctionDerivativeWRTCoordinates[0, i];
                StrainDisplacementMatrix[1, j + 1] = shapeFunctionDerivativeWRTCoordinates[1, i];
                StrainDisplacementMatrix[2, j + 2] = shapeFunctionDerivativeWRTCoordinates[2, i];
                StrainDisplacementMatrix[3, j]     = shapeFunctionDerivativeWRTCoordinates[1, i];
                StrainDisplacementMatrix[3, j + 1] = shapeFunctionDerivativeWRTCoordinates[0, i];
                StrainDisplacementMatrix[4, j + 1] = shapeFunctionDerivativeWRTCoordinates[2, i];
                StrainDisplacementMatrix[4, j + 2] = shapeFunctionDerivativeWRTCoordinates[1, i];
                StrainDisplacementMatrix[5, j]     = shapeFunctionDerivativeWRTCoordinates[2, i];
                StrainDisplacementMatrix[5, j + 2] = shapeFunctionDerivativeWRTCoordinates[0, i];
            }
            return(StrainDisplacementMatrix);
        }
Exemplo n.º 7
0
        public static double[,] getShapeFunctionDerivatives(int element_Type, double[,] xsi, double[,] eta, double[,] zet)
        {
            int NumberofNodes  = PreprocessingModelling.getElementNodesNumber(element_Type);
            int GaussianNumber = xsi.GetLength(0);

            double[,] ShapeFunctionDerivatives = new double[3 * NumberofNodes, GaussianNumber];
            if (NumberofNodes == 8)
            {
                for (int i = 0; i < NumberofNodes; i++)
                {
                    for (int j = 0; j < GaussianNumber; j++)
                    {
                        ShapeFunctionDerivatives[(3 * (j + 1)) - 3, i] = (Math.Sign(xsi[i, 0]) * (1 + Math.Sign(eta[i, 0]) * eta[j, 0]) * (1 + Math.Sign(zet[i, 0]) * zet[j, 0])) / 8;
                        ShapeFunctionDerivatives[(3 * (j + 1)) - 2, i] = (Math.Sign(eta[i, 0]) * (1 + Math.Sign(xsi[i, 0]) * xsi[j, 0]) * (1 + Math.Sign(zet[i, 0]) * zet[j, 0])) / 8;
                        ShapeFunctionDerivatives[(3 * (j + 1)) - 1, i] = (Math.Sign(zet[i, 0]) * (1 + Math.Sign(xsi[i, 0]) * xsi[j, 0]) * (1 + Math.Sign(eta[i, 0]) * eta[j, 0])) / 8;
                    }
                }
            }
            // TODO: Fill in the other Shape Function Derivatives.
            return(ShapeFunctionDerivatives);
        }
Exemplo n.º 8
0
        public static double[,] getShapeFunction(double[,] xsi, double[,] eta, double[,] zet)
        {
            int NumberofNodes  = PreprocessingModelling.getElementNodesNumber();
            int GaussianNumber = xsi.GetLength(0);

            double[,] ShapeFunction = new double[GaussianNumber, NumberofNodes];
            if (GaussianNumber == 8)
            {
                for (int i = 0; i < GaussianNumber; i++)
                {
                    ShapeFunction[i, 0] = 0.125 * (1 - xsi[i, 0]) * (1 - eta[i, 0]) * (1 - zet[i, 0]);
                    ShapeFunction[i, 1] = 0.125 * (1 - xsi[i, 0]) * (1 - eta[i, 0]) * (1 + zet[i, 0]);
                    ShapeFunction[i, 2] = 0.125 * (1 + xsi[i, 0]) * (1 - eta[i, 0]) * (1 + zet[i, 0]);
                    ShapeFunction[i, 3] = 0.125 * (1 + xsi[i, 0]) * (1 - eta[i, 0]) * (1 - zet[i, 0]);
                    ShapeFunction[i, 4] = 0.125 * (1 - xsi[i, 0]) * (1 + eta[i, 0]) * (1 - zet[i, 0]);
                    ShapeFunction[i, 5] = 0.125 * (1 - xsi[i, 0]) * (1 + eta[i, 0]) * (1 + zet[i, 0]);
                    ShapeFunction[i, 6] = 0.125 * (1 + xsi[i, 0]) * (1 + eta[i, 0]) * (1 + zet[i, 0]);
                    ShapeFunction[i, 7] = 0.125 * (1 + xsi[i, 0]) * (1 + eta[i, 0]) * (1 - zet[i, 0]);
                }
            }
            // TODO: Fill in the other Shape Functions.
            return(ShapeFunction);
        }