Commit ab65533e authored by Henry Weller's avatar Henry Weller
Browse files

rigidBodyMeshMotion: Added optional force damping ramp function

to provide smoother behavior on start-up when an acceleration impulse is
applied, e.g. if the body is suddenly released.  e.g.

dynamicFvMesh       dynamicMotionSolverFvMesh;

motionSolverLibs   ("librigidBodyMeshMotion.so");

solver             rigidBodyMotion;

rigidBodyMotionCoeffs
{
    report          on;

    solver
    {
        type    Newmark;
    }

    ramp
    {
        type     quadratic;
        start    0;
        duration 10;
    }
.
.
.

will quadratically ramp the forces from 0 to their full values over the first
10s of the run starting from 0.  If the 'ramp' entry is omitted no force ramping
is applied.
parent 1e592a12
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2016-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -30,6 +30,7 @@ License
#include "pointConstraints.H"
#include "uniformDimensionedFields.H"
#include "forces.H"
#include "OneConstant.H"
#include "mathematicalConstants.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
......@@ -115,6 +116,7 @@ Foam::rigidBodyMeshMotion::rigidBodyMeshMotion
test_(coeffDict().lookupOrDefault<Switch>("test", false)),
rhoInf_(1.0),
rhoName_(coeffDict().lookupOrDefault<word>("rho", "rho")),
ramp_(nullptr),
curTimeIndex_(-1)
{
if (rhoName_ == "rhoInf")
......@@ -122,6 +124,15 @@ Foam::rigidBodyMeshMotion::rigidBodyMeshMotion
rhoInf_ = readScalar(coeffDict().lookup("rhoInf"));
}
if (coeffDict().found("ramp"))
{
ramp_ = Function1<scalar>::New("ramp", coeffDict());
}
else
{
ramp_ = new Function1Types::OneConstant<scalar>("ramp");
}
const dictionary& bodiesDict = coeffDict().subDict("bodies");
forAllConstIter(IDLList<entry>, bodiesDict, iter)
......@@ -232,10 +243,12 @@ void Foam::rigidBodyMeshMotion::solve()
curTimeIndex_ = this->db().time().timeIndex();
}
const scalar ramp = ramp_->value(t.value());
if (db().foundObject<uniformDimensionedVectorField>("g"))
{
model_.g() =
db().lookupObject<uniformDimensionedVectorField>("g").value();
ramp*db().lookupObject<uniformDimensionedVectorField>("g").value();
}
if (test_)
......@@ -270,7 +283,7 @@ void Foam::rigidBodyMeshMotion::solve()
functionObjects::forces f("forces", db(), forcesDict);
f.calcForcesMoment();
fx[bodyID] = spatialVector(f.momentEff(), f.forceEff());
fx[bodyID] = ramp*spatialVector(f.momentEff(), f.forceEff());
}
model_.solve
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2016-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -40,6 +40,7 @@ SourceFiles
#include "displacementMotionSolver.H"
#include "rigidBodyMotion.H"
#include "ramp.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......@@ -116,6 +117,9 @@ class rigidBodyMeshMotion
// 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_;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment