Ejemplo n.º 1
0
        public int verify(int ires, int n1, int n2, int n3, int nt, double[,] cksum)
        {
            int verified = -1;

            bool[] temp = new bool[niter_default];
            double[,] cexpd = new double[21, 2];
            if ((n1 == 64) && (n2 == 64) && (n3 == 64) && (nt == 6))
            {
                //
                // Class S reference values.
                //
                cexpd[0, REAL] = 554.6087004964;
                cexpd[1, REAL] = 554.6385409189;
                cexpd[2, REAL] = 554.6148406171;
                cexpd[3, REAL] = 554.5423607415;
                cexpd[4, REAL] = 554.4255039624;
                cexpd[5, REAL] = 554.2683411902;

                cexpd[0, IMAG] = 484.5363331978;
                cexpd[1, IMAG] = 486.5304269511;
                cexpd[2, IMAG] = 488.3910722336;
                cexpd[3, IMAG] = 490.1273169046;
                cexpd[4, IMAG] = 491.7475857993;
                cexpd[5, IMAG] = 493.2597244941;
            }
            else if ((n1 == 128) && (n2 == 128) && (n3 == 32) && (nt == 6))
            {
                //
                // Class W reference values.
                //
                cexpd[0, REAL] = 567.3612178944;
                cexpd[1, REAL] = 563.1436885271;
                cexpd[2, REAL] = 559.4024089970;
                cexpd[3, REAL] = 556.0698047020;
                cexpd[4, REAL] = 553.0898991250;
                cexpd[5, REAL] = 550.4159734538;

                cexpd[0, IMAG] = 529.3246849175;
                cexpd[1, IMAG] = 528.2149986629;
                cexpd[2, IMAG] = 527.0996558037;
                cexpd[3, IMAG] = 526.0027904925;
                cexpd[4, IMAG] = 524.9400845633;
                cexpd[5, IMAG] = 523.9212247086;
                //
            }
            else if ((n1 == 256) && (n2 == 256) && (n3 == 128) && (nt == 6))
            {
                //
                // Class A reference values.
                //
                cexpd[0, REAL] = 504.6735008193;
                cexpd[1, REAL] = 505.9412319734;
                cexpd[2, REAL] = 506.9376896287;
                cexpd[3, REAL] = 507.7892868474;
                cexpd[4, REAL] = 508.5233095391;
                cexpd[5, REAL] = 509.1487099959;

                cexpd[0, IMAG] = 511.4047905510;
                cexpd[1, IMAG] = 509.8809666433;
                cexpd[2, IMAG] = 509.8144042213;
                cexpd[3, IMAG] = 510.1336130759;
                cexpd[4, IMAG] = 510.4914655194;
                cexpd[5, IMAG] = 510.7917842803;
                //
            }
            else if ((n1 == 512) && (n2 == 256) && (n3 == 256) && (nt == 20))
            {
                //
                // Class B reference values.
                //
                cexpd[0, REAL]  = 517.7643571579;
                cexpd[1, REAL]  = 515.4521291263;
                cexpd[2, REAL]  = 514.6409228649;
                cexpd[3, REAL]  = 514.2378756213;
                cexpd[4, REAL]  = 513.9626667737;
                cexpd[5, REAL]  = 513.7423460082;
                cexpd[6, REAL]  = 513.5547056878;
                cexpd[7, REAL]  = 513.3910925466;
                cexpd[8, REAL]  = 513.2470705390;
                cexpd[9, REAL]  = 513.1197729984;
                cexpd[10, REAL] = 513.0070319283;
                cexpd[11, REAL] = 512.9070537032;
                cexpd[12, REAL] = 512.8182883502;
                cexpd[13, REAL] = 512.7393733383;
                cexpd[14, REAL] = 512.6691062020;
                cexpd[15, REAL] = 512.6064276004;
                cexpd[16, REAL] = 512.5504076570;
                cexpd[17, REAL] = 512.5002331720;
                cexpd[18, REAL] = 512.4551951846;
                cexpd[19, REAL] = 512.4146770029;

                cexpd[0, IMAG]  = 507.7803458597;
                cexpd[1, IMAG]  = 508.8249431599;
                cexpd[2, IMAG]  = 509.6208912659;
                cexpd[3, IMAG]  = 510.1023387619;
                cexpd[4, IMAG]  = 510.3976610617;
                cexpd[5, IMAG]  = 510.5948019802;
                cexpd[6, IMAG]  = 510.7404165783;
                cexpd[7, IMAG]  = 510.8576573661;
                cexpd[8, IMAG]  = 510.9577278523;
                cexpd[9, IMAG]  = 511.0460304483;
                cexpd[10, IMAG] = 511.1252433800;
                cexpd[11, IMAG] = 511.1968077718;
                cexpd[12, IMAG] = 511.2616233064;
                cexpd[13, IMAG] = 511.3203605551;
                cexpd[14, IMAG] = 511.3735928093;
                cexpd[15, IMAG] = 511.4218460548;
                cexpd[16, IMAG] = 511.4656139760;
                cexpd[17, IMAG] = 511.5053595966;
                cexpd[18, IMAG] = 511.5415130407;
                cexpd[19, IMAG] = 511.5744692211;
                //
            }
            else if ((n1 == 512) && (n2 == 512) &&
                     (n3 == 512) && (nt == 20))
            {
                //
                // Class C reference values.
                //
                cexpd[0, REAL]  = 519.5078707457;
                cexpd[1, REAL]  = 515.5422171134;
                cexpd[2, REAL]  = 514.4678022222;
                cexpd[3, REAL]  = 514.0150594328;
                cexpd[4, REAL]  = 513.7550426810;
                cexpd[5, REAL]  = 513.5811056728;
                cexpd[6, REAL]  = 513.4569343165;
                cexpd[7, REAL]  = 513.3651975661;
                cexpd[8, REAL]  = 513.2955192805;
                cexpd[9, REAL]  = 513.2410471738;
                cexpd[10, REAL] = 513.1971141679;
                cexpd[11, REAL] = 513.1605205716;
                cexpd[12, REAL] = 513.1290734194;
                cexpd[13, REAL] = 513.1012720314;
                cexpd[14, REAL] = 513.0760908195;
                cexpd[15, REAL] = 513.0528295923;
                cexpd[16, REAL] = 513.0310107773;
                cexpd[17, REAL] = 513.0103090133;
                cexpd[18, REAL] = 512.9905029333;
                cexpd[19, REAL] = 512.9714421109;

                cexpd[0, IMAG]  = 514.9019699238;
                cexpd[1, IMAG]  = 512.7578201997;
                cexpd[2, IMAG]  = 512.2251847514;
                cexpd[3, IMAG]  = 512.1090289018;
                cexpd[4, IMAG]  = 512.1143685824;
                cexpd[5, IMAG]  = 512.1496764568;
                cexpd[6, IMAG]  = 512.1870921893;
                cexpd[7, IMAG]  = 512.2193250322;
                cexpd[8, IMAG]  = 512.2454735794;
                cexpd[9, IMAG]  = 512.2663649603;
                cexpd[10, IMAG] = 512.2830879827;
                cexpd[11, IMAG] = 512.2965869718;
                cexpd[12, IMAG] = 512.3075927445;
                cexpd[13, IMAG] = 512.3166486553;
                cexpd[14, IMAG] = 512.3241541685;
                cexpd[15, IMAG] = 512.3304037599;
                cexpd[16, IMAG] = 512.3356167976;
                cexpd[17, IMAG] = 512.3399592211;
                cexpd[18, IMAG] = 512.3435588985;
                cexpd[19, IMAG] = 512.3465164008;
            }
            double epsilon = 1.0E-12;

            //
            // Verification test for results.
            //
            if (nt <= 0)
            {
            }
            else
            {
                for (int it = 0; it < nt; it++)
                {
                    double csumr = (cksum[it, REAL] - cexpd[it, REAL]) / cexpd[it, REAL];
                    double csumi = (cksum[it, IMAG] - cexpd[it, IMAG]) / cexpd[it, IMAG];
                    if (Math.Abs(csumr) <= epsilon ||
                        Math.Abs(csumi) <= epsilon
                        )
                    {
                        if (verified == -1)
                        {
                            verified = 1;
                        }
                    }
                    else
                    {
                        verified = 0;
                    }
                }
            }
            BMResults.printVerificationStatus(CLASS, verified, BMName);
            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