Support for time-varying coordinate system in forces function object
OLD TITLE: Object time does not exist or wrong type when using expressions
Hi,
I am following the documentation about Expressions syntax here: https://www.openfoam.com/documentation/guides/latest/doc/openfoam-guide-expression-syntax.html
Under the constants section, it is mentioned that time()
is available and has access to the current simulation time. Here is an example:
forces_local
{
type forces;
libs ("libforces.so");
enabled true;
patches (cylinder);
//CofR (0 0 0.02);
writeControl timeStep;
writeInterval 1;
rho rhoInf;
rhoInf 1.225;
p p;
U U;
log true;
coordinateSystem
{
type cartesian;
origin (0 0 0.02);
coordinateRotation
{
type axesRotation; // local Cartesian co-ordinates
//e1 (0.7071067811865 -0.7071067811865 0);
//e2 (0.7071067811865 0.7071067811865 0);
e1 #eval "vector(cos(pi()*pi()/4.0),-sin(pi()*time()/4.0),0.0)";
e2 #eval "vector(sin(pi()*pi()/4.0),cos(pi()*pi()/4.0),0.0)";
}
}
I get the following error when I run pimpleFoam:
--> FOAM FATAL IO ERROR: (openfoam-2106)
Object time does not exist or wrong type in expression at position:36
<<<<
vector(cos(pi()*pi()/4.0),-sin(pi()*time()/4.0/time()),0.0)
^^^^ near here
Is it a bug? or I am missing something?
Thank you