A Gentle Introduction to the Finite Element Method

FEM Introduction numerical

Almost every engineer today have some knowledge of theoretical and practical aspects of FEM. And many have played with various software packages at some point of time.

Well that is enough if you just want to perform analysis but if you want to truly understand the mathematical aspects of FEM and want to get a feel of the numerical methods under the hood of FEM then this short lecture is for you.

Here’s the introduction, plucked straight from the course. IF you like it, you will enjoy the lecture.

The course is divided into five lessons and all this in 100 pages. Happy Learning!!

If you haven’t been hiding under a stone during your studies of engineering, mathematics or physics, it is very likely that you have already heard about the Finite Element Method. Maybe you even know some theoretical and practical aspects and have played a bit with some FEM software package. What you are going to find here is a detailed and mathematically biased introduction to several aspects of the Finite Element Method.

This is not however a course on the Analysis of the method. It is just a demonstration of how it works, written as applied mathematicians usually write it. There is going to be mathematics involved, but not lists of theorems and proofs. We are also going from the most particular cases towards useful generalizations, from example to theory.

It is going to be one hundred pages with many figures and many ideas repeated over and over, so that you can read it with ease. These notes have evolved during the decade I have been teaching finite elements to mixed audiences of mathematicians, physicists and engineers. The tone is definitely colloquial. I could just claim that these are my classnotes and that’s what I’m like.

There’s much more than that. First, I believe in doing your best at being entertaining when teaching. At least that’s what I try. Behind that there is
a deeper philosophical point: take your work (and your life) seriously but, please, don’t take yourself too seriously.

I also believe that people should be duly introduced when they meet. All this naming
old time mathematicians and scientists only by their last names looks to me too much
like the Army. Or worse, high school!

I think you have already been properly introduced to the great Leonhard Euler, David Hilbert, Carl Friedrich Gauss, Pierre Simon Laplace and George Green. If you haven’t so far, consider it done here. This is not about history.

It’s just good manners. Do you see what I mean by being colloquial?

Anyway, this is not about having fun, but since we are at it, let us try to have a good time while learning. If you take your time to read these notes with care and try the exercises at the end of each lesson, I can assure that you will have made a significant step in your scientific persona. Enjoy!

Click the below link to access the excellent PDF. Don’t forget to thanks to Francisco Jaview Sayas !

A gentle introduction to the Finite Element Method by Francisco–Javier Sayas

Quick Intro to 2D and 3D Visualization in Python

Posted a quick tutorial introducing visualization in python.

This tutorial offers a quick look at some common 2d and 3d Visualization available in python. This tutorial is meant to give anyone a quick start in matplotlib and mayavi.mlab.

The tutorial was written as part of CSRP program of AeSIAA which I am volunteering as a mentor to few aeronautical students.

View the tutorial by clicking this Quick Intro to 2D and 3D Visualization in Python

Multimap in multimap with C++ — an example

multimap example in c++

A colleague of mine is working in NXOpen and extracting the boundary conditions of the finite element model using Multimap.

Looking at the code, I suggested that he would be better up if he choose to use Multimap in Multimap for the functionality he is after.

To demonstrate the multimap in multimap concept, wrote a simple multimap in multimap example in c++

It helped him and should simplify his work. Putting it here in the hope that this will help someone.

#include "stdafx.h"
#include <iostream>
#include <map>
#include <string>
using namespace std;
void printmapvalues(multimap<string,int> p1,string ss1);
void printallmap(multimap<string,int> p1);
void printallmap2(multimap<string,multimap<string,int>> me);
int main()
      multimap<string,int> mmap,mmap2;  // simple string integer multimap
    multimap<string,multimap<string,int>> mera; // multimap of multimap
      // add some values
// add another multimpap valuess
// insert the two above multimaps to this multimap in multimap
//    cout<<"Size of  ss "<<mmap.count("SSS")<<endl; // cont the number of value for SSS
      return 0;
void printmapvalues(multimap<string,int> p1,string ss1){
// print values of a given filed of a malutimap
      pair <multimap<string,int>::iterator, multimap<string,int>::iterator> ret;
      ret = p1.equal_range(ss1);
      for (multimap<string,int>::iterator it=ret.first; it!=ret.second; ++it){
        cout << ' ' << it->second;
      cout << '\n';
void printallmap(multimap<string,int> p1){
// print all values of a multimap
      for (multimap<string,int>::iterator it=p1.begin(); it!=p1.end(); ++it){
      cout << it->first << ' ' << it->second << '\n';
void printallmap2(multimap<string,multimap<string,int>> me){
// prints values of a multimap containing a multimap
      for (multimap<string,multimap<string,int>>::iterator it=me.begin(); it!=me.end(); ++it){
     cout<<it->first<<" contains...."<<endl    ;

Simple Introduction To Working With HDF In PYTHON?


In May 2014 I wrote this tutorial, but stupidly made it as a gif format. Don’t know why?

Today had the chance to revisit that page and I felt the GIF format made the tutorial useless, so dumped it and used ipython notebook to create a more updated but simple tutorial to get started working with HDF in python.

If you are into scientific coding, you will encounter HDF and I hope this simple tutorial will get you started in python. Enjoy!

Click here to view the tutorial

GIF animation in Python in 3 Steps

Gif Animation in PythonGIF animation in Matlab in 3 steps is a popular post here on this blog. Learnt the technique while trying to plot the results from the Karhunen-Loeve Expansion in September 2012.

Since then, I have moved from matlab to python.

But I wanted to recreate that same thing in Python. This is where I have to say, Matlab is like iOS and Python is Android. For doing this in Matlab, all ingredients were in place, but in python, this isn’t the case.

So here are the 3 long steps in Python to get a GIF animation.

Step 1:
Download Figtodat and images2gif

Step 2:
Import Figtodat and writeGif

import Figtodat
from images2gif import writeGif

Step 3:
Collect the figures into an array and call writeGif to get the animation

figure = plt.figure()
plot   = figure.add_subplot (111)
y = numpy.random.randn(100,5)
for i in range(y.shape[1]):
    plot.plot (numpy.sin(y[:,i]))  
    im = Figtodat.fig2img(figure)


Don’t want to spend time finding the listed modules, download them directly from the link at the end of the post.

Here’s the complete code.
Continue reading

the pursuit of Java…..

I was just out of college and working at NAL. At the same time my roommate and friend was working on some java project in his office. That was the time, i began tinkering with java. Working from the usual basics, i was doing good, but then the Object oriented programming (OOP) stuff came and i got lost in the jungle of oops jargon. With VB/Fortran and my own tasks at NAL hitting in, i soon moved on, abandoning java, until now.

Pursuit of Java

This year began with the my second pursuit of java.

This time rushing through the basics, i plunged into Java with oops. This is what i think is the right approach. Transiting from procedural language to object oriented language, my mind in going everywhere. And this is where Daniel Stefankovic’s came to my help. or more precisely his course notes on Java.

Professor Daniel Stefankovic of The University of Chicago’s department of Computer Science had this java course notes.

I like them. They are short and straight. They start by exciting you and then delving into details. Just the way i like to learn something. And has lots of problems to hone the knowledge gained.

Visit the site to download the 7 PowerPoint that will help you get started in java or see then here.

Here are the 7 PowerPoint embedded for you to learn java.

Day 1

Day 2

Day 3

Day 4

Day 5

Day 6

Day 7

Nice resource if you want to pursue learning JAVA, the most popular language now.