Hi Tobias,

Yes but the meshes have to be part of a MeshHierarchy.

Make mesh=UnitSquareMesh(10,10)

And then mesh_hierarchy=MeshHierarchy(mesh,1).

You can set mesh_coarse=mesh_hierarchy[0] and mesh_fine=mesh_hierarchy[1] and proceed like that.

One can do inject(fun_fine, fun_coarse) to carry out the projection.

Many Thanks,
Ali

Sent from my iPhone

On 11 Jan 2017, at 12:52, Schwedes, Tobias <t.schwedes14@imperial.ac.uk> wrote:

Hi all,


is there a way to project a function defined on a fine mesh onto a functionspace with a coarse mesh? Look at the following exemplary setup:


from firedrake import *

import numpy as np


mesh_fine =  UnitSquareMesh(20,20)

mesh_coarse =  UnitSquareMesh(10,10)


fs_fine  = FunctionSpace(mesh_fine, 'CG', 1)

fs_coarse  = FunctionSpace(mesh_coarse, 'CG', 1)


fun_fine = Function(fs_fine)

fun_fine.dat.data[:] = np.random.normal(0, 1, len(fun_fine.dat.data))


fun_coarse = ?


In this case, perhaps one could inherit overlapping nodes from fine to coarse mesh?

All the best,
Tobias

_______________________________________________
firedrake mailing list
firedrake@imperial.ac.uk
https://mailman.ic.ac.uk/mailman/listinfo/firedrake