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

Using forces in other classes

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

Reply
 
LinkBack Thread Tools Display Modes
Old   May 7, 2012, 11:49
Default Using forces in other classes
  #1
Senior Member
 
Join Date: Apr 2010
Posts: 151
Rep Power: 6
flowris is on a distinguished road
Hello,

I have a mesh motion class that works very well for prescribed motion. I would like to use this class to do rigid body displacements, under the influence of the fluid forces. I can also calculate the forces using the standard forces function.

How can I take the results from this force calculation at each time step, and bring them into my mesh motion class for further use?
flowris is offline   Reply With Quote

Old   May 8, 2012, 08:14
Default
  #2
Senior Member
 
David Boger
Join Date: Mar 2009
Location: Penn State Applied Research Laboratory
Posts: 146
Rep Power: 7
boger is on a distinguished road
One way would be to instantiate a forces object from within your class and use the calcForcesMoment() method to get the forces and moments acting on your object.
__________________
David A. Boger
boger is offline   Reply With Quote

Old   May 8, 2012, 08:40
Default
  #3
Senior Member
 
Join Date: Apr 2010
Posts: 151
Rep Power: 6
flowris is on a distinguished road
Excellent! I saw that in the sixDoFRigidBodyDisplacement class, but was not sure if this was what I was looking for. I'll try and learn to use it.

Many thanks!
flowris is offline   Reply With Quote

Old   May 8, 2012, 11:22
Default
  #4
Senior Member
 
Join Date: Apr 2010
Posts: 151
Rep Power: 6
flowris is on a distinguished road
Do you know more about objectRegistry? I am trying to instantiate a forces object, as you suggested:
Code:
    dictionary forcesDict;

    forcesDict.add("patches", "block");
    forcesDict.add("rhoName", "rhoInf");
    forcesDict.add("rhoInf", 1000);
    vector centreOfMass_(0.0,0.0,0.0);
    forcesDict.add("CofR", centreOfMass_);

    forces f("forces", db(), forcesDict);
But in the last line, where is written "db()", I should put a reference to the objectRegistry. What is this, and how do I reference to it?
flowris is offline   Reply With Quote

Old   June 5, 2012, 11:38
Default
  #5
Senior Member
 
Join Date: Apr 2010
Posts: 151
Rep Power: 6
flowris is on a distinguished road
Can anybody tell me how to instantiate a forces object in a new class, or give an example where it is done?
flowris is offline   Reply With Quote

Old   June 5, 2012, 13:56
Default
  #6
Senior Member
 
Join Date: Apr 2010
Posts: 151
Rep Power: 6
flowris is on a distinguished road
Simply writing
Code:
    forces f("forces", db(), forcesDict);
results in the compiling error
Code:
hppGgiFvMesh.C: In member function ‘void Foam::hppGgiFvMesh::getMoment()’:
hppGgiFvMesh.C:358: error: reference to ‘db’ is ambiguous
/home/jmatthei/OpenFOAM/OpenFOAM-1.6-ext/src/OpenFOAM/lnInclude/IOobject.H:236: error: candidates are: const Foam::objectRegistry& Foam::IOobject::db() const
/home/jmatthei/OpenFOAM/OpenFOAM-1.6-ext/src/OpenFOAM/lnInclude/IOobject.H:236: error:                 const Foam::objectRegistry& Foam::IOobject::db() const
/home/jmatthei/OpenFOAM/OpenFOAM-1.6-ext/src/OpenFOAM/lnInclude/IOobject.H:236: error:                 const Foam::objectRegistry& Foam::IOobject::db() const
hppGgiFvMesh.C:358: error: reference to ‘db’ is ambiguous
/home/jmatthei/OpenFOAM/OpenFOAM-1.6-ext/src/OpenFOAM/lnInclude/IOobject.H:236: error: candidates are: const Foam::objectRegistry& Foam::IOobject::db() const
/home/jmatthei/OpenFOAM/OpenFOAM-1.6-ext/src/OpenFOAM/lnInclude/IOobject.H:236: error:                 const Foam::objectRegistry& Foam::IOobject::db() const
flowris is offline   Reply With Quote

Reply

Tags
forces, rigid body motions

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
forces in interFoam Svensson OpenFOAM Post-Processing 2 May 9, 2012 14:31
FORCES don't run! C12Carbon OpenFOAM 0 September 10, 2011 08:34
how to get forces on Iso-Clip Surfaces and How to get forces in cylindrical coordinat CFD XUE FLUENT 0 April 18, 2011 06:24
Reading forces from previous time step within solver SD@TUB OpenFOAM Programming & Development 0 March 14, 2010 08:58
Valve Forces in CFdesign Mike Clapp Main CFD Forum 3 March 8, 2001 15:09


All times are GMT -4. The time now is 00:02.