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

question regarding the codes for setting inlet flow

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

Reply
 
LinkBack Thread Tools Display Modes
Old   November 10, 2009, 03:59
Default question regarding the codes for setting inlet flow
  #1
New Member
 
Alice
Join Date: Nov 2009
Posts: 16
Rep Power: 6
Alicelin is on a distinguished road
Dear all,
I have a question about writing the codes for the inlet flow.I would like to know what's the difference between the following two codes?
Code 1:
inletk==1.5*pow(0.11*Foam:: pow(z*2,-0.18),2)*magSqr(inletU)
Code 2:
inletk==1.5*pow(0.11*pow(z*2,-0.18),2)*magSqr(inletU)

actually what's the difference in the meaning between "Foam:: pow" and "pow"?

Thanks
Alicelin is offline   Reply With Quote

Old   November 10, 2009, 05:46
Default
  #2
Senior Member
 
Kathrin Kissling
Join Date: Mar 2009
Location: Besigheim, Germany
Posts: 134
Rep Power: 7
kathrin_kissling is on a distinguished road
Dear Alicelin,

you will find the difference if you try to do something like this:

volScalarField a;
volScalarField b = Foam:ow(a,2);

or

volScalarField a;
volScalarField b = pow(a,2);

The second one will fail. The problem is pow is firstly only defined for scalars (doubles, float, ...)
If you try to work on a derrived type like volScalarField or scalarField, which are list of scalars, in c you would have need to go:

for (i=0; i< sizeOfField; i++)
b[i] = pow(a[i],2)

Foam does this for you. It automatically loops if you work on scalarFields. But Foam needs to know, whether it should do that or not. So you have to tell it the namespace, which is FOAM and the belonging function which is pow in your case. So the macro is FOAM:ow(<something>, double);
Foam will automatically take a look on what <something> is and work accordingly.
Understood?

If you have questions regarding this, please feel free to ask!

Kathrin
kathrin_kissling is offline   Reply With Quote

Old   November 11, 2009, 00:11
Default
  #3
New Member
 
Alice
Join Date: Nov 2009
Posts: 16
Rep Power: 6
Alicelin is on a distinguished road
Dear Kathrin,

Really thanks for your reply!

just one more question to ask.....what're "doubles" and "float" that you've mentioned in your post?

Alice
Alicelin is offline   Reply With Quote

Old   November 11, 2009, 02:05
Default
  #4
Senior Member
 
Kathrin Kissling
Join Date: Mar 2009
Location: Besigheim, Germany
Posts: 134
Rep Power: 7
kathrin_kissling is on a distinguished road
Dear Alice,

double and float are data types for floating point numbers in c/c++. The difference is in the size, which can be stored and therefore in its precision. Float gives you numbers in single precision, double in double precision.

This is really fundamental c/c++. Please refer to a textbook or webpages on c/c++. You will find it very difficult to work with OpenFOAM if you don't have experience with c++ or at least c.

Hope this helps!

Best

Kathrin
kathrin_kissling is offline   Reply With Quote

Old   November 11, 2009, 03:04
Default
  #5
New Member
 
Alice
Join Date: Nov 2009
Posts: 16
Rep Power: 6
Alicelin is on a distinguished road
Dear Kathrin,

Really thanks a lot!

Alice
Alicelin is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Internal Flow BCs for Compressible inlet flow Katie FLUENT 2 March 3, 2012 17:35
Mass flow inlet compressible flow richard FLUENT 2 June 1, 2008 11:44
inlet mass flow rate BC manu FLUENT 0 February 5, 2008 13:24
velocity or mass flow inlet? Silvia FLUENT 1 August 12, 2005 13:55
Inlet diffuser of ramjet Mohammad Kermani Main CFD Forum 25 December 29, 2000 18:46


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