Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Unsteady flow code - Problem with space loop

  1. Aug 8, 2011 #1
    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.
     
  2. jcsd
  3. Aug 8, 2011 #2
    You should have a boundary condition that defines your variable at i=1.
     
  4. Aug 9, 2011 #3
    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?
     
  5. Aug 9, 2011 #4
    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)
     
  6. Aug 9, 2011 #5

    boneh3ad

    User Avatar
    Science Advisor
    Gold Member

    You need an initial condition at whatever your start time is.
     
  7. Aug 9, 2011 #6
    my problem is with space loop . I have initial conditions. I think I need boundary conditions...
     
  8. Aug 9, 2011 #7

    boneh3ad

    User Avatar
    Science Advisor
    Gold Member

    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.
     
  9. Aug 9, 2011 #8
    I know that. Like I said I have my initial conditions sorted. I need to know how to deal with this space loop...
     
  10. Aug 9, 2011 #9

    boneh3ad

    User Avatar
    Science Advisor
    Gold Member

    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.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Unsteady flow code - Problem with space loop
  1. Unsteady Air Conditioner (Replies: 19)

Loading...