# Unsteady Stokes with PETSc

**URL:** <https://community.freefem.org/t/unsteady-stokes-with-petsc/2611>\
**Category:** General Discussion\
**Created:** [July 17, 2023, 3:26pm UTC](https://community.freefem.org/t/unsteady-stokes-with-petsc/2611 "2023-07-17T15:26:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rirane](https://avatars.discourse-cdn.com/v4/letter/r/51bf81/32.png) [@rirane](https://community.freefem.org/u/rirane)\
**Post date:** [July 17, 2023, 3:26pm UTC](https://community.freefem.org/t/unsteady-stokes-with-petsc/2611/1 "2023-07-17T15:26:25Z")

</div>

Hi,  
I am still trying to solve an unsteady stokes equation ([Stokes with time stepper - PETSc - #7 by rirane](https://community.freefem.org/t/stokes-with-time-stepper-petsc/2593/7) - the problem there got solved but now I have a problem with the time update) The right-hand side is updated in every time step. But the solution seems to “jump” between two states, so something seems to be wrong with the update of rhs. Does somebody know how to update it?

[petsc-stokes.edp](https://community.freefem.org/uploads/short-url/tHGRsVSxVlTpJcVpwW1untH49QW.edp) (1.8 KB)

---

<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:** [July 17, 2023, 5:46pm UTC](https://community.freefem.org/t/unsteady-stokes-with-petsc/2611/2 "2023-07-17T17:46:39Z")

</div>

Even with a single process, the solution is not correct after the first time step. You need to fix your discretization in time.

---

<div class="post-metadata">

**Author:** ![rirane](https://avatars.discourse-cdn.com/v4/letter/r/51bf81/32.png) [@rirane](https://community.freefem.org/u/rirane)\
**Post date:** [July 18, 2023, 3:12pm UTC](https://community.freefem.org/t/unsteady-stokes-with-petsc/2611/3 "2023-07-18T15:12:44Z")

</div>

The time discretization wasn’t the problem.  
The right-hand side was the problem.

[petsc-stokes.edp](https://community.freefem.org/uploads/short-url/4nDYpmEEfE0pQTrMMKz6M9ZJfUr.edp) (1.9 KB)

---

<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:** [July 18, 2023, 3:33pm UTC](https://community.freefem.org/t/unsteady-stokes-with-petsc/2611/4 "2023-07-18T15:33:41Z")

</div>

Well, the time discretization has a direct effect on the RHS… So if your RHS was wrong, it means that your time discretization was wrong indeed.
