This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

how to create an edge from mesh

0 votes

how to create an edge from mesh

asked Jul 11, 2017 by maro FEniCS Novice (220 points)

1 Answer

+1 vote

Do you mean getting the boundary mesh from another mesh?

You can generate a mesh using fenics and then use:

mesh = BoundaryMesh(mesh, 'exterior')

See here: https://fenicsproject.org/qa/12976/1-dimensional-circle-mesh

answered Jul 11, 2017 by alexmm FEniCS User (4,240 points)

How I make a call to nodes located in a single edge in a domain .
I havea rectangle and in the edge or x1 = 120 I will apply ;
ds = Measure("ds")(domain=mesh, subdomain_data=boundries)
u = Expression("cos(x[1])", degree=3)
I = assemble(u*ds(1))

so I am looking for how I can have the file "mesh_facet_region.xml" and the boundries ?!

So you want to reference one edge of the boundary in a form?

In that case you can mark the boundaries, for example:

class insideEdge(SubDomain):
    def inside(self, x, on_boundary):
        return near(x[0], R_inner)

class outsideEdge(SubDomain):
    def inside(self, x, on_boundary):
        return near(x[0], R_outer)


boundaries = FacetFunction('size_t', mesh)
boundaries.set_all(0)
insideEdge.mark(boundaries, 1)
outsideEdge.mark(boundaries, 2)
ds = Measure('ds')[boundaries]

And then you can have in your form something like:

F = k*inner(grad(T), grad(q))*dx() + h_g*T*q*ds(1) + h_a*T*q*ds(2)

The whole code is here:
https://fenicsproject.org/qa/14181/plotting-material-properties-subdomains-given-python-class

...