Commit 189c6c68 authored by Henry Weller's avatar Henry Weller
Browse files

rigidBodyMeshMotion: Read initial state and g from dictionary if present

parent bac78ef9
......@@ -76,7 +76,7 @@ Foam::Ostream& Foam::RBD::operator<<
const rigidBodyModelState& state
)
{
os << token::SPACE << state.q_
os << state.q_
<< token::SPACE << state.qDot_
<< token::SPACE << state.qDdot_
<< token::SPACE << state.deltaT_;
......
......@@ -59,7 +59,7 @@ Foam::RBD::rigidBodyMotion::rigidBodyMotion
)
:
rigidBodyModel(dict),
motionState_(*this),
motionState_(*this, dict),
motionState0_(motionState_),
X00_(X0_.size()),
aRelax_(dict.lookupOrDefault<scalar>("accelerationRelaxation", 1.0)),
......@@ -67,6 +67,11 @@ Foam::RBD::rigidBodyMotion::rigidBodyMotion
report_(dict.lookupOrDefault<Switch>("report", false)),
solver_(rigidBodySolver::New(*this, dict.subDict("solver")))
{
if (dict.found("g"))
{
g() = vector(dict.lookup("g"));
}
initialize();
}
......@@ -86,6 +91,11 @@ Foam::RBD::rigidBodyMotion::rigidBodyMotion
report_(dict.lookupOrDefault<Switch>("report", false)),
solver_(rigidBodySolver::New(*this, dict.subDict("solver")))
{
if (dict.found("g"))
{
g() = vector(dict.lookup("g"));
}
initialize();
}
......
......@@ -221,19 +221,12 @@ void Foam::rigidBodyMeshMotion::solve()
curTimeIndex_ = this->db().time().timeIndex();
}
dimensionedVector g("g", dimAcceleration, Zero);
if (db().foundObject<uniformDimensionedVectorField>("g"))
{
g = db().lookupObject<uniformDimensionedVectorField>("g");
}
else if (coeffDict().found("g"))
{
coeffDict().lookup("g") >> g;
model_.g() =
db().lookupObject<uniformDimensionedVectorField>("g").value();
}
model_.g() = g.value();
if (test_)
{
label nIter(readLabel(coeffDict().lookup("nIter")));
......
Supports Markdown
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