dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #07788
Re: Plotting MeshFunction
On Mon, May 05, 2008 at 03:38:49PM +0200, Ola Skavhaug wrote:
> Ola Skavhaug skrev den 05/05-2008 følgende:
> > Anders Logg skrev den 05/05-2008 følgende:
> > > On Mon, May 05, 2008 at 03:26:04PM +0200, Ola Skavhaug wrote:
> > > > Nuno David Lopes skrev den 05/05-2008 følgende:
> > > > > Hi,
> > > > >
> > > > > I'm a newbie --2 months--, user trying to get in to Dolfin.
> > > > > Until know I've found the answers to my doubts in the manual, demos or in the
> > > > > mailing list archive.
> > > > > (So Sorry if I'm asking something that's not reasonable.)
> > > > >
> > > > > What kind of MeshFunctions are we able to plot with Dolfin,
> > > > > (using viper or file vtk format)?
> > > > > For instance is there a direct way to plot the subdomain markers defined in a
> > > > > MeshFunction<unsigned int>?
> > > > >
> > > > > If we are dealing with complex domains it would be a great help, so one could
> > > > > be shore that the markers are well defined.
> > > > >
> > > > >
> > > > > Thanks in advance.
> > > >
> > > > Try this:
> > > >
> > > > from dolfin import *
> > > > mesh = UnitSquare(5,5)
> > > > #mesh = UnitCube(5,5,5)
> > > > mf = MeshFunction("uint", mesh, mesh.topology().dim())
> > > > tmp = mf.values()
> > > > tmp[::2] = 4
> > > > plot(mf)
> > > >
> > > > Ola
> > >
> > > I think the problem may be that it's not possible to plot a mesh
> > > function defined on the facets of a mesh. Viper can't handle that as
> > > far as I remember. It would be very good if this could be added since
> > > it's a simple way to debug boundary conditions.
>
> Should be:
>
> bmesh = BoundaryMesh(mesh)
> bmf = MeshFunction("uint", bmesh, bmesh.topology().dim())
> # ^^^^^
> # use mesh-bmesh mapping to remap indicators and insert into bmf
> plot(bmf)
I think that's a good solution (to just add a few lines that extracts
the boundary and then plots the cells of the boundary).
--
Anders
Follow ups
References