Platform: All Platforms Applies to: COMSOL Multiphysics® Versions: All versions

Problem Description

When I install or start COMSOL I get the following error message on Windows (or a similar message on Linux):

An error has occurred.
See the log file C:\Users\my_name\.comsol\v60\configuration\comsol\1234123423424.log.

Solution

There are several situations where this problem can occur:

A: Write problems in home or temp directory

If you have limited disk space in your home directory, or if you do not have write permissions, this message may appear because COMSOL cannot write during solution time. The log file typically includes error messages like these:

No space left on device
Cannot open native file
Disk error while writing to temporary solution file
Failed to create OOC file Failed to create out-of-core file

Also, the system temp directory is used by COMSOL during solution and can cause problems. The temp directory may be smaller than you expect, especially on Linux systems.

Workaround

Here is how you change the directory to which COMSOL writes temporary files:

  • Start COMSOL Multiphysics, go to the menu Options>Preferences>Files and change the folders for recovery and temporary files. It is also possible to turn off the saving of recovery files. The new folder locations need to have plenty of disk space available, and write permissions.

Alternatively, change the location of the COMSOL preferences folder, not only temporary files and recovery files:

  • Add the following command switches to the COMSOL command:

-prefsdir D:\work\comsol60data -tmpdir D:\work\comsol60data -configuration D:\work\comsol60data\configuration\comsol

Here, D:\work is an area where you have plenty of disk space available, and write permissions.

In Windows, the simplest way to do this is to right-click the COMSOL shortcut and select Properties. In the Target edit field, add the switches above after comsol.exe, separated by spaces. The target can for example look like:

"C:\Program files\COMSOL\COMSOL60\Multiphysics\bin\win64\comsol.exe" -prefsdir D:\work\comsol60data -tmpdir D:\work\comsol60data -configuration D:\work\comsol60data\configuration\comsol

On Linux, just add the switches to the comsol command. For example, if you have plenty of disk space available in /scratch, the command would look like this:

/usr/local/comsol60/multiphysics/bin/comsol -prefsdir /scratch/comsol60data -tmpdir /scratch/comsol60data -configuration /scratch/comsol60data/configuration/comsol

You can write a small script or define an alias that does this automatically.

Permanent command switches

If you are using MacOS or Linux, you can apply the switches permanently by editing the file comsol.ini that resides in the same directory as comsol, typically /usr/local/comsol60/multiphysics/bin/glnxa64 (for Linux). Add the following two switches starting with -Dcs one by one on separate lines:

-Dcs.prefsdir=/scratch/comsol60data
-Dcs.tmpdir=/scratch/comsol60data

Now save comsol.ini. Repeat the process above for the other .ini files in the same directory.
Note: this option requires write permission to the COMSOL installation directory.

For Windows, you can currently do the same if you are using the Java GUI. If you are using the default .NET GUI, some files will still be written to the default directory. Using the command line switches work as expected.

Personal command switches

An alternative is to use your own, personal comsol.ini file (for example, if you do not have write permissions to the installation directory). Make a copy of the comsol.ini file, for example as c:\work\mycomsol.ini. Now, start COMSOL with the following target:
"C:\Program files\COMSOL\COMSOL60\Multiphysics\bin\win64\comsol.exe" -comsolinifile c:\work\mycomsol.ini

B: Visual Studio runtime libraries not installed

When you install COMSOL on Windows from the DVD, runtime components of Visual C++ Libraries required to run COMSOL are automatically installed on the machine. One situation when this can fail is if you start COMSOL directly from a network disk by double-clicking comsol.exe, without having run the COMSOL installation program at least once. You will get the error message in the title of this solution. In the log file you may find the following error messages:
Can't find dependent libraries
Error loading native library
Could not load native library

In some rare cases, the redistributables fail to install even if you run the COMSOL installer DVD. Another situation when this may occur is if you run on a Windows HPC Server 2008 compute cluster. The runtime libraries will need to be installed on each compute node as shown below.

Workaround

Find the COMSOL installation DVD or download the offline installer, which is a DVD image of the installation DVD, from the Product Download page.

  • In the ext subdirectory of the DVD (for example D:), you will find the file

    D:\ext\vcredist_vc142_x64.exe

  • Double-click the file and answer yes or OK to any questions. If you run on a Windows HPC Server 2008 cluster, use the clusrun command to install on all nodes in the cluster.

  • Start COMSOL.