# Initialization of velocity/mass flux

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

May 17, 2019, 17:21
Initialization of velocity/mass flux
#1
New Member

Koustubh Bhagat
Join Date: Mar 2019
Posts: 2
Rep Power: 0
Hello,

I have just started writing small codes to simulate CFD problems just to get a gist of it. I have a question. Why should velocity be initialized such that continuity equation is solved? I mean it does sound obvious that continuity equation should be satisfied but what if I don't initialize velocity to so that continuity equation is satisfied? I tried doing it. The solution did converge but I got different results for both the cases. I have attached the problem and the MATLAB code I wrote. I haven't used the initialization values they have suggested though.

My MATLAB code:

u=[1 3];
p2c=10;
p2=0;
epsilon=0.001;
error=1;
ma=u(1)*3;
mb=u(2)*1;
e=[10 10]
while abs(p2c)>0.001
old=u;
ma=u(1)*3;
mb=u(2)*1;
u(1)=(3/ma)*(28-p2);
u(2)=ma/mb*u(1) + p2/mb;
u
p2c=(3*u(1) - u(2))/((1/mb)+(9/ma));
p2c
u(1)=u(1) -3*p2c/ma;
u(2)=u(2) + p2c/mb;
p2=p2 + p2c;
u
end
Attached Images
 2.JPG (14.6 KB, 5 views) 1.JPG (34.4 KB, 8 views)