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

Write out turbulence model functions

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 10, 2009, 22:35
Default Write out turbulence model functions
  #1
New Member
 
CFD user
Join Date: Jun 2009
Posts: 4
Rep Power: 17
bae127 is on a distinguished road
I am trying to modify turbulence models and would like to write out the value of some functions. For example, in kOmegaSST.C there is a private member function called F1. I would like to write out the value of this function each time I write out the other dependent variables.

I have tried the following syntax:

if(runTime_.outputTime())
{
F1.write()
}

While technically this works, the file name which is created is not "F1", but the function representation of F1 (e.g. tanh(pow4(min(min(max((((1|betaStar)*sqrt....)

Is there any way to force OpenFOAM to name this file something meaningful, like "F1"?
bae127 is offline   Reply With Quote

Old   June 10, 2009, 22:47
Default try IOobject
  #2
Senior Member
 
wayne.zhang
Join Date: Mar 2009
Location: Shanghai, Shanghai, P.R.China
Posts: 309
Rep Power: 18
waynezw0618 is on a distinguished road
Send a message via MSN to waynezw0618 Send a message via Skype™ to waynezw0618
F1_
(
IOobject
(
"F1",
runTime_.timeName(),
mesh_,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh_
),

what you want to modify?
waynezw0618 is offline   Reply With Quote

Old   June 10, 2009, 23:23
Default Thanks
  #3
New Member
 
CFD user
Join Date: Jun 2009
Posts: 4
Rep Power: 17
bae127 is on a distinguished road
Thanks for the help. I thought I had tried this before, and it did not work. I copied your syntax and everything works fine. I must have had a typo.

While the IOobject works, I am still wonding if there is a possibility of using the ".write()" function to accomplish this. The problem with the IOobject approach is that it requires a user to add an initial condition for "F1". This is not hard, but if an inexperienced user does not know that they need this initial condition, it can lead to lots of questions for me. Does anyone know the syntax to accomplish this with ".write()" ?
bae127 is offline   Reply With Quote

Old   June 11, 2009, 01:38
Default
  #4
Senior Member
 
wayne.zhang
Join Date: Mar 2009
Location: Shanghai, Shanghai, P.R.China
Posts: 309
Rep Power: 18
waynezw0618 is on a distinguished road
Send a message via MSN to waynezw0618 Send a message via Skype™ to waynezw0618
No it does work
i use this to output F1,and you could find out in the post before.
for initial condition i think it is not important for steady calculation.it is just a guess and after iteration it will get the correct values.
Quote:
Originally Posted by bae127 View Post
Thanks for the help. I thought I had tried this before, and it did not work. I copied your syntax and everything works fine. I must have had a typo.

While the IOobject works, I am still wonding if there is a possibility of using the ".write()" function to accomplish this. The problem with the IOobject approach is that it requires a user to add an initial condition for "F1". This is not hard, but if an inexperienced user does not know that they need this initial condition, it can lead to lots of questions for me. Does anyone know the syntax to accomplish this with ".write()" ?
waynezw0618 is offline   Reply With Quote

Old   June 11, 2009, 03:44
Default
  #5
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,902
Rep Power: 37
ngj will become famous soon enoughngj will become famous soon enough
You could also change the

IOobject::MUST_READ

to

IOobject::NO_READ

and use a different constructor for the F1

Best regards,

Niels
ngj is offline   Reply With Quote

Old   June 11, 2009, 07:37
Default NO_WRITE does not work
  #6
New Member
 
CFD user
Join Date: Jun 2009
Posts: 4
Rep Power: 17
bae127 is on a distinguished road
NGJ,

I know that I have tried this before... and I just did to reconfirm. If I make this change to my current code, it will compile fine. However, at run time I get an error like...

NO_READ specified for read-constructor of object F1 of class IOobject#0 Foam::error:rintStack(Foam::Ostream&) in "/home/edge/OpenFOAM/OpenFOAM-1.5/lib/linuxGccDPOpt/libOpenFOAM.so"
#1 Foam::error::abort() in "/home/edge/OpenFOAM/OpenFOAM-1.5/lib/linuxGccDPOpt/libOpenFOAM.so"
#2 Foam::regIOobject::readStream() in "/home/edge/OpenFOAM/OpenFOAM-1.5/lib/linuxGccDPOpt/libOpenFOAM.so"
....

You mentioned using a different constructor for F1. Could you elaborate on this a little? I appologize; I am a long time Fortran 90/95 user and am still working on learning C++.
bae127 is offline   Reply With Quote

Old   June 11, 2009, 07:52
Default
  #7
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,902
Rep Power: 37
ngj will become famous soon enoughngj will become famous soon enough
Well, then welcome to the world of C++

What I mean by using a different constructor is that you can choose to set it to the field of another volScalarField, e.g.

volScalarField F1
(
IOobject
(
"F1",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
pd
);

as initialization, and then you can set the values on run-time! Note that the one you have used initializes based on the mesh, whereas my initializes based on another volScalarField. You will be able to find examples of this use in e.g. /interFoam/createFields.H.
You can find the documentation here:
http://foam.sourceforge.net/doc/Doxy...onedField.html

Hope it did help,

Best regards,

Niels
ngj is offline   Reply With Quote

Old   June 11, 2009, 07:58
Default Thank you
  #8
New Member
 
CFD user
Join Date: Jun 2009
Posts: 4
Rep Power: 17
bae127 is on a distinguished road
Niels,

Thank you for the explanation. It is very helpful.
bae127 is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Adding a Turbulence Model doug OpenFOAM Running, Solving & CFD 11 May 21, 2018 13:54
SimpleFoam case with SpalartAllmaras turbulence model implemented nedved OpenFOAM Running, Solving & CFD 2 November 30, 2014 22:43
KOmega Turbulence model from wwwopenFOAMWikinet philippose OpenFOAM Running, Solving & CFD 30 August 4, 2010 10:26
Turbulence Model GG Siemens 3 March 3, 2008 19:06
v2-f turbulence model in CFX? flga CFX 14 November 23, 2006 06:12


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