# Modified Weak Galerkin of Heat equation in 2D

**URL:** https://community.freefem.org/t/modified-weak-galerkin-of-heat-equation-in-2d/3773
**Category:** General Discussion
**Created:** [February 25, 2025, 8:22pm UTC](https://community.freefem.org/t/modified-weak-galerkin-of-heat-equation-in-2d/3773 "2025-02-25T20:22:06Z")
**Posts on this page:** 3
**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 25, 2025, 8:22pm UTC](https://community.freefem.org/t/modified-weak-galerkin-of-heat-equation-in-2d/3773/1 "2025-02-25T20:22:06Z")

</div>

Dear all experts, Respected Francois Sir, and Respected Hecht sir, I have tried to implement modified weak Galerkin in the **heat equation 2D FF++ code using the poisson equation modified weak Galerkin code .** I am wondering why they both not giving good results sir. Can you please check my code sir??.

1. Heat equation in 2D with u=0 in boundary. Code\>  
[Heat\_WGM\_Sine.edp](https://community.freefem.org/uploads/short-url/xqwEERgYKHAxCtC5rmOIzLPnvXH.edp) (2.4 KB)
2. Heat equation in 2D with **neumann derivative of u** =0 in boundary. Code\>  
[MWG\_Heat\_2D\_Cosine.edp](https://community.freefem.org/uploads/short-url/73byYeKCJ3T5n4sN0EPPderhQ8R.edp) (2.3 KB)

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, 1:59pm UTC](https://community.freefem.org/t/modified-weak-galerkin-of-heat-equation-in-2d/3773/2 "2025-02-26T13:59:58Z")

</div>

You miss `exp(t)` in the last term of definition of `f`, and `*(nTonEdge-1)` in the two `intalledges` involving the `mean`  
[Heat\_WGM\_Sine.edp](https://community.freefem.org/uploads/short-url/qIT2vDtENUCYsRQGCfJZXgVUENe.edp) (2.4 KB)  
For Neumann BC, do not put the factor `(nTonEdge-1)` in the two `intalledges` involving the `mean`, but put it in the `intalledges` involving the jumps.

---

<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, 2:16pm UTC](https://community.freefem.org/t/modified-weak-galerkin-of-heat-equation-in-2d/3773/3 "2025-02-26T14:16:26Z")

</div>

Thank you so much sir. If you get time kindly look the post of integro-partial differential equation code in FF++. I have stored the solution of previous steps and computed the approximate for integral but results not coming good sir.
