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

RhoCentralFoam detail

Register Blogs Community New Posts Updated Threads Search

Like Tree25Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 5, 2008, 20:59
Default Hello, I have a doubt about
  #1
Senior Member
 
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,912
Rep Power: 36
alberto will become famous soon enoughalberto will become famous soon enough
Hello,

I have a doubt about rhoCentralFoam. What do instructions like the following do?

surfaceScalarField rho_pos = fvc::interpolate(rho, pos, "reconstruct(rho)");
surfaceScalarField rho_neg = fvc::interpolate(rho, neg, "reconstruct(rho)");

In particular, I don't understand the role of "pos" and "neg".

Thanks in advance for any help.

With kind regards,
Alberto
__________________
Alberto Passalacqua

GeekoCFD - A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as in both physical and virtual formats (current status: http://albertopassalacqua.com/?p=1541)
OpenQBMM - An open-source implementation of quadrature-based moment methods.

To obtain more accurate answers, please specify the version of OpenFOAM you are using.
alberto is offline   Reply With Quote

Old   September 8, 2008, 11:05
Default Alberto, When interpolating
  #2
Member
 
E. David Huckaby
Join Date: Mar 2009
Posts: 57
Rep Power: 17
david_h is on a distinguished road
Alberto,

When interpolating (reconstructing) a variable (e.g. "rho") from cells to faces there is a value associated with each side of the face. The "interpolate" function only returns an average of these two values. When using an "upwind"-type interpolation scheme the flux, "pos" or "neg", will weight (or select) the face value to "upwind" side of the face.

For rhoCentralFoam, I think the idea is to select a suitable interpolation scheme such that
"pos" > 0 to extract to the left value and
"neg" < 0 to extract to the right value.

hope this helps
Dave
david_h is offline   Reply With Quote

Old   September 8, 2008, 12:59
Default Thanks David for your answer.
  #3
Senior Member
 
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,912
Rep Power: 36
alberto will become famous soon enoughalberto will become famous soon enough
Thanks David for your answer. Let me try to see if I understand it right :-)

Let's consider this picture of a simple squared grid:



If I consider the face between i-1 and i, if I take the "pos", I should get the value in i, while if I take the "neg" I obtain the value in i-1.

In the same way, if I consider the face betweem i and i+1, if I take the "pos", I obtain the value in i, and if I take the "neg", the value in i+1.

Does this sound right to you?

Thanks again,
Alberto
__________________
Alberto Passalacqua

GeekoCFD - A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as in both physical and virtual formats (current status: http://albertopassalacqua.com/?p=1541)
OpenQBMM - An open-source implementation of quadrature-based moment methods.

To obtain more accurate answers, please specify the version of OpenFOAM you are using.
alberto is offline   Reply With Quote

Old   September 8, 2008, 14:01
Default Alberto, I agree with the a
  #4
Member
 
E. David Huckaby
Join Date: Mar 2009
Posts: 57
Rep Power: 17
david_h is on a distinguished road
Alberto,

I agree with the above statements, if the "face area vectors" point outward from cell i,j.

If all the "face area vectors" are pointed either toward the right or to the top, then:

on face the between i-1 and i (i-1/2),
"pos" would return rho[i-1]
"neg" would return rho[i]
on face the between i and i+1 (i+1/2),
"pos" would return rho[i]
"neg" would return rho[i+1]

The above is for zero-order reconstruction. For "cell-based" higher order reconstruction (e.g. limited-linear), the face values would take the form:
rho_pos[i+1/2] = rho[i] + drho[i]*(x[i+1/2] - x[i])
rho_neg[i+1/2] = rho[i] + drho[i]*(x[i+1/2] - x[i+1])

where drho[i] is limited gradient of rho at cell "i"

Dave
david_h is offline   Reply With Quote

Old   January 25, 2024, 04:05
Default
  #5
New Member
 
Carmelo Baronetto
Join Date: Dec 2023
Posts: 23
Rep Power: 2
Carmelo98 is on a distinguished road
Quote:
Originally Posted by david_h View Post
Alberto,

I agree with the above statements, if the "face area vectors" point outward from cell i,j.

If all the "face area vectors" are pointed either toward the right or to the top, then:

on face the between i-1 and i (i-1/2),
"pos" would return rho[i-1]
"neg" would return rho[i]
on face the between i and i+1 (i+1/2),
"pos" would return rho[i]
"neg" would return rho[i+1]

The above is for zero-order reconstruction. For "cell-based" higher order reconstruction (e.g. limited-linear), the face values would take the form:
rho_pos[i+1/2] = rho[i] + drho[i]*(x[i+1/2] - x[i])
rho_neg[i+1/2] = rho[i] + drho[i]*(x[i+1/2] - x[i+1])

where drho[i] is limited gradient of rho at cell "i"

Dave

Good morning,
sorry to reopen this old thread, but I'm studying rhoCentraFoam and I would like to understand better how this solver works.


I can't understand when David writes:
Quote:

rho_neg[i+1/2] = rho[i] + drho[i]*(x[i+1/2] - x[i+1])
I think "negative interpolation" interpolates from x[i+1], so that:
rho_neg[i+1/2] = rho[i+1] + drho[i+1]*(x[i+1/2] - x[i+1])
Is it corret, or am I missing something?


In general, refers to the article:
"Implementation of semi-discrete, non-staggered central schemes in a colocated, polyhedral, finite volume framework, for high-speed viscous flows" by C.J. Greenshields et Al.
it is explained how to compute positive interpolation of a general quantity:
\Psi_{f+}=(1-g_{f+})*\Psi_{P}+g_{f+}*\Psi_{N}

where:
g_{f+}=\beta*(1-w_f)
However I can't understand how to compute \Psi_{f-}.
I hope someone can help me.
Thank you
Carmelo98 is offline   Reply With Quote

Old   September 8, 2008, 14:09
Default David, yes, that's what I m
  #6
Senior Member
 
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,912
Rep Power: 36
alberto will become famous soon enoughalberto will become famous soon enough
David,

yes, that's what I meant. I didn't specify the face are vector direction.

Thanks again for your help :-)

Alberto
__________________
Alberto Passalacqua

GeekoCFD - A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as in both physical and virtual formats (current status: http://albertopassalacqua.com/?p=1541)
OpenQBMM - An open-source implementation of quadrature-based moment methods.

To obtain more accurate answers, please specify the version of OpenFOAM you are using.
alberto is offline   Reply With Quote

Old   September 9, 2008, 04:34
Default Alberto, the trick of pos a
  #7
Member
 
Luca Gasparini
Join Date: Mar 2009
Location: Italy
Posts: 37
Rep Power: 17
luca_g is on a distinguished road
Alberto,

the trick of pos and neg is the trick I thought about when I developed the centralFoam code, from which rhoCentralFoam has been later derived by the people at OpenCFD.

In OF, surface fields have just one single value which is related to the face, but when you apply Godunov-like scheme you actually want to compute the flux through a face solving (maybe approxiamtely) the Riemann problem defined by the TWO different states of the fluid on the opposite sides of each face.

Thus, for each unknown (say p, U and T), you need to evaluate two surface fields with the values of the variable on the two sides of the face.

The fvc::interpolate function normally use the sign of the velocity flux to "decide" how to upwind the cell values in order to interpolate a face value. So the idea was to "fool" the interpolation routine calling it twice: once with a "positive" flux (e.g. +1) and one with a "negative" flux (e.g. -1). Depending on the selected interpolation scheme, as explained by David, you will get two (most likely) different estimates of the face values from which the Godunov-like scheme (in this case a central-upwind scheme) can be applied.

The nice (and somewhat unusual) thing in OF is that given an internal face it always has an "owner" and a "neighbour": in OF notation the flux is positive if the flow is going through the face from the owner cell to the neighbour cell, and negative otherwise (i.e. the face normal is positive from owner to neighbour).
Thus, because of the unstructured grid used in OF you cannot easily think interms of i-1,j and i,j but you better think in terms of owner/neighbour relation.

So you actually solve a Riemann problem at each face between an "owner-side" and a "neighbour-side" with the convention that the flux will be positive in the "owner-to-neighbour" direction. It doesn't matter if (in a more conventional way of thinking) face normals are outward or inward with respect to any given cell. At the end, everything will be consistent.

Kind regards,

Luca
luca_g is offline   Reply With Quote

Old   August 6, 2015, 10:58
Default
  #8
Senior Member
 
Freedom
Join Date: May 2014
Posts: 209
Rep Power: 12
wenxu is on a distinguished road
Dear Luca and Alberto,

a = Grad(x-) = (PHI (i, j) - PHI(i-1, j))/ deltaX

I have several questions about the upwind scheme:
  1. In the same direction, the surface flux often (or definitely) has the different signs. For example, the phi between i-1 and i is "pos", then the sign between the i and i+1 is usually "neg"? because the U will not change within single cell.
  2. If the phi between cell i and i-1 is "pos", then we should take the value in cell i, if it is "neg", then we should take the value in cell i-1. Then, how to calculate value of a in the first attached equation (to calculate the gradient ) using upwind scheme? I really mislead by the upwind scheme....

Please help me.....

Thank you very much!!!

Best regards,
Wen
wenxu is offline   Reply With Quote

Old   August 3, 2016, 09:10
Default
  #9
New Member
 
Aaron
Join Date: Apr 2016
Posts: 24
Rep Power: 10
Aaron_L is on a distinguished road
Hi, foamers,
when I search the "neg", the officical document show this:
Quote:
neg
Foam::dimensionSet::neg()
Foam::neg(const dimensionedScalar &ds)
Foam::neg(const dimensionSet &)
Foam::neg(const label s)
Foam::neg(const Scalar s)
negate
negIndexFoam::BiIndirectList
negListFoam::BiIndirectList
negPart
negSumDiag
where is the function using field?
Aaron_L is offline   Reply With Quote

Old   September 9, 2008, 05:18
Default Hi Luca, take a look to the
  #10
Member
 
Luca M.
Join Date: Mar 2009
Location: Luzern, Switzerland
Posts: 59
Rep Power: 17
luca is on a distinguished road
Hi Luca,

take a look to the original paper of Kurganov about Riemann solver free approach implemented in the rhoCentralFoam solver: may be it can help you to better understand the algorithm

http://www.cscamm.umd.edu/centpack/publications/files/KT_semi-discrete.JCP00-cen tpack.pdf

Regards

Luca
luca is offline   Reply With Quote

Old   April 23, 2012, 04:05
Default
  #11
New Member
 
M K Singh
Join Date: Sep 2009
Posts: 19
Rep Power: 16
mksingh is on a distinguished road
Quote:
Originally Posted by luca View Post
Hi Luca,

take a look to the original paper of Kurganov about Riemann solver free approach implemented in the rhoCentralFoam solver: may be it can help you to better understand the algorithm

http://www.cscamm.umd.edu/centpack/publications/files/KT_semi-discrete.JCP00-cen tpack.pdf

Regards

Luca
The link given in this thread does not work
http://www.cfd-online.com/cgi-bin/Op...1867#POST11867
Is there a new link?
With best regards.
M K
mksingh is offline   Reply With Quote

Old   April 23, 2012, 15:26
Default
  #12
Senior Member
 
Mahdi Hosseinali
Join Date: Apr 2009
Location: NB, Canada
Posts: 273
Rep Power: 18
anishtain4 is on a distinguished road
I did download it a few days ago, that is fine
anishtain4 is offline   Reply With Quote

Old   April 23, 2012, 17:36
Default
  #13
New Member
 
M K Singh
Join Date: Sep 2009
Posts: 19
Rep Power: 16
mksingh is on a distinguished road
I mean this thread:
http://www.cfd-online.com/cgi-bin/Op...1867#POST11867
I am able to download the pdf but not able to see the above thread (see #8)
mksingh is offline   Reply With Quote

Old   April 27, 2012, 13:28
Default
  #14
Senior Member
 
Mahdi Hosseinali
Join Date: Apr 2009
Location: NB, Canada
Posts: 273
Rep Power: 18
anishtain4 is on a distinguished road
You are right, that is not displaying any more
anishtain4 is offline   Reply With Quote

Old   January 26, 2013, 04:28
Default Zeroth order interpolation
  #15
New Member
 
Lorenzo A. Ricciardi
Join Date: Mar 2011
Posts: 27
Rep Power: 15
lichmaster is on a distinguished road
Hi all,

Is there a way to force a "flat" (i.e. zeroth order) cell to face interpolation using the above mentioned interpolate method?

Thanks
lichmaster is offline   Reply With Quote

Old   January 31, 2013, 02:30
Default
  #16
Senior Member
 
Mahdi Hosseinali
Join Date: Apr 2009
Location: NB, Canada
Posts: 273
Rep Power: 18
anishtain4 is on a distinguished road
What do you mean by flat cell? that would be against FVM definition of spatial discretization.
anishtain4 is offline   Reply With Quote

Old   January 31, 2013, 07:56
Default
  #17
New Member
 
Lorenzo A. Ricciardi
Join Date: Mar 2011
Posts: 27
Rep Power: 15
lichmaster is on a distinguished road
"Flat" was relative to the interpolation, not to the cell. Call it constant interpolation (or zeroth order), if you prefer.

I don't agree with you about flat interpolation being against FVM.
When you pass from a generic nonlinear hyperbolic equation like

d/dt (u) + div(F(u)) = 0 // d is partial time derivative

to a semi discrete form, you have to integrate on the cell volume. The div term becomes a surface integral, but (if the cell geometry is constant) the partial time derivative becomes the time derivative of a volume integral. The equation is divided by the volume of the cell, and you have an ODE for each cell averaged value. Thus each value is "flat" inside the cell.

I'm implementing a particular solver in openFoam, which uses Riemann solvers, and although I will definitely use some kind of limited interpolation of values to the surface to get high resolution, for testing and completeness considerations I'm trying to use the unified "interpolate" function to assign a value from a volumeField to a surfaceField.

I solved the problem with a very simple routine I've written from scratch, but it doesn't work in parallel so far:

Code:
for (label faceI = 0; faceI < mesh.nInternalFaces(); faceI++)
    {
        label cellI         = mesh.faceOwner()[faceI];
        rho_neg[faceI]        = rho[cellI];
        U_neg[faceI]        = U[cellI];
        lambda_neg[faceI]    = lambda[cellI];
    
        label cellJ         = mesh.faceNeighbour()[faceI];
        rho_pos[faceI]        = rho[cellJ];
        U_pos[faceI]        = U[cellJ];
        lambda_pos[faceI]    = lambda[cellJ];
    }
So the question remains: is there a way to interpolate a value from cell to face in a similar fashion, using the "interpolate" method?

Thanks
lichmaster is offline   Reply With Quote

Old   January 31, 2013, 11:23
Default
  #18
Senior Member
 
Mahdi Hosseinali
Join Date: Apr 2009
Location: NB, Canada
Posts: 273
Rep Power: 18
anishtain4 is on a distinguished road
I know how FVM works, what you want is piece wise constant while usually piece wise linear is being used. I believe you are going to use Gudonove type methods which still would yield a better result if you use piecewise linear rather than constant.

Anyway, there is a simple way to interpolate from vol<type>Field to surface<Type>Field, and that is fvc::interpolate, look it up in Doxygen.

Also you might wanna take a look at the solver rhoCentralFoam, it is using what you are after.
anishtain4 is offline   Reply With Quote

Old   January 31, 2013, 14:11
Default
  #19
New Member
 
Lorenzo A. Ricciardi
Join Date: Mar 2011
Posts: 27
Rep Power: 15
lichmaster is on a distinguished road
I know Godunov method, and that's why I'm implementing another solver, different even from RhoCentralFoam
I'll try to look deeper inside Doxygen, thanks anyway
lichmaster is offline   Reply With Quote

Old   June 30, 2013, 07:48
Default
  #20
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Greetings to all!

In reference to the following quotes, I believe that the missing link is this thread: http://www.cfd-online.com/Forums/ope...ow-solver.html
The OpenFOAM Forum changed software a few times, so it's normal that some links are still broken

Quote:
Originally Posted by luca_g View Post
In the previous explanation I used the "Riemann problem" concept because it's the most familiar approach.

If you are interest:
http://www.cfd-online.com/cgi-bin/Op...1867#POST11867
Quote:
Originally Posted by mksingh View Post
The link given in this thread does not work
http://www.cfd-online.com/cgi-bin/Op...1867#POST11867
Is there a new link?
Quote:
Originally Posted by mksingh View Post
I mean this thread:
http://www.cfd-online.com/cgi-bin/Op...1867#POST11867
I am able to download the pdf but not able to see the above thread (see #8)
Quote:
Originally Posted by anishtain4 View Post
You are right, that is not displaying any more
Best regards,
Bruno
wyldckat 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
Thermophysicalproperties in rhoCentralFoam srinath OpenFOAM Running, Solving & CFD 12 October 2, 2012 10:04
RhoCentralFoam Steady State kieranwood85 OpenFOAM Running, Solving & CFD 0 January 9, 2009 18:50
RhocentralFoam ehsan OpenFOAM Running, Solving & CFD 0 November 19, 2008 05:35
how to get the detail information about k-e models limingtiger Siemens 1 July 15, 2005 04:22
HVN tell me the detail of relative pressure chong chee nan FLUENT 1 January 2, 2002 04:55


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