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

assign 0 to a List of scalarField

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 10, 2016, 01:51
Default assign 0 to a List of scalarField
  #1
Member
 
Join Date: Jul 2010
Posts: 55
Rep Power: 15
ashkan is on a distinguished road
Hi All,

I am trying to modify the force functionObject (force.C). There I need to calculate an integral of scalar field over a surface. In force.H I defined the following line:

Code:
List<Field<vector> > force_;
List<Field<vector> > moment_;
List<Field<scalar> > SubSurface_;
Then in the force.C (calcForcesMoment) I added

Code:
    
force_[0] = vector::zero;
force_[1] = vector::zero;
force_[2] = vector::zero;

moment_[0] = vector::zero;
moment_[1] = vector::zero;
moment_[2] = vector::zero;
    
SubSurface_ = 0.0;
However when I compile I get the following error

Code:
subforces/subforces.C:757:19: error: no match for ‘operator=’ in ‘((Foam::subforces*)this)->Foam::subforces::SubSurface_ = 0.0’
subforces/subforces.C:757:19: note: candidates are:
/media/Data/OpenFOAM/OpenFOAM-3.0.x/src/OpenFOAM/lnInclude/List.C:429:6: note: void Foam::List<T>::operator=(const Foam::UList<T>&) [with T = Foam::Field<double>]
/media/Data/OpenFOAM/OpenFOAM-3.0.x/src/OpenFOAM/lnInclude/List.C:429:6: note:   no known conversion for argument 1 from ‘double’ to ‘const Foam::UList<Foam::Field<double> >&’
/media/Data/OpenFOAM/OpenFOAM-3.0.x/src/OpenFOAM/lnInclude/List.C:461:6: note: void Foam::List<T>::operator=(const Foam::List<T>&) [with T = Foam::Field<double>]
/media/Data/OpenFOAM/OpenFOAM-3.0.x/src/OpenFOAM/lnInclude/List.C:461:6: note:   no known conversion for argument 1 from ‘double’ to ‘const Foam::List<Foam::Field<double> >&’
/media/Data/OpenFOAM/OpenFOAM-3.0.x/src/OpenFOAM/lnInclude/List.C:476:6: note: void Foam::List<T>::operator=(const Foam::SLList<T>&) [with T = Foam::Field<double>]
/media/Data/OpenFOAM/OpenFOAM-3.0.x/src/OpenFOAM/lnInclude/List.C:476:6: note:   no known conversion for argument 1 from ‘double’ to ‘const Foam::SLList<Foam::Field<double> >&’
/media/Data/OpenFOAM/OpenFOAM-3.0.x/src/OpenFOAM/lnInclude/List.C:504:6: note: void Foam::List<T>::operator=(const Foam::UIndirectList<T>&) [with T = Foam::Field<double>]
/media/Data/OpenFOAM/OpenFOAM-3.0.x/src/OpenFOAM/lnInclude/List.C:504:6: note:   no known conversion for argument 1 from ‘double’ to ‘const Foam::UIndirectList<Foam::Field<double> >&’
/media/Data/OpenFOAM/OpenFOAM-3.0.x/src/OpenFOAM/lnInclude/List.C:523:6: note: void Foam::List<T>::operator=(const Foam::BiIndirectList<T>&) [with T = Foam::Field<double>]
/media/Data/OpenFOAM/OpenFOAM-3.0.x/src/OpenFOAM/lnInclude/List.C:523:6: note:   no known conversion for argument 1 from ‘double’ to ‘const Foam::BiIndirectList<Foam::Field<double> >&’
/media/Data/OpenFOAM/OpenFOAM-3.0.x/src/OpenFOAM/lnInclude/ListI.H:140:13: note: void Foam::List<T>::operator=(const T&) [with T = Foam::Field<double>]
/media/Data/OpenFOAM/OpenFOAM-3.0.x/src/OpenFOAM/lnInclude/ListI.H:140:13: note:   no known conversion for argument 1 from ‘double’ to ‘const Foam::Field<double>&’
Line 757 that it refers to is
Code:
    
SubSurface_ = 0.0;
I believe it means I cannot assign 0 to my List. How can I resolve this issue?

Many thank in advance
Ashkan
ashkan 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
[swak4Foam] funkyDoCalc with OF2.3 massflow NiFl OpenFOAM Community Contributions 14 November 25, 2020 03:30
[Other] How to use finite area method in official OpenFOAM 2.2.0? Detian Liu OpenFOAM Meshing & Mesh Conversion 4 November 3, 2015 03:04
[foam-extend.org] problem when installing foam-extend-1.6 Thomas pan OpenFOAM Installation 7 September 9, 2015 21:53
[swak4Foam] build problem swak4Foam OF 2.2.0 mcathela OpenFOAM Community Contributions 14 April 23, 2013 13:59
DecomposePar links against liblamso0 with OpenMPI jens_klostermann OpenFOAM Bugs 11 June 28, 2007 17:51


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