CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Post-Processing (https://www.cfd-online.com/Forums/openfoam-post-processing/)
-   -   Time series of data at a point (https://www.cfd-online.com/Forums/openfoam-post-processing/61329-time-series-data-point.html)

col16 May 3, 2007 03:18

Hi everyone. I would like t
 
Hi everyone.

I would like to plot a graph of a given variable (eg U.component(0)) over time. I have tried using sample, but (at least in FoamX) it cannot use an 'axis' of time.

In other words: In post-processing, I can find the value of a variable at a given point, but sample spits it out in hundreds of folders, one for each time step. What I would like to get is one file giving data in two columns: the first being the time step, and the second being the value of the variable of interest (in the position of interest).

I have found other posts on this message board asking about a similar type of thing, but no resolution that would help me. Is there currently any capability within OpenFoam to do this? If not, would it be difficult to add in? I have done programming before, but never in C++, so doing it myself might be a bit of a challenge! :-)

Thanks a lot. I appreciate your help.
Cheers,
--cam--
Cameron

hjasak May 3, 2007 03:23

Do you want it only for the ti
 
Do you want it only for the time-steps you have written out or for every time step? You will need to use a Probe class, specifying the field (it must be calculated in the code) and a location. Depending on the version, have a look at oodles to see how this is done.

Enjoy,

Hrv

col16 May 3, 2007 03:37

Yes, sorry - I'm aware of prob
 
Yes, sorry - I'm aware of probe, but as I understand it, that needs to be set up when the simulation is carried out. I've run an oodles simulation, and used a writeInterval of 100 steps (corresponding to a time of 1e-2 seconds between writes). I would like to now plot the data from those writes over time.
--cam--

eugene May 3, 2007 05:18

The probe functions in oodles
 
The probe functions in oodles have been supersceded in 1.4 by the new functionObject class. This is a modular plugin library that evaluates every time runTime++ is called.

Function objects are instantiated by adding them to a functions subdict in the controlDict. At the moment probes is the only functionObject in the 1.4 release. 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
);
}
)

To sample these locations from an existing data set, you will have to write a very simple code to step over the existing timesteps, reading in the fields at each time and call runTime++ to activate the probes function. See "Ucomponents" as an example of how to read in existing fields for all times.

Warning: functionObjects are a beta component in that they have not been fully tested against all OpenFOAM applications and are not supported in FoamX. Most prominently, paraFoam will crash if the "functions" section is present in the controlDict, so you will have to comment it out if you want to use paraFoam.

hjasak May 3, 2007 05:24

Thanks Eugene, A slight pro
 
Thanks Eugene,

A slight problem: if I want the Ux components, I cannot just slap it into the fields list, because it does not exist as a field in the solver. Apart from that, it looks pretty.

Hrv

eugene May 3, 2007 05:36

Thank OpenCFD! The old vers
 
Thank OpenCFD!

The old version of Probes does not support this functionality either.
Extracting Ux from the probed U vector is trivial.

I am more concerned about implementing a global search routine so the probes can find the closest cell centre in a parallel environment without inter-processor conflict.

nikos May 10, 2007 10:38

Hi all, I've tried to use lib
 
Hi all,
I've tried to use libsampling.so functions from FoamX, but when I launch the solver (oodles or simpleFoam for example) I've got an error

Selecting function probes
--> FOAM Warning :
From function dlLibraryTable::open(const dictionary& dict, const word& libsEntry, const TablePtr tablePtr)
in file lnInclude/dlLibraryTableTemplates.C at line 67
library "libsampling.so" did not introduce any new entries

probes directory is created at time step but there is nothing in the file. the points are well inside the computational domain.

solvers are compiled with -lsampling as options
maybe I've done something wrong

thank you for advance
nicolas

msrinath80 June 2, 2007 02:51

I have faced a similar problem
 
I have faced a similar problem. I tried to solve it, but was unsuccessful. As a result, I copied the relevant probe functionality from oodles in OF 1.3 into the icoFoam solver. It works perfectly now!

christian July 12, 2007 06:38

To run paraFoam, the "function
 
To run paraFoam, the "functions" section with the probes I've defined needs to be commented out in the controlDict file. My problem is the following, at the same time my case runs I want to look at the results obtained so far using paraFoam. But to do that I need to comment out the "functions" section with my probes. This way I will loose probe data during the time I run paraView. This is not an option. Anyone with a solution to the problem?

Best regards,
Christian Svensson

msrinath80 July 12, 2007 08:44

Do exactly what I did. Copy th
 
Do exactly what I did. Copy the relevant functionality from oodles. I've modified the transientSimpleFoam and icoFoam solvers to do this. For a sample code with probe functionality, check the following solver:

http://www.ualberta.ca/~madhavan/icoFoam.tar.bz2

gschaider July 12, 2007 09:18

@christian: A simple hack: for
 
@christian: A simple hack: for a case example create a directory besides it called example.mirror in that directory create symbolic links for every directory in the original pointing to the original of the same name (for instance example.mirror/constant points to example/constant) EXCEPT for the system-direcory. For system you create a copy. In the controlDict of the copy remove the probes-entry.

Now
paraFoam . example.mirror
should be possible and not interrupt the calculation in example. Of course: new directories created in the meantime won't be visible.

You can create a script for the procedure described above

sradl July 30, 2007 03:13

Hi Eugene & Hrvoje, regardi
 
Hi Eugene & Hrvoje,

regarding the new probing via the functionObject class:

I'd like to run a multimesh programm (conjugate Heat transfer) and the libsampling.so asks for "region0" when it tries to sample data. However, I've a region called "fluidRegion" from which I want to sample data.

Now it would be nice if I can specify the region that has to be probed.

I'm thinking about adding this functionality to my libsampling.so as it is a nice implementation. However, I'm not sure if this is not already done: in the constructor in the file "probesFunctionObject.C" the programm is looking for a keyword "region". However, I don't know where to specify my region to be probed.

Can you provide any hint how to point the solver to probe a specific region?

br
Stefan Radl

hjasak July 30, 2007 03:21

Easy: go to the dictionary for
 
Easy: go to the dictionary for the function object in system/controlDict and add:

region fluidRegion;



For example:


functions
(
probes1
{
// Type of functionObject
type probes;

region fluidRegion;

// Where to load it from (if not already in solver)
functionObjectLibs ("libsampling.so");

// Locations to be probed. runTime modifiable!
probeLocations
(
(0.0254 0.0253 0.0)
(0.0508 0.0253 0.0)
(0.0762 0.0253 0.0)
(0.1016 0.0253 0.0)
(0.1270 0.0253 0.0)
(0.1524 0.0253 0.0)
(0.1778 0.0253 0.0)
);

// Fields to be probed. runTime modifiable!
fields
(
p
);

);

}

Hrv

sradl July 30, 2007 04:11

Thanks! I knew it is that s
 
Thanks!

I knew it is that simple... :-)

br
Stefan

ville August 13, 2007 08:50

Hi, I tried to set a probe in
 
Hi,
I tried to set a probe in OF-1.4.1
as explained here using:

functions
(
probes1
{
type probes;
functionObjectLibs("libsampling.so");

probeLocations
(
(0 0 0.01)
);

fields
(
p
U
);
}
);



When starting a case using e.g.
Xoodles the problem is:


--> FOAM FATAL IO ERROR : ill defined primitiveEntry starting at keyword 'functions' on line 60 and ending at line 81

file: /home/vavuorin/OpenFOAM/vavuorin-1.4.1/run/tests/mtot0075mg_D0300_U110/system/co ntrolDict at line 81.

From function primitiveEntry::readData(Istream& is)
in file db/dictionary/primitiveEntry/primitiveEntryIO.C at line 97.

FOAM exiting



What is the problem? How should I modify Xoodles
to make this work?


-Ville

ville August 17, 2007 06:56

Hi, Using PROBES in OF-1.4 and
 
Hi, Using PROBES in OF-1.4 and 1.4.1 works differently in comparison to earlier versions.
The channelOodles case works nicely but when
I try to use probe for other cases like Xoodles
it does not work anymore.

So...could someone comment on the following problem:

I tried to set a probe in OF-1.4.1
as explained here by adding a dictionary to
controlDict:

functions
(
probes1
{
type probes;
functionObjectLibs("libsampling.so");

probeLocations
(
(0 0 0.01)
);

fields
(
p
U
);
}
);



When starting a case using e.g.
Xoodles the problem is:


--> FOAM FATAL IO ERROR : ill defined primitiveEntry starting at keyword 'functions' on line 60 and ending at line 81

file: /home/vavuorin/OpenFOAM/vavuorin-1.4.1/run/tests/mtot0075mg_D0300_U110/system/co ntrolDict at line 81.

From function primitiveEntry::readData(Istream& is)
in file db/dictionary/primitiveEntry/primitiveEntryIO.C at line 97.

FOAM exiting



What is the problem? How should I modify Xoodles
to make this work?

Regards,
Ville

msrinath80 August 22, 2007 13:29

Ville, You can modify Xoodles
 
Ville, You can modify Xoodles source code to do this for you directly.

Just after #include "OFstream.H"

add the following line:
#include "Probe.H"

And then just before
Info<< "\nStarting time loop\n" << endl; add the following line:

#include "createProbes.H"


Finally, after
#include "writeNaveragingSteps.H"

add the following line:
#include "writeProbes.H"

Now after saving Xoodles.C,

create the file writeProbes.H with the following contents:

UProbe.write();
pProbe.write();

Now, you must create the file createProbes.H with the following contents:

Info<< "Reading probeLocations\n" << endl;

IOdictionary probeLocations
(
IOobject
(
"probeLocations",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
);


Info<< "Constructing probes\n" << endl;

Probe<volvectorfield> UProbe(probeLocations, U);
Probe<volscalarfield> pProbe(probeLocations, p);


Finally, you must create the file writeNaveragingSteps.H with the following contents:

if (runTime.outputTime())
{
OFstream nAveragingStepsFile
(
runTime.path()/runTime.timeName()/"uniform"/"nAveragingSteps.raw"
);

if (nAveragingStepsFile.good())
{
nAveragingStepsFile << nAveragingSteps << endl;
}
else
{
FatalErrorIn(args.executable())
<< "Cannot open file " << nAveragingStepsFile.name()
<< abort(FatalError);
}
}

I'm attaching probe.H to this post as it is too long. You'll need to put this file in the same directory as Xoodles.C along with createProbes.H, writeProbes.H and writeNaveragingSteps.H.

Once all files have been created and probe.H has been copied, you can execute wclean && wmake in the ~/OpenFOAM/OpenFOAM-1.4/applications/solvers/combustion/Xoodles directory. You Xoodles solver can now write probes of velocity and pressure. If there are other fields you wish to monitor, you need to edit the headers accordingly. Finally, when running your simulation, create a file called probeLocations inside the constant directory of your case. A sample of the same is also attached.

NB: I think this simple procedure can be used with almost any solver to get the probe functionality. I personally use it with icoFoam.

Hope that helps!

Attachments:
http://www.cfd-online.com/OpenFOAM_D...hment_icon.gif probeLocations
http://www.cfd-online.com/OpenFOAM_D...hment_icon.gif Probe.H

msrinath80 August 22, 2007 13:46

Apologies. writeNaveragingStep
 
Apologies. writeNaveragingSteps.H is already present. It is meant for time-averaging. Just ignore that part.

msrinath80 August 22, 2007 18:33

Oops! You also need Probe.C.
 
Oops! You also need Probe.C.
http://www.cfd-online.com/OpenFOAM_D...hment_icon.gif Probe.C

steve_mchale October 10, 2007 16:22

Has anyone noticed that the pr
 
Has anyone noticed that the probes function (any version of OpenFOAM) does not interpolate between cells but just spits out the cell-centered values??

I've tried with 1.3 to fix that but could not get the syntax correct for what I believe needed to be volPointInterpolation. (1.4 is a whole 'nother can of worms)

Samples does that, but I need U and p as functions of time, which samples does poorly. I've written a runtime and post-processing feature to convert the data files, but they are useless if they aren't interpolated.

If anyone can provide a solution in any version of OpenFOAM, I'd be much obliged.

~Steve


All times are GMT -4. The time now is 07:25.