CFD Online Discussion Forums

CFD Online Discussion Forums (
-   Main CFD Forum (
-   -   results of my MAC solver (

Maciej Matyka December 5, 2000 10:42

results of my MAC solver
hello everybody!


you have a couple of gif images generated by my MAC solver. as you see - its not a good result. i dont know what happens, whad im doing wrong. size of the mesh contains 32x16 cells. fluid have 5*5 particles in water basin and 10*10 particles in drop. viscosity 0.01, g=-0.98, v0=-1.0.

what im doing wrong?

im using The MAC Method described by Harlow and Welch 1963 (Los Alamos paper)

/// maq

ps. maybe put here more pictures?

ps2. help!!!

Maciej Matyka December 5, 2000 11:33

Re: results of my MAC solver
sorry. changes:

now files on panoramix (see prev. mail) are generated for:

width = 400 height = 400

nx = 40 (40 cells in x dir.) ny = 40

gy = -0.1 gx = 0

vis = 0.01

and still it is nothing good...


/// maq

Krash December 29, 2000 16:36

Re: results of my MAC solver
Hey Matyka, I am also working on solving a problem via MAC method. The problem I have experienced are stability related: I had to decrease time step, pick a fluid with a high viscosity,and let it run for many iterations. then, it finally converges...kind of. The convergence is "iffy" at best. I found this little tidbit on the Internet after struggling for weeks:

MAC: Marker-And-Cell

To treat incompressible, free surface flows, the MAC method was developed by Harlow and Welch [Harlow et al, 1965] as a variation of the PIC method but treating applications that extended beyond those addressed by the vorticity*stream-function method. The MAC method was the first successful technique for incompressible flows. Particles were used as markers to locate the material in the mesh and, consequently, to define the location of the free-surface. The MAC method had the advantage of a more compact finite difference stencil and tight coupling between the pressure and velocity fields. To treat the fluid incompressibility, a solution to the Poisson equation for the pressure was used. This was in contrast to later methods that solved the coupled velocity-pressure equations, as discussed by Viecelli [Viecelli, 1969]. Although the solution of Poisson's equation was numerically simple, the specification of the velocity boundary conditions were not straightforward. There was some controversy at the time about the relative stability of the MAC method, and this was resolved in the now-classic paper by Hirt [Hirt, 1968Hirt, C.W., J. Comp. Phys., Vol. 2, p. 339, 1968.], in which he showed that the MAC method is unstable with centered momentum advection unless the viscosity is sufficiently large. This work was the precursor of the modern truncation error subtraction analysis. This controversy illustrated the T-3 approach: the development was always on the physics, with limited application of mathematical analysis of, e.g., convergence and stability properties. The MAC method is still in use and has profited from the added efficiency of modern conjugate gradient schemes for solving the Poisson equation.


Arturo January 5, 2001 16:24

Re: results of my MAC solver
Hi, I'm a newbie and I would like to ask you about the existing codes for the MAC solver.

My advisor thinks that this method can be useful for my project about porous media.



Krash January 5, 2001 18:38

Re: results of my MAC solver
Hey Arturo, I recently coded (via Matlab) a program to solve the flow between two solid flat plates. The technique of "artificial compressibility" and the MAC method were used. I don't know if it will help with your project, but I can definitely send it to you.

The big points using this method as I see them are the damn staggered grid and deciding whether to use Poissons equation for pressure or another explicit method. Also, make sure all of the dang values are getinng calculated at the correct times.

Let me know if I can help.


All times are GMT -4. The time now is 15:16.