# BoundaryMesh projection

Hi everyone,

I'd like to project a function defined on a function space over a boundary mesh to a function space defined over the full mesh.

I thought this could be achieved by integrating over the boundary of the full mesh but I get 'matrices are not alligned error '.

The error can be reproduced by the code below.

from dolfin import *

mesh = UnitSquareMesh(4,4)

V = FunctionSpace(

mesh_e = BoundaryMesh(

V_e = FunctionSpace(

v_e = Function(V_e)

v = TrialFunction(V)

u = TestFunction(V)

L = v_e*u*ds

assemble(L)

In terms of math, I think the integral makes sense, as both v_e and u are defined over the domain of intergration. Is there a

way to achieve this? Thanks for help, Miro

## Question information

- Language:
- English Edit question

- Status:
- Answered

- For:
- DOLFIN Edit question

- Assignee:
- No assignee Edit question

- Last query:
- 2013-03-14

- Last reply:
- 2013-03-14

Hi,

Not sure what's the best way to do this, but here's a hard and not so

elegant way:-)

from dolfin import *

mesh = UnitSquareMesh(4,4)

V = FunctionSpace(

mesh_e = BoundaryMesh(

V_e = FunctionSpace(

v_e = interpolate(

v = TrialFunction(V)

u = TestFunction(V)

V_dofmap = V.dofmap()

u = Function(V)

for facet in facets(mesh):

if facet.exterior():

c = Cell(mesh, facet.entities(

local_facet = V_dofmap.

facet_coors = V_dofmap.

facet_dofs = V_dofmap.

for x, dof in zip(facet_coors, facet_dofs):

plot(u)

Mikael

On 14 March 2013 14:11, Miro <email address hidden> wrote:

> New question #224282 on DOLFIN:

> https:/

>

> Hi everyone,

>

> I'd like to project a function defined on a function space over a boundary

> mesh to a function space defined over the full mesh.

> I thought this could be achieved by integrating over the boundary of the

> full mesh but I get 'matrices are not alligned error '.

> The error can be reproduced by the code below.

>

> from dolfin import *

>

> mesh = UnitSquareMesh(4,4)

> V = FunctionSpace(

>

> mesh_e = BoundaryMesh(

> V_e = FunctionSpace(

> v_e = Function(V_e)

>

> v = TrialFunction(V)

> u = TestFunction(V)

>

> L = v_e*u*ds

> assemble(L)

>

> In terms of math, I think the integral makes sense, as both v_e and u are

> defined over the domain of intergration. Is there a

> way to achieve this? Thanks for help, Miro

>

> --

> You received this question notification because you are a member of

> DOLFIN Team, which is an answer contact for DOLFIN.

>

## Can you help with this problem?

Provide an answer of your own, or ask Miro for more information if necessary.