# Can it possible to find L^2-error and order of convergence in Heat-3d PETSc code (parrallel computing)

**URL:** <https://community.freefem.org/t/can-it-possible-to-find-l-2-error-and-order-of-convergence-in-heat-3d-petsc-code-parrallel-computing/3766>\
**Category:** General Discussion\
**Created:** [February 23, 2025, 4:11am UTC](https://community.freefem.org/t/can-it-possible-to-find-l-2-error-and-order-of-convergence-in-heat-3d-petsc-code-parrallel-computing/3766 "2025-02-23T04:11:04Z")\
**Posts on this page:** 10\
**Page:** 1

<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 23, 2025, 4:11am UTC](https://community.freefem.org/t/can-it-possible-to-find-l-2-error-and-order-of-convergence-in-heat-3d-petsc-code-parrallel-computing/3766/1 "2025-02-23T04:11:04Z")

</div>

Respected prj sir, i have run heat-3d petsc code in window commant promt.  
But i wondering why plot command does not is giving plot in command promt.  
[heat-3d.edp](https://community.freefem.org/uploads/short-url/67UzGgS3qB4Dyqb87HrWytBgGQC.edp) (5.0 KB)

> Blockquote  
> plotMPI(Th, u, Pk, def, real, cmm = “Global solution”);  
> This command does not creating plot. Can you help me pls??. It should give the plot.

**One more important thing:**  
**Can i find L^2-error and it corresponing order of convergence in PETSc code of Heat equation as we do in usual FreeFem++. Is there any demo example for that??. I am trying but getting problem.**

Thanks in advance sir.

---

<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:** [February 23, 2025, 9:14am UTC](https://community.freefem.org/t/can-it-possible-to-find-l-2-error-and-order-of-convergence-in-heat-3d-petsc-code-parrallel-computing/3766/2 "2025-02-23T09:14:01Z")

</div>

Yes, they are many ways to compute this, look at the examples.

---

<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 23, 2025, 9:32am UTC](https://community.freefem.org/t/can-it-possible-to-find-l-2-error-and-order-of-convergence-in-heat-3d-petsc-code-parrallel-computing/3766/3 "2025-02-23T09:32:44Z")

</div>

Okay thank you sir. I will see the examples. But can you tell me why plot is not coming?. I have seen plot was coming when you have worked in the Tutorial 1 in windwos. But I am not getting any plot in command promt. I am using FreeFem v4.15 in window 11.

Thanks sir.

---

<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:** [February 23, 2025, 9:36am UTC](https://community.freefem.org/t/can-it-possible-to-find-l-2-error-and-order-of-convergence-in-heat-3d-petsc-code-parrallel-computing/3766/4 "2025-02-23T09:36:21Z")

</div>

You are probably not using the `-wg` command line option.

---

<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 23, 2025, 9:50am UTC](https://community.freefem.org/t/can-it-possible-to-find-l-2-error-and-order-of-convergence-in-heat-3d-petsc-code-parrallel-computing/3766/5 "2025-02-23T09:50:16Z")

</div>

Yes sir. I have not used that. Okay, i will try with that.

Can you tell me the examples name which computed L^2-errors and order of convergence sir.  
This will help me to reach my goal.

Thanks in advance.

---

<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 23, 2025, 12:07pm UTC](https://community.freefem.org/t/can-it-possible-to-find-l-2-error-and-order-of-convergence-in-heat-3d-petsc-code-parrallel-computing/3766/6 "2025-02-23T12:07:27Z")

</div>

Sir, -wg command not working in my command promt. Programme not running if i write -wg-ns.  
The following error comes :

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

But if it is without -wg-ns, then it is running fine.

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/freefem/original/2X/5/57728131355adec221d02a370b31d3d8763d6b7f.png)  
(without -wg -ns)  
**Regarding error and order of convergence, i have seen the tutorial sir but i have not found any single example to compute that. Can you please tell me the specific example sir that can help me in this work.**

Thanks in advance sir.

---

<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 26, 2025, 11:10am UTC](https://community.freefem.org/t/can-it-possible-to-find-l-2-error-and-order-of-convergence-in-heat-3d-petsc-code-parrallel-computing/3766/7 "2025-02-26T11:10:16Z")

</div>

I need atleast one way to compute L2-error and order of convergence. Can you help me pls sir?. I am struggling with it.

Thanks in advance!.

---

<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:** [February 26, 2025, 11:38am UTC](https://community.freefem.org/t/can-it-possible-to-find-l-2-error-and-order-of-convergence-in-heat-3d-petsc-code-parrallel-computing/3766/8 "2025-02-26T11:38:08Z")

</div>

Here [PETSc example (heat-TS-2d-PETSc.edp) incorrectly imlpemented? - #11 by fb77](https://community.freefem.org/t/petsc-example-heat-ts-2d-petsc-edp-incorrectly-imlpemented/3704/11)  
you can find the computation of L2 error (2d) as

```auto
//build partition of unity
fespace Vhpart(Th, P0); // P0 elements for partition function
Vhpart part; // Partition function
PartitionCreate(Th, part[], P0); // Create partition using the mesh Th, part[] takes values 0 or 1

real localerr=int2d(Th)(part*(w-uexT)^2);
real globalerr;
mpiAllReduce(localerr, globalerr, mpiCommWorld, mpiSUM);
globalerr=sqrt(globalerr);
if (mpirank==0) cout << "t=" << t << " global L2 error " << globalerr << endl;

```

The order of convergence can be computed as in sequential codes.

---

<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 26, 2025, 11:41am UTC](https://community.freefem.org/t/can-it-possible-to-find-l-2-error-and-order-of-convergence-in-heat-3d-petsc-code-parrallel-computing/3766/9 "2025-02-26T11:41:55Z")

</div>

Thanks you so much sir ❤  
I have uploaded two more doubt in general discussion sir:  
**1) Modified Weak Galerkin for Heat equation.**  
**2) Parabolic integro-differential equations.**

You can check that sir when you will free. Thanks for your patience and time sir.

---

<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 26, 2025, 11:58am UTC](https://community.freefem.org/t/can-it-possible-to-find-l-2-error-and-order-of-convergence-in-heat-3d-petsc-code-parrallel-computing/3766/10 "2025-02-26T11:58:09Z")

</div>

![image](https://canada1.discourse-cdn.com/flex030/uploads/freefem/original/2X/a/a573288d50a9fa789c73293fad9e127f09b757c3.png)  
Sir, i don’t know why it taking time to run taking at least 6 min. Is it happening in your case also? . I am getting no plot also in command promt but it ran fine.

Thanks sir.
