CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (http://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   How to implement turbulence in one Solver??? (http://www.cfd-online.com/Forums/openfoam-programming-development/105378-how-implement-turbulence-one-solver.html)

vahid.najafi July 29, 2012 05:46

How to implement turbulence in one Solver???
 
1 Attachment(s)
Hi Dear Foamers.
I have a big problem!!!!please help me about this!!:)

my solver is in Appendix.I want to added kinetic turbulence energy in Directory:
OpenFOAM/vahid 2.0.1/run/myinterPhaseChangeFoam/phaseChangeTwoPhaseMixtures/SchnerrSauer/SchnerrSauer.c
in file:SchnerrSauer.c

I have add (turbulence kinetic Energy or k ) in a part of this solver.
first:
added:
-I$(LIB_SRC)/turbulenceModels \
-I$(LIB_SRC)/turbulenceModels/incompressible/RAS/RASModel \

in option.


and then:
added
//.................................................. .....changed
// Construct incompressible turbulence model
autoPtr<incompressible::RASModel> turbulence
(
incompressible::RASModel::New(U, phi, twoPhaseProperties())
);
//.................................................. .....changed


in creatField.

and then:
added

#include "RASModel.H"
and:

//.................................................. .............
volScalarField turbKinEnergy = turbulence().k(); //turbKinEnergy = turbulence().k();
volScalarField turbDisEnergy = turbulence().epsilon();
in this and turbkinEnergy=k
//.................................................. .............


in myinterPhaseChangeFoam.c

and wmake is ok!!!



but
I want in this solver in directory:
/run/myinterPhaseChangeFoam/phaseChangeTwoPhaseMixtures/SchnerrSauer/SchnerrSauer.c




I added
#include "RASModel.H"

in it and:


Foam::tmp<Foam::volScalarField>
Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::p Coeff
(
const volScalarField& p
) const
{
volScalarField limitedAlpha1(min(max(alpha1_, scalar(0)), scalar(1)));
volScalarField rho
(
limitedAlpha1*rho1() + (scalar(1) - limitedAlpha1)*rho2()
);

return
//......I want to change it( <<k>> turbulence multiple in it):
(3*rho1()*rho2())*sqrt(2/(3*rho1()))*k()
*rRb(limitedAlpha1)/(rho*sqrt(mag(p - pSat()) + 0.01*pSat()));
//.................................................. ......
}


dont successful wmake, and seen(was not declared ):

I/opt/openfoam201/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linux64GccDPOpt/SchnerrSauer.o
phaseChangeTwoPhaseMixtures/SchnerrSauer/SchnerrSauer.C: In member function â€کFoam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::p Coeff(const Foam::volScalarField&) const’:
phaseChangeTwoPhaseMixtures/SchnerrSauer/SchnerrSauer.C:113: error: k() was not declared in this scope
make: *** [Make/linux64GccDPOpt/SchnerrSauer.o] Error 1


please help me.

another way that I worked:


Foam::tmp<Foam::volScalarField>
Foam:haseChangeTwoPhaseMixtures::SchnerrSauer: Coeff
(
const volScalarField& p
) const
{
volScalarField limitedAlpha1(min(max(alpha1_, scalar(0)), scalar(1)));
volScalarField rho
(
limitedAlpha1*rho1() + (scalar(1) - limitedAlpha1)*rho2()
);

return
const volScalarField &k=U_.db().lookupObject<volScalarField>("k");

(3*rho1()*rho2())*sqrt(2/(3*rho1()))*k()
*rRb(limitedAlpha1)/(rho*sqrt(mag(p - pSat()) + 0.01*pSat()));


and wmake was Successfully .

but How can I Understand that this k is the same with k(kinetic turbulence energy)???Is it true???
Because I replase another world in this :
const volScalarField &M=U_.db().lookupObject<volScalarField>("M")
but not error occured!!!!!!??????


please help me more about this problem????Thanks.


All times are GMT -4. The time now is 22:16.