CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

2D SIMPLE Compressible flow Matlab

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By PacMan

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 11, 2021, 04:55
Question 2D SIMPLE Compressible flow Matlab
  #1
New Member
 
Gao Shangya
Join Date: Oct 2021
Posts: 18
Rep Power: 5
Harlotte is on a distinguished road
Hello everyone,
I'm Gao. I'm a master student in automotive systems. I am currently working on my thesis. The content of my thesis is to write a CFD code in matlab (it's 2D), this code is used to simulate the gas exchange in the cylinder of a hydrogen internal combustion engine. There is no need to consider the combustion as well as the exhaust. The intake and compression need to be considered.
I have started my first step: assume that the piston is at the BDC and that air flows the cylinder at a certain speed. I have used a staggered grid and discretized the governing equations using the finite volume method, while I have coupled the pressure-velocity-density using the SIMPLE algorithm.
I have successfully simulated the air flowing into the cylinder at a speed of 1m/s. However, when I modified the velocity just to 2m/s, my code went into chaos and I spent a lot of time trying to improve it, but it didn't seem to work.
I would like people to take a look at my code and give me some advice. I'm not a very good programmer. Also, I am a newbie to CFD. I have commented my code very well and it is very easy to understand.
If you could point out my mistakes and give me some corrections, I'd really appreciate your help!!!

KR Gao
Harlotte is offline   Reply With Quote

Old   December 22, 2021, 17:50
Default
  #2
New Member
 
Alan
Join Date: Dec 2021
Posts: 8
Rep Power: 4
PacMan is on a distinguished road
Hi, I used a similar approach to wrote a 2D FVM code using SIMPLE for the cavity lid problem.
I think your problem resides in turbulence. If you discretize the NS equations directly, you have to bound your problem to laminar flow conditions. If some part of the flow start to behave like turbulent, then an exponentially growing numerical error would likely to occur, and the simulation would diverge.
Try to set viscosity to zero.

AMK
PacMan is offline   Reply With Quote

Old   December 23, 2021, 08:02
Smile
  #3
New Member
 
Gao Shangya
Join Date: Oct 2021
Posts: 18
Rep Power: 5
Harlotte is on a distinguished road
Quote:
Originally Posted by PacMan View Post
Hi, I used a similar approach to wrote a 2D FVM code using SIMPLE for the cavity lid problem.
I think your problem resides in turbulence. If you discretize the NS equations directly, you have to bound your problem to laminar flow conditions. If some part of the flow start to behave like turbulent, then an exponentially growing numerical error would likely to occur, and the simulation would diverge.
Try to set viscosity to zero.

AMK
Hello,
thank you for your advice.Do you know how to discretize the NS turbulence equations? I have searched for some literature,but there are no details...
Harlotte is offline   Reply With Quote

Old   December 23, 2021, 09:42
Default
  #4
New Member
 
Alan
Join Date: Dec 2021
Posts: 8
Rep Power: 4
PacMan is on a distinguished road
I'm no specialist of this, but there are my advices:

Look into Fluent Manual -> theory guide -> turbulence modeling or something like this...
To model turbulence, you have to add (subtract the Reynold stress term in your velocity equations (Look the Raynolds Average NS - RANS). The RS term is then modelled in the scalar or vectorial equations of the turbulence model of your choice.
The simplest is Spalart-Allmaras, but is not suited for your case. Try the k-epsilon, that is stable.
Then you have to write the transport equations for k and epsilon. It has a lot of constants, take the default ones.
Choose a strategy to determine k and epsilon values on the boundaries. Think of them as scalars, like something that is convected with the flow. Use first order upwind scheme (look into Patankar).
Maybe in Versteeg and Malalasekera you can find some better explanation, but the solver manuals are written by people that use to code those things and are written in their language (very narrow).

Good luck
Harlotte likes this.
PacMan is offline   Reply With Quote

Reply

Tags
cfd, compressible flow problem, matlab


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Compressible Flow Pressure Outlet Back Flow okstatecheme OpenFOAM Running, Solving & CFD 1 March 21, 2018 09:11
Setting boundary conditions for simple pipe flow with flow direction changing in time Sipher FLUENT 1 May 4, 2015 21:05
compressible flow maria teresa FLUENT 1 September 7, 2007 17:58
urgent help needed with 2d compressible flow James FLUENT 2 June 20, 2007 05:22
Can 'shock waves' occur in viscous fluid flows? diaw Main CFD Forum 104 February 16, 2006 06:44


All times are GMT -4. The time now is 12:23.