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

Extract Ux, Uy, Uz of U Field

Register Blogs Community New Posts Updated Threads Search

 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old   October 8, 2020, 15:08
Default Extract Ux, Uy, Uz of U Field
  #1
New Member
 
Sebastian
Join Date: Apr 2019
Location: Germany
Posts: 12
Rep Power: 7
aeroBassti is on a distinguished road
Hello,

I'm Sebastian from Germany. I'm starting to write my one post-Pro-Solver. I modified a few other Solvers and wrote some post-Pro-Solvers with Vector-Field calculation. Now I need the Ux, Uy, Uz components for further calculation (radial velocity ,....). I know, that I could use postProcess, but that is not my aim. I found a few informations, but I'm not shure if they work with OF6.


My code (first try with Uz):


Code:
#include "fvCFD.H"   
#include "fvc.H"

int main(int argc, char *argv[])
{
  timeSelector::addOptions();
  #include "setRootCase.H"
  #include "createTime.H"
  #include "createMesh.H"
  instantList timeDirs = timeSelector::select0(runTime, args);

 double v=0; 
 forAll(mesh.C(),cell){v += mesh.V()[cell];}

  forAll(timeDirs, timeI)
  {
        runTime.setTime(timeDirs[timeI], timeI);
        mesh.readUpdate();

        Info << "Time = " << runTime.timeName() << endl;

    IOobject U
        (
            "U",
            runTime.timeName(),
            mesh,
            IOobject::MUST_READ
          );


    volScalarField Uz
    (
        IOobject
        (
            "Uz",
            runTime.timeName(),
            mesh,
            IOobject::NO_READ,
            IOobject::AUTO_WRITE
        ),
    U.component(vector::Z)
      );                  

    Uz.write();

    }

    
    
Info << "Volumen:" << v <<  "m3" << endl;        
Info << "finished" << endl;    
    
    return 0;
}
I get the error message:


Code:
44:4: error: ‘class Foam::IOobject’ has no member named ‘component’
  U.component(vector::Z)
I hope you can help me or can give me a hint.


Best regards
aeroBassti is offline   Reply With Quote

 

Tags
components


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
funkySetBoundaryFields - Manipulation of existing field jhertel OpenFOAM Pre-Processing 16 May 18, 2020 06:32
field read after each Time Step johanning OpenFOAM Programming & Development 1 December 29, 2019 07:59
Access to field which is evaluated at the moment Tobi OpenFOAM Programming & Development 6 April 19, 2017 13:09
''unknown radialModelType type Gidaspow'' PROBLEM WITH THE BED TUTORIAL AndoniBM OpenFOAM Running, Solving & CFD 2 March 25, 2015 18:44
Extract velocity field in certain time step to MATLAB spatialtime CFX 3 September 9, 2009 18:30


All times are GMT -4. The time now is 19:47.