CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

Interpolation in OpenFoam

Register Blogs Community New Posts Updated Threads Search

Like Tree4Likes
  • 3 Post By hjasak
  • 1 Post By s.v

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 27, 2008, 02:51
Default Interpolation in OpenFoam
  #1
Member
 
srinath
Join Date: Mar 2009
Location: Champaign, USA
Posts: 91
Rep Power: 17
srinath is on a distinguished road
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
srinath is offline   Reply With Quote

Old   July 30, 2008, 06:27
Default Yes. Both TVD and NVD are cal
  #2
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,907
Rep Power: 33
hjasak will become famous soon enough
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;
}
}
__________________
Hrvoje Jasak
Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk
hjasak is offline   Reply With Quote

Old   July 30, 2008, 09:08
Default Thanks for the reference Profe
  #3
Member
 
srinath
Join Date: Mar 2009
Location: Champaign, USA
Posts: 91
Rep Power: 17
srinath is on a distinguished road
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
srinath is offline   Reply With Quote

Old   July 30, 2008, 11:44
Default Yes, correct: you interpolate
  #4
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,907
Rep Power: 33
hjasak will become famous soon enough
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
__________________
Hrvoje Jasak
Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk
hjasak is offline   Reply With Quote

Old   July 31, 2008, 03:42
Default Thanks Professor Jasak That
  #5
Member
 
srinath
Join Date: Mar 2009
Location: Champaign, USA
Posts: 91
Rep Power: 17
srinath is on a distinguished road
Thanks Professor Jasak

That clears up this issue totally

Regards
Srinath
srinath is offline   Reply With Quote

Old   September 4, 2008, 08:01
Default Hi, I'm testing discretiza
  #6
Member
 
ville vuorinen
Join Date: Mar 2009
Posts: 67
Rep Power: 17
ville is on a distinguished road
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.


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


ville is offline   Reply With Quote

Old   May 26, 2014, 03:26
Default
  #7
Senior Member
 
T. Chourushi
Join Date: Jul 2009
Posts: 321
Blog Entries: 1
Rep Power: 18
Tushar@cfd is on a distinguished road
Quote:
Originally Posted by ville View Post
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?
Tushar@cfd is offline   Reply With Quote

Old   June 6, 2021, 16:52
Default
  #8
s.v
New Member
 
s.v
Join Date: Jun 2021
Posts: 13
Rep Power: 5
s.v is on a distinguished road
Hi Everyone:

I know this is an old thread but this might be useful for others.

Regarding Ville's first question -- psi = 2*Beta (as far as I understand).

So to avoid the "switching" instability discussed by Jasak et al. in their original Gamma scheme paper (https://citeseerx.ist.psu.edu/viewdo...=rep1&type=pdf) we would need to have psi>=0.2.

This is discussed in my PhD thesis (https://drum.lib.umd.edu/handle/1903/21883) on page 32. In my thesis psi is called "k".

Cheers ....
wo315 likes this.
s.v is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
OpenFoam vs CFX5 mass balance in OpenFoam tangd OpenFOAM Running, Solving & CFD 33 May 23, 2010 17:36
[blockMesh] CheckMesh error using a tutorial from OpenFOAM 114 with openFOAM 13 martapajon OpenFOAM Meshing & Mesh Conversion 7 January 21, 2008 13:52
OpenFOAM users in Munich OpenFOAM benutzer in M%c3%bcnchen jaswi OpenFOAM 0 August 3, 2007 14:11
A new Howto on the OpenFOAM Wiki Compiling OpenFOAM under Unix mbeaudoin OpenFOAM Installation 2 April 28, 2006 09:54
2D-Interpolation Don Tron Main CFD Forum 3 October 30, 2003 04:40


All times are GMT -4. The time now is 22:14.