- **OpenFOAM Running, Solving & CFD**
(*http://www.cfd-online.com/Forums/openfoam-solving/*)

- - **Questions for the bdivb function in OpenFOAM**
(*http://www.cfd-online.com/Forums/openfoam-solving/60217-questions-bdivb-function-openfoam.html*)

Hi, all
I have a question fHi, all
I have a question for 'div' function in OpenFOAM. I am solving advection-diffusion equation and the advection term has a velocity that is a vector. I can't use 'div' in OpenFOAM for solving 'div(U,C) here U is the velocity(vector) and C is concentration(scalar) in 2D. There is also another velocity applying to advection term, 'div(V,C), here V is a constant velocity and C is same as above. I can't use 'div' for this either. I tried 'V * div(C)' but it didn't work. Hence, what I did was: volVectorField gradC = fvc::grad(C); volScalarField gradCx = gradC.component(0); volScalarField gradCy = gradC.component(1); volVectorField gradUx = fvc::grad(U.component(0)); volScalarField gradUxx = gradUx.component(0); volVectorField gradUy = fvc::grad(U.component(1)); volScalarField gradUyy = gradUy.component(1); solve ( gradUxx*C+U.component(0)*gradCx + gradUyy*C+U.component(1)*gradCy + V*(gradCx+gradCy) ) By the way, U is given volVectorField from other case and I used the one of identities in page 21 of Programmer's Guide to solve 'div'. It worked fine but for the mathematic sense it is a bit strange. Are there any other ways to do this? Thanks. |

I guess you could try,
fvVectI guess you could try,
fvVectorMatrix CEqn ( fvm::ddt(C) + fvm::div(phi, C) - fvm::laplacian(Coef, C) ); for the concentration scalar, where "phi" is the flux through the cell faces, calculated from velocity field obtained either solving for U or from a fixed velocity field (look at icofoam for example for the former) and "Coef" a diffusion coeffecient of your choice. i.e. I guess fvm::div(flux, vector) or fvm::div(flux, scalar) is the right notation. Pierre |

Oops mistake sorry it is
fvScOops mistake sorry it is
fvScalarMatrix CEqn ( fvm::ddt(C) + fvm::div(phi, C) - fvm::laplacian(Coef, C) ); sorry Pierre |

Dear Pierre
Thanks for yourDear Pierre
Thanks for your advices. I tried flux instead of velocity and it worked fine. The result was much smoother and nicer. In the previous one there were some truncation errors (I guess) but there are not now. I am doing further development at the moment and I will put some questions here if anything arise. Thanks. Guiyeom. |

All times are GMT -4. The time now is 20:09. |