I am trying to assign a function defined on a mesh (e.g. a unit square mesh) to another function defined on another mesh (half of the unit squaremesh with the same mesh resolution and same type and order of the element as the previous function).
I try using the FunctionAssigner but this only work with functions defined on the same mesh. So, I would like to ask if there is any other functionalities that extend the FunctionAssigner ability to make the assignment possible with function defined on different meshes?
ps. I would like to preserve the connection between the assigning function and the receiving function as I get from the FunctionAssigner accordingt to the below code and picture.
from fenics import * from fenics_adjoint import * import time mesh = UnitSquareMesh(256, 256) V = FunctionSpace(mesh, "CG", 1) VV = VectorFunctionSpace(mesh, "CG", 1) # Define function vv = Function(VV) u0 = Function(V) u1 = Function(V) # Assign mixed function from two scalar functions using FunctionAssigner assigner = FunctionAssigner(VV, [V, V]) t0 = time.time() assigner.assign(vv, [u0, u1]) ta1 = time.time() - t0 tape = get_working_tape() tape.visualise()
Thank you very much