CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Interpolation in OpenFoam (https://www.cfd-online.com/Forums/openfoam-programming-development/60771-interpolation-openfoam.html)

srinath July 27, 2008 01:51

Interpolation in OpenFoam
 
Hello

I was reading Hrv's thesis and have a couple of doubts on the interpolation routine in OpenFoam

For the NVD schemes, there is an expression on page 109, which gives
\phi c \tilda = 1 - (gradphi)f.d/(2*grad phi)c.d

And a nice algorithm to give the value of phi on the face, using blended/gamma differencing.

But how do we calculate (grad phi)c?
Suppose i had rho at cell centers and wanted to obtain a limited value of rho on the surface, what would i do?
Should i use a least squared approach to find (grad phi)c?

Also i can't seem to find a formulation of TVD using slope limiters on unstructured grids.

Could someone please help me on this?

Thanks
Srinath

hjasak July 30, 2008 05:27

Yes. Both TVD and NVD are cal
 
Yes. Both TVD and NVD are calculated the way I described in the original Gamma paper:

@Article{Jasak:GAMMAPAPER,
author = {Jasak, H. and Weller, H.G. and Gosman, A.D.},
title = {High resolution NVD differencing scheme for
arbitrarily unstructured meshes},
journal = {Int. J. Numer. Meth. Fluids},
year = 1999,
volume = 31,
pages = {431-449}
}


Here's the code (below). As you can see, it uses the cell gradient and a face gradient (actually a difference across the face). For the cell gradient, you can use whatever you like: Gauss gradient will do. The code implements phict for the NVD and r for TVD.

Enjoy,

Hrv


scalar phict
(
const scalar faceFlux,
const vector& phiP,
const vector& phiN,
const tensor& gradcP,
const tensor& gradcN,
const vector& d
) const
{
vector gradfV = phiN - phiP;
scalar gradf = gradfV & gradfV;

scalar gradcf;

if (faceFlux > 0)
{
gradcf = gradfV & (d & gradcP);

else
{
gradcf = gradfV & (d & gradcN);
}

// Stabilise for division
gradcf = stabilise(gradcf, VSMALL);

return 1 - 0.5*gradf/gradcf;
}


scalar r
(
const scalar faceFlux,
const vector& phiP,
const vector& phiN,
const tensor& gradcP,
const tensor& gradcN,
const vector& d
) const
{
vector gradfV = phiN - phiP;
scalar gradf = gradfV & gradfV;

scalar gradcf;

if (faceFlux > 0)
{
gradcf = gradfV & (d & gradcP);
}
else
{
gradcf = gradfV & (d & gradcN);
}

// Stabilise for division
gradf = stabilise(gradf, VSMALL);

return 2*(gradcf/gradf) - 1;
}
}

srinath July 30, 2008 08:08

Thanks for the reference Profe
 
Thanks for the reference Professor Jasak, this scheme seems so much better computationally than something like ENO.

For the cell gradient, when you say Gauss gradient, do you mean
integral(grad (phi)dV) = \sigma dS * phi_face
Where dS is the outward pointing Area vector?

But in that case how do we get phi_face?
Is it ok to use the cell centre averages of the 2 cells sharing that face?

Regards
Srinath

hjasak July 30, 2008 10:44

Yes, correct: you interpolate
 
Yes, correct: you interpolate from the cell centre values. Remember how the scheme says Gauss linear - it is the linear that tells you how to interpolate (=linear interpolation}. You could of course do Gauss harmonic as well, you can guess what that does.

Enjoy,

Hrv

srinath July 31, 2008 02:42

Thanks Professor Jasak That
 
Thanks Professor Jasak

That clears up this issue totally

Regards
Srinath

ville September 4, 2008 07:01

Hi, I'm testing discretiza
 
Hi,

I'm testing discretization schemes for LES and have come up with the following picture on a
scalar pulse that is originally:

c = 1, when 0.2m < x < 0.7m
c = 0, elsewhere

and the pulse is advected to the right with velocity 1m/s. The Courant number is 0.1 and time integration is backward. The Gamma scheme is
the Gamma01 scheme.
http://www.cfd-online.com/OpenFOAM_D...ges/1/9040.jpg

A couple of questions about Gamma schemes in
OpenFOAM in general:

1) I've noted that the smaller I make the value
0<= psi <= 1, the larger overshoots I make.
What is the connection between psi and the parameter beta given in the above-mentioned
paper (Jasak et al.)? I seached the code
(as given above and related files) but
could not find a connection... The paper tells
us that typically beta = 0.1 is the lower limit.

2) What is the difference between the GammaV
scheme and the Gamma scheme? I can use both
for velocity.. So, where does the "V" come into
play?

Regards,
Ville

http://www.cfd-online.com/OpenFOAM_D...ges/1/9041.jpg

Tushar@cfd May 26, 2014 02:26

Quote:

Originally Posted by ville (Post 195321)
Hi,

A couple of questions about Gamma schemes in
OpenFOAM in general:

1) I've noted that the smaller I make the value
0<= psi <= 1, the larger overshoots I make.
What is the connection between psi and the parameter beta given in the above-mentioned
paper (Jasak et al.)? I seached the code
(as given above and related files) but
could not find a connection... The paper tells
us that typically beta = 0.1 is the lower limit.

2) What is the difference between the GammaV
scheme and the Gamma scheme? I can use both
for velocity.. So, where does the "V" come into
play?

Regards,
Ville

Do you got the answer?


All times are GMT -4. The time now is 23:17.