CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   Compressible turbulence model issues (https://www.cfd-online.com/Forums/openfoam/123610-compressible-turbulence-model-issues.html)

351Cleveland September 17, 2013 07:07

Compressible turbulence model issues
 
Hello forum,

I've been trying to compile my my own compressible RAS-based turbulence model, based upon compressible k-epsilon for use with rhoSimpleFoam in ver 2.2.0 but have been having a number of issues.

The root of the problems seems to be a mismatch between units within the model centered around the mut term. Although the model does compile correctly with no errors, I've had to copy the turbulenceModel/compressible directory to my run directory to compile the model. The only addition to the files in Make/ has been the new .C file and the write directory set to user library. The options file remains unchanged.

Copying the dimensions from the tutorial case located in : /opt/openfoam/220/tutorials/compressible/rhoSimpleFoam/angledExplicitDuctFixedCoeffs; give the units for mut as being [1 -1 -1 0 0 0 0], however when attempting to run with my new model, the mut term only calculates as [0 2 -1 0 0 0 0], obviously missing the unit change for rho [1 -3 0 0 0 0 0] despite its inclusion in the equations.
Although this model was written using the incompressible kEpsilon model originally, all terms and files have been updated to match compressible kEpsilon.

Code:

  mut_ = (Cmu_*rho_*sqr(k_)/epsilon_);
    mut_.correctBoundaryConditions();

I am wondering if there has been a missing link somewhere as it does not seem to recognise the addition of the rho terms dimensional units? When adding a file for rho to the 0/ directory, the following error is returned:

Code:

#0  Foam::error::printStack(Foam::Ostream&) in "/opt/openfoam220/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#1  Foam::sigFpe::sigHandler(int) in "/opt/openfoam220/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#2  in "/lib/x86_64-linux-gnu/libc.so.6"
#3  Foam::compressible::mutkWallFunctionFvPatchScalarField::calcMut() const in "/opt/openfoam220/platforms/linux64GccDPOpt/lib/libcompressibleRASModels.so"
#4  Foam::compressible::mutWallFunctionFvPatchScalarField::updateCoeffs() in "/opt/openfoam220/platforms/linux64GccDPOpt/lib/libcompressibleRASModels.so"
#5  Foam::fvPatchField<double>::evaluate(Foam::UPstream::commsTypes) in "/opt/openfoam220/platforms/linux64GccDPOpt/bin/rhoSimpleFoam"
#6  Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>::GeometricBoundaryField::evaluate() in "/opt/openfoam220/platforms/linux64GccDPOpt/bin/rhoSimpleFoam"
#7  Foam::compressible::RASModels::yliqcomp::yliqcomp(Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::fluidThermo const&, Foam::word const&, Foam::word const&) in "/home/moffat/OpenFOAM/moffat-2.2.0/platforms/linux64GccDPOpt/lib/libuserRAScomp.so"
#8  Foam::compressible::RASModel::adddictionaryConstructorToTable<Foam::compressible::RASModels::yliqcomp>::New(Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::fluidThermo const&, Foam::word const&) in "/home/moffat/OpenFOAM/moffat-2.2.0/platforms/linux64GccDPOpt/lib/libuserRAScomp.so"
#9  Foam::compressible::RASModel::New(Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::fluidThermo const&, Foam::word const&) in "/opt/openfoam220/platforms/linux64GccDPOpt/lib/libcompressibleRASModels.so"
#10 
 in "/opt/openfoam220/platforms/linux64GccDPOpt/bin/rhoSimpleFoam"
#11  __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#12 
 in "/opt/openfoam220/platforms/linux64GccDPOpt/bin/rhoSimpleFoam"
Floating point exception (core dumped)

Despite the lack of any such file in the tutorial time directory - I included it in an attempt to correct the lack of unit recognition. But this seems to throw up an error in the wall functions. Upon trying to run my case there are also a number of duplicate entries added to the runTime selection table, I'm assuming this is due to the copying of the turbulence model directory and the original in the src/ directory - but this doesn't seem to have any bearing on the problems.

Does anyone have any pointers as to why the units for density are seemingly being missed out? Or is there a specific way in which the rho term is handled during the compressible solver use?

Thanks.
Dom.

gregor September 18, 2013 04:34

Hi Dom,

can you be more specific on

Quote:

Although this model was written using the incompressible kEpsilon model originally, all terms and files have been updated to match compressible kEpsilon.
You copied the code incompressible from the incompressible formulation and replaced it ? Why dont you start from the compressible kEpsilon formulation
in src/turbulenceModels/compressible/RAS/kEpsilon. Are you sure you didn't miss an occurance of the mut_ equation and have you adapted. Is the namespace correct ? May be you are not missing rho units when you compute mut but when muEff=mut+mu is done.

Gregor

351Cleveland September 18, 2013 05:48

Hi Gregor,

the only reason I used the incompressible model as a basis for the compressible version was that I had fully implemented all additional equations in that version and was hoping for a quick, easy transition. Not so much :)

You were quite right, the fault lay with the units for muEff rather than the mut calculation with the turbulence model .C file; I took your advice and started again with the compressible model as a basis and now seems to work - additions pending.

Thank you very much for the assistance.
Cheers.
Dom.

jasonchen October 23, 2013 15:43

Hello,

I'm just starting to learn the openfoam turbulence models. Regarding kEpsilon model for compressible flows, I'm not clear about the of's formulations. Namely rho is included in the first unsteady term in the equation, say for epsilon, correspondingly the convection term also needs to include the rho contribution. But as seen the code below, phi_ is just function of Sf and U; where is rho's contribution? Does it appear in the RHS as - fvm::SuSp(((2.0/3.0)*C1_ + C3_)*rho_*divU, epsilon_).

fvm::ddt(rho_, epsilon_) + fvm::div(phi_, epsilon_)...

290 // Dissipation equation
291 tmp<fvScalarMatrix> epsEqn
292 (
293 fvm::ddt(rho_, epsilon_)
294 + fvm::div(phi_, epsilon_)
295 - fvm::laplacian(DepsilonEff(), epsilon_)
296 ==
297 C1_*G*epsilon_/k_
298 - fvm::SuSp(((2.0/3.0)*C1_ + C3_)*rho_*divU, epsilon_)
299 - fvm::Sp(C2_*rho_*epsilon_/k_, epsilon_)
300 );

Many thanks.

Regards,
Jason

gregor October 24, 2013 06:57

Hi Jason,

please double check the definition of phi it should contain rho*U
e.g. in compressibleCreatePhi.H
Code:

linearInterpolate(rho*U) & mesh.Sf()
In the code you posted i dont find a definintion of phi.

Cheers
Gregor

jasonchen October 24, 2013 15:41

Hi Gregor,

Exactly you are right. I just found definition of phi is different for incompressible and compressible flow.

Regards,
Jason

Quote:

Originally Posted by gregor (Post 458756)
Hi Jason,

please double check the definition of phi it should contain rho*U
e.g. in compressibleCreatePhi.H
Code:

linearInterpolate(rho*U) & mesh.Sf()
In the code you posted i dont find a definintion of phi.

Cheers
Gregor



All times are GMT -4. The time now is 10:33.