CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Main CFD Forum (http://www.cfd-online.com/Forums/main/)
-   -   Question Regarding MacCormack Technique (http://www.cfd-online.com/Forums/main/71542-question-regarding-maccormack-technique.html)

 RcktMan77 January 6, 2010 21:51

Question Regarding MacCormack Technique

I'm somewhat of a beginner/student to CFD development, and I'm making my way through John D. Anderson's "Computational Fluid Dynamics: The Basics With Applications" wherein Maccormack's finite differencing technique is being utilized to solve the flowfield for a quasi-1D, subsonic inflow-supersonic outflow isentropic nozzle. The governing flow equations are reduced for a quasi-1D Euler flow, and cast in strong conservation form. In writing my own program to solve this problem, I have been able to match Anderson's results for the first step in time. However, my code becomes unstable as I advance further in time, and I'm unable to obtain a stable solution using the Courant number, grid spacing, and time steps that Anderson specifies.

I'm wondering if this may have something to do with my implementation of calculating the time increment itself, which Anderson is a little vague in how he himself handles this. I know that for each grid point the time increment is calculated, and he in turn picks the minimum time increment calculated across each grid point to advance the solution to the next time step (global time marching approach). However, I'm left wondering if this is repeated for each time iteration, or if this minimum time increment calculated for the first time step is used for subsequent iterations. I have implemented the former approach, and I see that as the solution steps forward in time the minimum time increment calculated across all the grid points diminishes; eventhough, the grid spacing remains constant. Is this normal, or should the time increment remain constant while the solution marches in time? Any insights would be most helpful.

Thanks.

 jeroen_wink August 9, 2012 13:47

1d Maccormack

Hi Rcktman77,

Recently I was trying to do the same example from Anderson and I experience the same problem. The absolute value of the divergence seems to scale with the timestep but no matter what the timestep is, the solution diverges. Since you encountered this problem a couple of years ago, do you perhaps know what the problem was?

With kind regards.
Jeroen Wink

 kjkloesel October 1, 2012 17:10

Anderson's CFD book page 336

Jeroen Wink - I think I have stumbled onto the same error. I have coded this thing twice, one in C++ and then again in Excel (first step). The central problem begins on page 336. Once I get the calculations to the end of the predictor step (page 349) , I can't get the same answers for F1, F2, F3 (row 15). The calculations work for row 16 and that's OK. I have tried a couple of things. 1.) Not using primitives in the calculation of J2. 2.) Fixing the d(Area)/dx at rows 0 and 30. I am unsure why he claims one needs the primitives calculated on the top of page 349, because the iteration loops can be closed without that calculation, and then one just extracts the primitives at the end of looping, as needed. The web rumors that a solutions manual exists, maybe we can unravel the mystery from this documentation. I'm not sure how any graduate student could turn in re-coded Anderson with out it being somewhat obvious.
Thanks,

 mechiebud September 12, 2015 14:02

Quote:
 Originally Posted by jeroen_wink (Post 376306) Hi Rcktman77, Recently I was trying to do the same example from Anderson and I experience the same problem. The absolute value of the divergence seems to scale with the timestep but no matter what the timestep is, the solution diverges. Since you encountered this problem a couple of years ago, do you perhaps know what the problem was? With kind regards. Jeroen Wink
jeroen_wink Even I have encountered the same problem. Could you please guide me how it was resolved?

 RcktMan77 September 14, 2015 19:16

1 Attachment(s)
Hi all,

Apologies for the delayed response. It has been about 5 years since I re-visited this problem, so it took me some time to refresh my memory. I looked over my original question, and immediately noted what I originally thought as ambiguous regarding the time step, was in fact stated pretty explicitly in the book. Namely, that global time stepping is used throughout all of the example problems. The time step is calculated at each grid point using Eq. 7.67 and the minimum value from all of the interior points is used for advancing the solution in time (i.e. this value doesn't change once initially calculated).

I'm not sure whether this is the same issue you're encountering, but I went back and wrote a program in fortran to solve the problem which I think does so adequately. It doesn't appear to diverge after 1400 iterations at least. I've attached the fortran source for you to review. Please excuse the formatting of the output files. I didn't spend much time formatting them how I intended. Also a lot of the code could probably be re-factored to reduce some redundancy, but I felt it was probably best to be as explicit as possible to show the steps as Anderson has written them.

Lastly, for whatever reason the forums here don't appear to recognize the f90 extension, so I've renamed my fortran source file using the *.f extension. It's probably best if you rename the attachment prior to compiling using the f90 extension.