Unsteady flow code - Problem with space loop

AI Thread Summary
The discussion revolves around the challenges of implementing boundary conditions in a discretized fluid dynamics model, specifically when calculating velocity and pressure based on neighboring elements. The user is unsure how to handle the initial condition at the first element (i=1) since their loop starts from i=2, leading to a lack of defined values for i=1. Suggestions include setting boundary conditions that define the variable at i=1, potentially equating it to values at the walls of the elements. It is emphasized that both boundary and initial conditions are crucial for accurately modeling fluid behavior, particularly near surfaces or at infinity. The conversation highlights the need for more specific information about the user's boundary and initial conditions to provide tailored guidance.
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)
 
You need an initial condition at whatever your start time is.
 
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.
 
Back
Top