
[Sponsors] 
December 3, 2013, 04:11 
Inner product of tensor and vector

#1 
New Member
Johannes
Join Date: Mar 2011
Location: Austria
Posts: 11
Rep Power: 7 
Hello!
I try to implement an equation of scalar fluxes (an equation of type fvVectorMatrix) in OpenFOAM1.6 where terms of an inner product of a tensor and a vector have to be calculated such as is a vector (volVectorField), so the first term is the inner product of a vector and a tensor is the Reynolds stress tensor and Z is a scalar (volScalarField), so the second term is the inner product of a symmetric tensor and a vector At the moment I wrote this in OpenFOAM as Code:
rho*Cs* uz & fvc::grad(U) + rho*turbulence>R() & fvc::grad(Z) Code:
ZEqns.H:36: error: no match for ‘operator==’ in ‘Foam::operator(const Foam::tmp<Foam::fvMatrix<Type> >&, const Foam::tmp<Foam::fvMatrix<Type> >&) [with Type = Foam::Vector<double>](((const Foam::tmp<Foam::fvMatrix<Foam::Vector<double> > >&)((const Foam::tmp<Foam::fvMatrix<Foam::Vector<double> > >*)(& Foam::fvm::laplacian(const Foam::tmp<Foam::GeometricField<GType, Foam::fvPatchField, Foam::volMesh> >&, Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&) [with Type = Foam::Vector<double>, GType = Foam::SymmTensor<double>](((Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>&)(& uz))))))) == Foam::operator*(const Foam::tmp<Foam::GeometricField<double, PatchField, GeoMesh> >&, const Foam::tmp<Foam::GeometricField<Type, PatchField, GeoMesh> >&) [with Type = Foam::SymmTensor<double>, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh](((const Foam::tmp<Foam::GeometricField<Foam::SymmTensor<double>, Foam::fvPatchField, Foam::volMesh> >&)((const Foam::tmp<Foam::GeometricField<Foam::SymmTensor<double>, Foam::fvPatchField, Foam::volMesh> >*)(& Foam::compressible::turbulenceModel::R()))))’ /opt/OpenFOAM/OpenFOAM1.6/src/thermophysicalModels/specie/lnInclude/perfectGasI.H:148: note: candidates are: Foam::perfectGas Foam::operator==(const Foam::perfectGas&, const Foam::perfectGas&) /opt/OpenFOAM/OpenFOAM1.6/src/thermophysicalModels/specie/lnInclude/specieI.H:190: note: Foam::specie Foam::operator==(const Foam::specie&, const Foam::specie&) /opt/OpenFOAM/OpenFOAM1.6/src/OpenFOAM/lnInclude/triFaceI.H:304: note: bool Foam::operator==(const Foam::triFace&, const Foam::triFace&) /opt/OpenFOAM/OpenFOAM1.6/src/OpenFOAM/lnInclude/objectMapI.H:95: note: bool Foam::operator==(const Foam::objectMap&, const Foam::objectMap&) /opt/OpenFOAM/OpenFOAM1.6/src/OpenFOAM/lnInclude/objectHit.H:110: note: bool Foam::operator==(const Foam::objectHit&, const Foam::objectHit&) /opt/OpenFOAM/OpenFOAM1.6/src/OpenFOAM/lnInclude/cellShape.H:158: note: bool Foam::operator==(const Foam::cellShape&, const Foam::cellShape&) /opt/OpenFOAM/OpenFOAM1.6/src/OpenFOAM/lnInclude/cellModelI.H:124: note: bool Foam::operator==(const Foam::cellModel&, const Foam::cellModel&) /opt/OpenFOAM/OpenFOAM1.6/src/OpenFOAM/lnInclude/cell.H:134: note: bool Foam::operator==(const Foam::cell&, const Foam::cell&) /opt/OpenFOAM/OpenFOAM1.6/src/OpenFOAM/lnInclude/faceI.H:138: note: bool Foam::operator==(const Foam::face&, const Foam::face&) /opt/OpenFOAM/OpenFOAM1.6/src/OpenFOAM/lnInclude/edgeI.H:171: note: bool Foam::operator==(const Foam::edge&, const Foam::edge&) /opt/OpenFOAM/OpenFOAM1.6/src/OpenFOAM/lnInclude/instant.H:140: note: bool Foam::operator==(const Foam::instant&, const Foam::instant&) Thanks in advance for any comment! Greetings, Johannes 

December 3, 2013, 08:02 

#2 
Senior Member
Bernhard
Join Date: Sep 2009
Location: Delft
Posts: 790
Rep Power: 13 
The error message you give does not relate to the posted code, because there is no "==" in there.


December 3, 2013, 08:11 

#3 
New Member
Johannes
Join Date: Mar 2011
Location: Austria
Posts: 11
Rep Power: 7 
Hello Bernhard!
Thank you for your reply. My fault, since I didn't post the whole equation, only two terms of it. Anyway, I guess I found a solution with which I'll come back a bit later to get an opinion from others. Greetings and let's "read" again in a while.... 

December 3, 2013, 14:03 
possible solution

#4 
New Member
Johannes
Join Date: Mar 2011
Location: Austria
Posts: 11
Rep Power: 7 
As I sad before, I'll come back with a solution which I would like to share with you.
I finally implemented this equation = where is the vector (volVectorField) which has to be solved in OpenFOAM1.6 as Code:
volVectorField R_Z = turbulence>R() & fvc::grad(Z); volVectorField uz_gU = uz & fvc::grad(U); fvVectorMatrix uzEqn ( fvm::ddt(rho, uz) + fvm::div(phi, uz)  fvm::laplacian(rho*C_s*turbulence>k()/turbulence>epsilon()*turbulence>R(), uz) == rho*(C_2  1)*uz_gU  rho*R_Z  rho*C_1*turbulence>epsilon()/turbulence>k()*uz ); Any comments? Is there a better way or more "stable form" to implement the equation? Thank you and kind regards, Johannes Last edited by jfw_cfd; December 4, 2013 at 12:59. 

July 7, 2014, 10:04 

#5 
New Member
Xiangyu Gao
Join Date: Sep 2013
Location: West Lafayette, IN, USA
Posts: 29
Rep Power: 4 
Hi, Johannes
Have you got the solution to this problem? I am also facing the inner product of a tensor and a vector. Can you post the solution to this problem? Best regards, Xiangyu 

July 7, 2014, 10:33 
proposed solution should work

#6 
New Member
Johannes
Join Date: Mar 2011
Location: Austria
Posts: 11
Rep Power: 7 
Hello Xiangyu!
Well, the solution of how to calculate the inner product of a tensor and a vector which I stated in my previous post should actually work (I guess you can see the code snippet). At least it worked for me (compiled and calculated). The instabilities I mentioned above, did not arise from this part of the code as far as I remember (all this happened quite some months ago...). Unfortunately, I don't have any further news about this topic. So I hope the above code works for you, which should be the case if just the inner product is the problem. Kind regards, Johannes 

July 7, 2014, 10:36 

#7 
New Member
Xiangyu Gao
Join Date: Sep 2013
Location: West Lafayette, IN, USA
Posts: 29
Rep Power: 4 
Hi, Johannes!
Thank you very much for your reply! I just tried. Your solution works for my case perfectly! Thank you again for your help! Best regards, Xiangyu 

July 7, 2014, 10:41 

#8 
New Member
Johannes
Join Date: Mar 2011
Location: Austria
Posts: 11
Rep Power: 7 
Perfect! That's good to hear, Xiangyu!


Thread Tools  
Display Modes  

