Copy a part of values of a Function to the other Function

#1

Hello everyone:

I am using FEniCS based on C++, the question is stated as follows.
Assume \Omega_1=[0,0]\times [1,1] and \Omega_2=[1,0]\times [2,1], thus x=1 is an interface with facet id=1. Let V be some FunctionSpace on the mesh.

Now, if there are two Functions
Function f(V)
Function g(V)
Assume that f and g are two solutions computed by two bilinear forms. My question is how to copy the interface value of Function f to Function g? Something like the pseudocode below
g->vector()->(facetid=1) = f->vector()->(facetid=1)

I am not very familiar with FEniCS under C++, should I iterate the facet?

Thanks in advance,
Leon

#2

Well, you could make a facetfunction and mark those Davers you would like to copy values for with a specific marker. Then you could use DirichletBC to apply those values to the new function.