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

Using forces in other classes

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread 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: 16
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: 17
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: 16
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: 16
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: 16
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: 16
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

Old   August 19, 2016, 11:32
Default
  #7
New Member
 
Brecht Devolder
Join Date: Oct 2014
Posts: 2
Rep Power: 0
brdvolde is on a distinguished road
Have you found a solution for this problem?
brdvolde is offline   Reply With Quote

Old   August 26, 2016, 12:57
Default
  #8
New Member
 
Giovanni Stabile
Join Date: Sep 2014
Location: Trieste (Italy) - Florence (Italy)
Posts: 14
Rep Power: 12
giovastabile is on a distinguished road
I have also the same problem
giovastabile is offline   Reply With Quote

Old   November 3, 2017, 13:41
Default
  #9
Senior Member
 
louisgag's Avatar
 
Louis Gagnon
Join Date: Mar 2009
Location: Stuttgart, Germany
Posts: 338
Rep Power: 18
louisgag is on a distinguished road
Send a message via ICQ to louisgag
Quote:
Originally Posted by giovastabile View Post
I have also the same problem
And so do I, anyone knows how to access the db() objectRegistry required by the
Code:
forces f("forces", db(), forcesDict);
call directly from a solver?
louisgag is offline   Reply With Quote

Reply

Tags
forces, rigid body motions


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
Reading forces from previous time step within solver SD@TUB OpenFOAM Programming & Development 5 April 24, 2023 12:51
how to get forces on Iso-Clip Surfaces and How to get forces in cylindrical coordinat CFD XUE FLUENT 3 March 18, 2015 04:28
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
Valve Forces in CFdesign Mike Clapp Main CFD Forum 3 March 8, 2001 15:09


All times are GMT -4. The time now is 16:15.