# Time averaged values

**URL:** https://community.freefem.org/t/time-averaged-values/724
**Category:** General Discussion
**Created:** [January 4, 2021, 4:22pm UTC](https://community.freefem.org/t/time-averaged-values/724 "2021-01-04T16:22:04Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Robert](https://avatars.discourse-cdn.com/v4/letter/r/e95f7d/32.png) [@Robert](https://community.freefem.org/u/Robert)
#### Post date: [January 4, 2021, 4:22pm UTC](https://community.freefem.org/t/time-averaged-values/724/1 "2021-01-04T16:22:04Z")

</div>

Hello forum,

I am trying to get the mean values of an unsteady flow. So far I tried the following code:

for (i=1; i\<=iterations; i++)  
{  
t +=dt; // update the time step  
up[]=u[]; // Problem variables  
PROBLEM; //Call to solve the problem equation  
sumu[] += u[];  
}  
umean[] = sumu[]/iterations;

The problem is that “sumu[] += u[]” doesn’t seem to work as I expected. For example if at iteration “n”, the maximum velocity is 1 m/s and at iteration “n+1”, the maximum velocity is 2 m/s, I get a maximum velocity of 5 m/s.

I attached the equation of the time integral which I want to apply now in this case in order to get the mean/time-averaged values. Unfortunately I didn’t manage to implement it.  
 ![image](https://canada1.discourse-cdn.com/flex030/uploads/freefem/original/1X/df35aeb0edb86889399b7ad84712fe0912fe0918.png)

Could you, please, help me to get the mean values?

Regards,  
Robert

---

<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: [January 4, 2021, 4:33pm UTC](https://community.freefem.org/t/time-averaged-values/724/2 "2021-01-04T16:33:15Z")

</div>

That should work, do you do some kind of mesh adaptation?

---

<div class="post-metadata">

### Author: ![Robert](https://avatars.discourse-cdn.com/v4/letter/r/e95f7d/32.png) [@Robert](https://community.freefem.org/u/Robert)
#### Post date: [January 4, 2021, 4:40pm UTC](https://community.freefem.org/t/time-averaged-values/724/3 "2021-01-04T16:40:32Z")

</div>

Hello prj, and thank you for the fast answer. No, I don’t adapt the mesh.
