diff --git a/src/dynamicMesh/Make/files b/src/dynamicMesh/Make/files index d7310029a7e568fb83edda0d8719c0821948f257..21dcc7239828316acbf60f577c4c8c125b2156ec 100644 --- a/src/dynamicMesh/Make/files +++ b/src/dynamicMesh/Make/files @@ -85,7 +85,11 @@ motionSmoother/motionSmoother.C motionSmoother/motionSmootherCheck.C motionSmoother/polyMeshGeometry/polyMeshGeometry.C -motionSolver/motionSolver.C +motionSolver/motionSolver/motionSolver.C +motionSolver/displacement/displacementMotionSolver.C +motionSolver/componentDisplacement/componentDisplacementMotionSolver.C +motionSolver/velocity/velocityMotionSolver.C +motionSolver/componentVelocity/componentVelocityMotionSolver.C createShellMesh/createShellMesh.C diff --git a/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.C b/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.C index ce775360533424659dde1626e4b304fcfe5ac168..33058afaf4a06de831ad370727bd684751b563c1 100644 --- a/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.C +++ b/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.C @@ -2445,32 +2445,69 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute // parallel comms. After this points and edges should again be consistent. mergeSharedPoints(constructPointMap); +// // Bit of hack: processorFvPatchField does not get reset since created +// // from nothing so explicitly reset. +// initPatchFields<volScalarField, processorFvPatchField<scalar> > +// ( +// pTraits<scalar>::zero +// ); +// initPatchFields<volVectorField, processorFvPatchField<vector> > +// ( +// pTraits<vector>::zero +// ); +// initPatchFields +// < +// volSphericalTensorField, +// processorFvPatchField<sphericalTensor> +// > +// ( +// pTraits<sphericalTensor>::zero +// ); +// initPatchFields<volSymmTensorField, processorFvPatchField<symmTensor> > +// ( +// pTraits<symmTensor>::zero +// ); +// initPatchFields<volTensorField, processorFvPatchField<tensor> > +// ( +// pTraits<tensor>::zero +// ); +// initPatchFields<surfaceScalarField, processorFvsPatchField<scalar> > +// ( +// pTraits<scalar>::zero +// ); +// initPatchFields<surfaceVectorField, processorFvsPatchField<vector> > +// ( +// pTraits<vector>::zero +// ); +// initPatchFields +// < +// surfaceSphericalTensorField, +// processorFvsPatchField<sphericalTensor> +// > +// ( +// pTraits<sphericalTensor>::zero +// ); +// initPatchFields +// < +// surfaceSymmTensorField, +// processorFvsPatchField<symmTensor> +// > +// ( +// pTraits<symmTensor>::zero +// ); +// initPatchFields<surfaceTensorField, processorFvsPatchField<tensor> > +// ( +// pTraits<tensor>::zero +// ); +//XXXXX // Bit of hack: processorFvPatchField does not get reset since created // from nothing so explicitly reset. - initPatchFields<volScalarField, processorFvPatchField<scalar> > - ( - pTraits<scalar>::zero - ); - initPatchFields<volVectorField, processorFvPatchField<vector> > - ( - pTraits<vector>::zero - ); - initPatchFields - < - volSphericalTensorField, - processorFvPatchField<sphericalTensor> - > - ( - pTraits<sphericalTensor>::zero - ); - initPatchFields<volSymmTensorField, processorFvPatchField<symmTensor> > - ( - pTraits<symmTensor>::zero - ); - initPatchFields<volTensorField, processorFvPatchField<tensor> > - ( - pTraits<tensor>::zero - ); + correctBoundaryConditions<volScalarField>(); + correctBoundaryConditions<volVectorField>(); + correctBoundaryConditions<volSphericalTensorField>(); + correctBoundaryConditions<volSymmTensorField>(); + correctBoundaryConditions<volTensorField>(); + initPatchFields<surfaceScalarField, processorFvsPatchField<scalar> > ( pTraits<scalar>::zero @@ -2499,7 +2536,7 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute ( pTraits<tensor>::zero ); - +//XXXXX mesh_.setInstance(mesh_.time().timeName()); diff --git a/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.H b/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.H index ace7117602d1811f4e0d27ef36683c122a447139..eb771003a0c9674cc5ae4ae3bef6568e1437af92 100644 --- a/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.H +++ b/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.H @@ -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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -138,6 +138,10 @@ class fvMeshDistribute const typename GeoField::value_type& initVal ); + //- Call correctBoundaryConditions on fields + template<class GeoField> + void correctBoundaryConditions(); + //- Delete all processor patches. Move any processor faces into // patchI. autoPtr<mapPolyMesh> deleteProcPatches(const label patchI); diff --git a/src/dynamicMesh/fvMeshDistribute/fvMeshDistributeTemplates.C b/src/dynamicMesh/fvMeshDistribute/fvMeshDistributeTemplates.C index fa88841eb06f56a02ba300f8f34a60ebfa4db423..00364a81add063129d25d828ba2ed7a113890953 100644 --- a/src/dynamicMesh/fvMeshDistribute/fvMeshDistributeTemplates.C +++ b/src/dynamicMesh/fvMeshDistribute/fvMeshDistributeTemplates.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -241,6 +241,24 @@ void Foam::fvMeshDistribute::initPatchFields } +// correctBoundaryConditions patch fields of certain type +template<class GeoField> +void Foam::fvMeshDistribute::correctBoundaryConditions() +{ + HashTable<const GeoField*> flds + ( + mesh_.objectRegistry::lookupClass<GeoField>() + ); + + forAllConstIter(typename HashTable<const GeoField*>, flds, iter) + { + const GeoField& fld = *iter(); + + const_cast<GeoField&>(fld).correctBoundaryConditions(); + } +} + + // Send fields. Note order supplied so we can receive in exactly the same order. // Note that field gets written as entry in dictionary so we // can construct from subdictionary. diff --git a/src/dynamicMesh/motionSolver/componentDisplacement/componentDisplacementMotionSolver.C b/src/dynamicMesh/motionSolver/componentDisplacement/componentDisplacementMotionSolver.C new file mode 100644 index 0000000000000000000000000000000000000000..fe902f95a06304249873446625e5c5260f95bc55 --- /dev/null +++ b/src/dynamicMesh/motionSolver/componentDisplacement/componentDisplacementMotionSolver.C @@ -0,0 +1,215 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 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 "componentDisplacementMotionSolver.H" +#include "mapPolyMesh.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(componentDisplacementMotionSolver, 0); +} + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +Foam::direction Foam::componentDisplacementMotionSolver::cmpt +( + const word& cmptName +) const +{ + if (cmptName == "x") + { + return vector::X; + } + else if (cmptName == "y") + { + return vector::Y; + } + else if (cmptName == "z") + { + return vector::Z; + } + else + { + FatalErrorIn + ( + "componentDisplacementMotionSolver::" + "componentDisplacementMotionSolver" + "(const polyMesh& mesh, const IOdictionary&)" + ) << "Given component name " << cmptName << " should be x, y or z" + << exit(FatalError); + + return 0; + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::componentDisplacementMotionSolver::componentDisplacementMotionSolver +( + const polyMesh& mesh, + const IOdictionary& dict, + const word& type +) +: + motionSolver(mesh, dict, type), + cmptName_(coeffDict().lookup("component")), + cmpt_(cmpt(cmptName_)), + points0_ + ( + pointIOField + ( + IOobject + ( + "points", + time().constant(), + polyMesh::meshSubDir, + mesh, + IOobject::MUST_READ, + IOobject::NO_WRITE, + false + ) + ).component(cmpt_) + ), + pointDisplacement_ + ( + IOobject + ( + "pointDisplacement" + cmptName_, + mesh.time().timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + pointMesh::New(mesh) + ) +{ + if (points0_.size() != mesh.nPoints()) + { + FatalErrorIn + ( + "componentDisplacementMotionSolver::" + "componentDisplacementMotionSolver\n" + "(\n" + " const polyMesh&,\n" + " const IOdictionary&\n" + ")" + ) << "Number of points in mesh " << mesh.nPoints() + << " differs from number of points " << points0_.size() + << " read from file " + << + IOobject + ( + "points", + mesh.time().constant(), + polyMesh::meshSubDir, + mesh, + IOobject::MUST_READ, + IOobject::NO_WRITE, + false + ).filePath() + << exit(FatalError); + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::componentDisplacementMotionSolver::~componentDisplacementMotionSolver() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::componentDisplacementMotionSolver::movePoints(const pointField& p) +{ + // No local data to update +} + + +void Foam::componentDisplacementMotionSolver::updateMesh(const mapPolyMesh& mpm) +{ + // pointMesh already updates pointFields. + + motionSolver::updateMesh(mpm); + + // Map points0_. Bit special since we somehow have to come up with + // a sensible points0 position for introduced points. + // Find out scaling between points0 and current points + + // Get the new points either from the map or the mesh + const scalarField points + ( + mpm.hasMotionPoints() + ? mpm.preMotionPoints().component(cmpt_) + : mesh().points().component(cmpt_) + ); + + // Get extents of points0 and points and determine scale + const scalar scale = + (gMax(points0_)-gMin(points0_)) + /(gMax(points)-gMin(points)); + + scalarField newPoints0(mpm.pointMap().size()); + + forAll(newPoints0, pointI) + { + label oldPointI = mpm.pointMap()[pointI]; + + if (oldPointI >= 0) + { + label masterPointI = mpm.reversePointMap()[oldPointI]; + + if (masterPointI == pointI) + { + newPoints0[pointI] = points0_[oldPointI]; + } + else + { + // New point. Assume motion is scaling. + newPoints0[pointI] = + points0_[oldPointI] + + scale*(points[pointI]-points[masterPointI]); + } + } + else + { + FatalErrorIn + ( + "displacementLaplacianFvMotionSolver::updateMesh" + "(const mapPolyMesh& mpm)" + ) << "Cannot work out coordinates of introduced vertices." + << " New vertex " << pointI << " at coordinate " + << points[pointI] << exit(FatalError); + } + } + points0_.transfer(newPoints0); +} + + +// ************************************************************************* // diff --git a/src/dynamicMesh/motionSolver/componentDisplacement/componentDisplacementMotionSolver.H b/src/dynamicMesh/motionSolver/componentDisplacement/componentDisplacementMotionSolver.H new file mode 100644 index 0000000000000000000000000000000000000000..9a773a755b18e3d9bb84ef4cf886b55efeca5161 --- /dev/null +++ b/src/dynamicMesh/motionSolver/componentDisplacement/componentDisplacementMotionSolver.H @@ -0,0 +1,142 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 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/>. + +Class + Foam::componentDisplacementMotionSolver + +Description + Virtual base class for displacement motion solver + + The boundary displacement is set as a boundary condition + on the pointDisplacementX pointScalarField. + +SourceFiles + componentDisplacementMotionSolver.C + +\*---------------------------------------------------------------------------*/ + +#ifndef componentDisplacementMotionSolver_H +#define componentDisplacementMotionSolver_H + +#include "motionSolver.H" +#include "pointFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +class mapPolyMesh; + +/*---------------------------------------------------------------------------*\ + Class componentDisplacementMotionSolver Declaration +\*---------------------------------------------------------------------------*/ + +class componentDisplacementMotionSolver +: + public motionSolver +{ +protected: + + // Protected data + + //- The component name to solve for + word cmptName_; + + //- The component to solve for + direction cmpt_; + + //- Reference point field for this component + scalarField points0_; + + //- Point motion field + mutable pointScalarField pointDisplacement_; + +private: + + // Private Member Functions + + //- Return the component corresponding to the given component name + direction cmpt(const word& cmptName) const; + + //- Disallow default bitwise copy construct + componentDisplacementMotionSolver + ( + const componentDisplacementMotionSolver& + ); + + //- Disallow default bitwise assignment + void operator=(const componentDisplacementMotionSolver&); + +public: + + //- Runtime type information + TypeName("componentDisplacementMotionSolver"); + + + // Constructors + + //- Construct from polyMesh and dictionary and type + componentDisplacementMotionSolver + ( + const polyMesh&, + const IOdictionary&, + const word& type + ); + + + //- Destructor + virtual ~componentDisplacementMotionSolver(); + + + // Member Functions + + //- Return reference to the reference field + scalarField& points0() + { + return points0_; + } + + //- Return reference to the reference field + const scalarField& 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/dynamicMesh/motionSolver/componentVelocity/componentVelocityMotionSolver.C b/src/dynamicMesh/motionSolver/componentVelocity/componentVelocityMotionSolver.C new file mode 100644 index 0000000000000000000000000000000000000000..57781e3bb1e050c48894ca9d1323e7c58d214905 --- /dev/null +++ b/src/dynamicMesh/motionSolver/componentVelocity/componentVelocityMotionSolver.C @@ -0,0 +1,120 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 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 "componentVelocityMotionSolver.H" +#include "mapPolyMesh.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(componentVelocityMotionSolver, 0); +} + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +Foam::direction Foam::componentVelocityMotionSolver::cmpt +( + const word& cmptName +) const +{ + if (cmptName == "x") + { + return vector::X; + } + else if (cmptName == "y") + { + return vector::Y; + } + else if (cmptName == "z") + { + return vector::Z; + } + else + { + FatalErrorIn + ( + "componentVelocityMotionSolver::" + "componentVelocityMotionSolver" + "(const polyMesh& mesh, const IOdictionary&)" + ) << "Given component name " << cmptName << " should be x, y or z" + << exit(FatalError); + + return 0; + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::componentVelocityMotionSolver::componentVelocityMotionSolver +( + const polyMesh& mesh, + const IOdictionary& dict, + const word& type +) +: + motionSolver(mesh, dict, type), + cmptName_(coeffDict().lookup("component")), + cmpt_(cmpt(cmptName_)), + pointMotionU_ + ( + IOobject + ( + "pointMotionU" + cmptName_, + mesh.time().timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + pointMesh::New(mesh) + ) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::componentVelocityMotionSolver::~componentVelocityMotionSolver() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::componentVelocityMotionSolver::movePoints(const pointField& p) +{ + // No local data to adapt +} + + +void Foam::componentVelocityMotionSolver::updateMesh(const mapPolyMesh& mpm) +{ + // pointMesh already updates pointFields. + + motionSolver::updateMesh(mpm); +} + + +// ************************************************************************* // diff --git a/src/dynamicMesh/motionSolver/componentVelocity/componentVelocityMotionSolver.H b/src/dynamicMesh/motionSolver/componentVelocity/componentVelocityMotionSolver.H new file mode 100644 index 0000000000000000000000000000000000000000..5370797094f02b9bffae69aa980b2007196ed5d8 --- /dev/null +++ b/src/dynamicMesh/motionSolver/componentVelocity/componentVelocityMotionSolver.H @@ -0,0 +1,127 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 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/>. + +Class + Foam::componentVelocityMotionSolver + +Description + Virtual base class for velocity motion solver + + The boundary displacement is set as a boundary condition + on the pointMotionUX pointScalarField. + +SourceFiles + componentVelocityMotionSolver.C + +\*---------------------------------------------------------------------------*/ + +#ifndef componentVelocityMotionSolver_H +#define componentVelocityMotionSolver_H + +#include "motionSolver.H" +#include "pointFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +class mapPolyMesh; + +/*---------------------------------------------------------------------------*\ + Class componentVelocityMotionSolver Declaration +\*---------------------------------------------------------------------------*/ + +class componentVelocityMotionSolver +: + public motionSolver +{ +protected: + + // Protected data + + //- The component name to solve for + word cmptName_; + + //- The component to solve for + direction cmpt_; + + //- Point motion field + mutable pointScalarField pointMotionU_; + +private: + + // Private Member Functions + + //- Return the component corresponding to the given component name + direction cmpt(const word& cmptName) const; + + //- Disallow default bitwise copy construct + componentVelocityMotionSolver + ( + const componentVelocityMotionSolver& + ); + + //- Disallow default bitwise assignment + void operator=(const componentVelocityMotionSolver&); + +public: + + //- Runtime type information + TypeName("componentVelocityMotionSolver"); + + + // Constructors + + //- Construct from mesh and dictionary + componentVelocityMotionSolver + ( + const polyMesh&, + const IOdictionary&, + const word& type + ); + + + //- Destructor + virtual ~componentVelocityMotionSolver(); + + + // Member Functions + + //- 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/fvMotionSolver/fvMotionSolvers/displacement/displacementFvMotionSolver/displacementFvMotionSolver.C b/src/dynamicMesh/motionSolver/displacement/displacementMotionSolver.C similarity index 78% rename from src/fvMotionSolver/fvMotionSolvers/displacement/displacementFvMotionSolver/displacementFvMotionSolver.C rename to src/dynamicMesh/motionSolver/displacement/displacementMotionSolver.C index 690c4e1a5565b9e8c37d9a2af08c179e2fb6b30f..9330b5b35a39c6bd39650df827ae6f8ccfa3441b 100644 --- a/src/fvMotionSolver/fvMotionSolvers/displacement/displacementFvMotionSolver/displacementFvMotionSolver.C +++ b/src/dynamicMesh/motionSolver/displacement/displacementMotionSolver.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) 2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,27 +23,39 @@ License \*---------------------------------------------------------------------------*/ -#include "displacementFvMotionSolver.H" -#include "addToRunTimeSelectionTable.H" +#include "displacementMotionSolver.H" #include "mapPolyMesh.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { - defineTypeNameAndDebug(displacementFvMotionSolver, 0); + defineTypeNameAndDebug(displacementMotionSolver, 0); } // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::displacementFvMotionSolver::displacementFvMotionSolver +Foam::displacementMotionSolver::displacementMotionSolver ( const polyMesh& mesh, - Istream& + const IOdictionary& dict, + const word& type ) : - fvMotionSolver(mesh), + motionSolver(mesh, dict, type), + pointDisplacement_ + ( + IOobject + ( + "pointDisplacement", + mesh.time().timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + pointMesh::New(mesh) + ), points0_ ( pointIOField @@ -65,10 +77,11 @@ Foam::displacementFvMotionSolver::displacementFvMotionSolver { FatalErrorIn ( - "displacementFvMotionSolver::displacementFvMotionSolver\n" + "displacementMotionSolver::" + "displacementMotionSolver\n" "(\n" " const polyMesh&,\n" - " Istream&\n" + " const IOdictionary&\n" ")" ) << "Number of points in mesh " << mesh.nPoints() << " differs from number of points " << points0_.size() @@ -91,15 +104,23 @@ Foam::displacementFvMotionSolver::displacementFvMotionSolver // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // -Foam::displacementFvMotionSolver::~displacementFvMotionSolver() +Foam::displacementMotionSolver::~displacementMotionSolver() {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void Foam::displacementFvMotionSolver::updateMesh(const mapPolyMesh& mpm) +void Foam::displacementMotionSolver::movePoints(const pointField&) { - fvMotionSolver::updateMesh(mpm); + // No local data to update +} + + +void Foam::displacementMotionSolver::updateMesh(const mapPolyMesh& mpm) +{ + // pointMesh already updates pointFields. + + motionSolver::updateMesh(mpm); // Map points0_. Bit special since we somehow have to come up with // a sensible points0 position for introduced points. @@ -110,7 +131,7 @@ void Foam::displacementFvMotionSolver::updateMesh(const mapPolyMesh& mpm) ( mpm.hasMotionPoints() ? mpm.preMotionPoints() - : fvMesh_.points() + : mesh().points() ); // Note: boundBox does reduce @@ -147,8 +168,8 @@ void Foam::displacementFvMotionSolver::updateMesh(const mapPolyMesh& mpm) { FatalErrorIn ( - "displacementLaplacianFvMotionSolver::updateMesh" - "(const mapPolyMesh& mpm)" + "displacementMotionSolver::updateMesh" + "(const mapPolyMesh&)" ) << "Cannot work out coordinates of introduced vertices." << " New vertex " << pointI << " at coordinate " << points[pointI] << exit(FatalError); diff --git a/src/dynamicMesh/motionSolver/displacement/displacementMotionSolver.H b/src/dynamicMesh/motionSolver/displacement/displacementMotionSolver.H new file mode 100644 index 0000000000000000000000000000000000000000..ad7aa193b9a925953bb61ab15953610829fda4f5 --- /dev/null +++ b/src/dynamicMesh/motionSolver/displacement/displacementMotionSolver.H @@ -0,0 +1,148 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 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/>. + +Class + Foam::displacementMotionSolver + +Description + Virtual base class for displacement motion solver + + The boundary displacement is set as a boundary condition + on the pointDisplacement pointVectorField. + +SourceFiles + displacementMotionSolver.C + +\*---------------------------------------------------------------------------*/ + +#ifndef displacementMotionSolver_H +#define displacementMotionSolver_H + +#include "motionSolver.H" +#include "pointFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +class mapPolyMesh; + +/*---------------------------------------------------------------------------*\ + Class displacementMotionSolver Declaration +\*---------------------------------------------------------------------------*/ + +class displacementMotionSolver +: + public motionSolver +{ +protected: + + // Protected data + + //- Point motion field + mutable pointVectorField pointDisplacement_; + +private: + + // Private data + + //- Starting points + pointField points0_; + + + // Private Member Functions + + //- Disallow default bitwise copy construct + displacementMotionSolver + ( + const displacementMotionSolver& + ); + + //- Disallow default bitwise assignment + void operator=(const displacementMotionSolver&); + +public: + + //- Runtime type information + TypeName("displacementMotionSolver"); + + + // Constructors + + //- Construct from mesh and dictionary + displacementMotionSolver + ( + const polyMesh&, + const IOdictionary&, + const word& type + ); + + + //- Destructor + virtual ~displacementMotionSolver(); + + + // 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() + { + return pointDisplacement_; + } + + //- Return const reference to the point motion displacement field + const pointVectorField& pointDisplacement() const + { + return pointDisplacement_; + } + + //- 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/dynamicMesh/motionSolver/motionSolver.C b/src/dynamicMesh/motionSolver/motionSolver/motionSolver.C similarity index 77% rename from src/dynamicMesh/motionSolver/motionSolver.C rename to src/dynamicMesh/motionSolver/motionSolver/motionSolver.C index 1f54ef61e699b6a2d13bfab3d3c64a7afc85a4e1..eab2208764e0598c2ed80ee2dae5d534f84c83b9 100644 --- a/src/dynamicMesh/motionSolver/motionSolver.C +++ b/src/dynamicMesh/motionSolver/motionSolver/motionSolver.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -36,6 +36,26 @@ namespace Foam defineRunTimeSelectionTable(motionSolver, dictionary); } +// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // + +Foam::IOobject Foam::motionSolver::stealRegistration +( + const IOdictionary& dict +) +{ + IOobject io(dict); + if (dict.registerObject()) + { + // De-register if necessary + const_cast<IOdictionary&>(dict).checkOut(); + + io.registerObject() = true; + } + + return io; +} + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::motionSolver::motionSolver(const polyMesh& mesh) @@ -56,26 +76,29 @@ Foam::motionSolver::motionSolver(const polyMesh& mesh) {} -// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // +Foam::motionSolver::motionSolver +( + const polyMesh& mesh, + const IOdictionary& dict, + const word& type +) +: + IOdictionary(stealRegistration(dict), dict), + mesh_(mesh), + twoDPointCorrector_(mesh), + coeffDict_(dict.subDict(type + "Coeffs")) +{} -Foam::autoPtr<Foam::motionSolver> Foam::motionSolver::New(const polyMesh& mesh) -{ - IOdictionary solverDict - ( - IOobject - ( - "dynamicMeshDict", - mesh.time().constant(), - mesh, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE, - false - ) - ); - Istream& msData = solverDict.lookup("solver"); +// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // - const word solverTypeName(msData); +Foam::autoPtr<Foam::motionSolver> Foam::motionSolver::New +( + const polyMesh& mesh, + const IOdictionary& solverDict +) +{ + const word solverTypeName(solverDict.lookup("solver")); Info<< "Selecting motion solver: " << solverTypeName << endl; @@ -102,7 +125,7 @@ Foam::autoPtr<Foam::motionSolver> Foam::motionSolver::New(const polyMesh& mesh) { FatalErrorIn ( - "motionSolver::New(const polyMesh& mesh)" + "motionSolver::New(const polyMesh&)" ) << "Unknown solver type " << solverTypeName << nl << nl << "Valid solver types are:" << endl @@ -110,7 +133,25 @@ Foam::autoPtr<Foam::motionSolver> Foam::motionSolver::New(const polyMesh& mesh) << exit(FatalError); } - return autoPtr<motionSolver>(cstrIter()(mesh, msData)); + return autoPtr<motionSolver>(cstrIter()(mesh, solverDict)); +} + + +Foam::autoPtr<Foam::motionSolver> Foam::motionSolver::New(const polyMesh& mesh) +{ + IOdictionary solverDict + ( + IOobject + ( + "dynamicMeshDict", + mesh.time().constant(), + mesh, + IOobject::MUST_READ_IF_MODIFIED, + IOobject::NO_WRITE + ) + ); + + return New(mesh, solverDict); } diff --git a/src/dynamicMesh/motionSolver/motionSolver.H b/src/dynamicMesh/motionSolver/motionSolver/motionSolver.H similarity index 73% rename from src/dynamicMesh/motionSolver/motionSolver.H rename to src/dynamicMesh/motionSolver/motionSolver/motionSolver.H index 97e6d246826ba3695de867ae2efbe6daaf83c373..1c71d537b654775346f8916134b24e2cec3a0585 100644 --- a/src/dynamicMesh/motionSolver/motionSolver.H +++ b/src/dynamicMesh/motionSolver/motionSolver/motionSolver.H @@ -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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -56,6 +56,7 @@ class motionSolver : public IOdictionary { + private: // Private data @@ -66,6 +67,14 @@ private: //- 2-D motion corrector pointer twoDPointCorrector twoDPointCorrector_; + //- Model coefficients dictionary + dictionary coeffDict_; + + + // Private Member Functions + + //- De-register object if registered and assign to current + static IOobject stealRegistration(const IOdictionary& dict); public: @@ -80,15 +89,19 @@ public: autoPtr, motionSolver, dictionary, - (const polyMesh& mesh, Istream& msData), - (mesh, msData) + (const polyMesh& mesh, const IOdictionary& dict), + (mesh, dict) ); // Selectors //- Select constructed from polyMesh - static autoPtr<motionSolver> New(const polyMesh& mesh); + static autoPtr<motionSolver> New(const polyMesh&); + + //- Select constructed from polyMesh and dictionary. If dictionary + // was registered this will 'steal' that registration. + static autoPtr<motionSolver> New(const polyMesh&, const IOdictionary&); // Constructors @@ -96,6 +109,14 @@ public: //- Construct from polyMesh motionSolver(const polyMesh& mesh); + //- Construct from polyMesh and dictionary and type. + motionSolver + ( + const polyMesh& mesh, + const IOdictionary&, + const word& type + ); + //- Destructor virtual ~motionSolver(); @@ -109,6 +130,12 @@ public: return mesh_; } + //- Const access to the coefficients dictionary + const dictionary& coeffDict() const + { + return coeffDict_; + } + //- Provide new points for motion. Solves for motion virtual tmp<pointField> newPoints(); @@ -120,7 +147,10 @@ public: //- Solve for motion virtual void solve() = 0; - //- Update topology + //- Update local data for geometry changes + virtual void movePoints(const pointField&) = 0; + + //- Update local data for topology changes virtual void updateMesh(const mapPolyMesh&) = 0; }; diff --git a/src/fvMotionSolver/fvMotionSolvers/fvMotionSolver/fvMotionSolver.C b/src/dynamicMesh/motionSolver/velocity/velocityMotionSolver.C similarity index 64% rename from src/fvMotionSolver/fvMotionSolvers/fvMotionSolver/fvMotionSolver.C rename to src/dynamicMesh/motionSolver/velocity/velocityMotionSolver.C index 6c2a0c591ac44eae8d8edd777ae05409cf5a0385..35f9924b497e7a97f000b05bc23562e2acfe67b7 100644 --- a/src/fvMotionSolver/fvMotionSolvers/fvMotionSolver/fvMotionSolver.C +++ b/src/dynamicMesh/motionSolver/velocity/velocityMotionSolver.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) 2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,44 +23,61 @@ License \*---------------------------------------------------------------------------*/ -#include "fvMotionSolver.H" -#include "volPointInterpolation.H" +#include "velocityMotionSolver.H" +#include "mapPolyMesh.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { - defineTypeNameAndDebug(fvMotionSolver, 0); + defineTypeNameAndDebug(velocityMotionSolver, 0); } // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::fvMotionSolver::fvMotionSolver(const polyMesh& mesh) +Foam::velocityMotionSolver::velocityMotionSolver +( + const polyMesh& mesh, + const IOdictionary& dict, + const word& type +) : - motionSolver(mesh), - fvMesh_(refCast<const fvMesh>(mesh)) + motionSolver(mesh, dict, type), + pointMotionU_ + ( + IOobject + ( + "pointMotionU", + mesh.time().timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + pointMesh::New(mesh) + ) {} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // -Foam::fvMotionSolver::~fvMotionSolver() +Foam::velocityMotionSolver::~velocityMotionSolver() {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void Foam::fvMotionSolver::movePoints(const pointField& p) +void Foam::velocityMotionSolver::movePoints(const pointField& p) { - // Movement of pointMesh and volPointInterpolation done by polyMesh,fvMesh + // No local data that needs adapting. } -void Foam::fvMotionSolver::updateMesh(const mapPolyMesh& mpm) +void Foam::velocityMotionSolver::updateMesh(const mapPolyMesh& mpm) { + // pointMesh already updates pointFields. + motionSolver::updateMesh(mpm); - // Update of pointMesh and volPointInterpolation done by polyMesh,fvMesh } diff --git a/src/fvMotionSolver/fvMotionSolvers/displacement/displacementFvMotionSolver/displacementFvMotionSolver.H b/src/dynamicMesh/motionSolver/velocity/velocityMotionSolver.H similarity index 58% rename from src/fvMotionSolver/fvMotionSolvers/displacement/displacementFvMotionSolver/displacementFvMotionSolver.H rename to src/dynamicMesh/motionSolver/velocity/velocityMotionSolver.H index d69c6a1e73dec9d4a09b267fbe5d4982f3cfc29f..a9a5c160d1afc4d29949930ef3de8fdd56d1cf84 100644 --- a/src/fvMotionSolver/fvMotionSolvers/displacement/displacementFvMotionSolver/displacementFvMotionSolver.H +++ b/src/dynamicMesh/motionSolver/velocity/velocityMotionSolver.H @@ -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) 2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -22,81 +22,99 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::displacementFvMotionSolver + Foam::velocityMotionSolver Description - Base class for fvMotionSolvers which calculate displacement. + Virtual base class for velocity motion solver + + The boundary displacement is set as a boundary condition + on the pointMotionU pointVectorField. SourceFiles - displacementFvMotionSolver.C + velocityMotionSolver.C \*---------------------------------------------------------------------------*/ -#ifndef displacementFvMotionSolver_H -#define displacementFvMotionSolver_H +#ifndef velocityMotionSolver_H +#define velocityMotionSolver_H -#include "fvMotionSolver.H" +#include "motionSolver.H" +#include "pointFields.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { +class mapPolyMesh; + /*---------------------------------------------------------------------------*\ - Class displacementFvMotionSolver Declaration + Class velocityMotionSolver Declaration \*---------------------------------------------------------------------------*/ -class displacementFvMotionSolver +class velocityMotionSolver : - public fvMotionSolver + public motionSolver { - // Private data +protected: - //- Reference point field - pointField points0_; + // Protected data + //- Point motion field + mutable pointVectorField pointMotionU_; + +private: // Private Member Functions //- Disallow default bitwise copy construct - displacementFvMotionSolver + velocityMotionSolver ( - const displacementFvMotionSolver& + const velocityMotionSolver& ); //- Disallow default bitwise assignment - void operator=(const displacementFvMotionSolver&); - + void operator=(const velocityMotionSolver&); public: //- Runtime type information - TypeName("displacementInterpolation"); + TypeName("velocityMotionSolver"); // Constructors - //- Construct from polyMesh and data stream - displacementFvMotionSolver + //- Construct from mesh and dictionary + velocityMotionSolver ( const polyMesh&, - Istream& msDataUnused + const IOdictionary&, + const word& type ); //- Destructor - ~displacementFvMotionSolver(); + virtual ~velocityMotionSolver(); // Member Functions - //- Return reference to the reference field - const pointField& points0() const + //- Return reference to the point motion velocity field + pointVectorField& pointMotionU() { - return points0_; + return pointMotionU_; } - //- Update topology + //- Return const reference to the point motion velocity field + const pointVectorField& pointMotionU() const + { + return pointMotionU_; + } + + //- 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/Make/files b/src/fvMotionSolver/Make/files index cdaf67e6afa5fe670d13d35b24faf34c2c619560..13204042afb597b5c4005b49f21391fb00f1b8df 100644 --- a/src/fvMotionSolver/Make/files +++ b/src/fvMotionSolver/Make/files @@ -1,14 +1,13 @@ -fvMotionSolvers/fvMotionSolver/fvMotionSolver.C -fvMotionSolvers/velocity/laplacian/velocityLaplacianFvMotionSolver.C -fvMotionSolvers/displacement/displacementFvMotionSolver/displacementFvMotionSolver.C -fvMotionSolvers/displacement/layeredSolver/displacementLayeredMotionFvMotionSolver.C -fvMotionSolvers/displacement/layeredSolver/pointEdgeStructuredWalk.C -fvMotionSolvers/displacement/interpolation/displacementInterpolationFvMotionSolver.C -fvMotionSolvers/displacement/laplacian/displacementLaplacianFvMotionSolver.C +fvMotionSolvers/fvMotionSolverCore/fvMotionSolverCore.C fvMotionSolvers/displacement/SBRStress/displacementSBRStressFvMotionSolver.C +fvMotionSolvers/displacement/laplacian/displacementLaplacianFvMotionSolver.C +fvMotionSolvers/displacement/interpolation/displacementInterpolationMotionSolver.C +fvMotionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.C +fvMotionSolvers/displacement/layeredSolver/pointEdgeStructuredWalk.C -fvMotionSolvers/velocity/componentLaplacian/velocityComponentLaplacianFvMotionSolver.C -fvMotionSolvers/displacement/componentLaplacian/displacementComponentLaplacianFvMotionSolver.C +fvMotionSolvers/componentDisplacement/componentLaplacian/displacementComponentLaplacianFvMotionSolver.C +fvMotionSolvers/velocity/laplacian/velocityLaplacianFvMotionSolver.C +fvMotionSolvers/componentVelocity/componentLaplacian/velocityComponentLaplacianFvMotionSolver.C motionDiffusivity/motionDiffusivity/motionDiffusivity.C motionDiffusivity/uniform/uniformDiffusivity.C diff --git a/src/fvMotionSolver/fvMotionSolvers/displacement/componentLaplacian/displacementComponentLaplacianFvMotionSolver.C b/src/fvMotionSolver/fvMotionSolvers/componentDisplacement/componentLaplacian/displacementComponentLaplacianFvMotionSolver.C similarity index 56% rename from src/fvMotionSolver/fvMotionSolvers/displacement/componentLaplacian/displacementComponentLaplacianFvMotionSolver.C rename to src/fvMotionSolver/fvMotionSolvers/componentDisplacement/componentLaplacian/displacementComponentLaplacianFvMotionSolver.C index 72b183cecdba3c33bafab2c71089825d8cc82e37..2e369a3d9cd3feddbbdd3bc38734a80075983850 100644 --- a/src/fvMotionSolver/fvMotionSolvers/displacement/componentLaplacian/displacementComponentLaplacianFvMotionSolver.C +++ b/src/fvMotionSolver/fvMotionSolvers/componentDisplacement/componentLaplacian/displacementComponentLaplacianFvMotionSolver.C @@ -38,87 +38,24 @@ namespace Foam addToRunTimeSelectionTable ( - fvMotionSolver, + motionSolver, displacementComponentLaplacianFvMotionSolver, dictionary ); } -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -Foam::direction Foam::displacementComponentLaplacianFvMotionSolver::cmpt -( - const word& cmptName -) const -{ - if (cmptName == "x") - { - return vector::X; - } - else if (cmptName == "y") - { - return vector::Y; - } - else if (cmptName == "z") - { - return vector::Z; - } - else - { - FatalErrorIn - ( - "displacementComponentLaplacianFvMotionSolver::" - "displacementComponentLaplacianFvMotionSolver" - "(const polyMesh& mesh, Istream& msData)" - ) << "Given component name " << cmptName << " should be x, y or z" - << exit(FatalError); - - return 0; - } -} - - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::displacementComponentLaplacianFvMotionSolver:: displacementComponentLaplacianFvMotionSolver ( const polyMesh& mesh, - Istream& msData + const IOdictionary& dict ) : - fvMotionSolver(mesh), - cmptName_(msData), - cmpt_(cmpt(cmptName_)), - points0_ - ( - pointIOField - ( - IOobject - ( - "points", - time().constant(), - polyMesh::meshSubDir, - mesh, - IOobject::MUST_READ, - IOobject::NO_WRITE, - false - ) - ).component(cmpt_) - ), - pointDisplacement_ - ( - IOobject - ( - "pointDisplacement" + cmptName_, - fvMesh_.time().timeName(), - fvMesh_, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - pointMesh::New(fvMesh_) - ), + componentDisplacementMotionSolver(mesh, dict, type()), + fvMotionSolverCore(mesh), cellDisplacement_ ( IOobject @@ -141,75 +78,48 @@ displacementComponentLaplacianFvMotionSolver pointLocation_(NULL), diffusivityPtr_ ( - motionDiffusivity::New(fvMesh_, lookup("diffusivity")) + motionDiffusivity::New(fvMesh_, coeffDict().lookup("diffusivity")) ), frozenPointsZone_ ( - found("frozenPointsZone") - ? fvMesh_.pointZones().findZoneID(lookup("frozenPointsZone")) + coeffDict().found("frozenPointsZone") + ? fvMesh_.pointZones().findZoneID(coeffDict().lookup("frozenPointsZone")) : -1 ) { - if (points0_.size() != mesh.nPoints()) - { - FatalErrorIn - ( - "displacementComponentLaplacianFvMotionSolver::" - "displacementComponentLaplacianFvMotionSolver\n" - "(\n" - " const polyMesh&,\n" - " Istream&\n" - ")" - ) << "Number of points in mesh " << mesh.nPoints() - << " differs from number of points " << points0_.size() - << " read from file " - << - IOobject - ( - "points", - mesh.time().constant(), - polyMesh::meshSubDir, - mesh, - IOobject::MUST_READ, - IOobject::NO_WRITE, - false - ).filePath() - << exit(FatalError); - } - - - IOobject io + Switch applyPointLocation ( - "pointLocation", - fvMesh_.time().timeName(), - fvMesh_, - IOobject::MUST_READ, - IOobject::AUTO_WRITE + coeffDict().lookupOrDefault + ( + "applyPointLocation", + true + ) ); - if (debug) - { - Info<< "displacementComponentLaplacianFvMotionSolver:" << nl - << " diffusivity : " << diffusivityPtr_().type() << nl - << " frozenPoints zone : " << frozenPointsZone_ << endl; - } - - if (io.headerOk()) + if (applyPointLocation) { pointLocation_.reset ( new pointVectorField ( - io, + IOobject + ( + "pointLocation", + fvMesh_.time().timeName(), + fvMesh_, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), pointMesh::New(fvMesh_) ) ); - if (debug) + //if (debug) { Info<< "displacementComponentLaplacianFvMotionSolver :" << " Read pointVectorField " - << io.name() << " to be used for boundary conditions on points." + << pointLocation_().name() + << " to be used for boundary conditions on points." << nl << "Boundary conditions:" << pointLocation_().boundaryField().types() << endl; @@ -305,10 +215,22 @@ Foam::displacementComponentLaplacianFvMotionSolver::curPoints() const } +//void Foam::displacementComponentLaplacianFvMotionSolver::movePoints +//( +// const pointField& p +//) +//{ +// // Movement of pointMesh and volPointInterpolation already +// // done by polyMesh,fvMesh +// componentDisplacementMotionSolver::movePoints(p); +// +//} + + void Foam::displacementComponentLaplacianFvMotionSolver::solve() { // The points have moved so before interpolation update - // the fvMotionSolver accordingly + // the motionSolver accordingly movePoints(fvMesh_.points()); diffusivityPtr_->correct(); @@ -331,64 +253,16 @@ void Foam::displacementComponentLaplacianFvMotionSolver::updateMesh const mapPolyMesh& mpm ) { - fvMotionSolver::updateMesh(mpm); - - // Map points0_. Bit special since we somehow have to come up with - // a sensible points0 position for introduced points. - // Find out scaling between points0 and current points - - // Get the new points either from the map or the mesh - const scalarField points - ( - mpm.hasMotionPoints() - ? mpm.preMotionPoints().component(cmpt_) - : fvMesh_.points().component(cmpt_) - ); - - // Get extents of points0 and points and determine scale - const scalar scale = - (gMax(points0_)-gMin(points0_)) - /(gMax(points)-gMin(points)); - - scalarField newPoints0(mpm.pointMap().size()); - - forAll(newPoints0, pointI) - { - label oldPointI = mpm.pointMap()[pointI]; - - if (oldPointI >= 0) - { - label masterPointI = mpm.reversePointMap()[oldPointI]; - - if (masterPointI == pointI) - { - newPoints0[pointI] = points0_[oldPointI]; - } - else - { - // New point. Assume motion is scaling. - newPoints0[pointI] = - points0_[oldPointI] - + scale*(points[pointI]-points[masterPointI]); - } - } - else - { - FatalErrorIn - ( - "displacementLaplacianFvMotionSolver::updateMesh" - "(const mapPolyMesh& mpm)" - ) << "Cannot work out coordinates of introduced vertices." - << " New vertex " << pointI << " at coordinate " - << points[pointI] << exit(FatalError); - } - } - points0_.transfer(newPoints0); + componentDisplacementMotionSolver::updateMesh(mpm); // Update diffusivity. Note two stage to make sure old one is de-registered // before creating/registering new one. diffusivityPtr_.reset(NULL); - diffusivityPtr_ = motionDiffusivity::New(fvMesh_, lookup("diffusivity")); + diffusivityPtr_ = motionDiffusivity::New + ( + fvMesh_, + coeffDict().lookup("diffusivity") + ); } diff --git a/src/fvMotionSolver/fvMotionSolvers/displacement/componentLaplacian/displacementComponentLaplacianFvMotionSolver.H b/src/fvMotionSolver/fvMotionSolvers/componentDisplacement/componentLaplacian/displacementComponentLaplacianFvMotionSolver.H similarity index 86% rename from src/fvMotionSolver/fvMotionSolvers/displacement/componentLaplacian/displacementComponentLaplacianFvMotionSolver.H rename to src/fvMotionSolver/fvMotionSolvers/componentDisplacement/componentLaplacian/displacementComponentLaplacianFvMotionSolver.H index 65e3824b3d1eb67b862c037755013e953db4be0a..513a4a8515145df3ac13fe2a59f45a611475e87d 100644 --- a/src/fvMotionSolver/fvMotionSolvers/displacement/componentLaplacian/displacementComponentLaplacianFvMotionSolver.H +++ b/src/fvMotionSolver/fvMotionSolvers/componentDisplacement/componentLaplacian/displacementComponentLaplacianFvMotionSolver.H @@ -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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -36,7 +36,8 @@ SourceFiles #ifndef displacementComponentLaplacianFvMotionSolver_H #define displacementComponentLaplacianFvMotionSolver_H -#include "fvMotionSolver.H" +#include "componentDisplacementMotionSolver.H" +#include "fvMotionSolverCore.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -52,22 +53,11 @@ class motionDiffusivity; class displacementComponentLaplacianFvMotionSolver : - public fvMotionSolver + public componentDisplacementMotionSolver, + public fvMotionSolverCore { // Private data - //- The component name to solve for - word cmptName_; - - //- The component to solve for - direction cmpt_; - - //- Reference point field for this component - scalarField points0_; - - //- Point motion field - mutable pointScalarField pointDisplacement_; - //- Cell-centre motion field mutable volScalarField cellDisplacement_; @@ -106,11 +96,11 @@ public: // Constructors - //- Construct from polyMesh and data stream + //- Construct from polyMesh and IOdictionary displacementComponentLaplacianFvMotionSolver ( const polyMesh&, - Istream& msData + const IOdictionary& ); @@ -120,12 +110,6 @@ public: // Member Functions - //- Return reference to the reference field - const scalarField& points0() const - { - return points0_; - } - //- Non-const access to the cellDisplacement in order to allow // changes to the boundary motion volScalarField& cellDisplacement() @@ -141,6 +125,10 @@ public: //- Update topology virtual void updateMesh(const mapPolyMesh&); + +// //- Handle changes of geometry +// virtual void movePoints(const pointField& p); + }; diff --git a/src/fvMotionSolver/fvMotionSolvers/velocity/componentLaplacian/velocityComponentLaplacianFvMotionSolver.C b/src/fvMotionSolver/fvMotionSolvers/componentVelocity/componentLaplacian/velocityComponentLaplacianFvMotionSolver.C similarity index 78% rename from src/fvMotionSolver/fvMotionSolvers/velocity/componentLaplacian/velocityComponentLaplacianFvMotionSolver.C rename to src/fvMotionSolver/fvMotionSolvers/componentVelocity/componentLaplacian/velocityComponentLaplacianFvMotionSolver.C index e7cd44d761556dcbb1f1c937b0076d101ed2aad0..3bf50dae4657259baf4573c14ded6489cd2d084d 100644 --- a/src/fvMotionSolver/fvMotionSolvers/velocity/componentLaplacian/velocityComponentLaplacianFvMotionSolver.C +++ b/src/fvMotionSolver/fvMotionSolvers/componentVelocity/componentLaplacian/velocityComponentLaplacianFvMotionSolver.C @@ -37,7 +37,7 @@ namespace Foam addToRunTimeSelectionTable ( - fvMotionSolver, + motionSolver, velocityComponentLaplacianFvMotionSolver, dictionary ); @@ -50,24 +50,11 @@ Foam::velocityComponentLaplacianFvMotionSolver:: velocityComponentLaplacianFvMotionSolver ( const polyMesh& mesh, - Istream& msData + const IOdictionary& dict ) : - fvMotionSolver(mesh), - cmptName_(msData), - cmpt_(0), - pointMotionU_ - ( - IOobject - ( - "pointMotionU" + cmptName_, - fvMesh_.time().timeName(), - fvMesh_, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - pointMesh::New(fvMesh_) - ), + componentVelocityMotionSolver(mesh, dict, typeName), + fvMotionSolverCore(mesh), cellMotionU_ ( IOobject @@ -89,32 +76,9 @@ velocityComponentLaplacianFvMotionSolver ), diffusivityPtr_ ( - motionDiffusivity::New(fvMesh_, lookup("diffusivity")) + motionDiffusivity::New(fvMesh_, coeffDict().lookup("diffusivity")) ) -{ - if (cmptName_ == "x") - { - cmpt_ = vector::X; - } - else if (cmptName_ == "y") - { - cmpt_ = vector::Y; - } - else if (cmptName_ == "z") - { - cmpt_ = vector::Z; - } - else - { - FatalErrorIn - ( - "velocityComponentLaplacianFvMotionSolver::" - "velocityComponentLaplacianFvMotionSolver" - "(const polyMesh& mesh, Istream& msData)" - ) << "Given component name " << cmptName_ << " should be x, y or z" - << exit(FatalError); - } -} +{} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // @@ -171,17 +135,31 @@ void Foam::velocityComponentLaplacianFvMotionSolver::solve() } +//void Foam::velocityComponentLaplacianFvMotionSolver::movePoints +//( +// const pointField& p +//) +//{ +// // Movement of pointMesh and volPointInterpolation already +// // done by polyMesh,fvMesh +//} + + void Foam::velocityComponentLaplacianFvMotionSolver::updateMesh ( const mapPolyMesh& mpm ) { - fvMotionSolver::updateMesh(mpm); + componentVelocityMotionSolver::updateMesh(mpm); // Update diffusivity. Note two stage to make sure old one is de-registered // before creating/registering new one. diffusivityPtr_.reset(NULL); - diffusivityPtr_ = motionDiffusivity::New(fvMesh_, lookup("diffusivity")); + diffusivityPtr_ = motionDiffusivity::New + ( + fvMesh_, + coeffDict().lookup("diffusivity") + ); } diff --git a/src/fvMotionSolver/fvMotionSolvers/velocity/componentLaplacian/velocityComponentLaplacianFvMotionSolver.H b/src/fvMotionSolver/fvMotionSolvers/componentVelocity/componentLaplacian/velocityComponentLaplacianFvMotionSolver.H similarity index 88% rename from src/fvMotionSolver/fvMotionSolvers/velocity/componentLaplacian/velocityComponentLaplacianFvMotionSolver.H rename to src/fvMotionSolver/fvMotionSolvers/componentVelocity/componentLaplacian/velocityComponentLaplacianFvMotionSolver.H index 37e601b1463fa7a4b7d67483be268d560124237a..91beca1caae31f524a5658d2aea9d8bcf742a2d5 100644 --- a/src/fvMotionSolver/fvMotionSolvers/velocity/componentLaplacian/velocityComponentLaplacianFvMotionSolver.H +++ b/src/fvMotionSolver/fvMotionSolvers/componentVelocity/componentLaplacian/velocityComponentLaplacianFvMotionSolver.H @@ -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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -36,7 +36,8 @@ SourceFiles #ifndef velocityComponentLaplacianFvMotionSolver_H #define velocityComponentLaplacianFvMotionSolver_H -#include "fvMotionSolver.H" +#include "componentVelocityMotionSolver.H" +#include "fvMotionSolverCore.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -52,19 +53,11 @@ class motionDiffusivity; class velocityComponentLaplacianFvMotionSolver : - public fvMotionSolver + public componentVelocityMotionSolver, + public fvMotionSolverCore { // Private data - //- The component name to solve for - word cmptName_; - - //- The component to solve for - direction cmpt_; - - //- Point motion field - mutable pointScalarField pointMotionU_; - //- Cell-centre motion field mutable volScalarField cellMotionU_; @@ -92,11 +85,11 @@ public: // Constructors - //- Construct from polyMesh and data stream (provides component) + //- Construct from polyMesh and IOdictionary velocityComponentLaplacianFvMotionSolver ( const polyMesh&, - Istream& msData + const IOdictionary& ); @@ -121,6 +114,9 @@ public: //- Update topology virtual void updateMesh(const mapPolyMesh&); + +// //- Handle changes of geometry +// void movePoints(const pointField& p); }; diff --git a/src/fvMotionSolver/fvMotionSolvers/displacement/SBRStress/displacementSBRStressFvMotionSolver.H b/src/fvMotionSolver/fvMotionSolvers/displacement/SBRStress/displacementSBRStressFvMotionSolver.H index 403114ada9e315a2b6554dd3225c108a90eac713..e356609410826b986eeaee5e572dd3338c89cf61 100644 --- a/src/fvMotionSolver/fvMotionSolvers/displacement/SBRStress/displacementSBRStressFvMotionSolver.H +++ b/src/fvMotionSolver/fvMotionSolvers/displacement/SBRStress/displacementSBRStressFvMotionSolver.H @@ -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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -36,7 +36,8 @@ SourceFiles #ifndef displacementSBRStressFvMotionSolver_H #define displacementSBRStressFvMotionSolver_H -#include "displacementFvMotionSolver.H" +#include "displacementMotionSolver.H" +#include "fvMotionSolverCore.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -52,13 +53,12 @@ class motionDiffusivity; class displacementSBRStressFvMotionSolver : - public displacementFvMotionSolver +// public displacementFvMotionSolver + public displacementMotionSolver, + public fvMotionSolverCore { // Private data - //- Point motion field - mutable pointVectorField pointDisplacement_; - //- Cell-centre motion field mutable volVectorField cellDisplacement_; @@ -86,11 +86,11 @@ public: // Constructors - //- Construct from polyMesh and data stream + //- Construct from polyMesh and IOdictionary displacementSBRStressFvMotionSolver ( const polyMesh&, - Istream& msDataUnused + const IOdictionary& ); @@ -100,18 +100,6 @@ public: // Member Functions - //- Return reference to the point motion displacement field - pointVectorField& pointDisplacement() - { - return pointDisplacement_; - } - - //- Return const reference to the point motion displacement field - const pointVectorField& pointDisplacement() const - { - return pointDisplacement_; - } - //- Return reference to the cell motion displacement field volVectorField& cellDisplacement() { @@ -130,6 +118,9 @@ public: //- Solve for motion virtual void solve(); +// //- Update the pointMesh corresponding to the new points +// void movePoints(const pointField&); + //- Update topology virtual void updateMesh(const mapPolyMesh&); }; diff --git a/src/fvMotionSolver/fvMotionSolvers/displacement/interpolation/displacementInterpolationFvMotionSolver.C b/src/fvMotionSolver/fvMotionSolvers/displacement/interpolation/displacementInterpolationMotionSolver.C similarity index 89% rename from src/fvMotionSolver/fvMotionSolvers/displacement/interpolation/displacementInterpolationFvMotionSolver.C rename to src/fvMotionSolver/fvMotionSolvers/displacement/interpolation/displacementInterpolationMotionSolver.C index b893de2fde459cecf3e6f96bbc90b959fe594d37..8b34742672bda53cd3b0a0c651f976fce8c26dd2 100644 --- a/src/fvMotionSolver/fvMotionSolvers/displacement/interpolation/displacementInterpolationFvMotionSolver.C +++ b/src/fvMotionSolver/fvMotionSolvers/displacement/interpolation/displacementInterpolationMotionSolver.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,7 +23,7 @@ License \*---------------------------------------------------------------------------*/ -#include "displacementInterpolationFvMotionSolver.H" +#include "displacementInterpolationMotionSolver.H" #include "addToRunTimeSelectionTable.H" #include "SortableList.H" #include "IOList.H" @@ -35,12 +35,12 @@ License namespace Foam { - defineTypeNameAndDebug(displacementInterpolationFvMotionSolver, 0); + defineTypeNameAndDebug(displacementInterpolationMotionSolver, 0); addToRunTimeSelectionTable ( - fvMotionSolver, - displacementInterpolationFvMotionSolver, + motionSolver, + displacementInterpolationMotionSolver, dictionary ); @@ -53,36 +53,21 @@ namespace Foam // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::displacementInterpolationFvMotionSolver:: -displacementInterpolationFvMotionSolver +Foam::displacementInterpolationMotionSolver:: +displacementInterpolationMotionSolver ( const polyMesh& mesh, - Istream& is + const IOdictionary& dict ) : - displacementFvMotionSolver(mesh, is), - dynamicMeshCoeffs_ - ( - IOdictionary - ( - IOobject - ( - "dynamicMeshDict", - mesh.time().constant(), - mesh, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE, - false - ) - ).subDict(typeName + "Coeffs") - ) + displacementMotionSolver(mesh, dict, typeName) { // Get zones and their interpolation tables for displacement // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ List<Pair<word> > faceZoneToTable ( - dynamicMeshCoeffs_.lookup("interpolationTables") + coeffDict().lookup("interpolationTables") ); const faceZoneMesh& fZones = mesh.faceZones(); @@ -99,8 +84,8 @@ displacementInterpolationFvMotionSolver { FatalErrorIn ( - "displacementInterpolationFvMotionSolver::" - "displacementInterpolationFvMotionSolver(const polyMesh&," + "displacementInterpolationMotionSolver::" + "displacementInterpolationMotionSolver(const polyMesh&," "Istream&)" ) << "Cannot find zone " << zoneName << endl << "Valid zones are " << mesh.faceZones().names() @@ -267,8 +252,8 @@ displacementInterpolationFvMotionSolver { FatalErrorIn ( - "displacementInterpolationFvMotionSolver::" - "displacementInterpolationFvMotionSolver" + "displacementInterpolationMotionSolver::" + "displacementInterpolationMotionSolver" "(const polyMesh&, Istream&)" ) << "Did not find point " << points0()[pointI] << " coordinate " << meshCoords[pointI] @@ -316,21 +301,21 @@ displacementInterpolationFvMotionSolver // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // -Foam::displacementInterpolationFvMotionSolver:: -~displacementInterpolationFvMotionSolver() +Foam::displacementInterpolationMotionSolver:: +~displacementInterpolationMotionSolver() {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // Foam::tmp<Foam::pointField> -Foam::displacementInterpolationFvMotionSolver::curPoints() const +Foam::displacementInterpolationMotionSolver::curPoints() const { if (mesh().nPoints() != points0().size()) { FatalErrorIn ( - "displacementInterpolationFvMotionSolver::curPoints() const" + "displacementInterpolationMotionSolver::curPoints() const" ) << "The number of points in the mesh seems to have changed." << endl << "In constant/polyMesh there are " << points0().size() << " points; in the current mesh there are " << mesh().nPoints() diff --git a/src/fvMotionSolver/fvMotionSolvers/displacement/interpolation/displacementInterpolationFvMotionSolver.H b/src/fvMotionSolver/fvMotionSolvers/displacement/interpolation/displacementInterpolationMotionSolver.H similarity index 79% rename from src/fvMotionSolver/fvMotionSolvers/displacement/interpolation/displacementInterpolationFvMotionSolver.H rename to src/fvMotionSolver/fvMotionSolvers/displacement/interpolation/displacementInterpolationMotionSolver.H index 24a1c376bf675eeb2ac7b48c1c4fddeff1b93c2a..ec49b1e2231b138a5ccdaa85bfe47a865dd149da 100644 --- a/src/fvMotionSolver/fvMotionSolvers/displacement/interpolation/displacementInterpolationFvMotionSolver.H +++ b/src/fvMotionSolver/fvMotionSolvers/displacement/interpolation/displacementInterpolationMotionSolver.H @@ -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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::displacementInterpolationFvMotionSolver + Foam::displacementInterpolationMotionSolver Description Mesh motion solver for an fvMesh. @@ -40,14 +40,14 @@ Note could be a motionSolver - does not use any fvMesh structure. SourceFiles - displacementInterpolationFvMotionSolver.C + displacementInterpolationMotionSolver.C \*---------------------------------------------------------------------------*/ -#ifndef displacementInterpolationFvMotionSolver_H -#define displacementInterpolationFvMotionSolver_H +#ifndef displacementInterpolationMotionSolver_H +#define displacementInterpolationMotionSolver_H -#include "displacementFvMotionSolver.H" +#include "displacementMotionSolver.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -55,19 +55,15 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class displacementInterpolationFvMotionSolver Declaration + Class displacementInterpolationMotionSolver Declaration \*---------------------------------------------------------------------------*/ -class displacementInterpolationFvMotionSolver +class displacementInterpolationMotionSolver : - public displacementFvMotionSolver + public displacementMotionSolver { // Private data - //- Additional settings for motion solver - dictionary dynamicMeshCoeffs_; - - // Face zone information (note: could pack these to only contain // used zones) @@ -94,13 +90,13 @@ class displacementInterpolationFvMotionSolver // Private Member Functions //- Disallow default bitwise copy construct - displacementInterpolationFvMotionSolver + displacementInterpolationMotionSolver ( - const displacementInterpolationFvMotionSolver& + const displacementInterpolationMotionSolver& ); //- Disallow default bitwise assignment - void operator=(const displacementInterpolationFvMotionSolver&); + void operator=(const displacementInterpolationMotionSolver&); public: @@ -111,16 +107,16 @@ public: // Constructors - //- Construct from polyMesh and data stream - displacementInterpolationFvMotionSolver + //- Construct from polyMesh and IOdictionary + displacementInterpolationMotionSolver ( const polyMesh&, - Istream& msDataUnused + const IOdictionary& dict ); //- Destructor - ~displacementInterpolationFvMotionSolver(); + ~displacementInterpolationMotionSolver(); // Member Functions diff --git a/src/fvMotionSolver/fvMotionSolvers/displacement/laplacian/displacementLaplacianFvMotionSolver.H b/src/fvMotionSolver/fvMotionSolvers/displacement/laplacian/displacementLaplacianFvMotionSolver.H index b3f2347bad8c3851ac82bc20b885819c2549d840..fbc440d8a86ec767050bfb75bd30a146e674e08c 100644 --- a/src/fvMotionSolver/fvMotionSolvers/displacement/laplacian/displacementLaplacianFvMotionSolver.H +++ b/src/fvMotionSolver/fvMotionSolvers/displacement/laplacian/displacementLaplacianFvMotionSolver.H @@ -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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -36,7 +36,8 @@ SourceFiles #ifndef displacementLaplacianFvMotionSolver_H #define displacementLaplacianFvMotionSolver_H -#include "displacementFvMotionSolver.H" +#include "displacementMotionSolver.H" +#include "fvMotionSolverCore.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -52,13 +53,12 @@ class motionDiffusivity; class displacementLaplacianFvMotionSolver : - public displacementFvMotionSolver +// public displacementFvMotionSolver + public displacementMotionSolver, + public fvMotionSolverCore { // Private data - //- Point motion field - mutable pointVectorField pointDisplacement_; - //- Cell-centre motion field mutable volVectorField cellDisplacement_; @@ -94,11 +94,11 @@ public: // Constructors - //- Construct from polyMesh and data stream + //- Construct from polyMesh and IOdictionary displacementLaplacianFvMotionSolver ( const polyMesh&, - Istream& msDataUnused + const IOdictionary& ); @@ -108,18 +108,6 @@ public: // Member Functions - //- Return reference to the point motion displacement field - pointVectorField& pointDisplacement() - { - return pointDisplacement_; - } - - //- Return const reference to the point motion displacement field - const pointVectorField& pointDisplacement() const - { - return pointDisplacement_; - } - //- Return reference to the cell motion displacement field volVectorField& cellDisplacement() { @@ -132,24 +120,15 @@ public: return cellDisplacement_; } - //- Return const reference to the diffusivity - const motionDiffusivity& diffusivity() const - { - return diffusivityPtr_(); - } - - //- Return reference to the diffusivity - motionDiffusivity& diffusivity() - { - return diffusivityPtr_(); - } - //- Return point location obtained from the current motion field virtual tmp<pointField> curPoints() const; //- Solve for motion virtual void solve(); +// //- Update the pointMesh corresponding to the new points +// void movePoints(const pointField&); + //- Update topology virtual void updateMesh(const mapPolyMesh&); }; diff --git a/src/fvMotionSolver/fvMotionSolvers/displacement/layeredSolver/displacementLayeredMotionFvMotionSolver.C b/src/fvMotionSolver/fvMotionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.C similarity index 87% rename from src/fvMotionSolver/fvMotionSolvers/displacement/layeredSolver/displacementLayeredMotionFvMotionSolver.C rename to src/fvMotionSolver/fvMotionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.C index 76e850a515a44c46eb66488a1717c3a3af1a3f3a..f491ee586d78e25e5b1fa96f866d14f45560ff56 100644 --- a/src/fvMotionSolver/fvMotionSolvers/displacement/layeredSolver/displacementLayeredMotionFvMotionSolver.C +++ b/src/fvMotionSolver/fvMotionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,7 +23,7 @@ License \*---------------------------------------------------------------------------*/ -#include "displacementLayeredMotionFvMotionSolver.H" +#include "displacementLayeredMotionMotionSolver.H" #include "addToRunTimeSelectionTable.H" #include "pointEdgeStructuredWalk.H" #include "pointFields.H" @@ -35,12 +35,12 @@ License namespace Foam { - defineTypeNameAndDebug(displacementLayeredMotionFvMotionSolver, 0); + defineTypeNameAndDebug(displacementLayeredMotionMotionSolver, 0); addToRunTimeSelectionTable ( - fvMotionSolver, - displacementLayeredMotionFvMotionSolver, + motionSolver, + displacementLayeredMotionMotionSolver, dictionary ); } @@ -48,7 +48,7 @@ namespace Foam // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -void Foam::displacementLayeredMotionFvMotionSolver::calcZoneMask +void Foam::displacementLayeredMotionMotionSolver::calcZoneMask ( const label cellZoneI, PackedBoolList& isZonePoint, @@ -121,7 +121,7 @@ void Foam::displacementLayeredMotionFvMotionSolver::calcZoneMask // Find distance to starting point -void Foam::displacementLayeredMotionFvMotionSolver::walkStructured +void Foam::displacementLayeredMotionMotionSolver::walkStructured ( const label cellZoneI, const PackedBoolList& isZonePoint, @@ -209,7 +209,7 @@ void Foam::displacementLayeredMotionFvMotionSolver::walkStructured // Evaluate faceZone patch Foam::tmp<Foam::vectorField> -Foam::displacementLayeredMotionFvMotionSolver::faceZoneEvaluate +Foam::displacementLayeredMotionMotionSolver::faceZoneEvaluate ( const faceZone& fz, const labelList& meshPoints, @@ -239,7 +239,7 @@ Foam::displacementLayeredMotionFvMotionSolver::faceZoneEvaluate { FatalIOErrorIn ( - "displacementLayeredMotionFvMotionSolver::faceZoneEvaluate(..)", + "displacementLayeredMotionMotionSolver::faceZoneEvaluate(..)", *this ) << "slip can only be used on second faceZonePatch of pair." << "FaceZone:" << fz.name() @@ -257,7 +257,7 @@ Foam::displacementLayeredMotionFvMotionSolver::faceZoneEvaluate { FatalIOErrorIn ( - "displacementLayeredMotionFvMotionSolver::faceZoneEvaluate(..)", + "displacementLayeredMotionMotionSolver::faceZoneEvaluate(..)", *this ) << "Unknown faceZonePatch type " << type << " for faceZone " << fz.name() << exit(FatalIOError); @@ -266,7 +266,7 @@ Foam::displacementLayeredMotionFvMotionSolver::faceZoneEvaluate } -void Foam::displacementLayeredMotionFvMotionSolver::cellZoneSolve +void Foam::displacementLayeredMotionMotionSolver::cellZoneSolve ( const label cellZoneI, const dictionary& zoneDict @@ -282,7 +282,7 @@ void Foam::displacementLayeredMotionFvMotionSolver::cellZoneSolve { FatalIOErrorIn ( - "displacementLayeredMotionFvMotionSolver::" + "displacementLayeredMotionMotionSolver::" "correctBoundaryConditions(..)", *this ) << "Can only handle 2 faceZones (= patches) per cellZone. " @@ -304,7 +304,7 @@ void Foam::displacementLayeredMotionFvMotionSolver::cellZoneSolve { FatalIOErrorIn ( - "displacementLayeredMotionFvMotionSolver::" + "displacementLayeredMotionMotionSolver::" "correctBoundaryConditions(..)", *this ) << "Cannot find faceZone " << faceZoneName @@ -476,26 +476,14 @@ Info<< "For cellZone:" << cellZoneI // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::displacementLayeredMotionFvMotionSolver:: -displacementLayeredMotionFvMotionSolver +Foam::displacementLayeredMotionMotionSolver:: +displacementLayeredMotionMotionSolver ( const polyMesh& mesh, - Istream& is + const IOdictionary& dict ) : - displacementFvMotionSolver(mesh, is), - pointDisplacement_ - ( - IOobject - ( - "pointDisplacement", - fvMesh_.time().timeName(), - fvMesh_, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - pointMesh::New(fvMesh_) - ) + displacementMotionSolver(mesh, dict, typeName) { pointDisplacement_.correctBoundaryConditions(); } @@ -503,15 +491,15 @@ displacementLayeredMotionFvMotionSolver // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // -Foam::displacementLayeredMotionFvMotionSolver:: -~displacementLayeredMotionFvMotionSolver() +Foam::displacementLayeredMotionMotionSolver:: +~displacementLayeredMotionMotionSolver() {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // Foam::tmp<Foam::pointField> -Foam::displacementLayeredMotionFvMotionSolver::curPoints() const +Foam::displacementLayeredMotionMotionSolver::curPoints() const { tmp<pointField> tcurPoints ( @@ -520,27 +508,19 @@ Foam::displacementLayeredMotionFvMotionSolver::curPoints() const twoDCorrectPoints(tcurPoints()); -// const pointField& pts = tcurPoints(); -// forAll(pts, pointI) -// { -// Info<< " from:" << mesh().points()[pointI] -// << " to:" << pts[pointI] -// << endl; -// } - - return tcurPoints; } -void Foam::displacementLayeredMotionFvMotionSolver::solve() +void Foam::displacementLayeredMotionMotionSolver::solve() { - const dictionary& ms = mesh().lookupObject<motionSolver>("dynamicMeshDict"); - const dictionary& solverDict = ms.subDict(typeName + "Coeffs"); + // The points have moved so before interpolation update + // the motionSolver accordingly + movePoints(mesh().points()); // Apply all regions (=cellZones) - const dictionary& regionDicts = solverDict.subDict("regions"); + const dictionary& regionDicts = coeffDict().subDict("regions"); forAllConstIter(dictionary, regionDicts, regionIter) { const word& cellZoneName = regionIter().keyword(); @@ -555,7 +535,7 @@ void Foam::displacementLayeredMotionFvMotionSolver::solve() { FatalIOErrorIn ( - "displacementLayeredMotionFvMotionSolver::solve(..)", + "displacementLayeredMotionMotionSolver::solve(..)", *this ) << "Cannot find cellZone " << cellZoneName << endl << "Valid zones are " << mesh().cellZones().names() @@ -567,12 +547,12 @@ void Foam::displacementLayeredMotionFvMotionSolver::solve() } -void Foam::displacementLayeredMotionFvMotionSolver::updateMesh +void Foam::displacementLayeredMotionMotionSolver::updateMesh ( const mapPolyMesh& mpm ) { - displacementFvMotionSolver::updateMesh(mpm); + displacementMotionSolver::updateMesh(mpm); } diff --git a/src/fvMotionSolver/fvMotionSolvers/displacement/layeredSolver/displacementLayeredMotionFvMotionSolver.H b/src/fvMotionSolver/fvMotionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.H similarity index 77% rename from src/fvMotionSolver/fvMotionSolvers/displacement/layeredSolver/displacementLayeredMotionFvMotionSolver.H rename to src/fvMotionSolver/fvMotionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.H index ccd5bf0f3b89e451c392b8f5517b6ca2f80c77c6..0f29c4f88fd84b46bbf12ecea0a95ea7cd8ca228 100644 --- a/src/fvMotionSolver/fvMotionSolvers/displacement/layeredSolver/displacementLayeredMotionFvMotionSolver.H +++ b/src/fvMotionSolver/fvMotionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.H @@ -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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::displacementLayeredMotionFvMotionSolver + Foam::displacementLayeredMotionMotionSolver Description Mesh motion solver for an (multi-block) extruded fvMesh. Gets given the @@ -52,14 +52,14 @@ Description specified by the first faceZone. (= removes the normal component). SourceFiles - displacementLayeredMotionFvMotionSolver.C + displacementLayeredMotionMotionSolver.C \*---------------------------------------------------------------------------*/ -#ifndef displacementLayeredMotionFvMotionSolver_H -#define displacementLayeredMotionFvMotionSolver_H +#ifndef displacementLayeredMotionMotionSolver_H +#define displacementLayeredMotionMotionSolver_H -#include "displacementFvMotionSolver.H" +#include "displacementMotionSolver.H" #include "PackedBoolList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -70,19 +70,13 @@ namespace Foam // Forward class declarations /*---------------------------------------------------------------------------*\ - Class displacementLayeredMotionFvMotionSolver Declaration + Class displacementLayeredMotionMotionSolver Declaration \*---------------------------------------------------------------------------*/ -class displacementLayeredMotionFvMotionSolver +class displacementLayeredMotionMotionSolver : - public displacementFvMotionSolver + public displacementMotionSolver { - // Private data - - //- Point motion field - mutable pointVectorField pointDisplacement_; - - // Private Member Functions void calcZoneMask @@ -120,13 +114,13 @@ class displacementLayeredMotionFvMotionSolver //- Disallow default bitwise copy construct - displacementLayeredMotionFvMotionSolver + displacementLayeredMotionMotionSolver ( - const displacementLayeredMotionFvMotionSolver& + const displacementLayeredMotionMotionSolver& ); //- Disallow default bitwise assignment - void operator=(const displacementLayeredMotionFvMotionSolver&); + void operator=(const displacementLayeredMotionMotionSolver&); public: @@ -137,32 +131,20 @@ public: // Constructors - //- Construct from polyMesh and data stream - displacementLayeredMotionFvMotionSolver + //- Construct from polyMesh and IOdictionary + displacementLayeredMotionMotionSolver ( const polyMesh&, - Istream& msDataUnused + const IOdictionary& ); //- Destructor - ~displacementLayeredMotionFvMotionSolver(); + ~displacementLayeredMotionMotionSolver(); // Member Functions - //- Return reference to the point motion displacement field - pointVectorField& pointDisplacement() - { - return pointDisplacement_; - } - - //- Return const reference to the point motion displacement field - const pointVectorField& pointDisplacement() const - { - return pointDisplacement_; - } - //- Return point location obtained from the current motion field virtual tmp<pointField> curPoints() const; diff --git a/src/fvMotionSolver/fvMotionSolvers/fvMotionSolverCore/fvMotionSolverCore.C b/src/fvMotionSolver/fvMotionSolvers/fvMotionSolverCore/fvMotionSolverCore.C new file mode 100644 index 0000000000000000000000000000000000000000..3a1cc5273ffebcd1116e163ac2a4dcacba9e4882 --- /dev/null +++ b/src/fvMotionSolver/fvMotionSolvers/fvMotionSolverCore/fvMotionSolverCore.C @@ -0,0 +1,44 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 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 "fvMotionSolverCore.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(fvMotionSolverCore, 0); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::fvMotionSolverCore::fvMotionSolverCore(const polyMesh& mesh) +: + fvMesh_(refCast<const fvMesh>(mesh)) +{} + + +// ************************************************************************* // diff --git a/src/fvMotionSolver/fvMotionSolvers/fvMotionSolver/fvMotionSolver.H b/src/fvMotionSolver/fvMotionSolvers/fvMotionSolverCore/fvMotionSolverCore.H similarity index 69% rename from src/fvMotionSolver/fvMotionSolvers/fvMotionSolver/fvMotionSolver.H rename to src/fvMotionSolver/fvMotionSolvers/fvMotionSolverCore/fvMotionSolverCore.H index cb54b877a2388546fcb841c4ef9cc80499d932d4..b91dd80121a07a11c6ff5003f97fb10b84d69e9a 100644 --- a/src/fvMotionSolver/fvMotionSolvers/fvMotionSolver/fvMotionSolver.H +++ b/src/fvMotionSolver/fvMotionSolvers/fvMotionSolverCore/fvMotionSolverCore.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -22,40 +22,31 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::fvMotionSolver + Foam::fvMotionSolverCore Description - Virtual base class for finite volume mesh motion solvers. - - The boundary motion is set as a boundary condition on the motion velocity - variable motionU. + Base class for fvMesh based motionSolvers. SourceFiles - fvMotionSolver.C + fvMotionSolverCore.C \*---------------------------------------------------------------------------*/ -#ifndef fvMotionSolver_H -#define fvMotionSolver_H +#ifndef fvMotionSolverCore_H +#define fvMotionSolverCore_H -#include "motionSolver.H" -#include "pointFieldsFwd.H" +#include "fvMesh.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { -class fvMesh; -class mapPolyMesh; - /*---------------------------------------------------------------------------*\ - Class fvMotionSolver Declaration + Class velocityMotionSolver Declaration \*---------------------------------------------------------------------------*/ -class fvMotionSolver -: - public motionSolver +class fvMotionSolverCore { protected: @@ -77,21 +68,15 @@ protected: GeometricBoundaryField& pmUbf ) const; - public: //- Runtime type information - TypeName("fvMotionSolver"); - + ClassName("displacementMotionSolver"); // Constructors //- Construct from polyMesh - fvMotionSolver(const polyMesh& mesh); - - - //- Destructor - virtual ~fvMotionSolver(); + fvMotionSolverCore(const polyMesh&); // Member Functions @@ -101,18 +86,6 @@ public: { return fvMesh_; } - - //- Return point location obtained from the current motion field - virtual tmp<pointField> curPoints() const = 0; - - //- Solve for motion - virtual void solve() = 0; - - //- Update the pointMesh corresponding to the new points - virtual void movePoints(const pointField&); - - //- Update the mesh corresponding to given map - virtual void updateMesh(const mapPolyMesh&); }; @@ -123,7 +96,7 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #ifdef NoRepository -# include "fvMotionSolverTemplates.C" +# include "fvMotionSolverCoreTemplates.C" #endif // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/fvMotionSolver/fvMotionSolvers/fvMotionSolver/fvMotionSolverTemplates.C b/src/fvMotionSolver/fvMotionSolvers/fvMotionSolverCore/fvMotionSolverCoreTemplates.C similarity index 92% rename from src/fvMotionSolver/fvMotionSolvers/fvMotionSolver/fvMotionSolverTemplates.C rename to src/fvMotionSolver/fvMotionSolvers/fvMotionSolverCore/fvMotionSolverCoreTemplates.C index b102b252f0d77422852b0b520dbc59ef7a8ee91c..71dbdaa69f2c3bfeb62cf317941296a25001d91d 100644 --- a/src/fvMotionSolver/fvMotionSolvers/fvMotionSolver/fvMotionSolverTemplates.C +++ b/src/fvMotionSolver/fvMotionSolvers/fvMotionSolverCore/fvMotionSolverCoreTemplates.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) 2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,14 +23,14 @@ License \*---------------------------------------------------------------------------*/ -#include "fvMotionSolver.H" +#include "fvMotionSolverCore.H" #include "fixedValuePointPatchFields.H" #include "cellMotionFvPatchFields.H" // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // template<class Type> -Foam::wordList Foam::fvMotionSolver::cellMotionBoundaryTypes +Foam::wordList Foam::fvMotionSolverCore::cellMotionBoundaryTypes ( const typename GeometricField<Type, pointPatchField, pointMesh>:: GeometricBoundaryField& pmUbf diff --git a/src/fvMotionSolver/fvMotionSolvers/velocity/laplacian/velocityLaplacianFvMotionSolver.C b/src/fvMotionSolver/fvMotionSolvers/velocity/laplacian/velocityLaplacianFvMotionSolver.C index 2b31b3759b9bacbf0d320fe76dee6aa102330005..ce63274ed9fc8a25dfab738bde02878932a521ba 100644 --- a/src/fvMotionSolver/fvMotionSolvers/velocity/laplacian/velocityLaplacianFvMotionSolver.C +++ b/src/fvMotionSolver/fvMotionSolvers/velocity/laplacian/velocityLaplacianFvMotionSolver.C @@ -37,7 +37,7 @@ namespace Foam addToRunTimeSelectionTable ( - fvMotionSolver, + motionSolver, velocityLaplacianFvMotionSolver, dictionary ); @@ -49,22 +49,11 @@ namespace Foam Foam::velocityLaplacianFvMotionSolver::velocityLaplacianFvMotionSolver ( const polyMesh& mesh, - Istream& + const IOdictionary& dict ) : - fvMotionSolver(mesh), - pointMotionU_ - ( - IOobject - ( - "pointMotionU", - fvMesh_.time().timeName(), - fvMesh_, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - pointMesh::New(fvMesh_) - ), + velocityMotionSolver(mesh, dict, typeName), + fvMotionSolverCore(mesh), cellMotionU_ ( IOobject @@ -86,7 +75,7 @@ Foam::velocityLaplacianFvMotionSolver::velocityLaplacianFvMotionSolver ), diffusivityPtr_ ( - motionDiffusivity::New(fvMesh_, lookup("diffusivity")) + motionDiffusivity::New(fvMesh_, coeffDict().lookup("diffusivity")) ) {} @@ -141,17 +130,28 @@ void Foam::velocityLaplacianFvMotionSolver::solve() } +//void Foam::velocityLaplacianFvMotionSolver::movePoints(const pointField& p) +//{ +// // Movement of pointMesh and volPointInterpolation already +// // done by polyMesh,fvMesh +//} + + void Foam::velocityLaplacianFvMotionSolver::updateMesh ( const mapPolyMesh& mpm ) { - fvMotionSolver::updateMesh(mpm); + velocityMotionSolver::updateMesh(mpm); // Update diffusivity. Note two stage to make sure old one is de-registered // before creating/registering new one. diffusivityPtr_.reset(NULL); - diffusivityPtr_ = motionDiffusivity::New(mesh(), lookup("diffusivity")); + diffusivityPtr_ = motionDiffusivity::New + ( + fvMesh_, + coeffDict().lookup("diffusivity") + ); } diff --git a/src/fvMotionSolver/fvMotionSolvers/velocity/laplacian/velocityLaplacianFvMotionSolver.H b/src/fvMotionSolver/fvMotionSolvers/velocity/laplacian/velocityLaplacianFvMotionSolver.H index 774cb960b7e8c15c7718bea5166f25c81791a7e0..0cea80657705f8d77935c467dbdeb5b4c60b15ae 100644 --- a/src/fvMotionSolver/fvMotionSolvers/velocity/laplacian/velocityLaplacianFvMotionSolver.H +++ b/src/fvMotionSolver/fvMotionSolvers/velocity/laplacian/velocityLaplacianFvMotionSolver.H @@ -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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -36,7 +36,8 @@ SourceFiles #ifndef velocityLaplacianFvMotionSolver_H #define velocityLaplacianFvMotionSolver_H -#include "fvMotionSolver.H" +#include "velocityMotionSolver.H" +#include "fvMotionSolverCore.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -52,13 +53,11 @@ class motionDiffusivity; class velocityLaplacianFvMotionSolver : - public fvMotionSolver + public velocityMotionSolver, + public fvMotionSolverCore { // Private data - //- Point motion field - mutable pointVectorField pointMotionU_; - //- Cell-centre motion field mutable volVectorField cellMotionU_; @@ -86,11 +85,11 @@ public: // Constructors - //- Construct from polyMesh and data stream + //- Construct from polyMesh and IOdictionary velocityLaplacianFvMotionSolver ( const polyMesh&, - Istream& msDataUnused + const IOdictionary& ); @@ -100,18 +99,6 @@ public: // Member Functions - //- Return reference to the point motion velocity field - pointVectorField& pointMotionU() - { - return pointMotionU_; - } - - //- Return const reference to the point motion velocity field - const pointVectorField& pointMotionU() const - { - return pointMotionU_; - } - //- Return reference to the cell motion velocity field volVectorField& cellMotionU() { @@ -130,6 +117,9 @@ public: //- Solve for motion virtual void solve(); +// //- Update the pointMesh corresponding to the new points +// void movePoints(const pointField&); + //- Update topology virtual void updateMesh(const mapPolyMesh&); }; diff --git a/src/fvMotionSolver/motionDiffusivity/motionDirectional/motionDirectionalDiffusivity.C b/src/fvMotionSolver/motionDiffusivity/motionDirectional/motionDirectionalDiffusivity.C index 3fc5d48c5a61ee346836f77210582316573685e8..1943c09a98444ef1ad1f6b2c70d65aa6763d4222 100644 --- a/src/fvMotionSolver/motionDiffusivity/motionDirectional/motionDirectionalDiffusivity.C +++ b/src/fvMotionSolver/motionDiffusivity/motionDirectional/motionDirectionalDiffusivity.C @@ -27,7 +27,7 @@ License #include "surfaceInterpolate.H" #include "zeroGradientFvPatchFields.H" #include "addToRunTimeSelectionTable.H" -#include "fvMotionSolver.H" +#include "velocityMotionSolver.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -96,10 +96,10 @@ void Foam::motionDirectionalDiffusivity::correct() { first = false; - const fvMotionSolver& mSolver = - mesh().lookupObject<fvMotionSolver>("dynamicMeshDict"); + const velocityMotionSolver& mSolver = + mesh().lookupObject<velocityMotionSolver>("dynamicMeshDict"); - const_cast<fvMotionSolver&>(mSolver).solve(); + const_cast<velocityMotionSolver&>(mSolver).solve(); correct(); } } diff --git a/src/fvMotionSolver/pointPatchFields/derived/surfaceDisplacement/surfaceDisplacementPointPatchVectorField.C b/src/fvMotionSolver/pointPatchFields/derived/surfaceDisplacement/surfaceDisplacementPointPatchVectorField.C index 2f9ce5528ca0f9486eabe404bf8953e62505a0fa..8a3cd26b68b5501a79d192de54e8f70983f1b171 100644 --- a/src/fvMotionSolver/pointPatchFields/derived/surfaceDisplacement/surfaceDisplacementPointPatchVectorField.C +++ b/src/fvMotionSolver/pointPatchFields/derived/surfaceDisplacement/surfaceDisplacementPointPatchVectorField.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -28,7 +28,7 @@ License #include "Time.H" #include "transformField.H" #include "fvMesh.H" -#include "displacementLaplacianFvMotionSolver.H" +#include "displacementMotionSolver.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -95,7 +95,7 @@ void surfaceDisplacementPointPatchVectorField::calcProjection } // Get the starting locations from the motionSolver - const pointField& points0 = mesh.lookupObject<displacementFvMotionSolver> + const pointField& points0 = mesh.lookupObject<displacementMotionSolver> ( "dynamicMeshDict" ).points0(); diff --git a/src/fvMotionSolver/pointPatchFields/derived/surfaceDisplacement/surfaceDisplacementPointPatchVectorField.H b/src/fvMotionSolver/pointPatchFields/derived/surfaceDisplacement/surfaceDisplacementPointPatchVectorField.H index 9a743f170793625ed9cd1e294caee29358c10ac1..786e452a46fb4bee90205bced029f9a0e790d954 100644 --- a/src/fvMotionSolver/pointPatchFields/derived/surfaceDisplacement/surfaceDisplacementPointPatchVectorField.H +++ b/src/fvMotionSolver/pointPatchFields/derived/surfaceDisplacement/surfaceDisplacementPointPatchVectorField.H @@ -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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -26,7 +26,7 @@ Class Description Displacement fixed by projection onto triSurface. - Use in a displacement fvMotionSolver + Use in a displacementMotionSolver as a bc on the pointDisplacement field. Calculates the projection onto the surface according diff --git a/src/fvMotionSolver/pointPatchFields/derived/surfaceSlipDisplacement/surfaceSlipDisplacementPointPatchVectorField.C b/src/fvMotionSolver/pointPatchFields/derived/surfaceSlipDisplacement/surfaceSlipDisplacementPointPatchVectorField.C index 2af01d6e47656160c45cbcb1651f5dec17a7d978..c56a28135139bd8b2782db62946f1130d7382103 100644 --- a/src/fvMotionSolver/pointPatchFields/derived/surfaceSlipDisplacement/surfaceSlipDisplacementPointPatchVectorField.C +++ b/src/fvMotionSolver/pointPatchFields/derived/surfaceSlipDisplacement/surfaceSlipDisplacementPointPatchVectorField.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -28,7 +28,7 @@ License #include "Time.H" #include "transformField.H" #include "fvMesh.H" -#include "displacementFvMotionSolver.H" +#include "displacementMotionSolver.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -94,7 +94,7 @@ void surfaceSlipDisplacementPointPatchVectorField::calcProjection } // Get the starting locations from the motionSolver - const pointField& points0 = mesh.lookupObject<displacementFvMotionSolver> + const pointField& points0 = mesh.lookupObject<displacementMotionSolver> ( "dynamicMeshDict" ).points0(); diff --git a/src/fvMotionSolver/pointPatchFields/derived/surfaceSlipDisplacement/surfaceSlipDisplacementPointPatchVectorField.H b/src/fvMotionSolver/pointPatchFields/derived/surfaceSlipDisplacement/surfaceSlipDisplacementPointPatchVectorField.H index cb1a9cc50fd78e9898007381d3f621972d0e0b06..3115c3af3e33fc0a8db9c0c3b408e010c0fe5f32 100644 --- a/src/fvMotionSolver/pointPatchFields/derived/surfaceSlipDisplacement/surfaceSlipDisplacementPointPatchVectorField.H +++ b/src/fvMotionSolver/pointPatchFields/derived/surfaceSlipDisplacement/surfaceSlipDisplacementPointPatchVectorField.H @@ -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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,7 +25,7 @@ Class Foam::surfaceSlipDisplacementPointPatchVectorField Description - Displacement follows a triSurface. Use in a displacement fvMotionSolver + Displacement follows a triSurface. Use in a displacementMotionSolver as a bc on the pointDisplacement field. Following is done by calculating the projection onto the surface according to the projectMode