On Jan 1, 2008 12:29 PM, Burak Atakan <[EMAIL PROTECTED]> wrote: > > I would be interested. My procedure would be a merely linear geometric > approach, > taking the concentration or temperature value in the cell next to the > boundary > subtracting the value at the boundary and dividing by the distance between the > center of the cell and the boundary. Perhaps you have an easier - or more > elegant- way for doing this?
You are still imposing a boundary condition independent of the boundary condition objects that were given to solve the equation. Without that information you don't know what the exterior cell gradients should be. The right answer is that variables should know the boundary conditions not the equations. > I think FiPy (at least what I saw from it, so far)is already very valuable, > but > in heat transfer or mass transfer problems (as you will certainly know), often > fixed values are used as boundary conditions at some boundaries. That works fine in fipy just pass the boundary conditions to the equation. The variable that you get back has the correct values at the integration points (i.e. the cell centers). If you do a subsequent getGrad on that variable, then that calculation is not using the boundary conditions that you passed to the equation. > In such cases > the (heat or mass)fluxes at the boundaries are the variables looked for, which > are then generally calculated using Fourier's or Fick's law, which in turn > means > to calculate the gradient times a diffusion coefficient. Due to this, I had > expected that this issue would have been raised earlier. I would geatly > appreciate if this problem could be solved in a more general way.Would a > procedure giving the fluxes at the boundaries also be implemented then? The work around is this. Say you have an equation like this eqn = TransientTerm() == DiffusionTerm(D1) + (D2* var.getFaceGrad()).getDivergence() In this situation the variable var knows nothing about boundary conditions. The work around is to do the following, eqn = TransientTerm() == DiffusionTerm(D1) + (D2 * var.getFaceGrad()).getDivergence() + boundary_flux.getDivergence() where boundary_flux = D2_face * (varBC - var.getArithmeticFaceValue()) * mesh.getFaceNormals() / mesh._getCellDistances() D2_face should be 0 on all interior faces. varBC is a FaceVariable with the correct fixed value on the exterior faces. You can always add a source of this form and make up and boundary condition you want. > In total let me thank you for your prompt and very helpful answers and whish > you > a happy new year! You too. Cheers -- Daniel Wheeler
