CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM (
-   -   Problem with skew and .T() (

sven August 14, 2009 12:06

Problem with skew and .T()
Hey FOAMers,

I try to implement a new turbulence model in OpenFOAM. For doing this I slightly want to change the reynolds-stress equation of the LaunderGibsonRSTM-turbulence model. More exactly, I want add a new term to the currently existing terms of the equation. This term is:


C*k*((R_/(2*k)-1.0/3.0*I)&skew(fvc::grad(U_)) + skew(fvc::grad(U_))&(R_/(2*k)-1.0/3.0*I))
If I add this term and compile the file, I get the following error message:


YounisWeigandVogler.C: In member function ‘virtual void Foam::incompressible::RASModels::YounisWeigandVogler::correct()’:
YounisWeigandVogler.C:544: error: no match for ‘operator==’ in ‘Foam::operator+(const Foam::tmp<Foam::fvMatrix<Type> >&, const Foam::tmp<Foam::fvMatrix<Type> >&) [with Type = Foam::SymmTensor<double>](((const Foam::tmp<Foam::fvMatrix<Foam::SymmTensor<double> > >&)((const Foam::tmp<Foam::fvMatrix<Foam::SymmTensor<double> > >*)(& Foam::fvm::Sp(const Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> >&, Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&) [with Type = Foam::SymmTensor<double>](((Foam::GeometricField<Foam::SymmTensor<double>, Foam::fvPatchField, Foam::volMesh>&)(&((Foam::incompressible::RASModels::YounisWeigandVogler*)this)->Foam::incompressible::RASModels::YounisWeigandVogler::R_))))))) == Foam::operator+(const Foam::tmp<Foam::GeometricField<TypeR, PatchField, GeoMesh> >&, const Foam::tmp<Foam::GeometricField<Type1, PatchField, GeoMesh> >&) [with Type1 = Foam::SymmTensor<double>, Type2 = Foam::Tensor<double>, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh](((const Foam::tmp<Foam::GeometricField<Foam::Tensor<double>, Foam::fvPatchField, Foam::volMesh> >&)((const Foam::tmp<Foam::GeometricField<Foam::Tensor<double>, Foam::fvPatchField, Foam::volMesh> >*)(& Foam::skew(const Foam::tmp<Foam::GeometricField<Foam::Tensor<double>, PatchField, GeoMesh> >&) [with PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh]()))))’
/home/sven/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/cellShape.H:158: note: candidates are: bool Foam::operator==(const Foam::cellShape&, const Foam::cellShape&)
/home/sven/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/cellModelI.H:124: note:                bool Foam::operator==(const Foam::cellModel&, const Foam::cellModel&)
/home/sven/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/cell.H:134: note:                bool Foam::operator==(const Foam::cell&, const Foam::cell&)
/home/sven/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/faceI.H:138: note:                bool Foam::operator==(const Foam::face&, const Foam::face&)
/home/sven/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/objectHit.H:110: note:                bool Foam::operator==(const Foam::objectHit&, const Foam::objectHit&)
/home/sven/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/edgeI.H:171: note:                bool Foam::operator==(const Foam::edge&, const Foam::edge&)
/home/sven/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/instant.H:140: note:                bool Foam::operator==(const Foam::instant&, const Foam::instant&)

I thought it is perhaps a problem with the "skew function", so I tried not to use this function, but implementing it by using the definition of this function, that means:


"skew(fvc::grad(U_))" = 0.5*(fvc::grad(U_)-fvc::grad(U_).T())
Unfortunately this creates the following error message:


YounisWeigandVogler.C: In member function ‘virtual void Foam::incompressible::RASModels::YounisWeigandVogler::correct()’:
YounisWeigandVogler.C:544: error: ‘class Foam::tmp<Foam::GeometricField<Foam::Tensor<double>, Foam::fvPatchField, Foam::volMesh> >’ has no member named ‘T’

Has anyone encountered similar problems or does anyone know how to solve these problems? Thanks a lot

henrik August 15, 2009 08:33

Dear Sven,

the precedence of the "&"-operator in C++ is differs from what is should be according to it equivalent in mathematics. I think the guide is mentioning that somewhere.

That means that you should put brackets around each term in involving "&" (a & b).

Please try and see whether the error message changes ...


sven August 17, 2009 11:40

Thanks for your answer henrik. I tried to put brackets around the expressions with &, but it didn't help. I still get the error message:

no match for 'operator=='
I think it is a perhaps a problem, because the last term I add to the equation


is asymmetric, but the whole equation is defined for symmetric matrices


tmp<fvSymmTensorMatrix> REqn
      + fvm::div(phi_, R_)
      //- fvm::laplacian(Cs_*(k_/epsilon_)*R_, R_)
      - fvm::laplacian(DREff(), R_)
      + fvm::Sp(K1_*epsilon_/(2*k_)+K1Star_*G/(2*k_),R_)

Thus I tried to change fvSymmTensorMatrix to fvTensorMatrix, but that didnt help either!

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