예제 #1
0
        public void Calculate()
        {
            Stopwatch     stopwatch            = new Stopwatch();
            Configuration config               = getConfiguration();
            GridManager   grid                 = new GridManager(config);
            JacobiTransformationManager jacobi = new JacobiTransformationManager(config);
            HMatrixManager   hMatrix           = new HMatrixManager(jacobi, config);
            CMatrixManager   cMatrix           = new CMatrixManager(jacobi, config);
            HbcMatrixManager hbcMatrix         = new HbcMatrixManager(jacobi, config);
            VectorPManager   vectorP           = new VectorPManager(config);
            MatrixAgregator  global            = new MatrixAgregator(hMatrix, cMatrix, grid, config, hbcMatrix, vectorP);


            FillMatrixes(global, grid);
            stopwatch.Start();
            Matrix <double> CMatrixDt          = CMatrix / config.simulationStepTime;
            Matrix <double> tempHMatrix        = CMatrixDt + HMatrix;
            Matrix <double> InverseTempHMatrix = tempHMatrix.Inverse();

            for (int i = (int)config.simulationStepTime; i <= config.simulationTime; i += (int)config.simulationStepTime)
            {
                Matrix <double> tempCMatrix = CMatrixDt * temp - PVector;
                Matrix <double> NewTemp     = InverseTempHMatrix * tempCMatrix;
                temp = NewTemp;
                Console.WriteLine("Time: " + i + " MinTemp: " + temp.Enumerate().Min() + " MaxTemp: " + temp.Enumerate().Max());
            }
            stopwatch.Stop();
            Console.WriteLine("Elapsed Time is {0} ms", stopwatch.ElapsedMilliseconds);
        }
예제 #2
0
 private void CalculateHbcMatrix(JacobiTransformationManager jacobi, Configuration config)
 {
     for (int i = 0; i < 4; i++)
     {
         for (int j = 0; j < 4; j++)
         {
             Pow1HbcMatrix[i, j] = config.alfa * XDeterminant * (Pow1NValues[0, i] * Pow1NValues[0, j] + Pow1NValues[1, i] * Pow1NValues[1, j]);
             Pow2HbcMatrix[i, j] = config.alfa * YDeterminant * (Pow2NValues[0, i] * Pow2NValues[0, j] + Pow2NValues[1, i] * Pow2NValues[1, j]);
             Pow3HbcMatrix[i, j] = config.alfa * XDeterminant * (Pow3NValues[0, i] * Pow3NValues[0, j] + Pow3NValues[1, i] * Pow3NValues[1, j]);
             Pow4HbcMatrix[i, j] = config.alfa * YDeterminant * (Pow4NValues[0, i] * Pow4NValues[0, j] + Pow4NValues[1, i] * Pow4NValues[1, j]);
         }
     }
 }
예제 #3
0
        public HbcMatrixManager(JacobiTransformationManager jacobi, Configuration config)
        {
            Pow1HbcMatrix = new double[4, 4];
            Pow2HbcMatrix = new double[4, 4];
            Pow3HbcMatrix = new double[4, 4];
            Pow4HbcMatrix = new double[4, 4];

            XDeterminant = (config.W / (config.nW - 1)) / 2;
            YDeterminant = (config.H / (config.nH - 1)) / 2;

            CalculateNMatrixes();
            CalculateHbcMatrix(jacobi, config);
        }