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

How do I convert scalar to word

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

Like Tree1Likes
  • 1 Post By bala_gk1988

Reply
 
LinkBack Thread Tools Display Modes
Old   January 7, 2016, 05:29
Default How do I convert scalar to word
  #1
New Member
 
Balajee
Join Date: Dec 2013
Posts: 12
Rep Power: 5
bala_gk1988 is on a distinguished road
I want to convert a number to a string in openfoam.

Code:
scalar count(11);
    word fieldName(count);
    Info << fieldName << endl;
If I execute the above piece of code I get the following error

word::stripInvalid() called for word
For debug level (= 2) > 1 this is considered fatal
Aborted (core dumped)

What seems to be the problem here?
Thankyou
bala_gk1988 is offline   Reply With Quote

Old   January 8, 2016, 03:11
Default
  #2
New Member
 
Balajee
Join Date: Dec 2013
Posts: 12
Rep Power: 5
bala_gk1988 is on a distinguished road
Never mind. Converting scalar to word should be done like this

Code:
word fieldName(name(i));
mbookin likes this.
bala_gk1988 is offline   Reply With Quote

Reply

Tags
scalar word conversion

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
Issue symmetryPlane 2.5d extruded airfoil simulation 281419 OpenFOAM Running, Solving & CFD 5 November 28, 2015 14:09
problem during mpi in server: expected Scalar, found on line 0 the word 'nan' muth OpenFOAM Running, Solving & CFD 2 April 10, 2015 05:42
Diverging solution in transonicMRFDyMFoam tsalter OpenFOAM Running, Solving & CFD 30 July 7, 2014 06:20
compressible flow in turbocharger riesotto OpenFOAM 50 May 26, 2014 01:47
is internalField(U) equivalent to zeroGradient? immortality OpenFOAM Running, Solving & CFD 7 March 29, 2013 02:27


All times are GMT -4. The time now is 18:42.