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

IOobject

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 5, 2016, 08:16
Default
  #1
New Member
 
Wang Wei
Join Date: Apr 2016
Posts: 11
Rep Power: 10
Wang Wei is on a distinguished road
Quote:
Originally Posted by r2d2 View Post
Hi Guys,
If I created an array of volScalarFields with this syntax:

PtrList<volscalarfield> fields(2);
for (int i =0; i<2; i++)
{
word fieldName = "field" + Foam::name(i);
Info<< "Reading field " << fieldName<< endl;
fields.hook(
volScalarField
(
IOobject
(
fieldName,
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
)
);

}

and then I solve some equation for these (two fields for now), at runtime

runTime.write();
won´t print out these field values? Am I doing something wrong?
Cheers,
Radu
Hi! Radu, I also want to use PtrList, but what's the meaning of this line,

word fieldName = "field" + Foam::name(i);

Thank you!
Wang Wei 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
A question on IOObject ivan_cozza OpenFOAM 0 September 16, 2008 03:24
Create GeometricField without IOobject nadine OpenFOAM Running, Solving & CFD 3 August 15, 2008 09:24
IOobject and IOfield in OpenFoam xiao OpenFOAM Running, Solving & CFD 0 April 2, 2008 21:56
Use of IOobject to Output irishdave OpenFOAM Pre-Processing 1 January 8, 2008 11:12
IOobject constructor problem iyer_arvind OpenFOAM Running, Solving & CFD 3 November 19, 2006 06:39


All times are GMT -4. The time now is 10:43.