fvMotionSolvers: Reinstated velocity and componentVelocity motion solvers

There are cases still using these deprecated motion solvers pending update to
use interpolated displacement motion methods.
This commit is contained in:
Henry Weller
2021-12-08 11:48:40 +00:00
parent 5c4d42224f
commit 31fee136e1
8 changed files with 594 additions and 12 deletions

View File

@ -4,6 +4,10 @@ fvMotionSolvers/displacement/laplacian/displacementLaplacianFvMotionSolver.C
fvMotionSolvers/componentDisplacement/componentLaplacian/displacementComponentLaplacianFvMotionSolver.C
fvMotionSolvers/velocity/laplacian/velocityLaplacianFvMotionSolver.C
fvMotionSolvers/componentVelocity/componentLaplacian/velocityComponentLaplacianFvMotionSolver.C
motionDiffusivity/motionDiffusivity/motionDiffusivity.C
motionDiffusivity/uniform/uniformDiffusivity.C
motionDiffusivity/inverseDistance/inverseDistanceDiffusivity.C

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -82,16 +82,23 @@ displacementComponentLaplacianFvMotionSolver
: -1
)
{
Switch applyPointLocation
typeIOobject<pointVectorField> io
(
coeffDict().lookupOrDefault
(
"applyPointLocation",
true
)
"pointLocation",
fvMesh_.time().timeName(),
fvMesh_,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
);
if (applyPointLocation)
if (debug)
{
Info<< "displacementComponentLaplacianFvMotionSolver:" << nl
<< " diffusivity : " << diffusivityPtr_().type() << nl
<< " frozenPoints zone : " << frozenPointsZone_ << endl;
}
if (io.headerOk())
{
pointLocation_.reset
(
@ -109,7 +116,7 @@ displacementComponentLaplacianFvMotionSolver
)
);
// if (debug)
if (debug)
{
Info<< "displacementComponentLaplacianFvMotionSolver :"
<< " Read pointVectorField "

View File

@ -0,0 +1,151 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "velocityComponentLaplacianFvMotionSolver.H"
#include "motionDiffusivity.H"
#include "fvmLaplacian.H"
#include "addToRunTimeSelectionTable.H"
#include "volPointInterpolation.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(velocityComponentLaplacianFvMotionSolver, 0);
addToRunTimeSelectionTable
(
motionSolver,
velocityComponentLaplacianFvMotionSolver,
dictionary
);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::velocityComponentLaplacianFvMotionSolver::
velocityComponentLaplacianFvMotionSolver
(
const polyMesh& mesh,
const dictionary& dict
)
:
componentVelocityMotionSolver(mesh, dict, typeName),
fvMotionSolver(mesh),
cellMotionU_
(
IOobject
(
"cellMotionU" + cmptName_,
mesh.time().timeName(),
mesh,
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
fvMesh_,
dimensionedScalar(pointMotionU_.dimensions(), 0),
cellMotionBoundaryTypes<scalar>(pointMotionU_.boundaryField())
),
diffusivityPtr_
(
motionDiffusivity::New(fvMesh_, coeffDict().lookup("diffusivity"))
)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::velocityComponentLaplacianFvMotionSolver::
~velocityComponentLaplacianFvMotionSolver()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::tmp<Foam::pointField>
Foam::velocityComponentLaplacianFvMotionSolver::curPoints() const
{
volPointInterpolation::New(fvMesh_).interpolate
(
cellMotionU_,
pointMotionU_
);
tmp<pointField> tcurPoints(new pointField(fvMesh_.points()));
tcurPoints.ref().replace
(
cmpt_,
tcurPoints().component(cmpt_)
+ fvMesh_.time().deltaTValue()*pointMotionU_.primitiveField()
);
twoDCorrectPoints(tcurPoints.ref());
return tcurPoints;
}
void Foam::velocityComponentLaplacianFvMotionSolver::solve()
{
// The points have moved so before interpolation update
// the fvMotionSolver accordingly
movePoints(fvMesh_.points());
diffusivityPtr_->correct();
pointMotionU_.boundaryFieldRef().updateCoeffs();
Foam::solve
(
fvm::laplacian
(
diffusivityPtr_->operator()(),
cellMotionU_,
"laplacian(diffusivity,cellMotionU)"
)
);
}
void Foam::velocityComponentLaplacianFvMotionSolver::updateMesh
(
const mapPolyMesh& mpm
)
{
componentVelocityMotionSolver::updateMesh(mpm);
// Update diffusivity. Note two stage to make sure old one is de-registered
// before creating/registering new one.
diffusivityPtr_.reset(nullptr);
diffusivityPtr_ = motionDiffusivity::New
(
fvMesh_,
coeffDict().lookup("diffusivity")
);
}
// ************************************************************************* //

View File

@ -0,0 +1,131 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::velocityComponentLaplacianFvMotionSolver
Description
Mesh motion solver for an fvMesh. Based on solving the cell-centre
Laplacian for the given component of the motion velocity.
SourceFiles
velocityComponentLaplacianFvMotionSolver.C
\*---------------------------------------------------------------------------*/
#ifndef velocityComponentLaplacianFvMotionSolver_H
#define velocityComponentLaplacianFvMotionSolver_H
#include "componentVelocityMotionSolver.H"
#include "fvMotionSolver.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward class declarations
class motionDiffusivity;
/*---------------------------------------------------------------------------*\
Class velocityComponentLaplacianFvMotionSolver Declaration
\*---------------------------------------------------------------------------*/
class velocityComponentLaplacianFvMotionSolver
:
public componentVelocityMotionSolver,
public fvMotionSolver
{
// Private Data
//- Cell-centre motion field
mutable volScalarField cellMotionU_;
//- Diffusivity used to control the motion
autoPtr<motionDiffusivity> diffusivityPtr_;
public:
//- Runtime type information
TypeName("velocityComponentLaplacian");
// Constructors
//- Construct from polyMesh and dictionary
velocityComponentLaplacianFvMotionSolver
(
const polyMesh&,
const dictionary&
);
//- Disallow default bitwise copy construction
velocityComponentLaplacianFvMotionSolver
(
const velocityComponentLaplacianFvMotionSolver&
) = delete;
//- Destructor
~velocityComponentLaplacianFvMotionSolver();
// Member Functions
//- Non-const access to the cellMotionU in order to allow changes
// to the boundary motion
volScalarField& cellMotionU()
{
return cellMotionU_;
}
//- Return point location obtained from the current motion field
virtual tmp<pointField> curPoints() const;
//- Solve for motion
virtual void solve();
//- Update topology
virtual void updateMesh(const mapPolyMesh&);
// Member Operators
//- Disallow default bitwise assignment
void operator=
(
const velocityComponentLaplacianFvMotionSolver&
) = delete;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -104,7 +104,6 @@ Foam::displacementLaplacianFvMotionSolver::displacementLaplacianFvMotionSolver
<< " frozenPoints zone : " << frozenPointsZone_ << endl;
}
if (io.headerOk())
{
pointLocation_.reset

View File

@ -0,0 +1,158 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "velocityLaplacianFvMotionSolver.H"
#include "motionDiffusivity.H"
#include "fvmLaplacian.H"
#include "addToRunTimeSelectionTable.H"
#include "volPointInterpolation.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(velocityLaplacianFvMotionSolver, 0);
addToRunTimeSelectionTable
(
motionSolver,
velocityLaplacianFvMotionSolver,
dictionary
);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::velocityLaplacianFvMotionSolver::velocityLaplacianFvMotionSolver
(
const polyMesh& mesh,
const dictionary& dict
)
:
velocityMotionSolver(mesh, dict, typeName),
fvMotionSolver(mesh),
cellMotionU_
(
IOobject
(
"cellMotionU",
mesh.time().timeName(),
mesh,
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
fvMesh_,
dimensionedVector
(
"cellMotionU",
pointMotionU_.dimensions(),
Zero
),
cellMotionBoundaryTypes<vector>(pointMotionU_.boundaryField())
),
diffusivityPtr_
(
motionDiffusivity::New(fvMesh_, coeffDict().lookup("diffusivity"))
)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::velocityLaplacianFvMotionSolver::~velocityLaplacianFvMotionSolver()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::tmp<Foam::pointField>
Foam::velocityLaplacianFvMotionSolver::curPoints() const
{
volPointInterpolation::New(fvMesh_).interpolate
(
cellMotionU_,
pointMotionU_
);
tmp<pointField> tcurPoints
(
fvMesh_.points()
+ fvMesh_.time().deltaTValue()*pointMotionU_.primitiveField()
);
twoDCorrectPoints(tcurPoints.ref());
return tcurPoints;
}
void Foam::velocityLaplacianFvMotionSolver::solve()
{
// The points have moved so before interpolation update
// the fvMotionSolver accordingly
movePoints(fvMesh_.points());
diffusivityPtr_->correct();
pointMotionU_.boundaryFieldRef().updateCoeffs();
Foam::solve
(
fvm::laplacian
(
diffusivityPtr_->operator()(),
cellMotionU_,
"laplacian(diffusivity,cellMotionU)"
)
);
}
//void Foam::velocityLaplacianFvMotionSolver::movePoints(const pointField& p)
//{
// // Movement of pointMesh and volPointInterpolation already
// // done by polyMesh,fvMesh
//}
void Foam::velocityLaplacianFvMotionSolver::updateMesh
(
const mapPolyMesh& mpm
)
{
velocityMotionSolver::updateMesh(mpm);
// Update diffusivity. Note two stage to make sure old one is de-registered
// before creating/registering new one.
diffusivityPtr_.reset(nullptr);
diffusivityPtr_ = motionDiffusivity::New
(
fvMesh_,
coeffDict().lookup("diffusivity")
);
}
// ************************************************************************* //

View File

@ -0,0 +1,133 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::velocityLaplacianFvMotionSolver
Description
Mesh motion solver for an fvMesh. Based on solving the cell-centre
Laplacian for the motion velocity.
SourceFiles
velocityLaplacianFvMotionSolver.C
\*---------------------------------------------------------------------------*/
#ifndef velocityLaplacianFvMotionSolver_H
#define velocityLaplacianFvMotionSolver_H
#include "velocityMotionSolver.H"
#include "fvMotionSolver.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward class declarations
class motionDiffusivity;
/*---------------------------------------------------------------------------*\
Class velocityLaplacianFvMotionSolver Declaration
\*---------------------------------------------------------------------------*/
class velocityLaplacianFvMotionSolver
:
public velocityMotionSolver,
public fvMotionSolver
{
// Private Data
//- Cell-centre motion field
mutable volVectorField cellMotionU_;
//- Diffusivity used to control the motion
autoPtr<motionDiffusivity> diffusivityPtr_;
public:
//- Runtime type information
TypeName("velocityLaplacian");
// Constructors
//- Construct from polyMesh and dictionary
velocityLaplacianFvMotionSolver
(
const polyMesh&,
const dictionary&
);
//- Disallow default bitwise copy construction
velocityLaplacianFvMotionSolver
(
const velocityLaplacianFvMotionSolver&
);
//- Destructor
~velocityLaplacianFvMotionSolver();
// Member Functions
//- Return reference to the cell motion velocity field
volVectorField& cellMotionU()
{
return cellMotionU_;
}
//- Return const reference to the cell motion velocity field
const volVectorField& cellMotionU() const
{
return cellMotionU_;
}
//- Return point location obtained from the current motion field
virtual tmp<pointField> curPoints() const;
//- Solve for motion
virtual void solve();
//- Update topology
virtual void updateMesh(const mapPolyMesh&);
// Member Operators
//- Disallow default bitwise assignment
void operator=(const velocityLaplacianFvMotionSolver&) = delete;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -21,8 +21,7 @@ mover
libs ("libfvMeshMovers.so" "libfvMotionSolvers.so");
motionSolver displacementSBRStress; // displacementLaplacian;
// motionSolver velocityComponentLaplacian z;
motionSolver displacementSBRStress;
// diffusivity uniform;
// diffusivity directional (1 200 0);