Discussion Closed This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.

How to consider the system time in COMSOL?

Please login with a confirmed email address before reporting spam

Dear Engineer: I want to know how to use the random() function to proced a random related with the systme time?Thank you.


1 Reply Last Post 2019年5月11日 GMT-4 10:44

Please login with a confirmed email address before reporting spam

Posted: 5 years ago 2019年5月11日 GMT-4 10:44

Hi,

I am not sure what you intend to do exactly, but my bet is that you could do that using an external function. From the documentation:

An external function defines an interface to one or more functions written in the C language (which can be a wrapper function interfacing source code written in, for example, Fortran). Such an external function can be used, for example, to interface a user-created shared library. Note that the extension of a shared library file depends on the platform: .dll (Windows), .so (Linux), or .dylib (macOS).

So you could create a simple C program with no input and which outputs the system time, and then process that in any way you want in your model.

Hope it helps!

Hi, I am not sure what you intend to do exactly, but my bet is that you could do that using an external function. From the documentation: > An external function defines an interface to one or more functions written in the C language (which can be a wrapper function interfacing source code written in, for example, Fortran). Such an external function can be used, for example, to interface a user-created shared library. Note that the extension of a shared library file depends on the platform: .dll (Windows), .so (Linux), or .dylib (macOS). So you could create a simple C program with no input and which outputs the system time, and then process that in any way you want in your model. Hope it helps!