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

sampleDict Bug

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 8, 2011, 17:51
Default sampleDict Bug
  #1
Senior Member
 
musaddeque hossein
Join Date: Mar 2009
Posts: 309
Rep Power: 18
musahossein is on a distinguished road
Dear all:
I have the following bits of commands in sampleDict per the users manual:setFormat raw;
surfaceFormat raw;

interpolationScheme cell;

sets
(
left
{
type uniform;
axis xyz;
start ( 0 -15.0 5.0);
end ( 0 -15.0 -5.0);
nPoints 10;
}
middle
{
type uniform;
axis xyz;
start ( 0 0 5.0);
end ( 0 0 -5.0);
nPoints 10;
}
right
{
type uniform;
axis xyz;
start ( 0 15 5.0);
end ( 0 15 -5.0);
nPoints 10;
}
);
fields (alpha1);
surfaces
(
wallPressure
{
type patch;
patches (leftWall);
interpolate true;
triangulate false;
}
);
fields (p);

My assumption is that once I run it, it will do two things:
1. Provide value of alpha1
2. Provide value of pressure at left wall.

However, upon running sampleDict, in the sets folder, the following subfolders are generated for each time folder left_p.xy, middle_p.xy, right_p.xy. Upon opening of any one of these p.xy folders, the contents are:

0 -15 5 99954.9
0 -15 3.88889 99964.7
0 -15 2.77778 99974.7
0 -15 1.66667 99984.7
0 -15 0.555556 100004
0 -15 -0.555556 108959
0 -15 -1.66667 118995
0 -15 -2.77778 128842
0 -15 -3.88889 138618
0 -15 -5 148398

which is pressure along the three lines (left middle and right) that I defined. But this is bizzare, since I expected sampleDict to give me the alpha1 values along the 3 lines and the pressure at the left wall. Can any one help?
musahossein is offline   Reply With Quote

Old   December 9, 2011, 04:08
Default
  #2
Senior Member
 
akidess's Avatar
 
Anton Kidess
Join Date: May 2009
Location: Germany
Posts: 1,377
Rep Power: 30
akidess will become famous soon enough
I don't think the sample utility cares about the order in the input file. Thus, it doesn't correlate the fields keyword with the input that came previously. Just use "fields(alpha1 p)" instead. You will sample a bit more data than you need, but that shouldn't be a huge problem.
__________________
*On twitter @akidTwit
*Spend as much time formulating your questions as you expect people to spend on their answer.
akidess is offline   Reply With Quote

Old   December 9, 2011, 10:17
Default
  #3
Senior Member
 
musaddeque hossein
Join Date: Mar 2009
Posts: 309
Rep Power: 18
musahossein is on a distinguished road
I see. Thanks for the reply! One thing I am also trying to do is to see if OpenFOAM can read pressure for one phase only. So say I have a glass half full of water and as I rock the glass back and forth, I only want to see the pressure on glass walls from the water only and not the air above it. Right now specifying "p" in sampleDict gives me the pressure along the entire height of the wall specified. Is there a command that will do this?

Many thanks for your response.
musahossein is offline   Reply With Quote

Old   December 9, 2011, 12:33
Default
  #4
Senior Member
 
akidess's Avatar
 
Anton Kidess
Join Date: May 2009
Location: Germany
Posts: 1,377
Rep Power: 30
akidess will become famous soon enough
I would sample alpha and p along the walls, and use a python script to filter out values you don't want.
__________________
*On twitter @akidTwit
*Spend as much time formulating your questions as you expect people to spend on their answer.
akidess is offline   Reply With Quote

Old   December 9, 2011, 12:51
Default
  #5
Senior Member
 
musaddeque hossein
Join Date: Mar 2009
Posts: 309
Rep Power: 18
musahossein is on a distinguished road
Quote:
Originally Posted by akidess View Post
I would sample alpha and p along the walls, and use a python script to filter out values you don't want.
Good suggestion. But I see a potential problem though:

Say my phases are 0 and 1. So I know the interface or free surface occurs at 0.5. I can find out using sampleDict what the phase values are along the vertical surface. The accuracy of the phase value will depend on how many points I sample the phase along the wall vertically. So if I have 40 cells in the vertical direction, then I must sample the phase at more than 40 points - say 60 points. Now I will need to compute where the phase transition ("0.5") occurs and correlate that with all the points the pressures are measured. So there will have to be two sets of interpolation:
1. Find where 0.5 phase occurs and record the height
2. Find the corresponding height in the pressure value file. Interpolate between the values in the event there is no exact match.

Too bad OpenFOAM does not have this utility. An unfortunately I am not great at C++
musahossein is offline   Reply With Quote

Old   December 9, 2011, 13:40
Default
  #6
Senior Member
 
akidess's Avatar
 
Anton Kidess
Join Date: May 2009
Location: Germany
Posts: 1,377
Rep Power: 30
akidess will become famous soon enough
You never said you want to interpolate the interface. Your previous description corresponds to throwing away all values smaller than 0.5 (assuming air is denoted with zero) and doing the same for the list of pressure values. In this case, you won't need to do interpolation.

If you don't like to do it this way, you can use the threshold filter in paraview, select the cells closest to the wall and then export the values as a spreadsheet. This will require more programming effort though if you want to automate the process.
__________________
*On twitter @akidTwit
*Spend as much time formulating your questions as you expect people to spend on their answer.
akidess is offline   Reply With Quote

Old   December 9, 2011, 14:13
Default
  #7
Senior Member
 
musaddeque hossein
Join Date: Mar 2009
Posts: 309
Rep Power: 18
musahossein is on a distinguished road
Quote:
Originally Posted by akidess View Post
You never said you want to interpolate the interface. Your previous description corresponds to throwing away all values smaller than 0.5 (assuming air is denoted with zero) and doing the same for the list of pressure values. In this case, you won't need to do interpolation.

If you don't like to do it this way, you can use the threshold filter in paraview, select the cells closest to the wall and then export the values as a spreadsheet. This will require more programming effort though if you want to automate the process.
Yes but I dont know how many cells will have values less than or close to 0.5 (a threshold that would have to be defined). It will depend on how many points along the vertical face of the wall the points are sampled. In paraview, the threshold filter can be used as you suggest, but my goal is to extract the forces on the wall at each time increment. This would make the paraview option impractical. But many thanks for your suggestion
musahossein is offline   Reply With Quote

Old   December 12, 2011, 13:45
Default
  #8
Senior Member
 
musaddeque hossein
Join Date: Mar 2009
Posts: 309
Rep Power: 18
musahossein is on a distinguished road
Dear All:
I put the following code inthe sampleDict file:

fields (alpha1
p);
surfaces
(
wallPressure
{
type patch;
patches (leftWall);
interpolate true;
triangulate false;
}
);

I also put the same code in the controlDict file:

wallPressure
{
type surfaces;
functionObjectLibs ("libsampling.so");
outputControl outputTime;
outputInterval 10;
surfaceFormat raw;
interpolationScheme cellPoint;

fields ( alpha1
p
);
surfaces
(
walls
{
type patch;
patches (leftWall);
interpolate true;
triangulate false;
}
);
}

I am modeling a rectangular tank with the fluid halfway up the tank, as a variation of the sloshingTank2D. After running OpenFOAM, I checked the pressures for the left wall at the same time interval. The output from controlDict for the first few lines is:

# p POINT_DATA 82
# x y z p
-0.5 -19.97 -10 536249
0.5 -19.97 -10 536249
0.5 -19.97 -9.5 536249
-0.5 -19.97 -9.5 536249
0.5 -19.97 -9 530098
-0.5 -19.97 -9 530098
0.5 -19.97 -8.5 522683
-0.5 -19.97 -8.5 522683

The output from the sampleDict file is:
# p POINT_DATA 82
# x y z p
-0.5 -19.97 -10 533173
0.5 -19.97 -10 536942
0.5 -19.97 -9.5 536942
-0.5 -19.97 -9.5 533173
0.5 -19.97 -9 533173
-0.5 -19.97 -9 526390
0.5 -19.97 -8.5 526390
-0.5 -19.97 -8.5 518337

There are significant difference pressure values between the two. Can anyone tell me why this may be occuring?
Thanks
musahossein is offline   Reply With Quote

Reply

Tags
alpha1, patches, sampledict


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
Bug about MULES::implicitSolve for interPhaseChangeFoam in OF-1.6 chiven OpenFOAM Bugs 18 April 18, 2013 23:56
Ercoftac centrifugal pump case study bug, Openfoam 1.6-ext (Floating point exception) ArianeJasmin OpenFOAM Programming & Development 1 April 4, 2012 15:11
Serious bug in LES interface fs82 OpenFOAM Bugs 21 November 16, 2009 09:15
Bug reports Mattijs Janssens (Mattijs) OpenFOAM 0 January 10, 2005 11:05
Forum y2k Bug Jonas Larsson Main CFD Forum 1 January 5, 2000 11:22


All times are GMT -4. The time now is 06:53.