So I implemented the projection method as in Chorin (1969) for the solution of the Navier-Stokes Equations with the Boussinesq Approximation, using a 2nd Order accurate FD scheme. The primitive variables are arranged using a MAC scheme. Basically, what I want is to be able to generate a file (or files) to see the solution on a rendering software (a.k.a, Tecplot, paraView, etc). How can I arrange the data? I mean, from a pseudo-code kind of view.

  • $\begingroup$ I think you have two options: (i) shift the velocity components to all on a common grid; (ii) refine the grid once and do a linear interpolation/extrapolation of your variables where coefficients are missing. $\endgroup$ – Christian Waluga Feb 26 '15 at 17:02
  • $\begingroup$ Thanks Christian, but What do you mean by coefficients? Also, Wouldn't the interpolation reduce the accuracy of the solution? How can I measure the error involved? Lastly, I don't know about the shifting... EDIT: extended the reply $\endgroup$ – Kbzon Feb 27 '15 at 8:35
  • $\begingroup$ If you need this for visualizing, then the accuracy should not matter too much if you have fine enough meshes. With coefficients i mean the degrees of freedom. By shifting i mean to shift the velocity meshes such that the degrees of freedom are in the same position for all dimensions. In that way you can put your solution on a lattice and visualize in the usual way. $\endgroup$ – Christian Waluga Feb 27 '15 at 10:47
  • 1
    $\begingroup$ @me10240 From velocity and computational pressure fields ignore the ghost cells. This would give you four matrices (I assume you have 3 velocity 3 dimensional arrays and likewise for pressure) with the same size, without boundary conditions. The boundary conditions are located at a distance $\Delta x /2$ from the first internal point. The pressure at the boundaries are usually set to zero, and in the case of velocity they can be averaged using the ghost cell (or put equal to its dirichlet boundary value). $\endgroup$ – Kbzon Jun 25 '15 at 16:01
  • 1
    $\begingroup$ @me10240 In your example I would assume you're working with a zero index array (like in C) since, in general, it should be m+2 and n+2 in vx and vy, respectively. That being said, what I did just was to remove the 2 ghost cells from vx and vy, and just assume that the fields (vx,vy,p) were located at grid points (assuming you have implemented a staggered MAC grid). From there, the only missing part are the boundaries, which are located a distance $\Delta x_i /2$ from the first internal grid point. Depending on the boundary conditions, you can set those values (e.g. zero for velocity at walls) $\endgroup$ – Kbzon Jun 28 '15 at 14:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.