dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #05257
Re: DG viz
On Thu, Jun 28, 2007 at 10:17:09PM -0400, Jake Ostien wrote:
> Anders Logg wrote:
> >On Thu, Jun 28, 2007 at 12:17:50PM -0400, Jake Ostien wrote:
> >
> >>Garth N. Wells wrote:
> >>
> >>>Jake Ostien wrote:
> >>>
> >>>>Hi,
> >>>>
> >>>>If even possible, does anyone know how to view the fully
> >>>>discontinuous solution (without the interpolation to the vertices)?
> >>>>
> >>>>
> >>>It's not possible at the moment. The best approach for now is to
> >>>project the discontinuous solution onto a continuous basis, and plot
> >>>the continuous field.
> >>>
> >>OK. Here's a related question, I need to check that my weakly enforced
> >>Dirichlet BCs are being properly handled. Right now I think I need to
> >>sample the discontinuous function along a given subset of the boundary
> >>(which I do by iterating through all the vertices and selected solution
> >>components by position), and manually integrate those values along the
> >>boundary for comparison with the prescribed value, say zero for
> >>simplicity. Is there a better way to do this? I am observing some
> >>noise (oscillations) in the projected solution near the boundaries and I
> >>am trying to figure out why.
> >>
> >>-Jake
> >>
> >
> >Sounds like you want to compute a functional of the computed solution?
> >
> exactly
> >Say you want to check the L2 error of the computed solution along
> >a subset of the boundary. In FFC, do this:
> >
> >element = FiniteElement(...)
> >
> >u = Function(element)
> >u0 = Function(element)
> >
> >e = u - u0
> >
> >M = e*e*ds
> >
> >Here, u is your computed solution, u0 is a boundary condition (you
> >want u = u0 on the boundary). Then the functional M will be the L2
> >error squared along a subset of the boundary.
> >
> >Assemble the functional in DOLFIN by
> >
> >double L2error = assemble(M, mesh, sub_domain);
> >
> >
> OK, this was easy to do (many thanks, this was much, much simpler than
> what I was going to try and do).
>
> Let me add a little context to the discussion. As an exercise, I am
> solving a 2D Linear Elasticity problem using DG1 vector elements. I can
> write down the answer on paper, so I am checking how well the method
> performs. I am finding that the weakly enforced Dirichlet conditions,
> u[0] = 0.0 on x = 0.0, u[1] = 0.0 on y = 0.0 are showing oscillations
> near the domain corners (the domain is the UnitSquare(#,#).
> Qualitatively, the solutions look good if the mesh is fine enough, but
> quantitatively, the functional I am calculating on the fixed Dirichlet
> boundary is not identically zero. I get numbers around 1e-05 to 1e-07
> for the L2 norms. I expect to get much closer to machine precision than
> that, but maybe that assumption is misguided? Anyone have any thoughts
> or advice on this?
I can't say how small the error should be, but I wouldn't expect
machine precision.
> >where M is the form (taking two arguments u and u0) and sub_domain is
> >the sub_domain you want to integrate over.
> >
> >
> Just for the record, I was under the (possibly false) assumption that I
> could not use SubDomains with discontinuous functions. I don't remember
> where I picked that up. Is it true? (I could test it fairly easily if
> necessary)
I don't know of any such limitation.
/Anders
> Thanks again,
> Jake
> >/Anders
> >_______________________________________________
> >DOLFIN-dev mailing list
> >DOLFIN-dev@xxxxxxxxxx
> >http://www.fenics.org/mailman/listinfo/dolfin-dev
> >
> >
> >
>
References