|
[Sponsors] |
The motion function that access force and torque. |
![]() |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
![]() |
![]() |
#1 |
New Member
Shoji KASAI
Join Date: Jul 2014
Posts: 1
Rep Power: 0 ![]() |
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; | ^~~~~~ |
|
![]() |
![]() |
![]() |
![]() |
#2 |
New Member
Leong
Join Date: Mar 2009
Posts: 1
Rep Power: 0 ![]() |
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. |
|
![]() |
![]() |
![]() |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
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 |