CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Running, Solving & CFD (
-   -   Problem with source term in the calculation domain (

galaad November 28, 2005 10:43

Hello everybody I want to p
Hello everybody

I want to put a source term in the calculation domain of a variable V at x=0,25mm and for variation of 3mm on the y axis. I have written the equation resolution of this scalar as this:

tmp<fvscalarmatrix> VEqn
fvm::laplacian(sigma, V)

const vectorField& centres = ;
forAll(centres, cellI)
if ((centres[cellI].x() == 0.250e-03) && (centres[cellI].y() <= 3.000e-03))
solve(VEqn() == 1.200e08*exp(-2.080e03*centres[cellI].y())/0.250e-03);


But I have two questions:

1) is the geometric position of a cell is represented by (mesh.C()[cellI].x(), mesh.C()[cellI].y(), mesh.C()[cellI].z())?

2) I have an error concerning the exponential expression during compiling. This error is:

VEqn.H:14: error: call of overloaded 'exp(const double&)' is ambiguous
/usr/include/bits/mathcalls.h:101: note: candidates are: double exp(double)
/home/fvm/OpenFOAM/OpenFOAM-1.2/src/OpenFOAM/lnInclude/dimensionedScalar.H:70: note: Foam::dimensionedScalar Foam::exp(const Foam::dimensionedScalar&)

I thought the problem was with centres[cellI].y() declaration... but when I only use exp(-2.080e03) the error also occurs. So I think I have not well written the exponential expression in my program... I think it's a stupid question but it seems like I've forgotten something!!!

Thank you for your comments or your help.


All times are GMT -4. The time now is 17:45.