# Stokes Discontinous Galerkin

**URL:** <https://community.freefem.org/t/stokes-discontinous-galerkin/3696>\
**Category:** General Discussion\
**Created:** [January 20, 2025, 3:35pm UTC](https://community.freefem.org/t/stokes-discontinous-galerkin/3696 "2025-01-20T15:35:53Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Manel](https://avatars.discourse-cdn.com/v4/letter/m/ee7513/32.png) [@Manel](https://community.freefem.org/u/Manel)\
**Post date:** [January 20, 2025, 3:35pm UTC](https://community.freefem.org/t/stokes-discontinous-galerkin/3696/1 "2025-01-20T15:35:54Z")

</div>

Dear all,

I implemented a discontinous Galerkin scheme to solve the stokes equations. The case P2dc-P1dc for velocity-pressure is good but the case P1dc-P0 does not work and I do not why.  
Does anyone have an idea what the problem is ?

---

<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:** [January 20, 2025, 3:46pm UTC](https://community.freefem.org/t/stokes-discontinous-galerkin/3696/2 "2025-01-20T15:46:08Z")

</div>

I can look at it if you send a code.

---

<div class="post-metadata">

**Author:** ![Manel](https://avatars.discourse-cdn.com/v4/letter/m/ee7513/32.png) [@Manel](https://community.freefem.org/u/Manel)\
**Post date:** [January 20, 2025, 8:56pm UTC](https://community.freefem.org/t/stokes-discontinous-galerkin/3696/3 "2025-01-20T20:56:04Z")

</div>

Thank you for you reply. Please find enclosed the code.  
[stokesdg.edp](https://community.freefem.org/uploads/short-url/cThF4MjewjhVZTLAA2QOpPRYNUs.edp) (1.8 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:** [January 21, 2025, 12:18pm UTC](https://community.freefem.org/t/stokes-discontinous-galerkin/3696/4 "2025-01-21T12:18:26Z")

</div>

Your right-hand side `f` was not well computed. Computing it by using `dx()` and `dy()` in the fespaces induces some interpolation errors and inconsistencies. In particular `dx(pex)` and `dy(pex)` with `pex` in `P0` gives simply zero.  
I have defined f explicitly and it seems to work.  
[stokesdg.edp](https://community.freefem.org/uploads/short-url/vQmqMDvxOxNtdNS2gzarkJBvW2W.edp) (2.2 KB)

---

<div class="post-metadata">

**Author:** ![Manel](https://avatars.discourse-cdn.com/v4/letter/m/ee7513/32.png) [@Manel](https://community.freefem.org/u/Manel)\
**Post date:** [January 21, 2025, 8:45pm UTC](https://community.freefem.org/t/stokes-discontinous-galerkin/3696/5 "2025-01-21T20:45:53Z")

</div>

Yes, thank you for your replay !
