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

cannot convert DataEntry to scalar

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 20, 2016, 14:10
Default cannot convert DataEntry to scalar
  #1
Senior Member
 
Mahdi Hosseinali
Join Date: Apr 2009
Location: NB, Canada
Posts: 273
Rep Power: 17
anishtain4 is on a distinguished road
Hi,

I'm trying to modify a boundary condition, so I've started off with oscillatingFixedValue. I wanted this new boundary condition to be only for velocity so I've changed/removed all the template<class Type>. Now when I try to compile, it complains:
Quote:
error: cannot convert ‘const Foam::autoPtr<Foam:ataEntry<double> >’ to ‘Foam::scalar {aka double}’ in return
error: invalid initialization of reference of type ‘Foam::scalar& {aka double&}’ from expression of type ‘Foam::autoPtr<Foam:ataEntry<double> >’
If I remove DataEntry part first error goes away but the second one sticks. Since I haven't touched this part I don't understand what is going wrong? Also I prefer to keep the DataEntry in my code.
anishtain4 is offline   Reply With Quote

Old   July 21, 2016, 03:11
Default
  #2
Senior Member
 
Hassan Kassem
Join Date: May 2010
Location: Germany
Posts: 242
Rep Power: 17
hk318i is on a distinguished road
Because it is a template class and you basically need a special instance (vector), you have to replace Type by vector.
__________________
@HIKassem | HassanKassem.me
hk318i is offline   Reply With Quote

Old   July 21, 2016, 08:08
Default
  #3
Senior Member
 
Joachim Herb
Join Date: Sep 2010
Posts: 650
Rep Power: 21
jherb is on a distinguished road
Have a look at the fixedNormalInletOutletVelocityFvPatchVectorField class. This might be a good starting point (if you want to specify the same velocity for all faces of your boundary patch).
jherb is offline   Reply With Quote

Old   July 21, 2016, 14:30
Default
  #4
Senior Member
 
Mahdi Hosseinali
Join Date: Apr 2009
Location: NB, Canada
Posts: 273
Rep Power: 17
anishtain4 is on a distinguished road
Hassan: it is by default scalar not vector, (the same thing in the original boundary condition) hence the error <double>.

@Joachim: OscillatingFixedValue works fine for me, it's the autoPtr<DataEntry<scalar>> part that I haven't touched and complains after changes in non-related parts!!!!

I solved the issue by commenting the member functions as the ->value() of the DataEntry part would've done the same thing.
anishtain4 is offline   Reply With Quote

Old   July 22, 2016, 05:32
Default
  #5
Senior Member
 
Hassan Kassem
Join Date: May 2010
Location: Germany
Posts: 242
Rep Power: 17
hk318i is on a distinguished road
I did not mean in DataEntry. In your first post you said that your removed template<class Type> which mean you have to modify the entire class. Maybe I am not clear about your modifications.
__________________
@HIKassem | HassanKassem.me
hk318i is offline   Reply With Quote

Old   July 22, 2016, 10:45
Default
  #6
Senior Member
 
Mahdi Hosseinali
Join Date: Apr 2009
Location: NB, Canada
Posts: 273
Rep Power: 17
anishtain4 is on a distinguished road
Yep you're right, but the DataEntry part is not using template Type before I remove the template part. It's autoPtr<DataEntry<scalar>> from the very beginning, so I haven't touched it at all.
anishtain4 is offline   Reply With Quote

Old   July 22, 2016, 11:44
Default
  #7
Senior Member
 
Hassan Kassem
Join Date: May 2010
Location: Germany
Posts: 242
Rep Power: 17
hk318i is on a distinguished road
It is an interesting issue which may requires more investigation. I tried to reduce the template class to normal class and I get the same error. Actually this error make scene from the compiler point of view because ``frequency_`` for example is not scalar. Therefore the compiler complain about the return data type. For now, you can just remove these four function causing the error (if you don't need them) or change the return type. Also, you may consider using the template class as it is.
__________________
@HIKassem | HassanKassem.me
hk318i is offline   Reply With Quote

Old   July 25, 2016, 12:20
Default
  #8
Senior Member
 
Mahdi Hosseinali
Join Date: Apr 2009
Location: NB, Canada
Posts: 273
Rep Power: 17
anishtain4 is on a distinguished road
Yes that's what I did, commenting those lines.
But there's a new issue after that which I've been struggling. I'll make a new topic since it's a different issue.
Thanks for following up.
anishtain4 is offline   Reply With Quote

Reply

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
whats the cause of error? immortality OpenFOAM Running, Solving & CFD 13 March 24, 2021 08:15
problem during mpi in server: expected Scalar, found on line 0 the word 'nan' muth OpenFOAM Running, Solving & CFD 3 August 27, 2018 05:18
Issue symmetryPlane 2.5d extruded airfoil simulation 281419 OpenFOAM Running, Solving & CFD 5 November 28, 2015 14:09
Diverging solution in transonicMRFDyMFoam tsalter OpenFOAM Running, Solving & CFD 30 July 7, 2014 07:20
compressible flow in turbocharger riesotto OpenFOAM 50 May 26, 2014 02:47


All times are GMT -4. The time now is 08:35.