Tuesday, February 2, 2016

Codes are published on Github now!

Since I got a lot of requests for some of old codes, I have decided to share them on Github. I am trying to upload most of them ASAP. Please see https://github.com/arrgasm. If you still need a code that is not there, please drop a line and I'll send it to your email.  

Sunday, September 1, 2013

Posted a draft of my new article on arxiv.org. Here is the link
arXiv:1308.5626
http://arxiv.org/abs/1308.5626
 
The statistical approach to preconditioning is somewhat weird to the preconditionists however I've got something that works (actually nails it down!)

 

Wednesday, November 7, 2012

Quantum Theory: Is it understandable for us?


I've found another masterpiece from Prof. Brian Greene. It talks about quantum theory in the most illustrative way. I think I understood what's going on there. Highly recommended! about 52 mins. Have fun!

Sunday, June 17, 2012

An easy to understand documentary about Einstein theory and many new theories after that!

If you want to understand Einstein theory but you don't have time to read and derive 300 pages of mathematics, The following documentary is just made for you!
This is the link to the best cosmos doc I've ever seen.


The Fabric of the Cosmos What Is Space



It mainly discusses the effect of an empty space and the forces it exerts in a space-time concept. This movie makes the hard subject to be understandable for typical non physicists. There some theories that will be discussed in addition to Einstein's theory. Enjoy!     

Sunday, May 6, 2012

Recommended Tutorial for Learning Emacs Basics

If you have not decided on your text editor, I strongly recommend Emacs. The learning curve is steep meaning that you have to put so much time on basic stuff that you think is stupid at first! like copy and paste which is much harder than doing Ctrl+C/Ctrl+v in other editors. But you will get used to it as soon as you finish one project and then your never gonna leave it! Vim is also good but I personally prefer Emacs. These are typically editors of choice for advanced programmers working on giant codes.

The Emacs code has been under continuous development for more than two decades and it has been proven to be able to handle a wide range of programming tasks. It has syntax highlighting for almost all programming languages to be named a few here C/C++, Python, Pascal, Java, Fortran, Octave/Matlab, Perl, VHDL, Verilog, ...
To discover Emacs I recommend to first see this awesome introductory tutorial and then you are ready to jump on the advanced techniques.

Then you need to print the following cheat-sheet (http://www.cs.princeton.edu/~hains/os/emacs.html )and paste it on the walls exactly in front of you.
Try to use keyboard and shortcuts as mush as you can. Don't submit yourself to beginner style programming with mouse and graphical interface. The power of Emacs is that you can do task using keyboard much faster and easier than using a GUI. Have a nice programming experience!  

Friday, May 4, 2012

Three-Dimensional Mixed-Element Unstructured Finite-Volume Solver for Euler/Navier-Stokes Equations

Abstract

(Please refer the manual.pdf file in the attached archive for complete documentation of the code)


In this post, we implement and validate a three-dimensional algorithm for solving inviscid Euler equations on general geometries represented by a single block for a fair regime of fluid flow. To this end, we first use a set of predefined routines to read the grid topology. The input file is assumed to be in UGRID format. The grid topology is defined using the number of nodes, number of different elements in the grid, coordinates of all nodes, definitions for various elements including triangle and quadlateral for boundaries, and tetrahederal, pyramid, prism and hex for the interior regions. Prior to writing grid maps, we implement different element-based maps which locally specify the relation between face and node, relation between node and nodes, and the relation between edge and node for a particular element. Using these local maps, we proceed to implement various gird maps to access the grid point/edge of interest in the flow-solver section. These maps include, element sourrounding a point, points surrounding a particular point, edges sorrounding point, and element sourrounding an element.
In the second part of of the work, we transfer the cell-centered grid to the equal node centered representation which is more suitable for finite volume approach. In doing so, we define our geometrical data structure based on the edges in the interior of the domain and ghost edges on the boundaries. For each triangle boundary element, we define three ghost edges while for each quad, we will have four. The volume of the new node-centered cell together with conservative variables are stored in node-based array. All maps and transformed node-centered grid are validated using a set of predefined meshes including a 13 node generic grid, an all-hexahederal and all-tetrahederal meshes, a course and fine ramp mesh for supersonic evaluations and a heavy visoucs mesh for NACA0012 airfoil.
In the third part of the work, we implement the flow-solver. The conservation-laws are discretized using finite-volume approach \footnote{integration in space + Divergence theorem)} and a generic equation for temporal update is obtained. Flux vectors are using Roe approach. Roe averages are evaluated at the center of edges providing a Jacobian-based first-order approximation of flow field in space. For temporal discretization, both first-order Euler-explicit and fourth-order classic Runge-Kutta are implemented. A fifth-order Runge-Kutta scheme from Jameson-Baker is also implemented in the code.
To validate the current algorithm, a supersonic ramp flow is solved on both coarse and refined meshes. Convergence study is performed on both coarse and refined meshes. The shock angle and various parameter before and after shock are compared with the one-dimensional oblique shock theory.
The method is extended to second-order in space by using least square method for gradient construction. In addition, viscous terms are added by averaging the gradients over an edge. The final solver is validated for several benchmark problem including nonlinear acoustics of standing waves inside a pipe, vortex propagation and laminar boundary layer over flat plates. A comparison of the results with experimental data and analytical results for boundary layers proves the robustness of current solver.

Sample Results 


Here are some pictures. For complete documentation of the theory and running the code please download the attached archive. 

coarse grid ramp


A coarse grid supersonic ramp test case with second-order spatial Roe scheme. 
A coarse grid supersonic ramp test case with first-order spatial Roe scheme.
residual history for first-order spatial discretization


Fine grid ramp


Fine grid ramp with first-order spatial accuracy. The Shock is resolved perfectly!

Viscous Boundary Layer


Top) the three-dimensional grid for capturing the boundary layer on flat plate. The grid is refined where flat plate starts. Bottom) results from the current solver. For more info please see the PDF manual in the attached file.
Comparison Between Exact Blasius solution, Fluent code, and current code.


Download the Source Code and Documentation from Here:
PDF Manual:    http://ifile.it/amr59xi
Source Code in C: please put your email in the comments and I'll send you one copy of the source code.
Update Feb 2nd, 2016 : The code is uploaded here : https://github.com/arrgasm/ns3D




Wednesday, May 2, 2012

Completely Validated Unstructured Two-Dimensional Euler Solver Written in C

Here is my implementation of Van-Leer fluxes (and Jacobians) in the following C code. It has the following functionalities:
1- Has a special python script for plotting contours on unstructured grids!!! I wrote this Python script to get rid of third party packages like Tecplot and Fieldview. I can plot any contour using Python script right away in my C-code without calling external program.
2- Solve two-dimensional Euler equations with first-order and second-order spatial accuracy.
3- Implements Van-Leer fluxes and Jacobians. (ANALYTICAL Jacobians)
4- Has built-in explicit and implicit time-marching schemes.
5- Reads arbitrary unstructured grid in ".mesh" format.
6- Has a library for verification and validation using method of manufacturing solutions.
Below are some results for NACA0012 airfoil
   Fig. 1- Mach = .8 angle of attack is 1.25 degrees (second-order)
Fig. 2- Mach = .8 angle of attack is 1.25 degrees (first-order)
Fig. 3- Mach = 1.2 angle of attack is 0.0 degrees (first-order)
Fig. 4- Mach =  results from method of manufacturing solution. these contours are compared to exact solution and they are same contours.

To download my code please click on the following link:
please put your email in the comments and I'll send you one copy of the source code.
UPDATE FEB 1, 2016 : The code is published in https://github.com/arrgasm/UnstEuler2D