This year, for “pi day” (March 14th), I figured I’ll post a short article demonstrating how to estimate the value of π using different computer architectures. This topic is somewhat in line with the ASTE-499 Applied Scientific Computing Course I am currently teaching at USC’s Astronautical Engineering Department. The goal of that course is to […] (Mar 14 2020)
A simple 1D-1V Vlasov code for two-stream instability is developed. The code is based on a splitting scheme proposed by Cheng and Knorr in 1975. (Sep 11 2018)
Vorticity - Stream Function formulation for incompressible Navier Stokes equation is developed and demonstrated with Python code for flow in a cylindrical cavity. More complex geometry from a Java code is also shown. (May 27 2016)
This post shows how to develop a PIC plasma simulation code that uses NVIDIA CUDA to perform computations on the graphics card (GPU). Even without any optimization, the GPU version runs almost twice as fast as the CPU version for a large number of particles. (Feb 25 2016)
Example Finite Element Particle in Cell code for flow of ions past a charged sphere on an unstructured mesh (Dec 23 2015)
Details of implementing plasma simulations with the Particle In Cell Method in cylindrical coordinates. We develop a simulation of a simplistic ion gun. (Jun 15 2015)
Tutorial on implementing mesh stretching in Particle In Cell codes. Equations for node positions and finite difference coefficients are derived. (Feb 18 2015)
By considering one-dimensional flow, we can derive an expression for the variation of Mach number in a nozzle with a variable area change. Such a relationship is explored here with an interactive demo that allows you to change the shape of a converging-diverging nozzle and observe how the flow speed changes. (Feb 7 2014)
Interactive SVG+Javascript code for computing intersections between a line and a cubic Bezier curve. (Aug 10 2013)
G.A. Bird included several example codes with his book on the DSMC method. These codes are written in Fortran 77 which makes them somewhat hard to understand due to short variable names and reliance on global variables. This post is a summary of my effort to convert DSMC0.FOR to Java. (Jun 29 2013)
Particle codes have very different memory optimization requirements than fluid-based solvers. Here we consider three types of data structures for holding particles that offer an efficient way of adding and removing particles and compare their performance. (Jun 11 2012)
This tutorial discusses how to generate unstructured meshes using a Matlab code distmesh.m and how to use the mesh in a Matlab Finite Element Solver to solve the Poisson's equation on an unstructured domain. (Jun 8 2012)
This article describes how to interpolate data between a particle and an arbitrary quadrilateral cell used in non-Cartesian grids. The technique is illustrated with several Matlab / Octave examples. The examples show how pick points located inside the polygon, how to classify their position, and how to scatter and gather particle data. (Jun 4 2012)
Nonlinear Poisson's equation arises in typical plasma simulations which use a fluid approximation to model electron density. This article describes how to solve the non-linear Poisson's equation using the Newton's method and demonstrates the algorithm with a simple Matlab code. (Apr 30 2012)
Often, a significant code speed up can be accomplished by simply rearranging the way data is stored or accessed in memory. This article compares data access with arrays vs. linked lists, and compares loop ordering for 3D data sets. It also looks at a flat 1D array representation of 3D data via a mapping function. (Apr 22 2012)
Cylindrical and spherical coordinates are just two examples of general orthogonal curvilinear coordinates. In this article we derive the vector operators such as gradient, divergence, Laplacian, and curl for a general orthogonal curvilinear coordinate system. (Jan 16 2012)
This article includes the source code for a simple particle in cell code. The code simulates flow of plasma over a charged plate and is written in Matlab. (Nov 28 2011)
One of the topics we specialize in at Particle In Cell Consulting is modeling of electric propulsion (EP) thrusters. These devices generate thrust by accelerating ionized propellant (plasma). One of the most efficient EP devices is the Hall thruster. These devices have been flown for over 40 years, however, much still remains unknown about the details of their operation. (Aug 24 2011)
Code parallelization is the process of modifying a simulation program so that it can take advantage of multiple computational cores to obtain results faster. One method is to distribute the workload locally in the form of computational threads. Java makes it easy to add multithreading to your code. Here we show you how to implement a "poor-man's" method, in which individual cases run serially, but multiple cases are launched concurrently. (Jun 25 2011)
The Finite Volume Method (FVM) is an algorithm for solving differential equations. It is based on the integral formulation of the problem, with each computational element corresponding to a volume over which the integration is performed. It is somewhat more complex than the Finite Difference, however, it can be applied to arbitrarily shaped domains. In this article we show you the basics of this method and provide a simple solver. (Apr 19 2011)