예제 #1
0
        override public void initialize()
        {
            cell_size = Blocks.cell_size;

            problem_size  = Instance.problem_size;
            problem_class = Instance.CLASS;
            niter         = Instance.niter_default;

            ncells      = Problem.NCells;
            grid_points = Problem.grid_points;
        }
예제 #2
0
        override public void initialize()
        {
            itmax         = Instance.itmax;
            problem_class = Instance.CLASS;
            isiz01        = Instance.isiz01;
            isiz02        = Instance.isiz02;
            isiz03        = Instance.isiz03;

            nx0 = Blocks.nx0;
            ny0 = Blocks.ny0;
            nz0 = Blocks.nz0;

            worldcomm = Mpi.worldComm();
        }
        override public void initialize()
        {
            nx            = Instance.nx;
            ny            = Instance.ny;
            nz            = Instance.nz;
            niter_default = Instance.niter_default;
            problem_class = Instance.CLASS;
            T_max         = Constants.T_max;
            T_total       = Constants.T_total;
            T_checksum    = Constants.T_checksum;

            layout_0D = Constants.layout_0D;
            layout_1D = Constants.layout_1D;
            layout_2D = Constants.layout_2D;
        }
예제 #4
0
        public override int go()
        {
            double        err, epsilon, a, b, c, d, r1, r2;
            PROBLEM_CLASS clss = Instance.CLASS;
            int           node = this.GlobalRank;

            if (node != 0)
            {
                return(0);
            }
            epsilon = 0.000000000001;
            int verified = 0;

            for (int i = 0; i < nt; i++)
            {
                a   = sums[i * 2 + REAL] - csum_ref[i * 2 + REAL];
                b   = sums[i * 2 + IMAG] - csum_ref[i * 2 + IMAG];
                c   = csum_ref[i * 2 + REAL];
                d   = csum_ref[i * 2 + IMAG];
                r1  = ((a * c + b * d) / ((c * c) + (d * d))) * ((a * c + b * d) / ((c * c) + (d * d)));
                r2  = ((c * b - a * d) / (c * c + d * d)) * ((c * b - a * d) / (c * c + d * d));
                err = Math.Sqrt(r1 + r2);
                if (!(err <= epsilon))
                {
                    goto Go100;
                }
            }
            verified = 1;

Go100:
            if (verified == 1)
            {
                Console.WriteLine(" Result verification successful");
            }
            else
            {
                Console.WriteLine(" Result verification failed");
            }
            Console.WriteLine("Class = " + clss.ToString()[0]);
            return(verified);
        }
        public override int go()
        {
            int    no_time_steps = Instance.niter_default;
            double dt            = Instance.dt_default;

            grid_points = Problem.grid_points;

            double[] xcrref = Instance.xcrref, xceref = Instance.xceref,
            xcrdif = new double[5], xcedif = new double[5],
            xce    = Error_norm.xce, xcr = Rhs_norm.xcr;
            double dtref = Instance.dtref;
            int    m;

            PROBLEM_CLASS clss = Instance.CLASS;

            //---------------------------------------------------------------------
            //   compute the error norm and the residual norm, and exit if not printing
            //---------------------------------------------------------------------

            // error_norm(xce);
            Error_norm.go();

            // copy_faces();
            if (Ranks.Length > 1)
            {
                Copy_faces.go();
            }

            Compute_rhs.go();

            //rhs_norm(xcr);
            Rhs_norm.go();

            for (m = 0; m < 5; m++)
            {
                xcr[m] /= dt;
            }

            //for (m = 0; m < 5; m++)
            //{
            //    xcrref[m] = 1.0d;
            //    xceref[m] = 1.0d;
            //}

            //---------------------------------------------------------------------
            //    verification test for residuals if gridsize is either 12X12X12 or
            //    64X64X64 or 102X102X102 or 162X162X162
            //---------------------------------------------------------------------

            //---------------------------------------------------------------------
            //    Compute the difference of solution values and the known reference values.
            //---------------------------------------------------------------------
            for (m = 0; m < 5; m++)
            {
                xcrdif[m] = Math.Abs((xcr[m] - xcrref[m]) / xcrref[m]);
                xcedif[m] = Math.Abs((xce[m] - xceref[m]) / xceref[m]);
            }
            //---------------------------------------------------------------------
            //   tolerance level
            //---------------------------------------------------------------------
            double epsilon = 1.0E-8d;

            //---------------------------------------------------------------------
            //    Output the comparison of computed results to known cases.
            //---------------------------------------------------------------------
            if (clss != PROBLEM_CLASS.U)
            {
                Console.WriteLine(" Verification being performed for class " + clss);
                Console.WriteLine(" Accuracy setting for epsilon = " + epsilon);
                if (Math.Abs(dt - dtref) <= epsilon)
                {
                    if (verified == -1)
                    {
                        verified = 1;
                    }
                }
                else
                {
                    verified = 0;
                    clss     = PROBLEM_CLASS.U;
                    Console.WriteLine("DT does not match the reference value of " + dtref);
                }
                Console.WriteLine(" Comparison of RMS-norms of residual");
            }
            else
            {
                Console.WriteLine(" Unknown CLASS");
                Console.WriteLine(" RMS-norms of residual");
            }
            verified = BMResults.printComparisonStatus(clss.ToString()[0], verified, epsilon,
                                                       xcr, xcrref, xcrdif);
            if (clss != PROBLEM_CLASS.U)
            {
                Console.WriteLine(" Comparison of RMS-norms of solution error");
            }
            else
            {
                Console.WriteLine(" RMS-norms of solution error");
            }
            verified = BMResults.printComparisonStatus(clss.ToString()[0], verified, epsilon,
                                                       xce, xceref, xcedif);

            BMResults.printVerificationStatus(clss.ToString()[0], verified, BMName);

            return(0);
        } // end activate method
        public override int go()
        {
            double[] xcrdif = new double[5];
            double[] xcedif = new double[5];
            double   epsilon, xcidif;
            int      m;

            Console.WriteLine("BEGIN VERIFY 1");
            PROBLEM_CLASS clss = Instance.CLASS;

            epsilon  = 1.0E-08;
            verified = 1;
            Console.WriteLine("BEGIN VERIFY 2 " + (xcr == null) + " - " + (xce == null) + " - " + (xcrref == null));
            for (m = 0; m < 5; m++)
            {
                xcrdif[m] = Math.Abs((xcr[m] - xcrref[m]) / xcrref[m]);
                xcedif[m] = Math.Abs((xce[m] - xceref[m]) / xceref[m]);
            }
            Console.WriteLine("BEGIN VERIFY 3");

            xcidif = Math.Abs((xci - xciref) / xciref);

            if (clss != PROBLEM_CLASS.U)
            {
                Console.WriteLine(" Verification being performed for class " + clss);
                Console.WriteLine(" Accuracy setting for epsilon = " + epsilon);
                verified = (Math.Abs(dt - dtref) <= epsilon)?1:0;
                if (!(verified == 1))
                {
                    clss = PROBLEM_CLASS.U;
                    Console.WriteLine(" DT does not match the reference value of " + dtref);
                }
            }
            else
            {
                Console.WriteLine(" Unknown class");
            }

            if (clss != PROBLEM_CLASS.U)
            {
                Console.WriteLine(" Comparison of RMS-norms of residual");
            }
            else
            {
                Console.WriteLine(" RMS-norms of residual");
            }

            for (m = 0; m < 5; m++)
            {
                if (clss == PROBLEM_CLASS.U)
                {
                    Console.WriteLine("          " + m + " " + xcr[m]);
                }
                else if (xcrdif[m] <= epsilon)
                {
                    Console.WriteLine("          " + m + " " + xcr[m] + " " + xcrref[m] + " " + xcrdif[m]);
                }
                else
                {
                    Console.WriteLine(" FAILURE: " + m + " " + xcr[m] + " " + xcrref[m] + " " + xcrdif[m]);
                    verified = 0;
                }
            }

            if (clss != PROBLEM_CLASS.U)
            {
                Console.WriteLine(" Comparison of RMS-norms of solution error");
            }
            else
            {
                Console.WriteLine(" RMS-norms of solution error");
            }

            for (m = 0; m < 5; m++)
            {
                if (clss == PROBLEM_CLASS.U)
                {
                    Console.WriteLine("          " + m + " " + xce[m]);
                }
                else if (xcedif[m] <= epsilon)
                {
                    Console.WriteLine("          " + m + " " + xce[m] + " " + xceref[m] + " " + xcedif[m]);
                }
                else
                {
                    verified = 0;
                    Console.WriteLine(" FAILURE: " + m + " " + xce[m] + " " + xceref[m] + " " + xcedif[m]);
                }
            }
            if (clss != PROBLEM_CLASS.U)
            {
                Console.WriteLine(" Comparison of surface integral");
            }
            else
            {
                Console.WriteLine(" Surface integral");
            }
            if (clss == PROBLEM_CLASS.U)
            {
                Console.WriteLine("          " + xci);
            }
            else if (xcidif <= epsilon)
            {
                Console.WriteLine("          " + xci + " " + xciref + " " + xcidif);
            }
            else
            {
                verified = 0;
                Console.WriteLine(" FAILURE: " + xci + " " + xciref + " " + xcidif);
            }
            if (clss == PROBLEM_CLASS.U)
            {
                Console.WriteLine("No reference values provided");
                Console.WriteLine(" No verification performed");
            }
            else if (verified == 1)
            {
                Console.WriteLine(" Verification Successful");
            }
            else
            {
                Console.WriteLine(" Verification failed");
            }
            return(0);
        }