|
[Sponsors] |
June 10, 2009, 22:35 |
Write out turbulence model functions
|
#1 |
New Member
CFD user
Join Date: Jun 2009
Posts: 4
Rep Power: 17 |
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"? |
|
June 10, 2009, 22:47 |
try IOobject
|
#2 |
Senior Member
|
F1_
( IOobject ( "F1", runTime_.timeName(), mesh_, IOobject::MUST_READ, IOobject::AUTO_WRITE ), mesh_ ), what you want to modify? |
|
June 10, 2009, 23:23 |
Thanks
|
#3 |
New Member
CFD user
Join Date: Jun 2009
Posts: 4
Rep Power: 17 |
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()" ? |
|
June 11, 2009, 01:38 |
|
#4 | |
Senior Member
|
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:
|
||
June 11, 2009, 03:44 |
|
#5 |
Senior Member
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,902
Rep Power: 37 |
You could also change the
IOobject::MUST_READ to IOobject::NO_READ and use a different constructor for the F1 Best regards, Niels |
|
June 11, 2009, 07:37 |
NO_WRITE does not work
|
#6 |
New Member
CFD user
Join Date: Jun 2009
Posts: 4
Rep Power: 17 |
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++. |
|
June 11, 2009, 07:52 |
|
#7 |
Senior Member
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,902
Rep Power: 37 |
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 |
|
June 11, 2009, 07:58 |
Thank you
|
#8 |
New Member
CFD user
Join Date: Jun 2009
Posts: 4
Rep Power: 17 |
Niels,
Thank you for the explanation. It is very helpful. |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|
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 |