|
[Sponsors] |
June 10, 2009, 06:48 |
Problem with sample
|
#1 |
Senior Member
xinguang cui
Join Date: Mar 2009
Posts: 116
Rep Power: 17 |
Hey foamers:
Now I need to plot the variables in a line. And I have checked from the Forum. I know that I need to use "sample". And I try to use it in the tutorials/solidDisplacementFoam/plateHole. It is very sad that although there is no information and there is information such as below lines, I can not find any sample data. create time Create mesh for time = 0 Time = 0 Time = 20 Time = 40 Time = 60 Time = 80 Time = 100 End Moreover, I would like to know if I need to sample data through the internal field, is it enough to change "sets ( leftPatch " to "sets ( internalField " ? Thanks and best wishes! |
|
June 10, 2009, 06:53 |
|
#2 |
Senior Member
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,903
Rep Power: 37 |
Hi
Look into ~/OpenFOAM/OpenFOAM-1.5.x/applications/utilities/postProcessing/sampling/sample where you will find a sampleDict, which shows all (I think) possible usages of the sample utility. Then choose whatever you need, and it should be working. Best regards, Niels |
|
June 10, 2009, 06:56 |
|
#3 |
Senior Member
xinguang cui
Join Date: Mar 2009
Posts: 116
Rep Power: 17 |
Thanks, I will try it. But the thing is that I have tried it in the tutorial. Does anybody also find this problem?
|
|
June 10, 2009, 07:26 |
|
#4 |
Senior Member
xinguang cui
Join Date: Mar 2009
Posts: 116
Rep Power: 17 |
Hey ngj!
Thanks for your advice. Follow your advice, I have got the data.However, I could not get the "mag(U)" and mag"UMean". Would you like to give me more advice about it? Thanks and best wishes! |
|
June 10, 2009, 08:08 |
|
#5 |
Senior Member
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,903
Rep Power: 37 |
Hi
I cannot get the magnitude either, however, you can sample the U vector and calculate the magnitude afterward, i.e. fields ( U ); Or you can make a postprocessing tool, which calculates the magnitude of U over the complete computational domain, and extract the samples from this field. However, I believe the first option would be the easiest. Best regards, Niels |
|
June 10, 2009, 08:33 |
|
#6 |
Senior Member
xinguang cui
Join Date: Mar 2009
Posts: 116
Rep Power: 17 |
Thanks Niels!
It is a good method to solve the problem. However, I would like to know whether the "sample" Uitily can sample the mag(U), or I don't know how to do it. Have a nice day! |
|
June 10, 2009, 08:49 |
|
#7 |
Senior Member
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,903
Rep Power: 37 |
As said, I cannot get the tool to sample the magnitude. However sample the U-field and then use a small postprocessing tool in whatever language you prefer to convert the sampled U velocity components into the magnitude.
You could do something like the following. Put it into a small script and execute it from the case folder: cd sets list1=`ls` for i in $list1 do cd $i list2=`ls *U*` for j in $list2 do cat $j | awk '{var = sqrt( $2*$2 + $3*$3 + $4*$4)} {print $1,var}' > $j.modified done cd .. done Best regargs, Niels |
|
June 12, 2009, 10:33 |
|
#8 |
Senior Member
xinguang cui
Join Date: Mar 2009
Posts: 116
Rep Power: 17 |
I am sorry that I just have time to reply it.
Just now I copy the command line you have written. I am amazed by it. I think you are very great at coding. Although it works, it is very sorry that I even don't know much about its meaning and I also don't know how to "Put it into a small script and execute it ". I guess you used "linux" for last commands. If you could spend some time to tell me how to add it into a script and execute it, I will be very very grateful about it. Thanks and best wishes! |
|
June 12, 2009, 10:59 |
|
#9 |
Senior Member
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,903
Rep Power: 37 |
Hi
Thanks for the kind words. All you need is to copy the text into a text-file, let us call it "calculateUMag.sh". Then copy the file to your root directory, e.g. damBreak. When you executed the sample utility, then type "sh calculateUMag.sh" in the command line, and it will go through all of the files in the folder "sets" and read all those containing the U velocities, e.g. line_1_U.xy and write the data to the same folder with the name line_1_U.xy.modified. Note that you cannot have more and one vector field you are sampling, as the small script I gave you might not be able to handle that. I hope this helps. Best regards, Niels |
|
June 12, 2009, 11:13 |
|
#10 |
Senior Member
xinguang cui
Join Date: Mar 2009
Posts: 116
Rep Power: 17 |
Thanks for your reply. It is very helpful!
|
|
February 11, 2010, 09:51 |
|
#11 |
Senior Member
xinguang cui
Join Date: Mar 2009
Posts: 116
Rep Power: 17 |
Hey Niels:
I hope you are fine. Now I would like to observe the flow field in one plane changing with time. I could sample the plane out, but it is pity that they are put in different folders which is related with time with the same name. I wish they could be put in one folder and I could read them as a series of time. Then, I could observe the flow field evolution with time. My idea is to rename the file related with time and copy them in one folder. But I have no enough knowledge about linux programming. Would you like to give me some tips about it during your busy work? Best wishes and thanks! Xinguang Cui |
|
Tags |
sample |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
UDF compiling problem | Wouter | Fluent UDF and Scheme Programming | 6 | June 6, 2012 05:43 |
Incoherent problem table in hollow-fiber spinning | Gianni | FLUENT | 0 | April 5, 2008 11:33 |
natural convection problem for a CHT problem | Se-Hee | CFX | 2 | June 10, 2007 07:29 |
Adiabatic and Rotating wall (Convection problem) | ParodDav | CFX | 5 | April 29, 2007 20:13 |
Is this problem well posed? | Thomas P. Abraham | Main CFD Forum | 5 | September 8, 1999 15:52 |