CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

Read a new variable from a solver to turbulence model

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By Clarkyan

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 3, 2015, 14:23
Default Read a new variable from a solver to turbulence model
  #1
New Member
 
Clark Yan
Join Date: Jun 2015
Location: Ottawa, Canada
Posts: 5
Rep Power: 11
Clarkyan is on a distinguished road
Dear Foamers,

I've added the equation of state in the pisoFoam solver, now the rho is a function of temperature and salinity. The solver works well and the rho can be updated at every time step.

rho==1000;
rho==(rho/1000*(999.842594+6.793952e-2*T-(9.095290e-3*pow(T,2))+(1.001685e-4*pow(T,3))-(1.120083e-6*pow(T,4))+(6.536336e-9*pow(T,5))+S*(8.24493e-1-4.0899e-3*T+(7.6438e-5*pow(T,2))-(8.2467e-7*pow(T,3))+(5.3875e-9*pow(T,4)))+(pow(S,1.5))*(-5.72466e-3+1.0227e-4*T-1.6546e-6*pow(T,2))+S*(4.8314e-4)));

Currently I'm trying to add this rho into the incompressible kEpsilon turbulence model,

rho_
(
IOobject
(
"rho",
runTime_.timeName(),
mesh_,
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
mesh_
),


however the model just reads the initial rho instead of the updated rho, I find it hard to read a new variable from a solver to a turbulence model. Can anybody drop a hint? Thanks in advance.

Regards,
Clark
turbobluestreak likes this.
Clarkyan is offline   Reply With Quote

Old   June 3, 2015, 14:40
Default
  #2
Member
 
ali alkebsi
Join Date: Jan 2012
Location: Strasbourg, France
Posts: 82
Rep Power: 14
kebsiali is on a distinguished road
Hi,

What you need is the lookup command
it is mainly used for this stuff (fetch a variable from the solver into a model in the library)

You can see a simple example in the following link:
http://www.tfd.chalmers.se/~hani/kur...nFoam%20v2.pdf

page 11
where he needed the variable T to go into his viscosity model using:
const volScalarField& T= U_.mesh().lookupObject<volScalarField>("T");

Hope that helps
kebsiali is offline   Reply With Quote

Old   June 4, 2015, 09:28
Default
  #3
New Member
 
Clark Yan
Join Date: Jun 2015
Location: Ottawa, Canada
Posts: 5
Rep Power: 11
Clarkyan is on a distinguished road
Hi Ali,

Thanks, I believe it's a good way, however, I haven't figured out where to put it in the incompressible kEpsilon model.

I have written the following one:

const volScalarField& rho= U_.mesh().lookupObject<volScalarField>("rho");

If I put it before the "namespace", an error called "'volScalarField' does not name a type" shows up, as expected.

If I put it after the "namespace" but before "Constructors", an error called "‘U_’ was not declared in this scope" shows up;

If I put it within the "kEpsilon::kEpsilon" and after "const word& modelName,", an error called "‘prototype for ‘Foam::incompressible::RASModels::kEpsilon::kEpsil on(const volVectorField&, const surfaceScalarField&, Foam::transportModel&, const Foam::word&, const Foam::word&, const volScalarField&)’ does not match any in class ‘Foam::incompressible::RASModels::kEpsilon’" shows up;

If I put it after the "Constructors" but before "Member Function", the error called "‘U_’ was not declared in this scope" shows up again;

If I put it within the "void kEpsilonGGDH::correct()", an error called "‘ invalid initialization of reference of type ‘const volScalarField&" shows up.

Any help is appreciated. Thanks
Clark

Clarkyan is offline   Reply With Quote

Old   June 4, 2015, 09:55
Default
  #4
Member
 
ali alkebsi
Join Date: Jan 2012
Location: Strasbourg, France
Posts: 82
Rep Power: 14
kebsiali is on a distinguished road
im not 100% sure
but i would see it should go in:


tmp<fvVectorMatrix> kEpsilon::divDevRhoReff
(
const volScalarField& rho, put me here
volVectorField& U
) const
{
volScalarField muEff("muEff", rho*nuEff());

return
(
- fvm::laplacian(muEff, U)
- fvc::div(muEff*dev(T(fvc::grad(U))))
);
}
kebsiali is offline   Reply With Quote

Old   June 4, 2015, 12:20
Default
  #5
New Member
 
Clark Yan
Join Date: Jun 2015
Location: Ottawa, Canada
Posts: 5
Rep Power: 11
Clarkyan is on a distinguished road
Hi Ali,

Thank you for your help! It works very well now!
Finally I put it within "void kEpsilon::correct()"

Thanks again,
Clark
Clarkyan is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Fluent :- turbulence Model prince_pahariaa FLUENT 9 May 20, 2016 04:41
Setting rotating frame of referece. RPFigueiredo CFX 3 October 28, 2014 05:59
How to decide to Turbulence model shipman OpenFOAM 2 August 18, 2013 04:00
emag beta feature: charge density charlotte CFX 4 March 22, 2011 10:14
Advanced Turbulence Modeling in Fluent, Realizable k-epsilon Model Jonas Larsson FLUENT 5 March 13, 2000 04:27


All times are GMT -4. The time now is 00:04.