// // Copyright 2010 Intel Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // #include #include #include "applu_share.h" #define class _class_ #define FABS(x) ((x)>0 ? (x) : -(x)) #define xcr(m) xcr[m-1] #define xce(m) xce[m-1] #define xcrref(m) xcrref[m-1] #define xceref(m) xceref[m-1] #define xcrdif(m) xcrdif[m-1] #define xcedif(m) xcedif[m-1] void verify(double *xcr, double *xce, double *xcip, char *classp) { double xcrref[5],xceref[5],xciref, xcrdif[5], xcedif[5], xcidif, epsilon, dtref; int m; //c tolerance level double xci = *xcip; epsilon = 1.0e-8; char class = 'U'; int verified = 1; for (m=1; m<=5; m++) { xcrref(m) = 1.0; xceref(m) = 1.0; } xciref = 1.0; if ((nx0 == 12) && (ny0 == 12) && (nz0 == 12) && (itmax == 50 )) { class = 'S'; dtref = 5.0e-1; //c--------------------------------------------------------------------- //c Reference values of RMS-norms of residual, for the (12X12X12) grid, //c after 50 time steps, with DT = 5.0d-01 //--------------------------------------------------------------------- xcrref(1) = 1.6196343210976702e-02; xcrref(2) = 2.1976745164821318e-03; xcrref(3) = 1.5179927653399185e-03; xcrref(4) = 1.5029584435994323e-03; xcrref(5) = 3.4264073155896461e-02; //c--------------------------------------------------------------------- //c Reference values of RMS-norms of solution error, for the (12X12X12) grid, //c after 50 time steps, with DT = 5.0e-01; //c--------------------------------------------------------------------- xceref(1) = 6.4223319957960924e-04; xceref(2) = 8.4144342047347926e-05; xceref(3) = 5.8588269616485186e-05; xceref(4) = 5.8474222595157350e-05; xceref(5) = 1.3103347914111294e-03; //c--------------------------------------------------------------------- //c Reference value of surface integral, for the (12X12X12) grid, //c after 50 time steps, with DT = 5.0d-01 //c--------------------------------------------------------------------- xciref = 7.8418928865937083; } else if ((nx0 == 33) && (ny0 == 33) && (nz0 == 33) && (itmax == 300)) { class = 'W'; dtref = 1.5e-3; //c--------------------------------------------------------------------- //c Reference values of RMS-norms of residual, for the (33x33x33) grid, //c after 300 time steps, with DT = 1.5d-3 //c--------------------------------------------------------------------- xcrref(1) = 0.1236511638192e+02; xcrref(2) = 0.1317228477799e+01; xcrref(3) = 0.2550120713095e+01; xcrref(4) = 0.2326187750252e+01; xcrref(5) = 0.2826799444189e+02; //c--------------------------------------------------------------------- //c Reference values of RMS-norms of solution error, for the (33X33X33) grid, //c--------------------------------------------------------------------- xceref(1) = 0.4867877144216e+00; xceref(2) = 0.5064652880982e-01; xceref(3) = 0.9281818101960e-01; xceref(4) = 0.8570126542733e-01; xceref(5) = 0.1084277417792e+01; //c--------------------------------------------------------------------- //c Reference value of surface integral, for the (33X33X33) grid, //c after 300 time steps, with DT = 1.5e-3; //c--------------------------------------------------------------------- xciref = 0.1161399311023e+02; } else if ((nx0 == 64) && (ny0 == 64) && (nz0 == 64) && (itmax == 250)) { class = 'A'; dtref = 2.0e+0; //c--------------------------------------------------------------------- //c Reference values of RMS-norms of residual, for the (64X64X64) grid, //c after 250 time steps, with DT = 2.0e+00; //c--------------------------------------------------------------------- xcrref(1) = 7.7902107606689367e+02; xcrref(2) = 6.3402765259692870e+01; xcrref(3) = 1.9499249727292479e+02; xcrref(4) = 1.7845301160418537e+02; xcrref(5) = 1.8384760349464247e+03; //c--------------------------------------------------------------------- //c Reference values of RMS-norms of solution error, for the (64X64X64) grid, //c after 250 time steps, with DT = 2.0e+00; //c--------------------------------------------------------------------- xceref(1) = 2.9964085685471943e+01; xceref(2) = 2.8194576365003349e+00; xceref(3) = 7.3473412698774742e+00; xceref(4) = 6.7139225687777051e+00; xceref(5) = 7.0715315688392578e+01; //c--------------------------------------------------------------------- //c Reference value of surface integral, for the (64X64X64) grid, //c after 250 time steps, with DT = 2.0e+00; //c--------------------------------------------------------------------- xciref = 2.6030925604886277e+01; } else if ((nx0 == 102) && (ny0 == 102) && (nz0 == 102) && (itmax == 250)) { class = 'B'; dtref = 2.0e+0; //c--------------------------------------------------------------------- //c Reference values of RMS-norms of residual, for the (102X102X102) grid, //c after 250 time steps, with DT = 2.0e+00; //c--------------------------------------------------------------------- xcrref(1) = 3.5532672969982736e+03; xcrref(2) = 2.6214750795310692e+02; xcrref(3) = 8.8333721850952190e+02; xcrref(4) = 7.7812774739425265e+02; xcrref(5) = 7.3087969592545314e+03; //c--------------------------------------------------------------------- //c Reference values of RMS-norms of solution error, for the (102X102X102) //c grid, after 250 time steps, with DT = 2.0e+00; //c--------------------------------------------------------------------- xceref(1) = 1.1401176380212709e+02; xceref(2) = 8.1098963655421574e+00; xceref(3) = 2.8480597317698308e+01; xceref(4) = 2.5905394567832939e+01; xceref(5) = 2.6054907504857413e+02; //c--------------------------------------------------------------------- //c Reference value of surface integral, for the (102X102X102) grid, //c after 250 time steps, with DT = 2.0e+00; //c--------------------------------------------------------------------- xciref = 4.7887162703308227e+01; } else if ((nx0 == 162) && (ny0 == 162) && (nz0 == 162) && (itmax == 250)) { class = 'C'; dtref = 2.0e+0; //c--------------------------------------------------------------------- //c Reference values of RMS-norms of residual, for the (162X162X162) grid, //c after 250 time steps, with DT = 2.0e+00; //c--------------------------------------------------------------------- xcrref(1) = 1.03766980323537846e+04; xcrref(2) = 8.92212458801008552e+02; xcrref(3) = 2.56238814582660871e+03; xcrref(4) = 2.19194343857831427e+03; xcrref(5) = 1.78078057261061185e+04; //c--------------------------------------------------------------------- //c Reference values of RMS-norms of solution error, for the (162X162X162) //c grid, after 250 time steps, with DT = 2.0e+00; //c--------------------------------------------------------------------- xceref(1) = 2.15986399716949279e+02; xceref(2) = 1.55789559239863600e+01; xceref(3) = 5.41318863077207766e+01; xceref(4) = 4.82262643154045421e+01; xceref(5) = 4.55902910043250358e+02; //c--------------------------------------------------------------------- //c Reference value of surface integral, for the (162X162X162) grid, //c after 250 time steps, with DT = 2.0e+00; //c--------------------------------------------------------------------- xciref = 6.66404553572181300e+01; } else if ((nx0 == 408) && (ny0 == 408) && (nz0 == 408) && (itmax == 300)) { class = 'D'; dtref = 1.0e+0; //c--------------------------------------------------------------------- //c Reference values of RMS-norms of residual, for the (408X408X408) grid, //c after 300 time steps, with DT = 1.0e+00; //c--------------------------------------------------------------------- xcrref(1) = 0.4868417937025e+05; xcrref(2) = 0.4696371050071e+04; xcrref(3) = 0.1218114549776e+05; xcrref(4) = 0.1033801493461e+05; xcrref(5) = 0.7142398413817e+05; //c--------------------------------------------------------------------- //c Reference values of RMS-norms of solution error, for the (408X408X408) //c grid, after 300 time steps, with DT = 1.0e+00; //c--------------------------------------------------------------------- xceref(1) = 0.3752393004482e+03; xceref(2) = 0.3084128893659e+02; xceref(3) = 0.9434276905469e+02; xceref(4) = 0.8230686681928e+02; xceref(5) = 0.7002620636210e+03; //c--------------------------------------------------------------------- //c Reference value of surface integral, for the (408X408X408) grid, //c after 300 time steps, with DT = 1.0e+00; //c--------------------------------------------------------------------- xciref = 0.8334101392503e+02; } else if ((nx0 == 1020) && (ny0 == 1020) && (nz0 == 1020) && (itmax == 300) ) { class = 'E'; dtref = 0.5e+0; //c--------------------------------------------------------------------- //c Reference values of RMS-norms of residual, for the (1020X1020X1020) grid, //c after 300 time steps, with DT = 0.5e+00; //c--------------------------------------------------------------------- xcrref(1) = 0.2099641687874e+06; xcrref(2) = 0.2130403143165e+05; xcrref(3) = 0.5319228789371e+05; xcrref(4) = 0.4509761639833e+05; xcrref(5) = 0.2932360006590e+06; //c--------------------------------------------------------------------- //c Reference values of RMS-norms of solution error, for the (1020X1020X1020) //c grid, after 300 time steps, with DT = 0.5e+00; //c--------------------------------------------------------------------- xceref(1) = 0.4800572578333e+03; xceref(2) = 0.4221993400184e+02; xceref(3) = 0.1210851906824e+03; xceref(4) = 0.1047888986770e+03; xceref(5) = 0.8363028257389e+03; //c--------------------------------------------------------------------- //c Reference value of surface integral, for the (1020X1020X1020) grid, //c after 300 time steps, with DT = 0.5e+00; //c--------------------------------------------------------------------- // xciref = 0.9512163272273e+02; } else verified = 0; //c--------------------------------------------------------------------- //c verification test for residuals if gridsize is one of //c the defined grid sizes above (class != 'U') //c--------------------------------------------------------------------- //c--------------------------------------------------------------------- //c Compute the difference of solution values and the known reference values. //c--------------------------------------------------------------------- for (m=1; m<=5; m++) { xcrdif(m) = FABS((xcr(m)-xcrref(m))/xcrref(m)); xcedif(m) = FABS((xce(m)-xceref(m))/xceref(m)); } xcidif = FABS((xci - xciref)/xciref); //c--------------------------------------------------------------------- //c Output the comparison of computed results to known cases. //c--------------------------------------------------------------------- if (class != 'U') { printf(" Verification being performed for class %c\n", class); printf(" Accuracy setting for epsilon = %20.13e\n", epsilon); verified = (FABS(dt-dtref) <= epsilon); if (!verified) { class = 'U'; printf(" DT does not match the reference value of %15.8e\n", dtref); } } else printf(" Unknown class\n"); if (class != 'U') printf(" Comparison of RMS-norms of residual\n"); else printf(" RMS-norms of residual\n"); for (m=1; m<=5; m++) { if (class == 'U') printf(" %2d %20.13e\n", m, xcr(m)); else if (xcrdif(m) <= epsilon) { printf(" %2d %20.13e %20.13e %20.13e\n", m,xcr(m),xcrref(m),xcrdif(m)); } else { verified = 0; printf("FAILURE: %2d %20.13e %20.13e %20.13e\n", m,xcr(m),xcrref(m),xcrdif(m)); } } if (class != 'U') printf(" Comparison of RMS-norms of solution error\n"); else printf(" RMS-norms of solution error\n"); for (m=1; m<=5; m++) { if (class == 'U') printf(" %2d %20.13e\n", m, xce(m)); else if (xcedif(m) <= epsilon) { printf(" %2d %20.13e %20.13e %20.13e\n", m,xce(m),xceref(m),xcedif(m)); } else { verified = 0; printf("FAILURE: %2d %20.13e %20.13e %20.13e\n", m,xce(m),xceref(m),xcedif(m)); } } if (class != 'U') printf(" Comparison of surface integral\n"); else printf(" Surface integral\n"); if (class == 'U') { printf(" %20.13e\n", xci); } else if (xcidif <= epsilon) { printf(" %20.13e %20.13e %20.13e\n", xci, xciref, xcidif); } else { verified = 0; printf("FAILURE: %20.13e %20.13e %20.13e\n", xci, xciref, xcidif); } if (class == 'U') { printf(" No reference values provided\n"); printf(" No verification performed\n"); } else if (verified) { printf(" Verification Successful\n"); } else { printf(" Verification failed\n"); } *classp = class; return; }