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

Problem with sample

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 10, 2009, 05:48
Default Problem with sample
  #1
Senior Member
 
xinguang cui
Join Date: Mar 2009
Posts: 116
Rep Power: 17
flying is on a distinguished road
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!
flying is offline   Reply With Quote

Old   June 10, 2009, 05:53
Default
  #2
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,900
Rep Power: 37
ngj will become famous soon enoughngj will become famous soon enough
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
ngj is offline   Reply With Quote

Old   June 10, 2009, 05:56
Default
  #3
Senior Member
 
xinguang cui
Join Date: Mar 2009
Posts: 116
Rep Power: 17
flying is on a distinguished road
Thanks, I will try it. But the thing is that I have tried it in the tutorial. Does anybody also find this problem?
flying is offline   Reply With Quote

Old   June 10, 2009, 06:26
Default
  #4
Senior Member
 
xinguang cui
Join Date: Mar 2009
Posts: 116
Rep Power: 17
flying is on a distinguished road
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!
flying is offline   Reply With Quote

Old   June 10, 2009, 07:08
Default
  #5
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,900
Rep Power: 37
ngj will become famous soon enoughngj will become famous soon enough
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
ngj is offline   Reply With Quote

Old   June 10, 2009, 07:33
Default
  #6
Senior Member
 
xinguang cui
Join Date: Mar 2009
Posts: 116
Rep Power: 17
flying is on a distinguished road
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!
flying is offline   Reply With Quote

Old   June 10, 2009, 07:49
Default
  #7
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,900
Rep Power: 37
ngj will become famous soon enoughngj will become famous soon enough
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
ngj is offline   Reply With Quote

Old   June 12, 2009, 09:33
Default
  #8
Senior Member
 
xinguang cui
Join Date: Mar 2009
Posts: 116
Rep Power: 17
flying is on a distinguished road
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!
flying is offline   Reply With Quote

Old   June 12, 2009, 09:59
Default
  #9
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,900
Rep Power: 37
ngj will become famous soon enoughngj will become famous soon enough
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
ngj is offline   Reply With Quote

Old   June 12, 2009, 10:13
Default
  #10
Senior Member
 
xinguang cui
Join Date: Mar 2009
Posts: 116
Rep Power: 17
flying is on a distinguished road
Thanks for your reply. It is very helpful!
flying is offline   Reply With Quote

Old   February 11, 2010, 08:51
Default
  #11
Senior Member
 
xinguang cui
Join Date: Mar 2009
Posts: 116
Rep Power: 17
flying is on a distinguished road
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
flying is offline   Reply With Quote

Reply

Tags
sample


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
UDF compiling problem Wouter Fluent UDF and Scheme Programming 6 June 6, 2012 04:43
Incoherent problem table in hollow-fiber spinning Gianni FLUENT 0 April 5, 2008 10:33
natural convection problem for a CHT problem Se-Hee CFX 2 June 10, 2007 06:29
Adiabatic and Rotating wall (Convection problem) ParodDav CFX 5 April 29, 2007 19:13
Is this problem well posed? Thomas P. Abraham Main CFD Forum 5 September 8, 1999 14:52


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