CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Bugs (
-   -   laplacian(tensor,tensor) seg faults (

kmooney November 17, 2011 16:34

laplacian(tensor,tensor) seg faults
Hello All,

In a recent attempt to implement a tensor based viscosity field I ran into a problem with taking a Laplacian involving two volTensorFields. To perform some more simplified testing I altered laplacianFoam with the following:


        for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
                fvm::ddt(tau) - fvm::laplacian(dTau, tau)

where dTau and tau are both volTensorFields. I get a segfault within the HashTable lib. Below is the stack trace I get from my development code which is a little more comprehensive than the one that laplacianFoam gives me but crashes at the same point.


#0  0x00007ffff76e8850 in Foam::HashTable<Foam::tmp<Foam::fv::laplacianScheme<Foam::Vector<double>, Foam::Tensor<double> > > (*)(Foam::fvMesh const&, Foam::Istream&), Foam::word, Foam::string::hash>::find (this=0x0, key=...) at /home/kmooney/OpenFOAM/OpenFOAM-1.6-ext/src/OpenFOAM/lnInclude/HashTable.C:177
#1  0x00007ffff76de993 in Foam::fv::laplacianScheme<Foam::Vector<double>, Foam::Tensor<double> >::New (mesh=..., schemeData=...)
    at /home/kmooney/OpenFOAM/OpenFOAM-1.6-ext/src/finiteVolume/lnInclude/laplacianScheme.C:73
#2  0x00007ffff76d646b in Foam::fvm::laplacian<Foam::Vector<double>, Foam::Tensor<double> > (gamma=..., vf=..., name=...)
    at /home/kmooney/OpenFOAM/OpenFOAM-1.6-ext/src/finiteVolume/lnInclude/fvmLaplacian.C:220
#3  0x00007ffff76cf35d in Foam::fvm::laplacian<Foam::Vector<double>, Foam::Tensor<double> > (tgamma=..., vf=..., name=...)
    at /home/kmooney/OpenFOAM/OpenFOAM-1.6-ext/src/finiteVolume/lnInclude/fvmLaplacian.C:233
#4  0x00007ffff76c99be in Foam::LPTT::divTau (this=0x4c9c430, U=...) at viscoelasticLaws/LPTT/LPTT.C:146
#5  0x00007ffff7790ad6 in Foam::multiMode::divTau(Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>&) const ()
  from /home/kmooney/OpenFOAM/OpenFOAM-1.6-ext/lib/linux64GccDPOpt/
#6  0x00007ffff76c6e89 in Foam::viscoelasticModel::divTau(Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>&) const ()
  from /home/kmooney/OpenFOAM/OpenFOAM-1.6-ext/lib/linux64GccDPOpt/
#7  0x000000000041bbf1 in main ()

I'm a tad confused because the code compiles just fine and the Programmer's Guide says that those fields are accepted by FOAM in both implicit and explicit laplacian schemes. Also note that this error occurs even if all of the tensor fields are zeros. Does anyone have any idea as to why this is happening? Thanks a lot for any insight you guys might have for me.

Bernhard November 18, 2011 03:05

Maybe this bugreport can help you out, which is very similar:
Maybe for the solution you have to look in the same direction.

alberto November 18, 2011 13:33

FYI: bugs should be reported on the bug tracker, so that developers can see them.




kmooney November 18, 2011 13:36


Thanks a lot Bernhard and Alberto.

I didn't post it to the bug tracker outright because I figured I was doing something wrong.

It appears that Henry W. fixed it in 2.0.x but the fix hasn't been propagated to the extend branch. I'll post a bug report on it now. I fixed it locally in 1.6-ext in the same manner that Henry did with no issues.

jfw_cfd November 26, 2013 07:51

laplacian(tensor, tensor)
Hello all! Just to let everybody know (although the thread is quite old already and this problem does not arise in newer versions of OF):
The solution of henry posted here
worked for me too

Wanted to use the LRR-RSTM with the originally commented diffusion term in OF-1.6 (src/turbulenceModels/compressible/RAS/LRR/LRR.C)

- fvm::laplacian(Ceps_*rho_*(k_/epsilon_)*R_, epsilon_)
which compiles but gives a runtime error

add the line

makeFvLaplacianTypeScheme(SS, symmTensor, symmTensor)    \
to laplacianScheme.H in

recompile the finiteVolume library and that's it!

The only strange thing which I could not resolve until now is, that it works fine in serial with Gauss linearUpwind scheme for divSchemes but not in parallel. In parallel I had to change the divSchemes to Gauss Gamma

kmooney November 26, 2013 10:54

Thanks for the extra info on the div schemes! The fact that some schemes aren't functioning in parallel for this is suspicious.


wyldckat November 26, 2013 18:31

Greetings to all!

@Johannes: Can you provide a simple test case?
And which OpenFOAM version/variant are you using?

Best regards,

jfw_cfd November 27, 2013 04:13

Hi! Hello Bruno!

I use OpenFOAM-1.6.

Well, with respect to a simple test case, actually I did not try this on a simple case. My case is a stationary flame (so not that simple). I think one can reproduce this problem with any simple case using the LRR model, but with the diffusion term that originally is commented in OF-1.6

- fvm::laplacian(Ceps_*rho_*(k_/epsilon_)*R_, epsilon_)
instead of the "default" diffusion term

- fvm::laplacian(DepsilonEff(), epsilon_)
Concerning the mentioned problems with the diffSchemes, without having detailed knowledge in this topic, maybe it has something to do with

tmp<surfaceInterpolationScheme<GType> > tinterpGammaScheme_;
 tmp<snGradScheme<Type> > tsnGradScheme_;

in laplacianScheme.H.

It seems that I just used the wrong schemes. But as I sad, in this topic I'm not an expert.

All times are GMT -4. The time now is 20:08.