Ejemplo n.º 1
0
 public static Double[] Count_PforPow(Double L, Double T0, Double alpha, BCForHbc pow, bool count = false)
 {
     Double[] vP;
     if (!dictvP.TryGetValue(pow, out vP) || count)
     {
         dictvP[pow] = Count_vP(UniversalElement.GetBCPoints(pow), L, T0, alpha);
         vP          = dictvP[pow];
     }
     return(vP);
 }
Ejemplo n.º 2
0
        public static MatrixFEM Count_Hbc_for_edge(Grid grid, Element element, Double alpha, BCForHbc pow)
        {
            MatrixFEM matrixHbc = new MatrixFEM();

            Node[]     nodes   = GetElementNodes(grid, element);
            Double[][] matrixN = new Double[2][];
            var        points  = UniversalElement.GetBCPoints(pow);
            Double     L       = 0;

            switch (pow)
            {
            case BCForHbc.Pow1:
                L = (Double)Math.Sqrt(Math.Pow(nodes[1].X - nodes[0].X, 2) + Math.Pow(nodes[1].Y - nodes[0].Y, 2));
                break;

            case BCForHbc.Pow2:
                L = (Double)Math.Sqrt(Math.Pow(nodes[2].X - nodes[1].X, 2) + Math.Pow(nodes[2].Y - nodes[1].Y, 2));
                break;

            case BCForHbc.Pow3:
                L = (Double)Math.Sqrt(Math.Pow(nodes[3].X - nodes[2].X, 2) + Math.Pow(nodes[3].Y - nodes[2].Y, 2));
                break;

            case BCForHbc.Pow4:
                L = (Double)Math.Sqrt(Math.Pow(nodes[0].X - nodes[3].X, 2) + Math.Pow(nodes[0].Y - nodes[3].Y, 2));
                break;
            }
            Double detJ = L / 2f;

            for (var i = 0; i < 2; i++)
            {
                matrixN[i]    = new Double[4];
                matrixN[i][0] = func_N1(points[i].Xi, points[i].Eta);
                matrixN[i][1] = func_N2(points[i].Xi, points[i].Eta);
                matrixN[i][2] = func_N3(points[i].Xi, points[i].Eta);
                matrixN[i][3] = func_N4(points[i].Xi, points[i].Eta);
            }

            for (var i = 0; i < 4; i++)
            {
                for (var j = 0; j < 4; j++)
                {
                    matrixHbc[i, j]  = matrixN[0][j] * matrixN[0][i];
                    matrixHbc[i, j] += matrixN[1][j] * matrixN[1][i];
                    matrixHbc[i, j] *= alpha * detJ;
                }
            }

            return(matrixHbc);
        }