2D backward staggered SIMPLE MATLAB turbulent
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 kepsilon models). I have started to solve a simple convectiondiffusion flow between two stationary plates, and tried to incorporate inflowoutflow 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 unused 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 
SIMPLE Algorithm
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 online 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! 
no problem, i got your email and have replied to it, a work in progress, but the basics are there

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 convectiondiffusion 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 underrelax the solution of the p' equation? I think a value of omega~0.2 (relaxation coefficient) is recommended in Versteeg & Malalasekera. Cheers, Michujo. 
Quote:
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 
Simple
Quote:
I would appreciate a reply .. Thanks 
A good way to publicly share matlab code is on matlab central
http://www.mathworks.in/matlabcentral/ 
.
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 !

where is my little gifts? I think you should show the basis respect to me.

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! 
Quote:

!
Nobody helped me !

Quote:

Thanks MichaelMore
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 miscommunication.:) 
Quote:

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... 
need fvm code for SIMPLE

Blog proposal
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. 
Matlab code for steady incompressible laminar flow
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 
All times are GMT 4. The time now is 13:32. 