How can I write out a volscalarfield in openFOAM
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. |
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 |
'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. |
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() |
All times are GMT -4. The time now is 16:13. |