CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Post-Processing

postProcess functionality in openFOAM 4

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

Like Tree18Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 15, 2016, 03:46
Default postProcess functionality in openFOAM 4
  #1
Member
 
Gareth
Join Date: Jun 2010
Posts: 56
Rep Power: 16
bullmut is on a distinguished road
Hi All

I am switching to openFOAM 4 from 2.3.1
Currently working on the postProcess utility. I have run the motorbike tutorial to get a understanding on the new syntax. I then disabled the #inlcude files in the controlDict. I did this to try and run those files through the postProcess utility. I had sucess with
"streamlines" -
Code:
postProcess -func streamLines
and
"cuttingPlane" -
Code:
postProcess -func cuttingPlane
However
"forceCoeffs" -
Code:
postProcess -func forceCoeffs
and
"wallBoundedStreamLines" -
Code:
postProcess -func wallBoundedStreamLines
wont work directly.
so this is a two part question. Can anyone explain why these files wont work through this utility? In the case of the the forceCoeffs file i get the following error:
Code:
--> FOAM FATAL ERROR: 
Could not find U, p
and for the wallBoundedStreamLines, the error that pops up revolves around it not seeing a UNear field in the time folder.
Code:
--> FOAM FATAL ERROR: 
Cannot find field UNear
Valid scalar fields are:
2
(
k
p
)

Valid vector fields are:1(U)
But within the file itself it asks OF to make the UNear field.
So i then tried to run the nearWallField section of the file alone. I have not altered the file in anyway, i cut the one dictionary out form the original wallBoundedStreamLines file, and ran the code attached and got the following error
Code:
--> FOAM FATAL IO ERROR: 
wrong token type - expected word, found on line 19 the punctuation token '('

file: /home/erfort/OpenFOAM/erfort-4.0/tutorials/incompressible/simpleFoam/motorBike/system/near.near.fields at line 19.

    From function Foam::Istream& Foam::operator>>(Foam::Istream&, Foam::word&)
    in file primitives/strings/word/wordIO.C at line 74.

FOAM exiting
Then i removed the brackets around the field specification and got this...

Code:
--> FOAM FATAL IO ERROR: 
Expected a '(' while reading Tuple2, found on line 19 the word 'U'

file: /home/erfort/OpenFOAM/erfort-4.0/tutorials/incompressible/simpleFoam/motorBike/system/near.near.fields at line 19.

    From function Foam::Istream& Foam::Istream::readBegin(const char*)
    in file db/IOstreams/IOstreams/Istream.C at line 92.
Any advice on what is going on? I have read through the documentation with no success. Am i using this utility right? If the file has more than one subdictionary (like in wallboundedStreamLines) should i change the command line? How come forcesCoeff doesnt see fields that are present in the time directory?
I look forward to the replies

Regards
Attached Files
File Type: txt near.txt (527 Bytes, 71 views)
bullmut is offline   Reply With Quote

Old   August 18, 2016, 08:14
Default
  #2
New Member
 
igor.leo93's Avatar
 
Igor Leonardo
Join Date: Jul 2016
Location: Brazil - SP - SJC
Posts: 20
Rep Power: 10
igor.leo93 is on a distinguished road
Hello

Take a look here:
http://cfd.direct/openfoam/user-guid...#x31-2270006.2

For the first function, try this :

postProcess -fields "(p U)" -func forceCoeffs

About that second one i'm not sure, but i will take a look at it later.

Regards,
Igor Carvalho
lincui, purnp2 and saladbowl like this.
igor.leo93 is offline   Reply With Quote

Old   August 18, 2016, 08:36
Default
  #3
Member
 
Gareth
Join Date: Jun 2010
Posts: 56
Rep Power: 16
bullmut is on a distinguished road
Hi Igor

Thanks for the reply,
I tried using the line you suggested, it now reads the fields , but got the following reply

Code:
--> FOAM FATAL ERROR: 
No valid model for viscous stress calculation
    From function Foam::tmp<Foam::GeometricField<Foam::SymmTensor<double>, Foam::fvPatchField, Foam::volMesh> > Foam::functionObjects::forces::devRhoReff() const
I noticed at the post you directed me to, was the built in fucntion file for forcecoeffs.
I then ran the following line
Code:
postProcess -func 'forcesIncompressible('bladeBot',p,U)'
And got the same error. so i think i need to add into my fvSchemes file a definition for "devRhoReff", correct?

Full output in attachment

Regards
Attached Files
File Type: txt out.txt (2.1 KB, 55 views)
bullmut is offline   Reply With Quote

Old   August 18, 2016, 09:12
Default
  #4
New Member
 
igor.leo93's Avatar
 
Igor Leonardo
Join Date: Jul 2016
Location: Brazil - SP - SJC
Posts: 20
Rep Power: 10
igor.leo93 is on a distinguished road
Hello

Well i'm not quite sure my friend.
I never had to use that function before so i can't say for sure, but i think that is correct, try that.
Let us know if it works.

Regards
igor.leo93 is offline   Reply With Quote

Old   September 4, 2016, 13:45
Default
  #5
Member
 
Gareth
Join Date: Jun 2010
Posts: 56
Rep Power: 16
bullmut is on a distinguished road
solution... READ THE USER GUIDE.
So while i have read the user guide more than once, they tend to update along with the openFOAM versions.
The solution to my problem was to add the solver info.
Code:
simpleFoam -postProcess -func 'forces' -latestTime
The solver then provides field information as well as turbulence model.

Had i read the book... i would see said answer.
Thanks Igor for the help though. Each step counts!

Hope this helps someone eventually
bullmut is offline   Reply With Quote

Old   September 4, 2016, 13:56
Default
  #6
New Member
 
igor.leo93's Avatar
 
Igor Leonardo
Join Date: Jul 2016
Location: Brazil - SP - SJC
Posts: 20
Rep Power: 10
igor.leo93 is on a distinguished road
Yeah nice.
Now that i look at the error you were getting i realize that the solver info was needed, it is good habit perhaps, to also use the solver info on all functions for postprocessing.

Best regards,
Igor
igor.leo93 is offline   Reply With Quote

Old   September 21, 2016, 03:42
Default How to specify patch name
  #7
New Member
 
Dan Nielsen
Join Date: Mar 2014
Posts: 4
Rep Power: 12
Dan N is on a distinguished road
Hey All

I am trying to use the postProcess utility to calculate a patch average by using:

postProcess -func 'patchAverage'

it tells me that it needs a patch name:

surfaceRegion patchAverage: patch(<patchName>):
Unknown patch name: <patchName>. Valid patch names are:
3
(
movingWall
fixedWalls
frontAndBack
)

But it seems that i cant finde a way to specify that patch name, can anyone help me?
Dan N is offline   Reply With Quote

Old   September 21, 2016, 03:54
Default
  #8
Member
 
Gareth
Join Date: Jun 2010
Posts: 56
Rep Power: 16
bullmut is on a distinguished road
Hi Dan
After you specify the function you also need to tell it where to look.
try the following
Code:
postProcess -func "patchAverage(field,name=fixedWalls)"
The field you are interested in will be called on the patch you named
bullmut is offline   Reply With Quote

Old   September 21, 2016, 07:57
Default
  #9
New Member
 
Dan Nielsen
Join Date: Mar 2014
Posts: 4
Rep Power: 12
Dan N is on a distinguished road
Hi bullmut

Thanks it works.

Dan.
Dan N is offline   Reply With Quote

Old   November 24, 2016, 11:26
Default how to calculate grad(rho)&grad(U)
  #10
New Member
 
Join Date: May 2015
Posts: 9
Rep Power: 11
harvee is on a distinguished road
Hey all
I want to calculate the gradient of density and velocity.

Here is what I type:

postProcess -fields '(rho U)' -func 'grad'

Returns:

Reading fields:
volScalarFields: rho
volVectorFields: U

Executing funtionObjects
-->FOAM Warning : fuctionObject grad: Cannot find require field <fieldName>

anyone know how to fix it?
Thanks
harvee is offline   Reply With Quote

Old   November 24, 2016, 12:04
Default
  #11
Member
 
Gareth
Join Date: Jun 2010
Posts: 56
Rep Power: 16
bullmut is on a distinguished road
Hi Harvee

Try the line
Code:
postProcess -func "grad(U)"
It should act through the whole field and save the field to each time step.
bullmut is offline   Reply With Quote

Old   November 24, 2016, 12:16
Default
  #12
New Member
 
Join Date: May 2015
Posts: 9
Rep Power: 11
harvee is on a distinguished road
Hi bullmut
thanks for the quick reply.

I tried your code get I get this:
Executing functionObjects
--> FOAM Warning :
From function bool Foam::functionObjects::regionFunctionObject::store (Foam::word&, const Foam::tmp<T>&, bool) [with ObjectType = Foam::GeometricField<Foam::Tensor<double>, Foam::fvPatchField, Foam::volMesh>]
in file home/OpenFOAM/OpenFOAM-4.0/src/OpenFOAM/lnInclude/regionFunctionObjectTemplates.C at line 61
Cannot store cache-able field with the named used in the cache.
Either choose a different name or cache the field and use the 'writeObjects' functionObject.
--> FOAM Warning : functionObject grad: Cannot find required field U

I tried a lot of combination of fields and func ,none of them worked.

and when I try to get grad(rho), the rho file doesn't exist in my 0 folder since I'm using
rhoCentralFoam, I thought that maybe affect the searching of rho, do you know how to calculate rho for 0 folder btw?
harvee is offline   Reply With Quote

Old   November 27, 2016, 23:48
Default Lift Coeff error
  #13
New Member
 
H salem
Join Date: Nov 2016
Posts: 4
Rep Power: 9
hsalem is on a distinguished road
Hi Dear friends,
I have problem with using post processing tool. When I want to use the Force coefficient tool to find out about Cl, Cd, Cm there is problem with this type:
--> FOAM FATAL ERROR:
Could not find rho

From function void Foam::functionObjects::forces::initialise()
in file forces/forces.C at line 197.

FOAM exiting
Any idea?
this is my Code:
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Web: www.OpenFOAM.org
\\/ M anipulation |
-------------------------------------------------------------------------------
Description
Calculates lift, drag and moment coefficients by summing forces on
specified patches for a case where the solver is incompressible (pressure
is kinematic, e.g. m^2/s^2).

\*---------------------------------------------------------------------------*/
forces
{
type forces;
functionObjectLibs ("libforces.so");
writeControl timeStep;
writeInterval 10;

patches ( "airfoil.*" );
pName p;
UName U;
rhoName rhoInf;
log true;

CofR (0.25 0 0);

rhoInf 1.284;
}


forceCoeffs
{
type forceCoeffs;
functionObjectLibs ( "libforces.so" );
writeControl timeStep;
writeInterval 10;

patches ( "airfoil.*" );
pName p;
UName U;
rhoName rhoInf;
log true;

liftDir (0 1 0);
dragDir (1 0 0);
CofR (0.25 0 0);
pitchAxis (0 0 1);

magUInf 6.69;
rhoInf 1.284;
lRef 1;
Aref 1;
}
hsalem is offline   Reply With Quote

Old   November 28, 2016, 01:40
Default Calculate grad(U) & MachNo
  #14
New Member
 
Join Date: May 2015
Posts: 9
Rep Power: 11
harvee is on a distinguished road
Hey there!
grad(U) func seems can only deal one time directory once a time.
Until the bug is resolved, you can only calculate grad(U) for one time directory. You can add one of the time options, e.g -time <timeDir> or -latestTime, to select a specific time directory. For all time directories, the following will work in the meantime,make a script and put this in:

for d in $(foamListTimes) ;
do postProcess -time $d -func "grad(U)" ;
done

Additional info:

for machNo
solvername -postProcess -func MachNo

many command seems need to specify the solvername. The point about Mach number is you cannot do "pure" post-processing using data in time directories, because it also requires thermophysical models.
harvee is offline   Reply With Quote

Old   November 28, 2016, 01:44
Default
  #15
New Member
 
Join Date: May 2015
Posts: 9
Rep Power: 11
harvee is on a distinguished road
try this:
<solvername> -postProcess -func "forceCoeffsCompressible"
harvee is offline   Reply With Quote

Old   November 28, 2016, 11:23
Default
  #16
New Member
 
H salem
Join Date: Nov 2016
Posts: 4
Rep Power: 9
hsalem is on a distinguished road
Thank you harvee for your time.
your suggestion will work after the simulation is done. but I this problem doesn't let the simulation start. am I right? if not, where should I include your suggestion?
hsalem is offline   Reply With Quote

Old   November 28, 2016, 11:34
Default
  #17
New Member
 
Join Date: May 2015
Posts: 9
Rep Power: 11
harvee is on a distinguished road
Quote:
Originally Posted by hsalem View Post
Thank you harvee for your time.
your suggestion will work after the simulation is done. but I this problem doesn't let the simulation start. am I right? if not, where should I include your suggestion?
hi hsalem
Maybe I misunderstood your problem.
you're right,my case is doing some post-process after the simulation is done.
I've never used Run-time data processing.sorry I can't help you.
the only thing I can find related is on this page:http://cfd.direct/openfoam/user-guid...#x31-2270006.2
let me know if you figure it out.
harvee is offline   Reply With Quote

Old   November 28, 2016, 11:39
Default
  #18
New Member
 
H salem
Join Date: Nov 2016
Posts: 4
Rep Power: 9
hsalem is on a distinguished road
Dear Harvee,
Thank you. Yes I have found the solution. it seems that I was using the old method of finding the force coefficients. in openfooam 4, there is a package that let you use it more easily. all you need is to see the user guide section 6.2.2.
hsalem is offline   Reply With Quote

Old   January 1, 2017, 17:29
Default Gradient of Field - Gradient of Velocity in OpenFoam
  #19
New Member
 
Vijaya Kumar. G
Join Date: Jun 2016
Location: Chennai, India & Aachen, Germany
Posts: 20
Rep Power: 10
VIJAYA KUMAR is on a distinguished road
Dolution

After lots of trouble this works

I used in pimpleFoam solver. In OF4.0 it is necessary to specify the solver name

pimpleFoam -postProcess -func "grad(U)"
VIJAYA KUMAR is offline   Reply With Quote

Old   January 17, 2017, 10:14
Default
  #20
New Member
 
Join Date: Sep 2012
Posts: 13
Rep Power: 15
Endel is on a distinguished road
Helly everyone,

I am trying to calculate the rho field from a sonicFoam case.

In previous versions of OpenFOAM this was apparently possible using

Code:
execFlowFunctionObjects
as described here:

https://www.cfd-online.com/Forums/op...tml#post254920

In OF4 however, this doesn't seem to work anymore and the following message appears:

Code:
execFlowFunctionObjects has been superceded by the '-postProcess' solver command-line option

I still can't figure out how to calculate the rho field by either using the postProcess utility or the former solution above.

Any help is highly appreciated, thank you very much!
Endel is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to contribute to the community of OpenFOAM users and to the OpenFOAM technology wyldckat OpenFOAM 17 November 10, 2017 15:54
OpenFOAM Training Beijing 22-26 Aug 2016 cfd.direct OpenFOAM Announcements from Other Sources 0 May 3, 2016 04:57
OpenFOAM Foundation releases OpenFOAMŪ 3.0.0 CFDFoundation OpenFOAM Announcements from OpenFOAM Foundation 1 November 7, 2015 15:16
New OpenFOAM Forum Structure jola OpenFOAM 2 October 19, 2011 06:55
64bitrhel5 OF installation instructions mirko OpenFOAM Installation 2 August 12, 2008 18:07


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