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

Division of dimensioned scalars

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

Like Tree3Likes
  • 1 Post By Joachim
  • 1 Post By Bernhard
  • 1 Post By Joachim

Reply
 
LinkBack Thread Tools Display Modes
Old   August 5, 2013, 20:54
Default Division of dimensioned scalars
  #1
Senior Member
 
Joachim
Join Date: Mar 2012
Location: Atlanta
Posts: 140
Rep Power: 6
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, 03:50
Default
  #2
Senior Member
 
Bernhard
Join Date: Sep 2009
Location: Delft
Posts: 790
Rep Power: 12
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.
immortality likes this.
Bernhard is offline   Reply With Quote

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

Old   August 7, 2013, 03:52
Default
  #4
Senior Member
 
Elvis
Join Date: Mar 2009
Location: Sindelfingen, Germany
Posts: 579
Blog Entries: 5
Rep Power: 13
elvis is on a distinguished road
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 online now   Reply With Quote

Old   August 7, 2013, 09:53
Default
  #5
Senior Member
 
Joachim
Join Date: Mar 2012
Location: Atlanta
Posts: 140
Rep Power: 6
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 likes this.
Joachim is offline   Reply With Quote

Old   August 8, 2013, 01:53
Default
  #6
Senior Member
 
Elvis
Join Date: Mar 2009
Location: Sindelfingen, Germany
Posts: 579
Blog Entries: 5
Rep Power: 13
elvis is on a distinguished road
Thx for the explaination

greets

elvis
elvis is online now   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
Using trig/hyperbolic functions with dimensioned scalars cpro OpenFOAM Programming & Development 4 April 21, 2013 18:27
How to apply Transport Equation on DPM Scalars? yuhai FLUENT 0 May 19, 2010 10:38
generic scalars in star manuutin STAR-CD 0 August 7, 2009 06:05
about .run file and information of scalars isidro CD-adapco 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 06:01.