CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Running, Solving & CFD (
-   -   Including user defined eqations (

tsencic June 28, 2007 09:03

I am trying to include a new e
I am trying to include a new equation in dieselEngineFoam.

I included:

fvScalarMatrix sootEqn
fvm::ddt(rho, soot)
+ fvm::div(phi, soot)

In createFields.H I defined the field by:

volScalarField soot
dimensionedScalar("zero", dimensionSet(1,-3,-1,0,0,0,0), 0.0)

It compiles, but at the beginning of the run I recive the error:

--> FOAM FATAL ERROR : valueInternalCoeffs cannot be called for a calculatedFvPatchField.
You are probably trying to solve for a field with a calculated boundary conditions.

From function
calculatedFvPatchField<type>::valueInternalCoeffs( const tmp<scalarfield>&) const
in file fields/fvPatchFields/basicFvPatchFields/calculated/calculatedFvPatchField.C at line 136.

FOAM exiting

What does it mean? How can I solve it?


gschaider June 28, 2007 10:18

What it means is: "I created a
What it means is: "I created a field with no defined boundary conditions. This is OK. But you want me to solve an equation without BCs. This is not OK"

Get rid of the last parameter for your soot field. Instead create a soot file in your 0 directory with intial-BC(==0), dimensions AND boundary conditions

tsencic June 29, 2007 07:40

Thanks, it helped. But, whe
Thanks, it helped.

But, when I set the soot dimensions in the 0 directory to:
dimensions [0 0 0 0 0 0 0];

I obtain:

--> FOAM FATAL ERROR : incompatible dimensions for operation
[soot[1 -3 -1 0 0 0 0] ] == [scal[0 0 0 0 0 0 0] ]

Where else could be defined the soot dimensions, where does come from the [soot[1 -3 -1 0 0 0 0] ] dimension?

gschaider June 29, 2007 08:41

soot is the dimension of the r
soot[1 -3 -1 0 0 0 0] is the dimension of the right hand side (density per second) - the ddt ad div seem to be consistent. What seems to be wrong is the dimension of the right hand side. You've got to add a dimensioned scalar that has the right dimension (but think about the physical meaning of that)

gschaider July 2, 2007 11:17

I meant to say "left side" in
I meant to say "left side" in my last post. rho has dimension [1 -3 0 0 0 0 0] ddt adds [0 0 -1 0 0 0 0] with your undimensioned soot the resulting dimension is [1 -3 -1 0 0 0 0]

How many iterations does the linear solver need to get to "internalField uniform 0;"? What are the boundary conditions for soot? Try without a source term, but with an inhomogenous initial distribution
of soot.

tsencic July 3, 2007 07:07

OK, I got the dimensions. I
OK, I got the dimensions.

I do not know the number of iterations because in the log file "soot" is never mentioned, there is no something like:

BICCG: Solving for soot, Initial residual = 1, Final residual = 1.53774e-08, No Iterations 5

Could this be the key of the problem?

I tried the other things you suggested, but without result.
The boundary conditions are:
type zeroGradient;
type zeroGradient;
type zeroGradient;
type cyclic;
value uniform 0;

hjasak July 3, 2007 07:10

ON, so you've got a field with
ON, so you've got a field with zero gradient or cyclic b.c.-s all the way around and I suspect a uniform internal field. Do you have any sources or sinks in the equation or does the current solution satisfy the equations already?

If it does, OpenFOAM won't bother solving for it.


All times are GMT -4. The time now is 23:57.