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

How can I write out a volscalarfield in openFOAM

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 27, 2013, 12:38
Default How can I write out a volscalarfield in openFOAM
  #1
New Member
 
Join Date: Feb 2012
Posts: 25
Rep Power: 14
Marshak is on a distinguished road
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.
Marshak is offline   Reply With Quote

Old   August 28, 2013, 02:32
Default
  #2
Member
 
Hrushi
Join Date: Jan 2013
Posts: 58
Rep Power: 13
hrushi.397 is on a distinguished road
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
hrushi.397 is offline   Reply With Quote

Old   August 29, 2013, 05:53
Default
  #3
New Member
 
Join Date: Feb 2012
Posts: 25
Rep Power: 14
Marshak is on a distinguished road
'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.
Marshak is offline   Reply With Quote

Old   August 29, 2013, 14:10
Default
  #4
Senior Member
 
mkraposhin's Avatar
 
Matvey Kraposhin
Join Date: Mar 2009
Location: Moscow, Russian Federation
Posts: 355
Rep Power: 21
mkraposhin is on a distinguished road
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()
mkraposhin is offline   Reply With Quote

Reply


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
mesh file for flow over a circular cylinder Ardalan Main CFD Forum 7 December 15, 2020 13:06
output or write of tensorField in ascii format in openFoam safre OpenFOAM Installation 0 November 7, 2011 08: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 05:51
How to Install OpenFOAM on 64 Ubuntu 9.04 hansel OpenFOAM Installation 62 March 19, 2010 14:43
OpenFOAM Training in Europe and USA hjasak OpenFOAM 0 August 8, 2008 05:33


All times are GMT -4. The time now is 17:02.