# Issue with Parallel Computation in FreeFEM++ for Solving a PDE

**URL:** <https://community.freefem.org/t/issue-with-parallel-computation-in-freefem-for-solving-a-pde/3782>\
**Category:** General Discussion\
**Created:** [February 28, 2025, 7:12am UTC](https://community.freefem.org/t/issue-with-parallel-computation-in-freefem-for-solving-a-pde/3782 "2025-02-28T07:12:02Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![7420029](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/7420029/32/2962_2.png) [@7420029](https://community.freefem.org/u/7420029)\
**Post date:** [February 28, 2025, 7:12am UTC](https://community.freefem.org/t/issue-with-parallel-computation-in-freefem-for-solving-a-pde/3782/1 "2025-02-28T07:12:02Z")

</div>

Hello everyone! I am new to FreeFEM++ and I am working on solving the following partial differential equation (PDE):

x^2 (1 - x - y)^2 \frac{\partial^2 f}{\partial x^2} + (\beta (1 - x - y)-1) x \frac{\partial f}{\partial x} + \gamma x \frac{\partial f}{\partial y} - \epsilon f - \frac{\partial f}{\partial \tau} = 0

**Initial Condition** :

f(x, y, 0) = \max(x - k, 0)

**Boundary Condition** :

Neumann-Dirichlet boundary condition: f(0, y, \tau) = 0

Where 0 \leq x + y \leq 1 , and x, y \in [0, 1] .

When I run the following code on a Mac, I encounter an error:

before token ) in the parallel computation part of the weak form.

I am not sure what is causing the issue, especially in the parallel computation section. Could someone assist me in identifying the problem and suggest how to fix it?

```auto
// Load necessary libraries
load "msh3"
load "isoline"

// Parameter settings
real beta = 0.5;
real gamma = 0.3;
real epsilon =0.1;
real k = 0.3;
real T = 1.0;
real dt = 0.01;
int Ntime = int(T/dt);

// Boundary definitions (region constraint x + y <= 1)
border Gamma1(t=0,1){x=t; y=1-t;}
border Gamma2(t=0,1){x=1-t; y=t;}
border Gamma3(t=0,1){x=t; y=0;}
border Gamma4(t=0,1){x=0; y=t;}

// Mesh generation
int n=10;
mesh Th = buildmesh(Gamma1(n) + Gamma2(n) + Gamma3(n) + Gamma4(n));
plot(Th, wait=true, pdf="mesh.pdf");

// Finite element space
fespace Vh(Th, P1);
Vh f, fold, v;

// Initial conditions
f = (x > k ? x - k : 0);
fold = f; 

// Time evolution
for (int n = 0; n < Ntime; n++) {
    real t = n * dt;
    // Weak form of the partial differential equation (Backward Euler Scheme)
    solve P(f, v)
        = int2d(Th)(f / dt * v - fold / dt * v)
        - int2d(Th)(x^2 * (1 - x - y)^2 * (dx(f) * dx(v)))
        + int2d(Th)((beta * (1 - x - y) - 1+ 2* (1 - x - y) * (1 - x - 2 * y)) * x * (dx(f) * v))
        + int2d(Th)(gamma * x * (dy(f) * v))
        - int2d(Th)(epsilon * f * v);

    // Update time step
    fold[] = f[];
}

// Visualization (3D display)
plot(f, dim=3, wait=true, pdf="solution.pdf");

```

---

<div class="post-metadata">

**Author:** ![Monirul25](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/monirul25/32/3287_2.png) [@Monirul25](https://community.freefem.org/u/Monirul25)\
**Post date:** [February 28, 2025, 9:38am UTC](https://community.freefem.org/t/issue-with-parallel-computation-in-freefem-for-solving-a-pde/3782/2 "2025-02-28T09:38:00Z")

</div>

Run with FF++ not FF++ -mpi.  
Here, is your code with some corrections.  
[sample.edp](https://community.freefem.org/uploads/short-url/zYYUfp5UWL3TMRKQC0AR23RSWNs.edp) (1.4 KB)

---

<div class="post-metadata">

**Author:** ![frederichecht](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/frederichecht/32/15_2.png) [@frederichecht](https://community.freefem.org/u/frederichecht)\
**Post date:** [February 28, 2025, 9:42am UTC](https://community.freefem.org/t/issue-with-parallel-computation-in-freefem-for-solving-a-pde/3782/3 "2025-02-28T09:42:50Z")

</div>

You error is you can not mike linear an bilinear term in same integral

- the mesh construction is wrong (remember the domain must be a left of the border.)  
and no double border (overlap)

[zzz.edp](https://community.freefem.org/uploads/short-url/d3IhwIZhEIzlJrQ1cVzkNTLrNSn.edp) (1.3 KB)

---

<div class="post-metadata">

**Author:** ![7420029](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/7420029/32/2962_2.png) [@7420029](https://community.freefem.org/u/7420029)\
**Post date:** [February 28, 2025, 10:07am UTC](https://community.freefem.org/t/issue-with-parallel-computation-in-freefem-for-solving-a-pde/3782/4 "2025-02-28T10:07:18Z")

</div>

Thank you for your confirmation and I appreciate your follow-up!

---

<div class="post-metadata">

**Author:** ![7420029](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/7420029/32/2962_2.png) [@7420029](https://community.freefem.org/u/7420029)\
**Post date:** [February 28, 2025, 10:08am UTC](https://community.freefem.org/t/issue-with-parallel-computation-in-freefem-for-solving-a-pde/3782/5 "2025-02-28T10:08:21Z")

</div>

Thank you for your confirmation! I will check the mistake and correct it. Thank you again!
