sampleDict and controlDict
Dear all: I am trying to understand the difference between the functionality of sampleDict and ControlDict. If, for example, I need pressure output in OpenFoam and use the following commands in controlDict, I find that putting them in sampleDict does the same thing. So why not put all the commands in controlDict and not use sampleDict at all -- or are there more differences between the two than what meets the eye?:
wallPressure { type surfaces; functionObjectLibs ("libsampling.so"); outputControl outputTime; surfaceFormat raw; interpolationScheme cell; fields ( alpha1 p ); surfaces ( leftwalls { type patch; patches (leftWall); interpolate true; triangulate false; } rightwalls { type patch; patches (rightWall); interpolate true; triangulate false; } ); } |
Greetings Musaddeque,
The difference is that:
For example:
Bruno |
Many thanks for your explanation. Now I get the picture.
|
Some one please help,
I am a newbie to OpenFOAM and have a doubt related to the above posts. I need to find the pressure at a point in all the time steps, so what is the procedure that I need to follow. I will be grateful to get some hint. Thanks in advance. Regards, |
Greetings Sujatha and welcome to the forum!
There are at least 2 ways you can do this:
Bruno |
Ms Sujatha: Yes please do follow suggestion by Mr Bruno - he is one of the many geniuses on the forum who has helped many a lost foamers find the way -- I speak from experience. So best wishes. Now I have a question for Mr Bruno: Bruno, I tried to run the point probe in OpenFoam. I am running sloshingtank 2d (interdymfoam solver) and when I put the point probe very close to the wall, the solver will give error messages during the run. Also, if I am using moving mesh, then does the probe move with the mesh so that it is probing the same point each time? If not then dont you think it is a major error in OpenFoam? I look forward to your comments.
|
Hi Musaddeque,
Quote:
I've done a quick search and found this bug report: http://www.openfoam.org/mantisbt/view.php?id=744 - I had looked into this back then and I never managed to use this myself. In addition, I found this old thread: http://www.cfd-online.com/Forums/ope...-problems.html :eek: I think I've figured it! At least in theory. You need to create a "pointSet" first for the initial mesh and use that point set for the sampling. Please share the dictionary you've used for sampling, as well as instructions on how you've used it, so that I can test and create a variant for moving meshes. Best regards, Bruno |
Thanks a lot Mr. Bruno for your timely and quick reply. That hint helped me , I could do it with the probesDict and the pressure is obtained.
As Mr.Musahossein has quoted you helped me find the way. I am grateful. Regards, |
Point probe close to wall gives errors
Bruno:
Here is the sampleDict file that I am using to look at pressures very close to the tank wall. The tank is 1mX1mX0.1. The solver is interDymFOam and the problem is sloshingtank2D. The water depth is 0.5. The centroid (0,0,0) is at mid point along the tanks just at the transition between the water and air. The point probe is at 0.49m and 0.3m below the water level at rest. When I run the sample file, I get error mesages that the probe location is out outside the tank or something to that effect. However, when I place the proble at 0.45m, there are no errors. If you require, I can sent you the tank mesh file, but I dont thin the tank has anything to do with it. Any help advice will be appreciated, thanks. Code:
/*--------------------------------*- C++ -*----------------------------------*\ |
Bruno:
I asked the same question a while back.At that time I reproduced the error message that came on the scree. Here is the URL to that post: http://www.cfd-online.com/Forums/ope...ct-issues.html I hope this will clarify the situation better. Thankyou Musa |
Hi Musa,
OK, since you've split your question into two separate threads, I'll address the usage of "sampleDict" here. The example file provided for this utility: https://github.com/OpenFOAM/OpenFOAM...ple/sampleDict - indicates that it can use a cloud of points, which acts similarly to the probe. But neither the probes nor the cloud of points will move along with your geometry. These points are fixed in space. Now, based on your other thread, it seems that you want to sample a point in a patch, not a point strictly inside the domain. For this, you can use the "faceSource" function object: http://foam.sourceforge.net/docs/cpp/a00608.html - if you search here on the forum, I think there is already a couple of examples on how to use this. I'm going to answer on the other thread now, namely this one: http://www.cfd-online.com/Forums/ope...ct-issues.html Best regards, Bruno |
Sorry i have to ask this here: can i use sampleDict on a decomposed case? Ie one that has just been run in parallel?
|
Quote:
I hope that answers your question. |
Quote:
|
Greetings to all!
@kingjewel1: Quote:
Code:
sample -help Code:
Usage: sample [OPTIONS] Best regards, Bruno |
Quote:
Thank you for that. My question was not whether Code:
sample Code:
reconstructPar |
Hi everyone,
I am a very new openFoam user and i am trying a lot! All the discussion with Mr Bruno helped me a lot, but i have some extra questions. I use this sampleDict: Code:
interpolationScheme cellPoint; now i want to make a graph of U - time. Can you help me, please, because i am in confusion :/ Thanks a lot, Tasos. |
Greetings Tasos,
If you can provide an example case with instructions on how to get to the point you are right now, it'll be easier to help you, because it takes considerable time to set-up a similar case and to do some trial-and-error to figure out the best solution. On the other hand, why not use ParaView to do the plot of U over time? If you want to plot with gnuplot, you can export the data to CSV after plotting. Best regards, Bruno |
Sampling data in a window and save backup every other time steps
Hi all,
Here is my question and I guess I can do that with the controlDict. I want to simulate something kind of big and cannot save all the data (too much space and saving data slow down the simulation) yet I want backup just in case I need to crash the simulation for a bit and restart later from latest time step (example I need to run another simulation quickly and I don't need the big one for now so I can resume it later). So here is what I would like to do : at every 0.05s sample the data in a box (where do I define this box) for all the flow field parameters then at every 1s I want to back up the entire simulation (domain larger than the area of interest). I am doing that with IHFOAM by the way. Best Remi |
backing up data
I dont know whether you can back up data every 1s or at any time interval. Openfoam does not give you the option. Also, why backup results data? It will take a huge amount of space and may not be efficient to restore. Why cant you just back up the input data and the associated files (system, constant etc) so that in the event of a crash, you can rerun your case.
|
How to use endTime in ControlDict
Dear all:
I am using OpenFoam 2.2.1 , InterDyMFoam/SloshingTank2D as follows: I am running a code that will modify the displacement .dat file in OpenFoam/SloshingTank2D as follows: Each time the file is overwritten with 2 lines of data with a begin time and end time and corresponding displacements as follows: 2 ( ( 0.19 (( 0.0265476475 0.00 0.00) ( 0.00 0.00 0.00))) ( 0.21 (( 0.0369661065 0.00 0.00) ( 0.00 0.00 0.00))) ) The first column is time and the next column are the displacements associated with the time. Since both the time column and the displacement column will change as the new data is created, I would like to get an output at each end time (0.21 in this case). Can anyone suggest how I can use startFrom and stopAt to do this? In the OpenFoam Manual, for controlDict under "startFrom", there are options such as firstTime, startTime and latestTime options. so for example if the file previous to the one above is as follows: 2 ( ( 0.17 (( -0.0665476475 0.00 0.00) ( 0.00 0.00 0.00))) ( 0.19 (( 0.0369661065 0.00 0.00) ( 0.00 0.00 0.00))) ) Should I use the latestTime option? What about the stopAt option? looks like I only have the writeNow option. Is that correct? Any suggestions or comments would be appreciated, Thanks. |
Greetings Musaddeque,
If you have a certain code that generates the file for the movement, then you can also have that code generate a file that has the times for start and stop. For example, the new file "system/controlDict.start_stop" would have this: Code:
newStartTime 0.17; Code:
FoamFile This is further explained in the release notes for one of OpenFOAM's versions... er, I have no idea in which version of OpenFOAM this was included. OK, it's explained in the User Guide: http://www.openfoam.org/docs/user/ba...8-1040004.2.10 - section 4.2.10 The #include and #inputMode directives Best regards, Bruno |
Thankyou very much for your response. I am trying that approach.
|
Quote:
Code:
{stuff deleted} Thankyou |
Hi Musaddeque,
My guess is that this message: Quote:
A possible solution is to change your file to have something like this example, for 0.17 to 0.19: Code:
4 Best regards, Bruno |
Bruno, thanks again
Quote:
The numbers that my code sends to openfoam -- startTime, endTime, and the displacements are all followed by "0d0" after the last digit. This will ensure that there are no unintended digits. So if an updated time is 0.12, then the code will send 0.120d0, i.e. 0.1200000...to the end. Maybe that is where the conflict was. Even when I set the writeinterval in controlDict to 0.0005, the last OpenFoam time would be 0.1195 -- never quite reaching 0.1200. So what I did was subtract a small number say 0.0001 from the start time and add the same number to the end time in the displacement file, so that my displacement file would look like: 2 (0.1200001 (0, start_displacement) .... other columns deleted) (0.1400001 (0, end_dispalcement)......other columns deleted) However, in the controlDict file, the startTime and endTime are kept as 0.1200 and 0.1400. Given a larger time range in the displacement file, OpenFOAM now accepts the update and does the analysis w/o problems (well until the next time). So thank you for your suggestion. But may I suggest that OpenFOAM standardize the way numbers are dealt with so it keeps track of significant digits and sets all other numbers after it to zero. I am sure this way errors such as the one I came across can be avoided. I am not sure though, however, why OpenFOAM refused to write data after 0.1195, eventhough the write interval was 0.0005, and there was a displacement associated with 0.1200000. |
Quote:
|
OpenFOAM write interval doesnt always work
As a follow up to the previous thread, in control dict I specify the write time as 0.02 as shown below:
Code:
FoamFile Code:
. Any suggestions advice would be greatly apprciated. Thanks! |
Hi Musaddeque,
Sorry, I wasn't able to look into this any sooner. And I know there is a bug report related to this issue, but I haven't found it yet. OK, the latest error seems to be because the time snapshot 21.70 doesn't exist and because you have these settings: Code:
startFrom latestTime; Code:
21.68 Can you please provide a test case? Because I'm not able to reproduce this error. Best regards, Bruno edit: OK, found it: http://www.cfd-online.com/Forums/ope...ct-number.html |
OpenFOAM write interval doesnt always work
WyldKat:
Thanks for your response. I cant provide a test case as I have coupled at program with openfoam. The program looks for specific files with specific time stamps. As a result, if it does not find the file 27.72 for example, it will give an error. I got around this problem for the time being by: 1.Increasing the time stamp by a range. So for example, instead of supplying the start time as 2.00 seconds of simulation time, I will supply 1.999999. Similarly, I will increase the end time by a small amount say 0.0001. So the code now looks for something within that range. 2. Increasing the writPrecision in controlDict to 6. Both these appear to help and I have running simulations w/o problems on this issue. I will try OpenFOAM version 2.3 soon. Thanks |
Dear all.
I have the same type of problem as musahossein. I’am working on foam-extend 3.1 on a turbine simulation. I am using pimpleDyMFoam to solve the simulation. What I need to do now, is to set probes on one face of the blades. But probes can’t be fixed. I need them to follow the blades to always get the pressure at the good point. I read all your previous post but I could not fix my problem. Do you have an idea about the way I can do this? It also need to be run in parallel. I don’t know if it’s possible with this “moving” probes. Best Regards Romain |
Greetings Romain and welcome to the forum!
AFAIK, "moving probes" is only somewhat implemented in OpenFOAM 2.2.x and newer: http://www.openfoam.org/mantisbt/view.php?id=1090 It's in this commit: https://github.com/OpenFOAM/OpenFOAM...f27b5d573c2a9b I don't know if this feature has been back-ported to foam-extend already or not. Best regards, Bruno |
Sample can be run in parallel on a decomposed case in exactly the same manner as the case itself is run in parallel.
For instance, if you have a case decomposed into four processor directories, you can run sample in parallel on four processors by mpirun -np 4 sample -parallel This is much faster than running reconstructPar and then sample. |
Dear Bruno
Thanks for your reply and your help. I will try it and I will let you know regards |
Dear All,
I am working on the interDyMFoam/floatingObject tutorial. I need guidance with post processing. I am trying to get fluid velocities and acceleration values at specific points in the computational domain. 1.In the "sampleDict/controlDict" file can I use the option "type cloud" and read the points from a file. 2.Is it possible to get the acceleration data for these specific points by using "fields" (as U for velocity). Thank you. |
Dear Mr Bruno,
I am trying to use sampleDict utility with cloud of points option. Kindly can you please guide me as to how I could read the coordinates of the cloud points form a data file (as I need to track up to 150 points). Your help is highly appreciated.Thank you. Regards, Gautami. |
Quick answers:
Quote:
Quote:
The best you can do is use "#include" to include the file that has the data, but the data must be formatted in OpenFOAM's own interpretation of the data, e.g.: Code:
somePoints Code:
(0.049 0.049 0.00501) Quote:
|
Dear Mr Bruno,
Thank you very much for your reply. As per your suggestion I have used "#include option" in the "sampleDict" utility, to read the coordinate of the points from file "mordata" as: Code:
sets http://cfd.direct/openfoam/user-guid...c-file-format/) Code:
points However when I try to implement the same in "controlDict" utility to obtain the data runtime I end up getting the following error: Code:
/opt/OpenFOAM-2.2.0/bin/tools/RunFunctions: line 42: 8205 Segmentation fault $APP_RUN "$@" > log.$APP_NAME 2>&1 Code:
functions (I would like to mention here that, the option probes and wallPressure/surfaces in controlDict works fine, but the line option and points option in controlDict gaves me this error similar to the above error. Code:
: /opt/OpenFOAM-2.2.0/bin/tools/RunFunctions: line 42: 18418 Segmentation fault $APP_RUN "$@" > log.$APP_NAME 2>&1. Your guidance will be invaluable. Regards, Gautami. |
Hello Mr Bruno,
I was looking how to extraxt points from my configuration for the postprocessing till I found these posts above, I kindly would like to know how can I extract points from differents lines from my geometry and save it with a format that OpenFOAM would read it, (I´m using type cloud for sampling) The point is to sample the concentration in these differents cells on each time step |
Hi Bruno
first thanks for your kindness and time. I want to take the velocity profile at every time steps over some surfaces located in computational doamin during running, and as my case is big so i can't save all fields every time steps and i couldn't use sampleDict. could you please let me know the way? |
All times are GMT -4. The time now is 08:40. |