Implementing equations with passive scalars

Hello all,

I am interested in solving the incompressible Navier-Stokes equations.
PyFR accomplishes this by means of the artificial compressibility
approach. The question at hand concerns whether it is possible to solve
for temperature and or other passive scalars while solving these
equations.

Cheers,
Frank

Hi Frank,

Currently there is no functionality to add a passive scalar just with the .ini file.

I have not tried this, but it should not be too difficult to "hack" the functionality in.

In solvers/aceuler/elements.py class BaseACFluidElements(object) you can add an additional variable, such as T. You need to add it to the end of all varmap and dualcoeff dictionaries, for example

privarmap = {2: ['p', 'u', 'v', 'T'],
                  3: ['p', 'u', 'v', 'w', 'T']}

This variable will be addressed with the index ${nvars-1} (last index) in the mako templates which set the fluxes.

In solvers/aceuler/kernels/flux.mako you can write the convective flux for your passive scalar

% for i in range(ndims):
     f[${i}][${nvars-1}] = s[${nvars-1}]*v[${i}];
% endfor

In solvers/acnavstokes/kernels/flux.mako you can write the diffusive flux

% for i in pyfr.ndrange(ndims):
     fout[${i}][${nvars-1}] += -${c['diff']}*grad_uin[${i}][${nvars-1}]; #you can enter value for diff in the inifile under constants section
% endfor

Then you need to add the scalar to the existing boundary conditions. For example, a given value at the inlet

aceuler/kernels/bcs/ac-in-fv.mako:

     ur[${nvars-1}] = ${c['T']};

For extrapolation at outlet/walls you can add this line to the respective mako files.

     ur[${nvars-1}] = ul[${nvars-1}];

Off the top of my head, these lines should do it. I am happy to help if you want to try it.

Cheers,
Niki

Hello Niki,

Thank you very much for the explanation and suggestion. I am indeed very interested in trying out the addition of a passive scalar for incompressible flows. In fact as soon I as resolve some issues with my use of PyFR for the current incompressible cases I am running I would like add the passive scalar as you suggested.

Cheers,
Frank

Frank - Have you tried this? Were you successful?

Is anyone from the team implementing or planning on implementing passive scalars in the near future? If not, I would like to try starting with the method Niki has suggested. Any additional guidance at the outset would be appreciated.

Nolan

Hello Nolan,

I have been trying to get some other stuff working with PyFR and have
not tried this.

Cheers,
Frank