mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
rigidBodyMeshMotion: Read initial state and g from dictionary if present
This commit is contained in:
@ -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,18 +221,11 @@ void Foam::rigidBodyMeshMotion::solve()
|
||||
curTimeIndex_ = this->db().time().timeIndex();
|
||||
}
|
||||
|
||||
dimensionedVector g("g", dimAcceleration, Zero);
|
||||
|
||||
if (db().foundObject<uniformDimensionedVectorField>("g"))
|
||||
{
|
||||
g = db().lookupObject<uniformDimensionedVectorField>("g");
|
||||
model_.g() =
|
||||
db().lookupObject<uniformDimensionedVectorField>("g").value();
|
||||
}
|
||||
else if (coeffDict().found("g"))
|
||||
{
|
||||
coeffDict().lookup("g") >> g;
|
||||
}
|
||||
|
||||
model_.g() = g.value();
|
||||
|
||||
if (test_)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user