Skip to content

Commit

Permalink
use dNorms in ellip, it was reporting 2- and 4-norms instead of 1- an…
Browse files Browse the repository at this point in the history
…d 2-norms
  • Loading branch information
jedbrown committed Apr 23, 2011
1 parent ace0fce commit 64bdae1
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 35 deletions.
34 changes: 4 additions & 30 deletions src/fs/tests/ellip.c
Original file line number Diff line number Diff line change
Expand Up @@ -480,8 +480,7 @@ static dErr EllipErrorNorms(Ellip elp,Vec gx,dReal errorNorms[static 3],dReal ge
dRulesetIterator iter;

dFunctionBegin;
err = dMemzero(errorNorms,3*sizeof(errorNorms));dCHK(err);
err = dMemzero(gerrorNorms,3*sizeof(gerrorNorms));dCHK(err);
err = dNormsStart(errorNorms,gerrorNorms);dCHK(err);
err = dFSGetGeometryVectorExpanded(elp->fs,&Coords);dCHK(err);
err = EllipGetRegionIterator(elp,EVAL_FUNCTION,&iter);dCHK(err);
err = dRulesetIteratorStart(iter,Coords,dFS_INHOMOGENEOUS,NULL,gx,dFS_INHOMOGENEOUS,NULL);dCHK(err);
Expand All @@ -492,40 +491,15 @@ static dErr EllipErrorNorms(Ellip elp,Vec gx,dReal errorNorms[static 3],dReal ge
dInt Q;
err = dRulesetIteratorGetPatchApplied(iter,&Q,&jw, (dScalar**)&x,(dScalar**)&dx,NULL,NULL, &u,&du,NULL,NULL);dCHK(err);dCHK(err);
for (dInt i=0; i<Q; i++) {
dScalar uu[1],duu[1][3],r[1],gr[3]; /* Scalar problem */
dReal grsum;
dScalar uu[1],duu[1][3];
elp->exact.solution(&elp->exactctx,&elp->param,x[i],uu,(dScalar*)duu);
r[0] = u[i][0] - uu[0]; /* Function error at point */
gr[0] = du[i][0][0] - duu[0][0]; /* Gradient error at point */
gr[1] = du[i][0][1] - duu[0][1];
gr[2] = du[i][0][2] - duu[0][2];
if (elp->errorview) {
printf("e,q = %3d %3d (% 5f,% 5f,% 5f) dohp %10.2e exact %10.2e error %10.e\n",patchcnt,i,x[i][0],x[i][1],x[i][2],u[i][0],uu[0],r[0]);
}
grsum = dAbs(dDotScalar3(gr,gr));
errorNorms[0] += dAbs(r[0]) * jw[i]; /* 1-norm */
errorNorms[1] += dSqr(r[0]) * jw[i]; /* 2-norm */
errorNorms[2] = dMax(errorNorms[2],dAbs(r[0])); /* Sup-norm */
gerrorNorms[0] += grsum * jw[i];
gerrorNorms[1] += dSqr(grsum) * jw[i];
gerrorNorms[2] = dMax(gerrorNorms[2],grsum);
#if 0
printf("pointwise stats %8g %8g %8g %8g\n",jw[i],r[0],dSqr(r[0]),errorNorms[1]);
printf("pointwise grads %8g %8g %8g (%8g)\n",gr[0],gr[1],gr[2],grsum);
# if 0
printf("jinv[%2d][%3d] %+3.1f %+3.1f %+3.1f %+3.1f %+3.1f %+3.1f %+3.1f %+3.1f %+3.1f\n",e,i,
jinv[i][0][0],jinv[i][0][1],jinv[i][0][2],
jinv[i][1][0],jinv[i][1][1],jinv[i][1][2],
jinv[i][2][0],jinv[i][2][1],jinv[i][2][2]);
# endif
#endif
err = dNormsUpdate(errorNorms,gerrorNorms,jw[i],1,uu,u[i],&duu[0][0],&du[i][0][0]);dCHK(err);
}
err = dRulesetIteratorNextPatch(iter);dCHK(err);
patchcnt++;
}
err = dRulesetIteratorFinish(iter);dCHK(err);
errorNorms[1] = dSqrt(errorNorms[1]);
gerrorNorms[1] = dSqrt(gerrorNorms[1]);
err = dNormsFinish(errorNorms,gerrorNorms);dCHK(err);
dFunctionReturn(0);
}

Expand Down
2 changes: 1 addition & 1 deletion src/fs/tests/refout/ellip-e0-b1-p16.refout
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
Algebraic residual |x|_1 0.00e+00 |x|_2 0.00e+00 |x|_inf 0.00e+00
Interpolation residual |x|_1 9.00e-03 |x|_2 1.30e-02 |x|_inf 3.37e-02
Pointwise solution error |x|_1 1.41e-02 |x|_2 4.09e-02 |x|_inf 3.03e-01
Pointwise gradient error |x|_1 3.04e-01 |x|_2 1.38e+00 |x|_inf 1.59e+01
Pointwise gradient error |x|_1 1.95e-01 |x|_2 5.52e-01 |x|_inf 3.98e+00
2 changes: 1 addition & 1 deletion src/fs/tests/refout/ellip-e0-b3-p14-sse.refout
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,4 @@
Algebraic residual |x|_1 0.00e+00 |x|_2 0.00e+00 |x|_inf 3.16e-14
Interpolation residual |x|_1 3.68e-05 |x|_2 7.01e-05 |x|_inf 4.11e-04
Pointwise solution error |x|_1 8.59e-07 |x|_2 2.07e-05 |x|_inf 2.68e-03
Pointwise gradient error |x|_1 3.65e-03 |x|_2 1.40e-01 |x|_inf 1.70e+01
Pointwise gradient error |x|_1 2.67e-03 |x|_2 6.04e-02 |x|_inf 4.12e+00
2 changes: 1 addition & 1 deletion src/fs/tests/refout/ellip-e0-b3-p16.refout
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,4 @@
Algebraic residual |x|_1 0.00e+00 |x|_2 0.00e+00 |x|_inf 2.46e-14
Interpolation residual |x|_1 2.35e-05 |x|_2 4.30e-05 |x|_inf 2.55e-04
Pointwise solution error |x|_1 8.47e-07 |x|_2 2.06e-05 |x|_inf 2.66e-03
Pointwise gradient error |x|_1 3.65e-03 |x|_2 1.40e-01 |x|_inf 1.70e+01
Pointwise gradient error |x|_1 2.67e-03 |x|_2 6.04e-02 |x|_inf 4.12e+00
2 changes: 1 addition & 1 deletion src/fs/tests/refout/ellip-e0-b3-p17-lam1-sse.refout
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,4 @@
Algebraic residual |x|_1 0.00e+00 |x|_2 0.00e+00 |x|_inf 0.00e+00
Interpolation residual |x|_1 1.54e-01 |x|_2 1.83e-01 |x|_inf 4.10e-01
Pointwise solution error |x|_1 7.49e-04 |x|_2 1.25e-02 |x|_inf 4.10e-01
Pointwise gradient error |x|_1 1.41e-03 |x|_2 2.91e-02 |x|_inf 2.45e+00
Pointwise gradient error |x|_1 2.59e-03 |x|_2 3.76e-02 |x|_inf 1.56e+00
2 changes: 1 addition & 1 deletion src/fs/tests/refout/ellip-morph.refout
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@
Algebraic residual |x|_1 1.34e-08 |x|_2 2.05e-08 |x|_inf 1.52e-07
Interpolation residual |x|_1 1.00e-02 |x|_2 2.00e-02 |x|_inf 1.28e-01
Pointwise solution error |x|_1 4.04e-04 |x|_2 5.14e-03 |x|_inf 2.76e-01
Pointwise gradient error |x|_1 3.45e-03 |x|_2 7.78e-02 |x|_inf 2.27e+01
Pointwise gradient error |x|_1 4.82e-03 |x|_2 5.87e-02 |x|_inf 4.77e+00

0 comments on commit 64bdae1

Please sign in to comment.