CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (http://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Adding a term that includes time (http://www.cfd-online.com/Forums/openfoam-programming-development/79582-adding-term-includes-time.html)

ozgur August 27, 2010 10:05

Adding a term that includes time
 
Hi,

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:

solve
(
fvm::ddt(T)==-exp(-time())
);

Thanks for any comments,

Ozgur

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,

Niels

ozgur August 27, 2010 13:59

Hi Niels,

Thank you very much. It worked fine :)

cheers,

Ozgur


All times are GMT -4. The time now is 12:56.