# dimensioned problem in potentialFoam

 Register Blogs Members List Search Today's Posts Mark Forums Read

 December 20, 2012, 10:31 dimensioned problem in potentialFoam #1 New Member   Join Date: Mar 2012 Posts: 20 Rep Power: 6 there is a define of pressure p as follow in the createFields.H in the potentialFoam: volScalarField p ( IOobject ( "p", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::NO_WRITE ), mesh ); p = dimensionedScalar("zero", p.dimensions(), 0.0); In my opinion, the pressure p is created with dimensionedless at first, and then assign its dimension according to dimensionedScalar("zero", p.dimensions(), 0.0). However, when p.dimensions() is called, the dimension of p in left is still dimensionless. Therefore, the dimension of p is not given. At the same time, the same problem is also exist in the velocity U.

 December 20, 2012, 15:36 #2 Senior Member   Lieven Join Date: Dec 2011 Location: Leuven, Belgium Posts: 297 Rep Power: 14 Hey T.Matrix, The dimensions of p and U should be read from the input files. So if p.dimensions() is dimensionless, you should check the dimension set specified in 0/p and 0/U of the case. Kind regards, L

 December 21, 2012, 21:23 #3 New Member   Join Date: Mar 2012 Posts: 20 Rep Power: 6 Hi Lieven, the dimensions of p and U is given in the input files as normal, and potentialFoam can run correctly. However, the problem is how the dimensions is assigned in the source code. As far as I am concerned, volscalarField p is created by calling construction function GeometricField(*,*,*). In the following code, dimensions is not given to the construction GeometricField. Therefore, pressure p is created using the default dimension which is set dimensionless in the construction. So, in my opinion, p is created with no dimension. In fact, when source code is executed, p has its own dimension. I can't understand it. volScalarField p ( IOobject ( "p", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::NO_WRITE ), mesh );

December 22, 2012, 05:16
#4
Senior Member

Lieven
Join Date: Dec 2011
Location: Leuven, Belgium
Posts: 297
Rep Power: 14
Dear T.Matrix,

Quote:
 So, in my opinion, p is created with no dimension..
The dimensions are not given explicitly in the source code but they are effectively read from the input file because IOobject::MUST_READ is set. This give the user the flexibility to chose them himself. Only when IOobject::MUST_READ would be IOobject::NO_READ or IOobject::READ_IF_PRESENT on the other hand, they would need to be provided in the source code.

Code:
`Info << p.dimensions() << endl;`
just before
Code:
`p = dimensionedScalar("zero", p.dimensions(), 0.0);`
you can verify yourself that the dimensions are taken from the input file (simply change them a few times)

The only reason
Code:
`p = dimensionedScalar("zero", p.dimensions(), 0.0);`
is added to the createFields.H is to reset the pressure field to 0.

Kind regards,

L

 December 22, 2012, 06:48 #5 New Member   Join Date: Mar 2012 Posts: 20 Rep Power: 6 Hello L, If Oobject::MUST_READ is set, the dimension is read from input file. However, the dimension is saved in a temporary IOobject. I just do not know how this temporary IOobject transport its dimension to dimension in volScalarField. I read relative codes several days but have no idea. Matrix.T

 Tags dimensioned

 Thread Tools Display Modes Linear Mode

 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 OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post JonW OpenFOAM 3 February 23, 2013 21:41 Wouter Fluent UDF and Scheme Programming 6 June 6, 2012 04:43 tilek CFX 3 May 8, 2011 08:39 Se-Hee CFX 2 June 10, 2007 06:29 ParodDav CFX 5 April 29, 2007 19:13

All times are GMT -4. The time now is 09:05.