- **Main CFD Forum**
(*https://www.cfd-online.com/Forums/main/*)

- - **Boundary conditions
**
(*https://www.cfd-online.com/Forums/main/15802-boundary-conditions.html*)

Boundary conditions
Hello,
newbie here, so please bear with me. I'm trying to implement bc's for a 2d convection diffusion transient problem, but can't get a sensible solution. I'm sure the interior equations are fine. Could anybody help me with the EXACT method for implementing wall, inlet and outlet bc's, i.e. what are the discrete equations to put into the matrix system. Many thanks in advance. |

Re: Boundary conditions
Velocities on cells edges or cell center?
Finite volume, finite difference? Primitive variables (u, v, p), stream function vorticity, ?? If you can't get a sensible solution, how have you determined that the "interior equations are fine." A more polite way to ask these questions is to just say "please give us more information." |

Re: Boundary conditions
otd,
The method is finite volume. I'm trying to set the problem up one step at a time. At the moment I have one equation. It's a time dependent convection diffusion equation (2d): dc/dt + v dc/dy + div ( D grad c ) = 0 Constant velocity v in the y direction only. D is a constant diffusion coefficent at the bottom boundary (y=0) I have an inlet: c=c0. at the top I want an outflow boundary. the right/left boundaries are impermeable. Eventually I want to add the problem for (u,v,p) but it seems I can't get past this first stage - make of that what you will, please just help. What I've done at this stage is cell-centered differences for the spatial derivatives and upwind for the convection term. I've placed the physical boundaries at dx/2 or dy/2 (depending on horizontal/vertical) from the nearest grid point at which the solution is calculated (as is usually done). The time stepping is implicit. The reason I say the interior discretisation is correct is that I've checked it countless times against Patankar/Veerstag's books on FV method and can find no mistakes. Also if I set the velocity to zero, the solution is correct. What bothers me is the bcs. Being new to this I need the discretization spelled out, which isn't the case in the books I have managed to find - the authors give guidelines on inflow, outflow, wall, but spell out only very simple examples such as Dirichlet in 1d. Let's start with the impermeable boundary on the left hand side. As far as I'm aware (with no convective flow in the x direction) the condition is simply dc/dn = - dc/dx = 0. So at a point ( i , 1 ) = ( ith row , 1st column ) along the left boundary the discretization yields: ( c(i, 1) - c(i, 1)_old ) /d t + v dx ( c(i, j) - c(i-1, j) ) [upwind;v>0] - dy ( D (dc/dx)(i, j+1/2) - D( dc/dx)(i, j-1/2) ) - dx ( D (dc/dy)(i+1/2, j) - D (dc/dy)(i-1/2, j) ) = 0 where j+1/2, j-1/2, etc, denote the values at the control volume faces and "_old" denotes value at current time. Now what I would do (have done) is set dc/dx(i, j-1/2) = 0, since (i, j-1/2) coincides with the boundary. The other derivatives are calculated using central differences, which yields the final equation for a point along the left boundary. Any help would be appreciated. |

Re: Boundary conditions
What is your initial condition? c(x,y,t_o) = c_o perhaps?
You might consider completely dropping the dc/dx (and the 2nd order d/dx) terms from your code for a bit. That makes the problem undeniably c(y,t). This is (I think) a Bergers equation - which has analytic solutions for some combinations of initial/boundary conditions. Intuitively I'd like to say that you're posing a 1d problem in space and the x variation should not enter. What is your implicit technique? Are the BC values imposed implicity? That is, are the bc's updated implicitly or after the interior values of c are updated? Especially for 'large' values of the time step (see remarks below), it's really important that the bc's be included implicitly. Another thing to consider is your initial time step size. Even though an implicit method is supposed to be unconditionally stable, in practice starting these problems can be a real headache if the dt is too large. The solutions tend to flip-flop from time step to time step. That is, successive time steps overshoot and then overcorrect the analytic solution. You might consider - as a test - trying much smaller time steps to see how the transient c(y,t) develops. In summary, I'm suggesting that you've applied the boundary conditions correctly - but be sure to apply them implicitly. The inclusion of the d( )/dx is unnecessary for your test problem. Get the y,t variation to work first. And experiment with the dt you use. I hope this is of some use. It surely gives you a few things to try! Finally! Some combinations of vL/D (where L is some characteric distance) may give mathematical difficulties with the underlying differential equation you're solving. You'll find more about that when you start reading about Bergers equation I think. |

Re: Boundary conditions
otd,
thanks for the suggestions. The initial condition is consistent with the inlet value, i.e. c=co. The bc's are implemented implicitly. I've made a bit of "progress". The value of vL/D is very large in my problem - it's highly convection dominated. What I'm finding is a sensitive dependence on dt. For decreasing dt the solutions approach the correct solution. Perhaps naively, that surprises me, considering that the method of solution is entirely implicit. The dt value to get a reasonably accurate solution is too small at the moment. I'll try a higher order method in time to see if it helps. Thanks Nick |

All times are GMT -4. The time now is 22:57. |