# Hele shaw flow problem

**URL:** https://community.freefem.org/t/hele-shaw-flow-problem/3352
**Category:** General Discussion
**Created:** [June 26, 2024, 1:14pm UTC](https://community.freefem.org/t/hele-shaw-flow-problem/3352 "2024-06-26T13:14:28Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![111-1111](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/111-1111/32/2175_2.png) [@111-1111](https://community.freefem.org/u/111-1111)
#### Post date: [June 26, 2024, 1:14pm UTC](https://community.freefem.org/t/hele-shaw-flow-problem/3352/1 "2024-06-26T13:14:28Z")

</div>

Dear developer:  
I’m solving for a hele shaw flow over a rectangular region (2×1). The boundary conditions on all four edges are no-flux boundary conditions. The code I developed fails to converge. **Note that If the nonlinear term vr terms in the following equation is removed, the result agree well with the comsol result. My question is that how to handle vr terms so that the code converge.** I would appreciate that if your could kindly help me to solve this problem.

I would appreciate that if your could kindly help me

The specific equation is shown below：  
 ![image](https://canada1.discourse-cdn.com/flex030/uploads/freefem/original/2X/2/2ab2fe9646d461604aba37ddce929c6ecc90be2c.png)

Where Tr is 0.95.  
The initial conditions are as follows：

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/freefem/original/2X/c/c87cb6ad3f8b0b5a901d287d69594b29eeb6e32f.png)

Some key codes are as follows：

**varf form**

![image](https://canada1.discourse-cdn.com/flex030/uploads/freefem/original/2X/6/6543c9e1fb8446625969949f963c54af423cf377.png)

**Solving procedure**

![image](https://canada1.discourse-cdn.com/flex030/uploads/freefem/original/2X/d/dedd32e1352dac40de406fdbf88fb52ce0c25e00.png)

See attachment for the complete code.  
The results of my simulation using comsol are shown below:

![image](https://canada1.discourse-cdn.com/flex030/uploads/freefem/original/2X/a/ac9ad7892b2553594b2be6e969bed0a93438ab4b.png)  
 ![image](https://canada1.discourse-cdn.com/flex030/uploads/freefem/original/2X/2/24b84b735221ce15a4887db979ca055209f33848.png)  
 ![image](https://canada1.discourse-cdn.com/flex030/uploads/freefem/original/2X/7/7b7ffedeac9be059c37db4a33b50ac26ae7227ba.png)

Best wish,  
Guangyuan Wei  
[modify41.edp](https://community.freefem.org/uploads/short-url/kVox54kKKU1PVu05oY49o2dMhnF.edp) (2.0 KB)

---

<div class="post-metadata">

### Author: ![fb77](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/fb77/32/3796_2.png) [@fb77](https://community.freefem.org/u/fb77)
#### Post date: [June 26, 2024, 9:23pm UTC](https://community.freefem.org/t/hele-shaw-flow-problem/3352/2 "2024-06-26T21:23:07Z")

</div>

I have tried to resolve the nonlinearity v\_r(\rho) implicitly by iteration:  
\int\_\Omega\omega\frac{\rho^{(k+1)}-\rho^n}{dt} +\int\_\Omega\nabla\omega\cdot\left(\frac{\rho^{(k)2}}{\mu\_r(\rho^{(k)})}\nabla\Pi^{(k+1)}\right) +\int\_\Omega\chi\bigl(v\_r(\rho^{(k)})+r(\rho^{(k+1)}-\rho^{(k)})-\Pi^{(k+1)}\bigr)  
+\int\_\Omega\Lambda\nabla\chi\cdot\nabla\rho^{(k+1)}=0  
where k is an iteration index. Then \rho^{(k)} is supposed to converge to \rho^{n+1} solving the implicit problem. The constant r has to be taken large enough, in particular larger than \sup v\_r'(\rho), where v\_r' stands for the derivative of v\_r with respect to \rho. Moreover r must be greater than 6.\*(1.-Tr) which is minus the minimum of v\_r'.  
Warning: when you write ( 8 / 3 ), the quotient is taken in the sense of integers, giving the result of 2. You must write ( 8. / 3. ).  
Here is the code, that seems to work  
[heleshaw\_new.edp](https://community.freefem.org/uploads/short-url/qXyGbRtsEJNDrTi9YSrJIHMvzUT.edp) (2.8 KB)

---

<div class="post-metadata">

### Author: ![111-1111](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/111-1111/32/2175_2.png) [@111-1111](https://community.freefem.org/u/111-1111)
#### Post date: [June 28, 2024, 9:10am UTC](https://community.freefem.org/t/hele-shaw-flow-problem/3352/3 "2024-06-28T09:10:18Z")

</div>

Dear François Bouchut，  
Thank you very much for the great help you have given me in my difficulties. I will be greatly appreciated. I will consider your suggestions and solutions in depth.

Best wish,  
Guangyuan Wei
