1.4. Ubuntu 16.04.1 LTS

1.4.1. Change hostname

hostnamectl set-hostname andrew-pc
sudo nano /etc/hostname
    (andrew-pc in here)
sudo nano /etc/hosts
    (andrew-pc in here)

1.4.2. Chromium from Ubuntu Software

Changed default to Chromium

1.4.3. Background

I have saved this to Pictures/do_not_delete.svg

1.4.4. Adwaita-dark theme

Only need Adwaita theme (copied from laptop) /usr/share/themes/Adwaita

Install Tweak Tool and Unity Tweak from Ubuntu Software Centre

You must restart Ubuntu

1.4.5. Texmaker

Ubuntu software center

1.4.6. Dropbox

Ubuntu software

1.4.7. Aspell

sudo apt-get install aspell

1.4.8. VPN

Pulse Secure

1.4.9. NCDU

For quick size of directories

$ sudo apt-get install ncdu

1.4.10. GIMP

Ubuntu software centre

1.4.11. Pointwise

sh pw-V18.0R2-linux_x86_64-jre.sh

Next, Accept

/home/andrew/Pointwise/PointwiseV18.0R2 is installation directory

hydro/Pointwise_User copied from MyBookDuo

1.4.12. Tree

sudo apt-get install tree

1.4.13. TMUX 2.1

sudo apt-get install tmux

1.4.14. VIM 7.4

sudo apt-get install vim

1.4.15. Screen

Brightness and Lock > Turn screen off when incative for: Never

1.4.16. Changed password for user

passwd

1.4.17. Git

sudo apt-get install git

1.4.18. CURL

sudo apt-get install curl

1.4.19. Silver Searcher

sudo apt-get install silversearcher-ag

1.4.20. Sphinx

sudo apt-get install python-sphinx

Made a mistake, install Anaconda then pip install Sphinx(version)

sudo apt-get remove --purge python-sphinx
sudo apt-get autoremove

1.4.21. Synaptic Package Manager

Ubuntu software

1.4.22. Anaconda

https://www.anaconda.com/distribution/

64-bit (x86) Installer

sh Anaconda3-2019.07-Linux-x86_64.sh

1.4.23. Anaconda - condarc

Remove the prompt .condarc:

changeps1: False

1.4.24. Anaconda - install modules for same Python version as Isambard 2

conda search "python"
conda create -n py3 python=3.6.5 anaconda
pip install PyFoam==0.6.6

“distributed 1.21.8 requires msgpack, which is not installed.”

pip install msgpack

pip install numpy

pip install matplotlib

pip install scipy

pip install deap

pip install pyDOE

pip install evoalgos

pip install GPy

pip install cma

pip install numpy-stl

pip install Sphinx==2.0.1

pip install nbsphinx

pip install sphinx_rtd_theme
sphinx-quickstart

1.4.25. Filezilla

Ubuntu software centre

1.4.26. IscaOpt code

bashrc:

export PYTHONPATH="${PYTHONPATH}:/hydro/Dropbox/00_Hydro_Project/7_code/0000_bayesian_optimisation_readthedocs/source"
cd FrontCalc
python setup.py install

(EA algorithm doesnt work as OF not installed?)

export PYTHONPATH="${PYTHONPATH}:/hydro/Dropbox/00_Hydro_Project/7_code/0000_evolutionary_algorithm_readthedocs/arahat-cfd-test-problem-suite-untouched-sphinx/source"

1.4.27. OpenFOAM 4.x

Have to install 32 bit integer support for compatiblility with CFMesh

https://openfoamwiki.net/index.php/Installation/Linux/OpenFOAM-4.x/Ubuntu#Ubuntu_16.04

  • Ubuntu 16.04

Here you have the following choices:

  • Follow the official instructions for building from source code: OpenFOAM Source Repository

  • Or by following the detailed step-by-step instructions below…

Discussion thread where you can ask questions about these steps: No thread available. Please a create a new thread in the forum.

Steps:

  1. Switch to root mode (administrator), to install the necessary packages:

sudo -s
  • If the ‘sudo’ command tells you’re not in the sudoers list, then run:

su -
  1. Update the apt-get cache by running:

apt-get update
  1. Install the necessary packages:

apt-get install git-core build-essential binutils-dev cmake flex bison zlib1g-dev qt4-dev-tools libqt4-dev libqtwebkit-dev gnuplot \
libreadline-dev libncurses-dev libxt-dev libopenmpi-dev openmpi-bin libboost-system-dev libboost-thread-dev libgmp-dev \
libmpfr-dev python python-dev libcgal-dev

Note: It has been reported that the following should also be executed in some cases, so that ParaView will build properly:

apt-get install libglu1-mesa-dev libqt4-opengl-dev

Now exit from the root mode:

exit
  1. Download and unpack (here you can copy-paste all in single go):

#OpenFOAM downloading and installation
cd ~
mkdir OpenFOAM
cd OpenFOAM
git clone https://github.com/OpenFOAM/OpenFOAM-4.x.git
git clone https://github.com/OpenFOAM/ThirdParty-4.x.git
  1. Optional: Let’s make a few symbolic links that should ensure that the correct global MPI installation is used by this OpenFOAM installation:

ln -s /usr/bin/mpicc.openmpi OpenFOAM-4.x/bin/mpicc
ln -s /usr/bin/mpirun.openmpi OpenFOAM-4.x/bin/mpirun

This way we avoid having problems in case there is more than one MPI toolbox installed in your Ubuntu system, for example if MPICH2 is installed and is the default MPI toolbox.

For building OpenFOAM itself, it depends on whether you have installed the i686 or x86_64 architecture of Ubuntu. To check this, run:

uname -m

Now, accordingly:

  • For building with the normal 32-bit integer support (maximum 2.147×10^9 cells, faces or points):

source /hydro/OpenFOAM/OpenFOAM-4.x/etc/bashrc FOAMY_HEX_MESH=yes
  1. Save an alias in the personal .bashrc file, simply by running the following command:

echo "alias of4x='source /hydro/OpenFOAM/OpenFOAM-4.x/etc/bashrc $FOAM_SETTINGS'" >> $HOME/.bashrc

Note: This last line means that whenever you start a new terminal window or tab, you should run the alias command associated to the OpenFOAM-4.x shell environment. In other words, whenever you start a new terminal, you should run:

of4x

For more information on this topic, read section Using aliases to help manage multiple OpenFOAM versions in the page Installation/Working with the Shell.

  1. Now, in order to build ParaView 5.0.1, including with the ability to use Python and MPI, a few steps are needed:

  1. Make sure you’re running in the ThirdParty folder and that the correct Qt version is used:

cd $WM_THIRD_PARTY_DIR
export QT_SELECT=qt4
  1. For building ParaView with Python and MPI, it depends on whether you have installed the i686 or x86_64 architecture of Ubuntu. To check this, run:

uname -m

Now, accordingly:

  • For i686:

#this will take a while... somewhere between 30 minutes to 2 hours or more
./makeParaView -python -mpi -python-lib /usr/lib/i386-linux-gnu/libpython2.7.so.1.0 > log.makePV 2>&1
  • For x86_64:

#this will take a while... somewhere between 30 minutes to 2 hours or more
./makeParaView -python -mpi -python-lib /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0 > log.makePV 2>&1
wmRefresh
  1. Now let’s build OpenFOAM:

  1. Go into OpenFOAM’s main source folder and be certain that the correct Qt version is being used:

cd $WM_PROJECT_DIR
export QT_SELECT=qt4
  1. This next command will take a while… somewhere between 30 minutes to 3-6 hours:

./Allwmake -j 4 > log.make 2>&1

Note: The “4” refers to the number of cores to be used for building in parallel. In addition, the amount of RAM needed for building scales with the number of cores used, something like 1GB of RAM per core; a minimum of 1.5GB is needed for linking the libraries, which is not done in parallel.

  1. Run it a second time for getting a summary of the installation:

./Allwmake -j 4 > log.make 2>&1

Note: Technically, the build will stop as soon as the first error is found. Running a second time only makes it easier to sort through between what’s already been built and where the crash occurred.

To check if everything went well: Check if icoFoam is working, by running this command:

icoFoam -help

1.4.28. CFMESH

$ cd ~
$ wget https://sourceforge.net/projects/cfmesh/files/v1.1.2/cfMesh-v1.1.2.tgz
$ tar zxvf cfMesh-v1.1.2.tgz
$ cd cfMesh-v1.1.2/
$ chmod u+x ./Allwmake
$ ./Allwmake

1.4.29. Build the problems

of4x # load your OpenFOAM installation using alias
cd Exeter_CFD_Problems/data/PitzDaily/solvers
chmod u+x ./Allmake
./Allmake
cd ../../../..
cd Exeter_CFD_Problems/data/KaplanDuct/solvers
chmod u+x ./Allmake
./Allmake
cd ../../../..
cd Exeter_CFD_Problems/data/HeatExchanger/solvers
chmod u+x ./Allmake
./Allmake

1.4.30. Test the problem suite

$ jupyter-notebook
import sys, time
import numpy as np
seed = 1435
np.random.seed(seed)

# import problem classes
import Exeter_CFD_Problems as TestProblems
verbose = False

sys.argv = sys.argv[:1]
print('Demonstration of the PitzDialy test problem.')
# set up directories.
settings = {
        'source_case': 'Exeter_CFD_Problems/data/PitzDaily/case_fine/',
        'case_path': 'Exeter_CFD_Problems/data/PitzDaily/case_single/',
        'boundary_files': ['Exeter_CFD_Problems/data/PitzDaily/boundary.csv'],
        'fixed_points_files': ['Exeter_CFD_Problems/data/PitzDaily/fixed.csv']
}
# instantiate the problem object
prob = TestProblems.PitzDaily(settings)
# get the lower and upper bounds
lb, ub = prob.get_decision_boundary()
# generate random solutions satisfying the lower and upper bounds.
x = np.random.random((1000, lb.shape[0])) * (ub - lb) + lb
rand_x = []
for i in range(x.shape[0]):
        if prob.constraint(x[i]): # check to see if the random solution is valid
            rand_x.append(x[i])
# evaluate for a solution
print('Number of control points: ', prob.n_control)
print('Decision vector: ', rand_x[0])
print('Running simulation ...')
start = time.time()
res = prob.evaluate(rand_x[0], verbose=verbose)
print('Objective function value:', res)
print('Time taken:', time.time()-start, ' seconds.')

1.4.31. TEXLive

sudo apt-get install texlive-full

1.4.32. DVIPNG (for saving figures)

sudo apt-get install dvipng

1.4.33. PDF Presenter Console

sudo apt-get install pdf-presenter-console

1.4.34. Foxit Reader

a. Change the directory containing the downloaded file (used /tmp as the example):
# cd /tmp
b. Uncompress the executable file
# gzip -d 'FoxitReader_version_Setup.run.tar.gz'
c. Untar the .tar file
# tar xvf 'FoxitReader_version_Setup.run.tar'
d. Run the installer:
# ./'FoxitReader_version_Setup.run'
e. Follow the steps on the screen to complete the installation

1.4.35. Problem with Ubuntu Software

https://www.maketecheasier.com/ubuntu-software-center-not-working-fixes/

sudo apt-get update && sudo apt get upgrade

sudo apt autoremove gnome-software && sudo apt install gnome-software

sudo apt-get update && sudo apt-get dist-upgrade -f

1.4.36. Problem with title bar being transparent

Create this file and add .config/gtk3.0/gtk.css

.header-bar {
  background-image: none;
  background-color: #313434;
  box-shadow: none;
}