|
[Sponsors] |
How can I write out a volscalarfield in openFOAM |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
August 27, 2013, 13:38 |
How can I write out a volscalarfield in openFOAM
|
#1 |
New Member
Join Date: Feb 2012
Posts: 25
Rep Power: 14 |
I am trying to write out a volscalarfield 'a'. I define it in the library as follows
tmp<volScalarField> ta ( new volScalarField ( IOobject ( "a", mesh().time().timeName(), mesh(), IOobject::NO_READ, IOobject::AUTO_WRITE ), mesh(), dimensionedScalar("a", dimless/dimLength, 0.0) ) ); In the solve, in createFileds.H, i define it as volScalarField a ( IOobject ( "a", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE ), mesh, dimensionedScalar("a", dimensionSet(0,-1,0,0,0,0,0), 0.0) ); But when I save field data for a given time step the it does create a file 'a' but there are no values and instead for each bounday patch it is written : internalField uniform 0; boundaryField { boundary1 { type calculated; value uniform 0; } } can someone tell me how to write out any volscalarfield. |
|
August 28, 2013, 03:32 |
|
#2 |
Member
Hrushi
Join Date: Jan 2013
Posts: 58
Rep Power: 13 |
Why define two a's separately? Can you not define a separate variable for dimensionless a?
It looks like your a is not changing during simulation. Check that too |
|
August 29, 2013, 06:53 |
|
#3 |
New Member
Join Date: Feb 2012
Posts: 25
Rep Power: 14 |
'a' is a dimensioned variable. I also have defined it as
AUTO-WRITE in the code and removed it from createfields.H but it is still not writting for each time step. |
|
August 29, 2013, 15:10 |
|
#4 |
Senior Member
Matvey Kraposhin
Join Date: Mar 2009
Location: Moscow, Russian Federation
Posts: 355
Rep Power: 21 |
1) If you don't want to read field from the file, then you must specify it's boundary types in constructor
2) volScalarField is a typedef for the GeomtricField<scalar, fvPatchScalarField, fvMesh>, full list of constructors you can find here 3) If you want to write your field at the each time step, you must call a.write() |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
mesh file for flow over a circular cylinder | Ardalan | Main CFD Forum | 7 | December 15, 2020 14:06 |
output or write of tensorField in ascii format in openFoam | safre | OpenFOAM Installation | 0 | November 7, 2011 09:08 |
OpenFOAM 1.6.x, 1.7.0 and 1.7.x are not fully prepared to work with gcc-4.5.x | wyldckat | OpenFOAM Bugs | 18 | October 21, 2010 06:51 |
How to Install OpenFOAM on 64 Ubuntu 9.04 | hansel | OpenFOAM Installation | 62 | March 19, 2010 15:43 |
OpenFOAM Training in Europe and USA | hjasak | OpenFOAM | 0 | August 8, 2008 06:33 |