# calculating the viscous stress tensor tau for viscous dissipation heating

 Register Blogs Members List Search Today's Posts Mark Forums Read

 April 20, 2010, 13:58 calculating the viscous stress tensor tau for viscous dissipation heating #1 New Member   Dan Gadensgaard Join Date: Apr 2010 Posts: 13 Rep Power: 16 Hi all.. I have made a interTempFoam solver, based on the interFoam solver, in which i have included the temperature equation. However, as i am simulating a very viscous flow (Metal Injection Moulding - POM with metal powder) i would like to add the heat of dissapation to the temperature equation. To do this i need the stress tensor tau, and i have tried to implement it as shown in the code below: TEqn.H file: Code: ``` surfaceScalarField mu ( "mu", twoPhaseProperties.mu() ); volTensorField gradU = fvc::grad(U); volTensorField tau = mu * (gradU + gradU.T()); //Temperature equation (with viscous dissipation): fvScalarMatrix TEqn ( rho * cp * (fvm::ddt(T) + fvm::div(phi,T)) - fvm::laplacian(kT,T)+ tau && gradU ); TEqn.solve();``` The equation is added to the solver just before the PISO-loop. When i try to compile the solver it gives me a lot of errors, shown below: Code: ```In file included from interTempFoam.C:90: TEqn.H: In function ‘int main(int, char**)’: TEqn.H:10: fejl: no matching function for call to ‘Foam::GeometricField::GeometricField(const char [3], Foam::tmp >)’ /home/dang/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/GeometricField.C:607: bemærk: candidates are: Foam::GeometricField::GeometricField(const Foam::IOobject&, const Foam::GeometricField&, const Foam::wordList&) [with Type = double, PatchField = Foam::fvsPatchField, GeoMesh = Foam::surfaceMesh] /home/dang/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/GeometricField.C:572: bemærk: Foam::GeometricField::GeometricField(const Foam::IOobject&, const Foam::GeometricField&, const Foam::word&) [with Type = double, PatchField = Foam::fvsPatchField, GeoMesh = Foam::surfaceMesh] /home/dang/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/GeometricField.C:541: bemærk: Foam::GeometricField::GeometricField(const Foam::word&, const Foam::tmp >&) [with Type = double, PatchField = Foam::fvsPatchField, GeoMesh = Foam::surfaceMesh] /home/dang/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/GeometricField.C:508: bemærk: Foam::GeometricField::GeometricField(const Foam::word&, const Foam::GeometricField&) [with Type = double, PatchField = Foam::fvsPatchField, GeoMesh = Foam::surfaceMesh] /home/dang/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/GeometricField.C:476: bemærk: Foam::GeometricField::GeometricField(const Foam::IOobject&, const Foam::GeometricField&) [with Type = double, PatchField = Foam::fvsPatchField, GeoMesh = Foam::surfaceMesh] /home/dang/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/GeometricField.C:444: bemærk: Foam::GeometricField::GeometricField(const Foam::tmp >&) [with Type = double, PatchField = Foam::fvsPatchField, GeoMesh = Foam::surfaceMesh] /home/dang/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/GeometricField.C:412: bemærk: Foam::GeometricField::GeometricField(const Foam::GeometricField&) [with Type = double, PatchField = Foam::fvsPatchField, GeoMesh = Foam::surfaceMesh] /home/dang/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/GeometricField.C:374: bemærk: Foam::GeometricField::GeometricField(const Foam::IOobject&, const typename GeoMesh::Mesh&, Foam::Istream&) [with Type = double, PatchField = Foam::fvsPatchField, GeoMesh = Foam::surfaceMesh] /home/dang/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/GeometricField.C:333: bemærk: Foam::GeometricField::GeometricField(const Foam::IOobject&, const typename GeoMesh::Mesh&) [with Type = double, PatchField = Foam::fvsPatchField, GeoMesh = Foam::surfaceMesh] /home/dang/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/GeometricField.C:309: bemærk: Foam::GeometricField::GeometricField(const Foam::IOobject&, const typename GeoMesh::Mesh&, const Foam::dimensionSet&, const Foam::Field&, const Foam::PtrList >&) [with Type = double, PatchField = Foam::fvsPatchField, GeoMesh = Foam::surfaceMesh] /home/dang/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/GeometricField.C:279: bemærk: Foam::GeometricField::GeometricField(const Foam::IOobject&, const typename GeoMesh::Mesh&, const Foam::dimensioned&, const Foam::wordList&) [with Type = double, PatchField = Foam::fvsPatchField, GeoMesh = Foam::surfaceMesh] /home/dang/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/GeometricField.C:250: bemærk: Foam::GeometricField::GeometricField(const Foam::IOobject&, const typename GeoMesh::Mesh&, const Foam::dimensioned&, const Foam::word&) [with Type = double, PatchField = Foam::fvsPatchField, GeoMesh = Foam::surfaceMesh] /home/dang/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/GeometricField.C:223: bemærk: Foam::GeometricField::GeometricField(const Foam::IOobject&, const typename GeoMesh::Mesh&, const Foam::dimensionSet&, const Foam::wordList&) [with Type = double, PatchField = Foam::fvsPatchField, GeoMesh = Foam::surfaceMesh] /home/dang/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/GeometricField.C:193: bemærk: Foam::GeometricField::GeometricField(const Foam::IOobject&, const typename GeoMesh::Mesh&, const Foam::dimensionSet&, const Foam::word&) [with Type = double, PatchField = Foam::fvsPatchField, GeoMesh = Foam::surfaceMesh] TEqn.H:14: fejl: no match for ‘operator*’ in ‘mu * Foam::operator+(const Foam::GeometricField&, const Foam::tmp >&) [with Type1 = Foam::Tensor, Type2 = Foam::Tensor, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh](((const Foam::tmp, Foam::fvPatchField, Foam::volMesh> >&)((const Foam::tmp, Foam::fvPatchField, Foam::volMesh> >*)(& Foam::GeometricField::T() const [with Type = Foam::Tensor, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh]()))))’ /home/dang/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/dimensionSet.H:266: bemærk: candidates are: Foam::dimensionSet Foam::operator*(const Foam::dimensionSet&, const Foam::dimensionSet&) /home/dang/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/dimensionedScalar.H:56: bemærk: Foam::dimensionedScalar Foam::operator*(const Foam::dimensionedScalar&, Foam::scalar) /home/dang/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/scalarField.H:81: bemærk: Foam::tmp > Foam::operator*(const Foam::UList&, const Foam::UList&) /home/dang/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/scalarField.H:81: bemærk: Foam::tmp > Foam::operator*(const Foam::UList&, const Foam::tmp >&) /home/dang/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/scalarField.H:81: bemærk: Foam::tmp > Foam::operator*(const Foam::tmp >&, const Foam::UList&) /home/dang/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/scalarField.H:81: bemærk: Foam::tmp > Foam::operator*(const Foam::tmp >&, const Foam::tmp >&) /home/dang/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/symmTensorField.H:71: bemærk: Foam::tmp > > Foam::operator*(const Foam::UList >&) /home/dang/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/symmTensorField.H:71: bemærk: Foam::tmp > > Foam::operator*(const Foam::tmp > >&) /home/dang/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/tensorField.H:76: bemærk: Foam::tmp > > Foam::operator*(const Foam::UList >&) /home/dang/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/tensorField.H:76: bemærk: Foam::tmp > > Foam::operator*(const Foam::tmp > >&) /home/dang/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/tensorField.H:77: bemærk: Foam::tmp > > Foam::operator*(const Foam::UList >&) /home/dang/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/tensorField.H:77: bemærk: Foam::tmp > > Foam::operator*(const Foam::tmp > >&) /home/dang/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/dimensionedSymmTensor.H:69: bemærk: Foam::dimensionedVector Foam::operator*(const Foam::dimensionedSymmTensor&) /home/dang/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/dimensionedTensor.H:75: bemærk: Foam::dimensionedVector Foam::operator*(const Foam::dimensionedTensor&) /home/dang/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/dimensionedTensor.H:78: bemærk: Foam::dimensionedTensor Foam::operator*(const Foam::dimensionedVector&) /home/dang/OpenFOAM/OpenFOAM-1.6/src/finiteVolume/lnInclude/readPISOControls.H:11: advarsel: unused variable ‘transonic’ /home/dang/OpenFOAM/OpenFOAM-1.6/src/finiteVolume/lnInclude/readPISOControls.H:14: advarsel: unused variable ‘nOuterCorr’ TEqn.H:14: advarsel: unused variable ‘tau’ /home/dang/OpenFOAM/OpenFOAM-1.6/src/finiteVolume/lnInclude/readPISOControls.H:3: advarsel: unused variable ‘nCorr’ /home/dang/OpenFOAM/OpenFOAM-1.6/src/finiteVolume/lnInclude/readPISOControls.H:8: advarsel: unused variable ‘momentumPredictor’ /home/dang/OpenFOAM/OpenFOAM-1.6/src/finiteVolume/lnInclude/readPISOControls.H:11: advarsel: unused variable ‘transonic’ /home/dang/OpenFOAM/OpenFOAM-1.6/src/finiteVolume/lnInclude/readPISOControls.H:14: advarsel: unused variable ‘nOuterCorr’ make: *** [Make/linux64GccDPOpt/interTempFoam.o] Fejl 1``` Hope someone can tell me, og give me a hint as to what i am doing wrong?! // Dan

 April 20, 2010, 14:56 Found one error. #2 New Member   Dan Gadensgaard Join Date: Apr 2010 Posts: 13 Rep Power: 16 Well, i have now found one of the bugs, but i still get an error as soon as i try to perform: tau && gradU what have i missed? // Dan atulkjoy likes this.

 April 20, 2010, 17:32 #3 New Member   Join Date: Apr 2010 Posts: 10 Rep Power: 16 Hi dgadensg, try: rho * cp * (fvm::ddt(T) + fvm::div(phi,T)) - fvm::laplacian(kT,T)+ ( tau && gradU ) ( parentheses around double inner product , C operator precedence ) Bandfrosch atulkjoy and überschwupper like this.

 April 21, 2010, 03:16 #4 New Member   Dan Gadensgaard Join Date: Apr 2010 Posts: 13 Rep Power: 16 Hi Bandfrosch Well, that was a quick fix ;-), it works! Thank you! \\Dan atulkjoy likes this.

 January 11, 2023, 05:20 #5 Member   Join Date: Mar 2015 Posts: 36 Rep Power: 11 I actually try a similar thing, but I am not sure about the correct term to add. Here you just used (tau && gradU). Where did you got this term from? In the documentation of energy equation (https://doc.cfd.direct/openfoam/energy-equation/), I found the term div(tau * U). Using the definition from wikipedia (https://de.wikipedia.org/wiki/Formel...Cr_Divergenzen) that would give div(tau * U) = div(tau^T) * U + tau^T : gradU tau is symmetric, so the transpose does not matter, but there would be a another contribution. Is that term zero for any reason, that I do not see, or did i got a wrong idea from the documentation of energy equation? Thanks for any reply, K.C.

 January 17, 2023, 15:20 #6 New Member   Join Date: Apr 2010 Posts: 10 Rep Power: 16 Hi K.C. sorry for not being able to give you any advise, the problem of dgadensg ( the one who started the thread ) was a purely C++ syntactical one. May be I find some time to think about it once more, please do not expect any reasonable answer soon. Contacting dgadensg seems to be a better solution. Bandfrosch

 Tags dissipation, interfoam, temperature