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

error: no match for ‘operator/’ (operand types are ‘Foam::SphericalTensor<double>’

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 20, 2021, 02:15
Default error: no match for ‘operator/’ (operand types are ‘Foam::SphericalTensor<double>’
  #1
New Member
 
Alberto Campuzano
Join Date: Mar 2021
Posts: 14
Rep Power: 5
baezacaljo is on a distinguished road
Good afternoon dear all


i am quite new using openFoam and i am facing the next error when i tried to compile my code


error: no match for ‘operator/’ (operand types are ‘Foam::SphericalTensor<double>’ and ‘Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> >’)


i am following some tutorials and info about plasticSolver in openfoam. However, they only apply for the previous version of openfoam.


(BTW let me tell you that i took the solidDisplacementFoam solver as a base case and i started doing my modifications)



when i am trying to compile my file called calculateStress.H the previous mentioned error appears.


i am guessing that such error appears when i am trying to make a multiplication by a variable. see the code next.


Code:
        forAll(fac, celli)
        {
            if (fac[celli] > 1.0)    //Plasticity occurs
            {
                sigma[celli] = 1.0/3.0*I*tr(sigma[celli]) + dev(sigma[celli])/fac[celli];
                symmTensor dsigma = sigma[celli] - sigma_old[celli];
                tensor deps_e = (1.0/3.0*I*tr(dsigma))/(3.0*lambda+2.0*mu)
                              + dev(dsigma)/(2.0*mu);
                tensor deps = 1.0/2.0*(graddD[celli] + graddD[celli].T());
                deps_p[celli] = deps - deps_e;
            }
            else    // only elasticity
            {
                deps_p[celli] = tensor::zero;
            }
        }


the error relies exactly on the next line



Code:
                tensor deps_e = (1.0/3.0*I*tr(dsigma))/(3.0*lambda+2.0*mu)
                              + dev(dsigma)/(2.0*mu);

when i remove the variable volScalarField mu and volScalarField lambda the code compiles.


any suggestions?


what can i do?


Thanks in advance
Alberto
baezacaljo is offline   Reply With Quote

Old   April 27, 2021, 11:50
Default
  #2
New Member
 
Yang Zhe
Join Date: Apr 2021
Posts: 3
Rep Power: 5
Yang Zhe is on a distinguished road
I am also implementing the same code in openFOAM4.0 now.

but I encountered the following error:

calculateStress.H:43:49: error: no match for ‘operator=’ (operand types are ‘Foam::SymmTensor<double>’ and ‘const Foam::Tensor<double>’)
deps_p[celli] = tensor::zero;

Is there anybody could solve this problem?
Yang Zhe is offline   Reply With Quote

Old   April 27, 2021, 13:26
Default
  #3
New Member
 
Alberto Campuzano
Join Date: Mar 2021
Posts: 14
Rep Power: 5
baezacaljo is on a distinguished road
Quote:
Originally Posted by Yang Zhe View Post
I am also implementing the same code in openFOAM4.0 now.

but I encountered the following error:

calculateStress.H:43:49: error: no match for ‘operator=’ (operand types are ‘Foam::SymmTensor<double>’ and ‘const Foam::Tensor<double>’)
deps_p[celli] = tensor::zero;

Is there anybody could solve this problem?
Hi Yang Zhe. Look. Did you already tried to comment out the line

Code:
deps_p[celli] = tensor::zero;
if it compiles, change tensor::zero for another value and you will se what's the real problem.

I haven't solve mine, but it seems to me that your code compiles the lines on which I am struggling.

We have to keep doing trial and error.

Best regards
Alberto Campuzano
baezacaljo is offline   Reply With Quote

Old   April 27, 2021, 23:12
Default
  #4
New Member
 
Yang Zhe
Join Date: Apr 2021
Posts: 3
Rep Power: 5
Yang Zhe is on a distinguished road
Thanks a lot !
It passed by your suggestion.
like this:
deps_p[celli] = I;


As for your problem, I am also facing with it now and I cannot solve it.


I think there are some missing rules controlling the calculation between tensors and scalars in openFOAM 4.0 (at least for 4.0 ). And I have referred to this book before:



http://foam.sourceforge.net/docs/Gui...mmersGuide.pdf


But it did not work. What a pity !


I would be very appreciated if you can recommend some reference books to me !
Yang Zhe is offline   Reply With Quote

Old   May 3, 2021, 20:55
Default
  #5
New Member
 
Alberto Campuzano
Join Date: Mar 2021
Posts: 14
Rep Power: 5
baezacaljo is on a distinguished road
Quote:
Originally Posted by Yang Zhe View Post
Thanks a lot !
It passed by your suggestion.
like this:
deps_p[celli] = I;


As for your problem, I am also facing with it now and I cannot solve it.


I think there are some missing rules controlling the calculation between tensors and scalars in openFOAM 4.0 (at least for 4.0 ). And I have referred to this book before:



http://foam.sourceforge.net/docs/Gui...mmersGuide.pdf


But it did not work. What a pity !


I would be very appreciated if you can recommend some reference books to me !

Hi Yang Zhe


I ve been searching for answers. However, nothing comes out.


Take a look, at the next link (Awesome slides from Philip Cardiff)



https://www.researchgate.net/profile...am-toolbox.pdf


Check the slide 109. Look, there are solving the system which we are looking for.


I think that applying the code from old OF versions (lets say you make your own code about solids taking as a references codes from old OF versions) and compiling it in new OF versions is a bad idea, usually compatibility problems are within the path.


what i did is this, compile from source foam extended 4.0 in Ubuntu 20.04 after i compiled solids4Foam, in there already exist the solver that we are looking for.


Notice, that now we have the advantage to take a look of the original code, copy it and try to compile it in OF8, and now we will see if our problem comes with compatibility or was a silly mistake in the code.


Best Regards
Alberto
baezacaljo is offline   Reply With Quote

Reply

Tags
openfoam 8, programming


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
Errno = 1 in OpenFOAM rfiore1 OpenFOAM Bugs 2 November 1, 2022 18:35
createPatch Segmentation Fault (CORE DUMPED) sam.ho OpenFOAM Pre-Processing 2 April 21, 2014 03:01
Match Control and Symmetry Boundary Condtions in a quasi 2D calculation peterputer ANSYS Meshing & Geometry 0 May 15, 2012 09:53
gmsh2ToFoam sarajags_89 OpenFOAM 0 November 24, 2009 23:50
[Commercial meshers] Trimmed cell and embedded refinement mesh conversion issues michele OpenFOAM Meshing & Mesh Conversion 2 July 15, 2005 05:15


All times are GMT -4. The time now is 02:52.