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

ReTau and equation for nut

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 7, 2018, 12:03
Default ReTau and equation for nut
  #1
gu1
Senior Member
 
Guilherme
Join Date: Apr 2017
Posts: 245
Rep Power: 10
gu1 is on a distinguished road
Hi,

I need to write a eddy viscosity equation (nut) for my kOmega model. The equation is attached.

I would like help to be able to write the ReTau function because I am not able to create a this function (...and the biggest problem is to write the uTau equation).

Quote:

// I need to write an equation for ReTau

tmp<volScalarField> Foam::kOmega::fMu() const
{
return (scalar(1) - exp(-y_/15);
}

tmp<volScalarField> Foam::kOmega::fDR() const
{
return return (scalar(1) - exp(-ReTau/6.25));
}

void Foam::kOmega::correctNut(const volScalarField& fMu , const volScalarField& fDR)
{
nut_ = fDR*Cmu_*fMu*k_/omega_;
}
I tried this code below, but it gives error when compiling ...

Quote:

tmp<volScalarField> Foam::kOmega::fDR() const
{
const label patchi = patch().index();

forAll(mesh.faces(), faceI) //wallFaces?
{
label celli = patch().faceCells()[facei];
tmp<volScalarField> uTau = pow025(Cmu_)*sqrt(k[celli]);
}

tmp<volScalarField> ReTau(uTau*y_/nu_);
return return (scalar(1) - exp(-ReTau/6.25));
}
Error:

Quote:
: error: ‘patch’ was not declared in this scope
const label patchi = patch().index();

: error: ‘facei’ was not declared in this scope
label celli = patch().faceCells()[facei];

: warning: unused variable ‘patchi’ [-Wunused-variable]
const label patchi = patch().index();
Thanks
Attached Images
File Type: jpeg CFD.jpeg (12.1 KB, 19 views)

Last edited by gu1; December 7, 2018 at 16:25.
gu1 is offline   Reply With Quote

Old   December 9, 2018, 05:35
Default
  #2
gu1
Senior Member
 
Guilherme
Join Date: Apr 2017
Posts: 245
Rep Power: 10
gu1 is on a distinguished road
Can someone help me?
gu1 is offline   Reply With Quote

Old   December 27, 2018, 14:38
Default
  #3
gu1
Senior Member
 
Guilherme
Join Date: Apr 2017
Posts: 245
Rep Power: 10
gu1 is on a distinguished road
Can someone help me? 2
gu1 is offline   Reply With Quote

Old   December 28, 2018, 06:30
Default
  #4
Member
 
Join Date: Dec 2018
Location: Darmstadt, Germany
Posts: 87
Rep Power: 7
raumpolizei is on a distinguished road
Hey there,
taking a look at your code and the error, it is quite clear what is not going well.
Quote:
Originally Posted by gu1 View Post
: error: ‘patch’ was not declared in this scope
const label patchi = patch().index();

: error: ‘facei’ was not declared in this scope
label celli = patch().faceCells()[facei];

: warning: unused variable ‘patchi’ [-Wunused-variable]
const label patchi = patch().index();
in this context, the compiler can't know what you mean with patch().index(). patch() is a member function of the class fvPatchField (here, it is helpful to take a look at the documentation - www.openfoam.com/documentation/cpp-guide/html/)
Also, you define faceI in your forAll macro but then you use facei inside of the loop.
The last warning is not causing your code to not compile. However it tells you that you are defining something that you are not using.
Code:
tmp<volScalarField> uTau = pow025(Cmu_)*sqrt(k[celli]);
In the best case, this will not compile. The worst would be that it does. This will create for each loop iteration a field with the same value (based on the last value of celli, which is btw also not defined in the part you've shown).

I think you should take a look at a few more turbulence model classes as starting point. Read the OF programmers guide (google). Find the one class that suits best to your problem (if it's kOmega, great) and then implement the few functions needed in that framework. Write how it should be working on paper and then find functions that mimic the expected behaviour (and adapt them). What you seem to be doing is wild copy-pasting and it will probably not lead you to your goal.

wish you good luck!
RP
raumpolizei is offline   Reply With Quote

Old   December 28, 2018, 07:03
Default
  #5
gu1
Senior Member
 
Guilherme
Join Date: Apr 2017
Posts: 245
Rep Power: 10
gu1 is on a distinguished road
Quote:
Originally Posted by raumpolizei View Post
Hey there, taking a look at your code and the error, it is quite clear what is not going well.
Yes, I am aware that it is not right ... my intention was actually to show what my goal was. I believe it is not easy to implement a uTau function inside a kEpsilon.C file and alone I believe I can not do it. My intention with the post is to call on the help of more experienced people...
gu1 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



All times are GMT -4. The time now is 21:15.