Problems with running COMSOL with MATLAB

In summary: YourUserName"In summary, the conversation discusses a problem with running COMSOL with MATLAB 2007b. The issue is caused by a new memory allocation strategy in MATLAB, and the recommended solution is to set a Windows environment variable. If this does not work, there is a secondary solution involving editing certain files.
  • #1
twlewisut
1
0
Hello.

I recently obtained a trial version of COMSOL, and was trying to run COMSOL with MATLAB. During the installation process, I clicked option "MATLAB interface" under the "Features" tab. After installing COMSOL, I could not locate the "COMSOL with MATLAB" folder in my Programs menu. Also, I tried typing in "comsol" into the command window in MATLAB, but it said that it didn't recognize the function 'comsol.' The MATLAB that we have is MATLAB R2007b. Is this an acceptable version of MATLAB. If so, do you know what I could be doing wrong? I appreciate any help you may be able to give.

Thanks in advance!
 
Physics news on Phys.org
  • #2
During installation there is a check box that you must click to include the MATLAB and comsol interface. you may need to reinstall the program. If you have MATLAB 2007b you also may have additional trouble after installing the interface. follow these instructions.

Problem Description
When I start COMSOL with MATLAB 2007b, neither MATLAB nor the COMSOL Multiphysics user interface appear.
Solution
This problem has been reported by some users of COMSOL with MATLAB 2007b on Windows. MATLAB 2007a and earlier versions are not affected by this problem.
The problem seems to be related to a new memory allocation strategy introduced in MATLAB 2007b, and the solution is to tell MATLAB to use the old strategy instead by setting the Windows environment variable MATLAB_RESERVE_LO to 0.
Primary solution
To fix the problem, The MathWorks recommends to set this environment variable as follows:
1. In Windows, click Start > Control Panel > System > Advanced > Environment Variables.
2. Click the New button in the System variables frame.
3. Enter MATLAB_RESERVE_LO in the Variable name field and 0 in the Variable value field.
4. Click OK and close the dialog boxes.
Secondary solution
In some rare occasions, the primary solution might not help. Then try the following:
1. Try to start COMSOL with MATLAB once. It will fail but a file java.opts will be written to the COMSOL 3.4 installation directory.
2. Open the java.opts file, remove the line -Xmx256m and save the file.
3. Open the file comsol.opts in the bin directory under your COMSOL installation and change the line

JAVAOPTS=on

to

JAVAOPTS=off

This will ensure that a new java.opts file is not written automatically every time you start COMSOL with MATLAB and your manually edited comsol.opts will always be used.
4. When you use "Connect to MATLAB" from the File menu in COMSOL Multiphysics it will look for a java.opts file in your home directory. This means that you should copy the edited java.opts file to the home directory as well. This will be something like

C:\Documents and Settings\
 
  • #3


Hello,

Thank you for reaching out regarding your issue with running COMSOL with MATLAB. It seems that there may be a compatibility issue between the version of MATLAB you are using (R2007b) and the COMSOL software. It is possible that the "MATLAB interface" feature may not be fully compatible with older versions of MATLAB. I would recommend checking the system requirements for COMSOL and ensuring that your MATLAB version meets the minimum requirements.

If your MATLAB version is compatible, I would suggest reaching out to the COMSOL technical support team for further assistance. They may be able to provide more specific guidance on how to properly integrate the two software programs.

In the meantime, you could also try reinstalling COMSOL and ensuring that the "MATLAB interface" feature is selected during the installation process. It is also possible that there may be an issue with the installation itself, so a fresh install may help resolve the issue.

I hope this helps and that you are able to successfully run COMSOL with MATLAB. If you continue to experience difficulties, please don't hesitate to reach out to the technical support team for further assistance.

Best,
 

Related to Problems with running COMSOL with MATLAB

1. Can I run COMSOL with MATLAB on any operating system?

No, COMSOL and MATLAB are both supported on Windows and Linux operating systems, but not on Mac OS.

2. Why am I getting an error when trying to run COMSOL with MATLAB?

There could be several reasons for this, such as compatibility issues between the versions of COMSOL and MATLAB, missing or incorrect installation of necessary toolboxes, or incorrect syntax in the code. It is important to carefully check for any errors and troubleshoot accordingly.

3. How do I pass data between COMSOL and MATLAB?

Data can be passed between COMSOL and MATLAB using the COMSOL-MATLAB LiveLink feature. This allows for seamless transfer of data and parameters between the two software, making it easier to integrate them for simulations.

4. Can I use parallel computing with COMSOL and MATLAB?

Yes, both COMSOL and MATLAB support parallel computing, which can significantly speed up simulations. However, this requires a license for the Parallel Computing Toolbox in MATLAB and the COMSOL Multiphysics license with the LiveLink for MATLAB module.

5. How can I improve the performance of COMSOL and MATLAB simulations?

There are a few ways to improve the performance of simulations with COMSOL and MATLAB, such as reducing the mesh size, optimizing the code, and using parallel computing. It is also important to ensure that the hardware being used meets the minimum system requirements for both software.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
7
Views
7K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
13K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
2K
  • Programming and Computer Science
Replies
25
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
3K
Back
Top