Skip to content
Snippets Groups Projects

WIP:dynamicMotionSolverListFvMesh uses same points0 as reference. Fixes #1702

Closed Sergio Ferraris requested to merge code-review.saf into develop
Compare and
2 files
+ 19
5
Preferences
Compare changes
Files
2
@@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@@ -119,12 +119,26 @@ bool Foam::dynamicMotionSolverListFvMesh::update()
{
if (motionSolvers_.size())
{
const pointField& initPoints = lookupObjectRef<pointField>("points0");
// Accumulated displacement
pointField disp(motionSolvers_[0].newPoints() - fvMesh::points());
for (label i = 1; i < motionSolvers_.size(); i++)
{
disp += motionSolvers_[i].newPoints() - fvMesh::points();
tmp<pointField> dispI(motionSolvers_[i].newPoints());
forAll (disp, j)
{
if (mag(disp[j]) > 0)
{
disp[j] += dispI()[j] - initPoints[j];
}
else
{
disp[j] += dispI()[j] - fvMesh::points()[j];
}
}
}
fvMesh::movePoints(points() + disp);