Tuesday, April 2, 2024

User's Home Mounting Point in Linux: File System Table

 While ago, I decided to dedicate a separate hard-disk to the $HOME directory during the installation of Debian. Recently, after the complete removal of Windows from my PC, and deletion of the associated partition, I found enough space to mount $Home along with the root on the main NVME disk. What I needed to do was to First, open a terminal and login as the root system administrator:

su

Password: ***

The next step was to logout from the current user, take a copy and unmount $HOME partition:

init 1 

mkdir temp_home

cp -r /home/* /temp_home

umount -fl /home

Now, it was time to change the name of the temporary directory:

mv /temp_home /home

By commenting out the corresponding line in the file system table "/etc/fstab", the system would forget about the other partition with the mounting point of $HOME. Saving fstab, it is needed to reload daemons:

systemctl daemon-reload

The last step was to override the ownership of the /home directore:

chown -R user /home/*

Sunday, April 30, 2023

Compiling OpenFOAM on CentOS Stream 9

Compiling OpenFOAM on more popular Linux distros has become a trivial task due to the abundance of the references and guides published on the internet. However, for the first time that I tried compiling OpenFOAM on CentOS Stream, I realized that there is a lack of A-to-Z guide for more recent RHEL-based linux distros. This first post here is to fill the gap.

The main steps for the compilation are exactly the same as those published in the official OpenFOAM page: Compiling OpenFOAM from Source Code

However, the first step (installing Software for Compilation) is different here. Unfortunately, the old guide on the OpenFOAM page (Upgrading RHEL 6 Packages for OpenFOAM) would neither be useful for more recent RHEL-based OSs. The following steps are tested on CentOS Stream 9.

Installing the main tools

Before starting, it is easier to gain superuser privileges:
 
sudo -s

Installing EPEL RPM (the release version should match your OS, 9 in my case):
 
yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm

It is now easy to install the compilation and development prerequisites

yum groupinstall 'Development Tools'
yum install openmpi openmpi-devel
yum install CGAL-devel 

Now, we want to add a link to the boost library
 
ln -s /usr/lib64/libboost_thread-mt.so /usr/lib64/libboost_thread.so

And adding the OpenMPI binaries to system path

export PATH=/usr/lib64/openmpi/bin/:$PATH
export LD_LIBRARY_PATH=/usr/lib64/openmpi/lib/:$LD_LIBRARY_PATH 

Installing QT tools for compiling ParaView

yum install qt5
yum install qt5-qtbase-devel

Adding a link to qmake-qt5 (to be able to call it just as qmake)

ln -s /usr/bin/qmake-qt5 /usr/bin/qmake

yum install qt5-qtwebkit-devel
yum install qt5-qttools-devel
yum install qt5-qtsvg-devel
yum install qt5-qtxmlpatterns-devel

Now, we can end the superuser privilidges

exit

Setting the OpenFOAM Environment

Supposing that the OpenFOAM source has already been downloaded, the necessary paths can be set for bashrc

source $HOME/OpenFOAM/OpenFOAM-dev/etc/bashrc

Compiling thirdparty applications

From within the ThirdParty-dev directory run the commands

./Allwmake
./makeParaView
wmRefresh

Compiling OpenFOAM

From within the OpenFOAM-dev directory run the command
 
./Allwmake -j [no. of processors]

Finalizing the installation

The final step is to check if OpenFOAM is working. To this end, change the directory to 

cd /$HOME/OpenFOAM/OpenFOAM-dev/tutorials/incompressible/icoFoam/cavity/cavity

and run OpenFOAM mesher and solver, and post-process the result
 
blockMesh
icoFoam
paraFoam
 
If you are able to see the result, everything went well.