Skip to content
Permalink
Browse files

dynamicFvMesh: Rationalised the handling and caching of the dynamicMe…

…shDict

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.
  • Loading branch information...
Henry Weller
Henry Weller committed Mar 21, 2019
1 parent 5a978bb commit a1a225c504668080332f11aa366c9eedd48f640e
Showing with 447 additions and 729 deletions.
  1. +13 −3 applications/utilities/mesh/manipulation/moveMesh/moveMesh.C
  2. +28 −4 src/dynamicFvMesh/dynamicFvMesh/dynamicFvMesh.C
  3. +17 −1 src/dynamicFvMesh/dynamicFvMesh/dynamicFvMesh.H
  4. +2 −16 src/dynamicFvMesh/dynamicFvMesh/dynamicFvMeshNew.C
  5. +2 −16 src/dynamicFvMesh/dynamicInkJetFvMesh/dynamicInkJetFvMesh.C
  6. +2 −16 src/dynamicFvMesh/dynamicInterpolatedFvMesh/dynamicInterpolatedFvMesh.C
  7. +2 −2 src/dynamicFvMesh/dynamicMotionSolverFvMesh/dynamicMotionSolverFvMesh.C
  8. +16 −1 src/dynamicFvMesh/dynamicMotionSolverFvMesh/dynamicMotionSolverFvMesh.H
  9. +5 −30 src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C
  10. +3 −3 src/dynamicMesh/motionSolvers/componentDisplacement/componentDisplacementMotionSolver.C
  11. +2 −2 src/dynamicMesh/motionSolvers/componentDisplacement/componentDisplacementMotionSolver.H
  12. +2 −2 src/dynamicMesh/motionSolvers/componentVelocity/componentVelocityMotionSolver.C
  13. +2 −2 src/dynamicMesh/motionSolvers/componentVelocity/componentVelocityMotionSolver.H
  14. +3 −3 src/dynamicMesh/motionSolvers/displacement/displacement/displacementMotionSolver.C
  15. +2 −2 src/dynamicMesh/motionSolvers/displacement/displacement/displacementMotionSolver.H
  16. +2 −2 src/dynamicMesh/motionSolvers/displacement/interpolation/displacementInterpolationMotionSolver.C
  17. +3 −3 src/dynamicMesh/motionSolvers/displacement/interpolation/displacementInterpolationMotionSolver.H
  18. +12 −12 src/dynamicMesh/motionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.C
  19. +3 −3 src/dynamicMesh/motionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.H
  20. +3 −3 src/dynamicMesh/motionSolvers/displacement/linearSolver/displacementLinearMotionMotionSolver.C
  21. +3 −3 src/dynamicMesh/motionSolvers/displacement/linearSolver/displacementLinearMotionMotionSolver.H
  22. +4 −4 src/dynamicMesh/motionSolvers/displacement/points0/points0MotionSolver.C
  23. +2 −2 src/dynamicMesh/motionSolvers/displacement/points0/points0MotionSolver.H
  24. +2 −2 ...rs/displacement/solidBody/interpolatingSolidBodyMotionSolver/interpolatingSolidBodyMotionSolver.C
  25. +3 −3 ...rs/displacement/solidBody/interpolatingSolidBodyMotionSolver/interpolatingSolidBodyMotionSolver.H
  26. +2 −2 ...Mesh/motionSolvers/displacement/solidBody/multiSolidBodyMotionSolver/multiSolidBodyMotionSolver.C
  27. +2 −2 ...Mesh/motionSolvers/displacement/solidBody/multiSolidBodyMotionSolver/multiSolidBodyMotionSolver.H
  28. +2 −2 src/dynamicMesh/motionSolvers/displacement/solidBody/solidBodyMotionSolver/solidBodyMotionSolver.C
  29. +2 −2 src/dynamicMesh/motionSolvers/displacement/solidBody/solidBodyMotionSolver/solidBodyMotionSolver.H
  30. +3 −98 src/dynamicMesh/motionSolvers/motionSolver/motionSolver.C
  31. +5 −35 src/dynamicMesh/motionSolvers/motionSolver/motionSolver.H
  32. +1 −1 src/dynamicMesh/motionSolvers/motionSolverList/motionSolverList.C
  33. +1 −1 src/dynamicMesh/motionSolvers/motionSolverList/motionSolverList.H
  34. +2 −2 src/dynamicMesh/motionSolvers/velocity/velocityMotionSolver.C
  35. +2 −2 src/dynamicMesh/motionSolvers/velocity/velocityMotionSolver.H
  36. +3 −1 src/fvMotionSolver/Make/options
  37. +2 −2 ...onSolvers/componentDisplacement/componentLaplacian/displacementComponentLaplacianFvMotionSolver.C
  38. +3 −3 ...onSolvers/componentDisplacement/componentLaplacian/displacementComponentLaplacianFvMotionSolver.H
  39. +2 −2 ...r/fvMotionSolvers/componentVelocity/componentLaplacian/velocityComponentLaplacianFvMotionSolver.C
  40. +3 −3 ...r/fvMotionSolvers/componentVelocity/componentLaplacian/velocityComponentLaplacianFvMotionSolver.H
  41. +2 −2 src/fvMotionSolver/fvMotionSolvers/displacement/SBRStress/displacementSBRStressFvMotionSolver.C
  42. +3 −3 src/fvMotionSolver/fvMotionSolvers/displacement/SBRStress/displacementSBRStressFvMotionSolver.H
  43. +2 −2 src/fvMotionSolver/fvMotionSolvers/displacement/laplacian/displacementLaplacianFvMotionSolver.C
  44. +3 −3 src/fvMotionSolver/fvMotionSolvers/displacement/laplacian/displacementLaplacianFvMotionSolver.H
  45. +2 −2 src/fvMotionSolver/fvMotionSolvers/velocity/laplacian/velocityLaplacianFvMotionSolver.C
  46. +3 −3 src/fvMotionSolver/fvMotionSolvers/velocity/laplacian/velocityLaplacianFvMotionSolver.H
  47. +13 −8 src/fvMotionSolver/motionDiffusivity/directional/directionalDiffusivity.C
  48. +6 −6 src/fvMotionSolver/motionDiffusivity/directional/directionalDiffusivity.H
  49. +13 −8 src/fvMotionSolver/motionDiffusivity/inverseDistance/inverseDistanceDiffusivity.C
  50. +6 −6 src/fvMotionSolver/motionDiffusivity/inverseDistance/inverseDistanceDiffusivity.H
  51. +34 −13 src/fvMotionSolver/motionDiffusivity/inverseFaceDistance/inverseFaceDistanceDiffusivity.C
  52. +6 −6 src/fvMotionSolver/motionDiffusivity/inverseFaceDistance/inverseFaceDistanceDiffusivity.H
  53. +32 −11 src/fvMotionSolver/motionDiffusivity/inversePointDistance/inversePointDistanceDiffusivity.C
  54. +6 −6 src/fvMotionSolver/motionDiffusivity/inversePointDistance/inversePointDistanceDiffusivity.H
  55. +11 −8 src/fvMotionSolver/motionDiffusivity/inverseVolume/inverseVolumeDiffusivity.C
  56. +6 −6 src/fvMotionSolver/motionDiffusivity/inverseVolume/inverseVolumeDiffusivity.H
  57. +8 −4 src/fvMotionSolver/motionDiffusivity/motionDiffusivity/motionDiffusivity.H
  58. +27 −15 src/fvMotionSolver/motionDiffusivity/motionDirectional/motionDirectionalDiffusivity.C
  59. +6 −6 src/fvMotionSolver/motionDiffusivity/motionDirectional/motionDirectionalDiffusivity.H
  60. +27 −15 src/fvMotionSolver/motionDiffusivity/uniform/uniformDiffusivity.C
  61. +3 −21 src/fvMotionSolver/motionDiffusivity/uniform/uniformDiffusivity.H
  62. +7 −6 ...ionSolver/pointPatchFields/derived/surfaceDisplacement/surfaceDisplacementPointPatchVectorField.C
  63. +7 −6 ...r/pointPatchFields/derived/surfaceSlipDisplacement/surfaceSlipDisplacementPointPatchVectorField.C
  64. +2 −6 src/mesh/snappyHexMesh/externalDisplacementMeshMover/displacementMeshMoverMotionSolver.C
  65. +3 −3 src/mesh/snappyHexMesh/externalDisplacementMeshMover/displacementMeshMoverMotionSolver.H
  66. +6 −48 src/rigidBodyMeshMotion/rigidBodyMeshMotion/rigidBodyMeshMotion.C
  67. +2 −14 src/rigidBodyMeshMotion/rigidBodyMeshMotion/rigidBodyMeshMotion.H
  68. +6 −48 src/rigidBodyMeshMotion/rigidBodyMeshMotionSolver/rigidBodyMeshMotionSolver.C
  69. +2 −14 src/rigidBodyMeshMotion/rigidBodyMeshMotionSolver/rigidBodyMeshMotionSolver.H
  70. +8 −50 src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionSolver/sixDoFRigidBodyMotionSolver.C
  71. +3 −15 src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionSolver/sixDoFRigidBodyMotionSolver.H
  72. +3 −18 src/topoChangerFvMesh/linearValveFvMesh/linearValveFvMesh.C
  73. +2 −17 src/topoChangerFvMesh/linearValveLayersFvMesh/linearValveLayersFvMesh.C
  74. +2 −16 src/topoChangerFvMesh/mixerFvMesh/mixerFvMesh.C
  75. +2 −16 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
@@ -40,12 +40,22 @@ using namespace Foam;

int main(int argc, char *argv[])
{

#include "setRootCase.H"
#include "createTime.H"
#include "createMesh.H"

autoPtr<motionSolver> motionPtr = motionSolver::New(mesh);
IOdictionary dynamicMeshDict
(
IOobject
(
"dynamicMeshDict",
mesh.time().constant(),
mesh,
IOobject::MUST_READ
)
);

autoPtr<motionSolver> motionPtr = motionSolver::New(mesh, dynamicMeshDict);

while (runTime.loop())
{
@@ -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/<regionname>. 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)))
{}


@@ -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
@@ -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> 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/<regionname>. 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<IOdictionary>(true))
{
@@ -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"))),
@@ -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_
@@ -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()))
{}


@@ -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
\*---------------------------------------------------------------------------*/
@@ -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<Pair<word>> fluxVelocities = List<Pair<word>>
@@ -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.

@@ -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,

0 comments on commit a1a225c

Please sign in to comment.
You can’t perform that action at this time.