mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Add components to allow overset with multiple motion solvers
1) Add softWall rigidBody restrain 2) Add linearSpringDamper sixDoF restrain to work as soft rope 3) dynamicMotionSolverListFvMesh changed to dictionary based input 4) Add Time reference access to sixDof restraints 5) Add drivenLinearMotion to solidBodyMotionFunctions.
This commit is contained in:
@ -102,6 +102,7 @@ motionSmoother/badQualityToFace/badQualityToFace.C
|
||||
|
||||
motionSolvers/motionSolver/motionSolver.C
|
||||
motionSolvers/displacement/points0/points0MotionSolver.C
|
||||
motionSolvers/displacement/displacement/zoneMotion.C
|
||||
motionSolvers/displacement/displacement/displacementMotionSolver.C
|
||||
motionSolvers/displacement/interpolation/displacementInterpolationMotionSolver.C
|
||||
motionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.C
|
||||
@ -120,6 +121,7 @@ $(solidBodyMotionFunctions)/solidBodyMotionFunction/solidBodyMotionFunctionNew.C
|
||||
$(solidBodyMotionFunctions)/SDA/SDA.C
|
||||
$(solidBodyMotionFunctions)/tabulated6DoFMotion/tabulated6DoFMotion.C
|
||||
$(solidBodyMotionFunctions)/linearMotion/linearMotion.C
|
||||
$(solidBodyMotionFunctions)/drivenLinearMotion/drivenLinearMotion.C
|
||||
$(solidBodyMotionFunctions)/rotatingMotion/rotatingMotion.C
|
||||
$(solidBodyMotionFunctions)/axisRotationMotion/axisRotationMotion.C
|
||||
$(solidBodyMotionFunctions)/multiMotion/multiMotion.C
|
||||
|
||||
@ -0,0 +1,149 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "zoneMotion.H"
|
||||
#include "syncTools.H"
|
||||
#include "cellZoneMesh.H"
|
||||
#include "cellSet.H"
|
||||
#include "boolList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
Foam::zoneMotion::zoneMotion
|
||||
(
|
||||
const dictionary& dict,
|
||||
const polyMesh& mesh
|
||||
)
|
||||
:
|
||||
pointIDs_(),
|
||||
moveAllCells_(false)
|
||||
{
|
||||
word cellZoneName =
|
||||
dict.lookupOrDefault<word>("cellZone", "none");
|
||||
|
||||
word cellSetName =
|
||||
dict.lookupOrDefault<word>("cellSet", "none");
|
||||
|
||||
if ((cellZoneName != "none") && (cellSetName != "none"))
|
||||
{
|
||||
FatalIOErrorInFunction(dict)
|
||||
<< "Either cellZone OR cellSet can be supplied, but not both. "
|
||||
<< "If neither is supplied, all cells will be included"
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
labelList cellIDs;
|
||||
if (cellZoneName != "none")
|
||||
{
|
||||
Info<< "Applying solid body motion to cellZone " << cellZoneName
|
||||
<< endl;
|
||||
|
||||
label zoneID = mesh.cellZones().findZoneID(cellZoneName);
|
||||
|
||||
if (zoneID == -1)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unable to find cellZone " << cellZoneName
|
||||
<< ". Valid cellZones are:"
|
||||
<< mesh.cellZones().names()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
cellIDs = mesh.cellZones()[zoneID];
|
||||
}
|
||||
|
||||
if (cellSetName != "none")
|
||||
{
|
||||
Info<< "Applying solid body motion to cellSet " << cellSetName
|
||||
<< endl;
|
||||
|
||||
cellSet set(mesh, cellSetName);
|
||||
|
||||
cellIDs = set.toc();
|
||||
}
|
||||
|
||||
label nCells = returnReduce(cellIDs.size(), sumOp<label>());
|
||||
moveAllCells_ = (nCells == 0);
|
||||
|
||||
if (moveAllCells_)
|
||||
{
|
||||
Info<< "Applying solid body motion to entire mesh" << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
boolList movePts(mesh.nPoints(), false);
|
||||
|
||||
forAll(cellIDs, i)
|
||||
{
|
||||
label celli = cellIDs[i];
|
||||
const cell& c = mesh.cells()[celli];
|
||||
forAll(c, j)
|
||||
{
|
||||
const face& f = mesh.faces()[c[j]];
|
||||
forAll(f, k)
|
||||
{
|
||||
label pointi = f[k];
|
||||
movePts[pointi] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
syncTools::syncPointList(mesh, movePts, orEqOp<bool>(), false);
|
||||
|
||||
DynamicList<label> ptIDs(mesh.nPoints());
|
||||
forAll(movePts, i)
|
||||
{
|
||||
if (movePts[i])
|
||||
{
|
||||
ptIDs.append(i);
|
||||
}
|
||||
}
|
||||
|
||||
pointIDs_.transfer(ptIDs);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::zoneMotion::~zoneMotion()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Members * * * * * * * * * * * * * * //
|
||||
|
||||
const Foam::labelList& Foam::zoneMotion::pointIDs() const
|
||||
{
|
||||
return pointIDs_;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::zoneMotion::moveAllCells() const
|
||||
{
|
||||
return moveAllCells_;
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,107 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::zoneMotion
|
||||
|
||||
Description
|
||||
|
||||
|
||||
SourceFiles
|
||||
zoneMotion.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef zoneMotion_H
|
||||
#define zoneMotion_H
|
||||
|
||||
#include "labelList.H"
|
||||
#include "dictionary.H"
|
||||
#include "wordRes.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
class polyMesh;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class zoneMotion Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class zoneMotion
|
||||
{
|
||||
// Private data
|
||||
|
||||
|
||||
//- Points to move when cell zone is supplied
|
||||
labelList pointIDs_;
|
||||
|
||||
//- Flag to indicate whether all cells should move
|
||||
bool moveAllCells_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- No copy construct
|
||||
zoneMotion(const zoneMotion&) = delete;
|
||||
|
||||
//- No copy assignment
|
||||
void operator=(const zoneMotion&) = delete;
|
||||
|
||||
public:
|
||||
|
||||
// Member functions
|
||||
|
||||
//- Return pointsID
|
||||
const labelList& pointIDs() const;
|
||||
|
||||
//- Return flag
|
||||
bool moveAllCells() const;
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from dictionary
|
||||
zoneMotion
|
||||
(
|
||||
const dictionary&,
|
||||
const polyMesh&
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~zoneMotion();
|
||||
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015-2016 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2015-2019 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2012-2017 OpenFOAM Foundation
|
||||
@ -113,6 +113,7 @@ Foam::points0MotionSolver::points0MotionSolver
|
||||
)
|
||||
:
|
||||
motionSolver(mesh, dict, type),
|
||||
zoneMotion(dict, mesh),
|
||||
points0_(points0IO(mesh))
|
||||
{
|
||||
if
|
||||
@ -156,6 +157,7 @@ Foam::points0MotionSolver::points0MotionSolver
|
||||
)
|
||||
:
|
||||
motionSolver(mesh, dict, type),
|
||||
zoneMotion(dict, mesh),
|
||||
points0_(points0)
|
||||
{
|
||||
if (points0_.size() != mesh.nPoints())
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2016 OpenFOAM Foundation
|
||||
@ -41,6 +41,7 @@ SourceFiles
|
||||
#include "motionSolver.H"
|
||||
#include "pointFields.H"
|
||||
#include "pointIOField.H"
|
||||
#include "zoneMotion.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -55,7 +56,8 @@ class mapPolyMesh;
|
||||
|
||||
class points0MotionSolver
|
||||
:
|
||||
public motionSolver
|
||||
public motionSolver,
|
||||
public zoneMotion
|
||||
{
|
||||
protected:
|
||||
|
||||
|
||||
@ -0,0 +1,128 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "drivenLinearMotion.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "dimensionedVector.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace solidBodyMotionFunctions
|
||||
{
|
||||
defineTypeNameAndDebug(drivenLinearMotion, 0);
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
solidBodyMotionFunction,
|
||||
drivenLinearMotion,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::solidBodyMotionFunctions::drivenLinearMotion::drivenLinearMotion
|
||||
(
|
||||
const dictionary& SBMFCoeffs,
|
||||
const Time& runTime
|
||||
)
|
||||
:
|
||||
solidBodyMotionFunction(SBMFCoeffs, runTime),
|
||||
CofGvelocity_(SBMFCoeffs.get<word>("CofGvelocity")),
|
||||
normal_(SBMFCoeffs.lookupOrDefault<vector>("normal", Zero)),
|
||||
CofGvel_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
CofGvelocity_,
|
||||
time_.timeName(),
|
||||
time_,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
dimensionedVector(dimless, Zero)
|
||||
),
|
||||
displacement_(Zero)
|
||||
{
|
||||
read(SBMFCoeffs);
|
||||
if (mag(normal_) > SMALL)
|
||||
{
|
||||
normal_ /= (mag(normal_) + SMALL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::solidBodyMotionFunctions::drivenLinearMotion::~drivenLinearMotion()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::septernion
|
||||
Foam::solidBodyMotionFunctions::drivenLinearMotion::transformation() const
|
||||
{
|
||||
scalar deltaT = time_.deltaT().value();
|
||||
|
||||
vector velocity = CofGvel_.value();
|
||||
|
||||
// Take out normal component
|
||||
if (mag(normal_) > SMALL)
|
||||
{
|
||||
velocity = CofGvel_.value() - ((CofGvel_.value() & normal_)*normal_);
|
||||
}
|
||||
|
||||
DebugInFunction << "Vel on plane :" << velocity << endl;
|
||||
|
||||
// Translation of centre of gravity with constant velocity
|
||||
//const vector displacement = velocity*t;
|
||||
displacement_ += velocity*deltaT;
|
||||
|
||||
quaternion R(1);
|
||||
septernion TR(septernion(-displacement_)*R);
|
||||
|
||||
DebugInFunction << "Time = " << time_.value()
|
||||
<< " transformation: " << TR << endl;
|
||||
|
||||
return TR;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::solidBodyMotionFunctions::drivenLinearMotion::read
|
||||
(
|
||||
const dictionary& SBMFCoeffs
|
||||
)
|
||||
{
|
||||
solidBodyMotionFunction::read(SBMFCoeffs);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,138 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::solidBodyMotionFunctions::drivenLinearMotion
|
||||
|
||||
Description
|
||||
Variable velocity displacement. The velocity is read from a
|
||||
uniformVectorField from the time registry with the name CofGvelocity.
|
||||
|
||||
Optional plane of motion can be added with the normal vector
|
||||
|
||||
|
||||
SourceFiles
|
||||
drivenLinearMotion.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef drivenLinearMotion_H
|
||||
#define drivenLinearMotion_H
|
||||
|
||||
#include "solidBodyMotionFunction.H"
|
||||
#include "primitiveFields.H"
|
||||
#include "point.H"
|
||||
#include "uniformDimensionedFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace solidBodyMotionFunctions
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class drivenLinearMotion Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class drivenLinearMotion
|
||||
:
|
||||
public solidBodyMotionFunction
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Name of the meshObject to dum CofG velocity
|
||||
word CofGvelocity_;
|
||||
|
||||
//- Normal plane direction to restrict movement on a plane
|
||||
vector normal_;
|
||||
|
||||
//- Uniform vector to follow
|
||||
uniformDimensionedVectorField CofGvel_;
|
||||
|
||||
//- Last displacement
|
||||
mutable vector displacement_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- No copy construct
|
||||
drivenLinearMotion(const drivenLinearMotion&) = delete;
|
||||
|
||||
//- No copy assignment
|
||||
void operator=(const drivenLinearMotion&) = delete;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("drivenLinearMotion");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
drivenLinearMotion
|
||||
(
|
||||
const dictionary& SBMFCoeffs,
|
||||
const Time& runTime
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual autoPtr<solidBodyMotionFunction> clone() const
|
||||
{
|
||||
return autoPtr<solidBodyMotionFunction>
|
||||
(
|
||||
new drivenLinearMotion
|
||||
(
|
||||
SBMFCoeffs_,
|
||||
time_
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~drivenLinearMotion();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return the solid-body motion transformation septernion
|
||||
virtual septernion transformation() const;
|
||||
|
||||
//- Update properties from given dictionary
|
||||
virtual bool read(const dictionary& SBMFCoeffs);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace solidBodyMotionFunctions
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -52,9 +52,8 @@ Foam::IOobject Foam::motionSolver::stealRegistration
|
||||
{
|
||||
// De-register if necessary
|
||||
const_cast<IOdictionary&>(dict).checkOut();
|
||||
|
||||
io.registerObject() = true;
|
||||
}
|
||||
io.registerObject() = true;
|
||||
|
||||
return io;
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd |
|
||||
\\ / A nd | Copyright (C) 2004-2019 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
|
||||
Reference in New Issue
Block a user