# Large scale FSI example with parallel implementation

**URL:** <https://community.freefem.org/t/large-scale-fsi-example-with-parallel-implementation/3460>\
**Category:** General Discussion\
**Created:** [August 29, 2024, 10:07am UTC](https://community.freefem.org/t/large-scale-fsi-example-with-parallel-implementation/3460 "2024-08-29T10:07:58Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![clthu](https://avatars.discourse-cdn.com/v4/letter/c/f04885/32.png) [@clthu](https://community.freefem.org/u/clthu)\
**Post date:** [October 5, 2024, 5:13am UTC](https://community.freefem.org/t/large-scale-fsi-example-with-parallel-implementation/3460/5 "2024-10-05T05:13:36Z")

</div>

Hi, Professor Pierre Jolivet.  
I’m working on this problem from a simple conjugate heat transfer problem. Following the discussion in [Changing Matrix components PETSc Parallel - #10 by prj](https://community.freefem.org/t/changing-matrix-components-petsc-parallel/2367/10), I build the Mat to couple the fluid part on thF to lagrange multiplier on interface thL.

> Mat Aff,Ass;  
> {  
> buildDmesh(thF);  
> createMat(thF,Aff,P2);  
> }  
> {  
> buildDmesh(thS);  
> createMat(thS,Ass,P2);  
> }  
> {  
> fespace PhL(thGL,P0);  
> PhL Ltemp = chi(thF); //characteristic function of a mesh  
> thL = trunc(thGL,abs(Ltemp-1.0)\<1e-2);  
> }  
> varf aff(uF,vF) = int2d(thF)(kF\*(dx(uF) \* dx(vF)+dy(uF) \* dy(vF)));  
> varf alf(uL,vF) = int1d(thL)(uL \* vF);
> 
> Aff = aff(XhF,XhF);
> 
> matrix rtoFtemp = interpolate(XhL,XhF);  
> matrix Alftemp = alf(XhL,XhF);  
> Mat rtoF(Aff, restriction = rtoFtemp);  
> Mat Alf(Aff,rtoF,Alftemp);

This is OK, but for thS it fails.

> varf ass(uS,vS) = int2d(thS)(kS\*(dx(uS) \* dx(vS)+dy(uS) \* dy(vS)));  
> varf als(uL,vS) = int1d(thL)(-1.0_uL_vS);  
> Ass = ass(XhS,XhS);
> 
> matrix rtoStemp = interpolate(XhL,XhS);  
> matrix Alstemp = als(XhL,XhS);  
> Mat rtoS(Ass, restriction = rtoStemp);  
> Mat Als(Ass,rtoS,Alstemp);

I think the problem is due to I build thL from thF, not from thS.

The code fails on this line [test\_parallel.edp](https://community.freefem.org/uploads/short-url/kN0KKfOYmu9pbi57xpNqn8US4fT.edp) (2.4 KB). I am trying to parallize it from  
[test\_seq.edp](https://community.freefem.org/uploads/short-url/vVgwXlMAZrDgboF9mt8L5bBIL2U.edp) (1.7 KB).

Would you mind giving me some suggestions on this problem? Much thanks~

---

_[View the full topic](https://community.freefem.org/t/large-scale-fsi-example-with-parallel-implementation/3460)._
