View Issue Details

IDProjectCategoryView StatusLast Update
0003352OpenFOAMContributionpublic2019-09-30 14:32
Reporterhandrake0724Assigned Tohenry 
PrioritynormalSeverityminorReproducibilityhave not tried
Status resolvedResolutionfixed 
Product Versiondev 
Fixed in Version 
Summary0003352: support slacked spring of linearSpring restraint
Descriptionwhen simulating floating structures with soft mooring system with linear spring,
spring is slacked instead of making restoring force.

I think this feature might be useful to someone like me in offshore field.
I made a patch to linearSpring class
please review if it is useful.
TagsNo tags attached.

Activities

handrake0724

2019-09-19 12:17

reporter  

patch.diff (2,159 bytes)
diff --git a/src/rigidBodyDynamics/restraints/linearSpring/linearSpring.C b/src/rigidBodyDynamics/restraints/linearSpring/linearSpring.C
index dc0a1cdfe..9d131e67b 100644
--- a/src/rigidBodyDynamics/restraints/linearSpring/linearSpring.C
+++ b/src/rigidBodyDynamics/restraints/linearSpring/linearSpring.C
@@ -90,7 +90,9 @@ void Foam::RBD::restraints::linearSpring::restrain
     // Force and moment on the master body including optional damping
     vector force
     (
-        (-stiffness_*(magR - restLength_) - damping_*(r & v))*r
+        (allowSlack_ && magR < restLength_)?
+        (- damping_*(r & v))*r
+      : (-stiffness_*(magR - restLength_) - damping_*(r & v))*r
     );
 
     vector moment(attachmentPt ^ force);
@@ -100,6 +102,7 @@ void Foam::RBD::restraints::linearSpring::restrain
         Info<< " attachmentPt " << attachmentPt
             << " attachmentPt - anchor " << r*magR
             << " spring length " << magR
+            << " allow slack " << allowSlack_
             << " force " << force
             << " moment " << moment
             << endl;
@@ -122,6 +125,7 @@ bool Foam::RBD::restraints::linearSpring::read
     coeffs_.lookup("stiffness") >> stiffness_;
     coeffs_.lookup("damping") >> damping_;
     coeffs_.lookup("restLength") >> restLength_;
+    coeffs_.lookupOrDefault<bool>("allowSlack", false) >> allowSlack_;
 
     return true;
 }
@@ -143,6 +147,8 @@ void Foam::RBD::restraints::linearSpring::write
     writeEntry(os, "damping", damping_);
 
     writeEntry(os, "restLength", restLength_);
+
+    writeEntry(os, "allowSlack", allowSlack_);
 }
 
 
diff --git a/src/rigidBodyDynamics/restraints/linearSpring/linearSpring.H b/src/rigidBodyDynamics/restraints/linearSpring/linearSpring.H
index 7f9ddd6fa..74ebdbfb4 100644
--- a/src/rigidBodyDynamics/restraints/linearSpring/linearSpring.H
+++ b/src/rigidBodyDynamics/restraints/linearSpring/linearSpring.H
@@ -72,6 +72,8 @@ class linearSpring
         //- Rest length - length of spring when no forces are applied to it
         scalar restLength_;
 
+        //- no restraint when line is shorter than restLength
+        bool allowSlack_;
 
 public:
 
patch.diff (2,159 bytes)

henry

2019-09-30 14:32

manager   ~0010782

Thanks for the contribution.

Resolved in OpenFOAM-dev by commit f1b975bbb13b545115b5ed0b74caba5b0ae4e743

Issue History

Date Modified Username Field Change
2019-09-19 12:17 handrake0724 New Issue
2019-09-19 12:17 handrake0724 File Added: patch.diff
2019-09-30 14:32 henry Assigned To => henry
2019-09-30 14:32 henry Status new => resolved
2019-09-30 14:32 henry Resolution open => fixed
2019-09-30 14:32 henry Note Added: 0010782