CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Using codestream in controlDict (https://www.cfd-online.com/Forums/openfoam-solving/99760-using-codestream-controldict.html)

pad April 11, 2012 03:59

Using codestream in controlDict
 
Hi all,

I am having some trouble using #codestream in controlDict file.

Basically, what I want is outlined below:

transientRunTime 0.816326530612;
application transientSimpleDyMFoam;
startFrom startTime;
startTime 0;
stopAt endTime;
endTime #codeStream
{
code
#{
scalar startFrom = readScalar(dict.lookup("startFrom"));
scalar runTime = readScalar(dict.lookup("transientRunTime"));
os << startFrom+runTime;
#};
};

However, when I run the simulation I get the following error:

--> FOAM FATAL IO ERROR:
wrong token type - expected Scalar, found on line 22 the word 'startTime'
file: /storage/42938/Projects/Poseidon_2/E.35000W.50Hz.8P/EIMP.35.50.01.EVOL.35.50.01/Q100/system/controlDict::startFrom at line 22.
From function operator>>(Istream&, Scalar&)
in file lnInclude/Scalar.C at line 91.
FOAM exiting

Does anyone know how to get the value of 'startTime' assigned to 'startFrom' instead of the name 'startTime'

BR,
Per


All times are GMT -4. The time now is 02:30.