This article provides step-by-step instruction on installing CalculiX 2.17 binary executables on a personal computer running on Ubuntu 21.04. The binary executables here refers to the two (2) pre-compiled files, namely, CCX (the solver) and CGX (the pre/post tool). These pre-compiled executables are sufficient for most of us who want to explore CalculiX — i.e. without the hassle of compiling from the source package.

The instructions given are for a Ubuntu 21.04 system, but it should also work for Ubuntu 20.04 and other Ubuntu-compatible distributions with Pop!_OS inclusive.

Tested environment

An x64-based laptop running on Ubuntu 21.04

  • Linux kernel version: 5.11.0-25-generic

An x64-based desktop running on Pop!_OS 21.04

  • Linux kernel version: 5.11.0-7620-generic

Preparation

1: Install the Open MPI package (and its dependencies) if not yet installed. Open MPI is an open source Message Passing Interface developed for high-performance computing.

$ sudo apt install openmpi-bin (1)
1 The prompt symbol $ indicates that you are typing at a terminal emulator (e.g. Ubuntu Terminal).

Check the installation by the accessibility to its mpiexec (or mpirun) executable:

$ which mpiexec
/usr/bin/mpiexec

2: CalculiX CCX requires the 'libgfortran.so.4' library from the libgfortran4 package. To install libgfortran4, enter from a terminal as root (i.e. using the sudo command):

$ sudo apt install libgfortran4

You may check where the 'libgfortran.so.4' file sits and how it is linked.

$ sudo find /usr/ -iname libgfortran.so.4*
/usr/lib/x86_64-linux-gnu/libgfortran.so.4.0.0
/usr/lib/x86_64-linux-gnu/libgfortran.so.4
$ ll /usr/lib/x86_64-linux-gnu/libgfortran.so.4*
lrwxrwxrwx 1 root root      20 Nov 26  2020 /usr/lib/x86_64-linux-gnu/libgfortran.so.4 -> libgfortran.so.4.0.0
-rw-r--r-- 1 root root 1964056 Nov 26  2020 /usr/lib/x86_64-linux-gnu/libgfortran.so.4.0.0

CGX and CCX executables

Check the latest versions of CalculiX CGX and CCX executables from http://www.dhondt.de/.

Available downloads for the graphical interface (CalculiX GraphiX: cgx):

Available downloads for the solver (CalculiX CrunchiX: ccx):

Prepare a dedicated package folder for CalculiX under your HOME directory (e.g. '~/CalculiX/'), and then open a terminal from there.

$ cd ~/CalculiX/

Download the CGX executable using wget:

$ wget http://www.dhondt.de/cgx_2.17.1.bz2
--2021-07-25 18:52:00--  http://www.dhondt.de/cgx_2.17.1.bz2
Resolving www.dhondt.de (www.dhondt.de)... 81.169.145.94, 2a01:238:20a:202:1094::
Connecting to www.dhondt.de (www.dhondt.de)|81.169.145.94|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1185224 (1.1M) [application/x-bzip2]
Saving to: ‘cgx_2.17.1.bz2’

cgx_2.17.1.bz2               100%[==============================================>]   1.13M   330KB/s    in 3.5s

2021-07-25 18:52:05 (330 KB/s) - ‘cgx_2.17.1.bz2’ saved [1185224/1185224

Likewise, download the CCX executable:

$ wget http://www.dhondt.de/ccx_2.17.tar.bz2
--2021-07-25 18:53:14--  http://www.dhondt.de/ccx_2.17.tar.bz2
Resolving www.dhondt.de (www.dhondt.de)... 81.169.145.94, 2a01:238:20a:202:1094::
Connecting to www.dhondt.de (www.dhondt.de)|81.169.145.94|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2510094 (2.4M) [application/x-bzip2]
Saving to: ‘ccx_2.17.tar.bz2’

ccx_2.17.tar.bz2             100%[==============================================>]   2.39M   422KB/s    in 5.8s

2021-07-25 18:53:20 (422 KB/s) - ‘ccx_2.17.tar.bz2’ saved [2510094/2510094]

Unzip the compressed files accordingly:

$ bunzip2 cgx_2.17.1.bz2
  • This will turn the 'cgx_2.17.1.bz2' file into 'cgx_2.17.1' in the current work folder.

$ tar -xvjf ccx_2.17.tar.bz2 -C ~
  • This will extract the 'ccx_2.17' file and put it under the 'ccx_2.17/src/' folder.

Now, assign the executable permission to the to extracted files, and then move them to the '/usr/local/bin/' directory.

$ chmod +x cgx_2.17.1
$ chmod +x ccx_2.17/src/ccx_2.17
$ sudo mv ~/CalculiX/cgx_2.17.1 /usr/local/bin/
$ sudo mv ~/CalculiX/ccx_2.17/src/ccx_2.17 /usr/local/bin/

Also, let us create symbolic links to the two (2) respective "version-numbered" executables so that we can launch them with and without the release number tags:

$ sudo ln -s /usr/local/bin/cgx_2.17.1 /usr/local/bin/cgx
$ sudo ln -s /usr/local/bin/ccx_2.17 /usr/local/bin/ccx

TIP. Instead of creating symbolic links, you may either define command aliases in your '~/.bashrc' file as in (You need to reread the '~/.bashrc' configuration accordingly):

# CalculiX ##
alias cgx='/usr/local/bin/cgx_2.17.1'
alias ccx='/usr/local/bin/ccx_2.17'

Double-check if the two (2) executables are accessible:

$ which cgx
/usr/local/bin/cgx
$ which ccx
/usr/local/bin/ccx

You may now delete the compressed files if you wish.

$ rm *.bz2

CalculiX documents and examples

In this section, we will be downloading the documents and example files directly from the local package folder (as we did in the previous steps):

$ cd ~/CalculiX/

Get the compressed documentation and example files for CGX and CCX, one at a time:

$ wget http://www.dhondt.de/cgx_2.17.1.htm.tar.bz2
$ wget http://www.dhondt.de/cgx_2.17.1.exa.tar.bz2
$ wget http://www.dhondt.de/ccx_2.17.htm.tar.bz2
$ wget http://www.dhondt.de/ccx_2.17.test.tar.bz2

Unzip the compressed files accordingly:

$ tar -xvjf cgx_2.17.1.htm.tar.bz2 -C ~ (1)
$ tar -xvjf cgx_2.17.1.exa.tar.bz2 -C ~
$ tar -xvjf ccx_2.17.htm.tar.bz2 -C ~
$ tar -xvjf ccx_2.17.test.tar.bz2 -C ~
1 If you have not moved (nor deleted) the 'cgx_2.17.1' file, it will hinder tar from extracting the content in the 'cgx_2.17.1' directory (because a file of the same name will mislead it). Creating the folder explicitly (i.e. mkdir cgx_2.17.1) in prior will alleviate the issue.

Have a look at the directory structure — either using Files browser or using tree (To use the tree command, install it by sudo apt install tree).

$ tree . -d -L 2
.
├── ccx_2.17
│   ├── doc
│   ├── src
│   └── test
└── cgx_2.17.1
    ├── doc
    └── examples

7 directories

You may delete the compressed files if you wish.

$ rm *.bz2

Testing CalculiX

What follows are basic test routines for checking CalculiX installation.

Test routine 1

Open a terminal, copy and paste the whole command block to the terminal window:

mkdir -p ~/temp/test/calculix/
cd ~/temp/test/calculix
cp ~/CalculiX/ccx_2.17/test/beamp.inp .
ccx beamp | tee beamp.log
(1)
1 An extra blank line is intended for the last command line to be parsed on pasting.
 :

  STEP            1

 Static analysis was selected

 Decascading the MPC's

 Determining the structure of the matrix:
 number of equations
 720
 number of nonzero lower triangular matrix elements
 37458

 Using up to 1 cpu(s) for the stress calculation.

 Using up to 1 cpu(s) for the symmetric stiffness/mass contributions.

 Factoring the system of equations using the symmetric spooles solver
 Using up to 1 cpu(s) for the stress calculation.


 Job finished

________________________________________

Total CalculiX Time: 0.031531
________________________________________

To view the result using CGX, enter:

$ cgx -v beamp.frd
  1. Press and hold the left mouse button from anywhere outside the boxed area to open the CCX context menu.

  2. With the left mouse button still pressed, move the cursor to select Datasets → 1 DISP 1.000000, and then release the mouse button.

  3. Activate the CCX context menu again to select this time Datasets → -Entity- → 4 ALL.

  4. Try rotating the view by using the left mouse button from inside the boxed graphics area.

  5. Open the CCX context menu to select Hardcopy → Png-hardcopy, and then release the mouse button. Check the resulted image.

  6. To terminate the session, open the CCX context menu to select -QUIT- at the bottom.

shot0101

Test routine 2

Below is for testing a parallel run. Change the value for the OMP_NUM_THREADS parameter if you have less than four (4) threads available.

mkdir -p ~/temp/test/calculix/
cp ~/CalculiX/ccx_2.17/test/hueeber1.inp .
export OMP_NUM_THREADS=4
ccx hueeber1 | tee hueeber1.log
(1)
1 An extra blank line is intended for the last command line to be parsed on pasting.
 :

 iteration 14

 Number of contact spring elements=684

 Using up to 4 cpu(s) for the stress calculation.

 Using up to 4 cpu(s) for the symmetric stiffness/mass contributions.

 Factoring the system of equations using the symmetric spooles solver
 Using up to 4 cpu(s) for the stress calculation.

line search factor=0.819112

 Using up to 4 cpu(s) for the stress calculation.

 average force= 0.009631
 time avg. forc= 0.009631
 largest residual force= 0.000000 in node 17442 and dof 2
 largest increment of disp= 8.377836e-07
 largest correction to disp= 1.486631e-18 in node 112 and dof 2

 convergence

 the increment size exceeds the remainder of the step and is decreased to 0.000000e+00

nonlingeo iinc=1
 pressure ratio (smallest/largest pressure over all contact areas) =0.000000e+00

 Using up to 4 cpu(s) for the stress calculation.


 Job finished

________________________________________

Total CalculiX Time: 6.647776
________________________________________

This run didn’t produce any graphical output (because none was set in the input deck). Check the printed result instead:

$ gedit hueeber1.dat
shot0102

Post-installation configuration

HTML documentations

Using Files browser, locate the HTML index files for CGX and CCX to bookmark them to your favourite Web browser.

  • CGX: ~/CalculiX/cgx_2.17.1/doc/cgx/index.html

  • CCX: ~/CalculiX/ccx_2.17/doc/ccx/index.html

shot0103
shot0104