# Order of accuracy analysis in ACM

**URL:** <https://pyfr.discourse.group/t/order-of-accuracy-analysis-in-acm/302>\
**Category:** General\
**Created:** [6 October 2020 14:47 UTC](https://pyfr.discourse.group/t/order-of-accuracy-analysis-in-acm/302 "2020-10-06T14:47:28Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![MohamedKamra](https://avatars.discourse-cdn.com/v4/letter/m/a4c791/32.png) [@MohamedKamra](https://pyfr.discourse.group/u/MohamedKamra)\
**Post date:** [6 October 2020 14:47 UTC](https://pyfr.discourse.group/t/order-of-accuracy-analysis-in-acm/302/1 "2020-10-06T14:47:28Z")

</div>

Hello Everyone,

I have a question regarding the order of accuracy of the ACM method; Have you done any tests using the method of manufactured solutions ( published or otherwise) ?

I tried the 2D taylor green benchmark but the order of accuracy I am getting is nowhere near what it should be. When comparing with exact solution I used the solution points directly not the subdivided solution in the vtu file to avoid interpolation issues polluting the order of accuracy

Also regarding the ACM, how would one obtain the residual of the continuity and momentum equations? Pseudo-stats only report the change between two consecutive pseudo iterations

Regards,

M Kamra

---

<div class="post-metadata">

**Author:** ![p.vincent](https://yyz2.discourse-cdn.com/free1/user_avatar/pyfr.discourse.group/p.vincent/32/225_2.png) [@p.vincent](https://pyfr.discourse.group/u/p.vincent)\
**Post date:** [6 October 2020 14:51 UTC](https://pyfr.discourse.group/t/order-of-accuracy-analysis-in-acm/302/2 "2020-10-06T14:51:02Z")

</div>

Hi M Karma,

Could you provide more details of the test case, the way your are obtaining the order of accuracy, and the results that you are getting.

Thanks

Peter

---

<div class="post-metadata">

**Author:** ![MohamedKamra](https://avatars.discourse-cdn.com/v4/letter/m/a4c791/32.png) [@MohamedKamra](https://pyfr.discourse.group/u/MohamedKamra)\
**Post date:** [6 October 2020 15:38 UTC](https://pyfr.discourse.group/t/order-of-accuracy-analysis-in-acm/302/3 "2020-10-06T15:38:44Z")

</div>

Hi,  
Thanks for the prompt response  
I followed the case illustrated in Cox et al article

[https://www.sciencedirect.com/science/article/pii/S0021999116001686?casa\_token=Vpk3uWyaxE0AAAAA:IGLI-wLZFaIwfIIOyPM1OZH6-TphsFXG3nTrgAbaSuJkzNJrUbAYDcL-qc9R1WINd9qGIA](https://www.sciencedirect.com/science/article/pii/S0021999116001686?casa_token=Vpk3uWyaxE0AAAAA:IGLI-wLZFaIwfIIOyPM1OZH6-TphsFXG3nTrgAbaSuJkzNJrUbAYDcL-qc9R1WINd9qGIA)

It is a double periodic 2D manufactured solution case, the u, v source terms are evaluated using Mathematica

I attach the ini file here  
The Re = 10

I calculated the order of accuracy in the manner described in the article which is fairly straightforward

![image.png](https://global.discourse-cdn.com/free1/uploads/pyfr/original/1X/3cbc5363087e774d4827aa644ab4b1dc9fe6e20a.png)

![image.png](https://global.discourse-cdn.com/free1/uploads/pyfr/original/1X/f2a8d699eeee237f241f4e30ce1c247405409ea8.png)

where eps\_k is the difference between the exact solution and the numerical solution.  
I used the same meshes resolutions as the article 4x4, 8x8, 16x16, 32x32 with double periodic bcs generated using gmsh

For now, I am only trying to verify the spatial accuracy so following the article’s example I am using very small dt  
I tried different zeta values, different pseudo-dt, more pseudo-niters-max going as high as 50 which is killing my performance

the only part I did not mess with is the LDG beta and tau  
I double-checked the source terms several times but it seems okay  
So I am not sure what could be the problem.

Appreciate your help.

M Kamra

[tg2d.ini](https://pyfr.discourse.group/uploads/short-url/oQzFrAlsOHGOBwRm2JlDi8WoQSj.ini) (1.41 KB)

---

<div class="post-metadata">

**Author:** ![p.vincent](https://yyz2.discourse-cdn.com/free1/user_avatar/pyfr.discourse.group/p.vincent/32/225_2.png) [@p.vincent](https://pyfr.discourse.group/u/p.vincent)\
**Post date:** [7 October 2020 01:48 UTC](https://pyfr.discourse.group/t/order-of-accuracy-analysis-in-acm/302/4 "2020-10-07T01:48:56Z")

</div>

Hi Mohamed,

I am a little confused as to the test case you are using.

The 2D TGV case in the paper you reference does not seem to use a method of manufactured solutions, it just solves the regular NS equations without a source term?

Apologies if I missed something.

Peter

---

<div class="post-metadata">

**Author:** ![MohamedKamra](https://avatars.discourse-cdn.com/v4/letter/m/a4c791/32.png) [@MohamedKamra](https://pyfr.discourse.group/u/MohamedKamra)\
**Post date:** [7 October 2020 02:23 UTC](https://pyfr.discourse.group/t/order-of-accuracy-analysis-in-acm/302/5 "2020-10-07T02:23:18Z")

</div>

Hi Peter,  
You’re right. I left the source term in the ini file because it may not evaluate to zero depending on the choice of the length scale in the Reynolds number (since the domain is not a unit square). When the length scale is chosen to be 1 ( Re = 1/nu) which is the case in all of our simulations so far, then the source term vanishes and that’s what’s used in the ini file attached.

So I don’t think that the source term is the cause of the problem. I removed it now just in case but I got the exact same results.

Regards,  
Mohamed Kamra

---

<div class="post-metadata">

**Author:** ![p.vincent](https://yyz2.discourse-cdn.com/free1/user_avatar/pyfr.discourse.group/p.vincent/32/225_2.png) [@p.vincent](https://pyfr.discourse.group/u/p.vincent)\
**Post date:** [7 October 2020 02:28 UTC](https://pyfr.discourse.group/t/order-of-accuracy-analysis-in-acm/302/6 "2020-10-07T02:28:23Z")

</div>

So what orders of accuracy do you get?

Peter

---

<div class="post-metadata">

**Author:** ![MohamedKamra](https://avatars.discourse-cdn.com/v4/letter/m/a4c791/32.png) [@MohamedKamra](https://pyfr.discourse.group/u/MohamedKamra)\
**Post date:** [7 October 2020 03:27 UTC](https://pyfr.discourse.group/t/order-of-accuracy-analysis-in-acm/302/7 "2020-10-07T03:27:58Z")

</div>

When solver solver.order = 4

4x4 : Mesh DOFs = 400  
Variable: U Error L1Norm = 0.000114383  
Variable: U Error L2Norm = 0.000132731  
8x8 : Mesh DOFs = 1600  
Variable: U Error L1Norm = 3.8896e-05  
Variable: U Error L2Norm = 4.86379e-05  
16x16 : Mesh DOFs = 6400  
Variable: U Error L1Norm = 3.90541e-05  
Variable: U Error L2Norm = 4.82179e-05  
32x32 : Mesh DOFs = 25600  
Variable: U Error L1Norm = 3.91447e-05

Variable: U Error L2Norm = 4.81805e-05

Between the first two meshes, it is not even second order, after the order becomes almost 0!

Vvisualizing the error shows high error everywhere, specifically at high gradient areas

![image.jpg](https://global.discourse-cdn.com/free1/uploads/pyfr/original/1X/8ca16affeabddaa70988ee805eaa7a6212534974.jpeg)  
Error distribution of U for Mesh 16x16 , order 4.0

![image.jpg](https://global.discourse-cdn.com/free1/uploads/pyfr/original/1X/2eb4edbdf94cb900823f9d343314fa8667fe97b4.jpeg)  
Distribution of U Numerical solution for Mesh 16x16 , order 4.0

![image.jpg](https://global.discourse-cdn.com/free1/uploads/pyfr/original/1X/2eb4edbdf94cb900823f9d343314fa8667fe97b4.jpeg)

Distribution of U Exact solution for Mesh 16x16 , order 4.0

---

<div class="post-metadata">

**Author:** ![p.vincent](https://yyz2.discourse-cdn.com/free1/user_avatar/pyfr.discourse.group/p.vincent/32/225_2.png) [@p.vincent](https://pyfr.discourse.group/u/p.vincent)\
**Post date:** [7 October 2020 13:21 UTC](https://pyfr.discourse.group/t/order-of-accuracy-analysis-in-acm/302/8 "2020-10-07T13:21:17Z")

</div>

So it looks like errors saturate at 8x8 and don’t go down.

So maybe due to the time integration?

How small is the dt that you are using, and do the numbers change when you reduce it further?

Regarding:

> > > I tried different zeta values, different pseudo-dt, more pseudo-niters-max going as high as 50 which is killing my performance

Can you send plots of how the pseudo residuals are converging in each dt?

What do you mean quantitatively by ‘killing performance’

Are you using local pseudo dt and PMG etc. for the inner iterations, or just plain RK4?

Thanks

Peter

---

<div class="post-metadata">

**Author:** ![MohamedKamra](https://avatars.discourse-cdn.com/v4/letter/m/a4c791/32.png) [@MohamedKamra](https://pyfr.discourse.group/u/MohamedKamra)\
**Post date:** [7 October 2020 16:24 UTC](https://pyfr.discourse.group/t/order-of-accuracy-analysis-in-acm/302/9 "2020-10-07T16:24:54Z")

</div>

> How small is the dt that you are using, and do the numbers change when you reduce it further?

The time step dt = 0.001 when decreased to 5e-4 and even 1e-4 the change in error is no more 1%

pseudo-niters-max = 50 , using p-multigrid with vermiere pseudo integration  
I tried local-pi but it was either unstable or ineffective perhaps I need to do needs some fine-tuning of my chosen parameters

> What do you mean quantitatively by ‘killing performance’
> 
> Are you using local pseudo dt and PMG etc. for the inner iterations, or just plain RK4?

As for the matter of performance, using p-multigrid with pseudo-niters-max of 50 yields a wall clock time of 6 hours if dt is taken as low as 1e-4 for 8x8 mesh to run only 1s ( GPU utilization at less than 15%)

> Can you send plots of how the pseudo residuals are converging in each dt?

As for the residuals:  
p : 5e-5 ~ 1e-4  
uv: 1e-6 ~ 1e-7  
For reference, the residual history data and the corresponding ini file can be downloaded from the following link  
[https://mega.nz/folder/jVZBwIBb#gk6J1zSTM-Hg8GgRzDYysw](https://mega.nz/folder/jVZBwIBb#gk6J1zSTM-Hg8GgRzDYysw)  
I included residual history for 0.25s only

---

<div class="post-metadata">

**Author:** ![fdw](https://avatars.discourse-cdn.com/v4/letter/f/a587f6/32.png) [@fdw](https://pyfr.discourse.group/u/fdw)\
**Post date:** [7 October 2020 17:06 UTC](https://pyfr.discourse.group/t/order-of-accuracy-analysis-in-acm/302/10 "2020-10-07T17:06:13Z")

</div>

Can you confirm what order of accuracy you get if you just perform your study on the solution produced by PyFR at t = 0 (so the initial condition)?

Regards, Freddie.

---

<div class="post-metadata">

**Author:** ![MohamedKamra](https://avatars.discourse-cdn.com/v4/letter/m/a4c791/32.png) [@MohamedKamra](https://pyfr.discourse.group/u/MohamedKamra)\
**Post date:** [7 October 2020 17:19 UTC](https://pyfr.discourse.group/t/order-of-accuracy-analysis-in-acm/302/11 "2020-10-07T17:19:29Z")

</div>

The errors are all machine zero as to be expected  
Time = 0

Mesh DOFs = 400  
Variable: U Error L1Norm = 8.49147e-17  
Variable: U Error L2Norm = 1.76753e-16

Mesh DOFs = 1600  
Variable: U Error L1Norm = 1.03079e-16  
Variable: U Error L2Norm = 1.99849e-16  
Mesh DOFs = 6400  
Variable: U Error L1Norm = 1.02447e-16  
Variable: U Error L2Norm = 1.98217e-16  
Mesh DOFs = 25600  
Variable: U Error L1Norm = 1.05134e-16  
Variable: U Error L2Norm = 2.01533e-16
