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 Jun 2, 2015, 10:41 a.m. EDT

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Aug 3, 2011, 5:34 a.m. EDT
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: 9 years ago Jun 2, 2015, 10:41 a.m. EDT
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.