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 May 11, 2019, 10:44 a.m. EDT

Please login with a confirmed email address before reporting spam

Posted: 5 years ago May 11, 2019, 10:44 a.m. EDT

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!

Note that while COMSOL employees may participate in the discussion forum, COMSOL® software users who are on-subscription should submit their questions via the Support Center for a more comprehensive response from the Technical Support team.