|
[Sponsors] |
Solution to Quasi 1D converging-diverging nozzle problem (euler equations) blowing up |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
June 16, 2017, 10:54 |
Solution to Quasi 1D converging-diverging nozzle problem (euler equations) blowing up
|
#1 |
Member
Sangeet
Join Date: Jun 2017
Location: India
Posts: 43
Rep Power: 9 |
Hello,
I am currently trying to generate a numerical solution to a converging-diverging, subsonic-supersonic 1D nozzle flow problem. I am using Maccormack's technique to solve the Euler equations. I have already done it using the non-conservation form of the governing equations. I am now trying to solve it using the strong conservation form of the equations, but the solution keeps blowing up after a few time steps. I have checked for syntactical errors or logical errors in my C++ code but i am unable to pin down exactly what i am doing wrong. I have attached my C++ code and a few photos of the output. I will try to describe my code here as best as i can. I have 5 functions in my C++ code: 1-initial_values()=assigns initial values to the primitive variables and the area value at all grid points 2-conservation_form_initialization()=calculates the solution vector and flux vector terms at all the grid points from the initial values of the primitive variables. 3-time_step()=Calculates the time step satisfying the CFL criterion for linear PDEs at each grid point and chooses the lowest. 4-time_march()=Using Mccormack's technique marches one step forward in time 5-display_values()=just displays values with some formatting All variables are non-dimensionalized. I believe i have included enough comments in the code to help you understand whats going on in the code. If it helps, i am currently following the anderson book on CFD (CFD-The Basics with Applications) chapter 7. |
|
June 16, 2017, 11:54 |
|
#2 |
Senior Member
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,849
Rep Power: 73 |
I can suggest to check for the numerical stability constraint you are using. Furthermore, start to debug the code using a first order discretization so that you are sure to have a monotone scheme. If it works then go check if higher order discretization is correct.
|
|
June 16, 2017, 12:49 |
|
#3 |
Member
Sangeet
Join Date: Jun 2017
Location: India
Posts: 43
Rep Power: 9 |
So you are suggesting to try a first order method first and then if it's stable then to go for the Maccormak scheme?
And the numerical stability constraint is correct because I am following the scheme in the anderson book and the solution is stable. I will try to use a first order method though Thank you! PS: the numerical scheme works in the book though, can this mean that there's something wrong with my own implementation and not the scheme? |
|
June 16, 2017, 13:08 |
|
#4 | |
Senior Member
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,849
Rep Power: 73 |
Quote:
|
||
June 19, 2017, 11:33 |
|
#5 |
Member
Sangeet
Join Date: Jun 2017
Location: India
Posts: 43
Rep Power: 9 |
Hello again,
From what I understand from a first order upwind scheme it's a backward difference in space? I know i am supposed to make it converge for the first order scheme and then converge it again for the higher order method such as Maccormak's. When I edited the time marching function to use the first order method, my solution blew up even faster I believe. But I don't understand how I am supposed to converge it for the first order method. I must apologize for troubling you with a possibly trivial debugging but I can't understand what I should change to make the program converge. |
|
June 19, 2017, 15:01 |
|
#6 |
Senior Member
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,849
Rep Power: 73 |
If your code doesn't work with a first order upwind and you fulfilled all the numerical stability constraints I suppose you have a bug in the code.
|
|
June 21, 2017, 03:05 |
|
#7 |
Member
Sangeet
Join Date: Jun 2017
Location: India
Posts: 43
Rep Power: 9 |
Thank you.
That is what i suspected from the start but my problem is that i cannot figure out exactly where in the algorithm the mistake lies. I have gone through the code countless amount of times but I can't figure it out. But i understand that going through some one else's code is just mostly disorienting as we need to figure out what variables are what. Thank you for your help. On the bright side i did learn something new. I am a beginner so i didn't know about that a first order method is used to converge a code first. PS: I will post my code here if i manage to somehow figure it out. |
|
June 22, 2017, 03:41 |
Solved
|
#8 |
Member
Sangeet
Join Date: Jun 2017
Location: India
Posts: 43
Rep Power: 9 |
Hello,
So i figured out the the bug. It was a mistake in the calculation of the required flux terms in the corrector step. I have attached the C++ code if someone else faces this problem. |
|
June 22, 2017, 04:06 |
|
#9 |
Senior Member
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,849
Rep Power: 73 |
good, I suggest to check the difference between first order upwind and high order discretization
|
|
September 28, 2018, 11:09 |
|
#10 |
Member
Join Date: Feb 2018
Posts: 91
Rep Power: 8 |
Hello,
I really need your assistance. I am relatively new at using 1D equations, because I went straight into 3D. I now have to develop a 1D ventilation model so am using your code to understand basic implementation of 1D in C++. Am going through the Anderson book in order to understand your code. My question at the moment is what method you used for calculating the time step and why you used T. Am assuming T is temperature. The method for calculating time step in your code doesn't seem to fit with the methods in Anderson book, unless am misinterpreting your code. I look forward to hearing from you. Regards, charles |
|
October 21, 2019, 19:30 |
|
#11 | |
New Member
hajo jllon
Join Date: Jun 2019
Posts: 5
Rep Power: 7 |
Quote:
there is a Vectorized form of the solution using Python that may help https://github.com/JayJoeAy/Q1DNozzleVec |
||
March 8, 2020, 11:35 |
Shock capturing : MacCormack scheme with Artificial Viscosity
|
#12 |
New Member
NotSteve
Join Date: Mar 2020
Posts: 3
Rep Power: 6 |
Hello, After being succesful in solving all the problems in Chapter 7 of Anderson, i tried the shock capturing part where we induce a normal shock at the divergent portion of the CD nozzle. Although my results match the ones shown in the book for zero artificial viscosity, For Cx = 0.2 [Adjustment factor] my values go complex and blow up. Has anybody else come across this issue?
|
|
April 24, 2020, 20:33 |
|
#13 | |
New Member
Konstant Kampir
Join Date: Apr 2020
Posts: 1
Rep Power: 0 |
Quote:
|
||
Tags |
anderson, nozzle flow, quasi-1d |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Nozzle Flow - Divergence Problem | Ijaz | FLUENT | 9 | January 11, 2014 05:36 |
Future CFD Research | Jas | Main CFD Forum | 10 | March 30, 2013 13:26 |
unsteady 1-D euler equations in a nozzle | Luca | Main CFD Forum | 1 | November 30, 2008 15:13 |
problem with nozzle flow | belinda | FLUENT | 5 | July 12, 2006 18:42 |
multigrid solution of 2d euler equations | jim | Main CFD Forum | 2 | May 21, 2002 05:05 |