# "transfer" in PETSc-complex interface

**URL:** https://community.freefem.org/t/transfer-in-petsc-complex-interface/1140
**Category:** General Discussion
**Created:** [August 6, 2021, 3:16am UTC](https://community.freefem.org/t/transfer-in-petsc-complex-interface/1140 "2021-08-06T03:16:38Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![yuki](https://avatars.discourse-cdn.com/v4/letter/y/8edcca/32.png) [@yuki](https://community.freefem.org/u/yuki)
#### Post date: [August 6, 2021, 3:16am UTC](https://community.freefem.org/t/transfer-in-petsc-complex-interface/1140/1 "2021-08-06T03:16:39Z")

</div>

Dear all,

I would like to use “transfer” function in PETSc-complex interface.  
In FreeFEM v 4.8, the following code worked well:

//load “PETSc”  
load “PETSc-complex”  
macro dimension()2// EOM  
include “macro\_ddm.idp”

meshN Sh1=square(30,30,[x,y]);  
meshN Sh2=square(50,50,[x,y]);

buildDmesh(Sh1)  
buildDmesh(Sh2)

fespace Ph1(Sh1, P2);  
Ph1 u=sin(4_x)+cos(5_y);

fespace Ph2(Sh2, P2);  
Ph2 v;  
// v=u;

macro defPlot(u)u//  
transfer(Sh1, P2, u, Sh2, P2, v);

This code was borrowed from the previous topic:

> [@Copy variables between different meshes with PETSc](https://community.freefem.org/t/copy-variables-between-different-meshes-with-petsc/390):
>
> Dear Sir or Madam, I would like to use different 2 meshes with PETSc. Additionally, variables want to be copied from each other. However, as shown following codes, the direct copy, such as “v=u”, does not work. Would you please let me know how to do it? Thank you very much in advance. Best regards, Tak // $ ff-mpirun -np 4 script.edp -wg -ne load “PETSc” macro dimension()2// EOM include “macro\_ddm.idp” meshN Sh1=square(30,30,[x,y]); meshN Sh2=square(50,50,[x,y]); buildDmesh(Sh1) b…

However, I could not run the above example with FreeFEM v 4.9.  
Would you have any solutions to this issue?

Thank you so much in advance,  
Best regards,

Yuki

---

<div class="post-metadata">

### Author: ![prj](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prj](https://community.freefem.org/u/prj)
#### Post date: [August 6, 2021, 5:14am UTC](https://community.freefem.org/t/transfer-in-petsc-complex-interface/1140/2 "2021-08-06T05:14:59Z")

</div>

You need this commit [Fixes renumv + adds PetscScalar in .edp · FreeFem/FreeFem-sources@723520e · GitHub](https://github.com/FreeFem/FreeFem-sources/commit/723520e75ec36eb7f3802d30ec67319c249af51d#diff-6dd6dd51051ada00b3d8fa1b5e233cecd08ffe961add4f9fbdadf0805b73db1d) which is in 4.9, so please consider updating your FreeFEM installation.  
Also, your FE function needs to live in `Ph1<complex>` (resp. `Ph2<complex>`), not `Ph1` (resp. `Ph2`).

---

<div class="post-metadata">

### Author: ![yuki](https://avatars.discourse-cdn.com/v4/letter/y/8edcca/32.png) [@yuki](https://community.freefem.org/u/yuki)
#### Post date: [August 6, 2021, 5:38am UTC](https://community.freefem.org/t/transfer-in-petsc-complex-interface/1140/3 "2021-08-06T05:38:59Z")

</div>

Thank you for your advice.  
I could transfer the solution in FreeFEM v 4.9 by changing FE spaces from Phk to Phk (k=1,2).
