Question #137463 on DOLFIN changed: https://answers.launchpad.net/dolfin/+question/137463
Status: Open => Answered Anders Logg proposed the following answer: I might be missing something here, but it looks like you compare different things: the full jump and the jump in only the normal component. -- Anders On Sat, Dec 11, 2010 at 08:51:26PM -0000, JG wrote: > New question #137463 on DOLFIN: > https://answers.launchpad.net/dolfin/+question/137463 > > Hello -- I seem to get different answers when I project a discontinuous > vector function component by component or using the vector DG function space. > I expected the difference to be machine precision. What could I be doing > wrongly? Thanks, --Jay > > from dolfin import * > > degree=1 > n=10 > > mesh = UnitSquare(n,n) > Q = Expression(("(x[1]>=0.5? 10.0 : 0.0)","(x[0]>=0.5? 100.0 : 0.0)")) > > VDG = VectorFunctionSpace(mesh, "DG", degree) > DG = FunctionSpace(mesh, "DG", degree) > > q = project(Q, VDG, degree) > > qx = project(Q[0], DG, degree) > qy = project(Q[1], DG, degree) > > print 'q and (qx,qy) differs by: %e, %e' % \ > ( sqrt(abs(assemble( dot(q[0]-qx,q[0]-qx)*dx, mesh=mesh))), \ > sqrt(abs(assemble( dot(q[1]-qy,q[1]-qy)*dx, mesh=mesh))) ) > > n = FacetNormal(mesh) > print 'jump(q)=%e, jump(qx)=%e, jump(qy)=%e' %\ > ( sqrt(abs(assemble( jump(q,n)*jump(q,n)*dS, mesh=mesh))), \ > sqrt(abs(assemble( jump(qx)*jump(qx)*dS, mesh=mesh))), \ > sqrt(abs(assemble( jump(qy)*jump(qy)*dS, mesh=mesh))) ) > > Output: > > q and (qx,qy) differs by: 5.215406e-08, 3.885747e-07 > jump(q)=3.516078e-14, jump(qx)=1.931411e-07, jump(qy)=2.697398e-06 > > > > You received this question notification because you are a member of > DOLFIN Team, which is an answer contact for DOLFIN. > > _______________________________________________ > Mailing list: https://launchpad.net/~dolfin > Post to : dolfin@lists.launchpad.net > Unsubscribe : https://launchpad.net/~dolfin > More help : https://help.launchpad.net/ListHelp You received this question notification because you are a member of DOLFIN Team, which is an answer contact for DOLFIN. _______________________________________________ Mailing list: https://launchpad.net/~dolfin Post to : dolfin@lists.launchpad.net Unsubscribe : https://launchpad.net/~dolfin More help : https://help.launchpad.net/ListHelp