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

CFD code entirely from scratch using MATLAB for lid-driven cavity flow

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 17, 2023, 15:50
Default CFD code entirely from scratch using MATLAB for lid-driven cavity flow
  #1
New Member
 
Chandan Varma
Join Date: Aug 2023
Posts: 2
Rep Power: 0
chandanvarma07 is on a distinguished road
Hello everyone,

Inspired by the insightful teachings of Prof. Sandip Mazumder on YouTube, I have constructed a CFD code entirely from scratch using MATLAB for a classic problem: the lid-driven cavity flow. My goal is to implement a co-located mesh approach and harness the capabilities of the SIMPLE algorithm to ensure accurate pressure-velocity coupling. But after running the code, the residuals were blowing upto infinity.

In the early stages of debugging, I closely monitored the simulation's behavior. The initial iteration yielded a promising outcome, with both X and Y momentum well-preserved—a strong validation of my approach. Employing the TDMA method, I've attached an x momentum contour from the first iteration for your reference, exhibiting similarities to patterns observed in heat conduction cases solved by the ADI Method.

However, as I delved further into debugging, a significant challenge emerged: accurately calculating face velocities. It became evident that inaccuracies at this step were rippling through the simulation, affecting pressure source term calculations and subsequently impacting the pressure correction data. Notably, certain cells exhibited discrepancies between the sign of pressure source terms and correction data.

Through careful examination, I've begun to explore whether the absence of appropriate boundary conditions in face velocity calculation might contribute to these disparities. This has prompted a deeper consideration of boundary condition implementation and its potential influence on this critical simulation stage.

To provide a comprehensive view of my progress, I've attached the code I've been diligently working on. Your insights and expertise in reviewing this code would be invaluable in helping me address these challenges.

TIA
Attached Images
File Type: jpg mom_solver.jpg (58.2 KB, 15 views)
Attached Files
File Type: zip Code.zip (66.2 KB, 12 views)
chandanvarma07 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
2D Lid Driven Cavity Flow simulation using MATLAB josephlm Main CFD Forum 4 August 17, 2023 20:36
Patankar CFD FORTRAN 90 Code FVM siddiquesil Main CFD Forum 19 October 25, 2022 05:21
Sample code for SIMPLE-algorithm and solving Lid-Driven Cavity flow test is uploaded Michail CFD-Wiki 14 February 23, 2020 10:26
Matlab code for turbulent flow Karima Main CFD Forum 1 August 11, 2017 10:20
Question about Lid Driven Cavity Flow modeled by FEM msalamih Main CFD Forum 2 March 1, 2014 15:41


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