September 2, 2024
Mohamed Aly Sayed

Resolving Paraview Linking Issues with OpenFOAM

When working with OpenFOAM on Linux - especially after restaging your system or buying a new laptop, you might run into version compatibility issues with Paraview. OpenFOAM often comes bundled with an older version of Paraview, which may not run smoothly or support the latest features you need. In this article, I’ll will help you resolve these issues by linking the latest version of Paraview to your environment variables and ensuring compatibility across all installed versions of OpenFOAM. Cutting all the fluff let’s dive right into it.

Step by Step Guide

1. Download the Latest Pre-Compiled Version of Paraview

To begin, you’ll need to download the latest pre-compiled version of Paraview. This ensures you’re working with the most up-to-date and feature-rich version.

2. Remove the Existing Binary of the Old Paraview

Before installing the new version, it’s important to remove the old version of Paraview that came with your OpenFOAM installation (say you have v5.10). This avoids any conflicts that might arise from having multiple versions.

  • Open a terminal and run the following command:

sudo apt-get remove paraviewopenfoam510

If you have any other versions of Paraview installed, make sure to remove them as well to prevent any version conflicts.


3. Move the Latest Pre-Compiled Version to Directory

Next, move the downloaded Paraview version to the  directory, which is a common location for optional software packages.

  • Navigate to the directory where you downloaded Paraview.
  • Use the following command to move it to opt

sudo cp -r ParaView-5.13.0-MPI-Linux-Python3.10-x86_64 /opt/

4. Rename the Version for Simplicity

To make future references easier, rename the Paraview directory to something simpler.

  • Run the following command:

sudo mv /opt/ParaView-5.13.0-MPI-Linux-Python3.10-x86_64/ /opt/ParaView-5.13/

  • Next, add Paraview to your system’sby inserting the following line into your ~/.bashrc file:

export PATH=$PATH:/opt/ParaView-5.13/bin/

  • After editing ~/.bashrc, run source ~/.bashrc to update your terminal session.

5. Create New Soft Links

To ensure that your system points to the correct version of Paraview, you’ll need to create new symbolic links.

  • First, remove any existing or corrupted links to avoid conflicts:

sudo rm /usr/bin/paraview sudo rm -r /usr/lib/paraview-*

  • Then, create new soft links:

sudo ln -s /opt/ParaView-5.13/bin/paraview /usr/bin/paraview; sudo ln -s /opt/ParaView-5.13/lib/paraview-5.13/ /usr/lib/paraview-5.13

6. Create a Desktop Instance for Easy Launching

For a smoother experience, you can create a desktop entry for Paraview, allowing you to launch it easily from your application menu.

  • Open a new file in the applications directory:

sudo gedit /usr/share/applications/paraview.desktop

7. Configure the Desktop Entry

In the file you just created, add the following content to set up Paraview as an application on your system:

[Desktop Entry]
Version=1.0
Name=ParaView 5.13
Exec=paraview
Terminal=false
Icon=/opt/ParaView-5.13/share/icons/hicolor/96x96/apps/paraview.png Type=Application
x-Ayatana-Desktop-Shortcuts=NewWindow
[NewWindow Shortcut Group]
Name=New Window
Exec=paraview
TargetEnvironment=Unity

  • Save and close the file.

Now, Paraview should be easily accessible from your application menu, but also you can launch it from any local destination in your terminal. By following the above steps, you’ll have the latest version of Paraview integrated with OpenFOAM - make sure you don’t ignore any error and try to resolve all steps.

Happy simulating!

6 Ways I Can Help You

  1. Join CFD Dose on Skool to be part of a talented CFD community.
  2. Need support with your CFD journey? Check out my CFD mentorship programs.
  3. Are you completely new to CFD? Enroll in my T-Flows CFD Crash Course.
  4. Looking for a pre-processing tool to run CFD cases? Check out SplashFOAM.
  5. Want to grow your CFD network? let’s have an open 1:1 chat.
  6. Join a community of 22,000+ solopreneurs and entrepreneurs.