Candra Damis Widiawaty
There are several software that could be used for numerical calculation in example EES, Python, C, C++, etc. For this discussion, i would like to share how to make algorithm of python for solving discretisation in example 4.1 and 4.3 at veersteg handbook. Here is the step : - first, you have to understand the algorithm of array - second, you have to understand the algorithm of pde equation of steady state diffusion, then how to generate tat equation
Python Python is one of the open source which could be used for numerical methods for engineering. How to install it, just link to python.org, don’t forget to install numpy in command directory “pip install numpy”. Numpy is module library for solving array calculation. As we know, that PDE equation can be solved by array. So we have to understand word by word the program. I used Gauss Elimination method. Gauss elimination is the most familiar method for solving simultaneous algebra equation. It consist of two parts : the elimination phase and the back substitution phase. The purpose of elimination phase is to transform the equation into the form Ux=c. The equation are then solve by back substitution. Here is the example of equation transformed : Fig 2. Transformed equation The procedure of elimination phase : Elimination phase is the process of transforming equation become Ux=c by multiplying the equation (let say j) by constant lam and subtracting it from another equation (let say i).
Fig 3. Transforms equation The equation being subtracted, is called pivot equation Eq (j). Using excel makes it easier to understand the elimination phase process.
Fig 4. Elimination phase process using excel Fig. 5 Array Algorithm of elimination phase : For k in range [0, n-1]: For i in range [k+1,n]: If a[i,k] ! ==0.0: Lam=a[i,k]/a[k,k] a[i,k+1:n]= a[i,k+1:n]-lam*a[k,k+1:]: b[i]=b[i]-lam*b[k]
Back Substitution Phase :