CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > CD-adapco

accessing current time

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools 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: 7
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: 7
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: 7
Henry Arrigo is on a distinguished road
thanks Svenne. it was very helpful
Henry Arrigo is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 On
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 31 August 21, 2015 04:46
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
Accessing wall clock time from Scheme or UDF Angelo Sozzi FLUENT 0 July 6, 2005 18:24
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 20:42.