
[Sponsors] 
March 6, 2013, 05:11 
periodic boundary conditions with a gradient term

#1 
Senior Member
Join Date: Jun 2010
Posts: 111
Rep Power: 7 
Hi,
I have been trying to implement periodic bc's in my 1D code, I have a gradient term in my code, which I have discretized by using central differencing, so I have du/dx = (u_i+1  u_i)/(x_i+1  x_i) so for a periodic bc at the left and right boundaries I have used du/dx = (u_1  u_N)/(x_1  x_N) where N is the final cell, but for some reason I get weird results at the boundaries. Could someone please confirm that what I am doing it correct. Thanks! 

March 6, 2013, 07:49 

#2  
Senior Member
andy
Join Date: May 2009
Posts: 129
Rep Power: 8 
Quote:
du/dx = (u_i+1  u_i1)/(x_i+1  x_i1) ??? For a pure upwind scheme the downstream value is not used and so can take any value. Setting it to the first solved value would look tidy but is not required. Is this what you are seeing? Do you need to perform a line sweep to handle the unknown upstream boundary value? The code for periodic line sweeps is different to that for Dirichlet and Neumann line sweeps. 

March 6, 2013, 08:07 

#3 
Senior Member
Join Date: Jun 2010
Posts: 111
Rep Power: 7 
oooh! Thanks! Stupid of me to think I was using CDS!
I want to avoid a scheme that is based on the direction of the flow, are there such schemes that can be used just with 2 neighbouring cells involved, like in 1sr order upwind? I don't see how that would be possible but I though I'd ask just in case ... about CDS, would the expression "du/dx = (u_i+1  u_i1)/(x_i+1  x_i1) " give du/dx across the east face or the west face of node i? or would they both be the same. I am using collocated grid. Slightly confused by that for some reason. Would really appreciate you help. Many Thanks! Last edited by Hooman; March 6, 2013 at 08:33. Reason: more question 

March 6, 2013, 08:27 

#4  
Senior Member
andy
Join Date: May 2009
Posts: 129
Rep Power: 8 
Quote:


March 6, 2013, 08:37 

#5 
Senior Member
Join Date: Jun 2010
Posts: 111
Rep Power: 7 
Thanks Andy,
just added a bit to my previous question, I would appreciate you answer to that as well: about CDS, would the expression "du/dx = (u_i+1  u_i1)/(x_i+1  x_i1) " give du/dx across the east face or the west face of node i? or would they both be the same. I am using collocated grid. Many Thanks 

March 6, 2013, 09:15 

#6 
Senior Member
andy
Join Date: May 2009
Posts: 129
Rep Power: 8 
The expression is the usual central difference approximation for the gradient of u at the location i. If you are evaluating the gradient at cell walls then this looks to be part of doing something more. Perhaps part of an upwinding scheme or the first stage of working out the second derivatives? I think you might be better off reading a book for answers to this level of question.


March 6, 2013, 09:26 

#7 
Senior Member
Join Date: Jun 2010
Posts: 111
Rep Power: 7 
This forum was my last resort not first! I've read Versteeg, and other books, etc. I couldn't find what I wanted, perhaps because my equations are slightly different.
Thanks anyways! Your replies helped. 

March 6, 2013, 09:37 

#8 
Senior Member
Join Date: Jun 2010
Posts: 111
Rep Power: 7 

March 6, 2013, 09:53 

#9 
Senior Member
Join Date: Dec 2011
Location: Madrid, Spain
Posts: 133
Rep Power: 7 
Hi, apart from the comments you got on the numerical schemes, I think there is a mistake in the first expression you showed for the discretization of the derivative at the boundary. You are dividing by (x1xN) which, if I understand the notation, is about the whole length of the channel!. I think you should divide by something like , where [\Delta x_i] is the cell size. This expression is the length between the nodes N and 1 assuming the nodes are centered within the cells.
Maybe you could give it a try. Cheers, Michujo. 

March 6, 2013, 10:07 

#10  
Senior Member
Join Date: Jun 2010
Posts: 111
Rep Power: 7 
Quote:
still looking for a central differenced scheme if anyone has any ideas ... I will keep looking myself! 

March 6, 2013, 12:46 

#11 
Senior Member
andy
Join Date: May 2009
Posts: 129
Rep Power: 8 
This looks like diffusion rather than convection? If so, that is a much better behaved problem and is possibly better tackled by placing the unknowns at the cell faces and not the cell centres. That is, a standard Galerkin FEM approach. But the best arrangement of grid and unknowns may well be determined by where you are going with whatever you are trying to solve.


March 6, 2013, 13:05 

#12  
Senior Member
Join Date: Jun 2010
Posts: 111
Rep Power: 7 
Quote:
I have thought about moving the nodes but was trying my best to stick with FVM with nodes in the centre, because I have convection terms as well. I will give it some serious thought now ... Thanks! 

March 6, 2013, 13:25 

#13 
Senior Member
Join Date: Jun 2010
Posts: 111
Rep Power: 7 
I just took the average of the CDS obtained for the cell centres to the two sides of the faces of the current cell and it seems to work OK so far ... It involves more cells, but for now I think it's doing the job, fingers crossed!
Thanks for you guidance! 

Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Wind turbine simulation  Saturn  CFX  45  Yesterday 05:42 
mesh file for flow over a circular cylinder  Ardalan  Main CFD Forum  6  April 17, 2010 23:40 
RPM in Wind Turbine  Pankaj  CFX  9  November 23, 2009 05:05 
periodic boundary conditions  mranji1  Main CFD Forum  4  August 24, 2009 23:45 
3D nonconformal periodic boundary conditions  Simon Riverin  FLUENT  4  February 23, 2007 02:35 