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 Members List Search Today's Posts Mark Forums Read

Like Tree1Likes
  • 1 Post By Chaoran

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 3, 2020, 03:46
Exclamation compiled errors while using DimensionedField<Type, GeoMesh>
  #1
New Member
 
Chaoran Guan
Join Date: Aug 2019
Posts: 5
Rep Power: 3
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, 14:29
Default
  #2
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,863
Rep Power: 29
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, 22:33
Smile
  #3
New Member
 
Chaoran Guan
Join Date: Aug 2019
Posts: 5
Rep Power: 3
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, 11:48
Default
  #4
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: http://olesenm.github.io/
Posts: 1,001
Rep Power: 27
olesen will become famous soon enougholesen will become famous soon enough
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

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 567 October 22, 2020 14:28
LES, Courant Number, Crash, Sudden Alhasan OpenFOAM Running, Solving & CFD 5 November 22, 2019 03:05
decompose dependent solution arionfard OpenFOAM 3 December 10, 2018 10:36
AMI interDyMFoam for mixer nu problem danny123 OpenFOAM Programming & Development 8 September 6, 2013 03:34
Building OpenFOAM1.7.0 from source ata OpenFOAM Installation 42 May 14, 2012 21:48


All times are GMT -4. The time now is 06:41.