From a1a225c504668080332f11aa366c9eedd48f640e Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Thu, 21 Mar 2019 10:58:31 +0000 Subject: [PATCH] dynamicFvMesh: Rationalised the handling and caching of the dynamicMeshDict The base dynamicFvMesh now reads and stores the dynamicMeshDict and motion solver receive it as a constructor argument. Also rationalised the motionSolver diffusivity classes in which storing the faceDiffusivity field provided no advantage; now it is created and returned on demand. --- .../mesh/manipulation/moveMesh/moveMesh.C | 16 ++- .../dynamicFvMesh/dynamicFvMesh.C | 32 +++++- .../dynamicFvMesh/dynamicFvMesh.H | 18 +++- .../dynamicFvMesh/dynamicFvMeshNew.C | 18 +--- .../dynamicInkJetFvMesh/dynamicInkJetFvMesh.C | 18 +--- .../dynamicInterpolatedFvMesh.C | 18 +--- .../dynamicMotionSolverFvMesh.C | 4 +- .../dynamicMotionSolverFvMesh.H | 17 ++- .../dynamicRefineFvMesh/dynamicRefineFvMesh.C | 35 +----- .../componentDisplacementMotionSolver.C | 6 +- .../componentDisplacementMotionSolver.H | 4 +- .../componentVelocityMotionSolver.C | 4 +- .../componentVelocityMotionSolver.H | 4 +- .../displacement/displacementMotionSolver.C | 6 +- .../displacement/displacementMotionSolver.H | 4 +- .../displacementInterpolationMotionSolver.C | 4 +- .../displacementInterpolationMotionSolver.H | 6 +- .../displacementLayeredMotionMotionSolver.C | 24 ++--- .../displacementLayeredMotionMotionSolver.H | 6 +- .../displacementLinearMotionMotionSolver.C | 6 +- .../displacementLinearMotionMotionSolver.H | 6 +- .../points0/points0MotionSolver.C | 8 +- .../points0/points0MotionSolver.H | 4 +- .../interpolatingSolidBodyMotionSolver.C | 4 +- .../interpolatingSolidBodyMotionSolver.H | 6 +- .../multiSolidBodyMotionSolver.C | 4 +- .../multiSolidBodyMotionSolver.H | 4 +- .../solidBodyMotionSolver.C | 4 +- .../solidBodyMotionSolver.H | 4 +- .../motionSolvers/motionSolver/motionSolver.C | 101 +----------------- .../motionSolvers/motionSolver/motionSolver.H | 40 +------ .../motionSolverList/motionSolverList.C | 2 +- .../motionSolverList/motionSolverList.H | 2 +- .../velocity/velocityMotionSolver.C | 4 +- .../velocity/velocityMotionSolver.H | 4 +- src/fvMotionSolver/Make/options | 4 +- ...lacementComponentLaplacianFvMotionSolver.C | 4 +- ...lacementComponentLaplacianFvMotionSolver.H | 6 +- ...velocityComponentLaplacianFvMotionSolver.C | 4 +- ...velocityComponentLaplacianFvMotionSolver.H | 6 +- .../displacementSBRStressFvMotionSolver.C | 4 +- .../displacementSBRStressFvMotionSolver.H | 6 +- .../displacementLaplacianFvMotionSolver.C | 4 +- .../displacementLaplacianFvMotionSolver.H | 6 +- .../velocityLaplacianFvMotionSolver.C | 4 +- .../velocityLaplacianFvMotionSolver.H | 6 +- .../directional/directionalDiffusivity.C | 21 ++-- .../directional/directionalDiffusivity.H | 12 +-- .../inverseDistanceDiffusivity.C | 21 ++-- .../inverseDistanceDiffusivity.H | 12 +-- .../inverseFaceDistanceDiffusivity.C | 47 +++++--- .../inverseFaceDistanceDiffusivity.H | 12 +-- .../inversePointDistanceDiffusivity.C | 43 ++++++-- .../inversePointDistanceDiffusivity.H | 12 +-- .../inverseVolume/inverseVolumeDiffusivity.C | 19 ++-- .../inverseVolume/inverseVolumeDiffusivity.H | 12 +-- .../motionDiffusivity/motionDiffusivity.H | 12 ++- .../motionDirectionalDiffusivity.C | 42 +++++--- .../motionDirectionalDiffusivity.H | 12 +-- .../uniform/uniformDiffusivity.C | 42 +++++--- .../uniform/uniformDiffusivity.H | 24 +---- ...surfaceDisplacementPointPatchVectorField.C | 13 +-- ...aceSlipDisplacementPointPatchVectorField.C | 13 +-- .../displacementMeshMoverMotionSolver.C | 8 +- .../displacementMeshMoverMotionSolver.H | 6 +- .../rigidBodyMeshMotion/rigidBodyMeshMotion.C | 54 ++-------- .../rigidBodyMeshMotion/rigidBodyMeshMotion.H | 16 +-- .../rigidBodyMeshMotionSolver.C | 54 ++-------- .../rigidBodyMeshMotionSolver.H | 16 +-- .../sixDoFRigidBodyMotionSolver.C | 58 ++-------- .../sixDoFRigidBodyMotionSolver.H | 18 +--- .../linearValveFvMesh/linearValveFvMesh.C | 21 +--- .../linearValveLayersFvMesh.C | 19 +--- .../mixerFvMesh/mixerFvMesh.C | 18 +--- .../movingConeTopoFvMesh.C | 18 +--- 75 files changed, 447 insertions(+), 729 deletions(-) diff --git a/applications/utilities/mesh/manipulation/moveMesh/moveMesh.C b/applications/utilities/mesh/manipulation/moveMesh/moveMesh.C index 8577543a1f..87217c43f3 100644 --- a/applications/utilities/mesh/manipulation/moveMesh/moveMesh.C +++ b/applications/utilities/mesh/manipulation/moveMesh/moveMesh.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -40,12 +40,22 @@ using namespace Foam; int main(int argc, char *argv[]) { - #include "setRootCase.H" #include "createTime.H" #include "createMesh.H" - autoPtr motionPtr = motionSolver::New(mesh); + IOdictionary dynamicMeshDict + ( + IOobject + ( + "dynamicMeshDict", + mesh.time().constant(), + mesh, + IOobject::MUST_READ + ) + ); + + autoPtr motionPtr = motionSolver::New(mesh, dynamicMeshDict); while (runTime.loop()) { diff --git a/src/dynamicFvMesh/dynamicFvMesh/dynamicFvMesh.C b/src/dynamicFvMesh/dynamicFvMesh/dynamicFvMesh.C index 8129e8b8b5..2decc020ed 100644 --- a/src/dynamicFvMesh/dynamicFvMesh/dynamicFvMesh.C +++ b/src/dynamicFvMesh/dynamicFvMesh/dynamicFvMesh.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -33,11 +33,33 @@ namespace Foam defineRunTimeSelectionTable(dynamicFvMesh, IOobject); } + +// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // + +Foam::IOobject Foam::dynamicFvMesh::dynamicMeshDictIOobject(const IOobject& io) +{ + // defaultRegion (region0) gets loaded from constant, other ones get loaded + // from constant/. Normally we'd use polyMesh::dbDir() but we + // haven't got a polyMesh yet ... + return IOobject + ( + "dynamicMeshDict", + io.time().constant(), + (io.name() == polyMesh::defaultRegion ? "" : io.name()), + io.db(), + IOobject::READ_IF_PRESENT, + IOobject::NO_WRITE, + false + ); +} + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::dynamicFvMesh::dynamicFvMesh(const IOobject& io) : - fvMesh(io) + fvMesh(io), + dynamicMeshDict_(IOdictionary(dynamicMeshDictIOobject(io))) {} @@ -59,7 +81,8 @@ Foam::dynamicFvMesh::dynamicFvMesh allOwner, allNeighbour, syncPar - ) + ), + dynamicMeshDict_(IOdictionary(dynamicMeshDictIOobject(io))) {} @@ -79,7 +102,8 @@ Foam::dynamicFvMesh::dynamicFvMesh faces, cells, syncPar - ) + ), + dynamicMeshDict_(IOdictionary(dynamicMeshDictIOobject(io))) {} diff --git a/src/dynamicFvMesh/dynamicFvMesh/dynamicFvMesh.H b/src/dynamicFvMesh/dynamicFvMesh/dynamicFvMesh.H index ee9ee95c6d..af4e920b15 100644 --- a/src/dynamicFvMesh/dynamicFvMesh/dynamicFvMesh.H +++ b/src/dynamicFvMesh/dynamicFvMesh/dynamicFvMesh.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -51,8 +51,17 @@ class dynamicFvMesh : public fvMesh { + // Private data + + //- The dynamicMeshDict + dictionary dynamicMeshDict_; + + // Private Member Functions + //- Return the dynamicMeshDict IOobject + static IOobject dynamicMeshDictIOobject(const IOobject& io); + //- Disallow default bitwise copy construct dynamicFvMesh(const dynamicFvMesh&); @@ -121,6 +130,12 @@ public: // Member Functions + //- Return the dynamicMeshDict + const dictionary& dynamicMeshDict() const + { + return dynamicMeshDict_; + } + //- Is mesh dynamic virtual bool dynamic() const { @@ -131,6 +146,7 @@ public: virtual bool update() = 0; }; + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/dynamicFvMesh/dynamicFvMesh/dynamicFvMeshNew.C b/src/dynamicFvMesh/dynamicFvMesh/dynamicFvMeshNew.C index ace82e3453..61fca62743 100644 --- a/src/dynamicFvMesh/dynamicFvMesh/dynamicFvMeshNew.C +++ b/src/dynamicFvMesh/dynamicFvMesh/dynamicFvMeshNew.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -29,21 +29,7 @@ License Foam::autoPtr Foam::dynamicFvMesh::New(const IOobject& io) { - // Note: - do not register the dictionary since dynamicFvMeshes themselves - // do this. - // - defaultRegion (region0) gets loaded from constant, other ones - // get loaded from constant/. Normally we'd use - // polyMesh::dbDir() but we haven't got a polyMesh yet ... - IOobject dictHeader - ( - "dynamicMeshDict", - io.time().constant(), - (io.name() == polyMesh::defaultRegion ? "" : io.name()), - io.db(), - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE, - false - ); + IOobject dictHeader(dynamicMeshDictIOobject(io)); if (dictHeader.typeHeaderOk(true)) { diff --git a/src/dynamicFvMesh/dynamicInkJetFvMesh/dynamicInkJetFvMesh.C b/src/dynamicFvMesh/dynamicInkJetFvMesh/dynamicInkJetFvMesh.C index c2b1c8760c..2a8b362bdb 100644 --- a/src/dynamicFvMesh/dynamicInkJetFvMesh/dynamicInkJetFvMesh.C +++ b/src/dynamicFvMesh/dynamicInkJetFvMesh/dynamicInkJetFvMesh.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -42,21 +42,7 @@ namespace Foam Foam::dynamicInkJetFvMesh::dynamicInkJetFvMesh(const IOobject& io) : dynamicFvMesh(io), - dynamicMeshCoeffs_ - ( - IOdictionary - ( - IOobject - ( - "dynamicMeshDict", - io.time().constant(), - *this, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE, - false - ) - ).optionalSubDict(typeName + "Coeffs") - ), + dynamicMeshCoeffs_(dynamicMeshDict().optionalSubDict(typeName + "Coeffs")), amplitude_(readScalar(dynamicMeshCoeffs_.lookup("amplitude"))), frequency_(readScalar(dynamicMeshCoeffs_.lookup("frequency"))), refPlaneX_(readScalar(dynamicMeshCoeffs_.lookup("refPlaneX"))), diff --git a/src/dynamicFvMesh/dynamicInterpolatedFvMesh/dynamicInterpolatedFvMesh.C b/src/dynamicFvMesh/dynamicInterpolatedFvMesh/dynamicInterpolatedFvMesh.C index 73e4610fd1..f0ec4d435a 100644 --- a/src/dynamicFvMesh/dynamicInterpolatedFvMesh/dynamicInterpolatedFvMesh.C +++ b/src/dynamicFvMesh/dynamicInterpolatedFvMesh/dynamicInterpolatedFvMesh.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -47,21 +47,7 @@ namespace Foam Foam::dynamicInterpolatedFvMesh::dynamicInterpolatedFvMesh(const IOobject& io) : dynamicFvMesh(io), - dynamicMeshCoeffs_ - ( - IOdictionary - ( - IOobject - ( - "dynamicMeshDict", - io.time().constant(), - *this, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE, - false - ) - ).optionalSubDict(typeName + "Coeffs") - ), + dynamicMeshCoeffs_(dynamicMeshDict().optionalSubDict(typeName + "Coeffs")), pointInterpolator_(*this, dynamicMeshCoeffs_), displacement_(dynamicMeshCoeffs_.lookup("displacement")), points0_ diff --git a/src/dynamicFvMesh/dynamicMotionSolverFvMesh/dynamicMotionSolverFvMesh.C b/src/dynamicFvMesh/dynamicMotionSolverFvMesh/dynamicMotionSolverFvMesh.C index 068a328e3e..479fef52df 100644 --- a/src/dynamicFvMesh/dynamicMotionSolverFvMesh/dynamicMotionSolverFvMesh.C +++ b/src/dynamicFvMesh/dynamicMotionSolverFvMesh/dynamicMotionSolverFvMesh.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -47,7 +47,7 @@ namespace Foam Foam::dynamicMotionSolverFvMesh::dynamicMotionSolverFvMesh(const IOobject& io) : dynamicFvMesh(io), - motionPtr_(motionSolver::New(*this)) + motionPtr_(motionSolver::New(*this, dynamicMeshDict())) {} diff --git a/src/dynamicFvMesh/dynamicMotionSolverFvMesh/dynamicMotionSolverFvMesh.H b/src/dynamicFvMesh/dynamicMotionSolverFvMesh/dynamicMotionSolverFvMesh.H index 40ee6a06e2..a218eb510d 100644 --- a/src/dynamicFvMesh/dynamicMotionSolverFvMesh/dynamicMotionSolverFvMesh.H +++ b/src/dynamicFvMesh/dynamicMotionSolverFvMesh/dynamicMotionSolverFvMesh.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -44,6 +44,21 @@ namespace Foam class motionSolver; +class velocityMotionCorrection +{ + // Private data + + wordList velocityFields_; + +public: + + velocityMotionCorrection(const dictionary& dict) + : + velocityFields_(dict.lookup("velocityFields")) + {} +}; + + /*---------------------------------------------------------------------------*\ Class dynamicMotionSolverFvMesh Declaration \*---------------------------------------------------------------------------*/ diff --git a/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C b/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C index dea180d583..981cf0bfcc 100644 --- a/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C +++ b/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -178,20 +178,9 @@ void Foam::dynamicRefineFvMesh::calculateProtectedCells void Foam::dynamicRefineFvMesh::readDict() { - dictionary refineDict + const dictionary refineDict ( - IOdictionary - ( - IOobject - ( - "dynamicMeshDict", - time().constant(), - *this, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE, - false - ) - ).optionalSubDict(typeName + "Coeffs") + dynamicMeshDict().optionalSubDict(typeName + "Coeffs") ); List> fluxVelocities = List> @@ -1189,20 +1178,9 @@ bool Foam::dynamicRefineFvMesh::update() // Re-read dictionary. Chosen since usually -small so trivial amount // of time compared to actual refinement. Also very useful to be able // to modify on-the-fly. - dictionary refineDict + const dictionary refineDict ( - IOdictionary - ( - IOobject - ( - "dynamicMeshDict", - time().constant(), - *this, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE, - false - ) - ).optionalSubDict(typeName + "Coeffs") + dynamicMeshDict().optionalSubDict(typeName + "Coeffs") ); label refineInterval = readLabel(refineDict.lookup("refineInterval")); @@ -1224,9 +1202,6 @@ bool Foam::dynamicRefineFvMesh::update() << exit(FatalError); } - - - // Note: cannot refine at time 0 since no V0 present since mesh not // moved yet. diff --git a/src/dynamicMesh/motionSolvers/componentDisplacement/componentDisplacementMotionSolver.C b/src/dynamicMesh/motionSolvers/componentDisplacement/componentDisplacementMotionSolver.C index 33c435968c..ee139a34aa 100644 --- a/src/dynamicMesh/motionSolvers/componentDisplacement/componentDisplacementMotionSolver.C +++ b/src/dynamicMesh/motionSolvers/componentDisplacement/componentDisplacementMotionSolver.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2012-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -69,7 +69,7 @@ Foam::direction Foam::componentDisplacementMotionSolver::cmpt Foam::componentDisplacementMotionSolver::componentDisplacementMotionSolver ( const polyMesh& mesh, - const IOdictionary& dict, + const dictionary& dict, const word& type ) : @@ -83,7 +83,7 @@ Foam::componentDisplacementMotionSolver::componentDisplacementMotionSolver IOobject ( "points", - time().constant(), + mesh.time().constant(), polyMesh::meshSubDir, mesh, IOobject::MUST_READ, diff --git a/src/dynamicMesh/motionSolvers/componentDisplacement/componentDisplacementMotionSolver.H b/src/dynamicMesh/motionSolvers/componentDisplacement/componentDisplacementMotionSolver.H index 6ed193f52f..27349839b6 100644 --- a/src/dynamicMesh/motionSolvers/componentDisplacement/componentDisplacementMotionSolver.H +++ b/src/dynamicMesh/motionSolvers/componentDisplacement/componentDisplacementMotionSolver.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2012-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -102,7 +102,7 @@ public: componentDisplacementMotionSolver ( const polyMesh&, - const IOdictionary&, + const dictionary&, const word& type ); diff --git a/src/dynamicMesh/motionSolvers/componentVelocity/componentVelocityMotionSolver.C b/src/dynamicMesh/motionSolvers/componentVelocity/componentVelocityMotionSolver.C index addbfc14f9..e8c7e17bf7 100644 --- a/src/dynamicMesh/motionSolvers/componentVelocity/componentVelocityMotionSolver.C +++ b/src/dynamicMesh/motionSolvers/componentVelocity/componentVelocityMotionSolver.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2012-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -69,7 +69,7 @@ Foam::direction Foam::componentVelocityMotionSolver::cmpt Foam::componentVelocityMotionSolver::componentVelocityMotionSolver ( const polyMesh& mesh, - const IOdictionary& dict, + const dictionary& dict, const word& type ) : diff --git a/src/dynamicMesh/motionSolvers/componentVelocity/componentVelocityMotionSolver.H b/src/dynamicMesh/motionSolvers/componentVelocity/componentVelocityMotionSolver.H index ac22ec00ad..3b1f42160e 100644 --- a/src/dynamicMesh/motionSolvers/componentVelocity/componentVelocityMotionSolver.H +++ b/src/dynamicMesh/motionSolvers/componentVelocity/componentVelocityMotionSolver.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2012-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -99,7 +99,7 @@ public: componentVelocityMotionSolver ( const polyMesh&, - const IOdictionary&, + const dictionary&, const word& type ); diff --git a/src/dynamicMesh/motionSolvers/displacement/displacement/displacementMotionSolver.C b/src/dynamicMesh/motionSolvers/displacement/displacement/displacementMotionSolver.C index ec673b7fa8..905f6c4d67 100644 --- a/src/dynamicMesh/motionSolvers/displacement/displacement/displacementMotionSolver.C +++ b/src/dynamicMesh/motionSolvers/displacement/displacement/displacementMotionSolver.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2012-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -38,7 +38,7 @@ namespace Foam Foam::displacementMotionSolver::displacementMotionSolver ( const polyMesh& mesh, - const IOdictionary& dict, + const dictionary& dict, const word& type ) : @@ -48,7 +48,7 @@ Foam::displacementMotionSolver::displacementMotionSolver IOobject ( "pointDisplacement", - time().timeName(), + mesh.time().timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE diff --git a/src/dynamicMesh/motionSolvers/displacement/displacement/displacementMotionSolver.H b/src/dynamicMesh/motionSolvers/displacement/displacement/displacementMotionSolver.H index e66809a409..b4c7888353 100644 --- a/src/dynamicMesh/motionSolvers/displacement/displacement/displacementMotionSolver.H +++ b/src/dynamicMesh/motionSolvers/displacement/displacement/displacementMotionSolver.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2012-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -83,7 +83,7 @@ public: displacementMotionSolver ( const polyMesh&, - const IOdictionary&, + const dictionary&, const word& type ); diff --git a/src/dynamicMesh/motionSolvers/displacement/interpolation/displacementInterpolationMotionSolver.C b/src/dynamicMesh/motionSolvers/displacement/interpolation/displacementInterpolationMotionSolver.C index 0aaba114b5..24935df744 100644 --- a/src/dynamicMesh/motionSolvers/displacement/interpolation/displacementInterpolationMotionSolver.C +++ b/src/dynamicMesh/motionSolvers/displacement/interpolation/displacementInterpolationMotionSolver.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -55,7 +55,7 @@ Foam::displacementInterpolationMotionSolver:: displacementInterpolationMotionSolver ( const polyMesh& mesh, - const IOdictionary& dict + const dictionary& dict ) : points0MotionSolver(mesh, dict, typeName) diff --git a/src/dynamicMesh/motionSolvers/displacement/interpolation/displacementInterpolationMotionSolver.H b/src/dynamicMesh/motionSolvers/displacement/interpolation/displacementInterpolationMotionSolver.H index 1b5470dfe4..66a2873934 100644 --- a/src/dynamicMesh/motionSolvers/displacement/interpolation/displacementInterpolationMotionSolver.H +++ b/src/dynamicMesh/motionSolvers/displacement/interpolation/displacementInterpolationMotionSolver.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -104,11 +104,11 @@ public: // Constructors - //- Construct from polyMesh and IOdictionary + //- Construct from polyMesh and dictionary displacementInterpolationMotionSolver ( const polyMesh&, - const IOdictionary& dict + const dictionary& dict ); diff --git a/src/dynamicMesh/motionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.C b/src/dynamicMesh/motionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.C index f0f2eef367..a991717c07 100644 --- a/src/dynamicMesh/motionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.C +++ b/src/dynamicMesh/motionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -241,9 +241,9 @@ Foam::displacementLayeredMotionMotionSolver::faceZoneEvaluate { if ((patchi % 2) != 1) { - FatalIOErrorInFunction(*this) + FatalErrorInFunction << "FaceZone:" << fz.name() - << exit(FatalIOError); + << exit(FatalError); } // Use field set by previous bc fld = vectorField(patchDisp[patchi - 1], meshPoints); @@ -267,9 +267,9 @@ Foam::displacementLayeredMotionMotionSolver::faceZoneEvaluate } else { - FatalIOErrorInFunction(*this) + FatalErrorInFunction << "Unknown faceZonePatch type " << type << " for faceZone " - << fz.name() << exit(FatalIOError); + << fz.name() << exit(FatalError); } return tfld; } @@ -289,11 +289,11 @@ void Foam::displacementLayeredMotionMotionSolver::cellZoneSolve if (patchesDict.size() != 2) { - FatalIOErrorInFunction(*this) + FatalErrorInFunction << "Two faceZones (patches) must be specified per cellZone. " << " cellZone:" << cellZoneI << " patches:" << patchesDict.toc() - << exit(FatalIOError); + << exit(FatalError); } PtrList patchDist(patchesDict.size()); @@ -307,10 +307,10 @@ void Foam::displacementLayeredMotionMotionSolver::cellZoneSolve label zoneI = mesh().faceZones().findZoneID(faceZoneName); if (zoneI == -1) { - FatalIOErrorInFunction(*this) + FatalErrorInFunction << "Cannot find faceZone " << faceZoneName << endl << "Valid zones are " << mesh().faceZones().names() - << exit(FatalIOError); + << exit(FatalError); } // Determine the points of the faceZone within the cellZone @@ -491,7 +491,7 @@ Foam::displacementLayeredMotionMotionSolver:: displacementLayeredMotionMotionSolver ( const polyMesh& mesh, - const IOdictionary& dict + const dictionary& dict ) : displacementMotionSolver(mesh, dict, typeName) @@ -540,10 +540,10 @@ void Foam::displacementLayeredMotionMotionSolver::solve() if (zoneI == -1) { - FatalIOErrorInFunction(*this) + FatalErrorInFunction << "Cannot find cellZone " << cellZoneName << endl << "Valid zones are " << mesh().cellZones().names() - << exit(FatalIOError); + << exit(FatalError); } cellZoneSolve(zoneI, regionDict); diff --git a/src/dynamicMesh/motionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.H b/src/dynamicMesh/motionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.H index 1450927cd3..7cd97ef5de 100644 --- a/src/dynamicMesh/motionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.H +++ b/src/dynamicMesh/motionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -129,11 +129,11 @@ public: // Constructors - //- Construct from polyMesh and IOdictionary + //- Construct from polyMesh and dictionary displacementLayeredMotionMotionSolver ( const polyMesh&, - const IOdictionary& + const dictionary& ); diff --git a/src/dynamicMesh/motionSolvers/displacement/linearSolver/displacementLinearMotionMotionSolver.C b/src/dynamicMesh/motionSolvers/displacement/linearSolver/displacementLinearMotionMotionSolver.C index cdab64ade8..e27d39cdcf 100644 --- a/src/dynamicMesh/motionSolvers/displacement/linearSolver/displacementLinearMotionMotionSolver.C +++ b/src/dynamicMesh/motionSolvers/displacement/linearSolver/displacementLinearMotionMotionSolver.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -47,7 +47,7 @@ Foam::displacementLinearMotionMotionSolver:: displacementLinearMotionMotionSolver ( const polyMesh& mesh, - const IOdictionary& dict + const dictionary& dict ) : points0MotionSolver(mesh, dict, typeName), @@ -73,7 +73,7 @@ Foam::displacementLinearMotionMotionSolver::curPoints() const tmp tcurPoints(new pointField(points0())); pointField& curPoints = tcurPoints.ref(); - const scalar t = time().value(); + const scalar t = mesh().time().value(); const scalar displacement = displacement_->value(t); diff --git a/src/dynamicMesh/motionSolvers/displacement/linearSolver/displacementLinearMotionMotionSolver.H b/src/dynamicMesh/motionSolvers/displacement/linearSolver/displacementLinearMotionMotionSolver.H index 16388059db..f17f98a6d1 100644 --- a/src/dynamicMesh/motionSolvers/displacement/linearSolver/displacementLinearMotionMotionSolver.H +++ b/src/dynamicMesh/motionSolvers/displacement/linearSolver/displacementLinearMotionMotionSolver.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -106,11 +106,11 @@ public: // Constructors - //- Construct from polyMesh and IOdictionary + //- Construct from polyMesh and dictionary displacementLinearMotionMotionSolver ( const polyMesh&, - const IOdictionary& + const dictionary& ); diff --git a/src/dynamicMesh/motionSolvers/displacement/points0/points0MotionSolver.C b/src/dynamicMesh/motionSolvers/displacement/points0/points0MotionSolver.C index 92e837f7db..01adf0ced7 100644 --- a/src/dynamicMesh/motionSolvers/displacement/points0/points0MotionSolver.C +++ b/src/dynamicMesh/motionSolvers/displacement/points0/points0MotionSolver.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2016-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2016-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -38,7 +38,7 @@ namespace Foam Foam::points0MotionSolver::points0MotionSolver ( const polyMesh& mesh, - const IOdictionary& dict, + const dictionary& dict, const word& type ) : @@ -56,7 +56,7 @@ Foam::points0MotionSolver::points0MotionSolver IOobject ( "points", - time().constant(), + mesh.time().constant(), polyMesh::meshSubDir, mesh, IOobject::MUST_READ, @@ -145,7 +145,7 @@ void Foam::points0MotionSolver::updateMesh(const mapPolyMesh& mpm) // points0 changed - set to write and check-in to database points0_.rename("points0"); points0_.writeOpt() = IOobject::AUTO_WRITE; - points0_.instance() = time().timeName(); + points0_.instance() = mesh().time().timeName(); points0_.checkIn(); } diff --git a/src/dynamicMesh/motionSolvers/displacement/points0/points0MotionSolver.H b/src/dynamicMesh/motionSolvers/displacement/points0/points0MotionSolver.H index 9c498ee058..bf0391ae83 100644 --- a/src/dynamicMesh/motionSolvers/displacement/points0/points0MotionSolver.H +++ b/src/dynamicMesh/motionSolvers/displacement/points0/points0MotionSolver.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2016-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2016-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -84,7 +84,7 @@ public: points0MotionSolver ( const polyMesh&, - const IOdictionary&, + const dictionary&, const word& type ); diff --git a/src/dynamicMesh/motionSolvers/displacement/solidBody/interpolatingSolidBodyMotionSolver/interpolatingSolidBodyMotionSolver.C b/src/dynamicMesh/motionSolvers/displacement/solidBody/interpolatingSolidBodyMotionSolver/interpolatingSolidBodyMotionSolver.C index a3fd96f2a2..0975fdfbba 100644 --- a/src/dynamicMesh/motionSolvers/displacement/solidBody/interpolatingSolidBodyMotionSolver/interpolatingSolidBodyMotionSolver.C +++ b/src/dynamicMesh/motionSolvers/displacement/solidBody/interpolatingSolidBodyMotionSolver/interpolatingSolidBodyMotionSolver.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -48,7 +48,7 @@ namespace Foam Foam::interpolatingSolidBodyMotionSolver::interpolatingSolidBodyMotionSolver ( const polyMesh& mesh, - const IOdictionary& dict + const dictionary& dict ) : points0MotionSolver(mesh, dict, typeName), diff --git a/src/dynamicMesh/motionSolvers/displacement/solidBody/interpolatingSolidBodyMotionSolver/interpolatingSolidBodyMotionSolver.H b/src/dynamicMesh/motionSolvers/displacement/solidBody/interpolatingSolidBodyMotionSolver/interpolatingSolidBodyMotionSolver.H index f80a1bd31d..554919b5eb 100644 --- a/src/dynamicMesh/motionSolvers/displacement/solidBody/interpolatingSolidBodyMotionSolver/interpolatingSolidBodyMotionSolver.H +++ b/src/dynamicMesh/motionSolvers/displacement/solidBody/interpolatingSolidBodyMotionSolver/interpolatingSolidBodyMotionSolver.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -96,11 +96,11 @@ public: // Constructors - //- Construct from polyMesh and IOdictionary + //- Construct from polyMesh and dictionary interpolatingSolidBodyMotionSolver ( const polyMesh&, - const IOdictionary& dict + const dictionary& dict ); diff --git a/src/dynamicMesh/motionSolvers/displacement/solidBody/multiSolidBodyMotionSolver/multiSolidBodyMotionSolver.C b/src/dynamicMesh/motionSolvers/displacement/solidBody/multiSolidBodyMotionSolver/multiSolidBodyMotionSolver.C index 9e71711e70..7425dc6faf 100644 --- a/src/dynamicMesh/motionSolvers/displacement/solidBody/multiSolidBodyMotionSolver/multiSolidBodyMotionSolver.C +++ b/src/dynamicMesh/motionSolvers/displacement/solidBody/multiSolidBodyMotionSolver/multiSolidBodyMotionSolver.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -49,7 +49,7 @@ namespace Foam Foam::multiSolidBodyMotionSolver::multiSolidBodyMotionSolver ( const polyMesh& mesh, - const IOdictionary& dict + const dictionary& dict ) : points0MotionSolver(mesh, dict, typeName) diff --git a/src/dynamicMesh/motionSolvers/displacement/solidBody/multiSolidBodyMotionSolver/multiSolidBodyMotionSolver.H b/src/dynamicMesh/motionSolvers/displacement/solidBody/multiSolidBodyMotionSolver/multiSolidBodyMotionSolver.H index 843e7445fd..4cdbe843f4 100644 --- a/src/dynamicMesh/motionSolvers/displacement/solidBody/multiSolidBodyMotionSolver/multiSolidBodyMotionSolver.H +++ b/src/dynamicMesh/motionSolvers/displacement/solidBody/multiSolidBodyMotionSolver/multiSolidBodyMotionSolver.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -85,7 +85,7 @@ public: multiSolidBodyMotionSolver ( const polyMesh&, - const IOdictionary& + const dictionary& ); diff --git a/src/dynamicMesh/motionSolvers/displacement/solidBody/solidBodyMotionSolver/solidBodyMotionSolver.C b/src/dynamicMesh/motionSolvers/displacement/solidBody/solidBodyMotionSolver/solidBodyMotionSolver.C index 4c144cad53..7bc7bee3ec 100644 --- a/src/dynamicMesh/motionSolvers/displacement/solidBody/solidBodyMotionSolver/solidBodyMotionSolver.C +++ b/src/dynamicMesh/motionSolvers/displacement/solidBody/solidBodyMotionSolver/solidBodyMotionSolver.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2016-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2016-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -50,7 +50,7 @@ namespace Foam Foam::solidBodyMotionSolver::solidBodyMotionSolver ( const polyMesh& mesh, - const IOdictionary& dict + const dictionary& dict ) : points0MotionSolver(mesh, dict, typeName), diff --git a/src/dynamicMesh/motionSolvers/displacement/solidBody/solidBodyMotionSolver/solidBodyMotionSolver.H b/src/dynamicMesh/motionSolvers/displacement/solidBody/solidBodyMotionSolver/solidBodyMotionSolver.H index 5c003c2fdb..7b56db373a 100644 --- a/src/dynamicMesh/motionSolvers/displacement/solidBody/solidBodyMotionSolver/solidBodyMotionSolver.H +++ b/src/dynamicMesh/motionSolvers/displacement/solidBody/solidBodyMotionSolver/solidBodyMotionSolver.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2016-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2016-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -85,7 +85,7 @@ public: solidBodyMotionSolver ( const polyMesh&, - const IOdictionary& + const dictionary& ); diff --git a/src/dynamicMesh/motionSolvers/motionSolver/motionSolver.C b/src/dynamicMesh/motionSolvers/motionSolver/motionSolver.C index 992840b3bf..163e6bebfc 100644 --- a/src/dynamicMesh/motionSolvers/motionSolver/motionSolver.C +++ b/src/dynamicMesh/motionSolvers/motionSolver/motionSolver.C @@ -34,53 +34,16 @@ 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(dict).checkOut(); - - io.registerObject() = true; - } - - return io; -} - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::motionSolver::motionSolver(const polyMesh& mesh) -: - IOdictionary - ( - IOobject - ( - "dynamicMeshDict", - mesh.time().constant(), - mesh, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::AUTO_WRITE - ) - ), - mesh_(mesh) -{} - - Foam::motionSolver::motionSolver ( const polyMesh& mesh, - const IOdictionary& dict, + const dictionary& dict, const word& type ) : - IOdictionary(stealRegistration(dict), dict), mesh_(mesh), coeffDict_(dict.optionalSubDict(type + "Coeffs")) {} @@ -98,7 +61,7 @@ Foam::autoPtr Foam::motionSolver::clone() const Foam::autoPtr Foam::motionSolver::New ( const polyMesh& mesh, - const IOdictionary& solverDict + const dictionary& solverDict ) { if (solverDict.found("solvers")) @@ -148,24 +111,6 @@ Foam::autoPtr Foam::motionSolver::New } -Foam::autoPtr Foam::motionSolver::New(const polyMesh& mesh) -{ - IOdictionary solverDict - ( - IOobject - ( - "dynamicMeshDict", - mesh.time().constant(), - mesh, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::AUTO_WRITE - ) - ); - - return New(mesh, solverDict); -} - - Foam::motionSolver::iNew::iNew(const polyMesh& mesh) : mesh_(mesh) @@ -179,20 +124,7 @@ Foam::autoPtr Foam::motionSolver::iNew::operator() { dictionaryEntry dict(dictionary::null, is); - return motionSolver::New - ( - mesh_, - IOdictionary - ( - IOobject - ( - dict.name() + ":meshSolver", - mesh_.time().constant(), - mesh_ - ), - dict - ) - ); + return motionSolver::New(mesh_, dict); } @@ -221,31 +153,4 @@ void Foam::motionSolver::updateMesh(const mapPolyMesh& mpm) {} -bool Foam::motionSolver::writeObject -( - IOstream::streamFormat fmt, - IOstream::versionNumber ver, - IOstream::compressionType cmp, - const bool valid -) const -{ - return true; -} - - -bool Foam::motionSolver::read() -{ - if (regIOobject::read()) - { - coeffDict_ = optionalSubDict(type() + "Coeffs"); - - return true; - } - else - { - return false; - } -} - - // ************************************************************************* // diff --git a/src/dynamicMesh/motionSolvers/motionSolver/motionSolver.H b/src/dynamicMesh/motionSolvers/motionSolver/motionSolver.H index 68fc95f5fd..779209826c 100644 --- a/src/dynamicMesh/motionSolvers/motionSolver/motionSolver.H +++ b/src/dynamicMesh/motionSolvers/motionSolver/motionSolver.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -35,9 +35,7 @@ SourceFiles #ifndef motionSolver_H #define motionSolver_H -#include "IOdictionary.H" #include "pointField.H" - #include "Time.H" #include "polyMesh.H" #include "dictionaryEntry.H" @@ -56,8 +54,6 @@ class mapPolyMesh; \*---------------------------------------------------------------------------*/ class motionSolver -: - public IOdictionary { // Private data @@ -68,12 +64,6 @@ class motionSolver dictionary coeffDict_; - // Private Member Functions - - //- De-register object if registered and assign to current - static IOobject stealRegistration(const IOdictionary& dict); - - public: //- Runtime type information @@ -87,19 +77,15 @@ public: autoPtr, motionSolver, dictionary, - (const polyMesh& mesh, const IOdictionary& dict), + (const polyMesh& mesh, const dictionary& dict), (mesh, dict) ); // Selectors - //- Select constructed from polyMesh - static autoPtr New(const polyMesh&); - - //- Select constructed from polyMesh and dictionary. If dictionary - // was registered this will 'steal' that registration. - static autoPtr New(const polyMesh&, const IOdictionary&); + //- Select constructed from polyMesh and dictionary + static autoPtr New(const polyMesh&, const dictionary&); //- Class used for the construction of PtrLists of motionSolvers class iNew @@ -114,17 +100,13 @@ public: }; - // Constructors - //- Construct from polyMesh - motionSolver(const polyMesh& mesh); - //- Construct from polyMesh and dictionary and type. motionSolver ( const polyMesh& mesh, - const IOdictionary&, + const dictionary&, const word& type ); @@ -166,18 +148,6 @@ public: //- Update local data for topology changes virtual void updateMesh(const mapPolyMesh&) = 0; - - //- Write state using given format, version and compression - virtual bool writeObject - ( - IOstream::streamFormat fmt, - IOstream::versionNumber ver, - IOstream::compressionType cmp, - const bool valid - ) const; - - //- Read dynamicMeshDict dictionary - virtual bool read(); }; diff --git a/src/dynamicMesh/motionSolvers/motionSolverList/motionSolverList.C b/src/dynamicMesh/motionSolvers/motionSolverList/motionSolverList.C index 01d239b97f..fad1a39b77 100644 --- a/src/dynamicMesh/motionSolvers/motionSolverList/motionSolverList.C +++ b/src/dynamicMesh/motionSolvers/motionSolverList/motionSolverList.C @@ -45,7 +45,7 @@ namespace Foam Foam::motionSolverList::motionSolverList ( const polyMesh& mesh, - const IOdictionary& dict + const dictionary& dict ) : motionSolver(mesh, dict, typeName), diff --git a/src/dynamicMesh/motionSolvers/motionSolverList/motionSolverList.H b/src/dynamicMesh/motionSolvers/motionSolverList/motionSolverList.H index 6d561be5b1..ba47c70bbe 100644 --- a/src/dynamicMesh/motionSolvers/motionSolverList/motionSolverList.H +++ b/src/dynamicMesh/motionSolvers/motionSolverList/motionSolverList.H @@ -77,7 +77,7 @@ public: // Constructors //- Construct from mesh and dictionary - motionSolverList(const polyMesh&, const IOdictionary&); + motionSolverList(const polyMesh&, const dictionary&); //- Destructor diff --git a/src/dynamicMesh/motionSolvers/velocity/velocityMotionSolver.C b/src/dynamicMesh/motionSolvers/velocity/velocityMotionSolver.C index 3d1f85e6c9..194fda65f7 100644 --- a/src/dynamicMesh/motionSolvers/velocity/velocityMotionSolver.C +++ b/src/dynamicMesh/motionSolvers/velocity/velocityMotionSolver.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2012-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -39,7 +39,7 @@ namespace Foam Foam::velocityMotionSolver::velocityMotionSolver ( const polyMesh& mesh, - const IOdictionary& dict, + const dictionary& dict, const word& type ) : diff --git a/src/dynamicMesh/motionSolvers/velocity/velocityMotionSolver.H b/src/dynamicMesh/motionSolvers/velocity/velocityMotionSolver.H index bab28ee1d8..e6042775f9 100644 --- a/src/dynamicMesh/motionSolvers/velocity/velocityMotionSolver.H +++ b/src/dynamicMesh/motionSolvers/velocity/velocityMotionSolver.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2012-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -88,7 +88,7 @@ public: velocityMotionSolver ( const polyMesh&, - const IOdictionary&, + const dictionary&, const word& type ); diff --git a/src/fvMotionSolver/Make/options b/src/fvMotionSolver/Make/options index c4bc792179..91c19f1488 100644 --- a/src/fvMotionSolver/Make/options +++ b/src/fvMotionSolver/Make/options @@ -2,14 +2,16 @@ EXE_INC = \ -I$(LIB_SRC)/triSurface/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude \ + -I$(LIB_SRC)/dynamicFvMesh/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/fileFormats/lnInclude \ - -I$(LIB_SRC)/functionObjects/forces/lnInclude \ + -I$(LIB_SRC)/functionObjects/forces/lnInclude LIB_LIBS = \ -ltriSurface \ -lmeshTools \ -ldynamicMesh \ + -ldynamicFvMesh \ -lfiniteVolume \ -lfileFormats /*-lforces include in controlDict if needed */ diff --git a/src/fvMotionSolver/fvMotionSolvers/componentDisplacement/componentLaplacian/displacementComponentLaplacianFvMotionSolver.C b/src/fvMotionSolver/fvMotionSolvers/componentDisplacement/componentLaplacian/displacementComponentLaplacianFvMotionSolver.C index 8f5c3b7533..ecb503e90a 100644 --- a/src/fvMotionSolver/fvMotionSolvers/componentDisplacement/componentLaplacian/displacementComponentLaplacianFvMotionSolver.C +++ b/src/fvMotionSolver/fvMotionSolvers/componentDisplacement/componentLaplacian/displacementComponentLaplacianFvMotionSolver.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -51,7 +51,7 @@ Foam::displacementComponentLaplacianFvMotionSolver:: displacementComponentLaplacianFvMotionSolver ( const polyMesh& mesh, - const IOdictionary& dict + const dictionary& dict ) : componentDisplacementMotionSolver(mesh, dict, type()), diff --git a/src/fvMotionSolver/fvMotionSolvers/componentDisplacement/componentLaplacian/displacementComponentLaplacianFvMotionSolver.H b/src/fvMotionSolver/fvMotionSolvers/componentDisplacement/componentLaplacian/displacementComponentLaplacianFvMotionSolver.H index 285ef04108..967c980341 100644 --- a/src/fvMotionSolver/fvMotionSolvers/componentDisplacement/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 | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -96,11 +96,11 @@ public: // Constructors - //- Construct from polyMesh and IOdictionary + //- Construct from polyMesh and dictionary displacementComponentLaplacianFvMotionSolver ( const polyMesh&, - const IOdictionary& + const dictionary& ); diff --git a/src/fvMotionSolver/fvMotionSolvers/componentVelocity/componentLaplacian/velocityComponentLaplacianFvMotionSolver.C b/src/fvMotionSolver/fvMotionSolvers/componentVelocity/componentLaplacian/velocityComponentLaplacianFvMotionSolver.C index 67a783c127..315383381f 100644 --- a/src/fvMotionSolver/fvMotionSolvers/componentVelocity/componentLaplacian/velocityComponentLaplacianFvMotionSolver.C +++ b/src/fvMotionSolver/fvMotionSolvers/componentVelocity/componentLaplacian/velocityComponentLaplacianFvMotionSolver.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -50,7 +50,7 @@ Foam::velocityComponentLaplacianFvMotionSolver:: velocityComponentLaplacianFvMotionSolver ( const polyMesh& mesh, - const IOdictionary& dict + const dictionary& dict ) : componentVelocityMotionSolver(mesh, dict, typeName), diff --git a/src/fvMotionSolver/fvMotionSolvers/componentVelocity/componentLaplacian/velocityComponentLaplacianFvMotionSolver.H b/src/fvMotionSolver/fvMotionSolvers/componentVelocity/componentLaplacian/velocityComponentLaplacianFvMotionSolver.H index 29da01700d..0688111917 100644 --- a/src/fvMotionSolver/fvMotionSolvers/componentVelocity/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 | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -85,11 +85,11 @@ public: // Constructors - //- Construct from polyMesh and IOdictionary + //- Construct from polyMesh and dictionary velocityComponentLaplacianFvMotionSolver ( const polyMesh&, - const IOdictionary& + const dictionary& ); diff --git a/src/fvMotionSolver/fvMotionSolvers/displacement/SBRStress/displacementSBRStressFvMotionSolver.C b/src/fvMotionSolver/fvMotionSolvers/displacement/SBRStress/displacementSBRStressFvMotionSolver.C index 890ea6cefd..5526c31b58 100644 --- a/src/fvMotionSolver/fvMotionSolvers/displacement/SBRStress/displacementSBRStressFvMotionSolver.C +++ b/src/fvMotionSolver/fvMotionSolvers/displacement/SBRStress/displacementSBRStressFvMotionSolver.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -54,7 +54,7 @@ namespace Foam Foam::displacementSBRStressFvMotionSolver::displacementSBRStressFvMotionSolver ( const polyMesh& mesh, - const IOdictionary& dict + const dictionary& dict ) : displacementMotionSolver(mesh, dict, typeName), diff --git a/src/fvMotionSolver/fvMotionSolvers/displacement/SBRStress/displacementSBRStressFvMotionSolver.H b/src/fvMotionSolver/fvMotionSolvers/displacement/SBRStress/displacementSBRStressFvMotionSolver.H index 5fb848aec5..043f3de4ac 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 | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -85,11 +85,11 @@ public: // Constructors - //- Construct from polyMesh and IOdictionary + //- Construct from polyMesh and dictionary displacementSBRStressFvMotionSolver ( const polyMesh&, - const IOdictionary& + const dictionary& ); diff --git a/src/fvMotionSolver/fvMotionSolvers/displacement/laplacian/displacementLaplacianFvMotionSolver.C b/src/fvMotionSolver/fvMotionSolvers/displacement/laplacian/displacementLaplacianFvMotionSolver.C index 8a270a2a72..bce940015b 100644 --- a/src/fvMotionSolver/fvMotionSolvers/displacement/laplacian/displacementLaplacianFvMotionSolver.C +++ b/src/fvMotionSolver/fvMotionSolvers/displacement/laplacian/displacementLaplacianFvMotionSolver.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -52,7 +52,7 @@ namespace Foam Foam::displacementLaplacianFvMotionSolver::displacementLaplacianFvMotionSolver ( const polyMesh& mesh, - const IOdictionary& dict + const dictionary& dict ) : displacementMotionSolver(mesh, dict, typeName), diff --git a/src/fvMotionSolver/fvMotionSolvers/displacement/laplacian/displacementLaplacianFvMotionSolver.H b/src/fvMotionSolver/fvMotionSolvers/displacement/laplacian/displacementLaplacianFvMotionSolver.H index ae444bb22a..582499571b 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 | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -93,11 +93,11 @@ public: // Constructors - //- Construct from polyMesh and IOdictionary + //- Construct from polyMesh and dictionary displacementLaplacianFvMotionSolver ( const polyMesh&, - const IOdictionary& + const dictionary& ); diff --git a/src/fvMotionSolver/fvMotionSolvers/velocity/laplacian/velocityLaplacianFvMotionSolver.C b/src/fvMotionSolver/fvMotionSolvers/velocity/laplacian/velocityLaplacianFvMotionSolver.C index ffb0c52709..57231722ba 100644 --- a/src/fvMotionSolver/fvMotionSolvers/velocity/laplacian/velocityLaplacianFvMotionSolver.C +++ b/src/fvMotionSolver/fvMotionSolvers/velocity/laplacian/velocityLaplacianFvMotionSolver.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -49,7 +49,7 @@ namespace Foam Foam::velocityLaplacianFvMotionSolver::velocityLaplacianFvMotionSolver ( const polyMesh& mesh, - const IOdictionary& dict + const dictionary& dict ) : velocityMotionSolver(mesh, dict, typeName), diff --git a/src/fvMotionSolver/fvMotionSolvers/velocity/laplacian/velocityLaplacianFvMotionSolver.H b/src/fvMotionSolver/fvMotionSolvers/velocity/laplacian/velocityLaplacianFvMotionSolver.H index c6ddc96160..86760567d6 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 | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -85,11 +85,11 @@ public: // Constructors - //- Construct from polyMesh and IOdictionary + //- Construct from polyMesh and dictionary velocityLaplacianFvMotionSolver ( const polyMesh&, - const IOdictionary& + const dictionary& ); diff --git a/src/fvMotionSolver/motionDiffusivity/directional/directionalDiffusivity.C b/src/fvMotionSolver/motionDiffusivity/directional/directionalDiffusivity.C index 09062bf4c3..20bd6e2fb0 100644 --- a/src/fvMotionSolver/motionDiffusivity/directional/directionalDiffusivity.C +++ b/src/fvMotionSolver/motionDiffusivity/directional/directionalDiffusivity.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -24,6 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "directionalDiffusivity.H" +#include "surfaceFields.H" #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -49,11 +50,9 @@ Foam::directionalDiffusivity::directionalDiffusivity Istream& mdData ) : - uniformDiffusivity(mesh, mdData), + motionDiffusivity(mesh), diffusivityVector_(mdData) -{ - correct(); -} +{} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // @@ -62,12 +61,18 @@ Foam::directionalDiffusivity::~directionalDiffusivity() {} -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // -void Foam::directionalDiffusivity::correct() +Foam::tmp +Foam::directionalDiffusivity::operator()() const { const surfaceVectorField n(mesh().Sf()/mesh().magSf()); - faceDiffusivity_ == (n & cmptMultiply(diffusivityVector_, n)); + + return surfaceScalarField::New + ( + "faceDiffusivity", + n & cmptMultiply(diffusivityVector_, n) + ); } diff --git a/src/fvMotionSolver/motionDiffusivity/directional/directionalDiffusivity.H b/src/fvMotionSolver/motionDiffusivity/directional/directionalDiffusivity.H index e9e2d5c4bd..89f62d2caa 100644 --- a/src/fvMotionSolver/motionDiffusivity/directional/directionalDiffusivity.H +++ b/src/fvMotionSolver/motionDiffusivity/directional/directionalDiffusivity.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -35,7 +35,7 @@ SourceFiles #ifndef directionalDiffusivity_H #define directionalDiffusivity_H -#include "uniformDiffusivity.H" +#include "motionDiffusivity.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -48,7 +48,7 @@ namespace Foam class directionalDiffusivity : - public uniformDiffusivity + public motionDiffusivity { // Private data @@ -80,10 +80,10 @@ public: virtual ~directionalDiffusivity(); - // Member Functions + // Member Operators - //- Correct the motion diffusivity - virtual void correct(); + //- Return diffusivity field + virtual tmp operator()() const; }; diff --git a/src/fvMotionSolver/motionDiffusivity/inverseDistance/inverseDistanceDiffusivity.C b/src/fvMotionSolver/motionDiffusivity/inverseDistance/inverseDistanceDiffusivity.C index febe7f5537..7d5177a74a 100644 --- a/src/fvMotionSolver/motionDiffusivity/inverseDistance/inverseDistanceDiffusivity.C +++ b/src/fvMotionSolver/motionDiffusivity/inverseDistance/inverseDistanceDiffusivity.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -53,11 +53,9 @@ Foam::inverseDistanceDiffusivity::inverseDistanceDiffusivity Istream& mdData ) : - uniformDiffusivity(mesh, mdData), + motionDiffusivity(mesh), patchNames_(mdData) -{ - correct(); -} +{} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // @@ -70,7 +68,7 @@ Foam::inverseDistanceDiffusivity::~inverseDistanceDiffusivity() Foam::tmp Foam::inverseDistanceDiffusivity::y() const { - labelHashSet patchSet(mesh().boundaryMesh().patchSet(patchNames_)); + const labelHashSet patchSet(mesh().boundaryMesh().patchSet(patchNames_)); if (patchSet.size()) { @@ -86,7 +84,10 @@ Foam::tmp Foam::inverseDistanceDiffusivity::y() const } -void Foam::inverseDistanceDiffusivity::correct() +// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // + +Foam::tmp +Foam::inverseDistanceDiffusivity::operator()() const { volScalarField y_ ( @@ -103,7 +104,11 @@ void Foam::inverseDistanceDiffusivity::correct() y_.primitiveFieldRef() = y(); y_.correctBoundaryConditions(); - faceDiffusivity_ = 1.0/fvc::interpolate(y_); + return surfaceScalarField::New + ( + "faceDiffusivity", + 1.0/fvc::interpolate(y_) + ); } diff --git a/src/fvMotionSolver/motionDiffusivity/inverseDistance/inverseDistanceDiffusivity.H b/src/fvMotionSolver/motionDiffusivity/inverseDistance/inverseDistanceDiffusivity.H index 030848cb87..de8c45c754 100644 --- a/src/fvMotionSolver/motionDiffusivity/inverseDistance/inverseDistanceDiffusivity.H +++ b/src/fvMotionSolver/motionDiffusivity/inverseDistance/inverseDistanceDiffusivity.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -35,7 +35,7 @@ SourceFiles #ifndef inverseDistanceDiffusivity_H #define inverseDistanceDiffusivity_H -#include "uniformDiffusivity.H" +#include "motionDiffusivity.H" #include "wordReList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -49,7 +49,7 @@ namespace Foam class inverseDistanceDiffusivity : - public uniformDiffusivity + public motionDiffusivity { // Private data @@ -86,10 +86,10 @@ public: virtual ~inverseDistanceDiffusivity(); - // Member Functions + // Member Operators - //- Correct the motion diffusivity - virtual void correct(); + //- Return diffusivity field + virtual tmp operator()() const; }; diff --git a/src/fvMotionSolver/motionDiffusivity/inverseFaceDistance/inverseFaceDistanceDiffusivity.C b/src/fvMotionSolver/motionDiffusivity/inverseFaceDistance/inverseFaceDistanceDiffusivity.C index 1480dbf241..6abc44c4ea 100644 --- a/src/fvMotionSolver/motionDiffusivity/inverseFaceDistance/inverseFaceDistanceDiffusivity.C +++ b/src/fvMotionSolver/motionDiffusivity/inverseFaceDistance/inverseFaceDistanceDiffusivity.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -24,10 +24,11 @@ License \*---------------------------------------------------------------------------*/ #include "inverseFaceDistanceDiffusivity.H" -#include "addToRunTimeSelectionTable.H" +#include "surfaceFields.H" #include "HashSet.H" #include "wallPoint.H" #include "MeshWave.H" +#include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -52,11 +53,9 @@ Foam::inverseFaceDistanceDiffusivity::inverseFaceDistanceDiffusivity Istream& mdData ) : - uniformDiffusivity(mesh, mdData), + motionDiffusivity(mesh), patchNames_(mdData) -{ - correct(); -} +{} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // @@ -65,10 +64,30 @@ Foam::inverseFaceDistanceDiffusivity::~inverseFaceDistanceDiffusivity() {} -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // -void Foam::inverseFaceDistanceDiffusivity::correct() +Foam::tmp +Foam::inverseFaceDistanceDiffusivity::operator()() const { + tmp tfaceDiffusivity + ( + new surfaceScalarField + ( + IOobject + ( + "faceDiffusivity", + mesh().time().timeName(), + mesh(), + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh(), + dimensionedScalar(dimless, 1.0) + ) + ); + + surfaceScalarField& faceDiffusivity = tfaceDiffusivity.ref(); + const polyBoundaryMesh& bdry = mesh().boundaryMesh(); labelHashSet patchSet(bdry.size()); @@ -122,13 +141,13 @@ void Foam::inverseFaceDistanceDiffusivity::correct() for (label facei=0; facei operator()() const; }; diff --git a/src/fvMotionSolver/motionDiffusivity/inversePointDistance/inversePointDistanceDiffusivity.C b/src/fvMotionSolver/motionDiffusivity/inversePointDistance/inversePointDistanceDiffusivity.C index 66a7c1b4eb..e979a9703a 100644 --- a/src/fvMotionSolver/motionDiffusivity/inversePointDistance/inversePointDistanceDiffusivity.C +++ b/src/fvMotionSolver/motionDiffusivity/inversePointDistance/inversePointDistanceDiffusivity.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -24,10 +24,11 @@ License \*---------------------------------------------------------------------------*/ #include "inversePointDistanceDiffusivity.H" -#include "addToRunTimeSelectionTable.H" +#include "surfaceFields.H" #include "HashSet.H" #include "pointEdgePoint.H" #include "PointEdgeWave.H" +#include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -52,11 +53,9 @@ Foam::inversePointDistanceDiffusivity::inversePointDistanceDiffusivity Istream& mdData ) : - uniformDiffusivity(mesh, mdData), + motionDiffusivity(mesh), patchNames_(mdData) -{ - correct(); -} +{} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // @@ -67,11 +66,31 @@ Foam::inversePointDistanceDiffusivity::~inversePointDistanceDiffusivity() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void Foam::inversePointDistanceDiffusivity::correct() +Foam::tmp +Foam::inversePointDistanceDiffusivity::operator()() const { + tmp tfaceDiffusivity + ( + new surfaceScalarField + ( + IOobject + ( + "faceDiffusivity", + mesh().time().timeName(), + mesh(), + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh(), + dimensionedScalar(dimless, 1.0) + ) + ); + + surfaceScalarField& faceDiffusivity = tfaceDiffusivity.ref(); + const polyBoundaryMesh& bdry = mesh().boundaryMesh(); - labelHashSet patchSet(bdry.patchSet(patchNames_)); + const labelHashSet patchSet(bdry.patchSet(patchNames_)); label nPatchEdges = 0; @@ -102,7 +121,7 @@ void Foam::inversePointDistanceDiffusivity::correct() forAll(meshPoints, i) { - label pointi = meshPoints[i]; + const label pointi = meshPoints[i]; if (!pointWallDist[pointi].valid(dummyTrackData)) { @@ -149,12 +168,12 @@ void Foam::inversePointDistanceDiffusivity::correct() } dist /= f.size(); - faceDiffusivity_[facei] = 1.0/dist; + faceDiffusivity[facei] = 1.0/dist; } surfaceScalarField::Boundary& faceDiffusivityBf = - faceDiffusivity_.boundaryFieldRef(); + faceDiffusivity.boundaryFieldRef(); forAll(faceDiffusivityBf, patchi) { @@ -209,6 +228,8 @@ void Foam::inversePointDistanceDiffusivity::correct() } } } + + return tfaceDiffusivity; } diff --git a/src/fvMotionSolver/motionDiffusivity/inversePointDistance/inversePointDistanceDiffusivity.H b/src/fvMotionSolver/motionDiffusivity/inversePointDistance/inversePointDistanceDiffusivity.H index 32ffbeabe2..f9767eb75c 100644 --- a/src/fvMotionSolver/motionDiffusivity/inversePointDistance/inversePointDistanceDiffusivity.H +++ b/src/fvMotionSolver/motionDiffusivity/inversePointDistance/inversePointDistanceDiffusivity.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -35,7 +35,7 @@ SourceFiles #ifndef inversePointDistanceDiffusivity_H #define inversePointDistanceDiffusivity_H -#include "uniformDiffusivity.H" +#include "motionDiffusivity.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -48,7 +48,7 @@ namespace Foam class inversePointDistanceDiffusivity : - public uniformDiffusivity + public motionDiffusivity { // Private data @@ -81,10 +81,10 @@ public: virtual ~inversePointDistanceDiffusivity(); - // Member Functions + // Member Operators - //- Correct the motion diffusivity - virtual void correct(); + //- Return diffusivity field + virtual tmp operator()() const; }; diff --git a/src/fvMotionSolver/motionDiffusivity/inverseVolume/inverseVolumeDiffusivity.C b/src/fvMotionSolver/motionDiffusivity/inverseVolume/inverseVolumeDiffusivity.C index 986665dd93..844da54829 100644 --- a/src/fvMotionSolver/motionDiffusivity/inverseVolume/inverseVolumeDiffusivity.C +++ b/src/fvMotionSolver/motionDiffusivity/inverseVolume/inverseVolumeDiffusivity.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -24,11 +24,11 @@ License \*---------------------------------------------------------------------------*/ #include "inverseVolumeDiffusivity.H" -#include "addToRunTimeSelectionTable.H" #include "patchWave.H" #include "HashSet.H" #include "surfaceInterpolate.H" #include "zeroGradientFvPatchFields.H" +#include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -53,10 +53,8 @@ Foam::inverseVolumeDiffusivity::inverseVolumeDiffusivity Istream& mdData ) : - uniformDiffusivity(mesh, mdData) -{ - correct(); -} + motionDiffusivity(mesh) +{} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // @@ -67,7 +65,8 @@ Foam::inverseVolumeDiffusivity::~inverseVolumeDiffusivity() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void Foam::inverseVolumeDiffusivity::correct() +Foam::tmp +Foam::inverseVolumeDiffusivity::operator()() const { volScalarField V ( @@ -88,7 +87,11 @@ void Foam::inverseVolumeDiffusivity::correct() V.primitiveFieldRef() = mesh().V(); V.correctBoundaryConditions(); - faceDiffusivity_ = 1.0/fvc::interpolate(V); + return surfaceScalarField::New + ( + "faceDiffusivity", + 1.0/fvc::interpolate(V) + ); } diff --git a/src/fvMotionSolver/motionDiffusivity/inverseVolume/inverseVolumeDiffusivity.H b/src/fvMotionSolver/motionDiffusivity/inverseVolume/inverseVolumeDiffusivity.H index b1bf8f054f..a5f668c98b 100644 --- a/src/fvMotionSolver/motionDiffusivity/inverseVolume/inverseVolumeDiffusivity.H +++ b/src/fvMotionSolver/motionDiffusivity/inverseVolume/inverseVolumeDiffusivity.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -35,7 +35,7 @@ SourceFiles #ifndef inverseVolumeDiffusivity_H #define inverseVolumeDiffusivity_H -#include "uniformDiffusivity.H" +#include "motionDiffusivity.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -48,7 +48,7 @@ namespace Foam class inverseVolumeDiffusivity : - public uniformDiffusivity + public motionDiffusivity { // Private Member Functions @@ -75,10 +75,10 @@ public: virtual ~inverseVolumeDiffusivity(); - // Member Functions + // Member Operators - //- Correct the motion diffusivity - virtual void correct(); + //- Return diffusivity field + virtual tmp operator()() const; }; diff --git a/src/fvMotionSolver/motionDiffusivity/motionDiffusivity/motionDiffusivity.H b/src/fvMotionSolver/motionDiffusivity/motionDiffusivity/motionDiffusivity.H index 376d621503..8cf378ea1f 100644 --- a/src/fvMotionSolver/motionDiffusivity/motionDiffusivity/motionDiffusivity.H +++ b/src/fvMotionSolver/motionDiffusivity/motionDiffusivity/motionDiffusivity.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -103,11 +103,15 @@ public: return mesh_; } + //- Correct the motion diffusivity + virtual void correct() + {} + + + // Member Operators + //- Return diffusivity field virtual tmp operator()() const = 0; - - //- Correct the motion diffusivity - virtual void correct() = 0; }; diff --git a/src/fvMotionSolver/motionDiffusivity/motionDirectional/motionDirectionalDiffusivity.C b/src/fvMotionSolver/motionDiffusivity/motionDirectional/motionDirectionalDiffusivity.C index 6e937705ab..963496e598 100644 --- a/src/fvMotionSolver/motionDiffusivity/motionDirectional/motionDirectionalDiffusivity.C +++ b/src/fvMotionSolver/motionDiffusivity/motionDirectional/motionDirectionalDiffusivity.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -27,7 +27,6 @@ License #include "surfaceInterpolate.H" #include "zeroGradientFvPatchFields.H" #include "addToRunTimeSelectionTable.H" -#include "velocityMotionSolver.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -52,7 +51,7 @@ Foam::motionDirectionalDiffusivity::motionDirectionalDiffusivity Istream& mdData ) : - uniformDiffusivity(mesh, mdData), + motionDiffusivity(mesh), diffusivityVector_(mdData) {} @@ -65,11 +64,10 @@ Foam::motionDirectionalDiffusivity::~motionDirectionalDiffusivity() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void Foam::motionDirectionalDiffusivity::correct() +Foam::tmp +Foam::motionDirectionalDiffusivity::operator()() const { - static bool first = true; - - if (!first) + if (mesh().foundObject("cellMotionU")) { const volVectorField& cellMotionU = mesh().lookupObject("cellMotionU"); @@ -90,17 +88,31 @@ void Foam::motionDirectionalDiffusivity::correct() D.correctBoundaryConditions(); const surfaceVectorField n(mesh().Sf()/mesh().magSf()); - faceDiffusivity_ == (n & cmptMultiply(fvc::interpolate(D), n)); + + return surfaceScalarField::New + ( + "faceDiffusivity", + (n & cmptMultiply(fvc::interpolate(D), n)) + ); } else { - first = false; - - const velocityMotionSolver& mSolver = - mesh().lookupObject("dynamicMeshDict"); - - const_cast(mSolver).solve(); - correct(); + return tmp + ( + new surfaceScalarField + ( + IOobject + ( + "faceDiffusivity", + mesh().time().timeName(), + mesh(), + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh(), + dimensionedScalar(dimless, 1.0) + ) + ); } } diff --git a/src/fvMotionSolver/motionDiffusivity/motionDirectional/motionDirectionalDiffusivity.H b/src/fvMotionSolver/motionDiffusivity/motionDirectional/motionDirectionalDiffusivity.H index 22f20c99f1..ab97195e72 100644 --- a/src/fvMotionSolver/motionDiffusivity/motionDirectional/motionDirectionalDiffusivity.H +++ b/src/fvMotionSolver/motionDiffusivity/motionDirectional/motionDirectionalDiffusivity.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -35,7 +35,7 @@ SourceFiles #ifndef motionDirectionalDiffusivity_H #define motionDirectionalDiffusivity_H -#include "uniformDiffusivity.H" +#include "motionDiffusivity.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -48,7 +48,7 @@ namespace Foam class motionDirectionalDiffusivity : - public uniformDiffusivity + public motionDiffusivity { // Private data @@ -80,10 +80,10 @@ public: virtual ~motionDirectionalDiffusivity(); - // Member Functions + // Member Operators - //- Correct the motion diffusivity - virtual void correct(); + //- Return diffusivity field + virtual tmp operator()() const; }; diff --git a/src/fvMotionSolver/motionDiffusivity/uniform/uniformDiffusivity.C b/src/fvMotionSolver/motionDiffusivity/uniform/uniformDiffusivity.C index 7afa8998d1..6f6ebee810 100644 --- a/src/fvMotionSolver/motionDiffusivity/uniform/uniformDiffusivity.C +++ b/src/fvMotionSolver/motionDiffusivity/uniform/uniformDiffusivity.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -24,6 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "uniformDiffusivity.H" +#include "surfaceFields.H" #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -49,20 +50,7 @@ Foam::uniformDiffusivity::uniformDiffusivity Istream& ) : - motionDiffusivity(mesh), - faceDiffusivity_ - ( - IOobject - ( - "faceDiffusivity", - mesh.time().timeName(), - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - mesh, - dimensionedScalar(dimless, 1.0) - ) + motionDiffusivity(mesh) {} @@ -72,4 +60,28 @@ Foam::uniformDiffusivity::~uniformDiffusivity() {} +// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // + +Foam::tmp +Foam::uniformDiffusivity::operator()() const +{ + return tmp + ( + new surfaceScalarField + ( + IOobject + ( + "faceDiffusivity", + mesh().time().timeName(), + mesh(), + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh(), + dimensionedScalar(dimless, 1.0) + ) + ); +} + + // ************************************************************************* // diff --git a/src/fvMotionSolver/motionDiffusivity/uniform/uniformDiffusivity.H b/src/fvMotionSolver/motionDiffusivity/uniform/uniformDiffusivity.H index f9d630229a..1bc63b4357 100644 --- a/src/fvMotionSolver/motionDiffusivity/uniform/uniformDiffusivity.H +++ b/src/fvMotionSolver/motionDiffusivity/uniform/uniformDiffusivity.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -36,7 +36,6 @@ SourceFiles #define uniformDiffusivity_H #include "motionDiffusivity.H" -#include "surfaceFields.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -51,16 +50,6 @@ class uniformDiffusivity : public motionDiffusivity { - -protected: - - // Protected data - - surfaceScalarField faceDiffusivity_; - - -private: - // Private Member Functions //- Disallow default bitwise copy construct @@ -86,17 +75,10 @@ public: virtual ~uniformDiffusivity(); - // Member Functions + // Member Operators //- Return diffusivity field - virtual tmp operator()() const - { - return faceDiffusivity_; - } - - //- Do not correct the motion diffusivity - virtual void correct() - {} + virtual tmp operator()() const; }; diff --git a/src/fvMotionSolver/pointPatchFields/derived/surfaceDisplacement/surfaceDisplacementPointPatchVectorField.C b/src/fvMotionSolver/pointPatchFields/derived/surfaceDisplacement/surfaceDisplacementPointPatchVectorField.C index bf9073a0f2..37d82726e4 100644 --- a/src/fvMotionSolver/pointPatchFields/derived/surfaceDisplacement/surfaceDisplacementPointPatchVectorField.C +++ b/src/fvMotionSolver/pointPatchFields/derived/surfaceDisplacement/surfaceDisplacementPointPatchVectorField.C @@ -27,7 +27,7 @@ License #include "addToRunTimeSelectionTable.H" #include "Time.H" #include "transformField.H" -#include "fvMesh.H" +#include "dynamicMotionSolverFvMesh.H" #include "displacementMotionSolver.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -94,12 +94,13 @@ void surfaceDisplacementPointPatchVectorField::calcProjection << endl; } - // Get the starting locations from the motionSolver - const pointField& points0 = mesh.lookupObject - ( - "dynamicMeshDict" - ).points0(); + // Get the motionSolver from the dynamic mesh + const motionSolver& motion = + refCast(mesh).motion(); + // Get the starting locations from the motionSolver + const pointField& points0 = + refCast(motion).points0(); pointField start(meshPoints.size()); forAll(start, i) diff --git a/src/fvMotionSolver/pointPatchFields/derived/surfaceSlipDisplacement/surfaceSlipDisplacementPointPatchVectorField.C b/src/fvMotionSolver/pointPatchFields/derived/surfaceSlipDisplacement/surfaceSlipDisplacementPointPatchVectorField.C index fd4fe30874..d611b595a4 100644 --- a/src/fvMotionSolver/pointPatchFields/derived/surfaceSlipDisplacement/surfaceSlipDisplacementPointPatchVectorField.C +++ b/src/fvMotionSolver/pointPatchFields/derived/surfaceSlipDisplacement/surfaceSlipDisplacementPointPatchVectorField.C @@ -27,7 +27,7 @@ License #include "addToRunTimeSelectionTable.H" #include "Time.H" #include "transformField.H" -#include "fvMesh.H" +#include "dynamicMotionSolverFvMesh.H" #include "displacementMotionSolver.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -93,12 +93,13 @@ void surfaceSlipDisplacementPointPatchVectorField::calcProjection << endl; } - // Get the starting locations from the motionSolver - const pointField& points0 = mesh.lookupObject - ( - "dynamicMeshDict" - ).points0(); + // Get the motionSolver from the dynamic mesh + const motionSolver& motion = + refCast(mesh).motion(); + // Get the starting locations from the motionSolver + const pointField& points0 = + refCast(motion).points0(); pointField start(meshPoints.size()); forAll(start, i) diff --git a/src/mesh/snappyHexMesh/externalDisplacementMeshMover/displacementMeshMoverMotionSolver.C b/src/mesh/snappyHexMesh/externalDisplacementMeshMover/displacementMeshMoverMotionSolver.C index 201d674cc9..252838ee95 100644 --- a/src/mesh/snappyHexMesh/externalDisplacementMeshMover/displacementMeshMoverMotionSolver.C +++ b/src/mesh/snappyHexMesh/externalDisplacementMeshMover/displacementMeshMoverMotionSolver.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2013-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -42,15 +42,12 @@ namespace Foam } -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::displacementMeshMoverMotionSolver::displacementMeshMoverMotionSolver ( const polyMesh& mesh, - const IOdictionary& dict + const dictionary& dict ) : displacementMotionSolver(mesh, dict, typeName) // read pointDisplacement @@ -66,7 +63,6 @@ Foam::displacementMeshMoverMotionSolver:: // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - Foam::externalDisplacementMeshMover& Foam::displacementMeshMoverMotionSolver::meshMover() const { diff --git a/src/mesh/snappyHexMesh/externalDisplacementMeshMover/displacementMeshMoverMotionSolver.H b/src/mesh/snappyHexMesh/externalDisplacementMeshMover/displacementMeshMoverMotionSolver.H index 485f20e1ef..87d264585d 100644 --- a/src/mesh/snappyHexMesh/externalDisplacementMeshMover/displacementMeshMoverMotionSolver.H +++ b/src/mesh/snappyHexMesh/externalDisplacementMeshMover/displacementMeshMoverMotionSolver.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2013-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -77,8 +77,8 @@ public: // Constructors - //- Construct from polyMesh and IOdictionary - displacementMeshMoverMotionSolver(const polyMesh&, const IOdictionary&); + //- Construct from polyMesh and dictionary + displacementMeshMoverMotionSolver(const polyMesh&, const dictionary&); //- Destructor diff --git a/src/rigidBodyMeshMotion/rigidBodyMeshMotion/rigidBodyMeshMotion.C b/src/rigidBodyMeshMotion/rigidBodyMeshMotion/rigidBodyMeshMotion.C index 43690cfcc8..1c611be63b 100644 --- a/src/rigidBodyMeshMotion/rigidBodyMeshMotion/rigidBodyMeshMotion.C +++ b/src/rigidBodyMeshMotion/rigidBodyMeshMotion/rigidBodyMeshMotion.C @@ -84,7 +84,7 @@ Foam::rigidBodyMeshMotion::bodyMesh::bodyMesh Foam::rigidBodyMeshMotion::rigidBodyMeshMotion ( const polyMesh& mesh, - const IOdictionary& dict + const dictionary& dict ) : displacementMotionSolver(mesh, dict, typeName), @@ -237,18 +237,18 @@ void Foam::rigidBodyMeshMotion::solve() } // Store the motion state at the beginning of the time-step - if (curTimeIndex_ != this->db().time().timeIndex()) + if (curTimeIndex_ != t.timeIndex()) { newTime(); - curTimeIndex_ = this->db().time().timeIndex(); + curTimeIndex_ = t.timeIndex(); } const scalar ramp = ramp_->value(t.value()); - if (db().foundObject("g")) + if (t.foundObject("g")) { g() = - ramp*db().lookupObject("g").value(); + ramp*t.lookupObject("g").value(); } if (test_) @@ -281,7 +281,7 @@ void Foam::rigidBodyMeshMotion::solve() forcesDict.add("rho", rhoName_); forcesDict.add("CofR", vector::zero); - functionObjects::forces f("forces", db(), forcesDict); + functionObjects::forces f("forces", t, forcesDict); f.calcForcesMoment(); fx[bodyID] = ramp*spatialVector(f.momentEff(), f.forceEff()); @@ -336,46 +336,4 @@ void Foam::rigidBodyMeshMotion::solve() } -bool Foam::rigidBodyMeshMotion::writeObject -( - IOstream::streamFormat fmt, - IOstream::versionNumber ver, - IOstream::compressionType cmp, - const bool valid -) const -{ - IOdictionary dict - ( - IOobject - ( - "rigidBodyMotionState", - mesh().time().timeName(), - "uniform", - mesh(), - IOobject::NO_READ, - IOobject::NO_WRITE, - false - ) - ); - - state().write(dict); - return dict.regIOobject::write(); -} - - -bool Foam::rigidBodyMeshMotion::read() -{ - if (displacementMotionSolver::read()) - { - RBD::rigidBodyMotion::read(coeffDict()); - - return true; - } - else - { - return false; - } -} - - // ************************************************************************* // diff --git a/src/rigidBodyMeshMotion/rigidBodyMeshMotion/rigidBodyMeshMotion.H b/src/rigidBodyMeshMotion/rigidBodyMeshMotion/rigidBodyMeshMotion.H index a8ab033551..13310695a5 100644 --- a/src/rigidBodyMeshMotion/rigidBodyMeshMotion/rigidBodyMeshMotion.H +++ b/src/rigidBodyMeshMotion/rigidBodyMeshMotion/rigidBodyMeshMotion.H @@ -142,11 +142,11 @@ public: // Constructors - //- Construct from polyMesh and IOdictionary + //- Construct from polyMesh and dictionary rigidBodyMeshMotion ( const polyMesh&, - const IOdictionary& dict + const dictionary& dict ); @@ -161,18 +161,6 @@ public: //- Solve for motion virtual void solve(); - - //- Write state using given format, version and compression - virtual bool writeObject - ( - IOstream::streamFormat fmt, - IOstream::versionNumber ver, - IOstream::compressionType cmp, - const bool valid - ) const; - - //- Read dynamicMeshDict dictionary - virtual bool read(); }; diff --git a/src/rigidBodyMeshMotion/rigidBodyMeshMotionSolver/rigidBodyMeshMotionSolver.C b/src/rigidBodyMeshMotion/rigidBodyMeshMotionSolver/rigidBodyMeshMotionSolver.C index 6019a2f96f..ae4c621e8c 100644 --- a/src/rigidBodyMeshMotion/rigidBodyMeshMotionSolver/rigidBodyMeshMotionSolver.C +++ b/src/rigidBodyMeshMotion/rigidBodyMeshMotionSolver/rigidBodyMeshMotionSolver.C @@ -67,7 +67,7 @@ Foam::rigidBodyMeshMotionSolver::bodyMesh::bodyMesh Foam::rigidBodyMeshMotionSolver::rigidBodyMeshMotionSolver ( const polyMesh& mesh, - const IOdictionary& dict + const dictionary& dict ) : motionSolver(mesh, dict, typeName), @@ -187,16 +187,16 @@ void Foam::rigidBodyMeshMotionSolver::solve() } // Store the motion state at the beginning of the time-step - if (curTimeIndex_ != this->db().time().timeIndex()) + if (curTimeIndex_ != t.timeIndex()) { newTime(); - curTimeIndex_ = this->db().time().timeIndex(); + curTimeIndex_ = t.timeIndex(); } - if (db().foundObject("g")) + if (t.foundObject("g")) { g() = - db().lookupObject("g").value(); + t.lookupObject("g").value(); } if (test_) @@ -229,7 +229,7 @@ void Foam::rigidBodyMeshMotionSolver::solve() forcesDict.add("rho", rhoName_); forcesDict.add("CofR", vector::zero); - functionObjects::forces f("forces", db(), forcesDict); + functionObjects::forces f("forces", t, forcesDict); f.calcForcesMoment(); fx[bodyID] = spatialVector(f.momentEff(), f.forceEff()); @@ -280,48 +280,6 @@ void Foam::rigidBodyMeshMotionSolver::solve() } -bool Foam::rigidBodyMeshMotionSolver::writeObject -( - IOstream::streamFormat fmt, - IOstream::versionNumber ver, - IOstream::compressionType cmp, - const bool valid -) const -{ - IOdictionary dict - ( - IOobject - ( - "rigidBodyMotionState", - mesh().time().timeName(), - "uniform", - mesh(), - IOobject::NO_READ, - IOobject::NO_WRITE, - false - ) - ); - - state().write(dict); - return dict.regIOobject::write(); -} - - -bool Foam::rigidBodyMeshMotionSolver::read() -{ - if (motionSolver::read()) - { - RBD::rigidBodyMotion::read(coeffDict()); - - return true; - } - else - { - return false; - } -} - - void Foam::rigidBodyMeshMotionSolver::movePoints(const pointField& points) { meshSolverPtr_->movePoints(points); diff --git a/src/rigidBodyMeshMotion/rigidBodyMeshMotionSolver/rigidBodyMeshMotionSolver.H b/src/rigidBodyMeshMotion/rigidBodyMeshMotionSolver/rigidBodyMeshMotionSolver.H index 510c8db80e..acdf5a76f6 100644 --- a/src/rigidBodyMeshMotion/rigidBodyMeshMotionSolver/rigidBodyMeshMotionSolver.H +++ b/src/rigidBodyMeshMotion/rigidBodyMeshMotionSolver/rigidBodyMeshMotionSolver.H @@ -132,11 +132,11 @@ public: // Constructors - //- Construct from polyMesh and IOdictionary + //- Construct from polyMesh and dictionary rigidBodyMeshMotionSolver ( const polyMesh&, - const IOdictionary& dict + const dictionary& dict ); @@ -152,18 +152,6 @@ public: //- Solve for motion virtual void solve(); - //- Write state using given format, version and compression - virtual bool writeObject - ( - IOstream::streamFormat fmt, - IOstream::versionNumber ver, - IOstream::compressionType cmp, - const bool valid - ) const; - - //- Read dynamicMeshDict dictionary - virtual bool read(); - //- Update local data for geometry changes virtual void movePoints(const pointField&); diff --git a/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionSolver/sixDoFRigidBodyMotionSolver.C b/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionSolver/sixDoFRigidBodyMotionSolver.C index 60c0cc48d6..1c453f9d07 100644 --- a/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionSolver/sixDoFRigidBodyMotionSolver.C +++ b/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionSolver/sixDoFRigidBodyMotionSolver.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2013-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -52,7 +52,7 @@ namespace Foam Foam::sixDoFRigidBodyMotionSolver::sixDoFRigidBodyMotionSolver ( const polyMesh& mesh, - const IOdictionary& dict + const dictionary& dict ) : displacementMotionSolver(mesh, dict, typeName), @@ -187,25 +187,25 @@ void Foam::sixDoFRigidBodyMotionSolver::solve() // Store the motion state at the beginning of the time-stepbool bool firstIter = false; - if (curTimeIndex_ != this->db().time().timeIndex()) + if (curTimeIndex_ != t.timeIndex()) { motion_.newTime(); - curTimeIndex_ = this->db().time().timeIndex(); + curTimeIndex_ = t.timeIndex(); firstIter = true; } dimensionedVector g("g", dimAcceleration, Zero); - if (db().foundObject("g")) + if (t.foundObject("g")) { - g = db().lookupObject("g"); + g = t.lookupObject("g"); } else if (coeffDict().found("g")) { coeffDict().lookup("g") >> g; } - // scalar ramp = min(max((this->db().time().value() - 5)/10, 0), 1); + // scalar ramp = min(max((t.value() - 5)/10, 0), 1); scalar ramp = 1.0; if (test_) @@ -229,7 +229,7 @@ void Foam::sixDoFRigidBodyMotionSolver::solve() forcesDict.add("rho", rhoName_); forcesDict.add("CofR", motion_.centreOfRotation()); - functionObjects::forces f("forces", db(), forcesDict); + functionObjects::forces f("forces", t, forcesDict); f.calcForcesMoment(); @@ -259,46 +259,4 @@ void Foam::sixDoFRigidBodyMotionSolver::solve() } -bool Foam::sixDoFRigidBodyMotionSolver::writeObject -( - IOstream::streamFormat fmt, - IOstream::versionNumber ver, - IOstream::compressionType cmp, - const bool valid -) const -{ - IOdictionary dict - ( - IOobject - ( - "sixDoFRigidBodyMotionState", - mesh().time().timeName(), - "uniform", - mesh(), - IOobject::NO_READ, - IOobject::NO_WRITE, - false - ) - ); - - motion_.state().write(dict); - return dict.regIOobject::write(); -} - - -bool Foam::sixDoFRigidBodyMotionSolver::read() -{ - if (displacementMotionSolver::read()) - { - motion_.read(coeffDict()); - - return true; - } - else - { - return false; - } -} - - // ************************************************************************* // diff --git a/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionSolver/sixDoFRigidBodyMotionSolver.H b/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionSolver/sixDoFRigidBodyMotionSolver.H index c3349be36a..f13ece1a65 100644 --- a/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionSolver/sixDoFRigidBodyMotionSolver.H +++ b/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionSolver/sixDoFRigidBodyMotionSolver.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2013-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -110,11 +110,11 @@ public: // Constructors - //- Construct from polyMesh and IOdictionary + //- Construct from polyMesh and dictionary sixDoFRigidBodyMotionSolver ( const polyMesh&, - const IOdictionary& dict + const dictionary& dict ); @@ -132,18 +132,6 @@ public: //- Solve for motion virtual void solve(); - - //- Write state using given format, version and compression - virtual bool writeObject - ( - IOstream::streamFormat fmt, - IOstream::versionNumber ver, - IOstream::compressionType cmp, - const bool valid - ) const; - - //- Read dynamicMeshDict dictionary - virtual bool read(); }; diff --git a/src/topoChangerFvMesh/linearValveFvMesh/linearValveFvMesh.C b/src/topoChangerFvMesh/linearValveFvMesh/linearValveFvMesh.C index b85d11ed88..5d4cd81bff 100644 --- a/src/topoChangerFvMesh/linearValveFvMesh/linearValveFvMesh.C +++ b/src/topoChangerFvMesh/linearValveFvMesh/linearValveFvMesh.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -260,26 +260,11 @@ bool Foam::linearValveFvMesh::attached() const // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// Construct from components Foam::linearValveFvMesh::linearValveFvMesh(const IOobject& io) : topoChangerFvMesh(io), - motionDict_ - ( - IOdictionary - ( - IOobject - ( - "dynamicMeshDict", - time().constant(), - *this, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE, - false - ) - ).optionalSubDict(typeName + "Coeffs") - ), - msPtr_(motionSolver::New(*this)) + motionDict_(dict().optionalSubDict(typeName + "Coeffs")), + msPtr_(motionSolver::New(*this), dict()) { addZonesAndModifiers(); } diff --git a/src/topoChangerFvMesh/linearValveLayersFvMesh/linearValveLayersFvMesh.C b/src/topoChangerFvMesh/linearValveLayersFvMesh/linearValveLayersFvMesh.C index 766a61eb02..a6bf7a2520 100644 --- a/src/topoChangerFvMesh/linearValveLayersFvMesh/linearValveLayersFvMesh.C +++ b/src/topoChangerFvMesh/linearValveLayersFvMesh/linearValveLayersFvMesh.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -339,25 +339,10 @@ Foam::tmp Foam::linearValveLayersFvMesh::newPoints() const // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// Construct from components Foam::linearValveLayersFvMesh::linearValveLayersFvMesh(const IOobject& io) : topoChangerFvMesh(io), - motionDict_ - ( - IOdictionary - ( - IOobject - ( - "dynamicMeshDict", - time().constant(), - *this, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE, - false - ) - ).optionalSubDict(typeName + "Coeffs") - ) + motionDict_(dynamicMeshDict().optionalSubDict(typeName + "Coeffs")) { addZonesAndModifiers(); } diff --git a/src/topoChangerFvMesh/mixerFvMesh/mixerFvMesh.C b/src/topoChangerFvMesh/mixerFvMesh/mixerFvMesh.C index 01407e6eae..80d7f04b7c 100644 --- a/src/topoChangerFvMesh/mixerFvMesh/mixerFvMesh.C +++ b/src/topoChangerFvMesh/mixerFvMesh/mixerFvMesh.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -280,21 +280,7 @@ Foam::mixerFvMesh::mixerFvMesh ) : topoChangerFvMesh(io), - motionDict_ - ( - IOdictionary - ( - IOobject - ( - "dynamicMeshDict", - time().constant(), - *this, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE, - false - ) - ).optionalSubDict(typeName + "Coeffs") - ), + motionDict_(dynamicMeshDict().optionalSubDict(typeName + "Coeffs")), csPtr_ ( coordinateSystem::New diff --git a/src/topoChangerFvMesh/movingConeTopoFvMesh/movingConeTopoFvMesh.C b/src/topoChangerFvMesh/movingConeTopoFvMesh/movingConeTopoFvMesh.C index c6316a9c0f..99f8f4e551 100644 --- a/src/topoChangerFvMesh/movingConeTopoFvMesh/movingConeTopoFvMesh.C +++ b/src/topoChangerFvMesh/movingConeTopoFvMesh/movingConeTopoFvMesh.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -250,21 +250,7 @@ void Foam::movingConeTopoFvMesh::addZonesAndModifiers() Foam::movingConeTopoFvMesh::movingConeTopoFvMesh(const IOobject& io) : topoChangerFvMesh(io), - motionDict_ - ( - IOdictionary - ( - IOobject - ( - "dynamicMeshDict", - time().constant(), - *this, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE, - false - ) - ).optionalSubDict(typeName + "Coeffs") - ), + motionDict_(dynamicMeshDict().optionalSubDict(typeName + "Coeffs")), motionVelAmplitude_(motionDict_.lookup("motionVelAmplitude")), motionVelPeriod_(readScalar(motionDict_.lookup("motionVelPeriod"))), curMotionVel_