# Non homogeneous boundary and initial conditions

**URL:** https://community.freefem.org/t/non-homogeneous-boundary-and-initial-conditions/154
**Category:** General Discussion
**Created:** [October 12, 2019, 9:10am UTC](https://community.freefem.org/t/non-homogeneous-boundary-and-initial-conditions/154 "2019-10-12T09:10:13Z")
**Posts on this page:** 1
**Showing post:** 31

<div class="post-metadata">

### Author: ![quentin](https://avatars.discourse-cdn.com/v4/letter/q/e47c2d/32.png) [@quentin](https://community.freefem.org/u/quentin)
#### Post date: [May 24, 2024, 7:21pm UTC](https://community.freefem.org/t/non-homogeneous-boundary-and-initial-conditions/154/31 "2024-05-24T19:21:23Z")

</div>

I found a example using `VecInterpolate`, or `transfer`to copy variables to another mesh.

> [@Copy variables between different meshes with PETSc](https://community.freefem.org/t/copy-variables-between-different-meshes-with-petsc/390/2):
>
> Dear Tak, You can use the newly implemented routine transfer to help you go between one distributed solution to another. If you want the transfer PETSc Mat, you can use the transferMat function, see this new example [PtAP-2d-PETSc.edp](https://github.com/FreeFem/FreeFem-sources/blob/develop/examples/hpddm/PtAP-2d-PETSc.edp). Here is the function used in your code, and the resulting screenshots. 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) buildDmesh(Sh2) fespace Ph1(Sh1, P2); Ph1 u=sin…

I’ll try this approach, it looks more convenient than restrictions.

---

_[View the full topic](https://community.freefem.org/t/non-homogeneous-boundary-and-initial-conditions/154)._
