Showing posts with label Numerical library. Show all posts
Showing posts with label Numerical library. Show all posts

Sunday, January 15, 2012

SciPy and NumPy - Scientific Tools for Python



Scientific Tools for Python 
SciPy (pronounced "Sigh Pie") is open-source software for mathematics, science, and engineering. It is also the name of a very popular conference on scientific programming with Python. The SciPy library depends on NumPy, which provides convenient and fast N-dimensional array manipulation. The SciPy library is built to work with NumPy arrays, and provides many user-friendly and efficient numerical routines such as routines for numerical integration and optimization. Together, they run on all popular operating systems, are quick to install, and are free of charge. NumPy and SciPy are easy to use, but powerful enough to be depended upon by some of the world's leading scientists and engineers. If you need to manipulate numbers on a computer and display or publish the results, give SciPy a try!

Python and Scientific Computing 
NumPy and SciPy are two of many open-source packages for scientific computing that use the Python programming language. This website, together with other subdomains of the scipy.org domain, serves as a portal for all scientific computing with Python, not just NumPy and SciPy. The index under Topical Software in the navigation bar lists these domains and other destinations for scientific software using Python.  
Good places to start to learn more about SciPy: 
This is a community effort. We seek volunteers at all levels of ability to work on the project, from coding and packaging to documentation, tutorials, recipes, and the web site. Visit the Developer Zone if you are interested in helping out. SciPy is sponsored by Enthought, Inc.
SciPy optimization on Ubuntu Linux

NumPy is the fundamental package needed for scientific computing with Python. It contains among other things: 

  • a powerful N-dimensional array object 

  • sophisticated (broadcasting) functions 

  • tools for integrating C/C++ and Fortran code 

  • useful linear algebra, Fourier transform, and random number capabilities. 
Besides its obvious scientific uses, NumPy can also be used as an efficient multi-dimensional container of generic data. Arbitrary data-types can be defined. This allows NumPy to seamlessly and speedily integrate with a wide variety of databases. Numpy is licensed under the BSD license, enabling reuse with few restrictions.

Thursday, December 29, 2011

OpenFOAM and installation of ver. 2.1.0 in Ubuntu 11.10

I've been wanting to install and try this software for awhile now.  It is called OpenFOAM and is a free and open source CFD and numerical software.  While ANSYS Fluent and others are great and heavily developed, they are quite expensive and un-readily available to many users.  I've done some research and OpenFOAM seems to be the leader of the free world.  They seem to be very open and constantly updated and developed.

About the OpenFOAM Foundationhttp://www.openfoam.org/index.php
The OpenFOAM® Foundation is a non-stock corporation, incorporated on 5th August 2011 in Delaware, USA. It is a nonprofit organization whose “specific objectives and purposes... shall be to promote and manage the free open source distribution of the OpenFOAM software” (Bylaws, Article II). The Foundation has taken on the guardianship of the OpenFOAM software, previously undertaken by OpenCFD Ltd. Through its bylaws, it formalises the commitment, begun by OpenCFD in 2004, to ensure OpenFOAM is free and open source only. It is supported by SGI and lists Mark Barrenechea (CEO, SGI) and Henry Weller (creator of OpenFOAM) amongst its Board of Directors. 
The Foundation distributes the current repository version of OpenFOAM (and will distribute future ‘version’ releases of OpenFOAM) under the GNU general public licence (GPL). The GPL gives users the freedom to modify and redistribute the software and a guarantee of continued free use — as long as the terms of the GPL are adhered to. There are two elements to the GPL that provide protection against exploitation by companies including OpenFOAM within non-free and/or closed source software products. First, when any modified version of the software is redistributed, the source code must also be made available by the distributor. Secondly, any modified version can only legally be distributed open source under the GPL and software that links intimately enough to OpenFOAM has to be distributed under the GPL as well. 
People and organisations contribute to OpenFOAM on the understanding that their contributions become part of the public commons of free software and are not exploited by producers of non-free software. The Foundation exists to ensure this, adopting a suitably strong, open source license, i.e. the GPL. It will manage the software code base and promote the software, e.g. through its website www.openfoam.org, whose content will grow over time. OpenFOAM Foundation 15th August 2011

About OpenFOAMhttp://www.openfoam.com/
The OpenFOAM® (Open Field Operation and Manipulation) CFD Toolbox is a free, open source CFD software package produced by OpenCFD Ltd. It has a large user base across most areas of engineering and science, from both commercial and academic organisations. OpenFOAM has an extensive range of features to solve anything from complex fluid flows involving chemical reactions, turbulence and heat transfer, to solid dynamics and electromagnetics. It includes tools for meshing, notably snappyHexMesh, a parallelised mesher for complex CAD geometries, and for pre- and post-processing. Almost everything (including meshing, and pre- and post-processing) runs in parallel as standard, enabling users to take full advantage of computer hardware at their disposal. 
By being open, OpenFOAM offers users complete freedom to customise and extend its existing functionality, either by themselves or through support from OpenCFD. It follows a highly modular code design in which collections of functionality (e.g. numerical methods, meshing, physical models, …) are each compiled into their own shared library. Executable applications are then created that are simply linked to the library functionality. OpenFOAM includes over 80 solver applications that simulate specific problems in engineering mechanics and over 170 utility applications that perform pre- and post-processing tasks, e.g. meshing, data visualisation, etc.

The OpenFOAM Teamhttp://www.openfoam.com/about/
The OpenFOAM Team produces the OpenFOAM® open source CFD toolbox and distributes it through the OpenFOAM Foundation. The OpenFOAM Team was formed at OpenCFD Ltd, a company established in 2004 to coincide with the release of its OpenFOAM software under general public licence. The company was founded by: Henry Weller, the creator of OpenFOAM and its chief developer from inception to the present day; Chris Greenshields; and, Mattijs Janssens. In 2011, the team moved to SGI Corp, following its acquisition of OpenCFD Ltd.


OpenFOAM Services:
The OpenFOAM Team has unrivalled experience with OpenFOAM. Over the past 7 years they have successfully provided services to numerous science/engineering companies, consultancies and universities. Developments: written over half a million of lines of code. Support: delivered over 10,000 hours of support. Training: delivered over 100 training courses to over 1000 OpenFOAM users. The OpenFOAM Team is Henry Weller, Chris Greenshields, Mattijs Janssens, Andy Heather, Sergio Ferraris, Jenya Collings, Gijs Wierink and Laurence McGlashan.

I recommend you check this out if you are interested in a free CFD simulator.  While it may not have all the bells and whistles of Fluent or other similar software, but I bet you can get just as much done and in the process understand what you are doing much better as it can be the tendency to treat more fancy software as a black box.  OpenFOAM has meshing and post processing capabilities (ParaView), supports many imports of meshes from other software, has many solvers, many models, and many libraries, it also has great documentation, tutorials, and community support.  Training and customer support is also offered.

To install OpenFOAM simply go to http://www.openfoam.org/download/ where they have choices of the Ubuntu Deb Pack, SuSE RPM Pack, the Source Pack, and the Git Repository.  Luckily for us, I am using Ubuntu 11.10 so I simply went to their page for that installation here: http://www.openfoam.org/download/ubuntu.php

I followed the instructions and had no problems until I got to the end where it says Getting Started.  It seems to assume that a directory exist in your home directory called OpenFOAM.  However, this is not where OpenFOAM was installed as you can see it is installed in /opt/openfoam210 instead.  So you need to first create the directory OpenFOAM in your home folder then everything else should be fine in the directions.

This is the link for the documentation (tutorials and more): http://www.openfoam.org/docs/user/

One downside to OpenFOAM is that it is not cross platform.  It only works on Linux such as Ubuntu, Fedora, SuSE, etc.

Here is a screen shot showing that OpenFOAM installed into the opt directory.


Here is a screen shot showing the /home/timbarber/OpenFoam/timbarber-2.1.0/run/tutorial tree.  This is the step where the tutorial material is copied from the /opt/openfoam210 directory.


Here is the message I get after editing the .bashrc file then either typing source $HOME/.bashrc and then typing icoFoam -help or opening a new terminal window then typing icoFoam -help




Screen shot after running blockMesh in the cavity directory.


Viewing the mesh in ParaView by typing paraFoam in the terminal.



After following the instructions on OpenFOAM's user document web page, this is a view of the mesh.


Friday, October 14, 2011

Numerical Math - Solving systems of equations utilizing matrices (data fitting)

A nice pointer from Laundau et al [1] in the opening of their chapter (Ch. 8) on Solving Systems of Equations with Matrices; Data Fitting.  Many physical systems are modeled utilizing matrices which consist of a system of simultaneous equations.  However, these sets can become quite large and complicated which is why computers are very good with these processes.  Usually the algorithms for solving these sets of equations that utilize matrix theory is that they require repetition of a small list of steps which have been written in an efficient method.

One additional technique for speed is to tune the algorithm to the actual architecture of the computer which Landau et al [1] discuss more in their Chapter 14 called High-Performance Computing Hardware, Tuning, & Parallel Computing.

Many libraries exist which are "industrial-strength" subroutines for solving these matrix systems.  A majority of these libraries are well established such as the IMSL Numerical Libraries by Rogue Wave Software, Inc., the GNU Scientific Library (GSL), and the Netlib Repository at UTK and ORNL which contains LAPACK — Linear Algebra PACKage.  Landau et al [1] note that these libraries are usually an order of magnitude faster than general methods in linear algebra texts.  The libraries are streamlined for minimal round-off error and are aimed to solve a large spectrum of problems with high success.  It is here and for the reasons just mentioned where Landau et al warn that it is best if you don't write your own matrix subroutines but retrieve them from one of these libraries.  The libraries also provide the advantage of allowing the user to run them on one machine/processor or many machines/processors by varying with the computer architecture.

Next, Landau et al [1] ask the question which proposes to the user what is considered a "large" matrix.  Before, a large matrix was based upon a fraction of the RAM available to the computer system.  However, Landau et al describe a "large" matrix as now based upon the numerical time it takes to obtain values.  That is, if any waiting time is required, then a library should be used.  Landau et al also comment that the libraries are beneficial for speed even when the matrices may be small (which might apply in graphics processing).

One negative side effect lies in the multiple languages that the libraries are written.  That is one library may be in Fortran while the user is a C coder.  However, today libraries might exist which are programmed in or for many different computer coding languages.



References:


[1] R. H. Landau, M. J. Páez, and C. C. Bordeianu. A Survey of Computational Physics - Introductory Computational Science, Princeton University Press, Princeton, New Jersey. 2008

Monday, October 10, 2011

deal.II Homepage

deal.II Homepage: A Finite Element Differential Equations Analysis Library - October 9th, 2011: deal.II 7.1 released

What is deal.II? 

deal.II is a C++ program library targeted at the computational solution of partial differential equations using adaptive finite elements. It uses state-of-the-art programming techniques to offer you a modern interface to the complex data structures and algorithms required. 
The main aim of deal.II is to enable rapid development of modern finite element codes, using among other aspects adaptive meshes and a wide array of tools classes often used in finite element program. Writing such programs is a non-trivial task, and successful programs tend to become very large and complex. We believe that this is best done using a program library that takes care of the details of grid handling and refinement, handling of degrees of freedom, input of meshes and output of results in graphics formats, and the like. Likewise, support for several space dimensions at once is included in a way such that programs can be written independent of the space dimension without unreasonable penalties on run-time and memory consumption. 
deal.II is widely used in many academic and commercial projects. For its creation, its principal authors have received the 2007 J. H. Wilkinson Prize for Numerical Software. It is also part of the industry standard SPEC CPU 2006 benchmark suite used to determine the speed of computers and compilers, and comes pre-installed on the machines offered by the commercial Sun Grid program. 

deal.II emerged from work at the Numerical Methods Group at Universität Heidelberg, Germany, which is at the forefront of adaptive finite element methods and error estimators. Today, it is maintained by two of its original authors at Texas A&M University, and dozens of contributors and several hundred users are scattered around the world (see our credits page for a detailed list of people contributing to deal.II).

What deal.II can offer you? 

If you are active in the field of adaptive finite element methods, deal.II might be the right library for your projects. Among other features, it offers: 

Support for one, two, and three space dimensions, using a unified interface that allows to write programs almost dimension independent. 

Handling of locally refined grids, including different adaptive refinement strategies based on local error indicators and error estimators. Both h, p, and hp refinement is fully supported for continuous and discontinuous elements. 

Support for a variety of finite elements: Lagrange elements of any order, continuous and discontinuous; Nedelec and Raviart-Thomas elements of any order; elements composed of other elements. 

Parallelization on single machine through the Threading Build Blocks and across nodes via MPI. deal.II has been shown to scale to at least 16k processors. 

Extensive documentation: all documentation is available online in a logical tree structure to allow fast access to the information you need. If printed it comprises more than 500 pages of tutorials, several reports, and presently some 5,000 pages of programming interface documentation with explanations of all classes, functions, and variables. All documentation comes with the library and is available online locally on your computer after installation. 

Modern software techniques that make access to the complex data structures and algorithms as transparent as possible. The use of object oriented programming allows for program structures similar to the structures in mathematical analysis. 

A complete stand-alone linear algebra library including sparse matrices, vectors, Krylov subspace solvers, support for blocked systems, and interface to other packages such as Trilinos, PETSc and METIS.

Support for several output formats, including many common formats for visualization of scientific data.

Portable support for a variety of computer platforms and compilers.
Free source code under an Open Source license, and the invitation to contribute to further development of the library.