CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   A little help with compressibleInterFoam on OpenFoam2012 (https://www.cfd-online.com/Forums/openfoam-solving/233674-little-help-compressibleinterfoam-openfoam2012.html)

Shibi February 6, 2021 17:34

A little help with compressibleInterFoam on OpenFoam2012
 
Hello to all,

I just compiled OpenFOAM v2012 in debug mode.

I am trying to use compressibleInterFoam in a simple rectangle with (20 x 3 x 50)mm to simulate the filling of the plate with water and air.

However, I am getting an error saying:


Code:

--> FOAM FATAL ERROR: (openfoam-2012)
Tensor is not invertible due to the zero determinant:det(Tensor) = 8e-20

    From Foam::Tensor<Cmpt> Foam::inv(const Foam::Tensor<Cmpt>&, Cmpt) [with Cmpt = double]
    in file /home/pc/OpenFOAM/OpenFOAM-v2012/src/OpenFOAM/lnInclude/TensorI.H at line 738.

FOAM aborting

#0  Foam::error::printStack(Foam::Ostream&) at ~/OpenFOAM/OpenFOAM-v2012/src/OSspecific/POSIX/printStack/printStack.C:237
#1  Foam::error::exitOrAbort(int, bool) at ~/OpenFOAM/OpenFOAM-v2012/src/OpenFOAM/lnInclude/error.C:262
#2  Foam::error::abort() at ~/OpenFOAM/OpenFOAM-v2012/src/OpenFOAM/lnInclude/error.C:298
#3  Foam::Ostream& Foam::operator<< <Foam::error>(Foam::Ostream&, Foam::errorManip<Foam::error>) in ~/OpenFOAM/OpenFOAM-v2012/platforms/linux64GccDPInt32Debug/bin/compressibleInterFoam
#4  Foam::Tensor<double> Foam::inv<double>(Foam::Tensor<double> const&, double) at ~/OpenFOAM/OpenFOAM-v2012/src/OpenFOAM/lnInclude/TensorI.H:738
#5  Foam::Tensor<double> Foam::inv<double>(Foam::Tensor<double> const&) at ~/OpenFOAM/OpenFOAM-v2012/src/OpenFOAM/lnInclude/TensorI.H:754
#6  Foam::inv(Foam::Field<Foam::Tensor<double> >&, Foam::UList<Foam::Tensor<double> > const&) at ~/OpenFOAM/OpenFOAM-v2012/src/OpenFOAM/fields/Fields/tensorField/tensorField.C:106 (discriminator 3)
#7  void Foam::inv<Foam::fvPatchField, Foam::volMesh>(Foam::GeometricField<Foam::Tensor<double>, Foam::fvPatchField, Foam::volMesh>&, Foam::GeometricField<Foam::Tensor<double>, Foam::fvPatchField, Foam::volMesh> const&) in ~/OpenFOAM/OpenFOAM-v2012/platforms/linux64GccDPInt32Debug/bin/compressibleInterFoam
#8  Foam::tmp<Foam::GeometricField<Foam::Tensor<double>, Foam::fvPatchField, Foam::volMesh> > Foam::inv<Foam::fvPatchField, Foam::volMesh>(Foam::tmp<Foam::GeometricField<Foam::Tensor<double>, Foam::fvPatchField, Foam::volMesh> > const&) in ~/OpenFOAM/OpenFOAM-v2012/platforms/linux64GccDPInt32Debug/bin/compressibleInterFoam
#9  Foam::tmp<Foam::GeometricField<Foam::outerProduct<Foam::Vector<double>, double>::type, Foam::fvPatchField, Foam::volMesh> > Foam::fvc::reconstruct<double>(Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&) in ~/OpenFOAM/OpenFOAM-v2012/platforms/linux64GccDPInt32Debug/bin/compressibleInterFoam
#10  ? in ~/OpenFOAM/OpenFOAM-v2012/platforms/linux64GccDPInt32Debug/bin/compressibleInterFoam
#11  ? in ~/OpenFOAM/OpenFOAM-v2012/platforms/linux64GccDPInt32Debug/bin/compressibleInterFoam
#12  __libc_start_main in /lib/x86_64-linux-gnu/libc.so.6
 #13  ? in ~/OpenFOAM/OpenFOAM-v2012/platforms/linux64GccDPInt32Debug/bin/compressibleInterFoam


 Aborted (core dumped)

However, If I run the same setup with OpenFoam 7, the case will run without any problem...

Anyone had a similar problem?

Thanks in advance

HPE February 7, 2021 15:20

Hi,

The difference is that v2012 has an extra guard (which doesn't exist in OF7) to prevent zero division errors in TensorI.H during tensor-inverse computations (`inv` function):

Code:

    #ifdef FULLDEBUG
    if (mag(dett) < SMALL)
    {
        FatalErrorInFunction
            << "Tensor is not invertible due to the zero determinant:"
            << "det(Tensor) = " << mag(dett)
            << abort(FatalError);
    }
    #endif


    return cof(t).T()/dett;

- You can remove this bit and recompile the code
- You can compile the code in Opt mode
- We can relax the constraint from `SMALL` to `VSMALL`

Shibi February 8, 2021 12:19

Changed `SMALL` to `VSMALL`and got the problem solved!


Thanks!

Venky_94 October 7, 2021 02:05

Quote:

Originally Posted by HPE (Post 795534)
Hi,

The difference is that v2012 has an extra guard (which doesn't exist in OF7) to prevent zero division errors in TensorI.H during tensor-inverse computations (`inv` function):

Code:

    #ifdef FULLDEBUG
    if (mag(dett) < SMALL)
    {
        FatalErrorInFunction
            << "Tensor is not invertible due to the zero determinant:"
            << "det(Tensor) = " << mag(dett)
            << abort(FatalError);
    }
    #endif


    return cof(t).T()/dett;

- You can remove this bit and recompile the code
- You can compile the code in Opt mode
- We can relax the constraint from `SMALL` to `VSMALL`

Hi,

I'm facing the same issue while running in debug mode. My solver is running without issues in regular mode but throws the same error as mentioned here while running in debug mode. I followed your suggestion and tried removing the line of code, tried relaxing the constraint from `SMALL` to `VSMALL, and even copied the corresponding segment of code from OF7's TensorI.H file and replaced that in my v2012's TensorI.H file and recompiled the code. But everytime, OpenFOAM throws the same error at me in debug mode.

I go to the file location and check, the error line mentioned below is not even present in the header file. Please suggest what could be the issue.

Code:

--> FOAM FATAL ERROR: (openfoam-2012)
Tensor is not invertible due to the zero determinant:det(Tensor) = 6.5205e-29

    From Foam::Tensor<Cmpt> Foam::inv(const Foam::Tensor<Cmpt>&, Cmpt) [with Cmpt = double]
    in file /opt/OpenFOAM/OpenFOAM-v2012/src/OpenFOAM/lnInclude/TensorI.H at line 738.



All times are GMT -4. The time now is 19:38.