CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Force on linearSpring seems to make no sense (https://www.cfd-online.com/Forums/openfoam-solving/255180-force-linearspring-seems-make-no-sense.html)

marxioxyz March 23, 2024 16:52

Force on linearSpring seems to make no sense
 
4 Attachment(s)
Hi Folks

I'm trying to make sense of the results produced by an horizontal linear spring set up in file constant/dynamicMeshDict.

The source code shows the following:

linearSpring.H:

//- Anchor point, where the spring is attached to an immovable object
point anchor_;
//- Reference point of attachment to the solid body
point refAttachmentPt_;
//- Spring stiffness coefficient [N/m]
scalar stiffness_;
//- Damping coefficient [Ns/m]
scalar damping_;
//- Rest length - length of spring when no forces are applied to it
scalar restLength_;
//- Switch to allow no restraint when line is shorter than restLength
Switch allowSlack_;


linearSpring.C:

point attachmentPt = bodyPoint(refAttachmentPt_);

// Current axis of the spring
vector r = attachmentPt - anchor_;
scalar magR = mag(r);
r /= (magR + vSmall);

// Velocity of the attached end of the spring
vector v = bodyPointVelocity(refAttachmentPt_).l();

// Force and moment on the master body including optional damping
vector force
(
(allowSlack_ && magR < restLength_)
? -damping_*(r & v)*r
: (-stiffness_*(magR - restLength_) - damping_*(r & v))*r
);

==================

I've done several tests and none made sense to me. I'll show one of them.

I have a floating object with only one degree of freedom: displacement on X axis.
The force X exerted on the object by the flowfield (hydrodynamic drag) is around 100000 Newtons (attached graph shows 200000N but that's because I doubled the model results in the graph because I'm in fact simulating only half of the object and channel, using a symmetry plane).

The spring has a initial length of 1 meter, which is also the restlengh. For the body to stop moving downstream, I would expect the spring to produce a -100000 N force. Since i set damping to zero, and stiffness to 3000, the spring should stretch to magR=34.33 m to produce the -100kN force:

Fx = -stiffness*(magR - restLength)
-100000 = -3000 *(magR - 1)
magR = 34.33 metres

But during the simulation, when the spring has aproximately 2.2 metres, the spring force acting on the object surpasses the hydrodynamic drag and the object starts moving upstream (in the minus X direction).

Attached you can find force and displacemente graphs, the dynamicMeshDict and a zip file containing the complete simulation files.
Here is the link to a movie produced in paraview:
https://youtu.be/evx-9v28aeo

Another strange behaviour is that the spring exerts force on the object even when its length is smaller than the restlenght (makes no sense since allowSlack_ is set to true). For this I tested another case where the restlength is much greater than the initial lenght and the spring force begins way before the spring reaches the restlength.
By the way, allowSlack is explained here:
https://bugs.openfoam.org/view.php?id=3352

Any help or insight will be very appreciated.

Thank you!


Attachment 99075

Attachment 99076

Attachment 99077

Attachment 99078


All times are GMT -4. The time now is 03:28.