What is Open Source?
m (→Virtual Operating System)
m (→References: Added Charles Warner's blog as a reference. This blog author fired up my interest in open source !)
|Line 98:||Line 98:|
Revision as of 06:42, 5 July 2013
Definition and relevance of Open source
If you were to ask ten different people what Open Source Software (OSS) is, you would most likely get ten different answers. The official definition can be found, from The Open Source Initiative, along with guidelines and information related to an Open Source license. From an engineer's standpoint: "Open-source software ... is computer software that is ... provided under a software license that permits users to study, change, and improve the software."
One should understand that the best use of Open Source software and it's chief strength lies in customising the software to your needs and going a couple of steps ahead than being an End-User and adapting to a software's limitations. Though over the years, the documentation, support and the community of OSS have expanded and improved; productive working with OSS requires a shift in attitude and some good ground work.
For any decision, especially those related to significant cost and safety impacts, to rely on the analysis based on the results from a software package, the engineer or decision maker needs a mechanism whereby the validity of the algorithms and their implementation can be verified easily. This aspect is all the more important in the case of CFD, where several assumptions and simplifications are made in the process of breaking down the problem, into a set of parameters that can be computed with the available resources. The solvers that are used to solve complicated continuous functions and governing equations are often based on trial and error experiments and shrewd guesses and empirical basis. Other factors resulting in the increased interest in CFD, other than the boom in computing power in recent years, is the cost and feasibility of setting up the facilities to realistically experiment and study complicated physical phenomenon.
Granted, not all of us are going to go digging around in the code to determine that a particular piece of software actually cranks out viable results; however, the fact that there are a large number of other users who ARE validating and improving the code provides us with a greater sense of confidence than taking some commercial entity's word for it. There are of course technical paper's, performance comparison and validation studies done using the commercial codes. However, the huge leap ahead in the User Interfaces, available applications and ease of use of Linux operating systems, in the past few years, have made OSS and custom Linux distributions a realistic solution to providing increased efficiency at lower costs along with more freedom and possibilities of automating everyday tasks.
Other than the cost savings, there is another peripheral benefit that is often overlooked : the user community can be quite diverse, not to mention vast. Through forums and mailing lists, a good deal of support and assistance can be accessed without having to navigate through a corporate "Help" desk. These communities are often comprehensive sources of answers to specific questions. The kind of unofficial support, usually found in OpenSource Software, is often purely a function of 'getting things done' and 'gaining knowledge', sans the set commercial limitations. There are also an increasing number of official support channels and training programs offered by organisations like the OpenFOAM foundation
Of course, in parallel, commercial software giants like ANSYS and Altair have made their own powerful impact on the industry and have become conventional, albeit 'reliable' solutions. They have comprehensive after-sales support and often hire well qualified professionals, including PhD's as application engineers, to solve the problems of their clients. Many of them are also active in developing new and probably more customized solutions in collaborations with Universities and the Industry as well. There are plenty of industries and users satisfied with being end users, as it serves their purpose well.
Another area where open source and literally 'free' applications are very useful is for students with no access to commercial programs.
The objective of this wiki section is to provide a comprehensive reference and guide for harnessing the power of OpenSource and to make an informed and unbiased decision of the kind of package that will provide the most efficient/comprehensive solution to the problem being faced.
Cost and Licensing Considerations
Note that there's nothing in the definition of OpenSource software about its cost. Fortunately, many of the OpenSource solutions now available for engineering applications also happen to be free of any licensing fees (although this is not always the case). Some of the OpenSource software that is available for free is restricted to personal-use; you are not allowed to use it in your commercial engineering practice. Yet many of the best tools we have encountered are not hindered by restrictive licenses. Still, one must be aware of such restrictions to avoid ethical violations or possible legal problems. More information can be found on The Open Source Initiative website.
When considering the licensing cost, one's focus will naturally be upon Free and Open software. A Linux based Operating system is freely accessible and also can be configured to work on older systems very easily and efficiently without the typical problems a Windows based OS would cause. But, such a focus may not provide a viable solution for every circumstance. Therefore, as necessity dictates, the engineer should swerve off the path to explore possibilities that are not free, or that may involve restrictive licenses.
The goal is to identify the most cost-effective tools for engineering applications. And, of course, part of the cost that must be considered is the time one must invest in learning how to use the software. It lies in the engineer's purview to understand the software and make informed decisions about which kind of tool to use.
Based on the definitions above, it is not necessary for open source to be Operating system biased. It basically means code accessible to be modified (customised/improved) and used. This can take place in the Windows OS as well. In fact, there are articles suggesting that in many cases, Windows is simply the hassle free option where service is guaranteed and you do not have to get deeply involved with developmental sort of work (See this article on 'The Economist') CFD is also probably moving out in such directions, branching out to knowledgeable end users and those that play with numerical schemes and writing better code to put these schemes into use.
Different ways in which you can get started with using Open Source software. There are plenty of codes available, which can be found in the Related Links section at the bottom. Fundamentally, one should know which operating system a particular software caters to because each operating system has it's own way of handling the computer and the file storage systems, not to mention the User Interface.
It has been made amply clear that open source is not restricted only to Linux based Operating systems. The objective for the section would be to eventually have comprehensive references, case studies and guides to practically using free CFD software, on both Windows and Linux. This will include reviews and links to interesting articles as well.
The binaries or compiled versions of Programs that are meant for Windows, with functional GUI's are often documented enough for an end user to gain mastery of the software, and considering most Users are predominantly from a Windows background, this section outlines some popular options to get started using Linux.
One should also note that the easiest way of getting up and running with a Linux distribution, is to have an active internet connection at your disposal. There may be several missing libraries and utilities that may need to be downloaded for the applications to work. Using the sudo apt-get command is the simplest way of installing new programs in a painless manner as the dependent libraries are automatically downloaded. Downloading individual setups and tar files of the program, may be insufficient to get the program running.
Setting up a Linux OS
The first step is to possess an installation CD/image of the OS of choice. There are several distributions or flavors of Linux available and it is infact, quite easy to customise a distribution based on your needs. These distro's as, they are popularly known as, are available for free, and can be downloaded off the internet or procured inexpensively via the CD's that are offered 'free' with popular monthly computer magazines. The next step is to choose the mode of setting up the OS based on your preferences and the restrictions posed by the available facilities. A brief overview of the operating modes with links to the corresponding tutorials can be found below :
Virtual Operating System
The advent of functional User Interfaces in Linux distributions, even with styles matching that of Windows has made it a lot more easier to experiment with Open Source applications. One of the easiest ways to kickstart your open source experience within Windows itself is to use a virtual environment. There are free applications (eg : VirtualBox , VMWare ) which allow you to experience the Linux Operating system within Windows itself. All that is required is an ISO image or CD of the Operating System setup. It is possible to setup the virtual system to use a particular amount of RAM and also give it permission to access the host systems data and hardware. This method is often preferred as a starting point and also where very limited usage of other distributions is required. However, this method does not allow you to efficiently utilise all the computer's resources because Windows is the base OS and requires a minimum amount of RAM to keep running. However, with sufficient quantity of RAM, this is a relatively simple approach to getting started with Opensource. This solution is also not effective for handling large geometries or heavy number crunching. A detailed wiki page on the unofficial OpenFOAM wiki can be found regarding using VM ware in installing a virtual operating system.
Using Live USB/CD systems
Another method is by using a Live CD/ USB system. A pre-condition is that the computer must be able to boot off a USB disk. Most Modern computers have this facility. Here, the operating system utilises the CD or USB as the primary harddisk with the OS related files. The RAM of the host computer is used for it's functioning. It is also possible to install the OS onto the USB itself, but this is not recommended as it will wear out your USB stick very fast, simply because any such device has a limit on the number of read/write cycles that can be performed on it. The disadvantage here used to be that, changes made to files/ settings were not preserved on shut down. However, this can be overcome by using a Persistent File storage. Since Linux is about customisation, it is recommended to setup persistence and use a Live USB stick rather than a CD. There are several ways to make a USB stick or a CD bootable. Among the more popular windows based solutions are using Universal USB installer or UNetBootin. The above mentioned applications allow you to set a certain amount of 'persistence' on the USB stick. This space will be used to preserve the User settings and all the changes made to the Operating System. Step by step tutorials with screenshots are available on Pen Drive Linux. This method is a lot faster than using a virtual operating system. There may be an initial lag everytime you start up, but since the entire RAM is available for use, the feel of the OS as well the applications could be a lot faster than using a virtual system. With USB 3.0, it could be a much faster process with very less lag due to increased data transfer speeds. With the later versions of Ubuntu, there is a built in option to install the current OS onto a USB drive. The updates installed till date, can be selectively/collectively chosen to be written onto a CD/image and saved, using applications like Apton CD, see this tutorial. Partitions of drives are similar to partition tools inbuilt in windows, eg Gparted. A large pendrive or a Harddisk can easily be partitioned into primary's for OS or space for portable storage, files that you want to take along with your portable OS.
It is also possible to use tools like YUMI for holding multiple Operating Systems on a single pendrive. The current version only allows persistent storage for one of the operating systems. It offers a GUI where the user can choose the Operating Sytem at the time of start up. It also automatically makes groups of the OS based on the kind of distribution or the type. (Eg Windows Based and Linux based).
Dual/Multiple Booting with Windows and Linux is another solution. Open source distributions like those of SUSE and Ubuntu have the option, to install the OS onto the current Hard Disk. Windows 7, came out with the option of getting installed onto a pendrive. It is anyhow possible to do this using tools mentioned in the previous section, as long as CD/ISO image of the OS is available. Here both the operating systems work independently of each other. It is recommended to install Windows first and then install Linux and use Linux's boot selection software called GRUB. Live systems also provide the option of installing Linux 'within windows', using the Windows boot manager to choose the operating system of choice. The primary partition used by windows is shared by the Linux distribution. However, it should be noted the Windows loader is notorious, with cases reported where a maintenance/repair operation has resulted in the Linux distribution from being deleted from the boot selection.
Current Linux configurations usually are able to identify popular hardware configurations. Official and unoficial drivers for graphics cards exists. But it also can be seen in forums that particular laptop models (Eg : Acer Aspire Timeline 4820TG) with switchable graphics configurations have trouble with the Ubuntu distribution. This has been reported to cause a great deal of increase in the heat generated by the CPU. Applications like 'Jupiter' can be used to control the CPU usage and bring down the heat. Jupiter is basically a software with customisable 'CPU performance' modes (ranging from 'Maximum Performance' to 'Power Saver'. The Power Saver option, has been reported to reduce the temperature by about 5-10 degrees as long as the laptop remains plugged in to a power source (and doesn't have to switch to battery performance).
Useful Linux Distributions
In the past, installing the applications and using the Command Line Interface (CLI) was an issue for users used to the more intuitive Graphical USer Interface (GUI) in Windows. However, current Linux distributions, with their software manager, have made program installations almost as automated as Windows (in many cases)
CAE- Linux is an Ubuntu based distribution with a huge number of pre installed applications that cater specifically to the Engineer. Currently, the 2011 edition is only available as a x64 edition though there was an earlier edition (2008) which also had a x32 option.64 bit architecture is however always preferred and often advantageous for serious computational efforts. Though the ubuntu distribution is an older version, (10.04), it is absolutely functional (and pretty quick!) with minimal interference from the interface. The newer Linux distributions are veering more towards designing a slick interface for users to quickly migrate from Windows/Mac. This also causes them to run slower.
GeekoCFD is a SUSE based distribution with pre installed applications. There are far more such applications on CAE-Linux. However, it is possible to customise your Linux distribution online, using the SUSE studio to include exactly the applications that you would like in your basic OS installation/setup disc. This disc/configuration can be saved and downloaded as an ISO image, both x32 and x64 versions are available.
OpenFOAM (OF) is a well known solver based on the Finite Volume method and written in C++. It is really, a collection of Solvers and Utilities, i.e libraries. More details, including the history and links to the unofficial OF forum/communities can be found in the Related links section and the official website. As indicated, OF's capabilities don't end with that of being a Finite Volume Solver. A more comprehensive collection of OF related material can be found at Dr Jasak's homepage.
For CAE-Linux Users : OF V 2.01 will already be installed. The source files will be available in the 'opt' folder (which stands for Optional) that can be viewed in the 'Home' folder. The best way to begin with OF is to start with the User's Guide, which will be available in the 'docs' folder within openFOAM. For the new users and the uninitiated, the guide tutorials should be followed step by step until an understanding can be gained of the work flow. The first step in the tutorial involves copying the complete set of tutorial files to the User's own work folder so that the original documents will be available in the 'Opt' folder for reference. This is done using the commands mkdir (Make Directory) and the cp (copy command) as indicated in the User Guide in OF. See the 'Learning Linux' section under Related Links for links to comprehensive resources for learning Linux commands.
Following the openFOAM manual's tutorials provides a good overview of questions related to What/Where/How. It can also be noted that efforts and projects are on, to wrap the different solvers available in OpenFOAM with GUI's enabling easier input of boundary/operating conditions. Some simple GUI's already exist for solvers like SimpleFOAM which caters to incompressible laminar flow.
The inbuilt meshing application, 'blockMesh', of OF is quite /primitive/ or difficult to use for complicated geometry. It requires the definition of a geometry by the vertice or face and to split up the domain/geometry into Blocks for the mesh grading. It is reccommended to couple an application like Salome or GMsh or Elmer to generate the CAD and setup a Mesh. Commercial applications like ICEM can also be used and the mesh can be imported to OF. However, in these cases, care must be taken to adequately check that the boundary conditions are being correctly implemented. The above mentioned applications are widely preferred and reccomended in online forums. Salome, based on Python also has post processing capabilities, though Paraview is usually the preferred post processor that comes coupled with OpenFoam. Using a python based pre processor has it's advantages as python libraries interfacing with OF are available like PyFOAM and PyFlu which enable the user to input/control/manage/extract data from OpenFOAM. These libraries also enable hooking up Salome to OpenFOAM and eventually facilitating automated simulation setups.
1. Python is a scripting language which is rapidly gaining prominence. It can be learnt very easily and a collation of good resources can be found at Python Learning Resources
2. This is an interesting discussion on CFD Online's Forums related to PyFOAM and PyFlu
Stanford University Unstructured (SU2)
"The Stanford University Unstructured (SU2) suite is an open-source collection of software tools written in C++ for performing Partial Differential Equation (PDE) analysis and solving PDE-constrained optimization problems. The toolset is designed with computational fluid dynamics and aerodynamic shape optimization in mind, but it is extensible (and has been extended) to treat arbitrary sets of governing equations such as electrodynamics, chemically reacting flows, and many others." - from the official website
Have a look at : Why choose SU2 ? - CFD-Online SU2 Forum Thread
Palabos (Lattice Boltzmann Solver)
Palabos is a C++ solver with wide-spread use in the lattice Boltzmann community. It covers a large range of applications and specializes on multi-phase flow, flow through porous media, and complex flow with chemical reactions. The Flow Gallery of Palabos offer's a quick overview of the capabilities of this code. To get started, a look at the user's guide or at the tutorials is recommended.
The lattice Boltzmann method is considered to be a powerful, modern alternative to classical CFD. It models a fluid through kinetic theory (a statistical theory of molecular motion) and offers computational efficiency and high resolution for complex fluids like two-phase systems. The lattice Boltzmann forum offers an exchange platform for the very active lattice Boltzmann community.
Have a look at : Introduction to lattice Boltzmann - 30 Minute Lecture
- Codes section on CFD Wiki - Contains a pretty long list of Free & Commercial codes
- Source Code Archive - CFD Wiki - Donated Source Codes and External Links
- CFD Online - OpenFOAM Forum
- CFD-Online - SU2 Forum
- OpenFOAM Official Website
- The OpenFOAM Extend Project
- Unofficial OpenFOAM Wiki
- OpenFOAM course - Very lucid presentations to begin with OpenFOAM
- SU2 Official Website
Linux Distro's :
- CAE- Linux - Official website of CAE- Linux, an x64 Ubuntu based Linux Distribution with a huge variety of pre installed engineering applications.
- GeekoCFD - A customisable SUSE based distribution with both x64 and x32 versions. Contains a few applications pre installed, but the Live CD can be customised online via SUSE studio.
Learning Linux :
- Learning Linux - a Collation - This is a collection of web resources for learning Linux and gaining some practical skills, such as handling a Command Line Interface.
- Pen Drive Linux - Very useful source of technical articles and tutorials