CFD Online Logo CFD Online URL
Home > Forums > OpenFOAM Programming & Development

calculating work in sixDoFRigidBodyMotion

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

LinkBack Thread Tools Display Modes
Old   July 14, 2014, 23:04
Default calculating work in sixDoFRigidBodyMotion
Join Date: Jul 2010
Posts: 34
Rep Power: 9
ashkan is on a distinguished road
hi All,

I am doing a simulation of a restricted body in waves using OF2.3 and waves2foam. I am modifying the LinearSpring restriction to be able to calculate work done by the Spring. The total work is the sum of previous work and the current and it requires the length of the restraint in the past time.

My problem is saving the previous length of my tether (restraint) and the work done till current time. To do so I am using State code. But when I compile my solver I get the following error:

CETORigidBodyMotion/restraints/Tether/Tether.C: In member function ‘virtual void Foam::CETORigidBodyMotionRestraints::Tether::restrain(const Foam::CETORigidBodyMotion&, Foam::vector&, Foam::vector&, Foam::vector&, Foam::scalar&) const’:
CETORigidBodyMotion/restraints/Tether/Tether.C:89:38: error: invalid initialization of reference of type ‘Foam::vector& {aka Foam::Vector<double>&}’ from expression of type ‘const vector {aka const Foam::Vector<double>}’
     vector &oldR = tetherState_.oldR();
CETORigidBodyMotion/restraints/Tether/Tether.C:90:40: error: invalid initialization of reference of type ‘Foam::scalar& {aka double&}’ from expression of type ‘const scalar {aka const double}’
     scalar &power = tetherState_.power();
CETORigidBodyMotion/restraints/Tether/Tether.C:91:38: error: invalid initialization of reference of type ‘Foam::scalar& {aka double&}’ from expression of type ‘const scalar {aka const double}’
     scalar &work =;
I have attached my solvers (my codes are in "CETORigidBodyMotion/restraints/Tether") .

I would highly appreciate any comments as I am very new in programming in OpenFOAM.
Attached Files
File Type: zip (96.0 KB, 3 views)
ashkan is offline   Reply With Quote


Thread Tools
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 On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Does CX_Interpret_String work in parallel? 86lolo Fluent UDF and Scheme Programming 2 June 30, 2014 04:36
Companies that lease software & hardware for cloud-based work? Catthan ANSYS 0 June 18, 2014 10:53
Do all CFD analysts have to do some hands-on work except PhDs? e13drd Main CFD Forum 2 March 17, 2014 15:56
Why do the Plant library cases don't work? Alumna Phoenics 6 June 22, 2004 12:08
why my In-Form doesn't work? green Phoenics 2 May 27, 2004 21:03

All times are GMT -4. The time now is 04:14.