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

compiled errors while using DimensionedField<Type, GeoMesh>

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By Chaoran

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 3, 2020, 02:46
Exclamation compiled errors while using DimensionedField<Type, GeoMesh>
  #1
New Member
 
Chaoran Guan
Join Date: Aug 2019
Posts: 5
Rep Power: 6
Chaoran is on a distinguished road
I encountered a compiled error while using Dimensioned<tensor, volMesh>. Here is what I wrote in the createFields.H of the icoFoam:
Code:
volTensorField Ut = fvc::grad(U);
DimensionedField<tensor, volMesh> Ud = Ut.internalField();
Info << Ud << endl;
Info << Ud.T() << endl;
And the compiled error was:
Code:
error: no matching function for call to ‘T(const Foam::Field<Foam::Tensor<double> >&, const Foam::Field<Foam::Tensor<double> >&)’ Foam::T(result(), *this);
Then I found the Foam::T() functions in the FieldFunctions.H is declared as
Code:
template<class Type> void T(Field<Type>& res, const UList<Type>& f);
However, the member function T() of the class dimensionedField<Type, GeoMesh> is defined as
Code:
 template<class Type, class GeoMesh> tmp<DimensionedField<Type, GeoMesh>> DimensionedField<Type, GeoMesh>::T() const 
{ 
    tmp<DimensionedField<Type, GeoMesh>> result 
    ( 
        DimensionedField<Type, GeoMesh>::New 
        (
            name() + ".T()",
            mesh_, 
            dimensions_ 
        )
    );
    Foam::T(result(), *this);
    return result; 
}
where the operator() of the tmp<T> return a const reference of T rather than a non-const reference which is required by Foam::T() global function.
So, I modify the above code:
Code:
 Foam::T(result(), *this);
into:
Code:
Foam::T(result.ref(), *this);
After this modification, the compilation can be done successfully.
And I was using openFOAM 8 version. Is this a bug that has not been noticed in OpenFOAM yet?
Chaoran is offline   Reply With Quote

Old   October 4, 2020, 13:29
Default
  #2
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,905
Rep Power: 33
hjasak will become famous soon enough
This is a bug - missed in script changes. Can you report it please in the bug tracker?

Hrv
__________________
Hrvoje Jasak
Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk
hjasak is offline   Reply With Quote

Old   October 4, 2020, 21:33
Smile
  #3
New Member
 
Chaoran Guan
Join Date: Aug 2019
Posts: 5
Rep Power: 6
Chaoran is on a distinguished road
Quote:
Originally Posted by hjasak View Post
This is a bug - missed in script changes. Can you report it please in the bug tracker?

Hrv
I've reported the issue. https://bugs.openfoam.org/view.php?id=3564
Tobi likes this.
Chaoran is offline   Reply With Quote

Old   October 14, 2020, 10:48
Default
  #4
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,685
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
Quote:
Originally Posted by Chaoran View Post

https://develop.openfoam.com/Develop.../-/issues/1868
olesen is offline   Reply With Quote

Reply

Tags
bugs, dimensionedfield, fieldfunctons


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
[solidMechanics] Support thread for "Solid Mechanics Solvers added to OpenFOAM Extend" bigphil OpenFOAM CC Toolkits for Fluid-Structure Interaction 686 December 22, 2022 09:10
Building OpenFOAM1.7.0 from source ata OpenFOAM Installation 46 March 6, 2022 13:21
LES, Courant Number, Crash, Sudden Alhasan OpenFOAM Running, Solving & CFD 5 November 22, 2019 02:05
decompose dependent solution arionfard OpenFOAM 3 December 10, 2018 09:36
AMI interDyMFoam for mixer nu problem danny123 OpenFOAM Programming & Development 8 September 6, 2013 02:34


All times are GMT -4. The time now is 15:33.