CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (http://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Error dividing surfaceScalarFields using fvc::interpolate(volScalarField) (http://www.cfd-online.com/Forums/openfoam-programming-development/80484-error-dividing-surfacescalarfields-using-fvc-interpolate-volscalarfield.html)

Canesin September 27, 2010 18:14

Error dividing surfaceScalarFields using fvc::interpolate(volScalarField)
 
Hi all, I'm writing an modification of chtMultiRegionFoam and have been facing errors in calculation of diffusion-number as it follows:

Code:

Adding magnetic field

Region: fluidflow Courant Number mean: 0.14898649 max: 0.3
#0  Foam::error::printStack(Foam::Ostream&) at ~/OpenFOAM/OpenFOAM-1.7.x/src/OSspecific/POSIX/printStack.C:202
#1  Foam::sigFpe::sigFpeHandler(int) at ~/OpenFOAM/OpenFOAM-1.7.x/src/OSspecific/POSIX/signals/sigFpe.C:127
#2  in "/lib/libc.so.6"
#3  Foam::divide(Foam::Field<double>&, Foam::UList<double> const&, Foam::UList<double> const&) at ~/OpenFOAM/OpenFOAM-1.7.x/src/OpenFOAM/fields/Fields/scalarField/scalarField.C:95
#4  void Foam::divide<Foam::fvsPatchField>(Foam::FieldField<Foam::fvsPatchField, double>&, Foam::FieldField<Foam::fvsPatchField, double> const&, Foam::FieldField<Foam::fvsPatchField, double> const&) at ~/OpenFOAM/OpenFOAM-1.7.x/src/OpenFOAM/lnInclude/scalarFieldField.C:89
#5  void Foam::divide<Foam::fvsPatchField, Foam::surfaceMesh>(Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh>&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&) at ~/OpenFOAM/OpenFOAM-1.7.x/src/OpenFOAM/lnInclude/GeometricScalarField.C:114
#6  Foam::tmp<Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> > Foam::operator/<Foam::fvsPatchField, Foam::surfaceMesh>(Foam::tmp<Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> > const&, Foam::tmp<Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> > const&) at ~/OpenFOAM/OpenFOAM-1.7.x/src/OpenFOAM/lnInclude/GeometricScalarField.C:114
#7 
 at ~/OpenFOAM/canesin-1.7.x/solvers/amrIcoPolo/solid/solidRegionDiffNo.C:47
#8 
 at ~/OpenFOAM/canesin-1.7.x/solvers/amrIcoPolo/solid/solidRegionDiffusionNo.H:16
#9  __libc_start_main in "/lib/libc.so.6"
#10 
 in "/home/canesin/OpenFOAM/canesin-1.7.x/applications/bin/linux64GccDPDebug/amrIcoPolo"

The source code looks like for solidRegionDiffNo.C:
Code:

#include "solidRegionDiffNo.H"
#include "fvc.H"

Foam::scalar Foam::solidRegionDiffNo
(
    const fvMesh& mesh,
    const Time& runTime,
    const volScalarField& cp,
    const volScalarField& rho,
    const volScalarField& K
)
{
    scalar DiNum = 0.0;
    scalar meanDiNum = 0.0;

    //- Can have fluid domains with 0 cells so do not test.
    if (mesh.nInternalFaces())
    {
        surfaceScalarField KrhoCpbyDelta =
            mesh.surfaceInterpolation::deltaCoeffs()
          * fvc::interpolate(K)
          / (fvc::interpolate(cp) * fvc::interpolate(rho));

        DiNum = max(KrhoCpbyDelta.internalField())*runTime.deltaT().value();

        meanDiNum = (average(KrhoCpbyDelta)).value()*runTime.deltaT().value();
    }

    Info<< "Region: " << mesh.name() << " Diffusion Number mean: " << meanDiNum
        << " max: " << DiNum << endl;

    return DiNum;
}

What is wrong here ?? I'm really missing it.

Canesin September 27, 2010 19:05

Hi all, sorry for the lame post!!!!

I have setup an unphysical boundary condition by mistake, had cp 0 them gat the floint point error...

Sorry !


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