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

Probe for X or Y velocity

Register Blogs Community New Posts Updated Threads Search

Like Tree4Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 10, 2006, 04:30
Default Can someone please share with
  #1
Senior Member
 
Srinath Madhavan (a.k.a pUl|)
Join Date: Mar 2009
Location: Edmonton, AB, Canada
Posts: 703
Rep Power: 21
msrinath80 is on a distinguished road
Can someone please share with me the code to monitor velocity (either U or V) as the solution progresses. I know this is done using the probe utility. However, I would prefer if someone can show me the code. I'm using the incompressible icoFoam solver.

Thanks a lot!
msrinath80 is offline   Reply With Quote

Old   May 10, 2006, 06:02
Default That depends on whether you wa
  #2
Senior Member
 
Eugene de Villiers
Join Date: Mar 2009
Posts: 725
Rep Power: 21
eugene is on a distinguished road
That depends on whether you want the data to be written to screen or to a file. If you want it written to file, check the implementation in oodles. If you want it written to the standard out, see below.

Put this before your time loop:

/******************************************/
IOdictionary pLocs
(
IOobject
(
"probeLocations",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
);
const pointField& probeLocations(pLocs.lookup("probeLocations"));

labelList probeCells(probeLocations.size(), -1);

forAll(probeLocations, pI)
{
probeCells[pI] = mesh.findCell(probeLocations[pI]);
}
/******************************************/

And then put the following at the end inside your time loop:

/*******************************************/
forAll(probeCells, pI)
{
if(probeCells[pI] != -1)
{
label cellNo = probeCells[pI];
Pout << pI << ". Location: "
<< probeLocations[pI]
<< ", cell no.: " << cellNo
<< ", U: " << U[cellNo]
<< ", p: " << p[cellNo]
//add any other fields here
<< endl;
}
}

/*******************************************/

Put the probe locations in the constant/probeLocations dictionary as per usual.

Note the code hasn't been tested so there might be bugs.
eugene is offline   Reply With Quote

Old   May 10, 2006, 06:09
Default Thanks very much Eugene. I fee
  #3
Senior Member
 
Srinath Madhavan (a.k.a pUl|)
Join Date: Mar 2009
Location: Edmonton, AB, Canada
Posts: 703
Rep Power: 21
msrinath80 is on a distinguished road
Thanks very much Eugene. I feel ashamed. I just went and included Probe.H and createProbes.H in my icoFoam.C followed by a reference to writeprobes.H after the runTime.write(); (i.e. # include "writeProbes.H"). Then I created a probeLocations inside the constant sub-directory. That was all. Follow that with a wclean && wmake to rebuild icoFoam and when I run my case, it neatly creates a probes subdirectory with velocity and pressure data at my selected point.

I thank you guys a lot for being so patient with n00bs. Thanks and keep up the good work!
msrinath80 is offline   Reply With Quote

Old   August 2, 2007, 23:05
Default Eugene, Many thanks for your
  #4
Member
 
Quinn Tian
Join Date: Mar 2009
Posts: 62
Rep Power: 17
qtian is on a distinguished road
Eugene,
Many thanks for your code. I have successfully compiled my code. For some reason, I got this error while I tried to run the application.


--> FOAM FATAL IO ERROR : problem while reading header for object probeLocations

file: /home/qtian/OpenFOAM/qtian-1.4/run/tutorials/simpleFoam/bumpkom2/constant/probeL ocations at line 1.

From function regIOobject::readStream(const word&)
in file db/regIOobject/regIOobjectRead.C at line 75.

FOAM exiting

I know it must be something wrong with the probeLocations file format.

Here is probeLocations file format.

(
0.01 0.10 0.000
0.01 0.15 0.000
0.01 0.2 0.000
)

Is there any other way to read the probe points location? Thanks for your help.
Best

QT
qtian is offline   Reply With Quote

Old   August 3, 2007, 11:53
Default OpenFOAM 1.4 has probe functio
  #5
Senior Member
 
Srinath Madhavan (a.k.a pUl|)
Join Date: Mar 2009
Location: Edmonton, AB, Canada
Posts: 703
Rep Power: 21
msrinath80 is on a distinguished road
OpenFOAM 1.4 has probe functionality inbuilt. Define your probe points in controlDict.
james.conger likes this.
msrinath80 is offline   Reply With Quote

Old   August 6, 2007, 11:05
Default Dear Srinath, Could you tel
  #6
Member
 
Flavio Galeazzo
Join Date: Mar 2009
Location: Karlsruhe, Germany
Posts: 34
Rep Power: 18
flavio_galeazzo is on a distinguished road
Dear Srinath,

Could you tell what are the keywords one have to write to the controlDict to activate the inbuilt probe functionality?

Thanks
flavio_galeazzo is offline   Reply With Quote

Old   August 6, 2007, 11:19
Default Please use the 'Search' option
  #7
Senior Member
 
Srinath Madhavan (a.k.a pUl|)
Join Date: Mar 2009
Location: Edmonton, AB, Canada
Posts: 703
Rep Power: 21
msrinath80 is on a distinguished road
Please use the 'Search' option in future. Thanks!

Quoting Eugene from an eariler post:

Activate probes by adding the following to the end of your controlDict:

functions
(
probes1
{
type probes;

functionObjectLibs ("libsampling.so");

//dictionary probesDict;

region region0;

probeLocations
(
(0.710 -0.730 0.829)
(0.710 -0.757 0.763)
(0.855 -0.714 0.881)
(0.855 -0.748 0.805)
(0.855 -0.774 0.735)
(1.000 -0.695 0.932)
(1.000 -0.754 0.805)
(1.000 -0.779 0.735)
(1.350 -0.651 1.030)
(1.350 -0.740 0.862)
);

fields
(
p
U
);
}
)

Reference: http://www.cfd-online.com/OpenFOAM_D...es/1/4350.html
amir.mofakham likes this.
msrinath80 is offline   Reply With Quote

Old   August 7, 2007, 11:45
Default Dear Srinath, Thank you for
  #8
Member
 
Flavio Galeazzo
Join Date: Mar 2009
Location: Karlsruhe, Germany
Posts: 34
Rep Power: 18
flavio_galeazzo is on a distinguished road
Dear Srinath,

Thank you for the prompt reply.

Just a correction. The last parenthesis have to be followed by a ";", or the function doesn't work.

flga
amir.mofakham likes this.
flavio_galeazzo is offline   Reply With Quote

Old   May 22, 2009, 00:51
Default surface patch instead of probelocations
  #9
Member
 
santhosh
Join Date: Apr 2009
Location: India
Posts: 70
Rep Power: 17
santoo_cfd is on a distinguished road
Hi,

Can we use any surface patch instead of writing probeLocation explicitly. I need this to calculate surface averaged quantity(vertex averaged) at the outlet patch in case of RTD calculations.

The following is not working.

functions
(
RTD
{
type probes;
functionObjectLibs ("libsampling.so");
setFormat gnuplot;
surfaceFormat raw;

probeLocations
(
patches (outflow)
);
fields (T);
}
);

Thanks
Santhosh..
santoo_cfd is offline   Reply With Quote

Old   August 17, 2009, 05:40
Default patchAverage
  #10
Member
 
santhosh
Join Date: Apr 2009
Location: India
Posts: 70
Rep Power: 17
santoo_cfd is on a distinguished road
I started again looking at the answer for the above problem.

Finally I could find that patchAverage utility can do the required operation.

Now the problem is patchAverage cannot be used for runTime calucation, i.e., patchAverage cannot write the output at each time step similar to probes utility. I am trying to modify it so that it will output average of a patch at each time step.

If anybody already done that please reply.

Regards
santhosh
santoo_cfd is offline   Reply With Quote

Old   August 17, 2009, 11:22
Default
  #11
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by santoo_cfd View Post
I started again looking at the answer for the above problem.

Finally I could find that patchAverage utility can do the required operation.

Now the problem is patchAverage cannot be used for runTime calucation, i.e., patchAverage cannot write the output at each time step similar to probes utility. I am trying to modify it so that it will output average of a patch at each time step.

If anybody already done that please reply.
Yes. It has been done. Have a look at http://openfoamwiki.net/index.php/Co...unctionObjects and the (note the original name) patchAverage-functionObject

Bernhard
gschaider is offline   Reply With Quote

Old   August 18, 2009, 01:17
Smile
  #12
Member
 
santhosh
Join Date: Apr 2009
Location: India
Posts: 70
Rep Power: 17
santoo_cfd is on a distinguished road
Thanks Bernhard,

That is exactly what I want. Actually I was able to change the solver to do the required operation. But this utility is much more robust and generic.

Thanks a lot

--santoo..
santoo_cfd is offline   Reply With Quote

Old   August 18, 2009, 01:52
Default
  #13
Member
 
santhosh
Join Date: Apr 2009
Location: India
Posts: 70
Rep Power: 17
santoo_cfd is on a distinguished road
Bernhard

Little help, May be I am doing simple mistake.

I successfully compiled simpleFunctionObject and could able to see it in USER_LIBBIN.

But, when I included function object in system dictionary as following,

functions
(
RTD
{
type patchAverage ;
functionObjectsLibs ("libsimpleFunctionObjects.so");
verbose true;
patches
(
outflow
);
factor 1;
}
);



I got following error,

Unknown function type patchAverage

Table of functionObjects is empty


From function functionObject::New(const word& name, const Time&, const dictionary&)
in file db/functionObjects/functionObject/functionObject.C at line 74.

FOAM exiting


--santosh
santoo_cfd is offline   Reply With Quote

Old   August 18, 2009, 02:12
Default
  #14
Member
 
santhosh
Join Date: Apr 2009
Location: India
Posts: 70
Rep Power: 17
santoo_cfd is on a distinguished road
It is working now,

I added following in controlDict (change is addition of fields to it)

functions
(
RTD
{
type patchAverage;
functionObjectLibs ("libsimpleFunctionObjects.so");
fields ( T );
patches ( outflow );
verbose true;
factor 1;
}
);

-santhosh
santoo_cfd is offline   Reply With Quote

Old   August 18, 2009, 03:59
Default
  #15
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by santoo_cfd View Post
It is working now,

I added following in controlDict (change is addition of fields to it)
Strange. Your previous example should have failed with an error about that missing (not with an empty table)
gschaider is offline   Reply With Quote

Old   August 18, 2009, 06:21
Default
  #16
Member
 
santhosh
Join Date: Apr 2009
Location: India
Posts: 70
Rep Power: 17
santoo_cfd is on a distinguished road
I too felt the same.

I came to know about adding field after running in openFOAM 1.5 version. I feel the problem is with 1.6 version. It may be printing wrong error messages/Error messages are misplaced in code.

-santhosh
santoo_cfd is offline   Reply With Quote

Old   August 18, 2009, 08:46
Default Confused...
  #17
Senior Member
 
Sandy Lee
Join Date: Mar 2009
Posts: 213
Rep Power: 18
sandy is on a distinguished road
There is always different response ...

Last edited by sandy; August 18, 2009 at 19:33.
sandy is offline   Reply With Quote

Old   August 18, 2009, 08:47
Default
  #18
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by santoo_cfd View Post
I too felt the same.

I came to know about adding field after running in openFOAM 1.5 version. I feel the problem is with 1.6 version. It may be printing wrong error messages/Error messages are misplaced in code.
Question: You used different sources for 1.5 and 1.6 (the 1.5 version of the simpleFunctionObjects will not compile on 1.6 so this leads me to the suspicion that they were not there at all)

Bernhard
gschaider is offline   Reply With Quote

Old   August 18, 2009, 09:50
Default
  #19
Member
 
santhosh
Join Date: Apr 2009
Location: India
Posts: 70
Rep Power: 17
santoo_cfd is on a distinguished road
I have two machines one with 1.5 version and another 1.6 version..

I have compiled respective simpleObjects on different machines as given at
http://openfoamwiki.net/index.php/Co...unctionObjects.

(there both simpleObject utility for 1.5 and 1.6 versions are available)

The error I got in 1.6 machine is regarding "Table Empty"
The error I got in 1.5 machine is regarding "missing field"

hope I am clean now.

--santoo..


santoo_cfd is offline   Reply With Quote

Old   August 19, 2009, 04:04
Default
  #20
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by santoo_cfd View Post
I have two machines one with 1.5 version and another 1.6 version..

I have compiled respective simpleObjects on different machines as given at
http://openfoamwiki.net/index.php/Co...unctionObjects.

(there both simpleObject utility for 1.5 and 1.6 versions are available)

The error I got in 1.6 machine is regarding "Table Empty"
The error I got in 1.5 machine is regarding "missing field"

hope I am clean now.

--santoo..


If it is not in the table, then the problem is that OpenFOAM can't find it. So do a wclean on the 1.6-version of the sources (I can't stress enough that the 1.5-version won't compile on 1.6) and make a "wmake libso" on them again. Lookout for an error. If there is
- no error
- it still doesn't work
- the library is found in $FOAM_USER_LIBBIN
try using another functionObject (probe for instance) with that case (because I only take responsibility after the simpleFunctionObjects are loaded into the runtime-selection-table )

Bernhard
gschaider 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
Probe problem nzy102 OpenFOAM Running, Solving & CFD 1 April 14, 2008 01:16
Probe or something else to monitor hoerl OpenFOAM Running, Solving & CFD 2 January 15, 2007 06:04
I can not use the probe in the Paraview ztdep OpenFOAM Running, Solving & CFD 6 November 30, 2006 03:22
probe hydrogen CFX 2 May 22, 2006 11:59
problem with probe Yolanda CFX 0 May 17, 2006 06:27


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