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

The motion function that access force and torque.

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 24, 2024, 20:29
Default The motion function that access force and torque.
  #1
New Member
 
Shoji KASAI
Join Date: Jul 2014
Posts: 1
Rep Power: 0
skasai is on a distinguished road
In OpenFOAM, the rotating motion by rotatingMotion.C is prescribed with a fixed angular velocity.
I want to create a library to rotate by wind force from the rotatingMotion.C.

A similar library is reported in
http://hichem-hajaiej.com/wp-content...014/10/421.pdf.
What I want to make is the above FDRotationMotion.


A portion of forceDriveMotion.C, created by copying rotatingMotion.C, is shown below.
When I compile it, an error occurs and I do not know how to solve it.


Thus, there is an error in the mesh definition and we cannot obtain the mesh data or the pressure at the object boundary.
Therefore, it is not possible to determine the torque required to rotate the object.

Please give me any advice.




Foam::septernion
Foam::solidBodyMotionFunctions::forceDriveMotion:: transformation() const
{
//
fvMesh& mymesh;
forAll(mymesh.cells(), cell_id)
{
Info << "cell_id = " << cell_id << endl;
}



motionSolvers/displacement/solidBody/solidBodyMotionFunctions/forceDriveMotion/forceDriveMotion.C:77:13: error: ‘mymesh’ declared as reference but not initialized
77 | fvMesh& mymesh;
| ^~~~~~
skasai is offline   Reply With Quote

Old   November 18, 2024, 00:58
Default
  #2
New Member
 
Leong
Join Date: Mar 2009
Posts: 1
Rep Power: 0
tyco is on a distinguished road
It seems you are encountering an issue with the declaration of mymesh in your transformation() function. The error arises because mymesh is declared as a reference to an fvMesh, but it has not been initialized. In OpenFOAM, you need to ensure that mymesh correctly refers to a valid mesh object.

In my own custom solidBodyMotionFunction lib, I declared the mesh as a constant reference in the header file:

const polyMesh& mesh_;

In the constructor, initialize the mesh using the lookupObject method from runTime:

mesh_(runTime.lookupObject<polyMesh>(SBMFCoeffs_.l ookupOrDefault<word>("meshRegion", "region0")))

Once this is done, you can use something like Foam::functionObjects::forces forces("forces", mesh_, forcesDict_); within your transformation() to create a forces object with reference to mesh_ initialised in the constructor earlier. I recommend you have a look at some of the existing solidBodyMotionFunctions (e.g. oscillatingRotatingMotion) and sixDoFRigidBodyMotionSolver to achieve what you are trying to do.
tyco is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Force and torque evaluation Jiricbeng CFX 5 September 4, 2019 11:29
pimpleDyMFoam with sixDoFRigidBodyMotionCoeffs: External Torque chaz OpenFOAM Running, Solving & CFD 0 May 7, 2017 20:22
How to monitor torque or force in CFX? aja1345 CFX 11 April 15, 2016 04:58
torque function João Soares CFX 1 March 31, 2016 16:00
Force / Torque on car body Chonker CFX 0 November 30, 2010 09:09


All times are GMT -4. The time now is 11:47.