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

limiter function in openfoam

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 19, 2014, 18:07
Question limiter function in openfoam
  #1
Senior Member
 
Join Date: Jan 2013
Posts: 372
Rep Power: 14
openfoammaofnepo is on a distinguished road
Dear All,

In the openfoam limiter function, there is a scalar called k_, does anybody know what does it stand for? For example, we can have a look at the limiter for Gamma differencing:

Code:
    GammaLimiter(Istream& is)
    :
        k_(readScalar(is))
    {
        if (k_ < 0 || k_ > 1)
        {
            FatalIOErrorIn("GammaLimiter(Istream& is)", is)
                << "coefficient = " << k_
                << " should be >= 0 and <= 1"
                << exit(FatalIOError);
        }

        // Rescale k_ to be >= 0 and <= 0.5 (TVD conformant)
        // and avoid the /0 when k_ = 0
        k_ = max(k_/2.0, SMALL);
    }
The above code lines are from:
Code:
OpenFOAM/OpenFOAM-<version>/src/finiteVolume/interpolation/surfaceInterpolation/limitedSchemes/Gamma/Gamma.H
The second question is: we need the calculate the gradiant ratio for the limiter function (always the input for the limiter). In TVD scheme, we call it r and in NVD we call it phict. These two quantities are defined in:

Code:
OpenFOAM/OpenFOAM-<version>/src/finiteVolume/interpolation/surfaceInterpolation/limitedSchemes/LimitedScheme/NVDTVD.H
When calculating r or phict, we need to get the difference of phi in Cell N and P (actually upwind and downwind cells). Take r for example. The original code is:
Code:
        scalar r
        (
            const scalar faceFlux,
            const scalar phiP,
            const scalar phiN,
            const vector& gradcP,
            const vector& gradcN,
            const vector& d
        ) const
        {
            scalar gradf = phiN - phiP;

            scalar gradcf;

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

            if (mag(gradcf) >= 1000*mag(gradf))
            {
                return 2*1000*sign(gradcf)*sign(gradf) - 1;
            }
            else
            {
                return 2*(gradcf/gradf) - 1;
            }
        }
In my opinion, it should be like:

Code:
        scalar r
        (
            const scalar faceFlux,
            const scalar phiP,
            const scalar phiN,
            const vector& gradcP,
            const vector& gradcN,
            const vector& d
        ) const
        {
            

            scalar gradcf;

            if (faceFlux > 0)
            {
                gradcf = d & gradcP;
                scalar gradf = phiN - phiP;
            }
            else
            {
                gradcf = d & gradcN;
                scalar gradf = phiP - phiN;
            }

            if (mag(gradcf) >= 1000*mag(gradf))
            {
                return 2*1000*sign(gradcf)*sign(gradf) - 1;
            }
            else
            {
                return 2*(gradcf/gradf) - 1;
            }
        }
About this issue, I am not sure this is a bug or I make some mistakes here. In my opinion, gradf depends on the direction of flow, i.e. upwind or downwind, but as you know owner and neighbor cells only stands for the geometrical position, instead of any flow direction information. Does anybody have some comments here?

OFFO
openfoammaofnepo 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
foamToTecplot360 thomasduerr OpenFOAM Post-Processing 121 June 11, 2021 10:05
Production limiter only used for k - kOmegaSST - OpenFOAM 2.2.x Bokse OpenFOAM Programming & Development 8 September 21, 2015 08:55
probes function not working in Openfoam 2.1.1 nandiganavishal OpenFOAM 7 July 26, 2012 11:06
LiencubiclowRemodel nzy102 OpenFOAM Bugs 14 January 10, 2012 08:53
Version 15 on Mac OS X gschaider OpenFOAM Installation 113 December 2, 2009 10:23


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