CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

Unsteady flow code - Problem with space loop

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 8, 2011, 10:25
Default Unsteady flow code - Problem with space loop
  #1
Senior Member
 
Join Date: Jun 2010
Posts: 111
Rep Power: 16
Hooman is on a distinguished road
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.
Hooman is offline   Reply With Quote

Old   August 8, 2011, 20:49
Default
  #2
Senior Member
 
cfdnewbie
Join Date: Mar 2010
Posts: 557
Rep Power: 20
cfdnewbie is on a distinguished road
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
cfdnewbie is offline   Reply With Quote

Old   August 9, 2011, 07:00
Default
  #3
Senior Member
 
Join Date: Jun 2010
Posts: 111
Rep Power: 16
Hooman is on a distinguished road
I have a set of first order ODE's of the form:

dy/dt = f(y,t).

Thanks!
Hooman is offline   Reply With Quote

Old   August 9, 2011, 18:31
Default
  #4
Senior Member
 
cfdnewbie
Join Date: Mar 2010
Posts: 557
Rep Power: 20
cfdnewbie is on a distinguished road
Quote:
Originally Posted by Hooman View Post
I have a set of first order ODE's of the form:

dy/dt = f(y,t).

Thanks!

OK, you got me confused now....are you solving ODEs or PDEs? Because from your first post, I got the impression you where also dealing with a spatial derivative??
cfdnewbie is offline   Reply With Quote

Old   August 9, 2011, 19:02
Default
  #5
Senior Member
 
Join Date: Jun 2010
Posts: 111
Rep Power: 16
Hooman is on a distinguished road
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!
Hooman is offline   Reply With Quote

Old   August 9, 2011, 19:08
Default
  #6
Senior Member
 
cfdnewbie
Join Date: Mar 2010
Posts: 557
Rep Power: 20
cfdnewbie is on a distinguished road
Quote:
Originally Posted by Hooman View Post
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!

So are you saying that you start with a PDE (in x and t) and then semi-discretize it (by evaluating things like d/dx at the nodes) and now you end up with an ODE in time? Then I got you
cfdnewbie is offline   Reply With Quote

Old   August 9, 2011, 19:16
Default
  #7
Senior Member
 
Join Date: Jun 2010
Posts: 111
Rep Power: 16
Hooman is on a distinguished road
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.
Hooman is offline   Reply With Quote

Old   August 9, 2011, 19:50
Default
  #8
Senior Member
 
cfdnewbie
Join Date: Mar 2010
Posts: 557
Rep Power: 20
cfdnewbie is on a distinguished road
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=rightborder-1,t).

Hope this helps!
cfdnewbie is offline   Reply With Quote

Old   August 10, 2011, 17:03
Default
  #9
Senior Member
 
Join Date: Jun 2010
Posts: 111
Rep Power: 16
Hooman is on a distinguished road
Many thanks. That helped alot.
Hooman is offline   Reply With Quote

Old   August 10, 2011, 18:05
Default
  #10
Senior Member
 
cfdnewbie
Join Date: Mar 2010
Posts: 557
Rep Power: 20
cfdnewbie is on a distinguished road
glad i could help
cfdnewbie is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Boundary condition problem for open channel flow Andy CFX 9 June 11, 2016 08:20
NACA0012 geometry/design software needed Franny Main CFD Forum 13 July 7, 2007 16:57
Problem on boundry of two phase flow youngan CFX 0 June 30, 2003 03: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


All times are GMT -4. The time now is 17:21.