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

scale(a, b) function

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

Like Tree2Likes
  • 2 Post By ngj

Reply
 
LinkBack Thread Tools Display Modes
Old   August 31, 2010, 09:05
Default use of scale(a, b) function?? error: ‘scale’ was not declared in this scope
  #1
New Member
 
Ozgur Kirlangic
Join Date: May 2009
Location: Istanbul
Posts: 16
Rep Power: 8
ozgur is on a distinguished road
Hi,

In the Programmer’s Guide there is a description of a function named as scale:

Quote:
As the name suggests, the scale function is a tool for scaling the components of one tensor by the components of another tensor of the same rank. It is evaluated as the product of corresponding components of 2 tensors, e.g., scaling vector a by vector b would produce vector c whose components are ci = scale(a, b) = (a1b1, a2b2, a3b3)
I have tried to use it however, I get the following error during compilation:
Code:
error: ‘scale’ was not declared in this scope
My code is simple:

Code:
#include "fvCFD.H"
...
vector a(1,2,3), b(4,5,6), c;
c=scale(a,b)

What can I do about this?

Thanks,

Ozgur

Last edited by ozgur; August 31, 2010 at 10:23. Reason: title was not descriptive
ozgur is offline   Reply With Quote

Old   August 31, 2010, 11:25
Default
  #2
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Deltares, Delft, The Netherlands
Posts: 1,619
Rep Power: 25
ngj will become famous soon enoughngj will become famous soon enough
Unfortunately the Programmers Guide is not up to date, as the function is now called "cmptMultiply".

Best regards,

Niels
sharonyue and yvesc like this.
ngj is offline   Reply With Quote

Old   September 1, 2010, 05:53
Default
  #3
New Member
 
Ozgur Kirlangic
Join Date: May 2009
Location: Istanbul
Posts: 16
Rep Power: 8
ozgur is on a distinguished road
Hi Niels,

Thanks again

Ozgur
ozgur is offline   Reply With Quote

Old   December 31, 2012, 02:02
Default
  #4
Member
 
Nick
Join Date: Nov 2011
Location: Tongji University,Shanghai,China
Posts: 33
Blog Entries: 6
Rep Power: 5
sunliming is on a distinguished road
Can cmptMultiply be used for scalarField, e.g. cmptMultiply(points1,points2) where type of points1 and points2 is scalarField?
sunliming is offline   Reply With Quote

Old   December 31, 2012, 10:19
Default
  #5
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Deltares, Delft, The Netherlands
Posts: 1,619
Rep Power: 25
ngj will become famous soon enoughngj will become famous soon enough
Hi Nick,

You can just multiply two scalarFields with the operator "*", which result in a scalarField, so the cmptMultiply is not needed.

Happy New Year

Niels
ngj is offline   Reply With Quote

Old   January 1, 2013, 03:11
Default
  #6
Member
 
Nick
Join Date: Nov 2011
Location: Tongji University,Shanghai,China
Posts: 33
Blog Entries: 6
Rep Power: 5
sunliming is on a distinguished road
Hi Niels,
Thank you! It's cool and convenient to use "*" for scalarField multiply. Sometimes it is just hard to access OpenFOAM for there are so few documents about how to operate field. And it's slow and inefficient to dig in the source code itself. If there are some instructions of handing fields, that would be better for OpenFAOM user programming!

Happy new year!
Nick
sunliming is offline   Reply With Quote

Old   May 26, 2014, 19:34
Default Thank you Niels
  #7
New Member
 
yves candau
Join Date: May 2014
Posts: 4
Rep Power: 3
yvesc is on a distinguished road
Quote:
Originally Posted by ngj View Post
Unfortunately the Programmers Guide is not up to date, as the function is now called "cmptMultiply".

Best regards,

Niels
*sigh* this is 2013, and the Programmer's Guide is still not up-to-date.
Lost me 1/2 hour.
yvesc is offline   Reply With Quote

Old   August 27, 2015, 17:02
Default
  #8
New Member
 
Paul W. Fontana
Join Date: Jul 2013
Posts: 5
Rep Power: 4
pfontana is on a distinguished road
How do you multiply a vector field by a scalar constant? If alpha is a const and U is a vector field (e.g. velocity), is it just cmptMultiply(U,alpha) or cmptMultiply(alpha,U)? (I tried just using a * U, but I got a compile-time error. The file createFields.H defines alpha as follows:

Quote:
Info<< "Reading transportProperties\n" << endl;

IOdictionary transportProperties
(
IOobject
(
"transportProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);

dimensionedScalar alpha
(
transportProperties.lookup("alpha")
);
and the file transportProperties contains an entry for alpha (even though that shouldn't matter for compilation??):
Quote:
alpha alpha [ 0 0 -1 0 0 0 0 ] 7.0;
)

The compile-time error I get is
Quote:
fatal error: error in backend: IO failure on output stream.
pfontana 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
Compile problem ivanyao OpenFOAM Running, Solving & CFD 1 October 12, 2012 09:31
BlockMesh FOAM warning gaottino OpenFOAM Native Meshers: blockMesh 7 July 19, 2010 14:11
latest OpenFOAM-1.6.x from git failed to compile phsieh2005 OpenFOAM Bugs 25 February 9, 2010 05:37
Error with Wmake skabilan OpenFOAM Installation 3 July 28, 2009 00:35
Axisymmetrical mesh Rasmus Gjesing (Gjesing) OpenFOAM Native Meshers: blockMesh 10 April 2, 2007 14:00


All times are GMT -4. The time now is 14:08.