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.

Calling an outside script

Please login with a confirmed email address before reporting spam

Hi all!
I'm starting a new project in COMSOL (I'm quite new to the program). The thing is, I have a fortran routine that solves a radiation exchange progress between surfaces quite in an efficient way. So, I would like to have this exchange process as a boundary condition for an induction heating problem.

The thing is that this boundary condition is temperature-dependent (not only of the local element but also from all others, since it's a closed cavity), so this boundary condition should be updated in every thermal iteration.

Is there a way for doing it just from inside COMSOL? The Fortran program can generate an ASCII output with some values that can be read by comsol and then update the boundary...

I'm guessing that perhaps with the Matlab integration it could be "easier" to implement, but I'm completely lost as where to start looking.

Thanks in advance!

P.S.: I'm posting this message as a 3.5a question, but I'm changing to 4.2 during next month, so replies to instructions in any of the two versions is welcome.

2 Replies Last Post 2 juin 2015, 10:41 UTC−4

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 3 août 2011, 05:34 UTC−4
In general you can do this in COMSOL 4.2. Create an external function under the Global Definitions branch in the model tree. You have to compile a dll (or other link library depending on OS) and the dll has to define some functions. Everything is explained in the reference manual under model.func(). You can also find code examples there. That is at least a starting point for you.

--
Niklas
In general you can do this in COMSOL 4.2. Create an external function under the Global Definitions branch in the model tree. You have to compile a dll (or other link library depending on OS) and the dll has to define some functions. Everything is explained in the reference manual under model.func(). You can also find code examples there. That is at least a starting point for you. -- Niklas

Please login with a confirmed email address before reporting spam

Posted: 10 years ago 2 juin 2015, 10:41 UTC−4
Dear Aquiles,

Would you please let me know if you successfully iterate between Fortran and Comsol?

Best,
------------------------------------
Dear Aquiles, Would you please let me know if you successfully iterate between Fortran and Comsol? Best, ------------------------------------

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.