## Sunday, August 21, 2011

### Staggered mesh

Someone out there has encountered the zigzag garbage a numerical solution spits out when there is pressure-velocity decoupling. You can try to refine the mesh, smooth forcing functions or adjust the Peclet number, but in the end you are undone by a fundamental flaw in the advection terms and the central difference approximation of a first derivative. The problem is advection requires a first derivative, and the central difference may be very weakly coupled to its own node. The result is essentially two solutions, one for the odd nodes, and one for the even. This is why it is often called odd-even decoupling. But why not turn this apparent weakness into an advantage? Cut your degrees of freedom in half, and just use a staggered mesh. Solve for enthalpy (energy) at the odd  nodes, solve for momentum (pressure) at the even nodes, and solve both in the half nodes at the inlet and exit, where forward or backward difference approximations are used. Use linear averages everywhere else. This has worked very well for me. I also solve for all of the mass flow everywhere at once since it is explicit on boundary conditions and the time rate of change of mass in the system (i.e. continuity or mass balance). Given the enthalpy and pressure at every node, I can explicitly calculate the density using the IAPWS-IF97 steam tables, and given the mass flux from continuity, I can now calculate the velocity. No more zig-zags, I've reduced my degrees of freedom nearly in half, and I didn't have to add artificial diffusion or any other fudge factors. Yay!