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

2D backward staggered SIMPLE MATLAB turbulent

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 25, 2012, 16:49
Default 2D backward staggered SIMPLE MATLAB turbulent
  #1
Member
 
Michael Moor
Join Date: May 2012
Location: Ireland
Posts: 30
Rep Power: 14
michaelmoor.aero is on a distinguished road
Hello everyone!
My name is Michael Moor, I'm doing my MEng in Aeronautical engineerring, and my thesis is to develop my own CFD code in MATLAB, including turbulence (2D only, i'll only be doing the prandtl mixing length and k-epsilon models). I have started to solve a simple convection-diffusion flow between two stationary plates, and tried to incorporate inflow-outflow boundary conditions, with a hybrid differencing scheme.

I'd like to think that I am 85% finished... firstly i want to solve for laminar flow, and then include turbulence models once the basic model is working... so far I have:


- Created a backward staggered grid. I have included he un-used nodes i1 and j1, just to make it more clear, and to keep matrix dimensions the same. The way that I have manipulated and defined the matrices also allows for the same indexing as used by Versteeg, hopefully making it easier to read!
- employed a hybrid differencing scheme
- used predominantly matrix manipulation (on advice) to construct all of the coefficients and equations... a few "for loops" to keep the order of the u, v, p' and scalar cells the same
- included the often neglected source term which comes from the derivation of the NS equations (is it overly important? it may be causing my divergence...
- solved for u*, v* and p', although the coefficient matrices for v* and p' are not diagonally dominant, the v* gauss seidel still converges, but the p' does not, i.e. the pressure correction is not converging... I am wondering if that is because I have made a mistake with the boundary conditions (which I am also slightly perplexed about, a common theme I have seen in these posts!) or is it simply because of the initial poor guess?

- used the Gauss seidel method for solving the momentum and pressure correction equations ( I have followed as closely as I can to Versteeg and Malalasakera).


-"solved" for the new pressure and new velocites using the converged u* and v* values, as well as the unconverged p' values

- I am about to attempt to get the whole process to iterate...

BUT, before I try and start iterating the process, I am new to this forum and am not sure where to go or how to allow people to see my code and help me, I am not a particularly strong programmer, it has been a long hard slog, but everything is fairly explicit and I have annotated the code pretty well, I think that it would help beginners, (if it is correct, plus, I am basically a beginner myself!!), and similarly help me by allowing people to forward their suggestions, or more importantly to point out mistakes that I have made.

I would greatly appreciate your help in 1. looking at my code yourself and offering suggestions/correcting mistakes 2. helping me to get more help and understanding (not necessarily from you as I am sure that you are very busy)/ spread my work to help others with similar problems and to get them to help me!

I hope that you are still an active member and can help me out, i'd really appreciate it!!

Best Regards,
Michael Moor

Last edited by michaelmoor.aero; May 25, 2012 at 16:51. Reason: include convection-diffusion and hybrid differencing scheme
michaelmoor.aero is offline   Reply With Quote

Old   May 31, 2012, 18:32
Default SIMPLE Algorithm
  #2
New Member
 
Join Date: May 2012
Location: USA
Posts: 14
Rep Power: 14
Hoggs17 is on a distinguished road
Good to know there are other people out there interested in the same type of engineering problems as myself. I'm a mech. engineering grad student with emphasis in fluid dynamics/heat transfer.

I've been looking on-line for sample codes in attempts to guide me in creating my own finite volume CFD code in MATLAB but there hasn't been much help. My programming background is weak so it's difficult for me to jump right in and develop my own code. I've read up on several books to familiarize myself with the physics behind the solutions but I've had difficulty in finding good code that I can learn from.

If I come across anything or develop any code that might help you I'll be sure to let you know in case it would help you. May I see your sample code? I might be able to offer up a few tips from what I do know so far. Thanks!
Maanieh.h likes this.
Hoggs17 is offline   Reply With Quote

Old   June 7, 2012, 12:49
Default
  #3
Member
 
Michael Moor
Join Date: May 2012
Location: Ireland
Posts: 30
Rep Power: 14
michaelmoor.aero is on a distinguished road
no problem, i got your email and have replied to it, a work in progress, but the basics are there
michaelmoor.aero is offline   Reply With Quote

Old   September 19, 2012, 13:34
Default
  #4
Senior Member
 
Join Date: Dec 2011
Location: Madrid, Spain
Posts: 134
Rep Power: 16
michujo is on a distinguished road
Hi Michael, sorry for the late reply but your thread came up after a forum search. It turns out I'm also trying to develop my own 2D incompressible CFD code in MATLAB following Versteeg & Malalasekera. So far I'm only able to solve the convection-diffusion equation for a general variable phi (assuming a velocity field), but I'm struggling to code the fluid flow solver part.

Hopefully we can share some knowledge/experiences/problems and solutions.

About your convergence problem: did you try to under-relax the solution of the p' equation? I think a value of omega~0.2 (relaxation coefficient) is recommended in Versteeg & Malalasekera.

Cheers,
Michujo.
michujo is offline   Reply With Quote

Old   September 21, 2012, 05:33
Default
  #5
Member
 
Michael Moor
Join Date: May 2012
Location: Ireland
Posts: 30
Rep Power: 14
michaelmoor.aero is on a distinguished road
Quote:
Originally Posted by michujo View Post
Hi Michael, sorry for the late reply but your thread came up after a forum search. It turns out I'm also trying to develop my own 2D incompressible CFD code in MATLAB following Versteeg & Malalasekera. So far I'm only able to solve the convection-diffusion equation for a general variable phi (assuming a velocity field), but I'm struggling to code the fluid flow solver part.

Hopefully we can share some knowledge/experiences/problems and solutions.

About your convergence problem: did you try to under-relax the solution of the p' equation? I think a value of omega~0.2 (relaxation coefficient) is recommended in Versteeg & Malalasekera.

Cheers,
Michujo.
Hi Michujo,
I have succesfully completed the solver, using both Simple and Simplec. If you provided me with an address, I would be more than happy to share it with you, and to help you through it! It was constructed in such a way as to be educational, so I hope that it will be of help to you!

Best Regards,
Michael Moor
michaelmoor.aero is offline   Reply With Quote

Old   January 27, 2013, 10:37
Default Simple
  #6
New Member
 
Hsn Mnh
Join Date: Jan 2013
Location: Beirut, Lebanon
Posts: 9
Rep Power: 13
Maanieh.h is on a distinguished road
Send a message via Skype™ to Maanieh.h
Quote:
Originally Posted by michaelmoor.aero View Post
Hi Michujo,
I have succesfully completed the solver, using both Simple and Simplec. If you provided me with an address, I would be more than happy to share it with you, and to help you through it! It was constructed in such a way as to be educational, so I hope that it will be of help to you!

Best Regards,
Michael Moor
Hello Michael , can i also see the SIMPLE code ?? cause I am stuck with problems in flow and in discr. the momentum equation .. Can I see the SIMPLE code of yours ??

I would appreciate a reply ..
Thanks
Maanieh.h is offline   Reply With Quote

Old   January 27, 2013, 11:21
Default
  #7
Super Moderator
 
Praveen. C
Join Date: Mar 2009
Location: Bangalore
Posts: 343
Blog Entries: 6
Rep Power: 18
praveen is on a distinguished road
A good way to publicly share matlab code is on matlab central

http://www.mathworks.in/matlabcentral/
praveen is offline   Reply With Quote

Old   January 27, 2013, 11:25
Default .
  #8
New Member
 
Hsn Mnh
Join Date: Jan 2013
Location: Beirut, Lebanon
Posts: 9
Rep Power: 13
Maanieh.h is on a distinguished road
Send a message via Skype™ to Maanieh.h
I posted here because the friends in here are talking about the subject that Im having problems in .. I would like to share codes via email and not to publicly share them .. Thanks paraveen for ur reply !
Maanieh.h is offline   Reply With Quote

Old   January 29, 2013, 12:41
Default
  #9
Senior Member
 
ztdep's Avatar
 
p ding
Join Date: Mar 2009
Posts: 427
Rep Power: 19
ztdep is on a distinguished road
Send a message via Yahoo to ztdep Send a message via Skype™ to ztdep
where is my little gifts? I think you should show the basis respect to me.
ztdep is offline   Reply With Quote

Old   January 29, 2013, 21:10
Default
  #10
Member
 
Michael Moor
Join Date: May 2012
Location: Ireland
Posts: 30
Rep Power: 14
michaelmoor.aero is on a distinguished road
Hello everyone, my apologies for the delay!

I am more than happy to help you, just send me an email and I can forward it on! I was/am hoping to make my own small website to post it, but I must first put it on the MATLAB site as previously suggested!

As ztdep has correctly stated, all of my work would not have come about without his invaluable help, thanks again!
michaelmoor.aero is offline   Reply With Quote

Old   January 29, 2013, 21:15
Default
  #11
Member
 
Michael Moor
Join Date: May 2012
Location: Ireland
Posts: 30
Rep Power: 14
michaelmoor.aero is on a distinguished road
Quote:
Originally Posted by michaelmoor.aero View Post
Hello everyone, my apologies for the delay!

I am more than happy to help you, just send me an email and I can forward it on! I was/am hoping to make my own small website to post it, but I must first put it on the MATLAB site as previously suggested!

As ztdep has correctly stated, all of my work would not have come about without his invaluable help, thanks again!
also ding, check your gmail!
michaelmoor.aero is offline   Reply With Quote

Old   February 10, 2013, 11:02
Default !
  #12
New Member
 
Hsn Mnh
Join Date: Jan 2013
Location: Beirut, Lebanon
Posts: 9
Rep Power: 13
Maanieh.h is on a distinguished road
Send a message via Skype™ to Maanieh.h
Nobody helped me !
Maanieh.h is offline   Reply With Quote

Old   February 11, 2013, 06:02
Default
  #13
Member
 
Michael Moor
Join Date: May 2012
Location: Ireland
Posts: 30
Rep Power: 14
michaelmoor.aero is on a distinguished road
Quote:
Originally Posted by Maanieh.h View Post
Nobody helped me !
if you read my post correctly, the you can see that i have offered to help and that i would be happy ti forward on the code in an email address that you provide...
michaelmoor.aero is offline   Reply With Quote

Old   February 12, 2013, 08:01
Default Thanks MichaelMore
  #14
New Member
 
Hsn Mnh
Join Date: Jan 2013
Location: Beirut, Lebanon
Posts: 9
Rep Power: 13
Maanieh.h is on a distinguished road
Send a message via Skype™ to Maanieh.h
Oh Im so Sorry I didn't think your post was directed to me .. I would be honored to send you me email : huss.ma3@gmail.com

Sorry once again for any mis-communication.
Maanieh.h is offline   Reply With Quote

Old   February 15, 2013, 17:02
Default
  #15
Member
 
Michael Moor
Join Date: May 2012
Location: Ireland
Posts: 30
Rep Power: 14
michaelmoor.aero is on a distinguished road
Quote:
Originally Posted by Maanieh.h View Post
Oh Im so Sorry I didn't think your post was directed to me .. I would be honored to send you me email : huss.ma3@gmail.com

Sorry once again for any mis-communication.
that is no problem at all! apologies for the delay. i have sent the file to the address supplied, again, all thanks to ztdep, the true mastermind! please let me know how helpful/unhelpful it is, especially as i tried tomake it basic and educational.
michaelmoor.aero is offline   Reply With Quote

Old   February 15, 2013, 17:45
Default
  #16
Member
 
G. S.
Join Date: Nov 2010
Posts: 54
Rep Power: 16
gerardosrez is on a distinguished road
hello people,

Perhaps we should do something like a blog just for us, Michael and Ding both know me I'm in the same situation like many of you and them, developing incompressible 2d code. In my case I'm using the cvfem approach with collocated variables and still stucked in inflow and outflow problems, also dedicating some time to improve my code making it faster using less for loops...

It would be great if there is a way to share more directly experiences and advices with you guys...

Let me know your proposals about a way to keep constantly in toouch

Best regards

Hi michael and ding, long time we dont chat...
gerardosrez is offline   Reply With Quote

Old   April 15, 2013, 08:13
Default need fvm code for SIMPLE
  #17
New Member
 
hellboy
Join Date: Apr 2013
Posts: 1
Rep Power: 0
FVM_CFD_GUY is on a distinguished road
please send me code at anjaneya4@gmail.com

thanks!!!
FVM_CFD_GUY is offline   Reply With Quote

Old   May 1, 2013, 15:51
Default Blog proposal
  #18
New Member
 
Join Date: May 2012
Location: USA
Posts: 14
Rep Power: 14
Hoggs17 is on a distinguished road
I would be interested in keeping in touch with all fellow members who are interested in similar topics. I seem to make a little progress in my code but then I bang my head against the keyboard for a few weeks until it's resolved.

If we had a place to go to ask questions I believe it would make our research struggles much less painful. Let me know what you guys decide to do and I'd happily participate.
Hoggs17 is offline   Reply With Quote

Old   February 1, 2016, 11:47
Default Matlab code for steady incompressible laminar flow
  #19
New Member
 
Debayan
Join Date: Jan 2016
Posts: 1
Rep Power: 0
ribhu is on a distinguished road
Hi Michael,

I have made matlab codes for simple convection diffusion problems with a known velocity field as given in Versteeg book. But finding difficulty to solve the momentum equation fpr a laminar in compressible steady flow. I would be very grateful if you could send me your code. My email id is dasguptadebayan@gmail.com

Regards

Debayan
ribhu is offline   Reply With Quote

Old   October 5, 2021, 18:35
Default Code sharing
  #20
New Member
 
Yann Scott
Join Date: Oct 2019
Posts: 5
Rep Power: 7
Yann Scott is on a distinguished road
Hi Michael,

I am solving a turbulent 1D equation using three different turbulence model: Prandtl mixing length, k-epsilon and K-omega. However, I'm finding difficulty to solve explicitly the equations. I would be very grateful if you could send me your code. My email id is yannbirnie@gmail.com

Regards

Yann
Yann Scott is offline   Reply With Quote

Reply


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
Turbulent flow over a backward facing step Jenner Main CFD Forum 1 December 2, 2006 12:21
Turbulent flow over backward step Jenner Main CFD Forum 2 November 20, 2006 06:22
A simple question Q Main CFD Forum 3 November 16, 2005 04:37
About low Re number turbulent flows gorka Main CFD Forum 13 April 2, 2003 06:19
turbulent flow over a backward facing step Kirill Main CFD Forum 4 November 5, 2002 10:04


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