# scale(a, b) function

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

August 31, 2010, 09:05
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
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)```

Thanks,

Ozgur

Last edited by ozgur; August 31, 2010 at 10:23. Reason: title was not descriptive

 August 31, 2010, 11:25 #2 Senior Member   Niels Gjoel Jacobsen Join Date: Mar 2009 Location: Deltares, Delft, The Netherlands Posts: 1,619 Rep Power: 25 Unfortunately the Programmers Guide is not up to date, as the function is now called "cmptMultiply". Best regards, Niels sharonyue and yvesc like this.

 September 1, 2010, 05:53 #3 New Member   Ozgur Kirlangic Join Date: May 2009 Location: Istanbul Posts: 16 Rep Power: 8 Hi Niels, Thanks again Ozgur

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

 December 31, 2012, 10:19 #5 Senior Member   Niels Gjoel Jacobsen Join Date: Mar 2009 Location: Deltares, Delft, The Netherlands Posts: 1,619 Rep Power: 25 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

 January 1, 2013, 03:11 #6 Member   Nick Join Date: Nov 2011 Location: Tongji University,Shanghai,China Posts: 33 Blog Entries: 6 Rep Power: 5 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

May 26, 2014, 19:34
Thank you Niels
#7
New Member

yves candau
Join Date: May 2014
Posts: 4
Rep Power: 3
Quote:
 Originally Posted by ngj 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.

August 27, 2015, 17:02
#8
New Member

Paul W. Fontana
Join Date: Jul 2013
Posts: 5
Rep Power: 4
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.

 Thread Tools Display Modes Linear Mode

 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 OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post ivanyao OpenFOAM Running, Solving & CFD 1 October 12, 2012 09:31 gaottino OpenFOAM Native Meshers: blockMesh 7 July 19, 2010 14:11 phsieh2005 OpenFOAM Bugs 25 February 9, 2010 05:37 skabilan OpenFOAM Installation 3 July 28, 2009 00:35 Rasmus Gjesing (Gjesing) OpenFOAM Native Meshers: blockMesh 10 April 2, 2007 14:00

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