Ejemplo n.º 1
0
        // alfa*{N}{N}T  dS
        private double[,] CalculateH_bc(int alfa)
        {
            pc = new IntegrationPoint[4][];
            for (int i = 0; i < 4; i++)
            {
                pc[i] = new IntegrationPoint[2];
            }

            // na kazdy bok przypadają dwa punkty całkowania

            pc[0][0] = new IntegrationPoint(-1 / Math.Sqrt(3), -1, 1, 1);
            pc[0][1] = new IntegrationPoint(1 / Math.Sqrt(3), -1, 1, 1);

            pc[1][0] = new IntegrationPoint(1, -1 / Math.Sqrt(3), 1, 1);
            pc[1][1] = new IntegrationPoint(1, 1 / Math.Sqrt(3), 1, 1);

            pc[2][0] = new IntegrationPoint(1 / Math.Sqrt(3), 1, 1, 1);
            pc[2][1] = new IntegrationPoint(-1 / Math.Sqrt(3), 1, 1, 1);

            pc[3][0] = new IntegrationPoint(-1, 1 / Math.Sqrt(3), 1, 1);
            pc[3][1] = new IntegrationPoint(-1, -1 / Math.Sqrt(3), 1, 1);


            double[,] H_bc = new double[4, 4];

            //SPRAWDZANIE WARUNKU BRZEGOWEGO
            for (int i = 0; i < 4; i++)
            {
                if (Nodes[i].IsBoundary && Nodes[(i + 1) % 4].IsBoundary)
                {
                    Node   bc1      = Nodes[i];
                    Node   bc2      = Nodes[(i + 1) % 4];
                    double distance = Math.Sqrt(Math.Pow((bc1.GlobalX - bc2.GlobalX), 2) + Math.Pow((bc1.GlobalY - bc2.GlobalY), 2));
                    double detJ     = distance / 2;

                    IntegrationPoint[] pcForBoundary = pc[i];

                    double[,] matrixFor1pc = new double[4, 4];
                    double[,] matrixFor2pc = new double[4, 4];

                    // alfa * {N} * {N}transposed dla kazdego pc
                    matrixFor1pc = MatrixUtils.MultiplyMatrices(UniversalElement.NVector(pcForBoundary[0]), UniversalElement.NVectorTransposed(pcForBoundary[0]));
                    matrixFor2pc = MatrixUtils.MultiplyMatrices(UniversalElement.NVector(pcForBoundary[1]), UniversalElement.NVectorTransposed(pcForBoundary[1]));
                    matrixFor1pc = MatrixUtils.MultiplyMatrix(matrixFor1pc, alfa);
                    matrixFor2pc = MatrixUtils.MultiplyMatrix(matrixFor2pc, alfa);

                    //H_bc += matrixFor1pc * pcForBoundary[0].WeightEta * detJ + matrixFor2pc * pcForBoundary[1].WeightEta * detJ;
                    H_bc = MatrixUtils.AddMatrices(H_bc, MatrixUtils.AddMatrices(MatrixUtils.MultiplyMatrix((MatrixUtils.MultiplyMatrix(matrixFor1pc, pcForBoundary[0].WeightEta)), detJ), MatrixUtils.MultiplyMatrix(MatrixUtils.MultiplyMatrix(matrixFor2pc, pcForBoundary[1].WeightEta), detJ)));
                }
                else
                {
                    continue;
                }
            }
            this.HLocalMatrix = MatrixUtils.AddMatrices(this.HLocalMatrix, H_bc);
            return(H_bc);
        }
Ejemplo n.º 2
0
        // -alfa*{N} dS
        private void CalculateP(int alfa, double ambientTemperature)
        {
            pc = new IntegrationPoint[4][];
            for (int i = 0; i < 4; i++)
            {
                pc[i] = new IntegrationPoint[2];
            }

            // na kazdy bok przypadają dwa punkty całkowania
            pc[0][0] = new IntegrationPoint(-1 / Math.Sqrt(3), -1, 1, 1);
            pc[0][1] = new IntegrationPoint(1 / Math.Sqrt(3), -1, 1, 1);

            pc[1][0] = new IntegrationPoint(1, -1 / Math.Sqrt(3), 1, 1);
            pc[1][1] = new IntegrationPoint(1, 1 / Math.Sqrt(3), 1, 1);

            pc[2][0] = new IntegrationPoint(1 / Math.Sqrt(3), 1, 1, 1);
            pc[2][1] = new IntegrationPoint(-1 / Math.Sqrt(3), 1, 1, 1);

            pc[3][0] = new IntegrationPoint(-1, 1 / Math.Sqrt(3), 1, 1);
            pc[3][1] = new IntegrationPoint(-1, -1 / Math.Sqrt(3), 1, 1);

            double[,] P = new double[4, 1];

            //SPRAWDZANIE WARUNKU BRZEGOWEGO - lewy i prawy dolny róg mają warunek brzegowy ustawiony na 1
            for (int i = 0; i < 4; i++)
            {
                if (Nodes[i].IsBoundary && Nodes[(i + 1) % 4].IsBoundary)
                {
                    Node   bc1      = Nodes[i];
                    Node   bc2      = Nodes[(i + 1) % 4];
                    double distance = Math.Sqrt(Math.Pow((bc1.GlobalX - bc2.GlobalX), 2) + Math.Pow((bc1.GlobalY - bc2.GlobalY), 2));
                    double detJ     = distance / 2;

                    IntegrationPoint[] pcForBoundary = pc[i];

                    double[,] matrixFor1pc = new double[4, 1];
                    double[,] matrixFor2pc = new double[4, 1];

                    //  temp otoczenia * alfa * {N}  dla kazdego pc
                    matrixFor1pc = UniversalElement.NVector(pcForBoundary[0]);
                    matrixFor2pc = UniversalElement.NVector(pcForBoundary[1]);
                    matrixFor1pc = MatrixUtils.MultiplyMatrix(matrixFor1pc, alfa * ambientTemperature);
                    matrixFor2pc = MatrixUtils.MultiplyMatrix(matrixFor2pc, alfa * ambientTemperature);

                    double[,] integralMatrix = MatrixUtils.AddMatrices(MatrixUtils.MultiplyMatrix(matrixFor1pc, detJ), MatrixUtils.MultiplyMatrix(matrixFor2pc, detJ));
                    //P += matrixFor1pc * pcForBoundary[0].WeightEta * detJ + matrixFor2pc * pcForBoundary[1].WeightEta * detJ;
                    P = MatrixUtils.AddMatrices(P, MatrixUtils.MultiplyMatrix(integralMatrix, -1));
                }
                else
                {
                    continue;
                }
            }

            LocalP = P;
        }
Ejemplo n.º 3
0
        public static double[,] NVectorTransposed(IntegrationPoint integrationPoint)  // {N} transponowanie
        {
            double[,] NVectTransposed = new double[1, 4];
            NVectTransposed[0, 0]     = N1_local(integrationPoint);
            NVectTransposed[0, 1]     = N2_local(integrationPoint);
            NVectTransposed[0, 2]     = N3_local(integrationPoint);
            NVectTransposed[0, 3]     = N4_local(integrationPoint);

            return(NVectTransposed);
        }
Ejemplo n.º 4
0
        public static double[,] NVector(IntegrationPoint integrationPoint)  // {N} z poszczegilnych N1..N4
        {
            double[,] NVect = new double[4, 1];
            NVect[0, 0]     = N1_local(integrationPoint);
            NVect[1, 0]     = N2_local(integrationPoint);
            NVect[2, 0]     = N3_local(integrationPoint);
            NVect[3, 0]     = N4_local(integrationPoint);

            return(NVect);
        }
Ejemplo n.º 5
0
        public static double N3_local(IntegrationPoint integrationPoint)
        {
            double N3 = 0.25 * (1 + integrationPoint.Ksi) * (1 + integrationPoint.Eta);

            return(N3);
        }
Ejemplo n.º 6
0
        public static double N2_local(IntegrationPoint integrationPoint)
        {
            double N2 = 0.25 * (1 + integrationPoint.Ksi) * (1 - integrationPoint.Eta);

            return(N2);
        }
Ejemplo n.º 7
0
        public static double N1_local(IntegrationPoint integrationPoint)
        {
            double N1 = 0.25 * (1 - integrationPoint.Ksi) * (1 - integrationPoint.Eta);

            return(N1);
        }