CFD Online Logo CFD Online URL
Home > Forums > Main CFD Forum

help!on simple method code

Register Blogs Members List Search Today's Posts Mark Forums Read

LinkBack Thread Tools Display Modes
Old   July 9, 2011, 10:45
Default help!on simple method code
Join Date: Jul 2011
Posts: 66
Rep Power: 8
houkensjtu is on a distinguished road
Sponsored Links
I post a thread yesterday on SIMPLE method and Now I'm reading sample code from:

Maybe you are very familiar with this code.However I can't understand a paragrah in the main function in[simple.cpp]:


void Boundary_velocities(Matrix& Vel_u, Matrix& Vel_v) { /*{{{*/
//The values of the final row are the same as the previous one
unsigned FinalRow_u = Vel_u.numberOfRows() - 1;
for (unsigned col = 0; col < Vel_u.numberOfCols(); col++)
Vel_u(FinalRow_u, col) = Vel_u(FinalRow_u - 1, col);

//The values of the final column are the same as the previous one
unsigned FinalCol_v = Vel_v.numberOfCols() - 1;
for (unsigned row = 0; row < Vel_v.numberOfRows(); row++)
Vel_v(row, FinalCol_v) = Vel_v(row, FinalCol_v - 1);

//------------Mass balance
unsigned FinalCol_u = Vel_u.numberOfCols() - 1;
for (unsigned row = 1; row < Vel_u.numberOfRows() - 2; row++)
Vel_u(row, FinalCol_u) = 0;
//Vel_u(row, FinalCol_u) = Vel_u(row, FinalCol_u - 1) + Vel_v(row-1, FinalCol_u) - Vel_v(row,FinalCol_u);

//Vel_u(FinalRow_u-1, FinalCol_u) = Vel_u(FinalRow_u-1, FinalCol_u-1);
Vel_u(FinalRow_u-1, FinalCol_u) = 0;

unsigned FinalRow_v = Vel_v.numberOfRows() - 1;
for (unsigned col = 1; col < Vel_v.numberOfCols() - 1; col++)
Vel_v(FinalRow_v, col) = Vel_v(FinalRow_v - 1, col) + Vel_u(FinalRow_v,col-1) - Vel_u(FinalRow_v,col);


What does red part means?Is it trying to make sure the mass balance on the exit?or what?
I have also read other books like from patankar,but I am not quite clear that if SIMPLE method will automatically fufill the mass balance over all calculation region?
houkensjtu is offline   Reply With Quote
Sponsored Links


Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Open Source Code for Lattice Boltzmann Method Halim Main CFD Forum 25 December 15, 2016 03:26
Code for Discontinuous Galerkin Method ? Ameya J Main CFD Forum 2 April 21, 2011 05:45
2D Field Panel Method Source Code Shukla Main CFD Forum 3 January 20, 2011 13:51
Code for Immersed Boundary Method (ask for help) syq129 Main CFD Forum 2 November 23, 2010 04:16
Progressing to write my own simple code Jonny6001 Main CFD Forum 5 October 19, 2009 15:09

Sponsored Links

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