ENH: motionSolver: refactor into displacement v.s. velocity

This commit is contained in:
mattijs
2012-08-31 14:25:13 +01:00
parent c1ef233e5d
commit 1444b6f6c5
35 changed files with 1344 additions and 647 deletions

View File

@ -85,7 +85,11 @@ motionSmoother/motionSmoother.C
motionSmoother/motionSmootherCheck.C
motionSmoother/polyMeshGeometry/polyMeshGeometry.C
motionSolver/motionSolver.C
motionSolver/motionSolver/motionSolver.C
motionSolver/displacement/displacementMotionSolver.C
motionSolver/componentDisplacement/componentDisplacementMotionSolver.C
motionSolver/velocity/velocityMotionSolver.C
motionSolver/componentVelocity/componentVelocityMotionSolver.C
createShellMesh/createShellMesh.C

View File

@ -2445,32 +2445,69 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
// parallel comms. After this points and edges should again be consistent.
mergeSharedPoints(constructPointMap);
// // Bit of hack: processorFvPatchField does not get reset since created
// // from nothing so explicitly reset.
// initPatchFields<volScalarField, processorFvPatchField<scalar> >
// (
// pTraits<scalar>::zero
// );
// initPatchFields<volVectorField, processorFvPatchField<vector> >
// (
// pTraits<vector>::zero
// );
// initPatchFields
// <
// volSphericalTensorField,
// processorFvPatchField<sphericalTensor>
// >
// (
// pTraits<sphericalTensor>::zero
// );
// initPatchFields<volSymmTensorField, processorFvPatchField<symmTensor> >
// (
// pTraits<symmTensor>::zero
// );
// initPatchFields<volTensorField, processorFvPatchField<tensor> >
// (
// pTraits<tensor>::zero
// );
// initPatchFields<surfaceScalarField, processorFvsPatchField<scalar> >
// (
// pTraits<scalar>::zero
// );
// initPatchFields<surfaceVectorField, processorFvsPatchField<vector> >
// (
// pTraits<vector>::zero
// );
// initPatchFields
// <
// surfaceSphericalTensorField,
// processorFvsPatchField<sphericalTensor>
// >
// (
// pTraits<sphericalTensor>::zero
// );
// initPatchFields
// <
// surfaceSymmTensorField,
// processorFvsPatchField<symmTensor>
// >
// (
// pTraits<symmTensor>::zero
// );
// initPatchFields<surfaceTensorField, processorFvsPatchField<tensor> >
// (
// pTraits<tensor>::zero
// );
//XXXXX
// Bit of hack: processorFvPatchField does not get reset since created
// from nothing so explicitly reset.
initPatchFields<volScalarField, processorFvPatchField<scalar> >
(
pTraits<scalar>::zero
);
initPatchFields<volVectorField, processorFvPatchField<vector> >
(
pTraits<vector>::zero
);
initPatchFields
<
volSphericalTensorField,
processorFvPatchField<sphericalTensor>
>
(
pTraits<sphericalTensor>::zero
);
initPatchFields<volSymmTensorField, processorFvPatchField<symmTensor> >
(
pTraits<symmTensor>::zero
);
initPatchFields<volTensorField, processorFvPatchField<tensor> >
(
pTraits<tensor>::zero
);
correctBoundaryConditions<volScalarField>();
correctBoundaryConditions<volVectorField>();
correctBoundaryConditions<volSphericalTensorField>();
correctBoundaryConditions<volSymmTensorField>();
correctBoundaryConditions<volTensorField>();
initPatchFields<surfaceScalarField, processorFvsPatchField<scalar> >
(
pTraits<scalar>::zero
@ -2499,7 +2536,7 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
(
pTraits<tensor>::zero
);
//XXXXX
mesh_.setInstance(mesh_.time().timeName());

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -138,6 +138,10 @@ class fvMeshDistribute
const typename GeoField::value_type& initVal
);
//- Call correctBoundaryConditions on fields
template<class GeoField>
void correctBoundaryConditions();
//- Delete all processor patches. Move any processor faces into
// patchI.
autoPtr<mapPolyMesh> deleteProcPatches(const label patchI);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -241,6 +241,24 @@ void Foam::fvMeshDistribute::initPatchFields
}
// correctBoundaryConditions patch fields of certain type
template<class GeoField>
void Foam::fvMeshDistribute::correctBoundaryConditions()
{
HashTable<const GeoField*> flds
(
mesh_.objectRegistry::lookupClass<GeoField>()
);
forAllConstIter(typename HashTable<const GeoField*>, flds, iter)
{
const GeoField& fld = *iter();
const_cast<GeoField&>(fld).correctBoundaryConditions();
}
}
// Send fields. Note order supplied so we can receive in exactly the same order.
// Note that field gets written as entry in dictionary so we
// can construct from subdictionary.

View File

@ -0,0 +1,215 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "componentDisplacementMotionSolver.H"
#include "mapPolyMesh.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(componentDisplacementMotionSolver, 0);
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
Foam::direction Foam::componentDisplacementMotionSolver::cmpt
(
const word& cmptName
) const
{
if (cmptName == "x")
{
return vector::X;
}
else if (cmptName == "y")
{
return vector::Y;
}
else if (cmptName == "z")
{
return vector::Z;
}
else
{
FatalErrorIn
(
"componentDisplacementMotionSolver::"
"componentDisplacementMotionSolver"
"(const polyMesh& mesh, const IOdictionary&)"
) << "Given component name " << cmptName << " should be x, y or z"
<< exit(FatalError);
return 0;
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::componentDisplacementMotionSolver::componentDisplacementMotionSolver
(
const polyMesh& mesh,
const IOdictionary& dict,
const word& type
)
:
motionSolver(mesh, dict, type),
cmptName_(coeffDict().lookup("component")),
cmpt_(cmpt(cmptName_)),
points0_
(
pointIOField
(
IOobject
(
"points",
time().constant(),
polyMesh::meshSubDir,
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
)
).component(cmpt_)
),
pointDisplacement_
(
IOobject
(
"pointDisplacement" + cmptName_,
mesh.time().timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
pointMesh::New(mesh)
)
{
if (points0_.size() != mesh.nPoints())
{
FatalErrorIn
(
"componentDisplacementMotionSolver::"
"componentDisplacementMotionSolver\n"
"(\n"
" const polyMesh&,\n"
" const IOdictionary&\n"
")"
) << "Number of points in mesh " << mesh.nPoints()
<< " differs from number of points " << points0_.size()
<< " read from file "
<<
IOobject
(
"points",
mesh.time().constant(),
polyMesh::meshSubDir,
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
).filePath()
<< exit(FatalError);
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::componentDisplacementMotionSolver::~componentDisplacementMotionSolver()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::componentDisplacementMotionSolver::movePoints(const pointField& p)
{
// No local data to update
}
void Foam::componentDisplacementMotionSolver::updateMesh(const mapPolyMesh& mpm)
{
// pointMesh already updates pointFields.
motionSolver::updateMesh(mpm);
// Map points0_. Bit special since we somehow have to come up with
// a sensible points0 position for introduced points.
// Find out scaling between points0 and current points
// Get the new points either from the map or the mesh
const scalarField points
(
mpm.hasMotionPoints()
? mpm.preMotionPoints().component(cmpt_)
: mesh().points().component(cmpt_)
);
// Get extents of points0 and points and determine scale
const scalar scale =
(gMax(points0_)-gMin(points0_))
/(gMax(points)-gMin(points));
scalarField newPoints0(mpm.pointMap().size());
forAll(newPoints0, pointI)
{
label oldPointI = mpm.pointMap()[pointI];
if (oldPointI >= 0)
{
label masterPointI = mpm.reversePointMap()[oldPointI];
if (masterPointI == pointI)
{
newPoints0[pointI] = points0_[oldPointI];
}
else
{
// New point. Assume motion is scaling.
newPoints0[pointI] =
points0_[oldPointI]
+ scale*(points[pointI]-points[masterPointI]);
}
}
else
{
FatalErrorIn
(
"displacementLaplacianFvMotionSolver::updateMesh"
"(const mapPolyMesh& mpm)"
) << "Cannot work out coordinates of introduced vertices."
<< " New vertex " << pointI << " at coordinate "
<< points[pointI] << exit(FatalError);
}
}
points0_.transfer(newPoints0);
}
// ************************************************************************* //

View File

@ -0,0 +1,142 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::componentDisplacementMotionSolver
Description
Virtual base class for displacement motion solver
The boundary displacement is set as a boundary condition
on the pointDisplacementX pointScalarField.
SourceFiles
componentDisplacementMotionSolver.C
\*---------------------------------------------------------------------------*/
#ifndef componentDisplacementMotionSolver_H
#define componentDisplacementMotionSolver_H
#include "motionSolver.H"
#include "pointFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class mapPolyMesh;
/*---------------------------------------------------------------------------*\
Class componentDisplacementMotionSolver Declaration
\*---------------------------------------------------------------------------*/
class componentDisplacementMotionSolver
:
public motionSolver
{
protected:
// Protected data
//- The component name to solve for
word cmptName_;
//- The component to solve for
direction cmpt_;
//- Reference point field for this component
scalarField points0_;
//- Point motion field
mutable pointScalarField pointDisplacement_;
private:
// Private Member Functions
//- Return the component corresponding to the given component name
direction cmpt(const word& cmptName) const;
//- Disallow default bitwise copy construct
componentDisplacementMotionSolver
(
const componentDisplacementMotionSolver&
);
//- Disallow default bitwise assignment
void operator=(const componentDisplacementMotionSolver&);
public:
//- Runtime type information
TypeName("componentDisplacementMotionSolver");
// Constructors
//- Construct from polyMesh and dictionary and type
componentDisplacementMotionSolver
(
const polyMesh&,
const IOdictionary&,
const word& type
);
//- Destructor
virtual ~componentDisplacementMotionSolver();
// Member Functions
//- Return reference to the reference field
scalarField& points0()
{
return points0_;
}
//- Return reference to the reference field
const scalarField& points0() const
{
return points0_;
}
//- Update local data for geometry changes
virtual void movePoints(const pointField&);
//- Update local data for topology changes
virtual void updateMesh(const mapPolyMesh&);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,120 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "componentVelocityMotionSolver.H"
#include "mapPolyMesh.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(componentVelocityMotionSolver, 0);
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
Foam::direction Foam::componentVelocityMotionSolver::cmpt
(
const word& cmptName
) const
{
if (cmptName == "x")
{
return vector::X;
}
else if (cmptName == "y")
{
return vector::Y;
}
else if (cmptName == "z")
{
return vector::Z;
}
else
{
FatalErrorIn
(
"componentVelocityMotionSolver::"
"componentVelocityMotionSolver"
"(const polyMesh& mesh, const IOdictionary&)"
) << "Given component name " << cmptName << " should be x, y or z"
<< exit(FatalError);
return 0;
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::componentVelocityMotionSolver::componentVelocityMotionSolver
(
const polyMesh& mesh,
const IOdictionary& dict,
const word& type
)
:
motionSolver(mesh, dict, type),
cmptName_(coeffDict().lookup("component")),
cmpt_(cmpt(cmptName_)),
pointMotionU_
(
IOobject
(
"pointMotionU" + cmptName_,
mesh.time().timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
pointMesh::New(mesh)
)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::componentVelocityMotionSolver::~componentVelocityMotionSolver()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::componentVelocityMotionSolver::movePoints(const pointField& p)
{
// No local data to adapt
}
void Foam::componentVelocityMotionSolver::updateMesh(const mapPolyMesh& mpm)
{
// pointMesh already updates pointFields.
motionSolver::updateMesh(mpm);
}
// ************************************************************************* //

View File

@ -0,0 +1,127 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::componentVelocityMotionSolver
Description
Virtual base class for velocity motion solver
The boundary displacement is set as a boundary condition
on the pointMotionUX pointScalarField.
SourceFiles
componentVelocityMotionSolver.C
\*---------------------------------------------------------------------------*/
#ifndef componentVelocityMotionSolver_H
#define componentVelocityMotionSolver_H
#include "motionSolver.H"
#include "pointFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class mapPolyMesh;
/*---------------------------------------------------------------------------*\
Class componentVelocityMotionSolver Declaration
\*---------------------------------------------------------------------------*/
class componentVelocityMotionSolver
:
public motionSolver
{
protected:
// Protected data
//- The component name to solve for
word cmptName_;
//- The component to solve for
direction cmpt_;
//- Point motion field
mutable pointScalarField pointMotionU_;
private:
// Private Member Functions
//- Return the component corresponding to the given component name
direction cmpt(const word& cmptName) const;
//- Disallow default bitwise copy construct
componentVelocityMotionSolver
(
const componentVelocityMotionSolver&
);
//- Disallow default bitwise assignment
void operator=(const componentVelocityMotionSolver&);
public:
//- Runtime type information
TypeName("componentVelocityMotionSolver");
// Constructors
//- Construct from mesh and dictionary
componentVelocityMotionSolver
(
const polyMesh&,
const IOdictionary&,
const word& type
);
//- Destructor
virtual ~componentVelocityMotionSolver();
// Member Functions
//- Update local data for geometry changes
virtual void movePoints(const pointField&);
//- Update local data for topology changes
virtual void updateMesh(const mapPolyMesh&);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -23,27 +23,39 @@ License
\*---------------------------------------------------------------------------*/
#include "displacementFvMotionSolver.H"
#include "addToRunTimeSelectionTable.H"
#include "displacementMotionSolver.H"
#include "mapPolyMesh.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(displacementFvMotionSolver, 0);
defineTypeNameAndDebug(displacementMotionSolver, 0);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::displacementFvMotionSolver::displacementFvMotionSolver
Foam::displacementMotionSolver::displacementMotionSolver
(
const polyMesh& mesh,
Istream&
const IOdictionary& dict,
const word& type
)
:
fvMotionSolver(mesh),
motionSolver(mesh, dict, type),
pointDisplacement_
(
IOobject
(
"pointDisplacement",
mesh.time().timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
pointMesh::New(mesh)
),
points0_
(
pointIOField
@ -65,10 +77,11 @@ Foam::displacementFvMotionSolver::displacementFvMotionSolver
{
FatalErrorIn
(
"displacementFvMotionSolver::displacementFvMotionSolver\n"
"displacementMotionSolver::"
"displacementMotionSolver\n"
"(\n"
" const polyMesh&,\n"
" Istream&\n"
" const IOdictionary&\n"
")"
) << "Number of points in mesh " << mesh.nPoints()
<< " differs from number of points " << points0_.size()
@ -91,15 +104,23 @@ Foam::displacementFvMotionSolver::displacementFvMotionSolver
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::displacementFvMotionSolver::~displacementFvMotionSolver()
Foam::displacementMotionSolver::~displacementMotionSolver()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::displacementFvMotionSolver::updateMesh(const mapPolyMesh& mpm)
void Foam::displacementMotionSolver::movePoints(const pointField&)
{
fvMotionSolver::updateMesh(mpm);
// No local data to update
}
void Foam::displacementMotionSolver::updateMesh(const mapPolyMesh& mpm)
{
// pointMesh already updates pointFields.
motionSolver::updateMesh(mpm);
// Map points0_. Bit special since we somehow have to come up with
// a sensible points0 position for introduced points.
@ -110,7 +131,7 @@ void Foam::displacementFvMotionSolver::updateMesh(const mapPolyMesh& mpm)
(
mpm.hasMotionPoints()
? mpm.preMotionPoints()
: fvMesh_.points()
: mesh().points()
);
// Note: boundBox does reduce
@ -147,8 +168,8 @@ void Foam::displacementFvMotionSolver::updateMesh(const mapPolyMesh& mpm)
{
FatalErrorIn
(
"displacementLaplacianFvMotionSolver::updateMesh"
"(const mapPolyMesh& mpm)"
"displacementMotionSolver::updateMesh"
"(const mapPolyMesh&)"
) << "Cannot work out coordinates of introduced vertices."
<< " New vertex " << pointI << " at coordinate "
<< points[pointI] << exit(FatalError);

View File

@ -0,0 +1,148 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::displacementMotionSolver
Description
Virtual base class for displacement motion solver
The boundary displacement is set as a boundary condition
on the pointDisplacement pointVectorField.
SourceFiles
displacementMotionSolver.C
\*---------------------------------------------------------------------------*/
#ifndef displacementMotionSolver_H
#define displacementMotionSolver_H
#include "motionSolver.H"
#include "pointFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class mapPolyMesh;
/*---------------------------------------------------------------------------*\
Class displacementMotionSolver Declaration
\*---------------------------------------------------------------------------*/
class displacementMotionSolver
:
public motionSolver
{
protected:
// Protected data
//- Point motion field
mutable pointVectorField pointDisplacement_;
private:
// Private data
//- Starting points
pointField points0_;
// Private Member Functions
//- Disallow default bitwise copy construct
displacementMotionSolver
(
const displacementMotionSolver&
);
//- Disallow default bitwise assignment
void operator=(const displacementMotionSolver&);
public:
//- Runtime type information
TypeName("displacementMotionSolver");
// Constructors
//- Construct from mesh and dictionary
displacementMotionSolver
(
const polyMesh&,
const IOdictionary&,
const word& type
);
//- Destructor
virtual ~displacementMotionSolver();
// Member Functions
//- Return reference to the reference field
pointField& points0()
{
return points0_;
}
//- Return reference to the reference field
const pointField& points0() const
{
return points0_;
}
//- Return reference to the point motion displacement field
pointVectorField& pointDisplacement()
{
return pointDisplacement_;
}
//- Return const reference to the point motion displacement field
const pointVectorField& pointDisplacement() const
{
return pointDisplacement_;
}
//- Update local data for geometry changes
virtual void movePoints(const pointField&);
//- Update local data for topology changes
virtual void updateMesh(const mapPolyMesh&);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -36,6 +36,26 @@ namespace Foam
defineRunTimeSelectionTable(motionSolver, dictionary);
}
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
Foam::IOobject Foam::motionSolver::stealRegistration
(
const IOdictionary& dict
)
{
IOobject io(dict);
if (dict.registerObject())
{
// De-register if necessary
const_cast<IOdictionary&>(dict).checkOut();
io.registerObject() = true;
}
return io;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::motionSolver::motionSolver(const polyMesh& mesh)
@ -56,26 +76,29 @@ Foam::motionSolver::motionSolver(const polyMesh& mesh)
{}
Foam::motionSolver::motionSolver
(
const polyMesh& mesh,
const IOdictionary& dict,
const word& type
)
:
IOdictionary(stealRegistration(dict), dict),
mesh_(mesh),
twoDPointCorrector_(mesh),
coeffDict_(dict.subDict(type + "Coeffs"))
{}
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::motionSolver> Foam::motionSolver::New(const polyMesh& mesh)
Foam::autoPtr<Foam::motionSolver> Foam::motionSolver::New
(
const polyMesh& mesh,
const IOdictionary& solverDict
)
{
IOdictionary solverDict
(
IOobject
(
"dynamicMeshDict",
mesh.time().constant(),
mesh,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)
);
Istream& msData = solverDict.lookup("solver");
const word solverTypeName(msData);
const word solverTypeName(solverDict.lookup("solver"));
Info<< "Selecting motion solver: " << solverTypeName << endl;
@ -102,7 +125,7 @@ Foam::autoPtr<Foam::motionSolver> Foam::motionSolver::New(const polyMesh& mesh)
{
FatalErrorIn
(
"motionSolver::New(const polyMesh& mesh)"
"motionSolver::New(const polyMesh&)"
) << "Unknown solver type "
<< solverTypeName << nl << nl
<< "Valid solver types are:" << endl
@ -110,7 +133,25 @@ Foam::autoPtr<Foam::motionSolver> Foam::motionSolver::New(const polyMesh& mesh)
<< exit(FatalError);
}
return autoPtr<motionSolver>(cstrIter()(mesh, msData));
return autoPtr<motionSolver>(cstrIter()(mesh, solverDict));
}
Foam::autoPtr<Foam::motionSolver> Foam::motionSolver::New(const polyMesh& mesh)
{
IOdictionary solverDict
(
IOobject
(
"dynamicMeshDict",
mesh.time().constant(),
mesh,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);
return New(mesh, solverDict);
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -56,6 +56,7 @@ class motionSolver
:
public IOdictionary
{
private:
// Private data
@ -66,6 +67,14 @@ private:
//- 2-D motion corrector pointer
twoDPointCorrector twoDPointCorrector_;
//- Model coefficients dictionary
dictionary coeffDict_;
// Private Member Functions
//- De-register object if registered and assign to current
static IOobject stealRegistration(const IOdictionary& dict);
public:
@ -80,15 +89,19 @@ public:
autoPtr,
motionSolver,
dictionary,
(const polyMesh& mesh, Istream& msData),
(mesh, msData)
(const polyMesh& mesh, const IOdictionary& dict),
(mesh, dict)
);
// Selectors
//- Select constructed from polyMesh
static autoPtr<motionSolver> New(const polyMesh& mesh);
static autoPtr<motionSolver> New(const polyMesh&);
//- Select constructed from polyMesh and dictionary. If dictionary
// was registered this will 'steal' that registration.
static autoPtr<motionSolver> New(const polyMesh&, const IOdictionary&);
// Constructors
@ -96,6 +109,14 @@ public:
//- Construct from polyMesh
motionSolver(const polyMesh& mesh);
//- Construct from polyMesh and dictionary and type.
motionSolver
(
const polyMesh& mesh,
const IOdictionary&,
const word& type
);
//- Destructor
virtual ~motionSolver();
@ -109,6 +130,12 @@ public:
return mesh_;
}
//- Const access to the coefficients dictionary
const dictionary& coeffDict() const
{
return coeffDict_;
}
//- Provide new points for motion. Solves for motion
virtual tmp<pointField> newPoints();
@ -120,7 +147,10 @@ public:
//- Solve for motion
virtual void solve() = 0;
//- Update topology
//- Update local data for geometry changes
virtual void movePoints(const pointField&) = 0;
//- Update local data for topology changes
virtual void updateMesh(const mapPolyMesh&) = 0;
};

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -23,44 +23,61 @@ License
\*---------------------------------------------------------------------------*/
#include "fvMotionSolver.H"
#include "volPointInterpolation.H"
#include "velocityMotionSolver.H"
#include "mapPolyMesh.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(fvMotionSolver, 0);
defineTypeNameAndDebug(velocityMotionSolver, 0);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::fvMotionSolver::fvMotionSolver(const polyMesh& mesh)
Foam::velocityMotionSolver::velocityMotionSolver
(
const polyMesh& mesh,
const IOdictionary& dict,
const word& type
)
:
motionSolver(mesh),
fvMesh_(refCast<const fvMesh>(mesh))
motionSolver(mesh, dict, type),
pointMotionU_
(
IOobject
(
"pointMotionU",
mesh.time().timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
pointMesh::New(mesh)
)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::fvMotionSolver::~fvMotionSolver()
Foam::velocityMotionSolver::~velocityMotionSolver()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::fvMotionSolver::movePoints(const pointField& p)
void Foam::velocityMotionSolver::movePoints(const pointField& p)
{
// Movement of pointMesh and volPointInterpolation done by polyMesh,fvMesh
// No local data that needs adapting.
}
void Foam::fvMotionSolver::updateMesh(const mapPolyMesh& mpm)
void Foam::velocityMotionSolver::updateMesh(const mapPolyMesh& mpm)
{
// pointMesh already updates pointFields.
motionSolver::updateMesh(mpm);
// Update of pointMesh and volPointInterpolation done by polyMesh,fvMesh
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -22,81 +22,99 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::displacementFvMotionSolver
Foam::velocityMotionSolver
Description
Base class for fvMotionSolvers which calculate displacement.
Virtual base class for velocity motion solver
The boundary displacement is set as a boundary condition
on the pointMotionU pointVectorField.
SourceFiles
displacementFvMotionSolver.C
velocityMotionSolver.C
\*---------------------------------------------------------------------------*/
#ifndef displacementFvMotionSolver_H
#define displacementFvMotionSolver_H
#ifndef velocityMotionSolver_H
#define velocityMotionSolver_H
#include "fvMotionSolver.H"
#include "motionSolver.H"
#include "pointFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class mapPolyMesh;
/*---------------------------------------------------------------------------*\
Class displacementFvMotionSolver Declaration
Class velocityMotionSolver Declaration
\*---------------------------------------------------------------------------*/
class displacementFvMotionSolver
class velocityMotionSolver
:
public fvMotionSolver
public motionSolver
{
// Private data
protected:
//- Reference point field
pointField points0_;
// Protected data
//- Point motion field
mutable pointVectorField pointMotionU_;
private:
// Private Member Functions
//- Disallow default bitwise copy construct
displacementFvMotionSolver
velocityMotionSolver
(
const displacementFvMotionSolver&
const velocityMotionSolver&
);
//- Disallow default bitwise assignment
void operator=(const displacementFvMotionSolver&);
void operator=(const velocityMotionSolver&);
public:
//- Runtime type information
TypeName("displacementInterpolation");
TypeName("velocityMotionSolver");
// Constructors
//- Construct from polyMesh and data stream
displacementFvMotionSolver
//- Construct from mesh and dictionary
velocityMotionSolver
(
const polyMesh&,
Istream& msDataUnused
const IOdictionary&,
const word& type
);
//- Destructor
~displacementFvMotionSolver();
virtual ~velocityMotionSolver();
// Member Functions
//- Return reference to the reference field
const pointField& points0() const
//- Return reference to the point motion velocity field
pointVectorField& pointMotionU()
{
return points0_;
return pointMotionU_;
}
//- Update topology
//- Return const reference to the point motion velocity field
const pointVectorField& pointMotionU() const
{
return pointMotionU_;
}
//- Update local data for geometry changes
virtual void movePoints(const pointField&);
//- Update local data for topology changes
virtual void updateMesh(const mapPolyMesh&);
};

View File

@ -1,14 +1,13 @@
fvMotionSolvers/fvMotionSolver/fvMotionSolver.C
fvMotionSolvers/velocity/laplacian/velocityLaplacianFvMotionSolver.C
fvMotionSolvers/displacement/displacementFvMotionSolver/displacementFvMotionSolver.C
fvMotionSolvers/displacement/layeredSolver/displacementLayeredMotionFvMotionSolver.C
fvMotionSolvers/displacement/layeredSolver/pointEdgeStructuredWalk.C
fvMotionSolvers/displacement/interpolation/displacementInterpolationFvMotionSolver.C
fvMotionSolvers/displacement/laplacian/displacementLaplacianFvMotionSolver.C
fvMotionSolvers/fvMotionSolverCore/fvMotionSolverCore.C
fvMotionSolvers/displacement/SBRStress/displacementSBRStressFvMotionSolver.C
fvMotionSolvers/displacement/laplacian/displacementLaplacianFvMotionSolver.C
fvMotionSolvers/displacement/interpolation/displacementInterpolationMotionSolver.C
fvMotionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.C
fvMotionSolvers/displacement/layeredSolver/pointEdgeStructuredWalk.C
fvMotionSolvers/velocity/componentLaplacian/velocityComponentLaplacianFvMotionSolver.C
fvMotionSolvers/displacement/componentLaplacian/displacementComponentLaplacianFvMotionSolver.C
fvMotionSolvers/componentDisplacement/componentLaplacian/displacementComponentLaplacianFvMotionSolver.C
fvMotionSolvers/velocity/laplacian/velocityLaplacianFvMotionSolver.C
fvMotionSolvers/componentVelocity/componentLaplacian/velocityComponentLaplacianFvMotionSolver.C
motionDiffusivity/motionDiffusivity/motionDiffusivity.C
motionDiffusivity/uniform/uniformDiffusivity.C

View File

@ -38,87 +38,24 @@ namespace Foam
addToRunTimeSelectionTable
(
fvMotionSolver,
motionSolver,
displacementComponentLaplacianFvMotionSolver,
dictionary
);
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
Foam::direction Foam::displacementComponentLaplacianFvMotionSolver::cmpt
(
const word& cmptName
) const
{
if (cmptName == "x")
{
return vector::X;
}
else if (cmptName == "y")
{
return vector::Y;
}
else if (cmptName == "z")
{
return vector::Z;
}
else
{
FatalErrorIn
(
"displacementComponentLaplacianFvMotionSolver::"
"displacementComponentLaplacianFvMotionSolver"
"(const polyMesh& mesh, Istream& msData)"
) << "Given component name " << cmptName << " should be x, y or z"
<< exit(FatalError);
return 0;
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::displacementComponentLaplacianFvMotionSolver::
displacementComponentLaplacianFvMotionSolver
(
const polyMesh& mesh,
Istream& msData
const IOdictionary& dict
)
:
fvMotionSolver(mesh),
cmptName_(msData),
cmpt_(cmpt(cmptName_)),
points0_
(
pointIOField
(
IOobject
(
"points",
time().constant(),
polyMesh::meshSubDir,
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
)
).component(cmpt_)
),
pointDisplacement_
(
IOobject
(
"pointDisplacement" + cmptName_,
fvMesh_.time().timeName(),
fvMesh_,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
pointMesh::New(fvMesh_)
),
componentDisplacementMotionSolver(mesh, dict, type()),
fvMotionSolverCore(mesh),
cellDisplacement_
(
IOobject
@ -141,75 +78,48 @@ displacementComponentLaplacianFvMotionSolver
pointLocation_(NULL),
diffusivityPtr_
(
motionDiffusivity::New(fvMesh_, lookup("diffusivity"))
motionDiffusivity::New(fvMesh_, coeffDict().lookup("diffusivity"))
),
frozenPointsZone_
(
found("frozenPointsZone")
? fvMesh_.pointZones().findZoneID(lookup("frozenPointsZone"))
coeffDict().found("frozenPointsZone")
? fvMesh_.pointZones().findZoneID(coeffDict().lookup("frozenPointsZone"))
: -1
)
{
if (points0_.size() != mesh.nPoints())
{
FatalErrorIn
(
"displacementComponentLaplacianFvMotionSolver::"
"displacementComponentLaplacianFvMotionSolver\n"
"(\n"
" const polyMesh&,\n"
" Istream&\n"
")"
) << "Number of points in mesh " << mesh.nPoints()
<< " differs from number of points " << points0_.size()
<< " read from file "
<<
IOobject
(
"points",
mesh.time().constant(),
polyMesh::meshSubDir,
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
).filePath()
<< exit(FatalError);
}
IOobject io
Switch applyPointLocation
(
"pointLocation",
fvMesh_.time().timeName(),
fvMesh_,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
coeffDict().lookupOrDefault
(
"applyPointLocation",
true
)
);
if (debug)
{
Info<< "displacementComponentLaplacianFvMotionSolver:" << nl
<< " diffusivity : " << diffusivityPtr_().type() << nl
<< " frozenPoints zone : " << frozenPointsZone_ << endl;
}
if (io.headerOk())
if (applyPointLocation)
{
pointLocation_.reset
(
new pointVectorField
(
io,
IOobject
(
"pointLocation",
fvMesh_.time().timeName(),
fvMesh_,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
pointMesh::New(fvMesh_)
)
);
if (debug)
//if (debug)
{
Info<< "displacementComponentLaplacianFvMotionSolver :"
<< " Read pointVectorField "
<< io.name() << " to be used for boundary conditions on points."
<< pointLocation_().name()
<< " to be used for boundary conditions on points."
<< nl
<< "Boundary conditions:"
<< pointLocation_().boundaryField().types() << endl;
@ -305,10 +215,22 @@ Foam::displacementComponentLaplacianFvMotionSolver::curPoints() const
}
//void Foam::displacementComponentLaplacianFvMotionSolver::movePoints
//(
// const pointField& p
//)
//{
// // Movement of pointMesh and volPointInterpolation already
// // done by polyMesh,fvMesh
// componentDisplacementMotionSolver::movePoints(p);
//
//}
void Foam::displacementComponentLaplacianFvMotionSolver::solve()
{
// The points have moved so before interpolation update
// the fvMotionSolver accordingly
// the motionSolver accordingly
movePoints(fvMesh_.points());
diffusivityPtr_->correct();
@ -331,64 +253,16 @@ void Foam::displacementComponentLaplacianFvMotionSolver::updateMesh
const mapPolyMesh& mpm
)
{
fvMotionSolver::updateMesh(mpm);
// Map points0_. Bit special since we somehow have to come up with
// a sensible points0 position for introduced points.
// Find out scaling between points0 and current points
// Get the new points either from the map or the mesh
const scalarField points
(
mpm.hasMotionPoints()
? mpm.preMotionPoints().component(cmpt_)
: fvMesh_.points().component(cmpt_)
);
// Get extents of points0 and points and determine scale
const scalar scale =
(gMax(points0_)-gMin(points0_))
/(gMax(points)-gMin(points));
scalarField newPoints0(mpm.pointMap().size());
forAll(newPoints0, pointI)
{
label oldPointI = mpm.pointMap()[pointI];
if (oldPointI >= 0)
{
label masterPointI = mpm.reversePointMap()[oldPointI];
if (masterPointI == pointI)
{
newPoints0[pointI] = points0_[oldPointI];
}
else
{
// New point. Assume motion is scaling.
newPoints0[pointI] =
points0_[oldPointI]
+ scale*(points[pointI]-points[masterPointI]);
}
}
else
{
FatalErrorIn
(
"displacementLaplacianFvMotionSolver::updateMesh"
"(const mapPolyMesh& mpm)"
) << "Cannot work out coordinates of introduced vertices."
<< " New vertex " << pointI << " at coordinate "
<< points[pointI] << exit(FatalError);
}
}
points0_.transfer(newPoints0);
componentDisplacementMotionSolver::updateMesh(mpm);
// Update diffusivity. Note two stage to make sure old one is de-registered
// before creating/registering new one.
diffusivityPtr_.reset(NULL);
diffusivityPtr_ = motionDiffusivity::New(fvMesh_, lookup("diffusivity"));
diffusivityPtr_ = motionDiffusivity::New
(
fvMesh_,
coeffDict().lookup("diffusivity")
);
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -36,7 +36,8 @@ SourceFiles
#ifndef displacementComponentLaplacianFvMotionSolver_H
#define displacementComponentLaplacianFvMotionSolver_H
#include "fvMotionSolver.H"
#include "componentDisplacementMotionSolver.H"
#include "fvMotionSolverCore.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -52,22 +53,11 @@ class motionDiffusivity;
class displacementComponentLaplacianFvMotionSolver
:
public fvMotionSolver
public componentDisplacementMotionSolver,
public fvMotionSolverCore
{
// Private data
//- The component name to solve for
word cmptName_;
//- The component to solve for
direction cmpt_;
//- Reference point field for this component
scalarField points0_;
//- Point motion field
mutable pointScalarField pointDisplacement_;
//- Cell-centre motion field
mutable volScalarField cellDisplacement_;
@ -106,11 +96,11 @@ public:
// Constructors
//- Construct from polyMesh and data stream
//- Construct from polyMesh and IOdictionary
displacementComponentLaplacianFvMotionSolver
(
const polyMesh&,
Istream& msData
const IOdictionary&
);
@ -120,12 +110,6 @@ public:
// Member Functions
//- Return reference to the reference field
const scalarField& points0() const
{
return points0_;
}
//- Non-const access to the cellDisplacement in order to allow
// changes to the boundary motion
volScalarField& cellDisplacement()
@ -141,6 +125,10 @@ public:
//- Update topology
virtual void updateMesh(const mapPolyMesh&);
// //- Handle changes of geometry
// virtual void movePoints(const pointField& p);
};

View File

@ -37,7 +37,7 @@ namespace Foam
addToRunTimeSelectionTable
(
fvMotionSolver,
motionSolver,
velocityComponentLaplacianFvMotionSolver,
dictionary
);
@ -50,24 +50,11 @@ Foam::velocityComponentLaplacianFvMotionSolver::
velocityComponentLaplacianFvMotionSolver
(
const polyMesh& mesh,
Istream& msData
const IOdictionary& dict
)
:
fvMotionSolver(mesh),
cmptName_(msData),
cmpt_(0),
pointMotionU_
(
IOobject
(
"pointMotionU" + cmptName_,
fvMesh_.time().timeName(),
fvMesh_,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
pointMesh::New(fvMesh_)
),
componentVelocityMotionSolver(mesh, dict, typeName),
fvMotionSolverCore(mesh),
cellMotionU_
(
IOobject
@ -89,32 +76,9 @@ velocityComponentLaplacianFvMotionSolver
),
diffusivityPtr_
(
motionDiffusivity::New(fvMesh_, lookup("diffusivity"))
motionDiffusivity::New(fvMesh_, coeffDict().lookup("diffusivity"))
)
{
if (cmptName_ == "x")
{
cmpt_ = vector::X;
}
else if (cmptName_ == "y")
{
cmpt_ = vector::Y;
}
else if (cmptName_ == "z")
{
cmpt_ = vector::Z;
}
else
{
FatalErrorIn
(
"velocityComponentLaplacianFvMotionSolver::"
"velocityComponentLaplacianFvMotionSolver"
"(const polyMesh& mesh, Istream& msData)"
) << "Given component name " << cmptName_ << " should be x, y or z"
<< exit(FatalError);
}
}
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
@ -171,17 +135,31 @@ void Foam::velocityComponentLaplacianFvMotionSolver::solve()
}
//void Foam::velocityComponentLaplacianFvMotionSolver::movePoints
//(
// const pointField& p
//)
//{
// // Movement of pointMesh and volPointInterpolation already
// // done by polyMesh,fvMesh
//}
void Foam::velocityComponentLaplacianFvMotionSolver::updateMesh
(
const mapPolyMesh& mpm
)
{
fvMotionSolver::updateMesh(mpm);
componentVelocityMotionSolver::updateMesh(mpm);
// Update diffusivity. Note two stage to make sure old one is de-registered
// before creating/registering new one.
diffusivityPtr_.reset(NULL);
diffusivityPtr_ = motionDiffusivity::New(fvMesh_, lookup("diffusivity"));
diffusivityPtr_ = motionDiffusivity::New
(
fvMesh_,
coeffDict().lookup("diffusivity")
);
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -36,7 +36,8 @@ SourceFiles
#ifndef velocityComponentLaplacianFvMotionSolver_H
#define velocityComponentLaplacianFvMotionSolver_H
#include "fvMotionSolver.H"
#include "componentVelocityMotionSolver.H"
#include "fvMotionSolverCore.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -52,19 +53,11 @@ class motionDiffusivity;
class velocityComponentLaplacianFvMotionSolver
:
public fvMotionSolver
public componentVelocityMotionSolver,
public fvMotionSolverCore
{
// Private data
//- The component name to solve for
word cmptName_;
//- The component to solve for
direction cmpt_;
//- Point motion field
mutable pointScalarField pointMotionU_;
//- Cell-centre motion field
mutable volScalarField cellMotionU_;
@ -92,11 +85,11 @@ public:
// Constructors
//- Construct from polyMesh and data stream (provides component)
//- Construct from polyMesh and IOdictionary
velocityComponentLaplacianFvMotionSolver
(
const polyMesh&,
Istream& msData
const IOdictionary&
);
@ -121,6 +114,9 @@ public:
//- Update topology
virtual void updateMesh(const mapPolyMesh&);
// //- Handle changes of geometry
// void movePoints(const pointField& p);
};

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -36,7 +36,8 @@ SourceFiles
#ifndef displacementSBRStressFvMotionSolver_H
#define displacementSBRStressFvMotionSolver_H
#include "displacementFvMotionSolver.H"
#include "displacementMotionSolver.H"
#include "fvMotionSolverCore.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -52,13 +53,12 @@ class motionDiffusivity;
class displacementSBRStressFvMotionSolver
:
public displacementFvMotionSolver
// public displacementFvMotionSolver
public displacementMotionSolver,
public fvMotionSolverCore
{
// Private data
//- Point motion field
mutable pointVectorField pointDisplacement_;
//- Cell-centre motion field
mutable volVectorField cellDisplacement_;
@ -86,11 +86,11 @@ public:
// Constructors
//- Construct from polyMesh and data stream
//- Construct from polyMesh and IOdictionary
displacementSBRStressFvMotionSolver
(
const polyMesh&,
Istream& msDataUnused
const IOdictionary&
);
@ -100,18 +100,6 @@ public:
// Member Functions
//- Return reference to the point motion displacement field
pointVectorField& pointDisplacement()
{
return pointDisplacement_;
}
//- Return const reference to the point motion displacement field
const pointVectorField& pointDisplacement() const
{
return pointDisplacement_;
}
//- Return reference to the cell motion displacement field
volVectorField& cellDisplacement()
{
@ -130,6 +118,9 @@ public:
//- Solve for motion
virtual void solve();
// //- Update the pointMesh corresponding to the new points
// void movePoints(const pointField&);
//- Update topology
virtual void updateMesh(const mapPolyMesh&);
};

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -23,7 +23,7 @@ License
\*---------------------------------------------------------------------------*/
#include "displacementInterpolationFvMotionSolver.H"
#include "displacementInterpolationMotionSolver.H"
#include "addToRunTimeSelectionTable.H"
#include "SortableList.H"
#include "IOList.H"
@ -35,12 +35,12 @@ License
namespace Foam
{
defineTypeNameAndDebug(displacementInterpolationFvMotionSolver, 0);
defineTypeNameAndDebug(displacementInterpolationMotionSolver, 0);
addToRunTimeSelectionTable
(
fvMotionSolver,
displacementInterpolationFvMotionSolver,
motionSolver,
displacementInterpolationMotionSolver,
dictionary
);
@ -53,36 +53,21 @@ namespace Foam
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::displacementInterpolationFvMotionSolver::
displacementInterpolationFvMotionSolver
Foam::displacementInterpolationMotionSolver::
displacementInterpolationMotionSolver
(
const polyMesh& mesh,
Istream& is
const IOdictionary& dict
)
:
displacementFvMotionSolver(mesh, is),
dynamicMeshCoeffs_
(
IOdictionary
(
IOobject
(
"dynamicMeshDict",
mesh.time().constant(),
mesh,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)
).subDict(typeName + "Coeffs")
)
displacementMotionSolver(mesh, dict, typeName)
{
// Get zones and their interpolation tables for displacement
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
List<Pair<word> > faceZoneToTable
(
dynamicMeshCoeffs_.lookup("interpolationTables")
coeffDict().lookup("interpolationTables")
);
const faceZoneMesh& fZones = mesh.faceZones();
@ -99,8 +84,8 @@ displacementInterpolationFvMotionSolver
{
FatalErrorIn
(
"displacementInterpolationFvMotionSolver::"
"displacementInterpolationFvMotionSolver(const polyMesh&,"
"displacementInterpolationMotionSolver::"
"displacementInterpolationMotionSolver(const polyMesh&,"
"Istream&)"
) << "Cannot find zone " << zoneName << endl
<< "Valid zones are " << mesh.faceZones().names()
@ -267,8 +252,8 @@ displacementInterpolationFvMotionSolver
{
FatalErrorIn
(
"displacementInterpolationFvMotionSolver::"
"displacementInterpolationFvMotionSolver"
"displacementInterpolationMotionSolver::"
"displacementInterpolationMotionSolver"
"(const polyMesh&, Istream&)"
) << "Did not find point " << points0()[pointI]
<< " coordinate " << meshCoords[pointI]
@ -316,21 +301,21 @@ displacementInterpolationFvMotionSolver
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::displacementInterpolationFvMotionSolver::
~displacementInterpolationFvMotionSolver()
Foam::displacementInterpolationMotionSolver::
~displacementInterpolationMotionSolver()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::tmp<Foam::pointField>
Foam::displacementInterpolationFvMotionSolver::curPoints() const
Foam::displacementInterpolationMotionSolver::curPoints() const
{
if (mesh().nPoints() != points0().size())
{
FatalErrorIn
(
"displacementInterpolationFvMotionSolver::curPoints() const"
"displacementInterpolationMotionSolver::curPoints() const"
) << "The number of points in the mesh seems to have changed." << endl
<< "In constant/polyMesh there are " << points0().size()
<< " points; in the current mesh there are " << mesh().nPoints()

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -22,7 +22,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::displacementInterpolationFvMotionSolver
Foam::displacementInterpolationMotionSolver
Description
Mesh motion solver for an fvMesh.
@ -40,14 +40,14 @@ Note
could be a motionSolver - does not use any fvMesh structure.
SourceFiles
displacementInterpolationFvMotionSolver.C
displacementInterpolationMotionSolver.C
\*---------------------------------------------------------------------------*/
#ifndef displacementInterpolationFvMotionSolver_H
#define displacementInterpolationFvMotionSolver_H
#ifndef displacementInterpolationMotionSolver_H
#define displacementInterpolationMotionSolver_H
#include "displacementFvMotionSolver.H"
#include "displacementMotionSolver.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -55,19 +55,15 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
Class displacementInterpolationFvMotionSolver Declaration
Class displacementInterpolationMotionSolver Declaration
\*---------------------------------------------------------------------------*/
class displacementInterpolationFvMotionSolver
class displacementInterpolationMotionSolver
:
public displacementFvMotionSolver
public displacementMotionSolver
{
// Private data
//- Additional settings for motion solver
dictionary dynamicMeshCoeffs_;
// Face zone information (note: could pack these to only contain
// used zones)
@ -94,13 +90,13 @@ class displacementInterpolationFvMotionSolver
// Private Member Functions
//- Disallow default bitwise copy construct
displacementInterpolationFvMotionSolver
displacementInterpolationMotionSolver
(
const displacementInterpolationFvMotionSolver&
const displacementInterpolationMotionSolver&
);
//- Disallow default bitwise assignment
void operator=(const displacementInterpolationFvMotionSolver&);
void operator=(const displacementInterpolationMotionSolver&);
public:
@ -111,16 +107,16 @@ public:
// Constructors
//- Construct from polyMesh and data stream
displacementInterpolationFvMotionSolver
//- Construct from polyMesh and IOdictionary
displacementInterpolationMotionSolver
(
const polyMesh&,
Istream& msDataUnused
const IOdictionary& dict
);
//- Destructor
~displacementInterpolationFvMotionSolver();
~displacementInterpolationMotionSolver();
// Member Functions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -36,7 +36,8 @@ SourceFiles
#ifndef displacementLaplacianFvMotionSolver_H
#define displacementLaplacianFvMotionSolver_H
#include "displacementFvMotionSolver.H"
#include "displacementMotionSolver.H"
#include "fvMotionSolverCore.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -52,13 +53,12 @@ class motionDiffusivity;
class displacementLaplacianFvMotionSolver
:
public displacementFvMotionSolver
// public displacementFvMotionSolver
public displacementMotionSolver,
public fvMotionSolverCore
{
// Private data
//- Point motion field
mutable pointVectorField pointDisplacement_;
//- Cell-centre motion field
mutable volVectorField cellDisplacement_;
@ -94,11 +94,11 @@ public:
// Constructors
//- Construct from polyMesh and data stream
//- Construct from polyMesh and IOdictionary
displacementLaplacianFvMotionSolver
(
const polyMesh&,
Istream& msDataUnused
const IOdictionary&
);
@ -108,18 +108,6 @@ public:
// Member Functions
//- Return reference to the point motion displacement field
pointVectorField& pointDisplacement()
{
return pointDisplacement_;
}
//- Return const reference to the point motion displacement field
const pointVectorField& pointDisplacement() const
{
return pointDisplacement_;
}
//- Return reference to the cell motion displacement field
volVectorField& cellDisplacement()
{
@ -132,24 +120,15 @@ public:
return cellDisplacement_;
}
//- Return const reference to the diffusivity
const motionDiffusivity& diffusivity() const
{
return diffusivityPtr_();
}
//- Return reference to the diffusivity
motionDiffusivity& diffusivity()
{
return diffusivityPtr_();
}
//- Return point location obtained from the current motion field
virtual tmp<pointField> curPoints() const;
//- Solve for motion
virtual void solve();
// //- Update the pointMesh corresponding to the new points
// void movePoints(const pointField&);
//- Update topology
virtual void updateMesh(const mapPolyMesh&);
};

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -23,7 +23,7 @@ License
\*---------------------------------------------------------------------------*/
#include "displacementLayeredMotionFvMotionSolver.H"
#include "displacementLayeredMotionMotionSolver.H"
#include "addToRunTimeSelectionTable.H"
#include "pointEdgeStructuredWalk.H"
#include "pointFields.H"
@ -35,12 +35,12 @@ License
namespace Foam
{
defineTypeNameAndDebug(displacementLayeredMotionFvMotionSolver, 0);
defineTypeNameAndDebug(displacementLayeredMotionMotionSolver, 0);
addToRunTimeSelectionTable
(
fvMotionSolver,
displacementLayeredMotionFvMotionSolver,
motionSolver,
displacementLayeredMotionMotionSolver,
dictionary
);
}
@ -48,7 +48,7 @@ namespace Foam
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::displacementLayeredMotionFvMotionSolver::calcZoneMask
void Foam::displacementLayeredMotionMotionSolver::calcZoneMask
(
const label cellZoneI,
PackedBoolList& isZonePoint,
@ -121,7 +121,7 @@ void Foam::displacementLayeredMotionFvMotionSolver::calcZoneMask
// Find distance to starting point
void Foam::displacementLayeredMotionFvMotionSolver::walkStructured
void Foam::displacementLayeredMotionMotionSolver::walkStructured
(
const label cellZoneI,
const PackedBoolList& isZonePoint,
@ -209,7 +209,7 @@ void Foam::displacementLayeredMotionFvMotionSolver::walkStructured
// Evaluate faceZone patch
Foam::tmp<Foam::vectorField>
Foam::displacementLayeredMotionFvMotionSolver::faceZoneEvaluate
Foam::displacementLayeredMotionMotionSolver::faceZoneEvaluate
(
const faceZone& fz,
const labelList& meshPoints,
@ -239,7 +239,7 @@ Foam::displacementLayeredMotionFvMotionSolver::faceZoneEvaluate
{
FatalIOErrorIn
(
"displacementLayeredMotionFvMotionSolver::faceZoneEvaluate(..)",
"displacementLayeredMotionMotionSolver::faceZoneEvaluate(..)",
*this
) << "slip can only be used on second faceZonePatch of pair."
<< "FaceZone:" << fz.name()
@ -257,7 +257,7 @@ Foam::displacementLayeredMotionFvMotionSolver::faceZoneEvaluate
{
FatalIOErrorIn
(
"displacementLayeredMotionFvMotionSolver::faceZoneEvaluate(..)",
"displacementLayeredMotionMotionSolver::faceZoneEvaluate(..)",
*this
) << "Unknown faceZonePatch type " << type << " for faceZone "
<< fz.name() << exit(FatalIOError);
@ -266,7 +266,7 @@ Foam::displacementLayeredMotionFvMotionSolver::faceZoneEvaluate
}
void Foam::displacementLayeredMotionFvMotionSolver::cellZoneSolve
void Foam::displacementLayeredMotionMotionSolver::cellZoneSolve
(
const label cellZoneI,
const dictionary& zoneDict
@ -282,7 +282,7 @@ void Foam::displacementLayeredMotionFvMotionSolver::cellZoneSolve
{
FatalIOErrorIn
(
"displacementLayeredMotionFvMotionSolver::"
"displacementLayeredMotionMotionSolver::"
"correctBoundaryConditions(..)",
*this
) << "Can only handle 2 faceZones (= patches) per cellZone. "
@ -304,7 +304,7 @@ void Foam::displacementLayeredMotionFvMotionSolver::cellZoneSolve
{
FatalIOErrorIn
(
"displacementLayeredMotionFvMotionSolver::"
"displacementLayeredMotionMotionSolver::"
"correctBoundaryConditions(..)",
*this
) << "Cannot find faceZone " << faceZoneName
@ -476,26 +476,14 @@ Info<< "For cellZone:" << cellZoneI
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::displacementLayeredMotionFvMotionSolver::
displacementLayeredMotionFvMotionSolver
Foam::displacementLayeredMotionMotionSolver::
displacementLayeredMotionMotionSolver
(
const polyMesh& mesh,
Istream& is
const IOdictionary& dict
)
:
displacementFvMotionSolver(mesh, is),
pointDisplacement_
(
IOobject
(
"pointDisplacement",
fvMesh_.time().timeName(),
fvMesh_,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
pointMesh::New(fvMesh_)
)
displacementMotionSolver(mesh, dict, typeName)
{
pointDisplacement_.correctBoundaryConditions();
}
@ -503,15 +491,15 @@ displacementLayeredMotionFvMotionSolver
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::displacementLayeredMotionFvMotionSolver::
~displacementLayeredMotionFvMotionSolver()
Foam::displacementLayeredMotionMotionSolver::
~displacementLayeredMotionMotionSolver()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::tmp<Foam::pointField>
Foam::displacementLayeredMotionFvMotionSolver::curPoints() const
Foam::displacementLayeredMotionMotionSolver::curPoints() const
{
tmp<pointField> tcurPoints
(
@ -520,27 +508,19 @@ Foam::displacementLayeredMotionFvMotionSolver::curPoints() const
twoDCorrectPoints(tcurPoints());
// const pointField& pts = tcurPoints();
// forAll(pts, pointI)
// {
// Info<< " from:" << mesh().points()[pointI]
// << " to:" << pts[pointI]
// << endl;
// }
return tcurPoints;
}
void Foam::displacementLayeredMotionFvMotionSolver::solve()
void Foam::displacementLayeredMotionMotionSolver::solve()
{
const dictionary& ms = mesh().lookupObject<motionSolver>("dynamicMeshDict");
const dictionary& solverDict = ms.subDict(typeName + "Coeffs");
// The points have moved so before interpolation update
// the motionSolver accordingly
movePoints(mesh().points());
// Apply all regions (=cellZones)
const dictionary& regionDicts = solverDict.subDict("regions");
const dictionary& regionDicts = coeffDict().subDict("regions");
forAllConstIter(dictionary, regionDicts, regionIter)
{
const word& cellZoneName = regionIter().keyword();
@ -555,7 +535,7 @@ void Foam::displacementLayeredMotionFvMotionSolver::solve()
{
FatalIOErrorIn
(
"displacementLayeredMotionFvMotionSolver::solve(..)",
"displacementLayeredMotionMotionSolver::solve(..)",
*this
) << "Cannot find cellZone " << cellZoneName
<< endl << "Valid zones are " << mesh().cellZones().names()
@ -567,12 +547,12 @@ void Foam::displacementLayeredMotionFvMotionSolver::solve()
}
void Foam::displacementLayeredMotionFvMotionSolver::updateMesh
void Foam::displacementLayeredMotionMotionSolver::updateMesh
(
const mapPolyMesh& mpm
)
{
displacementFvMotionSolver::updateMesh(mpm);
displacementMotionSolver::updateMesh(mpm);
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -22,7 +22,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::displacementLayeredMotionFvMotionSolver
Foam::displacementLayeredMotionMotionSolver
Description
Mesh motion solver for an (multi-block) extruded fvMesh. Gets given the
@ -52,14 +52,14 @@ Description
specified by the first faceZone. (= removes the normal component).
SourceFiles
displacementLayeredMotionFvMotionSolver.C
displacementLayeredMotionMotionSolver.C
\*---------------------------------------------------------------------------*/
#ifndef displacementLayeredMotionFvMotionSolver_H
#define displacementLayeredMotionFvMotionSolver_H
#ifndef displacementLayeredMotionMotionSolver_H
#define displacementLayeredMotionMotionSolver_H
#include "displacementFvMotionSolver.H"
#include "displacementMotionSolver.H"
#include "PackedBoolList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -70,19 +70,13 @@ namespace Foam
// Forward class declarations
/*---------------------------------------------------------------------------*\
Class displacementLayeredMotionFvMotionSolver Declaration
Class displacementLayeredMotionMotionSolver Declaration
\*---------------------------------------------------------------------------*/
class displacementLayeredMotionFvMotionSolver
class displacementLayeredMotionMotionSolver
:
public displacementFvMotionSolver
public displacementMotionSolver
{
// Private data
//- Point motion field
mutable pointVectorField pointDisplacement_;
// Private Member Functions
void calcZoneMask
@ -120,13 +114,13 @@ class displacementLayeredMotionFvMotionSolver
//- Disallow default bitwise copy construct
displacementLayeredMotionFvMotionSolver
displacementLayeredMotionMotionSolver
(
const displacementLayeredMotionFvMotionSolver&
const displacementLayeredMotionMotionSolver&
);
//- Disallow default bitwise assignment
void operator=(const displacementLayeredMotionFvMotionSolver&);
void operator=(const displacementLayeredMotionMotionSolver&);
public:
@ -137,32 +131,20 @@ public:
// Constructors
//- Construct from polyMesh and data stream
displacementLayeredMotionFvMotionSolver
//- Construct from polyMesh and IOdictionary
displacementLayeredMotionMotionSolver
(
const polyMesh&,
Istream& msDataUnused
const IOdictionary&
);
//- Destructor
~displacementLayeredMotionFvMotionSolver();
~displacementLayeredMotionMotionSolver();
// Member Functions
//- Return reference to the point motion displacement field
pointVectorField& pointDisplacement()
{
return pointDisplacement_;
}
//- Return const reference to the point motion displacement field
const pointVectorField& pointDisplacement() const
{
return pointDisplacement_;
}
//- Return point location obtained from the current motion field
virtual tmp<pointField> curPoints() const;

View File

@ -0,0 +1,44 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "fvMotionSolverCore.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(fvMotionSolverCore, 0);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::fvMotionSolverCore::fvMotionSolverCore(const polyMesh& mesh)
:
fvMesh_(refCast<const fvMesh>(mesh))
{}
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -22,40 +22,31 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::fvMotionSolver
Foam::fvMotionSolverCore
Description
Virtual base class for finite volume mesh motion solvers.
The boundary motion is set as a boundary condition on the motion velocity
variable motionU.
Base class for fvMesh based motionSolvers.
SourceFiles
fvMotionSolver.C
fvMotionSolverCore.C
\*---------------------------------------------------------------------------*/
#ifndef fvMotionSolver_H
#define fvMotionSolver_H
#ifndef fvMotionSolverCore_H
#define fvMotionSolverCore_H
#include "motionSolver.H"
#include "pointFieldsFwd.H"
#include "fvMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class fvMesh;
class mapPolyMesh;
/*---------------------------------------------------------------------------*\
Class fvMotionSolver Declaration
Class velocityMotionSolver Declaration
\*---------------------------------------------------------------------------*/
class fvMotionSolver
:
public motionSolver
class fvMotionSolverCore
{
protected:
@ -77,21 +68,15 @@ protected:
GeometricBoundaryField& pmUbf
) const;
public:
//- Runtime type information
TypeName("fvMotionSolver");
ClassName("displacementMotionSolver");
// Constructors
//- Construct from polyMesh
fvMotionSolver(const polyMesh& mesh);
//- Destructor
virtual ~fvMotionSolver();
fvMotionSolverCore(const polyMesh&);
// Member Functions
@ -101,18 +86,6 @@ public:
{
return fvMesh_;
}
//- Return point location obtained from the current motion field
virtual tmp<pointField> curPoints() const = 0;
//- Solve for motion
virtual void solve() = 0;
//- Update the pointMesh corresponding to the new points
virtual void movePoints(const pointField&);
//- Update the mesh corresponding to given map
virtual void updateMesh(const mapPolyMesh&);
};
@ -123,7 +96,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "fvMotionSolverTemplates.C"
# include "fvMotionSolverCoreTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -23,14 +23,14 @@ License
\*---------------------------------------------------------------------------*/
#include "fvMotionSolver.H"
#include "fvMotionSolverCore.H"
#include "fixedValuePointPatchFields.H"
#include "cellMotionFvPatchFields.H"
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
template<class Type>
Foam::wordList Foam::fvMotionSolver::cellMotionBoundaryTypes
Foam::wordList Foam::fvMotionSolverCore::cellMotionBoundaryTypes
(
const typename GeometricField<Type, pointPatchField, pointMesh>::
GeometricBoundaryField& pmUbf

View File

@ -37,7 +37,7 @@ namespace Foam
addToRunTimeSelectionTable
(
fvMotionSolver,
motionSolver,
velocityLaplacianFvMotionSolver,
dictionary
);
@ -49,22 +49,11 @@ namespace Foam
Foam::velocityLaplacianFvMotionSolver::velocityLaplacianFvMotionSolver
(
const polyMesh& mesh,
Istream&
const IOdictionary& dict
)
:
fvMotionSolver(mesh),
pointMotionU_
(
IOobject
(
"pointMotionU",
fvMesh_.time().timeName(),
fvMesh_,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
pointMesh::New(fvMesh_)
),
velocityMotionSolver(mesh, dict, typeName),
fvMotionSolverCore(mesh),
cellMotionU_
(
IOobject
@ -86,7 +75,7 @@ Foam::velocityLaplacianFvMotionSolver::velocityLaplacianFvMotionSolver
),
diffusivityPtr_
(
motionDiffusivity::New(fvMesh_, lookup("diffusivity"))
motionDiffusivity::New(fvMesh_, coeffDict().lookup("diffusivity"))
)
{}
@ -141,17 +130,28 @@ void Foam::velocityLaplacianFvMotionSolver::solve()
}
//void Foam::velocityLaplacianFvMotionSolver::movePoints(const pointField& p)
//{
// // Movement of pointMesh and volPointInterpolation already
// // done by polyMesh,fvMesh
//}
void Foam::velocityLaplacianFvMotionSolver::updateMesh
(
const mapPolyMesh& mpm
)
{
fvMotionSolver::updateMesh(mpm);
velocityMotionSolver::updateMesh(mpm);
// Update diffusivity. Note two stage to make sure old one is de-registered
// before creating/registering new one.
diffusivityPtr_.reset(NULL);
diffusivityPtr_ = motionDiffusivity::New(mesh(), lookup("diffusivity"));
diffusivityPtr_ = motionDiffusivity::New
(
fvMesh_,
coeffDict().lookup("diffusivity")
);
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -36,7 +36,8 @@ SourceFiles
#ifndef velocityLaplacianFvMotionSolver_H
#define velocityLaplacianFvMotionSolver_H
#include "fvMotionSolver.H"
#include "velocityMotionSolver.H"
#include "fvMotionSolverCore.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -52,13 +53,11 @@ class motionDiffusivity;
class velocityLaplacianFvMotionSolver
:
public fvMotionSolver
public velocityMotionSolver,
public fvMotionSolverCore
{
// Private data
//- Point motion field
mutable pointVectorField pointMotionU_;
//- Cell-centre motion field
mutable volVectorField cellMotionU_;
@ -86,11 +85,11 @@ public:
// Constructors
//- Construct from polyMesh and data stream
//- Construct from polyMesh and IOdictionary
velocityLaplacianFvMotionSolver
(
const polyMesh&,
Istream& msDataUnused
const IOdictionary&
);
@ -100,18 +99,6 @@ public:
// Member Functions
//- Return reference to the point motion velocity field
pointVectorField& pointMotionU()
{
return pointMotionU_;
}
//- Return const reference to the point motion velocity field
const pointVectorField& pointMotionU() const
{
return pointMotionU_;
}
//- Return reference to the cell motion velocity field
volVectorField& cellMotionU()
{
@ -130,6 +117,9 @@ public:
//- Solve for motion
virtual void solve();
// //- Update the pointMesh corresponding to the new points
// void movePoints(const pointField&);
//- Update topology
virtual void updateMesh(const mapPolyMesh&);
};

View File

@ -27,7 +27,7 @@ License
#include "surfaceInterpolate.H"
#include "zeroGradientFvPatchFields.H"
#include "addToRunTimeSelectionTable.H"
#include "fvMotionSolver.H"
#include "velocityMotionSolver.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -96,10 +96,10 @@ void Foam::motionDirectionalDiffusivity::correct()
{
first = false;
const fvMotionSolver& mSolver =
mesh().lookupObject<fvMotionSolver>("dynamicMeshDict");
const velocityMotionSolver& mSolver =
mesh().lookupObject<velocityMotionSolver>("dynamicMeshDict");
const_cast<fvMotionSolver&>(mSolver).solve();
const_cast<velocityMotionSolver&>(mSolver).solve();
correct();
}
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -28,7 +28,7 @@ License
#include "Time.H"
#include "transformField.H"
#include "fvMesh.H"
#include "displacementLaplacianFvMotionSolver.H"
#include "displacementMotionSolver.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -95,7 +95,7 @@ void surfaceDisplacementPointPatchVectorField::calcProjection
}
// Get the starting locations from the motionSolver
const pointField& points0 = mesh.lookupObject<displacementFvMotionSolver>
const pointField& points0 = mesh.lookupObject<displacementMotionSolver>
(
"dynamicMeshDict"
).points0();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -26,7 +26,7 @@ Class
Description
Displacement fixed by projection onto triSurface.
Use in a displacement fvMotionSolver
Use in a displacementMotionSolver
as a bc on the pointDisplacement field.
Calculates the projection onto the surface according

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -28,7 +28,7 @@ License
#include "Time.H"
#include "transformField.H"
#include "fvMesh.H"
#include "displacementFvMotionSolver.H"
#include "displacementMotionSolver.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -94,7 +94,7 @@ void surfaceSlipDisplacementPointPatchVectorField::calcProjection
}
// Get the starting locations from the motionSolver
const pointField& points0 = mesh.lookupObject<displacementFvMotionSolver>
const pointField& points0 = mesh.lookupObject<displacementMotionSolver>
(
"dynamicMeshDict"
).points0();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -25,7 +25,7 @@ Class
Foam::surfaceSlipDisplacementPointPatchVectorField
Description
Displacement follows a triSurface. Use in a displacement fvMotionSolver
Displacement follows a triSurface. Use in a displacementMotionSolver
as a bc on the pointDisplacement field.
Following is done by calculating the projection onto the surface according
to the projectMode