|
[Sponsors] |
August 5, 2010, 05:37 |
Questions about data output
|
#1 |
New Member
yafuji aki
Join Date: Jul 2010
Location: Japan
Posts: 14
Rep Power: 16 |
Dear FOAMers,
I am now studying OpenFOAM by modifying some tutorials, especially dam break tutorial by supposing the kEpsilon model for turbulence. I have a couple of questions about data output... If you wouldn't mind, would you please give me some advice? 1. I could understand that when I want to control data output, I should modify "createFields.H", but I am not sure the description well. For example, pressure "p" and density "rho" are written in createFields.H as follows, ----------------------------------------------------- volScalarField p ( IOobject ( "p", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE ), mesh ); volScalarField rho ( IOobject ( "rho", runTime.timeName(), mesh, IOobject::READ_IF_PRESENT ), alpha1*rho1 + (scalar(1) - alpha1)*rho2, alpha1.boundaryField().types() ); ----------------------------------------------------- My question is what does "mesh" in p mean? For rho, concrete descriptions "alpha1*rho1 + (scalar(1) - alpha1)*rho2, alpha1.boundaryField().types()" are written instead of "mesh". 2. We can find turbulent viscosity: nut and Reynolds stress tensor: R in kEpsilon.C. Of them, nut is written in Constructors, ----------------------------------------------------- nut_ ( IOobject ( "nut", runTime_.timeName(), mesh_, IOobject::NO_READ, ), autoCreateNut("nut", mesh_) ) { nut_ = Cmu_*sqr(k_)/(epsilon_ + epsilonSmall_); nut_.correctBoundaryConditions(); printCoeffs(); } ----------------------------------------------------- on the other hand, R is written in Member Functions, ----------------------------------------------------- tmp<volSymmTensorField> kEpsilon::R() const { return tmp<volSymmTensorField> ( new volSymmTensorField ( IOobject ( "R", runTime_.timeName(), mesh_, IOobject::NO_READ, IOobject::NO_WRITE ), ((2.0/3.0)*I)*k_ - nut_*twoSymm(fvc::grad(U_)), k_.boundaryField().types() ) ); } ----------------------------------------------------- As for nut (which is described in Constructors), I can get its value at each time step when I add "IOobject::AUTO_WRITE". But I could not output R (which is described in Member Functions), even if I use "IOobject::AUTO_WRITE" instead of "IOobject::NO_WRITE". What should I do when I want to output the Reynolds stress tensor R (such as values that are written in Member Functions)? I can not output R either even if I type "R" in post-processing. 3. I think "U" in OpenFOAM means the total velocity which is the sum of mean and perturbation velocities. Where are the mean velocity (UMean) and the perturbation velocity (UPrime = U - UMean) in the code? I would like you to tell me how you output the three components (i.e., x, y, and z components) of both mean and perturbation velocities. 4. I would like to calculate potential energy: rho*g*x, but I am not sure how the x-coordinate is stored in the code. Would you please tell me how do you output the x-coordinate? Maybe these question arises from a lack of understanding of C++, it would give me a great deal of pleasure if you give me some advice. Thanks in advance! aki |
|
August 5, 2010, 09:33 |
|
#2 |
Senior Member
Nima Samkhaniani
Join Date: Sep 2009
Location: Tehran, Iran
Posts: 1,267
Blog Entries: 1
Rep Power: 25 |
hi friend you have too questions here
1. look following address you will find more about out put input to the openFoam http://openfoamwiki.net/index.php/In...IOobject_class |
|
August 5, 2010, 12:22 |
|
#3 | |||
Senior Member
David Gaden
Join Date: Apr 2009
Location: Winnipeg, Canada
Posts: 437
Rep Power: 22 |
These are all constructors for volScalarField, which is a GeometricField. There are 13 different constructors defined for the GeometricField, and p is being created using this one:
Code:
//- Construct and read given IOobject GeometricField ( const IOobject&, const Mesh& ); Code:
IOobject ( "p", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE ) http://openfoamwiki.net/index.php/Op...objectRegistry The second argument is a reference to the mesh, which the GeometricField needs to build itself. There are no other arguments, so GeometricField looks in your case directory for the file [time]/p and reads this file. On the other hand, rho is not (necessarily) defined in the case directory, rather it is derived from other variables. To accomplish this a different GeometricField constructor is used: Code:
//- Construct as copy resetting IO parameters and boundary types GeometricField ( const IOobject&, const GeometricField<Type, PatchField, GeoMesh>&, const wordList& patchFieldTypes ); Code:
alpha1*rho1 + (scalar(1) - alpha1)*rho2 Code:
alpha1.boundaryField().types() Quote:
The changes you suggest above are to the turbulence model itself, part of the core of OpenFOAM. I'd recommend against changing these, as it will impact the behaviour of every solver in existence. I'd recommend changing the solver if anything. I'm sure there's easier ways, but one thing you could try is adding another field to the end of createFields.H, such as: Code:
volSymmTensorField R ( IOobject ( "R", runTime.timeName(), mesh, IOobject::NO_READ IOobject::AUTO_WRITE ), turbulence->R() ); Code:
R = turbulence->R(); Quote:
Quote:
Good luck! -dave |
||||
September 9, 2010, 02:59 |
|
#4 | |
New Member
yafuji aki
Join Date: Jul 2010
Location: Japan
Posts: 14
Rep Power: 16 |
I am so sorry to be late that I could not reply you sooner,
because I attended a training camp... Dear nima, Thank you for letting me know good references on the wiki. I am not clear about hierarchy of codes yet, but I'll try to read the reference until I figure it out. Dear dave, Thank you very much for all the advices and help you gave me!! Your advices become informative guide to understand OpenFOAM! I tried to modify the code based on your guide, some additional questions are popped up. May I also know more about the way for data output? It would make me very happy if you gave me more advices. Q1. Quote:
But, R file is written at each time step. (Other files such as p and U are written at constant 'writeInterval' time step. On the other hand, although 'writeInterval' = 0.001, every folders such as '0.000119048', '0.000260204', '0.000428132'... are created and only R files are stored in them. ) If possible, please let me know if you can help in some other way to write R files at constant 'writeInterval' time step, similar to other files such as p and U. Q2. Now I am using the standard kEpsilon solver. The rate of turbulence energy production is defined in the 217 line from the top in /src/turbulenceModels/incompressible/RAS/kEpsilon/kEpsilon.C as 'G', Code:
00217 volScalarField G("RASModel::G", nut_*2*magSqr(symm(fvc::grad(U_)))); It would be very helpful if you could give me some advices! aki |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
lift and drag on ship superstructures | vaina74 | OpenFOAM Running, Solving & CFD | 3 | June 8, 2010 13:30 |
CCOSILAB -- output data in Excel Format | carlie | Main CFD Forum | 0 | June 9, 2005 17:11 |
transiant simualtion, data output | danny | FLUENT | 2 | November 19, 2004 22:31 |
Help with DPM UDF for OUTPUT needed | Zhengcai Ye | FLUENT | 0 | January 5, 2004 17:58 |
where is output data file[PHOENICS] | DSF | Siemens | 0 | May 30, 2000 12:49 |