|
[Sponsors] |
October 8, 2020, 16:08 |
Extract Ux, Uy, Uz of U Field
|
#1 |
New Member
Sebastian
Join Date: Apr 2019
Location: Germany
Posts: 12
Rep Power: 7 |
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; } Code:
44:4: error: ‘class Foam::IOobject’ has no member named ‘component’ U.component(vector::Z) Best regards |
|
October 9, 2020, 04:04 |
|
#2 |
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,715
Rep Power: 40 |
Looks like you might just want the components function object anyhow
https://www.openfoam.com/documentati...omponents.html |
|
October 9, 2020, 06:36 |
|
#3 |
New Member
Sebastian
Join Date: Apr 2019
Location: Germany
Posts: 12
Rep Power: 7 |
Sry, but that doesn't help me.
Do I forgot to include a file? |
|
October 9, 2020, 11:39 |
|
#4 |
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,715
Rep Power: 40 |
||
October 9, 2020, 12:06 |
|
#5 |
New Member
Sebastian
Join Date: Apr 2019
Location: Germany
Posts: 12
Rep Power: 7 |
Thanks a lot. It works. Sometimes it is not easy to find such small mistakes.
I wish you a nice weekend. |
|
Tags |
components |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
funkySetBoundaryFields - Manipulation of existing field | jhertel | OpenFOAM Pre-Processing | 16 | May 18, 2020 07:32 |
field read after each Time Step | johanning | OpenFOAM Programming & Development | 1 | December 29, 2019 08:59 |
Access to field which is evaluated at the moment | Tobi | OpenFOAM Programming & Development | 6 | April 19, 2017 14:09 |
''unknown radialModelType type Gidaspow'' PROBLEM WITH THE BED TUTORIAL | AndoniBM | OpenFOAM Running, Solving & CFD | 2 | March 25, 2015 19:44 |
Extract velocity field in certain time step to MATLAB | spatialtime | CFX | 3 | September 9, 2009 19:30 |