
[Sponsors] 
August 8, 2011, 09:25 
Unsteady flow code  Problem with space loop

#1 
Member
Join Date: Jun 2010
Posts: 98
Rep Power: 7 
Hi all,
I have discretized my equations in a way that for example the velocity depends on the velocity of the previous neighboring element so: h = number of elements t = 0: 0.5 : 10 for j= 1 : length(t) for i = 2: h v(i,j) = v(i1,j) + b p(i,j) = p(i,j) +b end end This is not my actual formulations(codes) but the idea is that I need the value of the variable at the previous element so I start my loop from 2 to avoid getting i=0. But then this means that I don't have any values when I have i = 1 in the code. Is the only way to deal with this using boundary conditions. For example setting the value of the variable at i = 1 to be equal to that at i =2 ? I hope I am clear enough. Thanks. 

August 8, 2011, 19:49 

#2 
Senior Member
cfdnewbie
Join Date: Mar 2010
Posts: 551
Rep Power: 11 
hm, I'm not clear what you are trying to do....which equation are you trying to solve? hyperbolic? parabolic? That would give you the type and number of boundary conditions you need... once you know that, you can apply the correct bc at your inflow / outflow.
cheers 

August 9, 2011, 06:00 

#3 
Member
Join Date: Jun 2010
Posts: 98
Rep Power: 7 
I have a set of first order ODE's of the form:
dy/dt = f(y,t). Thanks! 

August 9, 2011, 17:31 

#4 
Senior Member
cfdnewbie
Join Date: Mar 2010
Posts: 551
Rep Power: 11 

August 9, 2011, 18:02 

#5 
Member
Join Date: Jun 2010
Posts: 98
Rep Power: 7 
hmmm... Sorry ... well, that's the general form of the equation.....although the variables are evaluated at nodes which are at different locations... i.e. they change with space. So the 'i' is really a node number of a certain element. I hope this is more clear ...
Can I email you a simplified form of the equations, as my explanation is still probably unclear ... ? Thanks! 

August 9, 2011, 18:08 

#6  
Senior Member
cfdnewbie
Join Date: Mar 2010
Posts: 551
Rep Power: 11 
Quote:
So are you saying that you start with a PDE (in x and t) and then semidiscretize it (by evaluating things like d/dx at the nodes) and now you end up with an ODE in time? Then I got you 

August 9, 2011, 18:16 

#7 
Member
Join Date: Jun 2010
Posts: 98
Rep Power: 7 
yes! you're right. Thanks!
So is there a specific type of boundary conditions or a mixture of some that needs to be used with this type of equation? Thanks again. 

August 9, 2011, 18:50 

#8 
Senior Member
cfdnewbie
Join Date: Mar 2010
Posts: 551
Rep Power: 11 
Yes, in fact, there is. The problem you are solving is hyperbolic, so you have to find out your inflow and your outflow regions. You only specify your inflow for all times t, and extrapolate the outflow from inside the domain.
I'm trying to make it a little bit clearer by this example: say you want to solve the following standard hyperbolic problem (scalar): du/dt + a du/dx = 0, with u=u(x,t), a >0 Thats the equation of a hyperbolic wave transport, i.e. everything will be transported (NOT damped) with speed a to the right (since a >0). That means that the flow enters your domain from the left and exits on the right. So what you do is the following: you set your BCs ONLY at the left side, say thats at x=0: u(x=0,t)=something at the right side (outflow), you extrapolate your solution, i.e. u(x=right border,t) = u(x=rightborder1,t). Hope this helps! 

August 10, 2011, 16:03 

#9 
Member
Join Date: Jun 2010
Posts: 98
Rep Power: 7 
Many thanks. That helped alot.


August 10, 2011, 17:05 

#10 
Senior Member
cfdnewbie
Join Date: Mar 2010
Posts: 551
Rep Power: 11 
glad i could help


Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Boundary condition problem for open channel flow  Andy  CFX  8  October 1, 2012 07:45 
NACA0012 geometry/design software needed  Franny  Main CFD Forum  13  July 7, 2007 15:57 
Problem on boundry of two phase flow  youngan  CFX  0  June 30, 2003 02:32 
problem with using colocated code  Jack  Main CFD Forum  0  December 15, 2002 01:15 
Poiseuille flow problem  Rosie  FLUENT  1  December 6, 2002 17:52 