View Issue Details

IDProjectCategoryView StatusLast Update
0003417OpenFOAMFeaturepublic2019-12-23 10:46
ReporterjkauAssigned Tohenry 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
PlatformLinuxOSCentOSOS Version8
Product Versiondev 
Fixed in Version 
Summary0003417: rigidBodyMeshMotionSolver does not account for force ramp
Descriptionforce ramp is only included in rigidBodyMeshMotion, but not in rigidBodyMeshMotionSolver. Attached path fixes this issue
TagsNo tags attached.

Activities

jkau

2019-12-23 09:43

reporter  

ramp.patch (3,321 bytes)
diff --git a/src/rigidBodyMeshMotion/rigidBodyMeshMotionSolver/rigidBodyMeshMotionSolver.C b/src/rigidBodyMeshMotion/rigidBodyMeshMotionSolver/rigidBodyMeshMotionSolver.C
index 12ce8d1..214b90a 100644
--- a/src/rigidBodyMeshMotion/rigidBodyMeshMotionSolver/rigidBodyMeshMotionSolver.C
+++ b/src/rigidBodyMeshMotion/rigidBodyMeshMotionSolver/rigidBodyMeshMotionSolver.C
@@ -30,6 +30,7 @@ License
 #include "pointConstraints.H"
 #include "uniformDimensionedFields.H"
 #include "forces.H"
+#include "OneConstant.H"
 #include "mathematicalConstants.H"
 
 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@@ -99,6 +100,7 @@ Foam::rigidBodyMeshMotionSolver::rigidBodyMeshMotionSolver
     test_(coeffDict().lookupOrDefault<Switch>("test", false)),
     rhoInf_(1.0),
     rhoName_(coeffDict().lookupOrDefault<word>("rho", "rho")),
+	ramp_(nullptr),
     curTimeIndex_(-1),
     meshSolverPtr_
     (
@@ -121,7 +123,16 @@ Foam::rigidBodyMeshMotionSolver::rigidBodyMeshMotionSolver
 {
     if (rhoName_ == "rhoInf")
     {
-        rhoInf_ = coeffDict().lookup<scalar>("rhoInf");
+        rhoInf_ = readScalar(coeffDict().lookup("rhoInf"));
+    }
+
+    if (coeffDict().found("ramp"))
+    {
+        ramp_ = Function1<scalar>::New("ramp", coeffDict());
+    }
+    else
+    {
+        ramp_ = new Function1s::OneConstant<scalar>("ramp");
     }
 
     const dictionary& bodiesDict = coeffDict().subDict("bodies");
@@ -193,15 +204,18 @@ void Foam::rigidBodyMeshMotionSolver::solve()
         curTimeIndex_ = t.timeIndex();
     }
 
+    const scalar ramp = ramp_->value(t.value());
+
     if (mesh().foundObject<uniformDimensionedVectorField>("g"))
     {
         g() =
-            mesh().lookupObject<uniformDimensionedVectorField>("g").value();
+        	 ramp
+            *mesh().lookupObject<uniformDimensionedVectorField>("g").value();
     }
 
     if (test_)
     {
-        label nIter(coeffDict().lookup<label>("nIter"));
+        label nIter(readLabel(coeffDict().lookup("nIter")));
 
         for (label i=0; i<nIter; i++)
         {
@@ -232,7 +246,7 @@ void Foam::rigidBodyMeshMotionSolver::solve()
             functionObjects::forces f("forces", t, forcesDict);
             f.calcForcesMoment();
 
-            fx[bodyID] = spatialVector(f.momentEff(), f.forceEff());
+            fx[bodyID] = ramp*spatialVector(f.momentEff(), f.forceEff());
         }
 
         RBD::rigidBodyMotion::solve
diff --git a/src/rigidBodyMeshMotion/rigidBodyMeshMotionSolver/rigidBodyMeshMotionSolver.H b/src/rigidBodyMeshMotion/rigidBodyMeshMotionSolver/rigidBodyMeshMotionSolver.H
index dcb8f0a..361d0df 100644
--- a/src/rigidBodyMeshMotion/rigidBodyMeshMotionSolver/rigidBodyMeshMotionSolver.H
+++ b/src/rigidBodyMeshMotion/rigidBodyMeshMotionSolver/rigidBodyMeshMotionSolver.H
@@ -40,6 +40,7 @@ SourceFiles
 
 #include "displacementMotionSolver.H"
 #include "rigidBodyMotion.H"
+#include "Function1.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
@@ -104,6 +105,9 @@ class rigidBodyMeshMotionSolver
         //  as rhoInf
         word rhoName_;
 
+        //- Ramp the forces according to the specified function and period
+        autoPtr<Function1<scalar>> ramp_;
+
         //- Current time index (used for updating)
         label curTimeIndex_;
 
ramp.patch (3,321 bytes)

henry

2019-12-23 10:46

manager   ~0011000

I could not apply the patch you provided as it was not compatible with the latest OpenFOAM-dev. However I have transferred the ramp functionality from rigidBodyMeshMotion to rigidBodyMeshMotionSolver.

Resolved by commit 5a2956218038d46253d5897ea945365cc99f124d

Issue History

Date Modified Username Field Change
2019-12-23 09:43 jkau New Issue
2019-12-23 09:43 jkau File Added: ramp.patch
2019-12-23 10:44 henry Category Bug => Feature
2019-12-23 10:46 henry Assigned To => henry
2019-12-23 10:46 henry Status new => resolved
2019-12-23 10:46 henry Resolution open => fixed
2019-12-23 10:46 henry Note Added: 0011000