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

accessing current time

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 27, 2010, 12:13
Default accessing current time
  #1
Senior Member
 
Henry Arrigo
Join Date: Jun 2010
Location: Italy
Posts: 100
Rep Power: 15
Henry Arrigo is on a distinguished road
Dear all.
hi
working with star-CCM+ i want to write a field function which uses current physical time. how can I access current physical time?

thanx alot
Henry Arrigo is offline   Reply With Quote

Old   August 4, 2010, 07:14
Default
  #2
New Member
 
sven
Join Date: Jul 2010
Location: Germany
Posts: 7
Rep Power: 15
svenne is on a distinguished road
It is possible to access time using java or usercode (C, FORTRAN) The documentation how to compile and bind user code is actually pretty good. Read it and follow the instructions mentioned there.

The following files should do what you want, except that they are only updated while iterating. (Havent found a way to force an update yet)

Code:
//filename =  uclib.c
#include "uclib.h"
void physicaltime(Real*, int, Real*);
void 
uclib()
{
ucfunc(physicaltime, "VectorFieldFunction", "physicaltime");
ucarg(physicaltime, "Cell", "Temperature", sizeof (int));
}
Code:
//filename = physicaltime.c
#include "uclib.h"
#include <stdlib.h>
void physicaltime(Real (*result)[3], int size, Real *T) {
 
int i;
unsigned int t;
int seconds, minutes, hours;
t = time(NULL);
 
seconds = t % 60;
minutes = (t % 3600 - seconds) / 60;
hours = (t % 86400 - 60 * minutes - seconds) / 3600;
for (i = 0; i != size; ++i) {
result[i][0] = hours;
result[i][1] = minutes;
result[i][2] = seconds;
}
}
this gives you access to a vector field function called user physicaltime [hrs, min, sec].
svenne is offline   Reply With Quote

Old   August 4, 2010, 13:54
Default
  #3
Senior Member
 
Henry Arrigo
Join Date: Jun 2010
Location: Italy
Posts: 100
Rep Power: 15
Henry Arrigo is on a distinguished road
thanks Svenne. it was very helpful
Henry Arrigo 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
Time step size and max iterations per time step pUl| FLUENT 33 October 23, 2020 22:50
Accessing wall clock time from Scheme or UDF Angelo Sozzi FLUENT 2 February 23, 2018 05:03
Changing deltaT of current time step olwi OpenFOAM Running, Solving & CFD 1 April 30, 2009 04:55
IcoFoam parallel woes msrinath80 OpenFOAM Running, Solving & CFD 9 July 22, 2007 02:58
How to read out time used for current solution Angelo Sozzi FLUENT 1 July 7, 2004 13:16


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