CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Reading temperature in compressible k-omega SST (https://www.cfd-online.com/Forums/openfoam-programming-development/221346-reading-temperature-compressible-k-omega-sst.html)

mechkween October 13, 2019 23:28

Reading temperature in compressible k-omega SST
 
Hi all,
I'm trying to modify and build a version of k-omega SST (compressible) where I need to compute temperature gradients to evaluate and construct a new turbulent Prandtl number. I'm not sure how to get the turbulence solver to read in the temperature field to perform the processing. I tried adding T using:


Code:



rhoKOmegaSSTAlt
        ( 
            const volScalarField& rho,
            const volVectorField& U,
            const surfaceScalarField& phi,
            const volScalarField& T,
            const fluidThermo& thermophysicalModel,
            const word& turbulenceModelName = turbulenceModel::typeName,
            const word& modelName = typeName
        );



but the compilation fails saying no matching function call which leads me to RASModel.H where the T line doesn't exist. I could modify that as well but seems like a complicated thing. Is there a simpler way to read the temperature field into the solver?


Thanks

mAlletto October 14, 2019 06:47

You can lookup T by
Code:

volScalarField  Thelp =  U.mesh().lookupObject<volScalarField>("T");

mechkween October 15, 2019 01:08

Hi Michael,


Thanks for this, I can confirm I was able to compile the solver with a slight modification:
Code:

volScalarField THelp = U_.mesh().lookupObject<volScalarField>("T");
However the solver isn't behaving as expected. The Prt I'm building is not getting updated even though I do Prt_.correctBoundaryConditions(), which leads me to believe maybe the THelp is not getting updated? Would this looking up for T update THelp or I require a correctBoundaryConditions() call on THelp as well?

mAlletto October 15, 2019 01:16

What you're getting is the temperature which is stored in the database. It is a constant reference. It means it cannot be modified. The temperature is updated only when the temperature equation is solved.

mechkween October 15, 2019 18:26

I understand. I fixed the issue and now it updates the Prt every iteration.

The issue came from the fact the updating was happening in a conditional loop which wasn't being entered into.


Thanks for the help Michael!


All times are GMT -4. The time now is 13:30.