periodic boundary conditions with a gradient term
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! 
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. 
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! 
Quote:

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 
Quote:

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. 

Quote:
still looking for a central differenced scheme if anyone has any ideas ... I will keep looking myself! 
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.

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! 
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! 
All times are GMT 4. The time now is 08:05. 