|
[Sponsors] |
June 27, 2010, 13:13 |
accessing current time
|
#1 |
Senior Member
Henry Arrigo
Join Date: Jun 2010
Location: Italy
Posts: 100
Rep Power: 16 |
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 |
|
August 4, 2010, 08:14 |
|
#2 |
New Member
sven
Join Date: Jul 2010
Location: Germany
Posts: 7
Rep Power: 16 |
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; } } |
|
August 4, 2010, 14:54 |
|
#3 |
Senior Member
Henry Arrigo
Join Date: Jun 2010
Location: Italy
Posts: 100
Rep Power: 16 |
thanks Svenne. it was very helpful
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Time step size and max iterations per time step | pUl| | FLUENT | 31 | October 23, 2020 23:50 |
Accessing wall clock time from Scheme or UDF | Angelo Sozzi | FLUENT | 2 | February 23, 2018 06:03 |
Changing deltaT of current time step | olwi | OpenFOAM Running, Solving & CFD | 1 | April 30, 2009 05:55 |
IcoFoam parallel woes | msrinath80 | OpenFOAM Running, Solving & CFD | 9 | July 22, 2007 03:58 |
How to read out time used for current solution | Angelo Sozzi | FLUENT | 1 | July 7, 2004 14:16 |