diff --git a/src/OpenFOAM/containers/Dictionaries/DictionaryBase/DictionaryBaseIO.C b/src/OpenFOAM/containers/Dictionaries/DictionaryBase/DictionaryBaseIO.C index 24027496c..1970653b5 100644 --- a/src/OpenFOAM/containers/Dictionaries/DictionaryBase/DictionaryBaseIO.C +++ b/src/OpenFOAM/containers/Dictionaries/DictionaryBase/DictionaryBaseIO.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -62,6 +62,4 @@ Foam::Ostream& Foam::operator<< } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - // ************************************************************************* // diff --git a/src/dynamicFvMesh/Make/files b/src/dynamicFvMesh/Make/files index 0403ea42e..9f5609fdd 100644 --- a/src/dynamicFvMesh/Make/files +++ b/src/dynamicFvMesh/Make/files @@ -4,20 +4,6 @@ staticFvMesh/staticFvMesh.C dynamicMotionSolverFvMesh/dynamicMotionSolverFvMesh.C dynamicInkJetFvMesh/dynamicInkJetFvMesh.C dynamicRefineFvMesh/dynamicRefineFvMesh.C - -solidBodyMotionFvMesh/solidBodyMotionFvMesh.C -solidBodyMotionFvMesh/multiSolidBodyMotionFvMesh.C -solidBodyMotionFunctions = solidBodyMotionFvMesh/solidBodyMotionFunctions -$(solidBodyMotionFunctions)/solidBodyMotionFunction/solidBodyMotionFunction.C -$(solidBodyMotionFunctions)/solidBodyMotionFunction/solidBodyMotionFunctionNew.C -$(solidBodyMotionFunctions)/SDA/SDA.C -$(solidBodyMotionFunctions)/tabulated6DoFMotion/tabulated6DoFMotion.C -$(solidBodyMotionFunctions)/linearMotion/linearMotion.C -$(solidBodyMotionFunctions)/rotatingMotion/rotatingMotion.C -$(solidBodyMotionFunctions)/axisRotationMotion/axisRotationMotion.C -$(solidBodyMotionFunctions)/multiMotion/multiMotion.C -$(solidBodyMotionFunctions)/oscillatingLinearMotion/oscillatingLinearMotion.C -$(solidBodyMotionFunctions)/oscillatingRotatingMotion/oscillatingRotatingMotion.C -solidBodyMotionFvMesh/pointPatchFields/derived/solidBodyMotionDisplacement/solidBodyMotionDisplacementPointPatchVectorField.C +dynamicMotionSolverListFvMesh/dynamicMotionSolverListFvMesh.C LIB = $(FOAM_LIBBIN)/libdynamicFvMesh diff --git a/src/dynamicFvMesh/dynamicMotionSolverListFvMesh/dynamicMotionSolverListFvMesh.C b/src/dynamicFvMesh/dynamicMotionSolverListFvMesh/dynamicMotionSolverListFvMesh.C new file mode 100644 index 000000000..2814638b3 --- /dev/null +++ b/src/dynamicFvMesh/dynamicMotionSolverListFvMesh/dynamicMotionSolverListFvMesh.C @@ -0,0 +1,97 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 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 . + +\*---------------------------------------------------------------------------*/ + +#include "dynamicMotionSolverListFvMesh.H" +#include "addToRunTimeSelectionTable.H" +#include "motionSolver.H" +#include "volFields.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(dynamicMotionSolverListFvMesh, 0); + addToRunTimeSelectionTable + ( + dynamicFvMesh, + dynamicMotionSolverListFvMesh, + IOobject + ); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::dynamicMotionSolverListFvMesh::dynamicMotionSolverListFvMesh +( + const IOobject& io +) +: + dynamicFvMesh(io), + motionSolvers_ + ( + IOdictionary + ( + IOobject + ( + "dynamicMeshDict", + time().constant(), + *this, + IOobject::MUST_READ_IF_MODIFIED, + IOobject::AUTO_WRITE + ) + ).lookup("solvers"), + motionSolver::iNew(*this) + ) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::dynamicMotionSolverListFvMesh::~dynamicMotionSolverListFvMesh() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +bool Foam::dynamicMotionSolverListFvMesh::update() +{ + forAll(motionSolvers_, i) + { + fvMesh::movePoints(motionSolvers_[i].newPoints()); + } + + if (foundObject("U")) + { + volVectorField& U = + const_cast(lookupObject("U")); + U.correctBoundaryConditions(); + } + + return true; +} + + +// ************************************************************************* // diff --git a/src/dynamicFvMesh/dynamicMotionSolverListFvMesh/dynamicMotionSolverListFvMesh.H b/src/dynamicFvMesh/dynamicMotionSolverListFvMesh/dynamicMotionSolverListFvMesh.H new file mode 100644 index 000000000..e638bf63b --- /dev/null +++ b/src/dynamicFvMesh/dynamicMotionSolverListFvMesh/dynamicMotionSolverListFvMesh.H @@ -0,0 +1,100 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 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 . + +Class + Foam::dynamicMotionSolverListFvMesh + +Description + Foam::dynamicMotionSolverListFvMesh + +SourceFiles + dynamicMotionSolverListFvMesh.C + +\*---------------------------------------------------------------------------*/ + +#ifndef dynamicMotionSolverListFvMesh_H +#define dynamicMotionSolverListFvMesh_H + +#include "dynamicFvMesh.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +class motionSolver; + +/*---------------------------------------------------------------------------*\ + Class dynamicMotionSolverListFvMesh Declaration +\*---------------------------------------------------------------------------*/ + +class dynamicMotionSolverListFvMesh +: + public dynamicFvMesh +{ + // Private data + + PtrList motionSolvers_; + + + // Private Member Functions + + //- Disallow default bitwise copy construct + dynamicMotionSolverListFvMesh(const dynamicMotionSolverListFvMesh&); + + //- Disallow default bitwise assignment + void operator=(const dynamicMotionSolverListFvMesh&); + + +public: + + //- Runtime type information + TypeName("dynamicMotionSolverListFvMesh"); + + + // Constructors + + //- Construct from IOobject + dynamicMotionSolverListFvMesh(const IOobject& io); + + + //- Destructor + ~dynamicMotionSolverListFvMesh(); + + + // Member Functions + + //- Dummy update function which does not change the mesh + virtual bool update(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/dynamicMesh/Make/files b/src/dynamicMesh/Make/files index a96b93bdf..1bec6fedf 100644 --- a/src/dynamicMesh/Make/files +++ b/src/dynamicMesh/Make/files @@ -98,11 +98,31 @@ motionSmoother/polyMeshGeometry/polyMeshGeometry.C motionSmoother/badQualityToCell/badQualityToCell.C motionSmoother/badQualityToFace/badQualityToFace.C -motionSolver/motionSolver/motionSolver.C -motionSolver/displacement/displacementMotionSolver.C -motionSolver/componentDisplacement/componentDisplacementMotionSolver.C -motionSolver/velocity/velocityMotionSolver.C -motionSolver/componentVelocity/componentVelocityMotionSolver.C +motionSolvers/motionSolver/motionSolver.C +motionSolvers/displacement/points0/points0MotionSolver.C +motionSolvers/displacement/displacement/displacementMotionSolver.C +motionSolvers/displacement/interpolation/displacementInterpolationMotionSolver.C +motionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.C +motionSolvers/displacement/layeredSolver/pointEdgeStructuredWalk.C +motionSolvers/componentDisplacement/componentDisplacementMotionSolver.C +motionSolvers/velocity/velocityMotionSolver.C +motionSolvers/componentVelocity/componentVelocityMotionSolver.C +motionSolvers/displacement/solidBody/solidBodyMotionSolver.C +motionSolvers/displacement/solidBody/multiSolidBodyMotionSolver.C + +solidBodyMotionFunctions = motionSolvers/displacement/solidBody/solidBodyMotionFunctions +$(solidBodyMotionFunctions)/solidBodyMotionFunction/solidBodyMotionFunction.C +$(solidBodyMotionFunctions)/solidBodyMotionFunction/solidBodyMotionFunctionNew.C +$(solidBodyMotionFunctions)/SDA/SDA.C +$(solidBodyMotionFunctions)/tabulated6DoFMotion/tabulated6DoFMotion.C +$(solidBodyMotionFunctions)/linearMotion/linearMotion.C +$(solidBodyMotionFunctions)/rotatingMotion/rotatingMotion.C +$(solidBodyMotionFunctions)/axisRotationMotion/axisRotationMotion.C +$(solidBodyMotionFunctions)/multiMotion/multiMotion.C +$(solidBodyMotionFunctions)/oscillatingLinearMotion/oscillatingLinearMotion.C +$(solidBodyMotionFunctions)/oscillatingRotatingMotion/oscillatingRotatingMotion.C + +motionSolvers/displacement/solidBody/pointPatchFields/derived/solidBodyMotionDisplacement/solidBodyMotionDisplacementPointPatchVectorField.C createShellMesh/createShellMesh.C diff --git a/src/dynamicMesh/motionSolver/componentDisplacement/componentDisplacementMotionSolver.C b/src/dynamicMesh/motionSolvers/componentDisplacement/componentDisplacementMotionSolver.C similarity index 100% rename from src/dynamicMesh/motionSolver/componentDisplacement/componentDisplacementMotionSolver.C rename to src/dynamicMesh/motionSolvers/componentDisplacement/componentDisplacementMotionSolver.C diff --git a/src/dynamicMesh/motionSolver/componentDisplacement/componentDisplacementMotionSolver.H b/src/dynamicMesh/motionSolvers/componentDisplacement/componentDisplacementMotionSolver.H similarity index 100% rename from src/dynamicMesh/motionSolver/componentDisplacement/componentDisplacementMotionSolver.H rename to src/dynamicMesh/motionSolvers/componentDisplacement/componentDisplacementMotionSolver.H diff --git a/src/dynamicMesh/motionSolver/componentVelocity/componentVelocityMotionSolver.C b/src/dynamicMesh/motionSolvers/componentVelocity/componentVelocityMotionSolver.C similarity index 97% rename from src/dynamicMesh/motionSolver/componentVelocity/componentVelocityMotionSolver.C rename to src/dynamicMesh/motionSolvers/componentVelocity/componentVelocityMotionSolver.C index 7d38bcfa5..04afe7576 100644 --- a/src/dynamicMesh/motionSolver/componentVelocity/componentVelocityMotionSolver.C +++ b/src/dynamicMesh/motionSolvers/componentVelocity/componentVelocityMotionSolver.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/dynamicMesh/motionSolver/componentVelocity/componentVelocityMotionSolver.H b/src/dynamicMesh/motionSolvers/componentVelocity/componentVelocityMotionSolver.H similarity index 100% rename from src/dynamicMesh/motionSolver/componentVelocity/componentVelocityMotionSolver.H rename to src/dynamicMesh/motionSolvers/componentVelocity/componentVelocityMotionSolver.H diff --git a/src/dynamicMesh/motionSolvers/displacement/displacement/displacementMotionSolver.C b/src/dynamicMesh/motionSolvers/displacement/displacement/displacementMotionSolver.C new file mode 100644 index 000000000..3a76a91b3 --- /dev/null +++ b/src/dynamicMesh/motionSolvers/displacement/displacement/displacementMotionSolver.C @@ -0,0 +1,67 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012-2016 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 . + +\*---------------------------------------------------------------------------*/ + +#include "displacementMotionSolver.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(displacementMotionSolver, 0); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::displacementMotionSolver::displacementMotionSolver +( + const polyMesh& mesh, + const IOdictionary& dict, + const word& type +) +: + points0MotionSolver(mesh, dict, type), + pointDisplacement_ + ( + IOobject + ( + "pointDisplacement", + time().timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + pointMesh::New(mesh) + ) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::displacementMotionSolver::~displacementMotionSolver() +{} + + +// ************************************************************************* // diff --git a/src/dynamicMesh/motionSolver/displacement/displacementMotionSolver.H b/src/dynamicMesh/motionSolvers/displacement/displacement/displacementMotionSolver.H similarity index 78% rename from src/dynamicMesh/motionSolver/displacement/displacementMotionSolver.H rename to src/dynamicMesh/motionSolvers/displacement/displacement/displacementMotionSolver.H index 810aae068..df69f731c 100644 --- a/src/dynamicMesh/motionSolver/displacement/displacementMotionSolver.H +++ b/src/dynamicMesh/motionSolvers/displacement/displacement/displacementMotionSolver.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2012-2014 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -38,24 +38,20 @@ SourceFiles #ifndef displacementMotionSolver_H #define displacementMotionSolver_H -#include "motionSolver.H" -#include "pointFields.H" -#include "pointIOField.H" +#include "points0MotionSolver.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { -class mapPolyMesh; - /*---------------------------------------------------------------------------*\ Class displacementMotionSolver Declaration \*---------------------------------------------------------------------------*/ class displacementMotionSolver : - public motionSolver + public points0MotionSolver { protected: @@ -64,18 +60,9 @@ protected: //- Point motion field mutable pointVectorField pointDisplacement_; - //- Starting points - pointIOField points0_; - - - // Protected Member Functions - - //- Return IO object for points0 - IOobject points0IO(const polyMesh& mesh) const; private: - // Private Member Functions //- Disallow default bitwise copy construct @@ -107,18 +94,6 @@ public: // Member Functions - //- Return reference to the reference field - pointField& points0() - { - return points0_; - } - - //- Return reference to the reference field - const pointField& points0() const - { - return points0_; - } - //- Return reference to the point motion displacement field pointVectorField& pointDisplacement() { @@ -130,12 +105,6 @@ public: { return pointDisplacement_; } - - //- Update local data for geometry changes - virtual void movePoints(const pointField&); - - //- Update local data for topology changes - virtual void updateMesh(const mapPolyMesh&); }; diff --git a/src/fvMotionSolver/fvMotionSolvers/displacement/interpolation/displacementInterpolationMotionSolver.C b/src/dynamicMesh/motionSolvers/displacement/interpolation/displacementInterpolationMotionSolver.C similarity index 99% rename from src/fvMotionSolver/fvMotionSolvers/displacement/interpolation/displacementInterpolationMotionSolver.C rename to src/dynamicMesh/motionSolvers/displacement/interpolation/displacementInterpolationMotionSolver.C index 9acd5302a..d423153c5 100644 --- a/src/fvMotionSolver/fvMotionSolvers/displacement/interpolation/displacementInterpolationMotionSolver.C +++ b/src/dynamicMesh/motionSolvers/displacement/interpolation/displacementInterpolationMotionSolver.C @@ -49,8 +49,6 @@ namespace Foam } -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::displacementInterpolationMotionSolver:: diff --git a/src/fvMotionSolver/fvMotionSolvers/displacement/interpolation/displacementInterpolationMotionSolver.H b/src/dynamicMesh/motionSolvers/displacement/interpolation/displacementInterpolationMotionSolver.H similarity index 97% rename from src/fvMotionSolver/fvMotionSolvers/displacement/interpolation/displacementInterpolationMotionSolver.H rename to src/dynamicMesh/motionSolvers/displacement/interpolation/displacementInterpolationMotionSolver.H index b5da0b5b3..0cacf8914 100644 --- a/src/fvMotionSolver/fvMotionSolvers/displacement/interpolation/displacementInterpolationMotionSolver.H +++ b/src/dynamicMesh/motionSolvers/displacement/interpolation/displacementInterpolationMotionSolver.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,7 +25,7 @@ Class Foam::displacementInterpolationMotionSolver Description - Mesh motion solver for an fvMesh. + Mesh motion solver for a polyMesh. Scales inbetween motion prescribed on faceZones. Works out per point the distance between the bounding face zones (in all three directions) diff --git a/src/fvMotionSolver/fvMotionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.C b/src/dynamicMesh/motionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.C similarity index 100% rename from src/fvMotionSolver/fvMotionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.C rename to src/dynamicMesh/motionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.C diff --git a/src/fvMotionSolver/fvMotionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.H b/src/dynamicMesh/motionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.H similarity index 100% rename from src/fvMotionSolver/fvMotionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.H rename to src/dynamicMesh/motionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.H diff --git a/src/fvMotionSolver/fvMotionSolvers/displacement/layeredSolver/pointEdgeStructuredWalk.C b/src/dynamicMesh/motionSolvers/displacement/layeredSolver/pointEdgeStructuredWalk.C similarity index 95% rename from src/fvMotionSolver/fvMotionSolvers/displacement/layeredSolver/pointEdgeStructuredWalk.C rename to src/dynamicMesh/motionSolvers/displacement/layeredSolver/pointEdgeStructuredWalk.C index a2ab64d1d..5bb626935 100644 --- a/src/fvMotionSolver/fvMotionSolvers/displacement/layeredSolver/pointEdgeStructuredWalk.C +++ b/src/dynamicMesh/motionSolvers/displacement/layeredSolver/pointEdgeStructuredWalk.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/fvMotionSolver/fvMotionSolvers/displacement/layeredSolver/pointEdgeStructuredWalk.H b/src/dynamicMesh/motionSolvers/displacement/layeredSolver/pointEdgeStructuredWalk.H similarity index 100% rename from src/fvMotionSolver/fvMotionSolvers/displacement/layeredSolver/pointEdgeStructuredWalk.H rename to src/dynamicMesh/motionSolvers/displacement/layeredSolver/pointEdgeStructuredWalk.H diff --git a/src/fvMotionSolver/fvMotionSolvers/displacement/layeredSolver/pointEdgeStructuredWalkI.H b/src/dynamicMesh/motionSolvers/displacement/layeredSolver/pointEdgeStructuredWalkI.H similarity index 100% rename from src/fvMotionSolver/fvMotionSolvers/displacement/layeredSolver/pointEdgeStructuredWalkI.H rename to src/dynamicMesh/motionSolvers/displacement/layeredSolver/pointEdgeStructuredWalkI.H diff --git a/src/dynamicMesh/motionSolver/displacement/displacementMotionSolver.C b/src/dynamicMesh/motionSolvers/displacement/points0/points0MotionSolver.C similarity index 87% rename from src/dynamicMesh/motionSolver/displacement/displacementMotionSolver.C rename to src/dynamicMesh/motionSolvers/displacement/points0/points0MotionSolver.C index b86fb855d..29966de36 100644 --- a/src/dynamicMesh/motionSolver/displacement/displacementMotionSolver.C +++ b/src/dynamicMesh/motionSolvers/displacement/points0/points0MotionSolver.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,20 +23,20 @@ License \*---------------------------------------------------------------------------*/ -#include "displacementMotionSolver.H" +#include "points0MotionSolver.H" #include "mapPolyMesh.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { - defineTypeNameAndDebug(displacementMotionSolver, 0); + defineTypeNameAndDebug(points0MotionSolver, 0); } // * * * * * * * * * * * * * Protected Data Members * * * * * * * * * * * * * // -Foam::IOobject Foam::displacementMotionSolver::points0IO +Foam::IOobject Foam::points0MotionSolver::points0IO ( const polyMesh& mesh ) const @@ -106,7 +106,7 @@ Foam::IOobject Foam::displacementMotionSolver::points0IO // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::displacementMotionSolver::displacementMotionSolver +Foam::points0MotionSolver::points0MotionSolver ( const polyMesh& mesh, const IOdictionary& dict, @@ -114,18 +114,6 @@ Foam::displacementMotionSolver::displacementMotionSolver ) : motionSolver(mesh, dict, type), - pointDisplacement_ - ( - IOobject - ( - "pointDisplacement", - time().timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - pointMesh::New(mesh) - ), points0_(pointIOField(points0IO(mesh))) { if (points0_.size() != mesh.nPoints()) @@ -134,8 +122,7 @@ Foam::displacementMotionSolver::displacementMotionSolver << "Number of points in mesh " << mesh.nPoints() << " differs from number of points " << points0_.size() << " read from file " - << - IOobject + << IOobject ( "points", time().constant(), @@ -152,19 +139,17 @@ Foam::displacementMotionSolver::displacementMotionSolver // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // -Foam::displacementMotionSolver::~displacementMotionSolver() +Foam::points0MotionSolver::~points0MotionSolver() {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void Foam::displacementMotionSolver::movePoints(const pointField&) -{ - // No local data to update -} +void Foam::points0MotionSolver::movePoints(const pointField&) +{} -void Foam::displacementMotionSolver::updateMesh(const mapPolyMesh& mpm) +void Foam::points0MotionSolver::updateMesh(const mapPolyMesh& mpm) { // pointMesh already updates pointFields diff --git a/src/dynamicMesh/motionSolvers/displacement/points0/points0MotionSolver.H b/src/dynamicMesh/motionSolvers/displacement/points0/points0MotionSolver.H new file mode 100644 index 000000000..ed240ee91 --- /dev/null +++ b/src/dynamicMesh/motionSolvers/displacement/points0/points0MotionSolver.H @@ -0,0 +1,130 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 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 . + +Class + Foam::points0MotionSolver + +Description + Virtual base class for displacement motion solvers. + +SourceFiles + points0MotionSolver.C + +\*---------------------------------------------------------------------------*/ + +#ifndef points0MotionSolver_H +#define points0MotionSolver_H + +#include "motionSolver.H" +#include "pointFields.H" +#include "pointIOField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +class mapPolyMesh; + +/*---------------------------------------------------------------------------*\ + Class points0MotionSolver Declaration +\*---------------------------------------------------------------------------*/ + +class points0MotionSolver +: + public motionSolver +{ +protected: + + // Protected data + + //- Starting points + pointIOField points0_; + + // Protected Member Functions + + //- Return IO object for points0 + IOobject points0IO(const polyMesh& mesh) const; + +private: + + // Private Member Functions + + //- Disallow default bitwise copy construct + points0MotionSolver(const points0MotionSolver&); + + //- Disallow default bitwise assignment + void operator=(const points0MotionSolver&); + +public: + + //- Runtime type information + TypeName("points0MotionSolver"); + + + // Constructors + + //- Construct from mesh and dictionary + points0MotionSolver + ( + const polyMesh&, + const IOdictionary&, + const word& type + ); + + + //- Destructor + virtual ~points0MotionSolver(); + + + // Member Functions + + //- Return reference to the reference field + pointField& points0() + { + return points0_; + } + + //- Return reference to the reference field + const pointField& points0() const + { + return points0_; + } + + //- Update local data for geometry changes + virtual void movePoints(const pointField&); + + //- Update local data for topology changes + virtual void updateMesh(const mapPolyMesh&); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/dynamicFvMesh/solidBodyMotionFvMesh/multiSolidBodyMotionFvMesh.C b/src/dynamicMesh/motionSolvers/displacement/solidBody/multiSolidBodyMotionSolver.C similarity index 50% rename from src/dynamicFvMesh/solidBodyMotionFvMesh/multiSolidBodyMotionFvMesh.C rename to src/dynamicMesh/motionSolvers/displacement/solidBody/multiSolidBodyMotionSolver.C index f2a06887f..625f8cfad 100644 --- a/src/dynamicFvMesh/solidBodyMotionFvMesh/multiSolidBodyMotionFvMesh.C +++ b/src/dynamicMesh/motionSolvers/displacement/solidBody/multiSolidBodyMotionSolver.C @@ -23,9 +23,8 @@ License \*---------------------------------------------------------------------------*/ -#include "multiSolidBodyMotionFvMesh.H" +#include "multiSolidBodyMotionSolver.H" #include "addToRunTimeSelectionTable.H" -#include "volFields.H" #include "transformField.H" #include "cellZoneMesh.H" #include "boolList.H" @@ -35,80 +34,44 @@ License namespace Foam { - defineTypeNameAndDebug(multiSolidBodyMotionFvMesh, 0); + defineTypeNameAndDebug(multiSolidBodyMotionSolver, 0); addToRunTimeSelectionTable ( - dynamicFvMesh, - multiSolidBodyMotionFvMesh, - IOobject + motionSolver, + multiSolidBodyMotionSolver, + dictionary ); } // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::multiSolidBodyMotionFvMesh::multiSolidBodyMotionFvMesh(const IOobject& io) +Foam::multiSolidBodyMotionSolver::multiSolidBodyMotionSolver +( + const polyMesh& mesh, + const IOdictionary& dict +) : - dynamicFvMesh(io), - dynamicMeshCoeffs_ - ( - IOdictionary - ( - IOobject - ( - "dynamicMeshDict", - io.time().constant(), - *this, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE, - false - ) - ).subDict(typeName + "Coeffs") - ), - undisplacedPoints_ - ( - IOobject - ( - "points", - io.time().constant(), - meshSubDir, - *this, - IOobject::MUST_READ, - IOobject::NO_WRITE, - false - ) - ) + points0MotionSolver(mesh, dict, typeName) { - if (undisplacedPoints_.size() != nPoints()) - { - FatalIOErrorInFunction - ( - dynamicMeshCoeffs_ - ) << "Read " << undisplacedPoints_.size() - << " undisplaced points from " << undisplacedPoints_.objectPath() - << " but the current mesh has " << nPoints() - << exit(FatalIOError); - } + zoneIDs_.setSize(coeffDict().size()); + SBMFs_.setSize(coeffDict().size()); + pointIDs_.setSize(coeffDict().size()); + label zonei = 0; - - zoneIDs_.setSize(dynamicMeshCoeffs_.size()); - SBMFs_.setSize(dynamicMeshCoeffs_.size()); - pointIDs_.setSize(dynamicMeshCoeffs_.size()); - label zoneI = 0; - - forAllConstIter(dictionary, dynamicMeshCoeffs_, iter) + forAllConstIter(dictionary, coeffDict(), iter) { if (iter().isDict()) { - zoneIDs_[zoneI] = cellZones().findZoneID(iter().keyword()); + zoneIDs_[zonei] = mesh.cellZones().findZoneID(iter().keyword()); - if (zoneIDs_[zoneI] == -1) + if (zoneIDs_[zonei] == -1) { FatalIOErrorInFunction ( - dynamicMeshCoeffs_ + coeffDict() ) << "Cannot find cellZone named " << iter().keyword() - << ". Valid zones are " << cellZones().names() + << ". Valid zones are " << mesh.cellZones().names() << exit(FatalIOError); } @@ -116,22 +79,22 @@ Foam::multiSolidBodyMotionFvMesh::multiSolidBodyMotionFvMesh(const IOobject& io) SBMFs_.set ( - zoneI, - solidBodyMotionFunction::New(subDict, io.time()) + zonei, + solidBodyMotionFunction::New(subDict, mesh.time()) ); // Collect points of cell zone. - const cellZone& cz = cellZones()[zoneIDs_[zoneI]]; + const cellZone& cz = mesh.cellZones()[zoneIDs_[zonei]]; - boolList movePts(nPoints(), false); + boolList movePts(mesh.nPoints(), false); forAll(cz, i) { label celli = cz[i]; - const cell& c = cells()[celli]; + const cell& c = mesh.cells()[celli]; forAll(c, j) { - const face& f = faces()[c[j]]; + const face& f = mesh.faces()[c[j]]; forAll(f, k) { label pointi = f[k]; @@ -140,9 +103,9 @@ Foam::multiSolidBodyMotionFvMesh::multiSolidBodyMotionFvMesh(const IOobject& io) } } - syncTools::syncPointList(*this, movePts, orEqOp(), false); + syncTools::syncPointList(mesh, movePts, orEqOp(), false); - DynamicList