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

float or scalar for runTime.tinename() ??

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 2, 2011, 13:26
Default float or scalar for runTime.tinename() ??
  #1
Member
 
Fábio César Canesin
Join Date: Mar 2010
Location: Florianópolis
Posts: 67
Rep Power: 16
Canesin is on a distinguished road
I had look around but I'm not finding a method to call to provide the time the simulation is on.. I wan't to make a change when time = changetime..


I have tried to do casting like:

float(runTime.timeName()) but it do not work.... I'm starting to believe I will have to implement the casting..
Canesin is offline   Reply With Quote

Old   February 2, 2011, 14:12
Default
  #2
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Hi Fábio,

Type casting only works when the variables are similar, for example between pointers and between double/int/float and so on. To convert a string to float, you can use atof.

But I think that runTime.value() will get you the value already in scalar (float or double) format, without the need to convert the value.

Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   February 2, 2011, 15:36
Default
  #3
Member
 
Fábio César Canesin
Join Date: Mar 2010
Location: Florianópolis
Posts: 67
Rep Power: 16
Canesin is on a distinguished road
LOL ...

Thanks Bruno, I had looked at the doxygen but the method "value()" was not there, I believe it's because it is from inheritance..
Canesin is offline   Reply With Quote

Old   February 2, 2011, 17:13
Default
  #4
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Quote:
Originally Posted by Canesin View Post
I had looked at the doxygen but the method "value()" was not there, I believe it's because it is from inheritance..
You should always check the fine print
Quote:
Originally Posted by http://foam.sourceforge.net/docs/cpp/classFoam_1_1Time.php
__________________
wyldckat 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
Solving for an additional species CO in coalChemistryFoam N. A. OpenFOAM Programming & Development 3 February 18, 2019 05:58
dieselFoam problem!! trying to introduce a new heat transfer model vivek070176 OpenFOAM Programming & Development 10 December 23, 2014 23:48
OpenFOAM and gpgpu dewald OpenFOAM 37 August 29, 2014 09:32
Missing math.h header Travis FLUENT 4 January 15, 2009 11:48
to correct me an udf program farida hamadi FLUENT 0 December 18, 2004 05:54


All times are GMT -4. The time now is 10:26.