CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   How to change coefficient(s) to re-calibrate an existing model (https://www.cfd-online.com/Forums/openfoam-solving/217590-how-change-coefficient-s-re-calibrate-existing-model.html)

purnp2 May 17, 2019 10:44

How to change a coefficient to re-calibrate an existing turbulence model
 
1 Attachment(s)
Hello,
I am using kOmegaSST model to modify it into kOmegaBSL model (both are sub-class of kOmegaSSTBase class).
Between these two models, there is one difference where I have to change one coefficient (alphaK1 should be changed from 0.85 to 0.5). So, I want to change this value in my new model.
In the base-class (kOmegaSSTBase.C), this coefficient is defined as follows in the constructor of its class:
Code:

    alphaK1_
    (
        dimensioned<scalar>::lookupOrAddToDict
        (
            "alphaK1",
            this->coeffDict_,
            0.85
        )
    ),

One way of changing the value of this coefficient is to add the name of coefficient into the file in MainCaseDirectory/constant/turbulenceProperties. But I am looking for changing the default value from within the code of the new Turbulence model.
The above piece of code uses lookupOrAddToDict() function which is defined as follows:
Code:

Foam::dimensioned< Type > lookupOrAddToDict       
(      const word &        name,
        dictionary &        dict,
        const Type &        defaultValue = Type(Zero)
)

I have seen a few other standard models like kOmegaSSTSAS where new coefficients are added and then a read() function is added. I tried this method but it is not working for me.
Code:

      alphaK1_
    (
        dimensioned<scalar>::lookupOrAddToDict
        (
            "alphaK1",
            this->coeffDict_,
            0.501
        )

Maybe I am missing any step.

I'm attaching the current version of my kOmegaBSL.C file with this post.
Can you please suggest anything in it?
Thank you. Regards.
Purn :)

purnp2 May 17, 2019 19:30

Solution
 
One known solution is:
I need to add the coefficient in the pitzDaily/constant/turbulenceProperties of the case file which I am running.
The file should look like this:
Code:

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

simulationType RAS;

RAS
{
    // Tested with kOmegaSSTF, realizableKE, kOmega, kOmegaSST, v2f,
    // ShihQuadraticKE, LienCubicKE.
    RASModel        kOmegaBSL;

    turbulence      on;

    printCoeffs    on;

    alphaK1        0.5;
}


// ************************************************************************* //

Source:

purnp2 May 21, 2019 06:05

Still looking for a solution on how to change the coefficient by default.
:)

purnp2 May 21, 2019 15:13

1 Attachment(s)
I found out a solution but I am not sure it the standard way of doing this.

I made another dimensionedScalar alphaK10 and then gave the value of this coefficient to the alphaK1 during run time in the correct() function.

Take a look on (line 83 to 91), and (line 160 to 162) in this updated version of my .C file.


All times are GMT -4. The time now is 12:54.