CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Bugs (https://www.cfd-online.com/Forums/openfoam-bugs/)
-   -   Foam::word problem (https://www.cfd-online.com/Forums/openfoam-bugs/67163-foam-word-problem.html)

wang.zhy August 5, 2009 23:21

Foam::word problem
 
word a = "abc" ;
word b = a +"b"; //no problem
word c = b +"'" ; //do have a problem"word::stripInvalid() called for word abcc....",but this had no
//problem in OF1.5:(

olesen August 6, 2009 02:40

Quote:

Originally Posted by wang.zhy (Post 225418)
word a = "abc" ;
word b = a +"b"; //no problem
word c = b +"'" ; //do have a problem"word::stripInvalid() called for word abcc....",but this had no
//problem in OF1.5:(


The documentation is not so clear about it, but a "word" should not contain whitespace, quotes (single or double), '/' path separators, ';' end statement or ' {', '}' brace brackets.

This has been the same for many versions of OpenFOAM, so you are lucky to have not have problems before. What might be different is your setting of the debug variable for 'word'. If it is zero, the words will not be checked on construction. With 1, they'll be checked and you'll get a warning. With 2 they'll be treated as a fatal error.

Thus for your above example (assuming you really want to use a quote inside the word), you really should be using a plain string not a word.

wang.zhy August 6, 2009 03:01

thank you ,olesen !
your suggestion is good for me !


All times are GMT -4. The time now is 17:31.