CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

Question on sampleDict

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 17, 2013, 22:53
Default Question on sampleDict
  #1
Senior Member
 
musaddeque hossein
Join Date: Mar 2009
Posts: 309
Rep Power: 18
musahossein is on a distinguished road
Dear all:

Using sampleDict, I am trying to obtain pressure for the left and rightwall in a rectangular tank. The walls are called leftWall and rightWall in blockMesh. However sampleDict gives me reading for one wall only. How can I get it to read both walls? Any advice will be greatly appreciated.

/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object sampleDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

setFormat raw;
surfaceFormat raw;


interpolationScheme cell;

fields
(alpha1
p);

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

surfaces
(
wallPressure
{
type patch;
patches (rightWall);
interpolate true;
triangulate false;
}
);
musahossein is offline   Reply With Quote

Old   April 18, 2013, 17:59
Default
  #2
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Hi Musaddeque,

Summarizing the problem:
  • You have this:
    Code:
    surfaces
    (
    wallPressure
    );
    
    surfaces
    (
    wallPressure
    );
  • What you really want is this:
    Code:
    surfaces
    (
    wallPressure
    wallPressure2
    );

The entry "surfaces" should be used as a single list and names should not be repeated:
Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  1.6                                   |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "system";
    object      sampleDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

setFormat    raw;
surfaceFormat raw;


interpolationScheme cell;
  
    fields
    (alpha1
    p);

    surfaces
      (    
    wallPressure
    {
    type        patch;
    patches        (leftWall);
    interpolate    true;
    triangulate    false;
    }
    
wallPressure2
    {
    type        patch;
    patches        (rightWall);
    interpolate    true;
    triangulate    false;
    }
    );
Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   April 18, 2013, 21:47
Default
  #3
Senior Member
 
musaddeque hossein
Join Date: Mar 2009
Posts: 309
Rep Power: 18
musahossein is on a distinguished road
Quote:
Originally Posted by wyldckat View Post
Hi Musaddeque,

Summarizing the problem:
  • You have this:
    Code:
    surfaces
    (
    wallPressure
    );
    
    surfaces
    (
    wallPressure
    );
  • What you really want is this:
    Code:
    surfaces
    (
    wallPressure
    wallPressure2
    );

The entry "surfaces" should be used as a single list and names should not be repeated:
Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  1.6                                   |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "system";
    object      sampleDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

setFormat    raw;
surfaceFormat raw;


interpolationScheme cell;
  
    fields
    (alpha1
    p);

    surfaces
      (    
    wallPressure
    {
    type        patch;
    patches        (leftWall);
    interpolate    true;
    triangulate    false;
    }
    
wallPressure2
    {
    type        patch;
    patches        (rightWall);
    interpolate    true;
    triangulate    false;
    }
    );
Best regards,
Bruno
Thanks for your response. I did the following and got the left and right wall cell pressures and phase equally well. It does the same thing as your suggestion. Thanks for your help!:
------------------------------------------------------------------------------------------------------------------------------------------------
fields (alpha1
p);

surfaces
(
left
{
type patch;
patches (leftWall);
interpolate true;
triangulate false;
}
right
{
type patch;
patches (rightWall);
interpolate true;
triangulate false;
}
);
--------------------------------------------------------------------------------------------------------------------------------------
musahossein is offline   Reply With Quote

Old   May 7, 2013, 14:54
Default OpenFoam does not recognize change in mesh size
  #4
Senior Member
 
musaddeque hossein
Join Date: Mar 2009
Posts: 309
Rep Power: 18
musahossein is on a distinguished road
Dear all:

I am running sloshingTank2D. In the blockMesh dict file, initially, the cell size was 50X50. Then I changed it to 271X271. Now when I run in parallel, I get the following error message:

--> FOAM FATAL IO ERROR:
size 2500 is not equal to the given value of 73441

file: /home/musa/OpenFOAM/musa-2.2.0/run/tutorials/multiphase/interDyMFoam/ras/sloshingTank2D/0/alpha1 from line 18 to line 2546.

Here 2500 is the previous mesh size. 73441 is the current mesh size of 271x271. So what does OpenFOAM mean by this error message. The alpha1.org file that it is refering to does not have any reference to the mesh size. So why is it pointing to the alpha1 file?

Thankyou.
musahossein is offline   Reply With Quote

Old   May 7, 2013, 16:25
Default
  #5
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Hi Musaddeque,

The error message is due to the internal field for "alpha1" having a value count different from the mesh's own cell count. In essence, when setFields is executed, if the values are not all equal, it will define one value (scalar or vector) per cell of the mesh.

In the case folder you should find a file named "Allrun". This is a script that can be used to run the case as intended:
Code:
./Allrun
This folder can also be seen online, in case you've accidentally erased the Allrun script file: https://github.com/OpenFOAM/OpenFOAM...sloshingTank2D

From your description, it seems that you've missed two important steps:
Code:
cp 0/alpha1.org 0/alpha1
runApplication setFields
The first one recovers the original (".org") template file for the "alpha1" field. The second one defines the internal field values (i.e., fills the tank up to a certain height).

This is one of the quickest/easiest solutions there are, which is why it's the one shown in this tutorial

In addition, there is also the "Allclean" script, which is designed to quickly clean the tutorial case to make it ready for another run, or just to save disk space. To run it, it's the same way:
Code:
./Allclean
Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   May 7, 2013, 22:37
Default OpenFoam does not recognize change in mesh size
  #6
Senior Member
 
musaddeque hossein
Join Date: Mar 2009
Posts: 309
Rep Power: 18
musahossein is on a distinguished road
Quote:
Originally Posted by wyldckat View Post
Hi Musaddeque,

The error message is due to the internal field for "alpha1" having a value count different from the mesh's own cell count. In essence, when setFields is executed, if the values are not all equal, it will define one value (scalar or vector) per cell of the mesh.

In the case folder you should find a file named "Allrun". This is a script that can be used to run the case as intended:
Code:
./Allrun
This folder can also be seen online, in case you've accidentally erased the Allrun script file: https://github.com/OpenFOAM/OpenFOAM...sloshingTank2D

From your description, it seems that you've missed two important steps:
Code:
cp 0/alpha1.org 0/alpha1
runApplication setFields
The first one recovers the original (".org") template file for the "alpha1" field. The second one defines the internal field values (i.e., fills the tank up to a certain height).

This is one of the quickest/easiest solutions there are, which is why it's the one shown in this tutorial

In addition, there is also the "Allclean" script, which is designed to quickly clean the tutorial case to make it ready for another run, or just to save disk space. To run it, it's the same way:
Code:
./Allclean
Best regards,
Bruno
Wyldcat: Thanks for your response. The problem is I get this error when I am running in parallel. The cp/... stuf I have in the Allrun file. However, I have modified the Allclean file to read:

#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory

foamCleanTutorials cases
#rm -rf 0/alpha1 0/alpha1.gz probes wallPressure pRefProbe

rm -rf probes wallPressure pRefProbe

# ----------------------------------------------------------------- end-of-file

Note that I commented out the removal of the 0/alpha1 fields because otherwise OpenFOAM deletes it each time Allclean is run and I do not know a way of recovering it. And I dont understand why the alpha files must be deleted each time. I am trying to call OpenFOAM from another code, so regenerating the alpha1 file each time is not something I can do.

Any suggestions?
musahossein is offline   Reply With Quote

Old   May 7, 2013, 22:46
Default OpenFoam does not recognize change in mesh size
  #7
Senior Member
 
musaddeque hossein
Join Date: Mar 2009
Posts: 309
Rep Power: 18
musahossein is on a distinguished road
The error message I get appears after MPI sets up the processors and is as follows. Initially I had 50X50 cells then I increased to 271x271 cells.


Processor 3
Number of cells = 9180
Number of faces shared with processor 1 = 135
Number of faces shared with processor 2 = 269
Number of processor patches = 2
Number of processor faces = 404
Number of boundary faces = 18496

Number of processor faces = 812
Max number of cells = 27540 (49.998% above average 18360.2)
Max number of processor patches = 2 (0% above average 2)
Max number of faces between processors = 408 (0.492611% above average 406)

Time = 0


--> FOAM FATAL IO ERROR:
size 2500 is not equal to the given value of 73441

file: /home/musa/OpenFOAM/musa-2.2.0/run/tutorials/multiphase/interDyMFoam/ras/sloshingTank2D/0/alpha1 from line 18 to line 2546.

From function Field<Type>::Field(const word& keyword, const dictionary&, const label)
in file /home/opencfd/OpenFOAM/OpenFOAM-2.2.0/src/OpenFOAM/lnInclude/Field.C at line 236.

FOAM exiting
musahossein is offline   Reply With Quote

Old   May 8, 2013, 13:25
Default
  #8
Senior Member
 
musaddeque hossein
Join Date: Mar 2009
Posts: 309
Rep Power: 18
musahossein is on a distinguished road
One thing I dont understand is that we are running Allclean before Allrun. In Allclean the alpha1 and alpha1.org files are being removed from the 0 folder:
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory

foamCleanTutorials cases

rm -rf 0/alpha1 0/alpha1.gz
rm -rf probes wallPressure pRefProbe

# ----------------------------------------------------------------- end-of-file

Then Allrun is attempting to copy alpha1 file to alpha1.org as follows:

cp 0/alpha1.org 0/alpha1

But this cannot happen because alpha1 and alpha1.org files were deleted in the Allclean process. Is there something wrong here or am I missing something?

I look forward to your response.
musahossein is offline   Reply With Quote

Old   May 8, 2013, 17:48
Default
  #9
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Hi Musahossein,

That's very strange... the "0/alpha1.org" should have not been erased by Allclean.
Only "0/alpha1" and "0/alpha1.gz" should have been erased!
These two are the uncompressed and compressed forms of the same file. They do not affect "alpha1.org".

Perhaps you accidentally erased "alpha1.org"?
If you are missing this file right now, you can get it back with this command:
Code:
cp $FOAM_TUTORIALS/multiphase/interDyMFoam/ras/sloshingTank2D/0/alpha1.org 0/alpha1.org
You can also try and modify the case in order to work in the same way that some other tutorials work. They use a complete "0.org" folder that acts as a template for the whole "0" folder.
Have a look for example at the tutorial "multiphase/interDyMFoam/ras/damBreakWithObstacle": https://github.com/OpenFOAM/OpenFOAM...akWithObstacle

Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Reply

Tags
sampledict, wallpressure


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
small question about the functionalities of topological changes in OpenFoam ngj OpenFOAM Running, Solving & CFD 2 February 28, 2013 10:02
Question Re Engineering Data Source imnull ANSYS 0 March 5, 2012 13:51
question on sampleDict gorgon OpenFOAM 2 December 8, 2011 19:07
internal field question - PitzDaily Case atareen64 OpenFOAM Running, Solving & CFD 2 January 26, 2011 15:26
Poisson Solver question Suresh Main CFD Forum 3 August 12, 2005 04:37


All times are GMT -4. The time now is 18:55.