CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Running, Solving & CFD (
-   -   Help with modification needed (

harly December 28, 2008 01:22

Hi, I modified the built-in

I modified the built-in kEpsilon model of OpenFoam according to a paper. unfortunately the results are not at all what we expected.

I used the standard kEpsilon Model and turbFoam to produce vortex shedding behind a square cylinder (Re = 20000) and then wanted to restart with my modified model.

The paper states (results with an proprietary code) that the effect should be almost instantly - considering I practically change C1_ in the code that makes sense to me.

But nothing happens the drag and lift coefficients are (periodic) exactly the same as before.

I tried a lot and I can rule out a wrong formula - what I can't rule out is the accidental misuse of variables while coding - therefore I hope you can take a look at my modification and check if I do something what should not be done.

Here is the important extract of my modified file:


volScalarField G = nut_*2*magSqr(symm(fvc::grad(U_)));
volVectorField dU = fvc::ddt(U_);
volScalarField dUx = dU.component(0);
volScalarField dUy = dU.component(1);
volScalarField Gstar = 0.5*magSqr(U_)+k_;

volScalarField C1star = C1_+C1_*0.38*k_/epsilon_*1.0/(Gstar)
* mag(U_.component(vector::X)*dUx + U_.component(vector::Y)*dUy + fvc::ddt(k_));

Info << "Using modified kEpsilon model" << endl;

# include "wallFunctionsI.H"

// Dissipation equation
tmp<fvscalarmatrix> epsEqn
+ fvm::div(phi_, epsilon_)
- fvm::Sp(fvc::div(phi_), epsilon_)
- fvm::laplacian(DepsilonEff(), epsilon_)
- fvm::Sp(C2_*epsilon_/k_, epsilon_)

And here is the Link to the complete File: (I am sorry if your browser is showing a blue text between the code - just save the file to disk and it should be fine)

Hope you find something
- harly

nikola_m December 28, 2008 11:47

Harly, what paper you used as
Harly, what paper you used as your reference?

harly December 28, 2008 12:25

Hey no problem: http://harl
Hey no problem:

I am implementing the formulation (15) in the kEpsilonMod.C.

I am using the same mesh (described in the paper) and also Re = 20000

please don't distribute the paper - thanks

- harly

nikola_m December 28, 2008 12:46

Thanks - I asked you because I
Thanks - I asked you because I plan to do a similar thing. I was involved in simulating atmospheric boundary layer with modified two- equation models of turbulence (I'll send you a paper if you're interested) so I wanted to implement such "Atmospheric Boundary Layer k-e" here.

I'll take a look at your modification and see if I can help something.


harly January 5, 2009 15:28

Hi, I am back from the hol

I am back from the holidays and still can't find my mistake. So please if someone has an idea I am open for everything.

@Nikola: Did you have time to take a look at my code? - and yes please send me the paper of your modification.

- harly

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