Unsteady flow code - Problem with space loop

Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
8 replies · 2K views
hoomanya
Messages
86
Reaction score
0
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(i-1,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.
 
Physics news on Phys.org
You should have a boundary condition that defines your variable at i=1.
 
Looking at my equations again, I think a possibility would be to make the values at i-1 equal to the values at the walls of the elements/ cells when possible. Is that a sensible thing to do?
 
No I don't think that's doable. ...hmmm .. .still stuck!
my equations are a set of ODEs of the form:

dy/dt = f(y,t)
 
my problem is with space loop . I have initial conditions. I think I need boundary conditions...
 
Well it is a fluid problem, so you obviously need both. You will need boundary conditions to get the physical nature of the flow as far as what happens when it approaches surfaces, or infinity and you will need initial conditions to get a time history.
 
I know that. Like I said I have my initial conditions sorted. I need to know how to deal with this space loop...
 
Well without knowing more I suppose we can't really help you. You need to set velocities to zero at walls and free stream at infinity or whatever else your system requires. We don't know your BCs or ICs, so I don't know what you expect with so little information.