Platform: All Platforms Applies to: COMSOL Multiphysics® 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\v63\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\comsol63data -tmpdir D:\work\comsol63data -configuration D:\work\comsol63data\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\COMSOL63\Multiphysics\bin\win64\comsol.exe" -prefsdir D:\work\comsol63data -tmpdir D:\work\comsol63data -configuration D:\work\comsol63data\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/comsol63/multiphysics/bin/comsol -prefsdir /scratch/comsol63data -tmpdir /scratch/comsol63data -configuration /scratch/comsol63data/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/comsol63/multiphysics/bin/glnxa64 (for Linux), /Applications/comsol63/multiphysics/bin/maci64 or /Applications/comsol63/multiphysics/bin/macarm64 (for Mac), or C:\Program Files\COMSOL\COMSOL63\Multiphysics\bin\win64 (for Windows). Add the following two switches starting with -Dcs one by one on separate lines:

-Dcs.prefsdir=PATH_TO_COMSOL63_PREFS
-Dcs.tmpdir=PATH_TO_COMSOL63_TMP

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.

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\COMSOL63\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

    vcredist_vc143_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.