CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (http://www.cfd-online.com/Forums/openfoam-solving/)
-   -   how to get current time as scalar? (http://www.cfd-online.com/Forums/openfoam-solving/64399-how-get-current-time-scalar.html)

louisgag May 9, 2009 22:08

how to get current time as scalar?
 
Hi,


I am trying to get something like sin(time().timeName()) but timeName is of type word and I couldn't find a scalar equivalent..

Anmyone has a simple solution to this?

thanks!

-Louis

su_junwei May 10, 2009 07:50

runTime.value()
 
Hi Louis

just test

//read from runTime
scalar t=runTime.value();

//read from a field ,for example U
scalar t=U.mesh().time().value() ;

//read from mesh
scalar t=mesh.time().value();

Junwei

louisgag May 10, 2009 10:01

Hi Junwei,

thanks for the help. I got it working with time().value()

-Louis


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