mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
common base for displacement solvers
modified: fvMotionSolver/Make/files modified: fvMotionSolver/fvMotionSolvers/displacement/SBRStress/displacementSBRStressFvMotionSolver.C modified: fvMotionSolver/fvMotionSolvers/displacement/SBRStress/displacementSBRStressFvMotionSolver.H new file: fvMotionSolver/fvMotionSolvers/displacement/displacementFvMotionSolver/displacementFvMotionSolver.C new file: fvMotionSolver/fvMotionSolvers/displacement/displacementFvMotionSolver/displacementFvMotionSolver.H modified: fvMotionSolver/fvMotionSolvers/displacement/interpolation/displacementInterpolationFvMotionSolver.C modified: fvMotionSolver/fvMotionSolvers/displacement/interpolation/displacementInterpolationFvMotionSolver.H modified: fvMotionSolver/fvMotionSolvers/displacement/laplacian/displacementLaplacianFvMotionSolver.C modified: fvMotionSolver/fvMotionSolvers/displacement/laplacian/displacementLaplacianFvMotionSolver.H modified: fvMotionSolver/pointPatchFields/derived/surfaceSlipDisplacement/surfaceSlipDisplacementPointPatchVectorField.C
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
fvMotionSolvers/fvMotionSolver/fvMotionSolver.C
|
||||
fvMotionSolvers/velocity/laplacian/velocityLaplacianFvMotionSolver.C
|
||||
fvMotionSolvers/displacement/displacementFvMotionSolver/displacementFvMotionSolver.C
|
||||
fvMotionSolvers/displacement/interpolation/displacementInterpolationFvMotionSolver.C
|
||||
fvMotionSolvers/displacement/laplacian/displacementLaplacianFvMotionSolver.C
|
||||
fvMotionSolvers/displacement/SBRStress/displacementSBRStressFvMotionSolver.C
|
||||
|
||||
@ -55,25 +55,10 @@ namespace Foam
|
||||
Foam::displacementSBRStressFvMotionSolver::displacementSBRStressFvMotionSolver
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
Istream&
|
||||
Istream& is
|
||||
)
|
||||
:
|
||||
fvMotionSolver(mesh),
|
||||
points0_
|
||||
(
|
||||
pointIOField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"points",
|
||||
time().constant(),
|
||||
polyMesh::meshSubDir,
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
)
|
||||
),
|
||||
displacementFvMotionSolver(mesh, is),
|
||||
pointDisplacement_
|
||||
(
|
||||
IOobject
|
||||
@ -132,7 +117,7 @@ Foam::displacementSBRStressFvMotionSolver::curPoints() const
|
||||
|
||||
tmp<pointField> tcurPoints
|
||||
(
|
||||
points0_ + pointDisplacement_.internalField()
|
||||
points0() + pointDisplacement_.internalField()
|
||||
);
|
||||
|
||||
twoDCorrectPoints(tcurPoints());
|
||||
@ -208,63 +193,7 @@ void Foam::displacementSBRStressFvMotionSolver::updateMesh
|
||||
const mapPolyMesh& mpm
|
||||
)
|
||||
{
|
||||
fvMotionSolver::updateMesh(mpm);
|
||||
|
||||
// Map points0_
|
||||
// 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 pointField& points =
|
||||
(
|
||||
mpm.hasMotionPoints()
|
||||
? mpm.preMotionPoints()
|
||||
: fvMesh_.points()
|
||||
);
|
||||
|
||||
// Note: boundBox does reduce
|
||||
const vector span0 = boundBox(points0_).span();
|
||||
const vector span = boundBox(points).span();
|
||||
|
||||
vector scaleFactors(cmptDivide(span0, span));
|
||||
|
||||
pointField 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] + cmptMultiply
|
||||
(
|
||||
scaleFactors,
|
||||
points[pointI]-points[masterPointI]
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"displacementSBRStressFvMotionSolver::updateMesh"
|
||||
"(const mapPolyMesh& mpm)"
|
||||
) << "Cannot work out coordinates of introduced vertices."
|
||||
<< " New vertex " << pointI << " at coordinate "
|
||||
<< points[pointI] << exit(FatalError);
|
||||
}
|
||||
}
|
||||
points0_.transfer(newPoints0);
|
||||
displacementFvMotionSolver::updateMesh(mpm);
|
||||
|
||||
// Update diffusivity. Note two stage to make sure old one is de-registered
|
||||
// before creating/registering new one.
|
||||
|
||||
@ -37,7 +37,7 @@ SourceFiles
|
||||
#ifndef displacementSBRStressFvMotionSolver_H
|
||||
#define displacementSBRStressFvMotionSolver_H
|
||||
|
||||
#include "fvMotionSolver.H"
|
||||
#include "displacementFvMotionSolver.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -53,13 +53,10 @@ class motionDiffusivity;
|
||||
|
||||
class displacementSBRStressFvMotionSolver
|
||||
:
|
||||
public fvMotionSolver
|
||||
public displacementFvMotionSolver
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Reference point field
|
||||
pointField points0_;
|
||||
|
||||
//- Point motion field
|
||||
mutable pointVectorField pointDisplacement_;
|
||||
|
||||
@ -105,12 +102,6 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return reference to the reference field
|
||||
const pointField& points0() const
|
||||
{
|
||||
return points0_;
|
||||
}
|
||||
|
||||
//- Return reference to the point motion displacement field
|
||||
pointVectorField& pointDisplacement()
|
||||
{
|
||||
|
||||
@ -0,0 +1,146 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||
\\/ 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "displacementFvMotionSolver.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "mapPolyMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
// defineTypeNameAndDebug(displacementFvMotionSolver, 0);
|
||||
//
|
||||
// addToRunTimeSelectionTable
|
||||
// (
|
||||
// fvMotionSolver,
|
||||
// displacementFvMotionSolver,
|
||||
// dictionary
|
||||
// );
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::displacementFvMotionSolver::
|
||||
displacementFvMotionSolver
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
Istream&
|
||||
)
|
||||
:
|
||||
fvMotionSolver(mesh),
|
||||
points0_
|
||||
(
|
||||
pointIOField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"points",
|
||||
mesh.time().constant(),
|
||||
polyMesh::meshSubDir,
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
)
|
||||
)
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::displacementFvMotionSolver::~displacementFvMotionSolver()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::displacementFvMotionSolver::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 pointField& points =
|
||||
(
|
||||
mpm.hasMotionPoints()
|
||||
? mpm.preMotionPoints()
|
||||
: fvMesh_.points()
|
||||
);
|
||||
|
||||
// Note: boundBox does reduce
|
||||
const vector span0 = boundBox(points0_).span();
|
||||
const vector span = boundBox(points).span();
|
||||
|
||||
vector scaleFactors(cmptDivide(span0, span));
|
||||
|
||||
pointField 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] + cmptMultiply
|
||||
(
|
||||
scaleFactors,
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,114 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||
\\/ 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::displacementFvMotionSolver.H
|
||||
|
||||
Description
|
||||
Base class for fvMotionSolvers which calculate displacement.
|
||||
|
||||
SourceFiles
|
||||
displacementFvMotionSolver.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef displacementFvMotionSolver_H
|
||||
#define displacementFvMotionSolver_H
|
||||
|
||||
#include "fvMotionSolver.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class displacementFvMotionSolver Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class displacementFvMotionSolver
|
||||
:
|
||||
public fvMotionSolver
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Reference point field
|
||||
pointField points0_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
displacementFvMotionSolver
|
||||
(
|
||||
const displacementFvMotionSolver&
|
||||
);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const displacementFvMotionSolver&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("displacementInterpolation");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from polyMesh and data stream
|
||||
displacementFvMotionSolver
|
||||
(
|
||||
const polyMesh&,
|
||||
Istream& msDataUnused
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
~displacementFvMotionSolver();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return reference to the reference field
|
||||
const pointField& points0() const
|
||||
{
|
||||
return points0_;
|
||||
}
|
||||
|
||||
//- Update topology
|
||||
virtual void updateMesh(const mapPolyMesh&);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -58,26 +58,10 @@ Foam::displacementInterpolationFvMotionSolver::
|
||||
displacementInterpolationFvMotionSolver
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
Istream&
|
||||
Istream& is
|
||||
)
|
||||
:
|
||||
fvMotionSolver(mesh),
|
||||
points0_
|
||||
(
|
||||
pointIOField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"points",
|
||||
mesh.time().constant(),
|
||||
polyMesh::meshSubDir,
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
)
|
||||
)
|
||||
),
|
||||
displacementFvMotionSolver(mesh, is),
|
||||
dynamicMeshCoeffs_
|
||||
(
|
||||
IOdictionary
|
||||
@ -174,7 +158,7 @@ displacementInterpolationFvMotionSolver
|
||||
forAll(fz().meshPoints(), localI)
|
||||
{
|
||||
label pointI = fz().meshPoints()[localI];
|
||||
const scalar coord = points0_[pointI][dir];
|
||||
const scalar coord = points0()[pointI][dir];
|
||||
minCoord = min(minCoord, coord);
|
||||
maxCoord = max(maxCoord, coord);
|
||||
}
|
||||
@ -198,7 +182,7 @@ displacementInterpolationFvMotionSolver
|
||||
zoneCoordinates[zoneCoordinates.size()-1] += SMALL;
|
||||
|
||||
// Check if we have static min and max mesh bounds
|
||||
const scalarField meshCoords = points0_.component(dir);
|
||||
const scalarField meshCoords = points0().component(dir);
|
||||
|
||||
scalar minCoord = gMin(meshCoords);
|
||||
scalar maxCoord = gMax(meshCoords);
|
||||
@ -288,7 +272,7 @@ displacementInterpolationFvMotionSolver
|
||||
"displacementInterpolationFvMotionSolver::"
|
||||
"displacementInterpolationFvMotionSolver"
|
||||
"(const polyMesh&, Istream&)"
|
||||
) << "Did not find point " << points0_[pointI]
|
||||
) << "Did not find point " << points0()[pointI]
|
||||
<< " coordinate " << meshCoords[pointI]
|
||||
<< " in ranges " << rangeToCoord
|
||||
<< abort(FatalError);
|
||||
@ -344,18 +328,18 @@ Foam::displacementInterpolationFvMotionSolver::
|
||||
Foam::tmp<Foam::pointField>
|
||||
Foam::displacementInterpolationFvMotionSolver::curPoints() const
|
||||
{
|
||||
if (mesh().nPoints() != points0_.size())
|
||||
if (mesh().nPoints() != points0().size())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"displacementInterpolationFvMotionSolver::curPoints() const"
|
||||
) << "The number of points in the mesh seems to have changed." << endl
|
||||
<< "In constant/polyMesh there are " << points0_.size()
|
||||
<< "In constant/polyMesh there are " << points0().size()
|
||||
<< " points; in the current mesh there are " << mesh().nPoints()
|
||||
<< " points." << exit(FatalError);
|
||||
}
|
||||
|
||||
tmp<pointField> tcurPoints(new pointField(points0_));
|
||||
tmp<pointField> tcurPoints(new pointField(points0()));
|
||||
pointField& curPoints = tcurPoints();
|
||||
|
||||
// Interpolate the diplacement of the face zones.
|
||||
@ -413,68 +397,4 @@ Foam::displacementInterpolationFvMotionSolver::curPoints() const
|
||||
}
|
||||
|
||||
|
||||
void Foam::displacementInterpolationFvMotionSolver::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 pointField& points =
|
||||
(
|
||||
mpm.hasMotionPoints()
|
||||
? mpm.preMotionPoints()
|
||||
: fvMesh_.points()
|
||||
);
|
||||
|
||||
// Note: boundBox does reduce
|
||||
const vector span0 = boundBox(points0_).span();
|
||||
const vector span = boundBox(points).span();
|
||||
|
||||
vector scaleFactors(cmptDivide(span0, span));
|
||||
|
||||
pointField 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] + cmptMultiply
|
||||
(
|
||||
scaleFactors,
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -48,7 +48,7 @@ SourceFiles
|
||||
#ifndef displacementInterpolationFvMotionSolver_H
|
||||
#define displacementInterpolationFvMotionSolver_H
|
||||
|
||||
#include "fvMotionSolver.H"
|
||||
#include "displacementFvMotionSolver.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -61,13 +61,10 @@ namespace Foam
|
||||
|
||||
class displacementInterpolationFvMotionSolver
|
||||
:
|
||||
public fvMotionSolver
|
||||
public displacementFvMotionSolver
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Reference point field
|
||||
pointField points0_;
|
||||
|
||||
//- Additional settings for motion solver
|
||||
dictionary dynamicMeshCoeffs_;
|
||||
|
||||
@ -130,21 +127,12 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return reference to the reference field
|
||||
const pointField& points0() const
|
||||
{
|
||||
return points0_;
|
||||
}
|
||||
|
||||
//- 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&);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -53,26 +53,10 @@ namespace Foam
|
||||
Foam::displacementLaplacianFvMotionSolver::displacementLaplacianFvMotionSolver
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
Istream&
|
||||
Istream& is
|
||||
)
|
||||
:
|
||||
fvMotionSolver(mesh),
|
||||
points0_
|
||||
(
|
||||
pointIOField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"points",
|
||||
time().constant(),
|
||||
polyMesh::meshSubDir,
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
)
|
||||
)
|
||||
),
|
||||
displacementFvMotionSolver(mesh, is),
|
||||
pointDisplacement_
|
||||
(
|
||||
IOobject
|
||||
@ -186,7 +170,7 @@ Foam::displacementLaplacianFvMotionSolver::curPoints() const
|
||||
}
|
||||
|
||||
pointLocation_().internalField() =
|
||||
points0_
|
||||
points0()
|
||||
+ pointDisplacement_.internalField();
|
||||
|
||||
pointLocation_().correctBoundaryConditions();
|
||||
@ -198,7 +182,7 @@ Foam::displacementLaplacianFvMotionSolver::curPoints() const
|
||||
|
||||
forAll(pz, i)
|
||||
{
|
||||
pointLocation_()[pz[i]] = points0_[pz[i]];
|
||||
pointLocation_()[pz[i]] = points0()[pz[i]];
|
||||
}
|
||||
}
|
||||
|
||||
@ -210,7 +194,7 @@ Foam::displacementLaplacianFvMotionSolver::curPoints() const
|
||||
{
|
||||
tmp<pointField> tcurPoints
|
||||
(
|
||||
points0_ + pointDisplacement_.internalField()
|
||||
points0() + pointDisplacement_.internalField()
|
||||
);
|
||||
|
||||
// Implement frozen points
|
||||
@ -220,7 +204,7 @@ Foam::displacementLaplacianFvMotionSolver::curPoints() const
|
||||
|
||||
forAll(pz, i)
|
||||
{
|
||||
tcurPoints()[pz[i]] = points0_[pz[i]];
|
||||
tcurPoints()[pz[i]] = points0()[pz[i]];
|
||||
}
|
||||
}
|
||||
|
||||
@ -257,74 +241,7 @@ void Foam::displacementLaplacianFvMotionSolver::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 pointField& points =
|
||||
(
|
||||
mpm.hasMotionPoints()
|
||||
? mpm.preMotionPoints()
|
||||
: fvMesh_.points()
|
||||
);
|
||||
|
||||
// Note: boundBox does reduce
|
||||
const vector span0 = boundBox(points0_).span();
|
||||
const vector span = boundBox(points).span();
|
||||
|
||||
vector scaleFactors(cmptDivide(span0, span));
|
||||
|
||||
pointField 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] + cmptMultiply
|
||||
(
|
||||
scaleFactors,
|
||||
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);
|
||||
|
||||
if (debug & 2)
|
||||
{
|
||||
OFstream str(time().timePath()/"points0.obj");
|
||||
Pout<< "displacementLaplacianFvMotionSolver :"
|
||||
<< " Writing points0_ to " << str.name() << endl;
|
||||
|
||||
forAll(points0_, pointI)
|
||||
{
|
||||
meshTools::writeOBJ(str, points0_[pointI]);
|
||||
}
|
||||
}
|
||||
displacementFvMotionSolver::updateMesh(mpm);
|
||||
|
||||
// Update diffusivity. Note two stage to make sure old one is de-registered
|
||||
// before creating/registering new one.
|
||||
|
||||
@ -37,7 +37,7 @@ SourceFiles
|
||||
#ifndef displacementLaplacianFvMotionSolver_H
|
||||
#define displacementLaplacianFvMotionSolver_H
|
||||
|
||||
#include "fvMotionSolver.H"
|
||||
#include "displacementFvMotionSolver.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -53,13 +53,10 @@ class motionDiffusivity;
|
||||
|
||||
class displacementLaplacianFvMotionSolver
|
||||
:
|
||||
public fvMotionSolver
|
||||
public displacementFvMotionSolver
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Reference point field
|
||||
pointField points0_;
|
||||
|
||||
//- Point motion field
|
||||
mutable pointVectorField pointDisplacement_;
|
||||
|
||||
@ -113,13 +110,6 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
|
||||
//- Return reference to the reference field
|
||||
const pointField& points0() const
|
||||
{
|
||||
return points0_;
|
||||
}
|
||||
|
||||
//- Return reference to the point motion displacement field
|
||||
pointVectorField& pointDisplacement()
|
||||
{
|
||||
|
||||
@ -29,7 +29,7 @@ License
|
||||
#include "Time.H"
|
||||
#include "transformField.H"
|
||||
#include "fvMesh.H"
|
||||
#include "displacementLaplacianFvMotionSolver.H"
|
||||
#include "displacementFvMotionSolver.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -95,8 +95,8 @@ void surfaceSlipDisplacementPointPatchVectorField::calcProjection
|
||||
}
|
||||
|
||||
// Get the starting locations from the motionSolver
|
||||
const displacementLaplacianFvMotionSolver& motionSolver =
|
||||
mesh.lookupObject<displacementLaplacianFvMotionSolver>
|
||||
const displacementFvMotionSolver& motionSolver =
|
||||
mesh.lookupObject<displacementFvMotionSolver>
|
||||
(
|
||||
"dynamicMeshDict"
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user