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

PtrList error while trying to define an array of volScalarFields

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 13, 2012, 16:49
Default PtrList error while trying to define an array of volScalarFields
  #1
Senior Member
 
Adhiraj
Join Date: Sep 2010
Location: Karnataka, India
Posts: 187
Rep Power: 15
adhiraj is on a distinguished road
Hi all,
I am trying to implement a model where I need to solve for a number of (3 or 6, depending on the case setup) transport equations. I thought of using a PtrList for this. I followed what is being done in
Quote:
$FOAM_SRC/thermophysicalModels/reactionThermo/mixtures/basicMultiComponentMixture
for the variable Y.
However, when I add the line
Quote:
PtrList<volScalarField> Moments_;
in the header file, and the following in the constructor initializer list:
Quote:
Moments_(nMoments_)
I get the following on compiling:
Quote:
/home/adhiraj/OpenFOAM/OpenFOAM-1.7.1/src/OpenFOAM/lnInclude/PtrList.C: In copy constructor ‘Foam::PtrList<T>::PtrList(const Foam::PtrList<T>&) [with T = Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>]’:
MOMIC/MOMIC.H:62:7: instantiated from here
/home/adhiraj/OpenFOAM/OpenFOAM-1.7.1/src/OpenFOAM/lnInclude/PtrList.C:54:9: error: invalid conversion from ‘Foam:: DimensionedField<double, Foam::volMesh>*’ to ‘Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>*’ [-fpermissive]
make: *** [Make/linux64GccDPOpt/MOMIC.o] Error 1
nMoments_ is of type const label, and it is defined and initialized before Moments_.
Any ideas what is wrong here?
adhiraj is offline   Reply With Quote

Old   February 15, 2012, 12:27
Default
  #2
Senior Member
 
Adhiraj
Join Date: Sep 2010
Location: Karnataka, India
Posts: 187
Rep Power: 15
adhiraj is on a distinguished road
Anyone?
I don't understand why the copy constructor is being called at all.
It seems that the same method works in some classes, and that makes it very confusing.
adhiraj is offline   Reply With Quote

Old   February 15, 2012, 17:26
Default
  #3
Senior Member
 
Adhiraj
Join Date: Sep 2010
Location: Karnataka, India
Posts: 187
Rep Power: 15
adhiraj is on a distinguished road
SOLVED.
I was trying to create a new instance of the object with "new", and that was the problem.
adhiraj 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
Installing OF 1.6 on Mac OS X gschaider OpenFOAM Installation 129 June 19, 2010 09:23
Missing math.h header Travis FLUENT 4 January 15, 2009 11:48
REAL GAS UDF brian FLUENT 6 September 11, 2006 08:23
Free surface boudary conditions with SOLA-VOF Fan Main CFD Forum 10 September 9, 2006 12:24
UDF FOR UNSTEADY TIME STEP mayur FLUENT 3 August 9, 2006 10:19


All times are GMT -4. The time now is 01:53.