public static double[,] ComputeConvectionMatrix(PolyMatrix N, double u, double v, double w, Point Size) { var ConvectionMatrix = N.Transpose() * (u * N.Differentiate(0) + v * N.Differentiate(1) + w * N.Differentiate(2)); var Zero = new Point(); // point that starts at the origin return(ConvectionMatrix.Integrate(Zero, Size)); }
public static PolyMatrix ComputeGradientMatrix(PolyMatrix N) { if (N.Rows > 1) { throw new Exception("N must be 1 row x n cols"); } var Ndx = N.Differentiate(0); var Ndy = N.Differentiate(1); var Ndz = N.Differentiate(2); var B = new PolyMatrix(3, N.Cols); for (int j = 0; j < N.Cols; j++) { B.Data[0, j] = Ndx.Data[0, j]; B.Data[1, j] = Ndy.Data[0, j]; B.Data[2, j] = Ndz.Data[0, j]; } return(B); }