CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Programming & Development (
-   -   Adding a term that includes time (

ozgur August 27, 2010 10:05

Adding a term that includes time

A very simple question: In OpenFOAM, how can I add a term that includes time into my equations?

My first attempt which doesn't work is as follows:


Thanks for any comments,


ngj August 27, 2010 10:23

Hi Ozgur

time() is not a known object, so use runTime.time().value() instead. The "value()" request is given as it strips off the dimensionality of the given time and merely returns a scalar. This is needed as exp() does not know how to handle dimensionedScalar.

Further you need to do "A * Foam::exp(- runTime.time().value())", where A is a dimensionedScalar A("null", dims , 1), where dims is the dimensions of ddt(T). If this is not added you will get an error while running the program due to the dimensional checking functionality, however the program will compile.

Instead of dims you could e.g. do "dimensionSet( 0, 1, -1, 0, 0, 0, 0)" which sets the dimensions to those of velocity.

Have a nice weekend,


ozgur August 27, 2010 13:59

Hi Niels,

Thank you very much. It worked fine :)



All times are GMT -4. The time now is 06:25.