CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (http://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Limiting values inside volScalarField (http://www.cfd-online.com/Forums/openfoam-programming-development/86274-limiting-values-inside-volscalarfield.html)

PekkaRo March 18, 2011 08:11

Limiting values inside volScalarField
 
Hi all,

I am implementing passive scalar transport to dynamic Smagorinsky model, and I have run into trouble. In order to keep my solver steady I need to clip the insane values of turbulent Prandtl numbers, that are inevitable at least with the Lilly formulation. To that end I wrote the following.

Code:

    void PrtLimiter(volScalarField& Prt)
    {
        scalar Lup= 2.0;
        scalar Llo= 0.0;
           
        forAll(Prt,i)
        {
            if (Prt[i]<Llo){Prt.replace(i,Llo);}
            if (Prt[i]>Lup){Prt.replace(i,Lup);}
           
        }
     
    }

And called it like this:

Code:

volScalarField Tmp = cD(D)*cPrt(D);
 PrtLimiter(Tmp);

I also made the necessary declaration in my .H-file. As you can guess, it doesn't work. It compiles, but at the run time I get the following.

Code:

myChannelFoam2: symbol lookup error: .../lib/linux64GccDPOpt/libHTdynamicSmagorinskyModel.so: undefined symbol: _ZN4Foam14incompressible9LESModels20HTdynamicSmagorinsky10PrtLimiterERNS_14GeometricFieldIdNS_12fvPatchFieldENS_7volMeshEEE
I would be most grateful, if someone could tell me how to deal with this?

To those who are interested in the model, I did some modifications to avoid doing division with very small numbers that's why the constants are multiplied, not divided, and a 1/2 is missing.

-Pekka

ngj March 18, 2011 08:26

Hi Pekka

It sounds like PrtLimiter is a method of some object, so in your C-file, is should read

Code:

void <nameOfMyObject>::PtrLimiter(scalarField & Prt)
Bests

Niels

Cyp March 18, 2011 08:36

Hi!

I think you can use the .max() and .min() fonction of a volScalarField:

Code:

Prt.max(Low)
Prt.min(Lup)

Best,
Cyp

PekkaRo March 18, 2011 08:50

Thanks
 
Thank you both,

Niels was right and with the input from Cyp I don't even need the function. I tested it already and it works beautifully.

Thanks again,
-Pekka


All times are GMT -4. The time now is 07:57.