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

GeometricField read

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 4, 2018, 12:48
Default GeometricField read
  #1
New Member
 
Mohammad Najafi
Join Date: Oct 2017
Posts: 11
Rep Power: 8
mnajafi is on a distinguished road
Hi
After hour of search and find no solution I'm going to ask this question. There is for sure similar questions in the forum but I didn't find them.
I want to read a GeometricField, say p, from time folders in a loop. Following program works but it's not a good solution of course:
Code:
     label endTimeIndex=std::floor(runTime.endTime().value()/runTime.deltaTValue());
    for (int j=0;j<=endTimeIndex;j++)
    {
        volScalarField p
        (
            IOobject
            (
                 "p",
                 runTime.timeName(),
                 mesh,
                 IOobject::MUST_READ,
                 IOobject::AUTO_WRITE
           ),
           mesh
        );
        
        Info<<runTime.timeName()<<endl;
        Info<<"p:"<<endl<<p<<endl;
        runTime++;
    }
I was looking for an option like p.readFields() or p.readIfPresent() (which are established by constructors of GeometricField) to avoid redefinition of p in each loop. But these members are private and they are not accessible from main. What shall I do?
Thanks

Last edited by mnajafi; May 4, 2018 at 13:56.
mnajafi 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 manipulation] Importing Multiple Meshes thomasnwalshiii OpenFOAM Meshing & Mesh Conversion 18 December 19, 2015 18:57
[Commercial meshers] fluentMeshToFoam multidomain mesh conversion problem Attesz OpenFOAM Meshing & Mesh Conversion 12 May 2, 2013 10:52
999999 (../../src/mpsystem.c@1123):mpt_read: failed:errno = 11 UDS_rambler FLUENT 2 November 22, 2011 09:46
Problem in running ICEM grid in Openfoam Tarak OpenFOAM 6 September 9, 2011 17:51
Error Fluents TDL FLUENT 6 April 26, 2005 06:02


All times are GMT -4. The time now is 21:05.