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

TVD schemes, questions about limitedLinear

Register Blogs Community New Posts Updated Threads Search

Like Tree35Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 6, 2015, 07:11
Default
  #21
Member
 
Davi Barreira
Join Date: Apr 2014
Location: Fortaleza
Posts: 76
Rep Power: 12
davibarreira is on a distinguished road
There is Dr Jasak's thesis, which is a must for people using OpenFOAM (just google it and you will find right away). And also Versteeg and Malalasekera book on CFD.
davibarreira is offline   Reply With Quote

Old   October 25, 2018, 06:05
Default limited Linear NOT Sweby
  #22
New Member
 
Jan Gaertner
Join Date: Nov 2017
Posts: 20
Rep Power: 9
janGaertner is on a distinguished road
Hey,


I have seen in many posts, that limitedLinear uses the Sweby limiter function. This is not correct.



If you look at the code of the limitedLinear.H file you see:
Code:
     

scalar limiter
      (
         const scalar cdWeight,
         const scalar faceFlux,
         const typename LimiterFunc::phiType& phiP,
         const typename LimiterFunc::phiType& phiN,
         const typename LimiterFunc::gradPhiType& gradcP,
         const typename LimiterFunc::gradPhiType& gradcN,
         const vector& d
     ) const
     {
         scalar r = LimiterFunc::r
         (

             faceFlux, phiP, phiN, gradcP, gradcN, d
         );
         return max(min(twoByk_*r, 1), 0);
     }
I have plotted this function in the r-psi(r) plane, limitedLinear.png
janGaertner is offline   Reply With Quote

Old   June 6, 2021, 17:18
Default
  #23
s.v
New Member
 
s.v
Join Date: Jun 2021
Posts: 13
Rep Power: 5
s.v is on a distinguished road
Response to post #11 in this thread:

I am guessing the reason why "linear" and "limitedLinear 0" do not give identical results is because "limitedLinear 0" becomes upwind outside the Convection Boundedness Criterion (CBC) region on the NVD diagram -- see for example the discussion and figures around page 35 in my PhD thesis (https://drum.lib.umd.edu/handle/1903/21883).

Cheers ....
Tobi and anaspauzi like this.

Last edited by s.v; June 6, 2021 at 17:21. Reason: added which post I am responding to (post #11)
s.v is offline   Reply With Quote

Old   October 20, 2021, 11:36
Default A question of r
  #24
Member
 
bany
Join Date: Nov 2019
Posts: 50
Rep Power: 7
bany is on a distinguished road
Quote:
Originally Posted by jurich View Post
limitedLinear is used in fvSchemes as Gauss limitedLinear k

The value k you specify when activating the scheme is not the same as \psi, as used in Jasak's thesis.

What you get from limitedLinear is \psi(r) = r * \frac{2}{k}, with r as defined in Jasak's thesis, and \psi limited between 0 and 1.

See the discussion: http://www.cfd-online.com/Forums/ope...ar-scheme.html, and lines 76 and 95 of limitedLinear.H

So if you use k = 0, \psi will be fixed at 1.0, and you get the higher order scheme everywhere, in this case central differencing.

If you use k = 1, you get a limiter of \psi(r) = 2 * r applied. This limiter is the edge of Sweby's TVD region; it is TVD conforming.

That's why the documentation describes it that way.

Thanks for this explanation for \psi(r), where r=(phiC-phiU)/(phiD-phiC) defined in Dr. Jasak's thesis. Now i have two questions :

(1) If phiD-phiC=0, r equals? Just like the case:in a initial field, the value of phi (a scalar field) is uniform.

(2) As we know, r is related to the successive grad of phi. And C, D and U are at the upwind, downwind and far-upwind cells. While for the cells whose faces are at boundary, how does the definition of U and how does (phiC-phiU) calculate?


Any reply is grateful!
bany is offline   Reply With Quote

Old   October 20, 2021, 15:34
Default
  #25
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
How do you examine the far-upwind cell in an unstructured FV mesh?
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   October 20, 2021, 22:00
Default 1D uniform structured mesh
  #26
Member
 
bany
Join Date: Nov 2019
Posts: 50
Rep Power: 7
bany is on a distinguished road
Quote:
Originally Posted by Tobi View Post
How do you examine the far-upwind cell in an unstructured FV mesh?
We only consider the simple condition: a 1-D structured FV mesh.
Attached Images
File Type: png 1D mesh.png (50.7 KB, 20 views)
File Type: png a boundary question .png (11.6 KB, 14 views)
bany is offline   Reply With Quote

Old   October 20, 2021, 22:09
Default
  #27
s.v
New Member
 
s.v
Join Date: Jun 2021
Posts: 13
Rep Power: 5
s.v is on a distinguished road
Quote:
Originally Posted by Tobi View Post
How do you examine the far-upwind cell in an unstructured FV mesh?
Tobi -- Jasak et al. discuss this point in their gamma scheme paper (https://citeseerx.ist.psu.edu/viewdo...=rep1&type=pdf) -- see for example the text below equation 10 in the paper -- they work with gradients ....

This link might also be useful -- https://www.openfoam.com/documentati...e-nvd-tvd.html
s.v is offline   Reply With Quote

Old   October 20, 2021, 22:30
Default
  #28
Member
 
bany
Join Date: Nov 2019
Posts: 50
Rep Power: 7
bany is on a distinguished road
Quote:
Originally Posted by s.v View Post
Tobi -- Jasak et al. discuss this point in their gamma scheme paper (https://citeseerx.ist.psu.edu/viewdo...=rep1&type=pdf) -- see for example the text below equation 10 in the paper -- they work with gradients ....

This link might also be useful -- https://www.openfoam.com/documentati...e-nvd-tvd.html
Thanks for your reply. And when phiC=phiD, how to calculate r?

In my work: a 1D structured FV mesh, and the scalarField phi is uniform at the beginning. Thus phiC=phiD for initial time in every mesh.

When i output the matrix of convection term for the first timestep, i found the upper() and lower() of the matrix for convection term when using limitedLinear scheme is like that when using linear scheme. That means that when phiC=phiD, r=k/2. However, i failed to find the relative code in openfoam -- https://github.com/OpenFOAM/OpenFOAM...cheme/NVDTVD.H
bany is offline   Reply With Quote

Old   October 20, 2021, 22:43
Default
  #29
s.v
New Member
 
s.v
Join Date: Jun 2021
Posts: 13
Rep Power: 5
s.v is on a distinguished road
Quote:
Originally Posted by bany View Post
Thanks for this explanation for \psi(r), where r=(phiC-phiU)/(phiD-phiC) defined in Dr. Jasak's thesis. Now i have two questions :

(1) If phiD-phiC=0, r equals? Just like the case:in a initial field, the value of phi (a scalar field) is uniform.

(2) As we know, r is related to the successive grad of phi. And C, D and U are at the upwind, downwind and far-upwind cells. While for the cells whose faces are at boundary, how does the definition of U and how does (phiC-phiU) calculate?


Any reply is grateful!
Bany it has been a while since I looked at OpenFOAM ....

But I think the answer to your first question is in this file most likely -- https://www.openfoam.com/documentati...8H_source.html

It looks like if phiD-phiC=0 (I think in the file above they call phiD as phiN and phiC as phiP) the following lines in the above file will come into play:

if (mag(gradcf) >= 1000*mag(gradf))
{
return 2*1000*sign(gradcf)*sign(gradf) - 1;
}

which means r will either become 1999 or -2001 if phiD-phiC=0 or phiN-phiP=0 depending upon the signs of the gradients ....

Regarding your second question -- see my response to Tobi above -- they work with gradients -- they don't explicitly use the far-upwind cell ....

Again I have been away from OpenFOAM for a while -- but most likely what I have said above should be OK ....

Also remember that the gamma and limitedLinear schemes are very similar -- the only difference is how they switch between upwind and linear schemes -- if we use the factor "k" equal to 1 then gamma scheme switches more smoothly compared to limitedLinear scheme (see for example figure 2.9 in my thesis -- download link given above in one of my other posts) -- if we use a smaller value of the factor "k" like 0.2 then both schemes become pretty much the same (see figure 2.10 in my thesis) .... also note that the gamma scheme is generally bugged in OpenFOAM (this is also briefly discussed in my thesis) -- so I plot the dbGamma scheme in figures 2.9 and 2.10 -- dbGamma basically means debugged gamma scheme -- thats the best name I could come up with for my thesis ....
s.v is offline   Reply With Quote

Old   October 20, 2021, 22:53
Default
  #30
s.v
New Member
 
s.v
Join Date: Jun 2021
Posts: 13
Rep Power: 5
s.v is on a distinguished road
Quote:
Originally Posted by bany View Post
Thanks for your reply. And when phiC=phiD, how to calculate r?

In my work: a 1D structured FV mesh, and the scalarField phi is uniform at the beginning. Thus phiC=phiD for initial time in every mesh.

When i output the matrix of convection term for the first timestep, i found the upper() and lower() of the matrix for convection term when using limitedLinear scheme is like that when using linear scheme. That means that when phiC=phiD, r=k/2. However, i failed to find the relative code in openfoam -- https://github.com/OpenFOAM/OpenFOAM...cheme/NVDTVD.H
Bany -- for limitedLinear to behave like linear scheme r does not need to be exactly = k/2 ....

https://github.com/OpenFOAM/OpenFOAM...imitedLinear.H

At the end of the above file we see:
return max(min(twoByk_*r, 1), 0);

so if r = 1999 like I mentioned in my other post -- the above line will return 1 -- and for a value of 1 -- limitedLinear will behave like linear I think .... the above line is returning \psi(r) in the TVD framework I think .... sorry I do not know how to use math in these posts yet ....
s.v is offline   Reply With Quote

Old   October 20, 2021, 23:58
Default
  #31
Member
 
bany
Join Date: Nov 2019
Posts: 50
Rep Power: 7
bany is on a distinguished road
Quote:
Originally Posted by s.v View Post
Bany it has been a while since I looked at OpenFOAM ....

But I think the answer to your first question is in this file most likely -- https://www.openfoam.com/documentati...8H_source.html

It looks like if phiD-phiC=0 (I think in the file above they call phiD as phiN and phiC as phiP) the following lines in the above file will come into play:

if (mag(gradcf) >= 1000*mag(gradf))
{
return 2*1000*sign(gradcf)*sign(gradf) - 1;
}

which means r will either become 1999 or -2001 if phiD-phiC=0 or phiN-phiP=0 depending upon the signs of the gradients ....

Regarding your second question -- see my response to Tobi above -- they work with gradients -- they don't explicitly use the far-upwind cell ....

Again I have been away from OpenFOAM for a while -- but most likely what I have said above should be OK ....

Also remember that the gamma and limitedLinear schemes are very similar -- the only difference is how they switch between upwind and linear schemes -- if we use the factor "k" equal to 1 then gamma scheme switches more smoothly compared to limitedLinear scheme (see for example figure 2.9 in my thesis -- download link given above in one of my other posts) -- if we use a smaller value of the factor "k" like 0.2 then both schemes become pretty much the same (see figure 2.10 in my thesis) .... also note that the gamma scheme is generally bugged in OpenFOAM (this is also briefly discussed in my thesis) -- so I plot the dbGamma scheme in figures 2.9 and 2.10 -- dbGamma basically means debugged gamma scheme -- thats the best name I could come up with for my thesis ....

Oh, what you said helped me a lot and your thesis is so clearly. Thank you very much.

For the second question, the gradients are used. For the cell near the boundary just like the cell C in figure. The gradient of phi for the cell C is calculated by following: grad(phiC)=(phiC-phib)/(XC-Xb), where phib is the value of phi on the boundary.

If something is wrong, please note that.
bany is offline   Reply With Quote

Old   October 21, 2021, 00:05
Default
  #32
Member
 
bany
Join Date: Nov 2019
Posts: 50
Rep Power: 7
bany is on a distinguished road
Quote:
Originally Posted by s.v View Post
Bany -- for limitedLinear to behave like linear scheme r does not need to be exactly = k/2 ....

https://github.com/OpenFOAM/OpenFOAM...imitedLinear.H

At the end of the above file we see:
return max(min(twoByk_*r, 1), 0);

so if r = 1999 like I mentioned in my other post -- the above line will return 1 -- and for a value of 1 -- limitedLinear will behave like linear I think .... the above line is returning \psi(r) in the TVD framework I think .... sorry I do not know how to use math in these posts yet ....
Yeah, you are right. If r >= k/2, limitedLinear will equal to linear. Thanks again.

For the math scheme, you can quote any posts included math scheme and you will see the original math code. Just like: "[ math]......[ /math]" (of course, there is no space in [].). And \psi is "[math ]\psi[/math ]" in math scheme.
bany 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
A few simple questions about linearUpwind and limitedLinear chegdan OpenFOAM 28 March 30, 2024 03:44
Using TVD Schemes in fvScheme aydemirk OpenFOAM Pre-Processing 1 August 20, 2014 05:26
TVD schemes Vino Main CFD Forum 3 September 16, 2013 20:47
TVD schemes: 2 questions Shuo Main CFD Forum 0 August 19, 2008 22:51
TVD Schemes Matt Umbel Main CFD Forum 1 January 25, 2000 05:21


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