CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

Run-time Code Compilation in controlDict

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 7, 2012, 05:40
Default Run-time Code Compilation in controlDict
  #1
Senior Member
 
JNSN's Avatar
 
Jan
Join Date: Jul 2009
Location: Hamburg
Posts: 144
Rep Power: 20
JNSN is on a distinguished road
Hi Foamers,

I try to implement a variable time Step in the controlDict with the #codeStream directive based on the actual time. Something like
Code:
this->db().time().value()
produces the error massage "invalid use of ‘this’ in non-member function". Does anyone have an idea to get a reference to time?

Thanks and best regards,
Jan
JNSN is offline   Reply With Quote

Old   October 16, 2022, 23:53
Default
  #2
New Member
 
xinyu
Join Date: Apr 2022
Posts: 24
Rep Power: 4
lliyuu is on a distinguished road
May I ask if you have solved this problem? I have also encountered this problem.
lliyuu is offline   Reply With Quote

Old   October 17, 2022, 11:46
Default
  #3
Senior Member
 
JNSN's Avatar
 
Jan
Join Date: Jul 2009
Location: Hamburg
Posts: 144
Rep Power: 20
JNSN is on a distinguished road
sorry, but It's has been to long, can't remember. But as far as I know, there is now a functionObject available to control the time step. May this is helpful for your requirements.



Best,
Jan
JNSN is offline   Reply With Quote

Old   October 17, 2022, 22:08
Default
  #4
New Member
 
xinyu
Join Date: Apr 2022
Posts: 24
Rep Power: 4
lliyuu is on a distinguished road
Thank you very much for your help. I will try this method.
lliyuu is offline   Reply With Quote

Old   October 18, 2022, 00:51
Default
  #5
Member
 
Tatsuya Shimizu
Join Date: Jul 2012
Posts: 42
Rep Power: 14
LongGe is on a distinguished road
Quote:
Originally Posted by JNSN View Post
Hi Foamers,

I try to implement a variable time Step in the controlDict with the #codeStream directive based on the actual time. Something like
Code:
this->db().time().value()
produces the error massage "invalid use of ‘this’ in non-member function". Does anyone have an idea to get a reference to time?

Thanks and best regards,
Jan

Hi

Can't you access time() of db() with the following code?

const IOdictionary& d = static_cast<const IOdictionary&>(dict);
scalar t = d.db().time().value();
__________________
Our Work: https://www.idaj.co.jp/product/ennovacfd/openfoam_gui/
Powered by Ennova : https://ennova-cfd.com/
Ennova's Channel Partners : http://www.wolfdynamics.com/
LongGe is offline   Reply With Quote

Old   October 19, 2022, 05:15
Default
  #6
New Member
 
xinyu
Join Date: Apr 2022
Posts: 24
Rep Power: 4
lliyuu is on a distinguished road
Thank you very much for your help. I'm a novice. I've tried this method. It works. Why?
I can use scalar t=this ->db(). time(). value() in the u file;
However, it is not allowed in the coalcloudproperties file.
In addition, vectorField&field=* this; The same problem will arise.
Thanks and best regards,
liyuu
Attached Images
File Type: jpg Z9GDMSH`[13109VS87ED3}5.jpg (83.8 KB, 4 views)
File Type: png 2RDC3)TBAQF8`X$VVE{)S@Q.png (37.3 KB, 4 views)
lliyuu is offline   Reply With Quote

Old   October 24, 2022, 06:23
Default
  #7
New Member
 
xinyu
Join Date: Apr 2022
Posts: 24
Rep Power: 4
lliyuu is on a distinguished road
Quote:
Originally Posted by LongGe View Post
Hi

Can't you access time() of db() with the following code?

const IOdictionary& d = static_cast<const IOdictionary&>(dict);
scalar t = d.db().time().value();
Thank you very much for your help. I'm a novice. I've tried this method. It works. Why?
I can use scalar t=this ->db(). time(). value() in the u file;
However, it is not allowed in the coalcloudproperties file.
In addition, vectorField&field=* this; The same problem will arise.
Thanks and best regards,
liyuu
Attached Images
File Type: jpg Z9GDMSH`[13109VS87ED3}5.jpg (83.8 KB, 1 views)
File Type: png 2RDC3)TBAQF8`X$VVE{)S@Q.png (37.3 KB, 1 views)
lliyuu 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
Extrusion with OpenFoam problem No. Iterations 0 Lord Kelvin OpenFOAM Running, Solving & CFD 8 March 28, 2016 12:08
Run time Selection Mechanism - Some help required to understand jaswi OpenFOAM Programming & Development 3 October 29, 2015 14:42
Orifice Plate with a fully developed flow - Problems with convergence jonmec OpenFOAM Running, Solving & CFD 3 July 28, 2011 06:24
Full pipe 3D using icoFoam cyberbrain OpenFOAM 4 March 16, 2011 10:20
Could anybody help me see this error and give help liugx212 OpenFOAM Running, Solving & CFD 3 January 4, 2006 19:07


All times are GMT -4. The time now is 13:08.