Output euler vortex super accuracy

Hello everyone,

I want to assess accuracy by comparing with the analytical solutions in euler vortex case, such as the operator in this paper. (see PyFR: An open source framework for solving advection–diffusion type problems on streaming architectures using the flux reconstruction approach - ScienceDirect). Is there a built-in function in PyFr that can output cell values? If not, how can I add some codes to get cell value? And it’s not easy to operate in ParaView.

With best regards

The integrate plugin combined with a suitable region and sample frequency should be able to accomplish this.

Regards, Freddie.

Thanks a lot.

But it comes some errors.

File "/ENV3/lib/python3.8/site-packages/pyfr/plugins/![](file:///C:\Users\jiange\AppData\Roaming\Tencent\QQTempSys\%W@GJ$ACOF(TYDYECOKVDYB.png)integrate.py", line 40, in __init__
self._init_gradients(intg, rinfo)
File "/ENV3/lib/python3.8/site-packages/pyfr/plugins/![](file:///C:\Users\jiange\AppData\Roaming\Tencent\QQTempSys\%W@GJ$ACOF(TYDYECOKVDYB.png)integrate.py", line 128, in _init_gradients
self._gradpinfo = [(pname, privarmap.index(pname))
File "ENV3/lib/python3.8/site-packages/pyfr/plugins/![](file:///C:\Users\jiange\AppData\Roaming\Tencent\QQTempSys\%W@GJ$ACOF(TYDYECOKVDYB.png)integrate.py", line 128, in <listcomp>
self._gradpinfo = [(pname, privarmap.index(pname))
ValueError: 'w' is not in list
--------------------------------------------------------------------------
MPI_ABORT was invoked on rank 0 in communicator MPI_COMM_WORLD
with errorcode 1.

NOTE: invoking MPI_ABORT causes Open MPI to kill all MPI processes.
You may or may not see output from other processes, depending on
exactly when Open MPI kills them.

File "/home/jian/ENV3/lib/python3.8/site-packages/pyfr/plugins/![](file:///C:\Users\jiange\AppData\Roaming\Tencent\QQTempSys\%W@GJ$ACOF(TYDYECOKVDYB.png)integrate.py", line 40, in __init__
self._init_gradients(intg, rinfo)
File "/home/jian/ENV3/lib/python3.8/site-packages/pyfr/plugins/![](file:///C:\Users\jiange\AppData\Roaming\Tencent\QQTempSys\%W@GJ$ACOF(TYDYECOKVDYB.png)integrate.py", line 128, in _init_gradients
self._gradpinfo = [(pname, privarmap.index(pname))
File "/home/jian/ENV3/lib/python3.8/site-packages/pyfr/plugins/![](file:///C:\Users\jiange\AppData\Roaming\Tencent\QQTempSys\%W@GJ$ACOF(TYDYECOKVDYB.png)integrate.py", line 128, in <listcomp>
self._gradpinfo = [(pname, privarmap.index(pname))
ValueError: 'w' is not in list
--------------------------------------------------------------------------
MPI_ABORT was invoked on rank 0 in communicator MPI_COMM_WORLD
with errorcode 1.
NOTE: invoking MPI_ABORT causes Open MPI to kill all MPI processes.
You may or may not see output from other processes, depending on
exactly when Open MPI kills them.

And I copy this to test, What did I do wrong?

[soln-plugin-integrate]
nsteps = 50
file = integral.csv
header = true
quad-deg = 9
vor1 = (grad_w_y - grad_v_z)
vor2 = (grad_u_z - grad_w_x)
vor3 = (grad_v_x - grad_u_y)

int-E = rho*(u*u + v*v + w*w)
int-enst = rho*(%(vor1)s*%(vor1)s + %(vor2)s*%(vor2)s + %(vor3)s*%(vor3)s)

Are you running a 2D or a 3D simulations?

Yeah, 2d, Now it’s ok.

I want to calculate numerical error of rho by using L2 norm in the entire computational domain. I write integrate plugin such like this, but the result is all the same. What did I do wrong here?

Best regards

[soln-plugin-integrate]
nsteps = 20
file = 16.csv
header = true
quad-deg = 9
rho_numerical=sin(pi*(x+y))
rho_exact=sin(pi*(x+y-1.4))

int-L2rho = (%(rho_num)s-%(rho_exact)s)*(%(rho_num)s-%(rho_exact)s)

I think you have forgotten that the vortex is convecting and so their should be a time dependency in rho_exact, I think you’ll also need a mod for the periodic boundary.

  1. The rho_exact is at t=1.4, so rho_exact without a time dependency.

  2. I don’t understand this sentance. you mean sqrt(rho_exact)?

Looking at your snippet again, I’m a bit confused by what you are trying to do.

That you are asking pyfr to caclucate is

\int_\Omega \Big(\sin(\pi(x+y))-\sin(\pi(x+y-1.4))\Big)^2\mathrm{d}\mathbf{x}

Given x and y aren’t changing in time, this is always a constant.

If you are trying to calculate the error for the density of the Euler vortex, then you need to use something like:

[soln-plugin-integrate]
nsteps = 50
file = integral.csv
header = true
quad-deg = 15

yt = (mod((y + 10 - t, 20) - 10))
ft = ((1 - x*x - (%(yt)s)*(%(yt)s))/(2*R*R))
rhot = (pow(1 - S*S*M*M*(gamma - 1)*exp(2*%(ft)s)/(8*pi*pi), 1/(gamma - 1)))

int-rho_error_1 = abs(rho - %(rhot)s)
int-rho_error_2 = sqrt((rho - %(rhot)s)*(rho - %(rhot)s))
int-rho_error_inf = max(abs(rho - %(rhot)s))
  1. This is the exact solution of Euler’s equation.
    Initial condition:
    TN3V)TD_USC(39PU

Then the exact solution: rho=1+0.5sin(pi(x+y-2t)).
I calculate rho error at t=0.7.

For simple, I use

In this case, rho_exact don’t need time dependency. Am I right? what did I do wrong here?

  1. I use the ‘integrate’ above you given, and it comes error below.
    TypeError: sequence item 1: expected str instance, float found

Best regards

Ah ok because this was in a topic about the Euler vortex I assumed you were using that.

So you are still asking pyfr to calculate

\int_\Omega(\sin(\pi(x+y))−\sin(\pi(x+y−1.4)))^2dx

where as I think you want to be calculating

\int_\Omega \Big(\rho−(1 + 0.5\sin(\pi(x+y−1.4))) \Big)^2dx

This will calculate the error between the current rho in the solution and the solution at t=0.989949494.

  1. I use the “integrate” like:
[soln-plugin-integrate]
nsteps = 20
file = 8.csv
header = true
quad-deg = 19

rho_exact=1+0.5*sin(pi*(x+y-1.4))

int-rho = sqrt((rho-%(rho_exact)s)*(rho-%(rho_exact)s))

and the result

The L2 errors are the same in different grids at t=0.7.

  1. I use the ‘integrate’ above you given to compute Euler vortex, and it comes error below.
    TypeError: sequence item 1: expected str instance, float found

Could you give some advice?

Best regards

Yep there seems to be some error in integrate plugin and the way it handles string substitutions.

Try using this instead

[soln-plugin-integrate]
nsteps = 20
file = 8.csv
header = true
quad-deg = 19

int-rhot = sqrt((rho-(1+0.5*sin(pi*(x+y-t))))*(rho-(1+0.5*sin(pi*(x+y-t)))))
int-rho = sqrt((rho-(1+0.5*sin(pi*(x+y-1.4))))*(rho-(1+0.5*sin(pi*(x+y-1.4)))))

I also added an integral that is time dependent, which I think is what you are looking for.

OK, thanks.

And can pyfr output Mach contour? Because there is only pressure,velocity and desity in **.pyfrs file.

Computing things such as Mach contours is a post-processing task. Here you’ll want to export your .pyfrs files to .vtu and then in ParaView use the calculator filter to compute the Mach number from the velocity magnitude and then apply the contour filter.

Regards, Freddie.

Thanks very much.

And do you konw how to get the pressure confficient over the cylinder?

Best regards

This should be done in post using ParaView.

Regards, Freddie.