Simulation Times Increasing with LiveLink for MATLAB

Please login with a confirmed email address before reporting spam

I've been running automated simulations with LiveLink for MATLAB, where each run makes small geometry changes, remeshes, and solves. I’ve noticed that while early simulations take ~45 minutes, after 20–30 runs, the simulation time increases a lot (more than twice), even though the problem size stays the same.

Has anyone else experienced this slowdown?

Are there best practices for preventing resource issues or memory leaks when using LiveLink for MATLAB for multiple runs? Is it helpful to restart the COMSOL server periodically, and if so, how do you safely restart it without physically clicking from the start menu?

Would appreciate any advice!


2 Replies Last Post 14.11.2025, 19:01 GMT-5
Lars Gregersen COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 20 hours ago 14.11.2025, 04:29 GMT-5

Hi Aragon

This shouldn't happen. What version of Comsol are you using?

Can you share the code? Either here or by sending it to support?

Restarting is possible, but shouldn't really be necessary. The commands mphstartcomsolmphserver and mphstart can be used for this.

-------------------
Lars Gregersen
Comsol Denmark
Hi Aragon This shouldn't happen. What version of Comsol are you using? Can you share the code? Either here or by sending it to support? Restarting is possible, but shouldn't really be necessary. The commands mphstartcomsolmphserver and mphstart can be used for this.

Please login with a confirmed email address before reporting spam

Posted: 6 hours ago 14.11.2025, 19:01 GMT-5

Hi Aragon

This shouldn't happen. What version of Comsol are you using?

Can you share the code? Either here or by sending it to support?

Restarting is possible, but shouldn't really be necessary. The commands mphstartcomsolmphserver and mphstart can be used for this.

Hi Lars, thank you for your response. I am using COMSOL 6.3.

I'm attaching the relevant code snippets I use for looping through my simulations. I am afraid it might be difficult to replicate the issue directly, since my workflow involves opening a large .mph file and editing it, unfortunately, the file is too massive to share. However, this code should be pretty self explanatory and does cover the entire process.

If you spot anything in the code that might be causing problems, I’d appreciate your insights.

As for starting the server: I launch COMSOL + MATLAB from the Windows Start menu, then run my Base.m script from the MATLAB GUI. I haven’t used mphstart in this code, but when I tried adding it previously in the IterPartitionandSolve.m, I received an error indicating that the server was already running. So, there should be another way to close it and reopen it, if I understood it correctly.

Let me know if there’s anything in the code that stands out, or if you have any suggestions based on this setup. Thank you!

>Hi Aragon > >This shouldn't happen. What version of Comsol are you using? > >Can you share the code? Either here or by sending it to support? > >Restarting is possible, but shouldn't really be necessary. The commands mphstartcomsolmphserver and mphstart can be used for this. Hi Lars, thank you for your response. I am using COMSOL 6.3. I'm attaching the relevant code snippets I use for looping through my simulations. I am afraid it might be difficult to replicate the issue directly, since my workflow involves opening a large .mph file and editing it, unfortunately, the file is too massive to share. However, this code should be pretty self explanatory and does cover the entire process. If you spot anything in the code that might be causing problems, I’d appreciate your insights. As for starting the server: I launch COMSOL + MATLAB from the Windows Start menu, then run my Base.m script from the MATLAB GUI. I haven’t used mphstart in this code, but when I tried adding it previously in the IterPartitionandSolve.m, I received an error indicating that the server was already running. So, there should be another way to close it and reopen it, if I understood it correctly. Let me know if there’s anything in the code that stands out, or if you have any suggestions based on this setup. Thank you!

Reply

Please read the discussion forum rules before posting.

Please log in to post a reply.

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.