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

Units within the source code

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 5, 2008, 15: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: 17
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, 19:20
Default Hi Daniel Please use: di
  #2
Senior Member
 
Join Date: Mar 2009
Posts: 248
Rep Power: 18
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, 19:49
Default Hi, thanks for the answer -
  #3
Member
 
Daniel Harlacher
Join Date: Mar 2009
Location: Davis, CA, United States
Posts: 60
Rep Power: 17
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, 16:44
Default Hi Daniel It will help the
  #4
Senior Member
 
Join Date: Mar 2009
Posts: 248
Rep Power: 18
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, 17: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: 17
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


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
UDS source term units Ale FLUENT 3 March 29, 2017 07:08
Units of additonal Variable and its source Gauranga Das CFX 2 December 6, 2007 03: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


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