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

Division of dimensioned scalars

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

Like Tree6Likes
  • 1 Post By Joachim
  • 3 Post By Bernhard
  • 2 Post By Joachim

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 5, 2013, 21:54
Default Division of dimensioned scalars
  #1
Senior Member
 
Joachim
Join Date: Mar 2012
Location: Paris, France
Posts: 145
Rep Power: 15
Joachim is on a distinguished road
Hey everyone!

I have a small problem with dimensioned scalars...

let's say, I have

dimensionedScalar sA = ("A", [0 1 -1 0 0 0 0], 1.5);
dimensionedScalar sB = ("B", [0 1 0 0 0 0 0], 2.0);
dimensionedScalar sC = ("C", [0 2 -1 0 0 0 0], 2.0);

initially, I did sC/(sA*sB), but it turned out that the dimension of that scalar was [0 -1 -1 0 0 0 0] (??????)

I tried the following:

sA*sB -> [0 2 -1 0 0 0 0]
1/(sA*sB) -> [0 -2 1 0 0 0 0]
sA/(sB*sC) -> [0 -1 -1 0 0 0 0]

I checked in dimensionedScalar.H, but it seems that only the division and multiplication of a scalar with a dimensioned scalar are defined...(but then, why would the multiplication of sA and sB give the right result??)

Has anyone already seen this happening?

Thank you very much for your help!

Joachim
immortality likes this.
Joachim is offline   Reply With Quote

Old   August 6, 2013, 04:50
Default
  #2
Senior Member
 
Bernhard
Join Date: Sep 2009
Location: Delft
Posts: 790
Rep Power: 21
Bernhard is on a distinguished road
Did you try constructing your dimensionedScalar like this:
Code:
dimensionedScalar sA("A",dimensionSet(0,1,-1,0,0,0,0), 1.5);
I am not so sure if you are constructing it correctly with your code.
jiejie, immortality and gnvijayk like this.
Bernhard is offline   Reply With Quote

Old   August 6, 2013, 10:09
Default
  #3
Senior Member
 
Joachim
Join Date: Mar 2012
Location: Paris, France
Posts: 145
Rep Power: 15
Joachim is on a distinguished road
Problem solved! thanks
Joachim is offline   Reply With Quote

Old   August 7, 2013, 04:52
Default
  #4
Senior Member
 
Elvis
Join Date: Mar 2009
Location: Sindelfingen, Germany
Posts: 620
Blog Entries: 6
Rep Power: 24
elvis will become famous soon enough
Hi Joachim,

and could you explain the solution, would be great if you share for the others that will visit this discussion

Thx´s

elvis
elvis is offline   Reply With Quote

Old   August 7, 2013, 10:53
Default
  #5
Senior Member
 
Joachim
Join Date: Mar 2012
Location: Paris, France
Posts: 145
Rep Power: 15
Joachim is on a distinguished road
Hi,

Bernhard was completely right. Actually, I was directly reading the dimensionedScalars from a dictionary

in the .C file, I was calling:
const dimensionedScalar Uinf(perturbDict.lookup("Uinf"));

You could find this in the dictionary:
Uinf Uinf [0 1 -1 0 0 0 0] 10.0;

What is pretty strange is that it actually worked...for some cases. I changed it to:

const dimensionedScalar Uinf("Uinf", dimensionSet(0,1,-1,0,0,0,0), readScalar(perturbDict.lookup("Uinf")));

with Uinf 10.0 in the dictionary. It works just fine.
Hope that will help somebody else one day.

Joachim
elvis and beatlejuice like this.
Joachim is offline   Reply With Quote

Old   August 8, 2013, 02:53
Default
  #6
Senior Member
 
Elvis
Join Date: Mar 2009
Location: Sindelfingen, Germany
Posts: 620
Blog Entries: 6
Rep Power: 24
elvis will become famous soon enough
Thx for the explaination

greets

elvis
elvis is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using trig/hyperbolic functions with dimensioned scalars cpro OpenFOAM Programming & Development 4 April 21, 2013 19:27
How to apply Transport Equation on DPM Scalars? yuhai FLUENT 0 May 19, 2010 11:38
generic scalars in star manuutin STAR-CD 0 August 7, 2009 07:05
about .run file and information of scalars isidro Siemens 0 March 11, 2004 12:37
The Field Scalars in Tascflow Darcy CFX 0 November 19, 2003 23:14


All times are GMT -4. The time now is 04:21.