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

Units within the source code

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

Reply
 
LinkBack Thread Tools Display Modes
Old   December 5, 2008, 16:29
Default Hi, I was wondering how one
  #1
Member
 
Daniel Harlacher
Join Date: Mar 2009
Location: Davis, CA, United States
Posts: 60
Rep Power: 8
harly is on a distinguished road
Hi,

I was wondering how one can assign a dimension (units) to a variable in the source code.

I want to specify a time for example - how would I define the variable to be able to calculate with the units ?

thanks
harly
harly is offline   Reply With Quote

Old   December 5, 2008, 20:20
Default Hi Daniel Please use: di
  #2
Senior Member
 
Join Date: Mar 2009
Posts: 248
Rep Power: 9
jaswi is on a distinguished road
Hi Daniel

Please use:

dimensionedScalar
dimensionedVector

etc for this purpose. OpenFOAM uses a SI Units based dimensionset
[mass length time temp etc etc etc] - don't remember all of the names.

So a dimension less scalar has [0 0 0 0 0 0 0] as the dimension set

A dimesionedScalar should have a value and dimension. Taking your problem of defining the time with units:

dimensionedScalar myTime
(
"myTime",
dimensionSet(0 0 1 0 0 0 0),
0.0
)

Hope that helps. Also please try some forum browsing if your problem is not what I explain here.

Kind Regards
Jaswi
jaswi is offline   Reply With Quote

Old   December 5, 2008, 20:49
Default Hi, thanks for the answer -
  #3
Member
 
Daniel Harlacher
Join Date: Mar 2009
Location: Davis, CA, United States
Posts: 60
Rep Power: 8
harly is on a distinguished road
Hi,

thanks for the answer - do I have to include sth. or do I have to define this in a special place because I am getting an error and I cannot understand what the mistake is.

I just copied your example and wanted to display myTime, but it won't compile.

thanks
harly is offline   Reply With Quote

Old   December 7, 2008, 17:44
Default Hi Daniel It will help the
  #4
Senior Member
 
Join Date: Mar 2009
Posts: 248
Rep Power: 9
jaswi is on a distinguished road
Hi Daniel

It will help the forum to provide any feedback if you will please either post the error or the code which gives you error so that one could figure out if any of the header files to be included are missing

Kind Regards
Jaswi
jaswi is offline   Reply With Quote

Old   December 7, 2008, 18:33
Default Hi, yes you are right that
  #5
Member
 
Daniel Harlacher
Join Date: Mar 2009
Location: Davis, CA, United States
Posts: 60
Rep Power: 8
harly is on a distinguished road
Hi,

yes you are right that would make it a lot easier - I will have the possibility to upload it tomorrow - maybe you can have a look at it then.

thanks
- harly
harly 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
Units of additonal Variable and its source Gauranga Das CFX 2 December 6, 2007 04:59
UDF Source Term Units? Brian FLUENT 1 October 24, 2005 09:15
About units of mass source term bg2306 FLUENT 0 April 1, 2005 11:46
Source term units in 2D Chief FLUENT 1 August 23, 2004 12:40
UDS source term units Ale FLUENT 2 July 12, 2002 13:01


All times are GMT -4. The time now is 07:23.