Add a new Riemann solver with different flux methods

Hello everyone, I want to add a new Riemann solver, with flux solutions are different with PyFr on the left and right sides of the interface. such as the below picture, in my understanding, ‘fl’, ‘fr’ come from inviscid_flux function, and I did’t find the inviscid_flux function. but in my Riemann solver, the definition of ‘fl’, ‘fr’ is different.

How should I change the definition of ‘fl’, ‘fr’? Could anyone help me?

Thanks a lot.

Just to understand what you mean a little better, you want to implement a Riemann solver for a different flux function?

The inviscid flux is defined in flux.mako, for example this can be found for Euler’s equations here PyFR/flux.mako at c10e0e64e8ca6badfb39b208cb5a9f42bc88c73d · PyFR/PyFR · GitHub

The outputs from this function can be changed from equation set to equation set, but in Euler the input is u and the outputs are f, v, and p. Where u is a vector of conserved variables, f is a [ndims]x[nvars] array, v is the velocity vector, and p is the pressure.

Using the standard 1D transformation, you can actually change what you need to calculate. This might be easier for more complex equation sets and an example can be seen in my implementation here: GitHub - WillTrojak/PyFR at feature/riemann_solvers

I hope this answers some of your questions

If the fluxes are different on the left and right hand side then it is very easy to lose conservation. Further, PyFR makes no guarantees about what interface is classed as left and which is classed as right. Do you have any more detail about what you’re looking to accomplish?

Regards, Freddie.

Thank you for your answer.

I have described my problem in detail below.

With best regards

Checkout the branch I linked, I think from what you have said you need to use the methodology implemented there for some of the Riemann solvers. I.e you use the surface normal to transform the problem into a 1D problem, get the 1D common flux, and then transform it back.

tflux and tfluxlin calculate the transformed flux and transformed flux for linear elements respectively. There aren’t involved in the Riemann solver.

From what you say I think you need these transformations: PyFR/pyfr/backends/base/makocommon at feature/riemann_solvers · WillTrojak/PyFR · GitHub

Which I used here: PyFR/rsolve_trans.mako at feature/riemann_solvers · WillTrojak/PyFR · GitHub

Thanks a lot.

Follow your idea, I write Riemann solver in x direction as a 1D problem. but it does’t work, I think I should add this Riemann solver somewhere, PyFr can’t recognize this Riemann solver. Could you tell me how to solve it?

And how can I get the grid step dx, dy, dz when I write Riemann solver?

I appreciate your help very much.

When you say PyFR can’t recognize the Riemann solver, what do you mean? The functionality I sent you links to is not mainlined, so firstly you would need to bring that all in and verify it works. Secondly, say you implemented a Riemann solver new_solver.mako, in the ini file you would have to set riemann-solver = new_solver. You also have to make sure the Riemann solver is in correct directory for the physical solver you are trying to use, set by system in the ini file, remembering that advection-diffusion systems inherit from advection systems,

If that doesn’t solve your problems, then can you post the traceback?

In answer to your question on dx, dy, dz, I think there is no way to get this information, is that right @fdw?

1 Like

Thanks for your answer.

I have set the riemann-solver = new_solver, such as the picture below.
L3CI0B(W@P)~HG(LIA4~)C

But it doesn’t work. And I rename Roe, the set the riemann-solver = renamed Roe, the result is same.

What is the name of the file where you have implemented your new Riemann solver?

I put the new solver in resolvers file.

Ok, I think that is the correct place. What is the name of the mako file where you implemented the new Riemann solver?

the name of the mako file is new_solver.mako.

Ok, in the ini file you have to use riemann-solver = new_solver.mako.
Have you made sure that you rebuilt pyfr if necessary? (python setup.py install)

Does your mako file for the Riemann solver start with the following?

# -*- coding: utf-8 -*-
<%namespace module='pyfr.backends.base.makoutil' name='pyfr'/>
<%include file='pyfr.solvers.euler.kernels.flux'/>

<%pyfr:macro name='rsolve' params='ul, ur, n, nf'>

Or does it start with something else?

I use other Riemann solver, it works.

I rebuild pyfr, but it appear error.

The start

-- coding: utf-8 --

<%namespace module=‘pyfr.backends.base.makoutil’ name=‘pyfr’/>
<%include file=‘pyfr.solvers.euler.kernels.primitives’/>

<%pyfr:macro name=‘rsolve_t1d’ params=‘ul, ur, n, nf’>

So you are trying to use my transformed implementation. This indicates to me that you have forgotten to add one of the files along the way or forgotten to include <%include file='pyfr.solvers.euler.kernels.rsolvers.rsolve_trans'/> at the bottom.

I try and it doesn’t work.

I use riemann-solver = Hll, it woks. But I rename Hll to Hlla, then in the ini file I use riemann-solver = Hlla,` it fails.

Yeah it sounds like you aren’t rebuilding pyfr when you need to. I think you can also use pip to do this. ie. pip install ./path/to/pyfr/source/code

The van Leer solver implementation in that branch uses the 1D transformation, as does the Roe in that branch. I think it is most likely that you haven’t fully implemented the functionality of that branch.

Thanks a lot.

Those problems have been solved.

But I add my new Riemann solver, it still does’t work. Could you know this problem?

And how can I debug this? I use pycharm to open the ENV3 file, I can’t debug step by step. Could you know how to do it?