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/)
-   -   Komega equation (https://www.cfd-online.com/Forums/openfoam-solving/59561-komega-equation.html)

doug July 17, 2007 17:53

Hi all, I'm trying to code
 
Hi all,

I'm trying to code in a k-omega model. The model compiles, but during runtime I get the following error:

Time = 1

DILUPBiCG: Solving for Ux, Initial residual = 1, Final residual = 0.0529457, No Iterations 1
DILUPBiCG: Solving for Uy, Initial residual = 1, Final residual = 0.0290519, No Iterations 1
DICPCG: Solving for p, Initial residual = 1, Final residual = 0.0083708, No Iterations 171
time step continuity errors : sum local = 0.146471, global = -0.000598041, cumulative = -0.000598041
DILUPBiCG: Solving for omega, Initial residual = 0.183509, Final residual = 0.0054477, No Iterations 1


--> FOAM FATAL ERROR : incompatible fields for operation
[k] == [omega]#0 Foam::error::printStack(Foam:http://www.cfd-online.com/OpenFOAM_D...part/proud.gifstream&)
#1 Foam::error::abort()
#2 void Foam::checkMethod<double>(Foam::fvMatrix<double> const&, Foam::fvMatrix<double> const&, char const*)
#3 Foam::turbulenceModels::myKOmega::correct()
#4 main
#5 __libc_start_main
#6 __gxx_personality_v0 at /usr/src/packages/BUILD/glibc-2.3/csu/../sysdeps/i386/elf/start.S:122


From function checkMethod(const fvMatrix<type>&, const fvMatrix<type>&)
in file /home/doug/OpenFOAM/OpenFOAM-1.4/src/finiteVolume/lnInclude/fvMatrix.C at line 1005.

FOAM aborting

From the error message it is apparent that the error happens in the myKOmega::correct() function. I've tried adding print statements to see exactly where the error occurs, but haven't figured out how to get things to print to the screen. I tried Info<<"here"<<endl; statements, but they didn't work. Any ideas on how I might track down this runtime error?

Here is the portion of the code I think it is breaking at in case anyone can spot the error from the code. However, I'm not sure if it's breaking here because I can't figure out at what line the program aborts.

// Turbulent kinetic energy equation
tmp<fvscalarmatrix> kEqn
(
fvm::ddt(k_)
+ fvm::div(phi_, k_)
- fvm::Sp(fvc::div(phi_), k_)
- fvm::laplacian(DkEff(), k_)
==
G
- fvm::Sp(Cmu*k_, omega_)
);

Thanks in advance.

Doug

hjasak July 17, 2007 17:57

Easy: you are building a matri
 
Easy: you are building a matrix for k_ and the last term is implicit in omega_ - you cannot add it to this matrix.

Hrv

doug July 17, 2007 18:13

Thanks for the quick reply. So
 
Thanks for the quick reply. So how would you write Cmu*k_*omega_ ?
I tried fvc::Sp(Cmu*k_, omega_) and it didn't work either.

It must be obvious from that line of code what I'm trying to do (?).

-Doug

hjasak July 17, 2007 18:27

How about Cmu*omega_, k)? H
 
How about Cmu*omega_, k)?

Hrv

doug July 17, 2007 18:35

You mean fvm::Sp(Cmu*omega_,k_
 
You mean fvm::Sp(Cmu*omega_,k_) right? I tried that too and it gives the same error. This is very similar to the code that kOmegaSST.C uses in its correct() function. So, I'm not sure what is causing the error. Any other ideas? Is there a way to print statements to the screen so I can track down which line it is aborting on?

Thanks again.

cosimobianchini July 18, 2007 03:02

Hi Doug, that correction is w
 
Hi Doug,
that correction is what you need to avoid the error you are referring.
I mean: fvm::Sp(Cmu*omega_,k_).

And you are right, this is a way you can add printouts:
Info << "Solving for k_" << endl;

Are you sure you manage to correctly compile the update version of your turbulence model?
Don't know what else could be.
Good luck,
Cosimo

hjasak July 18, 2007 03:09

Well Doug, you've got a proble
 
Well Doug, you've got a problem - I am not guessing what's wrong: I actually know for a fact (been writing this code since 1993). The solution is fvm::Sp(Cmu*omega_,k_). Check the file, check the compilation, check that you are running what you think you are running etc.

Hrv


All times are GMT -4. The time now is 19:29.