|
[Sponsors] |
May 11, 2006, 14:50 |
Hi, all
I have a question f
|
#1 |
New Member
Guiyeom Kang
Join Date: Mar 2009
Posts: 2
Rep Power: 0 |
Hi, 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. |
|
May 11, 2006, 16:31 |
I guess you could try,
fvVect
|
#2 |
Member
Pierre Le Fur
Join Date: Mar 2009
Location: UK
Posts: 60
Rep Power: 17 |
I 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 |
|
May 11, 2006, 16:33 |
Oops mistake sorry it is
fvSc
|
#3 |
Member
Pierre Le Fur
Join Date: Mar 2009
Location: UK
Posts: 60
Rep Power: 17 |
Oops mistake sorry it is
fvScalarMatrix CEqn ( fvm::ddt(C) + fvm::div(phi, C) - fvm::laplacian(Coef, C) ); sorry Pierre |
|
May 13, 2006, 12:11 |
Dear Pierre
Thanks for your
|
#4 |
New Member
Guiyeom Kang
Join Date: Mar 2009
Posts: 2
Rep Power: 0 |
Dear 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. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Questions about OpenFOAM | misch | OpenFOAM | 2 | August 29, 2008 06:18 |
[Commercial meshers] Bug in Harpoon OpenFoam export function | philippose | OpenFOAM Meshing & Mesh Conversion | 1 | June 28, 2007 08:36 |
Stream Function - Potential Function coordinates | harish | Main CFD Forum | 8 | June 25, 2005 14:18 |
Questions about wall function | sarah_ron | FLUENT | 9 | October 26, 2004 05:44 |
questions about keps model and wall function | sarah_ron | FLUENT | 3 | October 15, 2004 08:50 |