CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

Access simulation time in dictionary expression

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 1, 2021, 10:28
Default Access simulation time in dictionary expression
  #1
New Member
 
Join Date: Oct 2019
Posts: 10
Rep Power: 6
Kraneberger is on a distinguished road
Hello everyone,


I am trying to define a a time dependent rotation axis in my dynamicMeshDict. I think I also found the right tools here: https://www.openfoam.com//documentat...on-syntax.html


In my dynamicMeshDict I now want to define axisy as:



FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object dynamicMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

axisx 0;
axisy #eval "time()";
axisz 1;
...



Upon running pimpleFoam this gives me the error:


Object time does not exist or wrong type in expression
<<<<
time()
>>>>


When I instead use "pi()" instead of "time()" it correctly sets axisy to 3.141 etc. In the documentation it says about the "time()"-function:


time() : the current simulation time-value (if used by the parser)


So maybe it has something to do with the parser? I wouldn't know how to change that, though. Does anybody know what to do and could help me? Thanks in advance.



Greetings,
Kraneberger
Kraneberger is offline   Reply With Quote

Old   September 1, 2021, 17:44
Default
  #2
Senior Member
 
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 5,675
Rep Power: 66
LuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura about
PI() is a mathematical function in the math library which is linked in almost every compiled solver. This is like trying to do 2*1.

time() tries to retrieve the Foam::Time object, the variable that stores the time that you want, which isn't even created until runtime and is associated with a mesh object or a field object. E.g. mesh.time()

You are trying to make a declaration in a dict. Unfortunately I don't know enough about any of the DyM solvers to fix your issue.
LuckyTran is offline   Reply With Quote

Old   September 2, 2021, 02:18
Default
  #3
New Member
 
Join Date: Oct 2019
Posts: 10
Rep Power: 6
Kraneberger is on a distinguished road
I see, thanks for the quick answer. Is there a way to include or create a Foam object that I could then call *.time() on. For example with #codeStream?



I am using v2012.



Greetings,
Kraneberger
Kraneberger is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
LES, Courant Number, Crash, Sudden Alhasan OpenFOAM Running, Solving & CFD 5 November 22, 2019 02:05
laplacianFoam with source term Herwig OpenFOAM Running, Solving & CFD 17 November 19, 2019 13:47
How to export time series of variables for one point? mary mor OpenFOAM Post-Processing 8 July 19, 2017 10:54
Problem with an old Simulation FrankW CFX 3 February 8, 2016 04:28
Problem with rhoSimpleFoam matteo_gautero OpenFOAM Running, Solving & CFD 0 February 28, 2008 06:51


All times are GMT -4. The time now is 21:54.