CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Running, Solving & CFD (
-   -   how to implement this kind of equation (

keishawillstone August 4, 2009 10:19

how to implement this kind of equation
hi there!
I'm modeling a combustion problem(2D problem) and I have trouble
implementing this equation:
(vs rhoapp Cps)d/dx(Ts)-laplacian(lambda,Ts) = S;
where d/dx stands for derivative with respect to x
vs stands for the velocity of the household refuse entering the
incinerator (dimensionedVector)
rhoapp is a volScalarfield (density)
Cps is the heat capacity
S is a source term
Here is what I tried:
-fvm::laplacian(lambdaeff,Ts)+fvm::div(rhoappvsCp, Ts) ==S
coupled with the gas mixture temperature (in order to take into account the convective transfer included in the source term of both equations) which is:

solve(fvm::div(phi,T) == SS);

rhoappvsCp is surfaceScalarField
it starts well but it crashes after.
I thought it was due to the boundary condition in the
beginning(conservative flux)
but when I turned it into a transient problem which gave:
-fvm::laplacian(lambdaeff,Ts)+fvm::ddt(rhoappvsCp, Ts)

== S

fvm::ddt(rhoCpporo, T)+fvm::div(phi,T) == SS
it's ok,it ran well and gave an accurate solution!
Then I ended up thinking that the problem was due to the
implementation of this term
""(vs rhoapp Cps)d/dx(Ts)""
So I tried to do something else like this:
-fvm::laplacian(lambdaeff,Ts)+rhoappvsCp*(myvector &
fvc::grad(Ts)) == S

Because I thought that it was a gradient term but the y component
should be eliminated then I created a vector
myvector (1 0 0),and with the inner product the y component is
it still crashed!!!!
in the source code I also have to implement the density equation which
d/dx(vs rhoapp) = S
and I went on with the elimination of the y-component:
mag(vs)*(myvector & fvc::grad(rhoapp)) == Srhoapp
but it sends an error message!!!before,I took it as divergence term
fvm::div(svs,rhoapp) = Srhoapp
svs is a surfaceScalarField and it runs well but I don't think that it is a
divergence term!!!
So my question is how to implement this kind of equation
"(vs rhoapp Cps)d/dx(Ts)" and this "d/dx(vs rhoapp)" DIVERGENCE OR GRADIENT WITH Y-COMPONENT ELIMINATED??
Please can somebody help me out?
Best Regards

henrik August 11, 2009 02:09

Dear Mihamina,

when you drop the ddt-term from the standard transport equation, the resulting linear system becomes unsuitable for the linear solvers that are commonly used in CFD. Therefor you MUST underrelax the equation. Did you and did it have an effect, that is change the number of iterations?

You don't need special treatment for 2D cases on the top level. My bet is that you can safely throw that in the bin.


keishawillstone August 11, 2009 06:01

Hi Henrik,
I will follow your advice by underrelaxing it because I didn't think about it!!
Thanks a lot

All times are GMT -4. The time now is 14:34.