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

help!on simple method code

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 9, 2011, 10:45
Default help!on simple method code
  #1
Member
 
HouKen
Join Date: Jul 2011
Posts: 67
Rep Power: 14
houkensjtu is on a distinguished road
I post a thread yesterday on SIMPLE method and Now I'm reading sample code from:
http://www.students.ncl.ac.uk/f.j.he...webs/codes.php

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

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
Open Source Code for Lattice Boltzmann Method Halim Main CFD Forum 34 November 14, 2019 01:27
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 12:51
Code for Immersed Boundary Method (ask for help) syq129 Main CFD Forum 2 November 23, 2010 03:16
Progressing to write my own simple code Jonny6001 Main CFD Forum 5 October 19, 2009 15:09


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