CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

Why can't I multiply these two tensors?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 19, 2020, 12:41
Default Why can't I multiply these two tensors?
  #1
New Member
 
Join Date: Sep 2019
Posts: 17
Rep Power: 7
courant_numero_uno is on a distinguished road
I am simply trying to multiply the strain rate tensor by the rotation rate tensor:



Code:
volSymmTensorField S //Mean strain rate
(
    IOobject
    (
        "S",
        runTime.timeName(),
        mesh,
        IOobject::NO_READ,
        IOobject::AUTO_WRITE
),
    mesh,
    dimensionedSymmTensor("S",dimensionSet(0,0,-1,0,0,0,0),symmTensor::zero)
); 

volTensorField R //Mean rotation rate
(
    IOobject
    (
        "R",
        runTime.timeName(),
        mesh,
        IOobject::NO_READ,
        IOobject::AUTO_WRITE
),
    mesh,
    dimensionedTensor("R",dimensionSet(0,0,-1,0,0,0,0),tensor::zero)
); 



volTensorField T
(
    IOobject
    (
        "T",
        runTime.timeName(),
        mesh,
        IOobject::NO_READ,
        IOobject::AUTO_WRITE
),
    mesh,
    dimensionedTensor("T",dimensionSet(0,0,-2,0,0,0,0),tensor::zero)
); 



...


        S = symm(fvc::grad(U));
        R = skew(fvc::grad(U));
        T = S * R;
The compiler throws the following:
Code:
n file included from /usr/lib/openfoam/openfoam2006/src/OpenFOAM/lnInclude/doubleFloat.H:33,
                 from /usr/lib/openfoam/openfoam2006/src/OpenFOAM/lnInclude/floatScalar.H:42,
                 from /usr/lib/openfoam/openfoam2006/src/OpenFOAM/lnInclude/scalar.H:42,
                 from /usr/lib/openfoam/openfoam2006/src/OpenFOAM/lnInclude/zeroI.H:30,
                 from /usr/lib/openfoam/openfoam2006/src/OpenFOAM/lnInclude/zero.H:157,
                 from /usr/lib/openfoam/openfoam2006/src/OpenFOAM/lnInclude/UList.H:51,
                 from /usr/lib/openfoam/openfoam2006/src/OpenFOAM/lnInclude/List.H:46,
                 from /usr/lib/openfoam/openfoam2006/src/OpenFOAM/lnInclude/labelList.H:45,
                 from /usr/lib/openfoam/openfoam2006/src/OpenFOAM/lnInclude/UPstream.H:45,
                 from /usr/lib/openfoam/openfoam2006/src/OpenFOAM/lnInclude/Pstream.H:45,
                 from /usr/lib/openfoam/openfoam2006/src/OpenFOAM/lnInclude/parRun.H:39,
                 from /usr/lib/openfoam/openfoam2006/src/finiteVolume/lnInclude/fvCFD.H:4,
                 from tbnnFoam.C:66:
/usr/lib/openfoam/openfoam2006/src/OpenFOAM/lnInclude/products.H: In instantiation of ‘class Foam::outerProduct<Foam::SymmTensor<double>, Foam::Tensor<double> >’:
/usr/lib/openfoam/openfoam2006/src/OpenFOAM/lnInclude/GeometricFieldFunctions.C:952:1:   required by substitution of ‘template<class Type1, class Type2, template<class> class PatchField, class GeoMesh> Foam::tmp<Foam::GeometricField<typename Foam::outerProduct<Type1, Type2>::type, PatchField, GeoMesh> > Foam::operator*(const Foam::GeometricField<TypeR, PatchField, GeoMesh>&, const Foam::GeometricField<Type1, PatchField, GeoMesh>&) [with Type1 = Foam::SymmTensor<double>; Type2 = Foam::Tensor<double>; PatchField = Foam::fvPatchField; GeoMesh = Foam::volMesh]’
tbnnFoam.C:129:11:   required from here
/usr/lib/openfoam/openfoam2006/src/OpenFOAM/lnInclude/products.H:114:13: error: no type named ‘type’ in ‘class Foam::typeOfRank<double, 4>’
  114 |     >::type type;
      |             ^~~~
tbnnFoam.C: In function ‘int main(int, char**)’:
tbnnFoam.C:129:9: error: no match for ‘operator*’ (operand types are ‘Foam::volSymmTensorField’ {aka ‘Foam::GeometricField<Foam::SymmTensor<double>, Foam::fvPatchField, Foam::volMesh>’} and ‘Foam::volTensorField’ {aka ‘Foam::GeometricField<Foam::Tensor<double>, Foam::fvPatchField, Foam::volMesh>’})
  129 |   T = S * R;
      |       ~ ^ ~
      |       |   |
      |       |   GeometricField<Foam::Tensor<double>,[...],[...]>
      |       GeometricField<Foam::SymmTensor<double>,[...],[...]>
In file included from /usr/lib/openfoam/openfoam2006/src/OpenFOAM/lnInclude/zero.H:157,
                 from /usr/lib/openfoam/openfoam2006/src/OpenFOAM/lnInclude/UList.H:51,
                 from /usr/lib/openfoam/openfoam2006/src/OpenFOAM/lnInclude/List.H:46,
                 from /usr/lib/openfoam/openfoam2006/src/OpenFOAM/lnInclude/labelList.H:45,
                 from /usr/lib/openfoam/openfoam2006/src/OpenFOAM/lnInclude/UPstream.H:45,
                 from /usr/lib/openfoam/openfoam2006/src/OpenFOAM/lnInclude/Pstream.H:45,
                 from /usr/lib/openfoam/openfoam2006/src/OpenFOAM/lnInclude/parRun.H:39,
                 from /usr/lib/openfoam/openfoam2006/src/finiteVolume/lnInclude/fvCFD.H:4,
                 from tbnnFoam.C:66:
Is there a different way to do matrix multiplication? I know the tensors are two different types (one is symmetric and one is a normal tensor), but this error still occurs when the two tensor are identical types.
courant_numero_uno is offline   Reply With Quote

Old   November 19, 2020, 15:02
Default
  #2
HPE
Senior Member
 
HPE's Avatar
 
Herpes Free Engineer
Join Date: Sep 2019
Location: The Home Under The Ground with the Lost Boys
Posts: 931
Rep Power: 13
HPE is on a distinguished road
Hi,

Could you please open a ticket in https://develop.openfoam.com/Development/openfoam ?

As a workaround, could you please try to set the type of `S` as `volTensorField`?
HPE is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Netgen] Import netgen mesh to OpenFOAM hsieh OpenFOAM Meshing & Mesh Conversion 32 September 13, 2011 06:50
Pressure instability with rhoSimpleFoam daniel_mills OpenFOAM Running, Solving & CFD 44 February 17, 2011 18:08
CheckMeshbs errors ivanyao OpenFOAM Running, Solving & CFD 2 March 11, 2009 03:34
CheckMeshbs errors ivanyao OpenFOAM Running, Solving & CFD 0 March 10, 2009 23:07
Courant no%23 and sharp corner in 3D jam OpenFOAM Running, Solving & CFD 6 November 18, 2008 09:21


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