Adopting linux as primary OS

Image Source: Forbes.com

Linux distros are being used by researchers, engineers, scientists and doctors among many other professionals. Linux is omnipresent, in servers providing critical cloud services, in desktops running scientific computations and for day-to-day use. Recently, the Indian state of Kerala saved $400 million by choosing Linux computers as the operating system for school computers under a state-wide project.

Recently, more and more people, especially with background, is data science and machine learning are making use of Linux distros as their primary desktops. Newer distros with more advanced features are being developed to enable better performance and ease of use for faster adoption and transition. The most recent of them is the Clear Linux project developed by Intel which provides developers and data scientist the capability to develop cutting edge machine learning applications and at the same time use it can be used as a regular desktop OS. Users of Ubuntu, Fedora, elementary OS, and Linux Mint would find it a similar environment but with a different way of managing packages in bundles rather than the traditional package managers used in Debian or Red Hat based systems.

The surge in Linux usage can be attributed to Zero or low cost, ability to develop software and perform complex scientific computations with ease.

The lack of large reliable data sets in fluid dynamics for deep learning

Fluid flow method using regression forest method by Ladicky et. al (Source)

Deep learning has gained prominence in varied sectors. Fluid dynamics simulations and experiments have also been explored to improve predictions over the past few years.

Ladicky et. al has explored a novel idea combining machine learning with fluid dynamics simulation. Here they made use of physics-based simulation as a regression problem, estimating the acceleration of every particle in every frame. The created a feature vector, directly modeling individual forces and constraints from the Navier-Stokes equations, predicting reliably the positions and velocities of particles in large time step on an unseen test video. A large training set of simulations obtained using traditional solvers were used for training using regression forest to obtain an approximate behavior of particles. Simulations like these reduce the need for computational resources for high-resolution real-time simulation.

“Given the inherent difficulties of long-term predictions, our vision for CFD in 2030 is grounded on a desired set of capabilities that must be present for a radical improvement in CFD predictions of critical flow phenomena associated with the key aerospace product/application categories, including commercial and military aircraft, engine propulsion, rotorcraft, space exploration systems, launch vehicle programs, air-breathing space-access configurations, and spacecraft entry, descent, and landing (EDL). “- NASA’s CFD Vision 2030 Study: A Path to Revolutionary Computational Aerosciences (NASA/CR–2014-218178

Modern day simulations in fluid dynamics have reached its pinnacle with traditional turbulence modelling. In NASA’s CFD Vision 2030 Study: A Path to Revolutionary Computational Aerosciences (NASA/CR–2014-218178) report the most critical area in CFD simulation capability that will remain a pacing item by 2030 will be the ability to adequately predict viscous turbulent flows with possible boundary layer transition and flow separation present.

But modeling knowledge and predictive capabilities can be built only on the basis of good data under varied conditions. The single thing that the fluid dynamics community suffers in the lack of reliable data under different conditions and for different applications. Training, algorithms, modeling techniques and machine learning approaches are secondary to develop data-driven turbulence modeling capabilities. This necessitates a global repository or database of reliable data both experimental and computational, where researchers from around the globe can pool in data and can benefit researchers focused on data-driven fluid dynamic simulations. Such a repository would open up better capabilities of predicting fluid dynamics and understanding flow in varied areas of interest unlike anything seen in history.

Installing Tensorflow(GPU), OpenCV and dlib on Ubuntu 18.04 Bionic Beaver

https://www.tensorflow.org/

Image source: https://www.tensorflow.org/

For those who are ready for machine learning and computer vision with the updated versions of OpenCV, dlib, Tensorflow (GPU) on the Bionic Beaver.

Install synaptic and atom from Ubuntu’s package manager

sudo ubuntu-drivers autoinstall
sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt update

search and install nvidia-390 from synaptic

Download CUDA 9.0 (It has to be 9.0 for Tensorflow 1.8):

https://developer.nvidia.com/cuda-90-download-archive?target_os=Linux&target_arch=x86_64&target_distro=Ubuntu&target_version=1704&target_type=runfilelocal

And Download cuDNN v7.1.3 for CUDA 9.0:

https://developer.nvidia.com/rdp/cudnn-download

sudo chmod +x cuda_9.0.176_384.81_linux.run
sudo chmod +x cuda_9.0.176.1_linux.run
sudo chmod +x cuda_9.0.176.2_linux.run
sudo ./cuda_9.0.176_384.81_linux.run --override
sudo ./cuda_9.0.176.1_linux.run
sudo ./cuda_9.0.176.2_linux.run

DO NOT INSTALL THE DRIVER AND SAMPLES IN THIS PART! Ignore the fact that they give you a warning for the driver not being installed. This is because the installer cannot detect the installed driver in your system, which we installed earlier through synaptic.

sudo apt-get install cuda-9
sudo apt-get upgrade
tar -zxvf cudnn-9.0-linux-x64-v7.1.tgz
sudo cp -P cuda/lib64/* /usr/local/cuda-9.0/lib64/
sudo cp  cuda/include/* /usr/local/cuda-9.0/include/
sudo chmod a+r /usr/local/cuda-9.0/include/cudnn.h
sudo apt-get install libcupti-dev
sudo atom ~/.bashrc

And add these lines:

export PATH=/usr/local/cuda-9.0/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

source ~/.bashrc
sudo apt-get update
sudo apt-get install build-essential cmake libopenblas-dev liblapack-dev libx11-dev libgtk-3-dev python python-dev python-pip python3 python3-dev python3-pip

Download and install Anaconda Python 3.6 (I use 3.6 universally and 2.7 for scientific computations)

Create environment using an environment name (envname)

conda create -n envname python=2.7
source activate envname
pip install numpy pillow lxml jupyter matplotlib dlib protobuf
sudo apt -y install python-opencv
conda install -c conda-forge opencv 
sudo snap install protobuf --classic
pip install --upgrade tensorflow-gpu

To KILL process and clear memory of GPU:

nvidia-smi

and kill the process causing unwanted memory usage

sudo kill -20483 PID.

Ubuntu 18.04 LTS (Bionic Beaver) – A powerful platform for a multitude of applications

Source:fossbytes.com

Image source: fossbytes.com

The heavily revamped Ubuntu comes with GNOME shell instead of unity, Snap apps and a software center where (finally!) we don’t have to search the web for an updated version of any software! The team at Canonical has added many features which have made the platform easy to use and powerful for programming. Canonical’s LivePatch can be used for critical updates without the need for rebooting the computer. The only issue I found was the boot issue with my laptop post-installation. The following fix can be applied to solve the problem.

Fixing boot problems with Ubuntu 18.04 LTS (Bionic Beaver)

In BIOS:
Intel Virtualization Technology: Enabled
VT-d: Enabled
Hyper-threading: Enabled
CPU C states: Disabled
Fast Boot: Enabled
Boot mode select: UEFI
Secure Boot: Disabled
Secure Boot Mode: Standard

In: /etc/default/grub, change:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash acpi_osi= acpi_backlight=none acpi=ht pci=nomsi"

Then run: sudo update-grub

The original work of M.J. Boussinesq published in 1913

Annals of Chemistry and of Physics - 1913

In was the search of the original article “The application of the formula for surface viscosity to the surface of a slowly falling droplet in the midst of a large unlimited amount of fluid which is at rest and possesses a smaller specific gravity” published by M.J. Boussinesq which was published in originally in French in the Annales de Chimie et de physique (Annals of Chemistry and of Physics) published in 1913. The paper formed the basis of the legendary Boussinesq-Scriven stress model. I found the volume of the scientific journal in a French library repository and is sharing the same here:

M.J. Boussinesq, “The application of the formula for surface viscosity to the
surface of a slowly falling droplet in the midst of a large unlimited amount
of fluid which is at rest and possesses a smaller specific gravity,” Ann. Chem.
Phys., vol. 29, pp. 357–364, 1913

Interesting publications in fluid dynamics using neural networks

Image source:  Oreilly – A look at deep learning for science

“Turbulence was probably invented by the Devil on the seventh day of Creation when the Good Lord wasn’t looking.” Peter Bradshaw (1994)

Recently, I came across a few interesting publications in fluid dynamics domain focusing on the use of neural networks. The use of neural networks is popular in varied areas including self-driving cars. The use of neural networks has started leaving its footprints in fluid dynamics, especially in turbulence modeling. A recent article in the Journal of Fluid Mechanics by José Nathan Kutz provided an overview of Deep learning in fluid dynamics.

The article mentions the publication by Ling et al. titled: “Reynolds averaged turbulence modelling using deep neural networks with embedded invariance“, as one of first to apply a true DNN architecture, specifically to Reynolds averaged Navier Stokes turbulence models. The paper by Ling et al. focuses on the fact demand for improved Reynolds-averaged Navier–Stokes (RANS) turbulence models that are informed by and can represent a richer set of turbulence physics, and the method they used to learn a model for the Reynolds stress anisotropy tensor from high-fidelity simulation data. The paper showed that the neural network architecture provided improved prediction accuracy  and significant improvement in comparison to baseline RANS linear eddy viscosity and nonlinear eddy viscosity, models.

In May 2017, Gamahara et al. published a paper in Physical Review Fluids titled: Searching for turbulence models by artificial neural network. The work  demonstrated the use of the artificial neural network (ANN) as a tool for finding a new subgrid model of the subgrid-scale (SGS) stress in large-eddy simulation. The paper concludes that the results confirm that the ANN is a promising tool for establishing a new subgrid model with further improvement.

These interesting research papers point to the growing importance of deep neural networks in the area of fluid dynamics and turbulence modeling. It was rightly said that by Peter Bradshaw that  “Turbulence was probably invented by the Devil on the seventh day of Creation when the Good Lord wasn’t looking.”  and maybe the advances in machine learning and neural networks, would provide at least some of the answers humans have been seeking for a long time. 

 

Jupyter Lab in the Azure platform

We all love the Jupyter notebooks for its intuitive and interactive interface. It  is one of the best interactive platforms for data analysis and scientific computation. I have executed numerous computation and analysis using python with Jupyter notebooks offline and on the cloud using AWS(Amazon Web Services). 

Recently, I started using the python with Jupyter notebooks on the Microsoft’s Azure platform, along with the newly released JupyterLab IDE. The JupyterLab IDE is a true Interactive development environment for effective computation. It comprises of a file browser, terminal and code editor, which reminds me of the Rodeo IDE.The Jupyter lab google drive feature also assists in realtime collaboration.

The ability scale and deploy on the azure platform, similar to the AWS and the Google cloud, enables computationally intensive applications to be performed with ease.

 

Check out the video below for an intro to JupyterLab:

Machine learning to improve experimental fluid flow analysis

Most analysis in experimental fluid dynamics uses techniques to track flow, by seeding the flow with particles. Humans with eye and the extraordinarily fascinating brain are undoubtedly the best system to identify and track moving objects or particles. The only issue with that is,  human beings are slower for tracking thousands of particles/ objects over time, get tired over time and can sometimes lead to error as a result of tiredness/ fatigue.

Most popular experimental techniques in the fluid flow analysis domain include particle image velocimetry- PIV (used for a high density of particles) and particle tracking velocimetry-PTV. The accuracy of both the methods depends on the algorithm used, the quality of images and the validation to ground truth. Most major companies that produce these PIV and PTV systems such as Dantec Dynamics have a pre-calibrated system and employ robust methods, which yield results that are ready for publication. However, the use of free and open source software, often untested for a given condition and set of particles, produce erroneous results. In the case of PTV systems, there is another complication; this arises due to the existence of particle tracking methods used by surface chemists(e.g., to look at Brownian motion), that produce inaccurate results when used for fluid dynamic analysis.  A classic example of this transpired when I used a particle tracking system used by surface chemists, which produced erroneous results for an oscillatory flow. However, when I used a correction factor calculation called “drift,” used to correct the velocity of particles when the flow field varies as a result of variation in the fluid containment such as in the case of a shaking beaker, there was a much better result, but still not accurate enough. Hence, such algorithms can cause serious errors and wrong interpretation of results, when used to look at fluid dynamics analysis.

The advent of new technologies and advanced machine learning techniques and state-of-the-art tools such as Tensorflow and DLib C++ can resolve such errors, producing highly accurate results and better interpretation of physics. These revolutionary technologies can help us understand fluid dynamics better than yesteryears.

Machine learning and artificial intelligence to improve scientific research 

Title image source: http://www.esanosys.com/

 

Most scientists come up with mathematical models that could be used to simulate physics. It was rightly said by George Box that “all models are wrong but some are useful”. A mathematical model is mostly based on considering a few conditions that make up the physical process and gives us results to some degree of accuracy given a number of controlled physical parameters or conditions.

The advent of machine learning and artificial intelligence is going to change the method of mathematical modeling, making it obsolete. The method of modeling of future will involve computational models which are generated in real-time, considering all the physical parameters associated with a physical process. The results: a complex computational model which is being updated in real-time, which can be used to predict with much accuracy the results we are looking for.

This method will not only put an end to multiple models with limited capability but also to ambiguity, bias and limitations of current models. The newer computation models will not be limited to a given condition but can be used in every condition.