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

How can I write out a volscalarfield in openFOAM

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools 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: 5
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: 57
Rep Power: 4
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: 5
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
 
Matvej Kraposhin
Join Date: Mar 2009
Location: Moscow, Russian Federation
Posts: 172
Rep Power: 8
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

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
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 05:51
mesh file for flow over a circular cylinder Ardalan Main CFD Forum 6 April 17, 2010 23:40
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 05:33


All times are GMT -4. The time now is 01:58.