Exemplo n.º 1
0
        public void calculate(Matrix K, Vector b, Vector T)
        {
            Console.WriteLine("Iniciando calculo de respuesta...");
            Matrix Kinv = new Matrix();

            Console.WriteLine("Calculo de inversa...");
            Math_tools.inverseMatrix(K, Kinv);

            Console.WriteLine("Calculo de respuesta...");
            Math_tools.productMatrixVector(Kinv, b, T);
        }
Exemplo n.º 2
0
        public Vector createLocalb(int element, Mesh m)
        {
            Vector b = new Vector();

            float J = calculateLocalJ(element, m);

            Math_tools.zeroes(b, 30);

            //FALTA MODIFICAR, HAY QUE OBTENER LOS VALORES DESDE EL ARCHIVO PARA HACER ESTO

            b[0]  = (J / 120) * 3540;
            b[1]  = (J / 120) * -60;
            b[2]  = (J / 120) * -60;
            b[3]  = (J / 120) * -60;
            b[4]  = (J / 120) * 240;
            b[5]  = (J / 120) * 240;
            b[6]  = (J / 120) * 240;
            b[7]  = (J / 120) * 240;
            b[8]  = (J / 120) * 240;
            b[9]  = (J / 120) * 240;
            b[10] = (J / 120) * 177;
            b[11] = (J / 120) * -3;
            b[12] = (J / 120) * -3;
            b[13] = (J / 120) * -3;
            b[14] = (J / 120) * 12;
            b[15] = (J / 120) * 12;
            b[16] = (J / 120) * 12;
            b[17] = (J / 120) * 12;
            b[18] = (J / 120) * 12;
            b[19] = (J / 120) * 12;
            b[20] = (J / 120) * -1711;
            b[21] = (J / 120) * 29;
            b[22] = (J / 120) * 29;
            b[23] = (J / 120) * 29;
            b[24] = (J / 120) * -116;
            b[25] = (J / 120) * -116;
            b[26] = (J / 120) * -116;
            b[27] = (J / 120) * -116;
            b[28] = (J / 120) * -116;
            b[29] = (J / 120) * -116;

            return(b);
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            string filename = args[0];

            List <Matrix> localKs = new List <Matrix>();
            List <Vector> localbs = new List <Vector>();


            Matrix K   = new Matrix();
            Vector b   = new Vector();
            Vector T   = new Vector();
            Sel    sel = new Sel();

            Console.Write("IMPLEMENTACION DEL METODO DE LOS ELEMENTOS FINITOS\n"
                          + "\t- TRANSFERENCIA DE CALOR\n" + "\t- 3 DIMENSIONES\n" +
                          "\t- FUNCIONES DE FORMA LINEALES\n" + "\t- PESOS DE GALERKIN\n"
                          + "\t- ELEMENTOS TETRAHEDROS\n" +
                          "*********************************************************************************\n\n");

            Mesh m = new Mesh();

            Tools.leerMallayCondiciones(m, filename + ".dat");
            Console.WriteLine("Datos obtenidos correctamente");

            sel.crearSistemasLocales(m, localKs, localbs);

            Math_tools.zeroes(K, m.getSize((int)Classes.size.NODES));
            Math_tools.zeroes(b, m.getSize((int)Classes.size.NODES));

            sel.ensamblaje(m, localKs, localbs, K, b);

            sel.applyNeumann(m, b);
            sel.applyDirichlet(m, K, b);

            Math_tools.zeroes(T, b.Count);
            sel.calculate(K, b, T);

            Tools.writeResults(m, T, filename);
        }
Exemplo n.º 4
0
        public Matrix createLocalK(int id, Mesh m)//id = element
        {
            Matrix localK   = new Matrix();
            float  EI       = 88f; //VALOR QUEMADO PORQUE ES EL RANDOMIZADO
            float  Jacobian = calculateLocalJ(id, m);

            ////
            float A = calculateElement_A(id, m);
            float B = calculateElement_B(id, m);
            float C = calculateElement_C(id, m);
            float D = calculateElement_D(id, m);
            float E = calculateElement_E(id, m);
            float F = calculateElement_F(id, m);
            float G = calculateElement_G(id, m);
            float H = calculateElement_H(id, m);
            float I = calculateElement_I(id, m);
            float J = calculateElement_J(id, m);
            float K = calculateElement_K(id, m);

            Math_tools.zeroes(localK, 30);


            //SI TRUENA, ES PORQUE SE DURMIERON Y ME DICTARON MAL MATRIZ MIU
            //COPY 1
            localK[0][0] = (EI * Jacobian) * A;
            localK[0][1] = (EI * Jacobian) * E;
            localK[0][4] = (EI * Jacobian) * -E;
            localK[0][6] = (EI * Jacobian) * -F;
            localK[0][7] = (EI * Jacobian) * G;
            localK[0][8] = (EI * Jacobian) * F;
            localK[0][9] = (EI * Jacobian) * F;

            localK[1][0] = (EI * Jacobian) * E;
            localK[1][1] = (EI * Jacobian) * B;
            localK[1][4] = (EI * Jacobian) * -H;
            localK[1][6] = (EI * Jacobian) * -H;
            localK[1][7] = (EI * Jacobian) * I;
            localK[1][8] = (EI * Jacobian) * H;
            localK[1][9] = (EI * Jacobian) * H;

            localK[4][0] = (EI * Jacobian) * -F;
            localK[4][1] = (EI * Jacobian) * -H;
            localK[4][4] = (EI * Jacobian) * C;
            localK[4][6] = (EI * Jacobian) * J;
            localK[4][7] = (EI * Jacobian) * -K;
            localK[4][8] = (EI * Jacobian) * -C;
            localK[4][9] = (EI * Jacobian) * -J;

            localK[6][0] = (EI * Jacobian) * -F;
            localK[6][1] = (EI * Jacobian) * -H;
            localK[6][4] = (EI * Jacobian) * J;
            localK[6][6] = (EI * Jacobian) * C;
            localK[6][7] = (EI * Jacobian) * -K;
            localK[6][8] = (EI * Jacobian) * -J;
            localK[6][9] = (EI * Jacobian) * -C;

            localK[7][0] = (EI * Jacobian) * G;
            localK[7][1] = (EI * Jacobian) * I;
            localK[7][4] = (EI * Jacobian) * -K;
            localK[7][6] = (EI * Jacobian) * -K;
            localK[7][7] = (EI * Jacobian) * D;
            localK[7][8] = (EI * Jacobian) * K;
            localK[7][9] = (EI * Jacobian) * K;

            localK[8][0] = (EI * Jacobian) * F;
            localK[8][1] = (EI * Jacobian) * H;
            localK[8][4] = (EI * Jacobian) * -C;
            localK[8][6] = (EI * Jacobian) * -J;
            localK[8][7] = (EI * Jacobian) * K;
            localK[8][8] = (EI * Jacobian) * C;
            localK[8][9] = (EI * Jacobian) * J;

            localK[9][0] = (EI * Jacobian) * F;
            localK[9][1] = (EI * Jacobian) * H;
            localK[9][4] = (EI * Jacobian) * -J;
            localK[9][6] = (EI * Jacobian) * -C;
            localK[9][7] = (EI * Jacobian) * K;
            localK[9][8] = (EI * Jacobian) * J;
            localK[9][9] = (EI * Jacobian) * C;

            //COPY 2
            localK[10][10] = (EI * Jacobian) * A;
            localK[10][11] = (EI * Jacobian) * E;
            localK[10][14] = (EI * Jacobian) * -E;
            localK[10][16] = (EI * Jacobian) * -F;
            localK[10][17] = (EI * Jacobian) * G;
            localK[10][18] = (EI * Jacobian) * F;
            localK[10][19] = (EI * Jacobian) * F;

            localK[11][10] = (EI * Jacobian) * E;
            localK[11][11] = (EI * Jacobian) * B;
            localK[11][14] = (EI * Jacobian) * -H;
            localK[11][16] = (EI * Jacobian) * -H;
            localK[11][17] = (EI * Jacobian) * I;
            localK[11][18] = (EI * Jacobian) * H;
            localK[11][19] = (EI * Jacobian) * H;

            localK[14][10] = (EI * Jacobian) * -F;
            localK[14][11] = (EI * Jacobian) * -H;
            localK[14][14] = (EI * Jacobian) * C;
            localK[14][16] = (EI * Jacobian) * J;
            localK[14][17] = (EI * Jacobian) * -K;
            localK[14][18] = (EI * Jacobian) * -C;
            localK[14][19] = (EI * Jacobian) * -J;

            localK[16][10] = (EI * Jacobian) * -F;
            localK[16][11] = (EI * Jacobian) * -H;
            localK[16][14] = (EI * Jacobian) * J;
            localK[16][16] = (EI * Jacobian) * C;
            localK[16][17] = (EI * Jacobian) * -K;
            localK[16][18] = (EI * Jacobian) * -J;
            localK[16][19] = (EI * Jacobian) * -C;

            localK[17][10] = (EI * Jacobian) * G;
            localK[17][11] = (EI * Jacobian) * I;
            localK[17][14] = (EI * Jacobian) * -K;
            localK[17][16] = (EI * Jacobian) * -K;
            localK[17][17] = (EI * Jacobian) * D;
            localK[17][18] = (EI * Jacobian) * K;
            localK[17][19] = (EI * Jacobian) * K;

            localK[18][10] = (EI * Jacobian) * F;
            localK[18][11] = (EI * Jacobian) * H;
            localK[18][14] = (EI * Jacobian) * -C;
            localK[18][16] = (EI * Jacobian) * -J;
            localK[18][17] = (EI * Jacobian) * K;
            localK[18][18] = (EI * Jacobian) * C;
            localK[18][19] = (EI * Jacobian) * J;

            localK[19][10] = (EI * Jacobian) * F;
            localK[19][11] = (EI * Jacobian) * H;
            localK[19][14] = (EI * Jacobian) * -J;
            localK[19][16] = (EI * Jacobian) * -C;
            localK[19][17] = (EI * Jacobian) * K;
            localK[19][18] = (EI * Jacobian) * J;
            localK[19][19] = (EI * Jacobian) * C;

            //COPY 3

            localK[20][20] = (EI * Jacobian) * A;
            localK[20][21] = (EI * Jacobian) * E;
            localK[20][24] = (EI * Jacobian) * -E;
            localK[20][26] = (EI * Jacobian) * -F;
            localK[20][27] = (EI * Jacobian) * G;
            localK[20][28] = (EI * Jacobian) * F;
            localK[20][29] = (EI * Jacobian) * F;

            localK[21][20] = (EI * Jacobian) * E;
            localK[21][21] = (EI * Jacobian) * B;
            localK[21][24] = (EI * Jacobian) * -H;
            localK[21][26] = (EI * Jacobian) * -H;
            localK[21][27] = (EI * Jacobian) * I;
            localK[21][28] = (EI * Jacobian) * H;
            localK[21][29] = (EI * Jacobian) * H;

            localK[24][20] = (EI * Jacobian) * -F;
            localK[24][21] = (EI * Jacobian) * -H;
            localK[24][24] = (EI * Jacobian) * C;
            localK[24][26] = (EI * Jacobian) * J;
            localK[24][27] = (EI * Jacobian) * -K;
            localK[24][28] = (EI * Jacobian) * -C;
            localK[24][29] = (EI * Jacobian) * -J;

            localK[26][20] = (EI * Jacobian) * -F;
            localK[26][21] = (EI * Jacobian) * -H;
            localK[26][24] = (EI * Jacobian) * J;
            localK[26][26] = (EI * Jacobian) * C;
            localK[26][27] = (EI * Jacobian) * -K;
            localK[26][28] = (EI * Jacobian) * -J;
            localK[26][29] = (EI * Jacobian) * -C;

            localK[27][20] = (EI * Jacobian) * G;
            localK[27][21] = (EI * Jacobian) * I;
            localK[27][24] = (EI * Jacobian) * -K;
            localK[27][26] = (EI * Jacobian) * -K;
            localK[27][27] = (EI * Jacobian) * D;
            localK[27][28] = (EI * Jacobian) * K;
            localK[27][29] = (EI * Jacobian) * K;

            localK[28][20] = (EI * Jacobian) * F;
            localK[28][21] = (EI * Jacobian) * H;
            localK[28][24] = (EI * Jacobian) * -C;
            localK[28][26] = (EI * Jacobian) * -J;
            localK[28][27] = (EI * Jacobian) * K;
            localK[28][28] = (EI * Jacobian) * C;
            localK[28][29] = (EI * Jacobian) * J;

            localK[29][20] = (EI * Jacobian) * F;
            localK[29][21] = (EI * Jacobian) * H;
            localK[29][24] = (EI * Jacobian) * -J;
            localK[29][26] = (EI * Jacobian) * -C;
            localK[29][27] = (EI * Jacobian) * K;
            localK[29][28] = (EI * Jacobian) * J;
            localK[29][29] = (EI * Jacobian) * C;

            return(localK);
        }