- **OpenFOAM Programming & Development**
(*http://www.cfd-online.com/Forums/openfoam-programming-development/*)

- - **BCs and correctBoundaryConditions() for an electric field and current solver**
(*http://www.cfd-online.com/Forums/openfoam-programming-development/128778-bcs-correctboundaryconditions-electric-field-current-solver.html*)

BCs and correctBoundaryConditions() for an electric field and current solverHello,
I'm working on a solver for calculating electric field and current in an inhomogenous conductivity field. I'm currently evaluating the validity of the solution and I'm wondering which boundary conditions make most sense, and which fields need to use field.correctBoundaryConditions(). To my understanding correctBoundaryConditions() adjusts the values of the boundary so they match their gradient conditions after the values of the cells were (explicitly) modified. Here's a simplified excerpt of the solver code: Code:
`forAll(sigma, iter)` Electric field and current both use zeroGradient BC, although I would prefer to use a BC that has zeroGradient in normal direction and fixedValue 0 in tangential direction. Is there such a BC? For testing, I've used zeroGradient for the conductivity and I'm having some numerical problems. Below you can see the output of the calculated current using different methods, with j being the current density: Quote:
I also expect that the difference between the electrodes should be (close to) zero, meaning that the current is conserved. However, there is a significant error. I am using a simple wedge mesh generated with blockMesh. The electrodes have different angles towards each other, one at the top, one at the bottom, and one at the side of the cylindrical mesh, separated by isolating material with zero conductivity BC. Right now the cells are completely orthogonal. I believe this could be caused by the somewhat unfitting zeroGradient BC for electric field and current, but I don't know if there is such a condition as described above. I would be very grateful if someone could give me some hints. It is important to me to get current conservation (atleast to a certain accuracy). By the way, can anyone explain to me the meaning of phiSolve.nIterations() and phiSolve.converged() ? I suspect this is related to the way the solution matrix is approximated, but if it is, why does the loop in the solver above has to run multiple times until the solution converges? I would expect the solver to iterate until conversion is reached. Is there some artificial limit that stops it before convergence? |

All times are GMT -4. The time now is 00:19. |