CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Main CFD Forum (https://www.cfd-online.com/Forums/main/)
-   -   Experiencing trouble in iteration using Maccormack's Technique (https://www.cfd-online.com/Forums/main/236974-experiencing-trouble-iteration-using-maccormacks-technique.html)

rjomega June 24, 2021 09:20

Experiencing trouble in iteration using Maccormack's Technique
 
I have been searching and working on this for hours and still have not found a solution for my problem. I am still learning to code and do computational fluid dynamics using python. I am using Computational Fluid Dynamics: The Basics with Applications by John D. Anderson, JR. https://www.amazon.com/Computational.../dp/0070016852

I am currently doing the CFD Solution of Subsonic-Supersonic Isentropic Nozzle Flow: Maccormack's Technique. https://en.wikipedia.org/wiki/MacCormack_method



I dont have any issue for the values for the initial time step but after around 150 to 200 iterations, everything goes downhill. Final values for the 1000th iteration are all zeroes. Residual is not going down just like what was shown in the book.



It might get messy if i pasted my code here so I placed it in google docs using code blocks to at least lessen the mess. The way I try to code this is the same as how Lorena Barba's 12 step to navier stokes do it https://lorenabarba.com/blog/cfd-pyt...navier-stokes/ (I am not blaming her for my incompetence, maybe I have skipped something important leading me to this kind of problem)





https://docs.google.com/document/d/1...2X52rfi_A/edit


Here's an image of the result. Im sorry for not including what was being shown. https://imgur.com/a/ZKsLPAV



Orange: Values of density at the throat of the nozzle per iteration
Blue: The residual (Average partial derivatives) the final residual shown in the book is around 10 x-6 while mine got stuck at around zero.



https://imgur.com/a/wfHkQj4


I have followed and checked my code multiple times already for hours. I dont know how to solve this issue because I have already ran out questions I can search to fix it. I hope anyone can help me with this one. Thank you in advance.

cbooks77 July 23, 2021 00:46

Are you still having trouble with your code? I just recently ran through the applications in JD Andersons wonderful book myself. I ran into some hiccups along the way so don't worry it happens. Most likely you have a silly error somewhere. Do you have Matlab by chance? I generally write solvers in Matlab since its so convenient for debugging.


All times are GMT -4. The time now is 01:14.