mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Creation of OpenFOAM-dev repository 15/04/2008
This commit is contained in:
32
src/fvMotionSolver/Make/files
Normal file
32
src/fvMotionSolver/Make/files
Normal file
@ -0,0 +1,32 @@
|
||||
fvMotionSolvers/fvMotionSolver/fvMotionSolver.C
|
||||
fvMotionSolvers/velocity/laplacian/velocityLaplacianFvMotionSolver.C
|
||||
fvMotionSolvers/displacement/laplacian/displacementLaplacianFvMotionSolver.C
|
||||
fvMotionSolvers/displacement/SBRStress/displacementSBRStressFvMotionSolver.C
|
||||
|
||||
fvMotionSolvers/velocity/componentLaplacian/velocityComponentLaplacianFvMotionSolver.C
|
||||
fvMotionSolvers/displacement/componentLaplacian/displacementComponentLaplacianFvMotionSolver.C
|
||||
|
||||
motionDiffusivity/motionDiffusivity/motionDiffusivity.C
|
||||
motionDiffusivity/uniform/uniformDiffusivity.C
|
||||
motionDiffusivity/inverseDistance/inverseDistanceDiffusivity.C
|
||||
motionDiffusivity/inverseFaceDistance/inverseFaceDistanceDiffusivity.C
|
||||
motionDiffusivity/inversePointDistance/inversePointDistanceDiffusivity.C
|
||||
motionDiffusivity/inverseVolume/inverseVolumeDiffusivity.C
|
||||
motionDiffusivity/directional/directionalDiffusivity.C
|
||||
motionDiffusivity/motionDirectional/motionDirectionalDiffusivity.C
|
||||
motionDiffusivity/file/fileDiffusivity.C
|
||||
|
||||
motionDiffusivity/manipulators/quadratic/quadraticDiffusivity.C
|
||||
motionDiffusivity/manipulators/exponential/exponentialDiffusivity.C
|
||||
|
||||
fvPatchFields/derived/cellMotion/cellMotionFvPatchFields.C
|
||||
fvPatchFields/derived/surfaceSlipDisplacement/surfaceSlipDisplacementFvPatchFields.C
|
||||
|
||||
pointPatchFields/derived/oscillatingVelocity/oscillatingVelocityPointPatchVectorField.C
|
||||
pointPatchFields/derived/angularOscillatingVelocity/angularOscillatingVelocityPointPatchVectorField.C
|
||||
|
||||
pointPatchFields/derived/oscillatingDisplacement/oscillatingDisplacementPointPatchVectorField.C
|
||||
pointPatchFields/derived/angularOscillatingDisplacement/angularOscillatingDisplacementPointPatchVectorField.C
|
||||
pointPatchFields/derived/surfaceSlipDisplacement/surfaceSlipDisplacementPointPatchVectorField.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libfvMotionSolvers
|
||||
11
src/fvMotionSolver/Make/options
Normal file
11
src/fvMotionSolver/Make/options
Normal file
@ -0,0 +1,11 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/triSurface/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/dynamicMesh/lnInclude \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude
|
||||
|
||||
LIB_LIBS = \
|
||||
-ltriSurface \
|
||||
-lmeshTools \
|
||||
-ldynamicMesh \
|
||||
-lfiniteVolume
|
||||
@ -0,0 +1,275 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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 "displacementSBRStressFvMotionSolver.H"
|
||||
#include "motionDiffusivity.H"
|
||||
#include "fvmLaplacian.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "fvcDiv.H"
|
||||
#include "fvcGrad.H"
|
||||
#include "surfaceInterpolate.H"
|
||||
#include "fvcLaplacian.H"
|
||||
#include "mapPolyMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(displacementSBRStressFvMotionSolver, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
fvMotionSolver,
|
||||
displacementSBRStressFvMotionSolver,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::displacementSBRStressFvMotionSolver::displacementSBRStressFvMotionSolver
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
Istream& msData
|
||||
)
|
||||
:
|
||||
fvMotionSolver(mesh),
|
||||
points0_
|
||||
(
|
||||
pointIOField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"points",
|
||||
time().constant(),
|
||||
polyMesh::meshSubDir,
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
)
|
||||
),
|
||||
pointDisplacement_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"pointDisplacement",
|
||||
fvMesh_.time().timeName(),
|
||||
fvMesh_,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
pointMesh_
|
||||
),
|
||||
cellDisplacement_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"cellDisplacement",
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
fvMesh_,
|
||||
dimensionedVector
|
||||
(
|
||||
"cellDisplacement",
|
||||
pointDisplacement_.dimensions(),
|
||||
vector::zero
|
||||
),
|
||||
cellMotionBoundaryTypes<vector>(pointDisplacement_.boundaryField())
|
||||
),
|
||||
diffusivityPtr_
|
||||
(
|
||||
motionDiffusivity::New(*this, lookup("diffusivity"))
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::displacementSBRStressFvMotionSolver::
|
||||
~displacementSBRStressFvMotionSolver()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
Foam::tmp<Foam::pointField>
|
||||
Foam::displacementSBRStressFvMotionSolver::curPoints() const
|
||||
{
|
||||
vpi_.interpolate(cellDisplacement_, pointDisplacement_);
|
||||
|
||||
tmp<pointField> tcurPoints
|
||||
(
|
||||
points0_ + pointDisplacement_.internalField()
|
||||
);
|
||||
|
||||
twoDCorrectPoints(tcurPoints());
|
||||
|
||||
return tcurPoints;
|
||||
}
|
||||
|
||||
|
||||
void Foam::displacementSBRStressFvMotionSolver::solve()
|
||||
{
|
||||
// The points have moved so before interpolation update
|
||||
// the fvMotionSolver accordingly
|
||||
movePoints(fvMesh_.points());
|
||||
|
||||
diffusivityPtr_->correct();
|
||||
pointDisplacement_.boundaryField().updateCoeffs();
|
||||
|
||||
surfaceScalarField Df = diffusivityPtr_->operator()();
|
||||
|
||||
volTensorField gradCd = fvc::grad(cellDisplacement_);
|
||||
|
||||
Foam::solve
|
||||
(
|
||||
fvm::laplacian
|
||||
(
|
||||
2*Df,
|
||||
cellDisplacement_,
|
||||
"laplacian(diffusivity,cellDisplacement)"
|
||||
)
|
||||
|
||||
+ fvc::div
|
||||
(
|
||||
Df
|
||||
*(
|
||||
(
|
||||
cellDisplacement_.mesh().Sf()
|
||||
& fvc::interpolate(gradCd.T() - gradCd)
|
||||
)
|
||||
|
||||
// Solid-body rotation "lambda" term
|
||||
- cellDisplacement_.mesh().Sf()*fvc::interpolate(tr(gradCd))
|
||||
)
|
||||
)
|
||||
|
||||
/*
|
||||
- fvc::laplacian
|
||||
(
|
||||
2*Df,
|
||||
cellDisplacement_,
|
||||
"laplacian(diffusivity,cellDisplacement)"
|
||||
)
|
||||
|
||||
+ fvc::div
|
||||
(
|
||||
Df
|
||||
*(
|
||||
(
|
||||
cellDisplacement_.mesh().Sf()
|
||||
& fvc::interpolate(gradCd + gradCd.T())
|
||||
)
|
||||
|
||||
// Solid-body rotation "lambda" term
|
||||
- cellDisplacement_.mesh().Sf()*fvc::interpolate(tr(gradCd))
|
||||
)
|
||||
)
|
||||
*/
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
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 boundBox bb0(points0_, true);
|
||||
const vector span0(bb0.max()-bb0.min());
|
||||
const boundBox bb(points, true);
|
||||
const vector span(bb.max()-bb.min());
|
||||
|
||||
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);
|
||||
|
||||
// Update diffusivity. Note two stage to make sure old one is de-registered
|
||||
// before creating/registering new one.
|
||||
diffusivityPtr_.reset(NULL);
|
||||
diffusivityPtr_ = motionDiffusivity::New(*this, lookup("diffusivity"));
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,157 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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::displacementSBRStressFvMotionSolver
|
||||
|
||||
Description
|
||||
Mesh motion solver for an fvMesh. Based on solving the cell-centre
|
||||
solid-body rotation stress equations for the motion displacement.
|
||||
|
||||
SourceFiles
|
||||
displacementSBRStressFvMotionSolver.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef displacementSBRStressFvMotionSolver_H
|
||||
#define displacementSBRStressFvMotionSolver_H
|
||||
|
||||
#include "fvMotionSolver.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward class declarations
|
||||
class motionDiffusivity;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class displacementSBRStressFvMotionSolver Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class displacementSBRStressFvMotionSolver
|
||||
:
|
||||
public fvMotionSolver
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Reference point field
|
||||
pointField points0_;
|
||||
|
||||
//- Point motion field
|
||||
mutable pointVectorField pointDisplacement_;
|
||||
|
||||
//- Cell-centre motion field
|
||||
mutable volVectorField cellDisplacement_;
|
||||
|
||||
//- Diffusivity used to control the motion
|
||||
autoPtr<motionDiffusivity> diffusivityPtr_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
displacementSBRStressFvMotionSolver
|
||||
(
|
||||
const displacementSBRStressFvMotionSolver&
|
||||
);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const displacementSBRStressFvMotionSolver&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("displacementSBRStress");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from polyMesh and data stream
|
||||
displacementSBRStressFvMotionSolver
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
Istream& msData
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
~displacementSBRStressFvMotionSolver();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- 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_;
|
||||
}
|
||||
|
||||
//- Return reference to the cell motion displacement field
|
||||
volVectorField& cellDisplacement()
|
||||
{
|
||||
return cellDisplacement_;
|
||||
}
|
||||
|
||||
//- Return const reference to the cell motion displacement field
|
||||
const volVectorField& cellDisplacement() const
|
||||
{
|
||||
return cellDisplacement_;
|
||||
}
|
||||
|
||||
//- 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&);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,363 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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 "displacementComponentLaplacianFvMotionSolver.H"
|
||||
#include "motionDiffusivity.H"
|
||||
#include "fvmLaplacian.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "mapPolyMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(displacementComponentLaplacianFvMotionSolver, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
fvMotionSolver,
|
||||
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
|
||||
)
|
||||
:
|
||||
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_
|
||||
),
|
||||
cellDisplacement_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"cellDisplacement" + cmptName_,
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
fvMesh_,
|
||||
dimensionedScalar
|
||||
(
|
||||
"cellDisplacement",
|
||||
pointDisplacement_.dimensions(),
|
||||
0
|
||||
),
|
||||
cellMotionBoundaryTypes<scalar>(pointDisplacement_.boundaryField())
|
||||
),
|
||||
pointLocation_(NULL),
|
||||
diffusivityPtr_
|
||||
(
|
||||
motionDiffusivity::New(*this, lookup("diffusivity"))
|
||||
),
|
||||
frozenPointsZone_
|
||||
(
|
||||
found("frozenPointsZone")
|
||||
? fvMesh_.pointZones().findZoneID(lookup("frozenPointsZone"))
|
||||
: -1
|
||||
)
|
||||
{
|
||||
IOobject io
|
||||
(
|
||||
"pointLocation",
|
||||
fvMesh_.time().timeName(),
|
||||
fvMesh_,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
);
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Info<< "displacementComponentLaplacianFvMotionSolver:" << nl
|
||||
<< " diffusivity : " << diffusivityPtr_().type() << nl
|
||||
<< " frozenPoints zone : " << frozenPointsZone_ << endl;
|
||||
}
|
||||
|
||||
if (io.headerOk())
|
||||
{
|
||||
pointLocation_.reset
|
||||
(
|
||||
new pointVectorField
|
||||
(
|
||||
io,
|
||||
pointMesh_
|
||||
)
|
||||
);
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Info<< "displacementComponentLaplacianFvMotionSolver :"
|
||||
<< " Read pointVectorField "
|
||||
<< io.name() << " to be used for boundary conditions on points."
|
||||
<< nl
|
||||
<< "Boundary conditions:"
|
||||
<< pointLocation_().boundaryField().types() << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::displacementComponentLaplacianFvMotionSolver::
|
||||
~displacementComponentLaplacianFvMotionSolver()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
Foam::tmp<Foam::pointField>
|
||||
Foam::displacementComponentLaplacianFvMotionSolver::curPoints() const
|
||||
{
|
||||
vpi_.interpolate(cellDisplacement_, pointDisplacement_);
|
||||
|
||||
if (pointLocation_.valid())
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Info<< "displacementComponentLaplacianFvMotionSolver : applying "
|
||||
<< " boundary conditions on " << pointLocation_().name()
|
||||
<< " to new point location."
|
||||
<< endl;
|
||||
}
|
||||
|
||||
// Apply pointLocation_ b.c. to mesh points.
|
||||
|
||||
pointLocation_().internalField() = fvMesh_.points();
|
||||
|
||||
pointLocation_().internalField().replace
|
||||
(
|
||||
cmpt_,
|
||||
points0_ + pointDisplacement_.internalField()
|
||||
);
|
||||
|
||||
pointLocation_().correctBoundaryConditions();
|
||||
|
||||
// Implement frozen points
|
||||
if (frozenPointsZone_ != -1)
|
||||
{
|
||||
const pointZone& pz = fvMesh_.pointZones()[frozenPointsZone_];
|
||||
|
||||
forAll(pz, i)
|
||||
{
|
||||
label pointI = pz[i];
|
||||
|
||||
pointLocation_()[pointI][cmpt_] = points0_[pointI];
|
||||
}
|
||||
}
|
||||
|
||||
twoDCorrectPoints(pointLocation_().internalField());
|
||||
|
||||
return tmp<pointField>(pointLocation_().internalField());
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp<pointField> tcurPoints(new pointField(fvMesh_.points()));
|
||||
|
||||
tcurPoints().replace
|
||||
(
|
||||
cmpt_,
|
||||
points0_ + pointDisplacement_.internalField()
|
||||
);
|
||||
|
||||
// Implement frozen points
|
||||
if (frozenPointsZone_ != -1)
|
||||
{
|
||||
const pointZone& pz = fvMesh_.pointZones()[frozenPointsZone_];
|
||||
|
||||
forAll(pz, i)
|
||||
{
|
||||
label pointI = pz[i];
|
||||
|
||||
tcurPoints()[pointI][cmpt_] = points0_[pointI];
|
||||
}
|
||||
}
|
||||
|
||||
twoDCorrectPoints(tcurPoints());
|
||||
|
||||
return tcurPoints;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::displacementComponentLaplacianFvMotionSolver::solve()
|
||||
{
|
||||
// The points have moved so before interpolation update
|
||||
// the fvMotionSolver accordingly
|
||||
movePoints(fvMesh_.points());
|
||||
|
||||
diffusivityPtr_->correct();
|
||||
pointDisplacement_.boundaryField().updateCoeffs();
|
||||
|
||||
Foam::solve
|
||||
(
|
||||
fvm::laplacian
|
||||
(
|
||||
diffusivityPtr_->operator()(),
|
||||
cellDisplacement_,
|
||||
"laplacian(diffusivity,cellDisplacement)"
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
|
||||
// Update diffusivity. Note two stage to make sure old one is de-registered
|
||||
// before creating/registering new one.
|
||||
diffusivityPtr_.reset(NULL);
|
||||
diffusivityPtr_ = motionDiffusivity::New(*this, lookup("diffusivity"));
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,156 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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::displacementComponentLaplacianFvMotionSolver
|
||||
|
||||
Description
|
||||
Mesh motion solver for an fvMesh. Based on solving the cell-centre
|
||||
Laplacian for the given component of the motion displacement.
|
||||
|
||||
SourceFiles
|
||||
displacementComponentLaplacianFvMotionSolver.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef displacementComponentLaplacianFvMotionSolver_H
|
||||
#define displacementComponentLaplacianFvMotionSolver_H
|
||||
|
||||
#include "fvMotionSolver.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward class declarations
|
||||
class motionDiffusivity;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class displacementComponentLaplacianFvMotionSolver Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class displacementComponentLaplacianFvMotionSolver
|
||||
:
|
||||
public fvMotionSolver
|
||||
{
|
||||
// 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_;
|
||||
|
||||
//- Optionally read point-position field. Used only for position
|
||||
// boundary conditions.
|
||||
mutable autoPtr<pointVectorField> pointLocation_;
|
||||
|
||||
//- Diffusivity used to control the motion
|
||||
autoPtr<motionDiffusivity> diffusivityPtr_;
|
||||
|
||||
//- Frozen points (that are not on patches). -1 or points that are
|
||||
// fixed to be at points0_ location
|
||||
label frozenPointsZone_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
displacementComponentLaplacianFvMotionSolver
|
||||
(
|
||||
const displacementComponentLaplacianFvMotionSolver&
|
||||
);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const displacementComponentLaplacianFvMotionSolver&);
|
||||
|
||||
//- Return the component corresponding to the given component name
|
||||
direction cmpt(const word& cmptName) const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("displacementComponentLaplacian");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
displacementComponentLaplacianFvMotionSolver
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
Istream& msData
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
~displacementComponentLaplacianFvMotionSolver();
|
||||
|
||||
|
||||
// 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()
|
||||
{
|
||||
return cellDisplacement_;
|
||||
}
|
||||
|
||||
//- 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&);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,335 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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 "displacementLaplacianFvMotionSolver.H"
|
||||
#include "motionDiffusivity.H"
|
||||
#include "fvmLaplacian.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "OFstream.H"
|
||||
#include "meshTools.H"
|
||||
#include "mapPolyMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(displacementLaplacianFvMotionSolver, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
fvMotionSolver,
|
||||
displacementLaplacianFvMotionSolver,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::displacementLaplacianFvMotionSolver::displacementLaplacianFvMotionSolver
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
Istream& msData
|
||||
)
|
||||
:
|
||||
fvMotionSolver(mesh),
|
||||
points0_
|
||||
(
|
||||
pointIOField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"points",
|
||||
time().constant(),
|
||||
polyMesh::meshSubDir,
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
)
|
||||
)
|
||||
),
|
||||
pointDisplacement_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"pointDisplacement",
|
||||
fvMesh_.time().timeName(),
|
||||
fvMesh_,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
pointMesh_
|
||||
),
|
||||
cellDisplacement_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"cellDisplacement",
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
fvMesh_,
|
||||
dimensionedVector
|
||||
(
|
||||
"cellDisplacement",
|
||||
pointDisplacement_.dimensions(),
|
||||
vector::zero
|
||||
),
|
||||
cellMotionBoundaryTypes<vector>(pointDisplacement_.boundaryField())
|
||||
),
|
||||
pointLocation_(NULL),
|
||||
diffusivityPtr_
|
||||
(
|
||||
motionDiffusivity::New(*this, lookup("diffusivity"))
|
||||
),
|
||||
frozenPointsZone_
|
||||
(
|
||||
found("frozenPointsZone")
|
||||
? fvMesh_.pointZones().findZoneID(lookup("frozenPointsZone"))
|
||||
: -1
|
||||
)
|
||||
{
|
||||
IOobject io
|
||||
(
|
||||
"pointLocation",
|
||||
fvMesh_.time().timeName(),
|
||||
fvMesh_,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
);
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Info<< "displacementLaplacianFvMotionSolver:" << nl
|
||||
<< " diffusivity : " << diffusivityPtr_().type() << nl
|
||||
<< " frozenPoints zone : " << frozenPointsZone_ << endl;
|
||||
}
|
||||
|
||||
|
||||
if (io.headerOk())
|
||||
{
|
||||
pointLocation_.reset
|
||||
(
|
||||
new pointVectorField
|
||||
(
|
||||
io,
|
||||
pointMesh_
|
||||
)
|
||||
);
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Info<< "displacementLaplacianFvMotionSolver :"
|
||||
<< " Read pointVectorField "
|
||||
<< io.name() << " to be used for boundary conditions on points."
|
||||
<< nl
|
||||
<< "Boundary conditions:"
|
||||
<< pointLocation_().boundaryField().types() << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::displacementLaplacianFvMotionSolver::
|
||||
~displacementLaplacianFvMotionSolver()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
Foam::tmp<Foam::pointField>
|
||||
Foam::displacementLaplacianFvMotionSolver::curPoints() const
|
||||
{
|
||||
vpi_.interpolate(cellDisplacement_, pointDisplacement_);
|
||||
|
||||
if (pointLocation_.valid())
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Info<< "displacementLaplacianFvMotionSolver : applying "
|
||||
<< " boundary conditions on " << pointLocation_().name()
|
||||
<< " to new point location."
|
||||
<< endl;
|
||||
}
|
||||
|
||||
pointLocation_().internalField() =
|
||||
points0_
|
||||
+ pointDisplacement_.internalField();
|
||||
|
||||
pointLocation_().correctBoundaryConditions();
|
||||
|
||||
// Implement frozen points
|
||||
if (frozenPointsZone_ != -1)
|
||||
{
|
||||
const pointZone& pz = fvMesh_.pointZones()[frozenPointsZone_];
|
||||
|
||||
forAll(pz, i)
|
||||
{
|
||||
pointLocation_()[pz[i]] = points0_[pz[i]];
|
||||
}
|
||||
}
|
||||
|
||||
twoDCorrectPoints(pointLocation_().internalField());
|
||||
|
||||
return tmp<pointField>(pointLocation_().internalField());
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp<pointField> tcurPoints
|
||||
(
|
||||
points0_ + pointDisplacement_.internalField()
|
||||
);
|
||||
|
||||
// Implement frozen points
|
||||
if (frozenPointsZone_ != -1)
|
||||
{
|
||||
const pointZone& pz = fvMesh_.pointZones()[frozenPointsZone_];
|
||||
|
||||
forAll(pz, i)
|
||||
{
|
||||
tcurPoints()[pz[i]] = points0_[pz[i]];
|
||||
}
|
||||
}
|
||||
|
||||
twoDCorrectPoints(tcurPoints());
|
||||
|
||||
return tcurPoints;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::displacementLaplacianFvMotionSolver::solve()
|
||||
{
|
||||
// The points have moved so before interpolation update
|
||||
// the fvMotionSolver accordingly
|
||||
movePoints(fvMesh_.points());
|
||||
|
||||
diffusivityPtr_->correct();
|
||||
pointDisplacement_.boundaryField().updateCoeffs();
|
||||
|
||||
Foam::solve
|
||||
(
|
||||
fvm::laplacian
|
||||
(
|
||||
diffusivityPtr_->operator()(),
|
||||
cellDisplacement_,
|
||||
"laplacian(diffusivity,cellDisplacement)"
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
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 boundBox bb0(points0_, true);
|
||||
const vector span0(bb0.max()-bb0.min());
|
||||
const boundBox bb(points, true);
|
||||
const vector span(bb.max()-bb.min());
|
||||
|
||||
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]);
|
||||
}
|
||||
}
|
||||
|
||||
// Update diffusivity. Note two stage to make sure old one is de-registered
|
||||
// before creating/registering new one.
|
||||
diffusivityPtr_.reset(NULL);
|
||||
diffusivityPtr_ = motionDiffusivity::New(*this, lookup("diffusivity"));
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,166 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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::displacementLaplacianFvMotionSolver
|
||||
|
||||
Description
|
||||
Mesh motion solver for an fvMesh. Based on solving the cell-centre
|
||||
Laplacian for the motion displacement.
|
||||
|
||||
SourceFiles
|
||||
displacementLaplacianFvMotionSolver.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef displacementLaplacianFvMotionSolver_H
|
||||
#define displacementLaplacianFvMotionSolver_H
|
||||
|
||||
#include "fvMotionSolver.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward class declarations
|
||||
class motionDiffusivity;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class displacementLaplacianFvMotionSolver Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class displacementLaplacianFvMotionSolver
|
||||
:
|
||||
public fvMotionSolver
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Reference point field
|
||||
pointField points0_;
|
||||
|
||||
//- Point motion field
|
||||
mutable pointVectorField pointDisplacement_;
|
||||
|
||||
//- Cell-centre motion field
|
||||
mutable volVectorField cellDisplacement_;
|
||||
|
||||
//- Optionally read point-position field. Used only for position
|
||||
// boundary conditions.
|
||||
mutable autoPtr<pointVectorField> pointLocation_;
|
||||
|
||||
//- Diffusivity used to control the motion
|
||||
autoPtr<motionDiffusivity> diffusivityPtr_;
|
||||
|
||||
//- Frozen points (that are not on patches). -1 or points that are
|
||||
// fixed to be at points0_ location
|
||||
label frozenPointsZone_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
displacementLaplacianFvMotionSolver
|
||||
(
|
||||
const displacementLaplacianFvMotionSolver&
|
||||
);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const displacementLaplacianFvMotionSolver&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("displacementLaplacian");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from polyMesh and data stream
|
||||
displacementLaplacianFvMotionSolver
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
Istream& msData
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
~displacementLaplacianFvMotionSolver();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
|
||||
//- 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_;
|
||||
}
|
||||
|
||||
//- Return reference to the cell motion displacement field
|
||||
volVectorField& cellDisplacement()
|
||||
{
|
||||
return cellDisplacement_;
|
||||
}
|
||||
|
||||
//- Return const reference to the cell motion displacement field
|
||||
const volVectorField& cellDisplacement() const
|
||||
{
|
||||
return cellDisplacement_;
|
||||
}
|
||||
|
||||
//- 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&);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,71 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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 "fvMotionSolver.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(fvMotionSolver, 0);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::fvMotionSolver::fvMotionSolver(const polyMesh& mesh)
|
||||
:
|
||||
motionSolver(mesh),
|
||||
fvMesh_(refCast<const fvMesh>(mesh)),
|
||||
pointMesh_(fvMesh_),
|
||||
vpi_(fvMesh_, pointMesh_)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::fvMotionSolver::~fvMotionSolver()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::fvMotionSolver::movePoints(const pointField& p)
|
||||
{
|
||||
pointMesh_.movePoints(p);
|
||||
vpi_.movePoints();
|
||||
}
|
||||
|
||||
|
||||
void Foam::fvMotionSolver::updateMesh(const mapPolyMesh& mpm)
|
||||
{
|
||||
motionSolver::updateMesh();
|
||||
pointMesh_.updateMesh(mpm);
|
||||
vpi_.updateMesh();
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,139 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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::fvMotionSolver
|
||||
|
||||
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.
|
||||
|
||||
SourceFiles
|
||||
fvMotionSolver.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef fvMotionSolver_H
|
||||
#define fvMotionSolver_H
|
||||
|
||||
#include "motionSolver.H"
|
||||
#include "volPointInterpolation.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class fvMotionSolver Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class fvMotionSolver
|
||||
:
|
||||
public motionSolver
|
||||
{
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- The fvMesh to be moved
|
||||
const fvMesh& fvMesh_;
|
||||
|
||||
//- Point mesh needed by the volPointInterpolation
|
||||
mutable pointMesh pointMesh_;
|
||||
|
||||
//- Vol-point interpolator used to obtain the point motion from
|
||||
// the cell-centre motion
|
||||
mutable volPointInterpolation vpi_;
|
||||
|
||||
|
||||
// Protected member functions
|
||||
|
||||
//- Create the corresponding patch types for cellMotion from those
|
||||
// of the given pointMotion
|
||||
template<class Type>
|
||||
wordList cellMotionBoundaryTypes
|
||||
(
|
||||
const typename GeometricField<Type, pointPatchField, pointMesh>::
|
||||
GeometricBoundaryField& pmUbf
|
||||
) const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("fvMotionSolver");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from polyMesh
|
||||
fvMotionSolver(const polyMesh& mesh);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~fvMotionSolver();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return reference to the fvMesh to be moved
|
||||
const fvMesh& mesh() const
|
||||
{
|
||||
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
|
||||
void movePoints(const pointField&);
|
||||
|
||||
//- Update the mesh corresponding to given map
|
||||
virtual void updateMesh(const mapPolyMesh&);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "fvMotionSolverTemplates.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,64 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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 "fvMotionSolver.H"
|
||||
#include "fixedValuePointPatchFields.H"
|
||||
#include "cellMotionFvPatchFields.H"
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::wordList Foam::fvMotionSolver::cellMotionBoundaryTypes
|
||||
(
|
||||
const typename GeometricField<Type, pointPatchField, pointMesh>::
|
||||
GeometricBoundaryField& pmUbf
|
||||
) const
|
||||
{
|
||||
wordList cmUbf = pmUbf.types();
|
||||
|
||||
// Remove global patches from the end of the list
|
||||
cmUbf.setSize(fvMesh_.boundary().size());
|
||||
|
||||
forAll(cmUbf, patchi)
|
||||
{
|
||||
if (isA<fixedValuePointPatchField<Type> >(pmUbf[patchi]))
|
||||
{
|
||||
cmUbf[patchi] = cellMotionFvPatchField<Type>::typeName;
|
||||
}
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "Patch:" << fvMesh_.boundary()[patchi].patch().name()
|
||||
<< " pointType:" << pmUbf.types()[patchi]
|
||||
<< " cellType:" << cmUbf[patchi] << endl;
|
||||
}
|
||||
}
|
||||
|
||||
return cmUbf;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,184 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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 "velocityComponentLaplacianFvMotionSolver.H"
|
||||
#include "motionDiffusivity.H"
|
||||
#include "fvmLaplacian.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(velocityComponentLaplacianFvMotionSolver, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
fvMotionSolver,
|
||||
velocityComponentLaplacianFvMotionSolver,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::velocityComponentLaplacianFvMotionSolver::
|
||||
velocityComponentLaplacianFvMotionSolver
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
Istream& msData
|
||||
)
|
||||
:
|
||||
fvMotionSolver(mesh),
|
||||
cmptName_(msData),
|
||||
cmpt_(0),
|
||||
pointMotionU_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"pointMotionU" + cmptName_,
|
||||
fvMesh_.time().timeName(),
|
||||
fvMesh_,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
pointMesh_
|
||||
),
|
||||
cellMotionU_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"cellMotionU" + cmptName_,
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
fvMesh_,
|
||||
dimensionedScalar
|
||||
(
|
||||
"cellMotionU",
|
||||
pointMotionU_.dimensions(),
|
||||
0
|
||||
),
|
||||
cellMotionBoundaryTypes<scalar>(pointMotionU_.boundaryField())
|
||||
),
|
||||
diffusivityPtr_
|
||||
(
|
||||
motionDiffusivity::New(*this, 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 * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::velocityComponentLaplacianFvMotionSolver::
|
||||
~velocityComponentLaplacianFvMotionSolver()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
Foam::tmp<Foam::pointField>
|
||||
Foam::velocityComponentLaplacianFvMotionSolver::curPoints() const
|
||||
{
|
||||
vpi_.interpolate(cellMotionU_, pointMotionU_);
|
||||
|
||||
tmp<pointField> tcurPoints(new pointField(fvMesh_.points()));
|
||||
|
||||
tcurPoints().replace
|
||||
(
|
||||
cmpt_,
|
||||
tcurPoints().component(cmpt_)
|
||||
+ fvMesh_.time().deltaT().value()*pointMotionU_.internalField()
|
||||
);
|
||||
|
||||
twoDCorrectPoints(tcurPoints());
|
||||
|
||||
return tcurPoints;
|
||||
}
|
||||
|
||||
|
||||
void Foam::velocityComponentLaplacianFvMotionSolver::solve()
|
||||
{
|
||||
// The points have moved so before interpolation update
|
||||
// the fvMotionSolver accordingly
|
||||
movePoints(fvMesh_.points());
|
||||
|
||||
diffusivityPtr_->correct();
|
||||
pointMotionU_.boundaryField().updateCoeffs();
|
||||
|
||||
Foam::solve
|
||||
(
|
||||
fvm::laplacian
|
||||
(
|
||||
diffusivityPtr_->operator()(),
|
||||
cellMotionU_,
|
||||
"laplacian(diffusivity,cellMotionU)"
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
void Foam::velocityComponentLaplacianFvMotionSolver::updateMesh
|
||||
(
|
||||
const mapPolyMesh& mpm
|
||||
)
|
||||
{
|
||||
fvMotionSolver::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(*this, lookup("diffusivity"));
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,136 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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::velocityComponentLaplacianFvMotionSolver
|
||||
|
||||
Description
|
||||
Mesh motion solver for an fvMesh. Based on solving the cell-centre
|
||||
Laplacian for the given component of the motion velocity.
|
||||
|
||||
SourceFiles
|
||||
velocityComponentLaplacianFvMotionSolver.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef velocityComponentLaplacianFvMotionSolver_H
|
||||
#define velocityComponentLaplacianFvMotionSolver_H
|
||||
|
||||
#include "fvMotionSolver.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward class declarations
|
||||
class motionDiffusivity;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class velocityComponentLaplacianFvMotionSolver Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class velocityComponentLaplacianFvMotionSolver
|
||||
:
|
||||
public fvMotionSolver
|
||||
{
|
||||
// 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_;
|
||||
|
||||
//- Diffusivity used to control the motion
|
||||
autoPtr<motionDiffusivity> diffusivityPtr_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
velocityComponentLaplacianFvMotionSolver
|
||||
(
|
||||
const velocityComponentLaplacianFvMotionSolver&
|
||||
);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const velocityComponentLaplacianFvMotionSolver&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("velocityComponentLaplacian");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
velocityComponentLaplacianFvMotionSolver
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
Istream& msData
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
~velocityComponentLaplacianFvMotionSolver();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Non-const access to the cellMotionU in order to allow changes
|
||||
// to the boundary motion
|
||||
volScalarField& cellMotionU()
|
||||
{
|
||||
return cellMotionU_;
|
||||
}
|
||||
|
||||
//- Return point location obtained from the current motion field
|
||||
virtual tmp<pointField> curPoints() const;
|
||||
|
||||
//- Solve for motion
|
||||
virtual void solve();
|
||||
|
||||
//- Update topology
|
||||
virtual void updateMesh(const mapPolyMesh&);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,154 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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 "velocityLaplacianFvMotionSolver.H"
|
||||
#include "motionDiffusivity.H"
|
||||
#include "fvmLaplacian.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(velocityLaplacianFvMotionSolver, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
fvMotionSolver,
|
||||
velocityLaplacianFvMotionSolver,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::velocityLaplacianFvMotionSolver::velocityLaplacianFvMotionSolver
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
Istream& msData
|
||||
)
|
||||
:
|
||||
fvMotionSolver(mesh),
|
||||
pointMotionU_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"pointMotionU",
|
||||
fvMesh_.time().timeName(),
|
||||
fvMesh_,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
pointMesh_
|
||||
),
|
||||
cellMotionU_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"cellMotionU",
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
fvMesh_,
|
||||
dimensionedVector
|
||||
(
|
||||
"cellMotionU",
|
||||
pointMotionU_.dimensions(),
|
||||
vector::zero
|
||||
),
|
||||
cellMotionBoundaryTypes<vector>(pointMotionU_.boundaryField())
|
||||
),
|
||||
diffusivityPtr_
|
||||
(
|
||||
motionDiffusivity::New(*this, lookup("diffusivity"))
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::velocityLaplacianFvMotionSolver::~velocityLaplacianFvMotionSolver()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
Foam::tmp<Foam::pointField>
|
||||
Foam::velocityLaplacianFvMotionSolver::curPoints() const
|
||||
{
|
||||
vpi_.interpolate(cellMotionU_, pointMotionU_);
|
||||
|
||||
tmp<pointField> tcurPoints
|
||||
(
|
||||
fvMesh_.points()
|
||||
+ fvMesh_.time().deltaT().value()*pointMotionU_.internalField()
|
||||
);
|
||||
|
||||
twoDCorrectPoints(tcurPoints());
|
||||
|
||||
return tcurPoints;
|
||||
}
|
||||
|
||||
|
||||
void Foam::velocityLaplacianFvMotionSolver::solve()
|
||||
{
|
||||
// The points have moved so before interpolation update
|
||||
// the fvMotionSolver accordingly
|
||||
movePoints(fvMesh_.points());
|
||||
|
||||
diffusivityPtr_->correct();
|
||||
pointMotionU_.boundaryField().updateCoeffs();
|
||||
|
||||
Foam::solve
|
||||
(
|
||||
fvm::laplacian
|
||||
(
|
||||
diffusivityPtr_->operator()(),
|
||||
cellMotionU_,
|
||||
"laplacian(diffusivity,cellMotionU)"
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
void Foam::velocityLaplacianFvMotionSolver::updateMesh
|
||||
(
|
||||
const mapPolyMesh& mpm
|
||||
)
|
||||
{
|
||||
fvMotionSolver::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(*this, lookup("diffusivity"));
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,144 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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::velocityLaplacianFvMotionSolver
|
||||
|
||||
Description
|
||||
Mesh motion solver for an fvMesh. Based on solving the cell-centre
|
||||
Laplacian for the motion velocity.
|
||||
|
||||
SourceFiles
|
||||
velocityLaplacianFvMotionSolver.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef velocityLaplacianFvMotionSolver_H
|
||||
#define velocityLaplacianFvMotionSolver_H
|
||||
|
||||
#include "fvMotionSolver.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward class declarations
|
||||
class motionDiffusivity;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class velocityLaplacianFvMotionSolver Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class velocityLaplacianFvMotionSolver
|
||||
:
|
||||
public fvMotionSolver
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Point motion field
|
||||
mutable pointVectorField pointMotionU_;
|
||||
|
||||
//- Cell-centre motion field
|
||||
mutable volVectorField cellMotionU_;
|
||||
|
||||
//- Diffusivity used to control the motion
|
||||
autoPtr<motionDiffusivity> diffusivityPtr_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
velocityLaplacianFvMotionSolver
|
||||
(
|
||||
const velocityLaplacianFvMotionSolver&
|
||||
);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const velocityLaplacianFvMotionSolver&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("velocityLaplacian");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from polyMesh and data stream
|
||||
velocityLaplacianFvMotionSolver(const polyMesh& mesh, Istream& msData);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
~velocityLaplacianFvMotionSolver();
|
||||
|
||||
|
||||
// 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()
|
||||
{
|
||||
return cellMotionU_;
|
||||
}
|
||||
|
||||
//- Return const reference to the cell motion velocity field
|
||||
const volVectorField& cellMotionU() const
|
||||
{
|
||||
return cellMotionU_;
|
||||
}
|
||||
|
||||
//- Return point location obtained from the current motion field
|
||||
virtual tmp<pointField> curPoints() const;
|
||||
|
||||
//- Solve for motion
|
||||
virtual void solve();
|
||||
|
||||
//- Update topology
|
||||
virtual void updateMesh(const mapPolyMesh&);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,144 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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 "cellMotionFvPatchField.H"
|
||||
#include "fvMesh.H"
|
||||
#include "volMesh.H"
|
||||
#include "pointFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
cellMotionFvPatchField<Type>::cellMotionFvPatchField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<Type, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<Type>(p, iF)
|
||||
{}
|
||||
|
||||
|
||||
template<class Type>
|
||||
cellMotionFvPatchField<Type>::cellMotionFvPatchField
|
||||
(
|
||||
const cellMotionFvPatchField<Type>& ptf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<Type, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<Type>(ptf, p, iF, mapper)
|
||||
{}
|
||||
|
||||
|
||||
template<class Type>
|
||||
cellMotionFvPatchField<Type>::cellMotionFvPatchField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<Type, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<Type>(p, iF)
|
||||
{
|
||||
fvPatchField<Type>::operator=(Field<Type>("value", dict, p.size()));
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
cellMotionFvPatchField<Type>::cellMotionFvPatchField
|
||||
(
|
||||
const cellMotionFvPatchField<Type>& ptf
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<Type>(ptf)
|
||||
{}
|
||||
|
||||
|
||||
template<class Type>
|
||||
cellMotionFvPatchField<Type>::cellMotionFvPatchField
|
||||
(
|
||||
const cellMotionFvPatchField<Type>& ptf,
|
||||
const DimensionedField<Type, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<Type>(ptf, iF)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
void cellMotionFvPatchField<Type>::updateCoeffs()
|
||||
{
|
||||
if (this->updated())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const fvPatch& p = this->patch();
|
||||
const polyPatch& pp = p.patch();
|
||||
const fvMesh& mesh = this->dimensionedInternalField().mesh();
|
||||
const pointField& points = mesh.points();
|
||||
|
||||
word pfName = this->dimensionedInternalField().name();
|
||||
pfName.replace("cell", "point");
|
||||
|
||||
const GeometricField<Type, pointPatchField, pointMesh>& pointMotion =
|
||||
this->db().objectRegistry::
|
||||
lookupObject<GeometricField<Type, pointPatchField, pointMesh> >
|
||||
(
|
||||
pfName
|
||||
);
|
||||
|
||||
forAll(p, i)
|
||||
{
|
||||
this->operator[](i) = pp[i].average(points, pointMotion);
|
||||
}
|
||||
|
||||
fixedValueFvPatchField<Type>::updateCoeffs();
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void cellMotionFvPatchField<Type>::write(Ostream& os) const
|
||||
{
|
||||
fvPatchField<Type>::write(os);
|
||||
this->writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,149 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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::cellMotionFvPatchField
|
||||
|
||||
Description
|
||||
Foam::cellMotionFvPatchField
|
||||
|
||||
SourceFiles
|
||||
cellMotionFvPatchField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef cellMotionFvPatchField_H
|
||||
#define cellMotionFvPatchField_H
|
||||
|
||||
#include "Random.H"
|
||||
#include "fixedValueFvPatchFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class cellMotionFvPatch Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class Type>
|
||||
class cellMotionFvPatchField
|
||||
:
|
||||
public fixedValueFvPatchField<Type>
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("cellMotion");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
cellMotionFvPatchField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<Type, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
cellMotionFvPatchField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<Type, volMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given cellMotionFvPatchField
|
||||
// onto a new patch
|
||||
cellMotionFvPatchField
|
||||
(
|
||||
const cellMotionFvPatchField<Type>&,
|
||||
const fvPatch&,
|
||||
const DimensionedField<Type, volMesh>&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
cellMotionFvPatchField
|
||||
(
|
||||
const cellMotionFvPatchField<Type>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchField<Type> > clone() const
|
||||
{
|
||||
return tmp<fvPatchField<Type> >
|
||||
(
|
||||
new cellMotionFvPatchField<Type>(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
cellMotionFvPatchField
|
||||
(
|
||||
const cellMotionFvPatchField<Type>&,
|
||||
const DimensionedField<Type, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual tmp<fvPatchField<Type> > clone
|
||||
(
|
||||
const DimensionedField<Type, volMesh>& iF
|
||||
) const
|
||||
{
|
||||
return tmp<fvPatchField<Type> >
|
||||
(
|
||||
new cellMotionFvPatchField<Type>(*this, iF)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
virtual void updateCoeffs();
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "cellMotionFvPatchField.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,44 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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 "cellMotionFvPatchFields.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "volFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
makePatchFields(cellMotion);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,50 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef cellMotionFvPatchFields_H
|
||||
#define cellMotionFvPatchFields_H
|
||||
|
||||
#include "cellMotionFvPatchField.H"
|
||||
#include "fieldTypes.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
makePatchTypeFieldTypedefs(cellMotion)
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,51 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef cellMotionFvPatchFieldsFwd_H
|
||||
#define cellMotionFvPatchFieldsFwd_H
|
||||
|
||||
#include "fieldTypes.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type> class cellMotionFvPatchField;
|
||||
|
||||
makePatchTypeFieldTypedefs(cellMotion)
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,158 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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::surfaceSlipDisplacementFvPatchField
|
||||
|
||||
Description
|
||||
fvPatchField corresponding to surfaceSlipDisplacementPointPatchField.
|
||||
Is just a slip type since all hard work (projection) is done in the
|
||||
pointPatch field.
|
||||
|
||||
SourceFiles
|
||||
surfaceSlipDisplacementFvPatchField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef surfaceSlipDisplacementFvPatchField_H
|
||||
#define surfaceSlipDisplacementFvPatchField_H
|
||||
|
||||
#include "slipFvPatchField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class surfaceSlipDisplacementFvPatch Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class Type>
|
||||
class surfaceSlipDisplacementFvPatchField
|
||||
:
|
||||
public slipFvPatchField<Type>
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("surfaceSlipDisplacement");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
surfaceSlipDisplacementFvPatchField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<Type, volMesh>& iF
|
||||
)
|
||||
:
|
||||
slipFvPatchField<Type>(p, iF)
|
||||
{}
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
surfaceSlipDisplacementFvPatchField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<Type, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
slipFvPatchField<Type>(p, iF, dict)
|
||||
{}
|
||||
|
||||
//- Construct by mapping given surfaceSlipDisplacementFvPatchField
|
||||
// onto a new patch
|
||||
surfaceSlipDisplacementFvPatchField
|
||||
(
|
||||
const surfaceSlipDisplacementFvPatchField<Type>& ptf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<Type, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
slipFvPatchField<Type>(ptf, p, iF, mapper)
|
||||
{}
|
||||
|
||||
|
||||
//- Construct as copy
|
||||
surfaceSlipDisplacementFvPatchField
|
||||
(
|
||||
const surfaceSlipDisplacementFvPatchField<Type>& ptf
|
||||
)
|
||||
:
|
||||
slipFvPatchField<Type>(ptf)
|
||||
{}
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchField<Type> > clone() const
|
||||
{
|
||||
return tmp<fvPatchField<Type> >
|
||||
(
|
||||
new surfaceSlipDisplacementFvPatchField<Type>(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
surfaceSlipDisplacementFvPatchField
|
||||
(
|
||||
const surfaceSlipDisplacementFvPatchField<Type>& ptf,
|
||||
const DimensionedField<Type, volMesh>& iF
|
||||
)
|
||||
:
|
||||
slipFvPatchField<Type>(ptf, iF)
|
||||
{}
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual tmp<fvPatchField<Type> > clone
|
||||
(
|
||||
const DimensionedField<Type, volMesh>& iF
|
||||
) const
|
||||
{
|
||||
return tmp<fvPatchField<Type> >
|
||||
(
|
||||
new surfaceSlipDisplacementFvPatchField<Type>(*this, iF)
|
||||
);
|
||||
}
|
||||
|
||||
virtual void write(Ostream& os) const
|
||||
{
|
||||
slipFvPatchField<Type>::write(os);
|
||||
// Only so we can easily postprocess.
|
||||
this->writeEntry("value", os);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,44 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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 "surfaceSlipDisplacementFvPatchFields.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "volFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
makePatchFields(surfaceSlipDisplacement);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,50 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef surfaceSlipDisplacementFvPatchFields_H
|
||||
#define surfaceSlipDisplacementFvPatchFields_H
|
||||
|
||||
#include "surfaceSlipDisplacementFvPatchField.H"
|
||||
#include "fieldTypes.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
makePatchTypeFieldTypedefs(surfaceSlipDisplacement)
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,51 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef surfaceSlipDisplacementFvPatchFieldsFwd_H
|
||||
#define surfaceSlipDisplacementFvPatchFieldsFwd_H
|
||||
|
||||
#include "fieldTypes.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type> class surfaceSlipDisplacementFvPatchField;
|
||||
|
||||
makePatchTypeFieldTypedefs(slip)
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,77 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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 "directionalDiffusivity.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(directionalDiffusivity, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
motionDiffusivity,
|
||||
directionalDiffusivity,
|
||||
Istream
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::directionalDiffusivity::directionalDiffusivity
|
||||
(
|
||||
const fvMotionSolver& mSolver,
|
||||
Istream& mdData
|
||||
)
|
||||
:
|
||||
uniformDiffusivity(mSolver, mdData),
|
||||
diffusivityVector_(mdData)
|
||||
{
|
||||
correct();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::directionalDiffusivity::~directionalDiffusivity()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::directionalDiffusivity::correct()
|
||||
{
|
||||
const fvMesh& mesh = mSolver().mesh();
|
||||
|
||||
surfaceVectorField n = mesh.Sf()/mesh.magSf();
|
||||
faceDiffusivity_ == (n & cmptMultiply(diffusivityVector_, n));
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,104 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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::directionalDiffusivity
|
||||
|
||||
Description
|
||||
Directional finite volume mesh motion diffusivity.
|
||||
|
||||
SourceFiles
|
||||
directionalDiffusivity.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef directionalDiffusivity_H
|
||||
#define directionalDiffusivity_H
|
||||
|
||||
#include "uniformDiffusivity.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class directionalDiffusivity Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class directionalDiffusivity
|
||||
:
|
||||
public uniformDiffusivity
|
||||
{
|
||||
// Private data
|
||||
|
||||
vector diffusivityVector_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
directionalDiffusivity(const directionalDiffusivity&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const directionalDiffusivity&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("directional");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct for the given fvMotionSolver and data Istream
|
||||
directionalDiffusivity
|
||||
(
|
||||
const fvMotionSolver& mSolver,
|
||||
Istream& mdData
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~directionalDiffusivity();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Correct the motion diffusivity
|
||||
virtual void correct();
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
75
src/fvMotionSolver/motionDiffusivity/file/fileDiffusivity.C
Normal file
75
src/fvMotionSolver/motionDiffusivity/file/fileDiffusivity.C
Normal file
@ -0,0 +1,75 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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 "fileDiffusivity.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(fileDiffusivity, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
motionDiffusivity,
|
||||
fileDiffusivity,
|
||||
Istream
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::fileDiffusivity::fileDiffusivity
|
||||
(
|
||||
const fvMotionSolver& mSolver,
|
||||
Istream& mdData
|
||||
)
|
||||
:
|
||||
motionDiffusivity(mSolver),
|
||||
faceDiffusivity_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
word(mdData),
|
||||
mSolver.mesh().time().constant(),
|
||||
mSolver.mesh(),
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mSolver.mesh()
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::fileDiffusivity::~fileDiffusivity()
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
117
src/fvMotionSolver/motionDiffusivity/file/fileDiffusivity.H
Normal file
117
src/fvMotionSolver/motionDiffusivity/file/fileDiffusivity.H
Normal file
@ -0,0 +1,117 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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::fileDiffusivity
|
||||
|
||||
Description
|
||||
Motion diffusivity read from given file name.
|
||||
|
||||
SourceFiles
|
||||
fileDiffusivity.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef fileDiffusivity_H
|
||||
#define fileDiffusivity_H
|
||||
|
||||
#include "motionDiffusivity.H"
|
||||
#include "surfaceFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class fileDiffusivity Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class fileDiffusivity
|
||||
:
|
||||
public motionDiffusivity
|
||||
{
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
surfaceScalarField faceDiffusivity_;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
fileDiffusivity(const fileDiffusivity&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const fileDiffusivity&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("file");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct for the given fvMotionSolver and data Istream
|
||||
fileDiffusivity
|
||||
(
|
||||
const fvMotionSolver& mSolver,
|
||||
Istream& mdData
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~fileDiffusivity();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return diffusivity field
|
||||
virtual tmp<surfaceScalarField> operator()() const
|
||||
{
|
||||
return faceDiffusivity_;
|
||||
}
|
||||
|
||||
//- Do not correct the motion diffusivity
|
||||
virtual void correct()
|
||||
{}
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,115 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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 "inverseDistanceDiffusivity.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "patchWave.H"
|
||||
#include "labelHashSet.H"
|
||||
#include "surfaceInterpolate.H"
|
||||
#include "zeroGradientFvPatchFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(inverseDistanceDiffusivity, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
motionDiffusivity,
|
||||
inverseDistanceDiffusivity,
|
||||
Istream
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::inverseDistanceDiffusivity::inverseDistanceDiffusivity
|
||||
(
|
||||
const fvMotionSolver& mSolver,
|
||||
Istream& mdData
|
||||
)
|
||||
:
|
||||
uniformDiffusivity(mSolver, mdData),
|
||||
patchNames_(mdData)
|
||||
{
|
||||
correct();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::inverseDistanceDiffusivity::~inverseDistanceDiffusivity()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
Foam::tmp<Foam::scalarField> Foam::inverseDistanceDiffusivity::y() const
|
||||
{
|
||||
const polyMesh& mesh = mSolver().mesh();
|
||||
|
||||
labelHashSet patchSet(mesh.boundaryMesh().patchSet(patchNames_));
|
||||
|
||||
if (patchSet.size() > 0)
|
||||
{
|
||||
return tmp<scalarField>
|
||||
(
|
||||
new scalarField(patchWave(mesh, patchSet, false).distance())
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
return tmp<scalarField>(new scalarField(mesh.nCells(), 1.0));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::inverseDistanceDiffusivity::correct()
|
||||
{
|
||||
const fvMesh& mesh = mSolver().mesh();
|
||||
|
||||
volScalarField y_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"y",
|
||||
mesh.time().timeName(),
|
||||
mesh
|
||||
),
|
||||
mesh,
|
||||
dimless,
|
||||
zeroGradientFvPatchScalarField::typeName
|
||||
);
|
||||
y_.internalField() = y();
|
||||
y_.correctBoundaryConditions();
|
||||
|
||||
faceDiffusivity_ = 1.0/fvc::interpolate(y_);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,110 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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::inverseDistanceDiffusivity
|
||||
|
||||
Description
|
||||
Inverse distance to the given patches motion diffusivity.
|
||||
|
||||
SourceFiles
|
||||
inverseDistanceDiffusivity.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef inverseDistanceDiffusivity_H
|
||||
#define inverseDistanceDiffusivity_H
|
||||
|
||||
#include "uniformDiffusivity.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class inverseDistanceDiffusivity Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class inverseDistanceDiffusivity
|
||||
:
|
||||
public uniformDiffusivity
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Patches selected to base the distance on
|
||||
// These can contain regular expressions and the actuallt patch names
|
||||
// will be searched for.
|
||||
wordList patchNames_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Return patch-cell-centre distance field
|
||||
tmp<scalarField> y() const;
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
inverseDistanceDiffusivity(const inverseDistanceDiffusivity&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const inverseDistanceDiffusivity&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("inverseDistance");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct for the given fvMotionSolver and data Istream
|
||||
inverseDistanceDiffusivity
|
||||
(
|
||||
const fvMotionSolver& mSolver,
|
||||
Istream& mdData
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~inverseDistanceDiffusivity();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Correct the motion diffusivity
|
||||
virtual void correct();
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,160 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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 "inverseFaceDistanceDiffusivity.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "labelHashSet.H"
|
||||
#include "wallPoint.H"
|
||||
#include "MeshWave.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(inverseFaceDistanceDiffusivity, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
motionDiffusivity,
|
||||
inverseFaceDistanceDiffusivity,
|
||||
Istream
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::inverseFaceDistanceDiffusivity::inverseFaceDistanceDiffusivity
|
||||
(
|
||||
const fvMotionSolver& mSolver,
|
||||
Istream& mdData
|
||||
)
|
||||
:
|
||||
uniformDiffusivity(mSolver, mdData),
|
||||
patchNames_(mdData)
|
||||
{
|
||||
correct();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::inverseFaceDistanceDiffusivity::~inverseFaceDistanceDiffusivity()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::inverseFaceDistanceDiffusivity::correct()
|
||||
{
|
||||
const polyMesh& mesh = mSolver().mesh();
|
||||
const polyBoundaryMesh& bdry = mesh.boundaryMesh();
|
||||
|
||||
labelHashSet patchSet(bdry.size());
|
||||
|
||||
label nPatchFaces = 0;
|
||||
|
||||
forAll (patchNames_, i)
|
||||
{
|
||||
label pID = bdry.findPatchID(patchNames_[i]);
|
||||
|
||||
if (pID > -1)
|
||||
{
|
||||
patchSet.insert(pID);
|
||||
nPatchFaces += bdry[pID].size();
|
||||
}
|
||||
}
|
||||
|
||||
List<wallPoint> faceDist(nPatchFaces);
|
||||
labelList changedFaces(nPatchFaces);
|
||||
|
||||
nPatchFaces = 0;
|
||||
|
||||
forAllConstIter(labelHashSet, patchSet, iter)
|
||||
{
|
||||
const polyPatch& patch = bdry[iter.key()];
|
||||
|
||||
const vectorField::subField fc = patch.faceCentres();
|
||||
|
||||
forAll(fc, patchFaceI)
|
||||
{
|
||||
changedFaces[nPatchFaces] = patch.start() + patchFaceI;
|
||||
|
||||
faceDist[nPatchFaces] = wallPoint(fc[patchFaceI], 0);
|
||||
|
||||
nPatchFaces++;
|
||||
}
|
||||
}
|
||||
faceDist.setSize(nPatchFaces);
|
||||
changedFaces.setSize(nPatchFaces);
|
||||
|
||||
MeshWave<wallPoint> waveInfo
|
||||
(
|
||||
mesh,
|
||||
changedFaces,
|
||||
faceDist,
|
||||
mesh.globalData().nTotalCells() // max iterations
|
||||
);
|
||||
|
||||
const List<wallPoint>& faceInfo = waveInfo.allFaceInfo();
|
||||
const List<wallPoint>& cellInfo = waveInfo.allCellInfo();
|
||||
|
||||
for (label faceI=0; faceI<mesh.nInternalFaces(); faceI++)
|
||||
{
|
||||
scalar dist = faceInfo[faceI].distSqr();
|
||||
|
||||
faceDiffusivity_[faceI] = 1.0/sqrt(dist);
|
||||
}
|
||||
|
||||
forAll(faceDiffusivity_.boundaryField(), patchI)
|
||||
{
|
||||
fvsPatchScalarField& bfld = faceDiffusivity_.boundaryField()[patchI];
|
||||
|
||||
const unallocLabelList& faceCells = bfld.patch().faceCells();
|
||||
|
||||
if (patchSet.found(patchI))
|
||||
{
|
||||
forAll(bfld, i)
|
||||
{
|
||||
scalar dist = cellInfo[faceCells[i]].distSqr();
|
||||
bfld[i] = 1.0/sqrt(dist);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
label start = bfld.patch().patch().start();
|
||||
|
||||
forAll(bfld, i)
|
||||
{
|
||||
scalar dist = faceInfo[start+i].distSqr();
|
||||
bfld[i] = 1.0/sqrt(dist);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,105 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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::inverseFaceDistanceDiffusivity
|
||||
|
||||
Description
|
||||
Inverse distance to the given patches motion diffusivity.
|
||||
|
||||
SourceFiles
|
||||
inverseFaceDistanceDiffusivity.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef inverseFaceDistanceDiffusivity_H
|
||||
#define inverseFaceDistanceDiffusivity_H
|
||||
|
||||
#include "uniformDiffusivity.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class inverseFaceDistanceDiffusivity Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class inverseFaceDistanceDiffusivity
|
||||
:
|
||||
public uniformDiffusivity
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Patches selected to base the distance on
|
||||
wordList patchNames_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
inverseFaceDistanceDiffusivity(const inverseFaceDistanceDiffusivity&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const inverseFaceDistanceDiffusivity&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("inverseFaceDistance");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct for the given fvMotionSolver and data Istream
|
||||
inverseFaceDistanceDiffusivity
|
||||
(
|
||||
const fvMotionSolver& mSolver,
|
||||
Istream& mdData
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~inverseFaceDistanceDiffusivity();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Correct the motion diffusivity
|
||||
virtual void correct();
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,218 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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 "inversePointDistanceDiffusivity.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "labelHashSet.H"
|
||||
#include "pointEdgePoint.H"
|
||||
#include "PointEdgeWave.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(inversePointDistanceDiffusivity, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
motionDiffusivity,
|
||||
inversePointDistanceDiffusivity,
|
||||
Istream
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::inversePointDistanceDiffusivity::inversePointDistanceDiffusivity
|
||||
(
|
||||
const fvMotionSolver& mSolver,
|
||||
Istream& mdData
|
||||
)
|
||||
:
|
||||
uniformDiffusivity(mSolver, mdData),
|
||||
patchNames_(mdData)
|
||||
{
|
||||
correct();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::inversePointDistanceDiffusivity::~inversePointDistanceDiffusivity()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::inversePointDistanceDiffusivity::correct()
|
||||
{
|
||||
const polyMesh& mesh = mSolver().mesh();
|
||||
const polyBoundaryMesh& bdry = mesh.boundaryMesh();
|
||||
|
||||
// Construct point mesh
|
||||
const pointMesh pMesh(mesh);
|
||||
|
||||
labelHashSet patchSet(bdry.size());
|
||||
|
||||
label nPatchEdges = 0;
|
||||
|
||||
forAll (patchNames_, i)
|
||||
{
|
||||
label pID = bdry.findPatchID(patchNames_[i]);
|
||||
|
||||
if (pID > -1)
|
||||
{
|
||||
patchSet.insert(pID);
|
||||
nPatchEdges += bdry[pID].nEdges();
|
||||
}
|
||||
}
|
||||
|
||||
// Distance to wall on points and edges.
|
||||
List<pointEdgePoint> pointWallDist(mesh.nPoints());
|
||||
List<pointEdgePoint> edgeWallDist(mesh.nEdges());
|
||||
|
||||
{
|
||||
// Seeds
|
||||
List<pointEdgePoint> seedInfo(nPatchEdges);
|
||||
labelList seedPoints(nPatchEdges);
|
||||
|
||||
nPatchEdges = 0;
|
||||
|
||||
forAllConstIter(labelHashSet, patchSet, iter)
|
||||
{
|
||||
const polyPatch& patch = bdry[iter.key()];
|
||||
|
||||
const labelList& meshPoints = patch.meshPoints();
|
||||
|
||||
forAll(meshPoints, i)
|
||||
{
|
||||
label pointI = meshPoints[i];
|
||||
|
||||
if (!pointWallDist[pointI].valid())
|
||||
{
|
||||
// Not yet seeded
|
||||
seedInfo[nPatchEdges] = pointEdgePoint
|
||||
(
|
||||
mesh.points()[pointI],
|
||||
0.0
|
||||
);
|
||||
seedPoints[nPatchEdges] = pointI;
|
||||
pointWallDist[pointI] = seedInfo[nPatchEdges];
|
||||
|
||||
nPatchEdges++;
|
||||
}
|
||||
}
|
||||
}
|
||||
seedInfo.setSize(nPatchEdges);
|
||||
seedPoints.setSize(nPatchEdges);
|
||||
|
||||
// Do calculations
|
||||
PointEdgeWave<pointEdgePoint> waveInfo
|
||||
(
|
||||
pMesh,
|
||||
seedPoints,
|
||||
seedInfo,
|
||||
|
||||
pointWallDist,
|
||||
edgeWallDist,
|
||||
mesh.globalData().nTotalPoints() // max iterations
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
for (label faceI=0; faceI<mesh.nInternalFaces(); faceI++)
|
||||
{
|
||||
const face& f = mesh.faces()[faceI];
|
||||
|
||||
scalar dist = 0;
|
||||
|
||||
forAll(f, fp)
|
||||
{
|
||||
dist += sqrt(pointWallDist[f[fp]].distSqr());
|
||||
}
|
||||
dist /= f.size();
|
||||
|
||||
faceDiffusivity_[faceI] = 1.0/dist;
|
||||
}
|
||||
|
||||
forAll(faceDiffusivity_.boundaryField(), patchI)
|
||||
{
|
||||
fvsPatchScalarField& bfld = faceDiffusivity_.boundaryField()[patchI];
|
||||
|
||||
if (patchSet.found(patchI))
|
||||
{
|
||||
const unallocLabelList& faceCells = bfld.patch().faceCells();
|
||||
|
||||
forAll(bfld, i)
|
||||
{
|
||||
const cell& ownFaces = mesh.cells()[faceCells[i]];
|
||||
|
||||
labelHashSet cPoints(4*ownFaces.size());
|
||||
|
||||
scalar dist = 0;
|
||||
|
||||
forAll(ownFaces, ownFaceI)
|
||||
{
|
||||
const face& f = mesh.faces()[ownFaces[ownFaceI]];
|
||||
|
||||
forAll(f, fp)
|
||||
{
|
||||
if (cPoints.insert(f[fp]))
|
||||
{
|
||||
dist += sqrt(pointWallDist[f[fp]].distSqr());
|
||||
}
|
||||
}
|
||||
}
|
||||
dist /= cPoints.size();
|
||||
|
||||
bfld[i] = 1.0/dist;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
label start = bfld.patch().patch().start();
|
||||
|
||||
forAll(bfld, i)
|
||||
{
|
||||
const face& f = mesh.faces()[start+i];
|
||||
|
||||
scalar dist = 0;
|
||||
|
||||
forAll(f, fp)
|
||||
{
|
||||
dist += sqrt(pointWallDist[f[fp]].distSqr());
|
||||
}
|
||||
dist /= f.size();
|
||||
|
||||
bfld[i] = 1.0/dist;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,105 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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::inversePointDistanceDiffusivity
|
||||
|
||||
Description
|
||||
Inverse distance to the given patches motion diffusivity.
|
||||
|
||||
SourceFiles
|
||||
inversePointDistanceDiffusivity.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef inversePointDistanceDiffusivity_H
|
||||
#define inversePointDistanceDiffusivity_H
|
||||
|
||||
#include "uniformDiffusivity.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class inversePointDistanceDiffusivity Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class inversePointDistanceDiffusivity
|
||||
:
|
||||
public uniformDiffusivity
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Patches selected to base the distance on
|
||||
wordList patchNames_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
inversePointDistanceDiffusivity(const inversePointDistanceDiffusivity&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const inversePointDistanceDiffusivity&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("inversePointDistance");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct for the given fvMotionSolver and data Istream
|
||||
inversePointDistanceDiffusivity
|
||||
(
|
||||
const fvMotionSolver& mSolver,
|
||||
Istream& mdData
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~inversePointDistanceDiffusivity();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Correct the motion diffusivity
|
||||
virtual void correct();
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,95 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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 "inverseVolumeDiffusivity.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "patchWave.H"
|
||||
#include "labelHashSet.H"
|
||||
#include "surfaceInterpolate.H"
|
||||
#include "zeroGradientFvPatchFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(inverseVolumeDiffusivity, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
motionDiffusivity,
|
||||
inverseVolumeDiffusivity,
|
||||
Istream
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::inverseVolumeDiffusivity::inverseVolumeDiffusivity
|
||||
(
|
||||
const fvMotionSolver& mSolver,
|
||||
Istream& mdData
|
||||
)
|
||||
:
|
||||
uniformDiffusivity(mSolver, mdData)
|
||||
{
|
||||
correct();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::inverseVolumeDiffusivity::~inverseVolumeDiffusivity()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::inverseVolumeDiffusivity::correct()
|
||||
{
|
||||
const fvMesh& mesh = mSolver().mesh();
|
||||
|
||||
volScalarField V
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"V",
|
||||
mesh.time().timeName(),
|
||||
mesh
|
||||
),
|
||||
mesh,
|
||||
dimless,
|
||||
zeroGradientFvPatchScalarField::typeName
|
||||
);
|
||||
|
||||
V.internalField() = mesh.V();
|
||||
V.correctBoundaryConditions();
|
||||
|
||||
faceDiffusivity_ = 1.0/fvc::interpolate(V);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,99 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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::inverseVolumeDiffusivity
|
||||
|
||||
Description
|
||||
Inverse cell-volume motion diffusivity.
|
||||
|
||||
SourceFiles
|
||||
inverseVolumeDiffusivity.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef inverseVolumeDiffusivity_H
|
||||
#define inverseVolumeDiffusivity_H
|
||||
|
||||
#include "uniformDiffusivity.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class inverseVolumeDiffusivity Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class inverseVolumeDiffusivity
|
||||
:
|
||||
public uniformDiffusivity
|
||||
{
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
inverseVolumeDiffusivity(const inverseVolumeDiffusivity&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const inverseVolumeDiffusivity&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("inverseVolume");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct for the given fvMotionSolver and data Istream
|
||||
inverseVolumeDiffusivity
|
||||
(
|
||||
const fvMotionSolver& mSolver,
|
||||
Istream& mdData
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~inverseVolumeDiffusivity();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Correct the motion diffusivity
|
||||
virtual void correct();
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,81 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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 "exponentialDiffusivity.H"
|
||||
#include "surfaceFields.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(exponentialDiffusivity, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
motionDiffusivity,
|
||||
exponentialDiffusivity,
|
||||
Istream
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::exponentialDiffusivity::exponentialDiffusivity
|
||||
(
|
||||
const fvMotionSolver& mSolver,
|
||||
Istream& mdData
|
||||
)
|
||||
:
|
||||
motionDiffusivity(mSolver),
|
||||
alpha_(readScalar(mdData)),
|
||||
basicDiffusivityPtr_(motionDiffusivity::New(mSolver, mdData))
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::exponentialDiffusivity::~exponentialDiffusivity()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
Foam::tmp<Foam::surfaceScalarField>
|
||||
Foam::exponentialDiffusivity::operator()() const
|
||||
{
|
||||
return exp(-alpha_/basicDiffusivityPtr_->operator()());
|
||||
}
|
||||
|
||||
|
||||
void Foam::exponentialDiffusivity::correct()
|
||||
{
|
||||
basicDiffusivityPtr_->correct();
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,109 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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::exponentialDiffusivity
|
||||
|
||||
Description
|
||||
Mesh motion diffusivity maipulator which returns the exp(-alpha/D)
|
||||
of the given diffusivity D.
|
||||
|
||||
SourceFiles
|
||||
exponentialDiffusivity.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef exponentialDiffusivity_H
|
||||
#define exponentialDiffusivity_H
|
||||
|
||||
#include "motionDiffusivity.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class exponentialDiffusivity Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class exponentialDiffusivity
|
||||
:
|
||||
public motionDiffusivity
|
||||
{
|
||||
// Private data
|
||||
|
||||
scalar alpha_;
|
||||
autoPtr<motionDiffusivity> basicDiffusivityPtr_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
exponentialDiffusivity(const exponentialDiffusivity&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const exponentialDiffusivity&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("exponential");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct for the given fvMotionSolver and data Istream
|
||||
exponentialDiffusivity
|
||||
(
|
||||
const fvMotionSolver& mSolver,
|
||||
Istream& mdData
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~exponentialDiffusivity();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return diffusivity field
|
||||
virtual tmp<surfaceScalarField> operator()() const;
|
||||
|
||||
//- Correct the motion diffusivity
|
||||
virtual void correct();
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,80 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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 "quadraticDiffusivity.H"
|
||||
#include "surfaceFields.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(quadraticDiffusivity, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
motionDiffusivity,
|
||||
quadraticDiffusivity,
|
||||
Istream
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::quadraticDiffusivity::quadraticDiffusivity
|
||||
(
|
||||
const fvMotionSolver& mSolver,
|
||||
Istream& mdData
|
||||
)
|
||||
:
|
||||
motionDiffusivity(mSolver),
|
||||
basicDiffusivityPtr_(motionDiffusivity::New(mSolver, mdData))
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::quadraticDiffusivity::~quadraticDiffusivity()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
Foam::tmp<Foam::surfaceScalarField>
|
||||
Foam::quadraticDiffusivity::operator()() const
|
||||
{
|
||||
return sqr(basicDiffusivityPtr_->operator()());
|
||||
}
|
||||
|
||||
|
||||
void Foam::quadraticDiffusivity::correct()
|
||||
{
|
||||
basicDiffusivityPtr_->correct();
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,108 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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::quadraticDiffusivity
|
||||
|
||||
Description
|
||||
Mesh motion diffusivity maipulator which returns the sqr of the given
|
||||
diffusivity.
|
||||
|
||||
SourceFiles
|
||||
quadraticDiffusivity.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef quadraticDiffusivity_H
|
||||
#define quadraticDiffusivity_H
|
||||
|
||||
#include "motionDiffusivity.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class quadraticDiffusivity Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class quadraticDiffusivity
|
||||
:
|
||||
public motionDiffusivity
|
||||
{
|
||||
// Private data
|
||||
|
||||
autoPtr<motionDiffusivity> basicDiffusivityPtr_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
quadraticDiffusivity(const quadraticDiffusivity&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const quadraticDiffusivity&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("quadratic");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct for the given fvMotionSolver and data Istream
|
||||
quadraticDiffusivity
|
||||
(
|
||||
const fvMotionSolver& mSolver,
|
||||
Istream& mdData
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~quadraticDiffusivity();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return diffusivity field
|
||||
virtual tmp<surfaceScalarField> operator()() const;
|
||||
|
||||
//- Correct the motion diffusivity
|
||||
virtual void correct();
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,85 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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 "motionDiffusivity.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(motionDiffusivity, 0);
|
||||
|
||||
defineRunTimeSelectionTable(motionDiffusivity, Istream);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::motionDiffusivity::motionDiffusivity(const fvMotionSolver& mSolver)
|
||||
:
|
||||
mSolver_(mSolver)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::autoPtr<Foam::motionDiffusivity> Foam::motionDiffusivity::New
|
||||
(
|
||||
const fvMotionSolver& mSolver,
|
||||
Istream& mdData
|
||||
)
|
||||
{
|
||||
word diffTypeName(mdData);
|
||||
|
||||
Info << "Selecting motion diffusion: " << diffTypeName << endl;
|
||||
|
||||
IstreamConstructorTable::iterator cstrIter =
|
||||
IstreamConstructorTablePtr_->find(diffTypeName);
|
||||
|
||||
if (cstrIter == IstreamConstructorTablePtr_->end())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"motionDiffusivity::New(const tetPolyMesh& tetMesh, "
|
||||
"const Istream& dict)"
|
||||
) << "Unknown diffusion type " << diffTypeName
|
||||
<< endl << endl
|
||||
<< "Valid diffusion types are :" << endl
|
||||
<< IstreamConstructorTablePtr_->toc()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return autoPtr<motionDiffusivity>(cstrIter()(mSolver, mdData));
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::motionDiffusivity::~motionDiffusivity()
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,124 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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::motionDiffusivity
|
||||
|
||||
Description
|
||||
Abstract base class for cell-centre mesh motion diffusivity.
|
||||
|
||||
SourceFiles
|
||||
motionDiffusivity.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef motionDiffusivity_H
|
||||
#define motionDiffusivity_H
|
||||
|
||||
#include "fvMotionSolver.H"
|
||||
#include "surfaceFieldsFwd.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class motionDiffusivity Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class motionDiffusivity
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Motion solver reference
|
||||
const fvMotionSolver& mSolver_;
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("motionDiffusivity");
|
||||
|
||||
|
||||
// Declare run-time constructor selection tables
|
||||
|
||||
declareRunTimeSelectionTable
|
||||
(
|
||||
autoPtr,
|
||||
motionDiffusivity,
|
||||
Istream,
|
||||
(
|
||||
const fvMotionSolver& mSolver,
|
||||
Istream& mdData
|
||||
),
|
||||
(mSolver, mdData)
|
||||
);
|
||||
|
||||
|
||||
// Selectors
|
||||
|
||||
//- Select null constructed
|
||||
static autoPtr<motionDiffusivity> New
|
||||
(
|
||||
const fvMotionSolver& mSolver,
|
||||
Istream& mdData
|
||||
);
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct for the given fvMotionSolver
|
||||
motionDiffusivity(const fvMotionSolver& mSolver);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~motionDiffusivity();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return reference to the motion solver
|
||||
const fvMotionSolver& mSolver() const
|
||||
{
|
||||
return mSolver_;
|
||||
}
|
||||
|
||||
//- Return diffusivity field
|
||||
virtual tmp<surfaceScalarField> operator()() const = 0;
|
||||
|
||||
//- Correct the motion diffusivity
|
||||
virtual void correct() = 0;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,106 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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 "motionDirectionalDiffusivity.H"
|
||||
#include "surfaceInterpolate.H"
|
||||
#include "zeroGradientFvPatchFields.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(motionDirectionalDiffusivity, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
motionDiffusivity,
|
||||
motionDirectionalDiffusivity,
|
||||
Istream
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::motionDirectionalDiffusivity::motionDirectionalDiffusivity
|
||||
(
|
||||
const fvMotionSolver& mSolver,
|
||||
Istream& mdData
|
||||
)
|
||||
:
|
||||
uniformDiffusivity(mSolver, mdData),
|
||||
diffusivityVector_(mdData)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::motionDirectionalDiffusivity::~motionDirectionalDiffusivity()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::motionDirectionalDiffusivity::correct()
|
||||
{
|
||||
const fvMesh& mesh = mSolver().mesh();
|
||||
|
||||
static bool first = true;
|
||||
|
||||
if (!first)
|
||||
{
|
||||
const volVectorField& cellMotionU =
|
||||
mesh.lookupObject<volVectorField>("cellMotionU");
|
||||
|
||||
volVectorField D
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"D",
|
||||
mesh.time().timeName(),
|
||||
mesh
|
||||
),
|
||||
diffusivityVector_.y()*vector::one
|
||||
+ (diffusivityVector_.x() - diffusivityVector_.y())*cellMotionU
|
||||
/(mag(cellMotionU) + dimensionedScalar("small", dimVelocity, SMALL)),
|
||||
zeroGradientFvPatchVectorField::typeName
|
||||
);
|
||||
D.correctBoundaryConditions();
|
||||
|
||||
surfaceVectorField n = mesh.Sf()/mesh.magSf();
|
||||
faceDiffusivity_ == (n & cmptMultiply(fvc::interpolate(D), n));
|
||||
}
|
||||
else
|
||||
{
|
||||
first = false;
|
||||
const_cast<fvMotionSolver&>(mSolver()).solve();
|
||||
correct();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,104 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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::motionDirectionalDiffusivity
|
||||
|
||||
Description
|
||||
MotionDirectional finite volume mesh motion diffusivity.
|
||||
|
||||
SourceFiles
|
||||
motionDirectionalDiffusivity.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef motionDirectionalDiffusivity_H
|
||||
#define motionDirectionalDiffusivity_H
|
||||
|
||||
#include "uniformDiffusivity.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class motionDirectionalDiffusivity Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class motionDirectionalDiffusivity
|
||||
:
|
||||
public uniformDiffusivity
|
||||
{
|
||||
// Private data
|
||||
|
||||
vector diffusivityVector_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
motionDirectionalDiffusivity(const motionDirectionalDiffusivity&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const motionDirectionalDiffusivity&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("motionDirectional");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct for the given fvMotionSolver and data Istream
|
||||
motionDirectionalDiffusivity
|
||||
(
|
||||
const fvMotionSolver& mSolver,
|
||||
Istream& mdData
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~motionDirectionalDiffusivity();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Correct the motion diffusivity
|
||||
virtual void correct();
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,76 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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 "uniformDiffusivity.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(uniformDiffusivity, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
motionDiffusivity,
|
||||
uniformDiffusivity,
|
||||
Istream
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::uniformDiffusivity::uniformDiffusivity
|
||||
(
|
||||
const fvMotionSolver& mSolver,
|
||||
Istream&
|
||||
)
|
||||
:
|
||||
motionDiffusivity(mSolver),
|
||||
faceDiffusivity_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"faceDiffusivity",
|
||||
mSolver.mesh().time().timeName(),
|
||||
mSolver.mesh(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mSolver.mesh(),
|
||||
dimensionedScalar("1.0", dimless, 1.0)
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::uniformDiffusivity::~uniformDiffusivity()
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,117 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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::uniformDiffusivity
|
||||
|
||||
Description
|
||||
Uniform uniform finite volume mesh motion diffusivity.
|
||||
|
||||
SourceFiles
|
||||
uniformDiffusivity.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef uniformDiffusivity_H
|
||||
#define uniformDiffusivity_H
|
||||
|
||||
#include "motionDiffusivity.H"
|
||||
#include "surfaceFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class uniformDiffusivity Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class uniformDiffusivity
|
||||
:
|
||||
public motionDiffusivity
|
||||
{
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
surfaceScalarField faceDiffusivity_;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
uniformDiffusivity(const uniformDiffusivity&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const uniformDiffusivity&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("uniform");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct for the given fvMotionSolver and data Istream
|
||||
uniformDiffusivity
|
||||
(
|
||||
const fvMotionSolver& mSolver,
|
||||
Istream& mdData
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~uniformDiffusivity();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return diffusivity field
|
||||
virtual tmp<surfaceScalarField> operator()() const
|
||||
{
|
||||
return faceDiffusivity_;
|
||||
}
|
||||
|
||||
//- Do not correct the motion diffusivity
|
||||
virtual void correct()
|
||||
{}
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,184 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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 "angularOscillatingDisplacementPointPatchVectorField.H"
|
||||
#include "pointPatchFields.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "Time.H"
|
||||
#include "polyMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
angularOscillatingDisplacementPointPatchVectorField::
|
||||
angularOscillatingDisplacementPointPatchVectorField
|
||||
(
|
||||
const pointPatch& p,
|
||||
const DimensionedField<vector, pointMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValuePointPatchField<vector>(p, iF),
|
||||
axis_(vector::zero),
|
||||
origin_(vector::zero),
|
||||
angle0_(0.0),
|
||||
amplitude_(0.0),
|
||||
omega_(0.0),
|
||||
p0_(p.localPoints())
|
||||
{}
|
||||
|
||||
|
||||
angularOscillatingDisplacementPointPatchVectorField::
|
||||
angularOscillatingDisplacementPointPatchVectorField
|
||||
(
|
||||
const pointPatch& p,
|
||||
const DimensionedField<vector, pointMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fixedValuePointPatchField<vector>(p, iF, dict),
|
||||
axis_(dict.lookup("axis")),
|
||||
origin_(dict.lookup("origin")),
|
||||
angle0_(readScalar(dict.lookup("angle0"))),
|
||||
amplitude_(readScalar(dict.lookup("amplitude"))),
|
||||
omega_(readScalar(dict.lookup("omega")))
|
||||
{
|
||||
if (!dict.found("value"))
|
||||
{
|
||||
updateCoeffs();
|
||||
}
|
||||
|
||||
if (dict.found("p0"))
|
||||
{
|
||||
p0_ = vectorField("p0", dict , p.size());
|
||||
}
|
||||
else
|
||||
{
|
||||
p0_ = p.localPoints();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
angularOscillatingDisplacementPointPatchVectorField::
|
||||
angularOscillatingDisplacementPointPatchVectorField
|
||||
(
|
||||
const angularOscillatingDisplacementPointPatchVectorField& ptf,
|
||||
const pointPatch& p,
|
||||
const DimensionedField<vector, pointMesh>& iF,
|
||||
const pointPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
fixedValuePointPatchField<vector>(ptf, p, iF, mapper),
|
||||
axis_(ptf.axis_),
|
||||
origin_(ptf.origin_),
|
||||
angle0_(ptf.angle0_),
|
||||
amplitude_(ptf.amplitude_),
|
||||
omega_(ptf.omega_),
|
||||
p0_(ptf.p0_)
|
||||
{}
|
||||
|
||||
|
||||
angularOscillatingDisplacementPointPatchVectorField::
|
||||
angularOscillatingDisplacementPointPatchVectorField
|
||||
(
|
||||
const angularOscillatingDisplacementPointPatchVectorField& ptf,
|
||||
const DimensionedField<vector, pointMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValuePointPatchField<vector>(ptf, iF),
|
||||
axis_(ptf.axis_),
|
||||
origin_(ptf.origin_),
|
||||
angle0_(ptf.angle0_),
|
||||
amplitude_(ptf.amplitude_),
|
||||
omega_(ptf.omega_),
|
||||
p0_(ptf.p0_)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void angularOscillatingDisplacementPointPatchVectorField::updateCoeffs()
|
||||
{
|
||||
if (this->updated())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const polyMesh& mesh = this->dimensionedInternalField().mesh()();
|
||||
const Time& t = mesh.time();
|
||||
|
||||
scalar angle = angle0_ + amplitude_*sin(omega_*t.value());
|
||||
vector axisHat = axis_/mag(axis_);
|
||||
vectorField p0Rel = p0_ - origin_;
|
||||
|
||||
vectorField::operator=
|
||||
(
|
||||
p0Rel*(cos(angle) - 1)
|
||||
+ (axisHat ^ p0Rel*sin(angle))
|
||||
+ (axisHat & p0Rel)*(1 - cos(angle))*axisHat
|
||||
);
|
||||
|
||||
fixedValuePointPatchField<vector>::updateCoeffs();
|
||||
}
|
||||
|
||||
|
||||
void angularOscillatingDisplacementPointPatchVectorField::write
|
||||
(
|
||||
Ostream& os
|
||||
) const
|
||||
{
|
||||
pointPatchField<vector>::write(os);
|
||||
os.writeKeyword("axis")
|
||||
<< axis_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("origin")
|
||||
<< origin_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("angle0")
|
||||
<< angle0_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("amplitude")
|
||||
<< amplitude_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("omega")
|
||||
<< omega_ << token::END_STATEMENT << nl;
|
||||
p0_.writeEntry("p0", os);
|
||||
writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
makePointPatchTypeField
|
||||
(
|
||||
pointPatchVectorField,
|
||||
angularOscillatingDisplacementPointPatchVectorField
|
||||
);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,154 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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::angularOscillatingDisplacementPointPatchVectorField
|
||||
|
||||
Description
|
||||
Foam::angularOscillatingDisplacementPointPatchVectorField
|
||||
|
||||
SourceFiles
|
||||
angularOscillatingDisplacementPointPatchVectorField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef angularOscillatingDisplacementPointPatchVectorField_H
|
||||
#define angularOscillatingDisplacementPointPatchVectorField_H
|
||||
|
||||
#include "fixedValuePointPatchField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class angularOscillatingDisplacementPointPatchVectorField Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class angularOscillatingDisplacementPointPatchVectorField
|
||||
:
|
||||
public fixedValuePointPatchField<vector>
|
||||
{
|
||||
// Private data
|
||||
|
||||
vector axis_;
|
||||
vector origin_;
|
||||
scalar angle0_;
|
||||
scalar amplitude_;
|
||||
scalar omega_;
|
||||
|
||||
pointField p0_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("angularOscillatingDisplacement");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
angularOscillatingDisplacementPointPatchVectorField
|
||||
(
|
||||
const pointPatch&,
|
||||
const DimensionedField<vector, pointMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
angularOscillatingDisplacementPointPatchVectorField
|
||||
(
|
||||
const pointPatch&,
|
||||
const DimensionedField<vector, pointMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given patchField<vector> onto a new patch
|
||||
angularOscillatingDisplacementPointPatchVectorField
|
||||
(
|
||||
const angularOscillatingDisplacementPointPatchVectorField&,
|
||||
const pointPatch&,
|
||||
const DimensionedField<vector, pointMesh>&,
|
||||
const pointPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual autoPtr<pointPatchField<vector> > clone() const
|
||||
{
|
||||
return autoPtr<pointPatchField<vector> >
|
||||
(
|
||||
new angularOscillatingDisplacementPointPatchVectorField
|
||||
(
|
||||
*this
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
angularOscillatingDisplacementPointPatchVectorField
|
||||
(
|
||||
const angularOscillatingDisplacementPointPatchVectorField&,
|
||||
const DimensionedField<vector, pointMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual autoPtr<pointPatchField<vector> > clone
|
||||
(
|
||||
const DimensionedField<vector, pointMesh>& iF
|
||||
) const
|
||||
{
|
||||
return autoPtr<pointPatchField<vector> >
|
||||
(
|
||||
new angularOscillatingDisplacementPointPatchVectorField
|
||||
(
|
||||
*this,
|
||||
iF
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
// Evaluation functions
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
virtual void updateCoeffs();
|
||||
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,189 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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 "angularOscillatingVelocityPointPatchVectorField.H"
|
||||
#include "pointPatchFields.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "Time.H"
|
||||
#include "polyMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
angularOscillatingVelocityPointPatchVectorField::
|
||||
angularOscillatingVelocityPointPatchVectorField
|
||||
(
|
||||
const pointPatch& p,
|
||||
const DimensionedField<vector, pointMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValuePointPatchField<vector>(p, iF),
|
||||
axis_(vector::zero),
|
||||
origin_(vector::zero),
|
||||
angle0_(0.0),
|
||||
amplitude_(0.0),
|
||||
omega_(0.0),
|
||||
p0_(p.localPoints())
|
||||
{}
|
||||
|
||||
|
||||
angularOscillatingVelocityPointPatchVectorField::
|
||||
angularOscillatingVelocityPointPatchVectorField
|
||||
(
|
||||
const pointPatch& p,
|
||||
const DimensionedField<vector, pointMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fixedValuePointPatchField<vector>(p, iF, dict),
|
||||
axis_(dict.lookup("axis")),
|
||||
origin_(dict.lookup("origin")),
|
||||
angle0_(readScalar(dict.lookup("angle0"))),
|
||||
amplitude_(readScalar(dict.lookup("amplitude"))),
|
||||
omega_(readScalar(dict.lookup("omega")))
|
||||
{
|
||||
if (!dict.found("value"))
|
||||
{
|
||||
updateCoeffs();
|
||||
}
|
||||
|
||||
if (dict.found("p0"))
|
||||
{
|
||||
p0_ = vectorField("p0", dict , p.size());
|
||||
}
|
||||
else
|
||||
{
|
||||
p0_ = p.localPoints();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
angularOscillatingVelocityPointPatchVectorField::
|
||||
angularOscillatingVelocityPointPatchVectorField
|
||||
(
|
||||
const angularOscillatingVelocityPointPatchVectorField& ptf,
|
||||
const pointPatch& p,
|
||||
const DimensionedField<vector, pointMesh>& iF,
|
||||
const pointPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
fixedValuePointPatchField<vector>(ptf, p, iF, mapper),
|
||||
axis_(ptf.axis_),
|
||||
origin_(ptf.origin_),
|
||||
angle0_(ptf.angle0_),
|
||||
amplitude_(ptf.amplitude_),
|
||||
omega_(ptf.omega_),
|
||||
p0_(ptf.p0_)
|
||||
{}
|
||||
|
||||
|
||||
angularOscillatingVelocityPointPatchVectorField::
|
||||
angularOscillatingVelocityPointPatchVectorField
|
||||
(
|
||||
const angularOscillatingVelocityPointPatchVectorField& ptf,
|
||||
const DimensionedField<vector, pointMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValuePointPatchField<vector>(ptf, iF),
|
||||
axis_(ptf.axis_),
|
||||
origin_(ptf.origin_),
|
||||
angle0_(ptf.angle0_),
|
||||
amplitude_(ptf.amplitude_),
|
||||
omega_(ptf.omega_),
|
||||
p0_(ptf.p0_)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void angularOscillatingVelocityPointPatchVectorField::updateCoeffs()
|
||||
{
|
||||
if (this->updated())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const polyMesh& mesh = this->dimensionedInternalField().mesh()();
|
||||
const Time& t = mesh.time();
|
||||
const pointPatch& p = this->patch();
|
||||
|
||||
scalar angle = angle0_ + amplitude_*sin(omega_*t.value());
|
||||
vector axisHat = axis_/mag(axis_);
|
||||
vectorField p0Rel = p0_ - origin_;
|
||||
|
||||
vectorField::operator=
|
||||
(
|
||||
(
|
||||
p0_
|
||||
+ p0Rel*(cos(angle) - 1)
|
||||
+ (axisHat ^ p0Rel*sin(angle))
|
||||
+ (axisHat & p0Rel)*(1 - cos(angle))*axisHat
|
||||
- p.localPoints()
|
||||
)/t.deltaT().value()
|
||||
);
|
||||
|
||||
fixedValuePointPatchField<vector>::updateCoeffs();
|
||||
}
|
||||
|
||||
|
||||
void angularOscillatingVelocityPointPatchVectorField::write
|
||||
(
|
||||
Ostream& os
|
||||
) const
|
||||
{
|
||||
pointPatchField<vector>::write(os);
|
||||
os.writeKeyword("axis")
|
||||
<< axis_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("origin")
|
||||
<< origin_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("angle0")
|
||||
<< angle0_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("amplitude")
|
||||
<< amplitude_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("omega")
|
||||
<< omega_ << token::END_STATEMENT << nl;
|
||||
p0_.writeEntry("p0", os);
|
||||
writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
makePointPatchTypeField
|
||||
(
|
||||
pointPatchVectorField,
|
||||
angularOscillatingVelocityPointPatchVectorField
|
||||
);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,154 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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::angularOscillatingVelocityPointPatchVectorField
|
||||
|
||||
Description
|
||||
Foam::angularOscillatingVelocityPointPatchVectorField
|
||||
|
||||
SourceFiles
|
||||
angularOscillatingVelocityPointPatchVectorField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef angularOscillatingVelocityPointPatchVectorField_H
|
||||
#define angularOscillatingVelocityPointPatchVectorField_H
|
||||
|
||||
#include "fixedValuePointPatchField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class angularOscillatingVelocityPointPatchVectorField Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class angularOscillatingVelocityPointPatchVectorField
|
||||
:
|
||||
public fixedValuePointPatchField<vector>
|
||||
{
|
||||
// Private data
|
||||
|
||||
vector axis_;
|
||||
vector origin_;
|
||||
scalar angle0_;
|
||||
scalar amplitude_;
|
||||
scalar omega_;
|
||||
|
||||
pointField p0_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("angularOscillatingVelocity");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
angularOscillatingVelocityPointPatchVectorField
|
||||
(
|
||||
const pointPatch&,
|
||||
const DimensionedField<vector, pointMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
angularOscillatingVelocityPointPatchVectorField
|
||||
(
|
||||
const pointPatch&,
|
||||
const DimensionedField<vector, pointMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given patchField<vector> onto a new patch
|
||||
angularOscillatingVelocityPointPatchVectorField
|
||||
(
|
||||
const angularOscillatingVelocityPointPatchVectorField&,
|
||||
const pointPatch&,
|
||||
const DimensionedField<vector, pointMesh>&,
|
||||
const pointPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual autoPtr<pointPatchField<vector> > clone() const
|
||||
{
|
||||
return autoPtr<pointPatchField<vector> >
|
||||
(
|
||||
new angularOscillatingVelocityPointPatchVectorField
|
||||
(
|
||||
*this
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
angularOscillatingVelocityPointPatchVectorField
|
||||
(
|
||||
const angularOscillatingVelocityPointPatchVectorField&,
|
||||
const DimensionedField<vector, pointMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual autoPtr<pointPatchField<vector> > clone
|
||||
(
|
||||
const DimensionedField<vector, pointMesh>& iF
|
||||
) const
|
||||
{
|
||||
return autoPtr<pointPatchField<vector> >
|
||||
(
|
||||
new angularOscillatingVelocityPointPatchVectorField
|
||||
(
|
||||
*this,
|
||||
iF
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
// Evaluation functions
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
virtual void updateCoeffs();
|
||||
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,141 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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 "oscillatingDisplacementPointPatchVectorField.H"
|
||||
#include "pointPatchFields.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "Time.H"
|
||||
#include "polyMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
oscillatingDisplacementPointPatchVectorField::
|
||||
oscillatingDisplacementPointPatchVectorField
|
||||
(
|
||||
const pointPatch& p,
|
||||
const DimensionedField<vector, pointMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValuePointPatchField<vector>(p, iF),
|
||||
amplitude_(vector::zero),
|
||||
omega_(0.0)
|
||||
{}
|
||||
|
||||
|
||||
oscillatingDisplacementPointPatchVectorField::
|
||||
oscillatingDisplacementPointPatchVectorField
|
||||
(
|
||||
const pointPatch& p,
|
||||
const DimensionedField<vector, pointMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fixedValuePointPatchField<vector>(p, iF, dict),
|
||||
amplitude_(dict.lookup("amplitude")),
|
||||
omega_(readScalar(dict.lookup("omega")))
|
||||
{
|
||||
if (!dict.found("value"))
|
||||
{
|
||||
updateCoeffs();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
oscillatingDisplacementPointPatchVectorField::
|
||||
oscillatingDisplacementPointPatchVectorField
|
||||
(
|
||||
const oscillatingDisplacementPointPatchVectorField& ptf,
|
||||
const pointPatch& p,
|
||||
const DimensionedField<vector, pointMesh>& iF,
|
||||
const pointPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
fixedValuePointPatchField<vector>(ptf, p, iF, mapper),
|
||||
amplitude_(ptf.amplitude_),
|
||||
omega_(ptf.omega_)
|
||||
{}
|
||||
|
||||
|
||||
oscillatingDisplacementPointPatchVectorField::
|
||||
oscillatingDisplacementPointPatchVectorField
|
||||
(
|
||||
const oscillatingDisplacementPointPatchVectorField& ptf,
|
||||
const DimensionedField<vector, pointMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValuePointPatchField<vector>(ptf, iF),
|
||||
amplitude_(ptf.amplitude_),
|
||||
omega_(ptf.omega_)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void oscillatingDisplacementPointPatchVectorField::updateCoeffs()
|
||||
{
|
||||
if (this->updated())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const polyMesh& mesh = this->dimensionedInternalField().mesh()();
|
||||
const Time& t = mesh.time();
|
||||
|
||||
Field<vector>::operator=(amplitude_*sin(omega_*t.value()));
|
||||
|
||||
fixedValuePointPatchField<vector>::updateCoeffs();
|
||||
}
|
||||
|
||||
|
||||
void oscillatingDisplacementPointPatchVectorField::write(Ostream& os) const
|
||||
{
|
||||
pointPatchField<vector>::write(os);
|
||||
os.writeKeyword("amplitude")
|
||||
<< amplitude_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("omega")
|
||||
<< omega_ << token::END_STATEMENT << nl;
|
||||
writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
makePointPatchTypeField
|
||||
(
|
||||
pointPatchVectorField,
|
||||
oscillatingDisplacementPointPatchVectorField
|
||||
);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,149 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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::oscillatingDisplacementPointPatchVectorField
|
||||
|
||||
Description
|
||||
Foam::oscillatingDisplacementPointPatchVectorField
|
||||
|
||||
SourceFiles
|
||||
oscillatingDisplacementPointPatchVectorField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef oscillatingDisplacementPointPatchVectorField_H
|
||||
#define oscillatingDisplacementPointPatchVectorField_H
|
||||
|
||||
#include "fixedValuePointPatchField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class oscillatingDisplacementPointPatchVectorField Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class oscillatingDisplacementPointPatchVectorField
|
||||
:
|
||||
public fixedValuePointPatchField<vector>
|
||||
{
|
||||
// Private data
|
||||
|
||||
vector amplitude_;
|
||||
scalar omega_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("oscillatingDisplacement");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
oscillatingDisplacementPointPatchVectorField
|
||||
(
|
||||
const pointPatch&,
|
||||
const DimensionedField<vector, pointMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
oscillatingDisplacementPointPatchVectorField
|
||||
(
|
||||
const pointPatch&,
|
||||
const DimensionedField<vector, pointMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given patchField<vector> onto a new patch
|
||||
oscillatingDisplacementPointPatchVectorField
|
||||
(
|
||||
const oscillatingDisplacementPointPatchVectorField&,
|
||||
const pointPatch&,
|
||||
const DimensionedField<vector, pointMesh>&,
|
||||
const pointPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual autoPtr<pointPatchField<vector> > clone() const
|
||||
{
|
||||
return autoPtr<pointPatchField<vector> >
|
||||
(
|
||||
new oscillatingDisplacementPointPatchVectorField
|
||||
(
|
||||
*this
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
oscillatingDisplacementPointPatchVectorField
|
||||
(
|
||||
const oscillatingDisplacementPointPatchVectorField&,
|
||||
const DimensionedField<vector, pointMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual autoPtr<pointPatchField<vector> > clone
|
||||
(
|
||||
const DimensionedField<vector, pointMesh>& iF
|
||||
) const
|
||||
{
|
||||
return autoPtr<pointPatchField<vector> >
|
||||
(
|
||||
new oscillatingDisplacementPointPatchVectorField
|
||||
(
|
||||
*this,
|
||||
iF
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
// Evaluation functions
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
virtual void updateCoeffs();
|
||||
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,159 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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 "oscillatingVelocityPointPatchVectorField.H"
|
||||
#include "pointPatchFields.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "Time.H"
|
||||
#include "polyMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
oscillatingVelocityPointPatchVectorField::
|
||||
oscillatingVelocityPointPatchVectorField
|
||||
(
|
||||
const pointPatch& p,
|
||||
const DimensionedField<vector, pointMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValuePointPatchField<vector>(p, iF),
|
||||
amplitude_(vector::zero),
|
||||
omega_(0.0),
|
||||
p0_(p.localPoints())
|
||||
{}
|
||||
|
||||
|
||||
oscillatingVelocityPointPatchVectorField::
|
||||
oscillatingVelocityPointPatchVectorField
|
||||
(
|
||||
const pointPatch& p,
|
||||
const DimensionedField<vector, pointMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fixedValuePointPatchField<vector>(p, iF, dict),
|
||||
amplitude_(dict.lookup("amplitude")),
|
||||
omega_(readScalar(dict.lookup("omega")))
|
||||
{
|
||||
if (!dict.found("value"))
|
||||
{
|
||||
updateCoeffs();
|
||||
}
|
||||
|
||||
if (dict.found("p0"))
|
||||
{
|
||||
p0_ = vectorField("p0", dict , p.size());
|
||||
}
|
||||
else
|
||||
{
|
||||
p0_ = p.localPoints();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
oscillatingVelocityPointPatchVectorField::
|
||||
oscillatingVelocityPointPatchVectorField
|
||||
(
|
||||
const oscillatingVelocityPointPatchVectorField& ptf,
|
||||
const pointPatch& p,
|
||||
const DimensionedField<vector, pointMesh>& iF,
|
||||
const pointPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
fixedValuePointPatchField<vector>(ptf, p, iF, mapper),
|
||||
amplitude_(ptf.amplitude_),
|
||||
omega_(ptf.omega_),
|
||||
p0_(ptf.p0_)
|
||||
{}
|
||||
|
||||
|
||||
oscillatingVelocityPointPatchVectorField::
|
||||
oscillatingVelocityPointPatchVectorField
|
||||
(
|
||||
const oscillatingVelocityPointPatchVectorField& ptf,
|
||||
const DimensionedField<vector, pointMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValuePointPatchField<vector>(ptf, iF),
|
||||
amplitude_(ptf.amplitude_),
|
||||
omega_(ptf.omega_),
|
||||
p0_(ptf.p0_)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void oscillatingVelocityPointPatchVectorField::updateCoeffs()
|
||||
{
|
||||
if (this->updated())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const polyMesh& mesh = this->dimensionedInternalField().mesh()();
|
||||
const Time& t = mesh.time();
|
||||
const pointPatch& p = this->patch();
|
||||
|
||||
Field<vector>::operator=
|
||||
(
|
||||
(p0_ + amplitude_*sin(omega_*t.value()) - p.localPoints())
|
||||
/t.deltaT().value()
|
||||
);
|
||||
|
||||
fixedValuePointPatchField<vector>::updateCoeffs();
|
||||
}
|
||||
|
||||
|
||||
void oscillatingVelocityPointPatchVectorField::write(Ostream& os) const
|
||||
{
|
||||
pointPatchField<vector>::write(os);
|
||||
os.writeKeyword("amplitude")
|
||||
<< amplitude_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("omega")
|
||||
<< omega_ << token::END_STATEMENT << nl;
|
||||
p0_.writeEntry("p0", os);
|
||||
writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
makePointPatchTypeField
|
||||
(
|
||||
pointPatchVectorField,
|
||||
oscillatingVelocityPointPatchVectorField
|
||||
);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,151 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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::oscillatingVelocityPointPatchVectorField
|
||||
|
||||
Description
|
||||
Foam::oscillatingVelocityPointPatchVectorField
|
||||
|
||||
SourceFiles
|
||||
oscillatingVelocityPointPatchVectorField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef oscillatingVelocityPointPatchVectorField_H
|
||||
#define oscillatingVelocityPointPatchVectorField_H
|
||||
|
||||
#include "fixedValuePointPatchField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class oscillatingVelocityPointPatchVectorField Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class oscillatingVelocityPointPatchVectorField
|
||||
:
|
||||
public fixedValuePointPatchField<vector>
|
||||
{
|
||||
// Private data
|
||||
|
||||
vector amplitude_;
|
||||
scalar omega_;
|
||||
|
||||
pointField p0_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("oscillatingVelocity");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
oscillatingVelocityPointPatchVectorField
|
||||
(
|
||||
const pointPatch&,
|
||||
const DimensionedField<vector, pointMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
oscillatingVelocityPointPatchVectorField
|
||||
(
|
||||
const pointPatch&,
|
||||
const DimensionedField<vector, pointMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given patchField<vector> onto a new patch
|
||||
oscillatingVelocityPointPatchVectorField
|
||||
(
|
||||
const oscillatingVelocityPointPatchVectorField&,
|
||||
const pointPatch&,
|
||||
const DimensionedField<vector, pointMesh>&,
|
||||
const pointPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual autoPtr<pointPatchField<vector> > clone() const
|
||||
{
|
||||
return autoPtr<pointPatchField<vector> >
|
||||
(
|
||||
new oscillatingVelocityPointPatchVectorField
|
||||
(
|
||||
*this
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
oscillatingVelocityPointPatchVectorField
|
||||
(
|
||||
const oscillatingVelocityPointPatchVectorField&,
|
||||
const DimensionedField<vector, pointMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual autoPtr<pointPatchField<vector> > clone
|
||||
(
|
||||
const DimensionedField<vector, pointMesh>& iF
|
||||
) const
|
||||
{
|
||||
return autoPtr<pointPatchField<vector> >
|
||||
(
|
||||
new oscillatingVelocityPointPatchVectorField
|
||||
(
|
||||
*this,
|
||||
iF
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
// Evaluation functions
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
virtual void updateCoeffs();
|
||||
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,381 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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 "surfaceSlipDisplacementPointPatchVectorField.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "Time.H"
|
||||
#include "transformField.H"
|
||||
#include "fvMesh.H"
|
||||
#include "displacementLaplacianFvMotionSolver.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
//Foam::vector
|
||||
// Foam::surfaceSlipDisplacementPointPatchVectorField::projectNormal
|
||||
//(
|
||||
// const label pointI,
|
||||
// const point& pt
|
||||
//)
|
||||
//{
|
||||
// vector projectNormal
|
||||
//
|
||||
// if (wedge)
|
||||
// {
|
||||
// // For wedge: assume axis runs from (0 0 0) in direction axisNormal_
|
||||
// //vector projectNormal(pt-axisPt);
|
||||
// //projectNormal -= (axisNormal&projectNormal)*projectNormal;
|
||||
//
|
||||
// projectNormal = pt - (axisNormal_&pt)*axisNormal_;
|
||||
// projectNormal /= mag(projectNormal) + VSMALL;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// projectNormal = this->patch().pointNormals()[pointI];
|
||||
// }
|
||||
//
|
||||
// return projectNormal;
|
||||
//}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
surfaceSlipDisplacementPointPatchVectorField::
|
||||
surfaceSlipDisplacementPointPatchVectorField
|
||||
(
|
||||
const pointPatch& p,
|
||||
const DimensionedField<vector, pointMesh>& iF
|
||||
)
|
||||
:
|
||||
pointPatchVectorField(p, iF),
|
||||
surfaceNames_(),
|
||||
projectDir_(vector::zero),
|
||||
wedgePlane_(-1)
|
||||
{}
|
||||
|
||||
|
||||
surfaceSlipDisplacementPointPatchVectorField::
|
||||
surfaceSlipDisplacementPointPatchVectorField
|
||||
(
|
||||
const pointPatch& p,
|
||||
const DimensionedField<vector, pointMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
pointPatchVectorField(p, iF),
|
||||
surfaceNames_(dict.lookup("projectSurfaces")),
|
||||
projectDir_(dict.lookup("projectDirection")),
|
||||
wedgePlane_(readLabel(dict.lookup("wedgePlane"))),
|
||||
frozenPointsZone_(dict.lookup("frozenPointsZone"))
|
||||
{}
|
||||
|
||||
|
||||
surfaceSlipDisplacementPointPatchVectorField::
|
||||
surfaceSlipDisplacementPointPatchVectorField
|
||||
(
|
||||
const surfaceSlipDisplacementPointPatchVectorField& ppf,
|
||||
const pointPatch& p,
|
||||
const DimensionedField<vector, pointMesh>& iF,
|
||||
const pointPatchFieldMapper&
|
||||
)
|
||||
:
|
||||
pointPatchVectorField(p, iF),
|
||||
surfaceNames_(ppf.surfaceNames()),
|
||||
projectDir_(ppf.projectDir()),
|
||||
wedgePlane_(ppf.wedgePlane()),
|
||||
frozenPointsZone_(ppf.frozenPointsZone())
|
||||
{}
|
||||
|
||||
|
||||
surfaceSlipDisplacementPointPatchVectorField::
|
||||
surfaceSlipDisplacementPointPatchVectorField
|
||||
(
|
||||
const surfaceSlipDisplacementPointPatchVectorField& ppf
|
||||
)
|
||||
:
|
||||
pointPatchVectorField(ppf),
|
||||
surfaceNames_(ppf.surfaceNames()),
|
||||
projectDir_(ppf.projectDir()),
|
||||
wedgePlane_(ppf.wedgePlane()),
|
||||
frozenPointsZone_(ppf.frozenPointsZone())
|
||||
{}
|
||||
|
||||
|
||||
surfaceSlipDisplacementPointPatchVectorField::
|
||||
surfaceSlipDisplacementPointPatchVectorField
|
||||
(
|
||||
const surfaceSlipDisplacementPointPatchVectorField& ppf,
|
||||
const DimensionedField<vector, pointMesh>& iF
|
||||
)
|
||||
:
|
||||
pointPatchVectorField(ppf, iF),
|
||||
surfaceNames_(ppf.surfaceNames()),
|
||||
projectDir_(ppf.projectDir()),
|
||||
wedgePlane_(ppf.wedgePlane()),
|
||||
frozenPointsZone_(ppf.frozenPointsZone())
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
const triSurfaceMeshes& surfaceSlipDisplacementPointPatchVectorField::
|
||||
surfaces() const
|
||||
{
|
||||
if (!surfacesPtr_.valid())
|
||||
{
|
||||
surfacesPtr_.reset
|
||||
(
|
||||
new triSurfaceMeshes
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"abc", // dummy name
|
||||
db().time().constant(), // directory
|
||||
"triSurface", // instance
|
||||
db().time(), // registry
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
surfaceNames_
|
||||
)
|
||||
);
|
||||
}
|
||||
return surfacesPtr_();
|
||||
}
|
||||
|
||||
|
||||
void surfaceSlipDisplacementPointPatchVectorField::evaluate
|
||||
(
|
||||
const Pstream::commsTypes commsType
|
||||
)
|
||||
{
|
||||
const polyMesh& mesh = patch().boundaryMesh().mesh()();
|
||||
|
||||
//const scalar deltaT = mesh.time().deltaT().value();
|
||||
|
||||
// Construct large enough vector in direction of projectDir so
|
||||
// we're guaranteed to hit something.
|
||||
|
||||
//- Fixed projection vector:
|
||||
//vector n = projectDir_/mag(projectDir_);
|
||||
//vector projectVec = n*(n&(mesh.bounds().max()-mesh.bounds().min()));
|
||||
|
||||
//- Per point projection vector:
|
||||
const scalar projectLen = mag(mesh.bounds().max()-mesh.bounds().min());
|
||||
|
||||
const pointField& localPoints = patch().localPoints();
|
||||
const labelList& meshPoints = patch().meshPoints();
|
||||
|
||||
//vectorField motionU(this->patchInternalField());
|
||||
vectorField displacement(this->patchInternalField());
|
||||
|
||||
|
||||
// Get fixed points (bit of a hack)
|
||||
const pointZone* zonePtr = NULL;
|
||||
|
||||
if (frozenPointsZone_.size() > 0)
|
||||
{
|
||||
const pointZoneMesh& pZones = mesh.pointZones();
|
||||
|
||||
zonePtr = &pZones[pZones.findZoneID(frozenPointsZone_)];
|
||||
|
||||
Pout<< "surfaceSlipDisplacementPointPatchVectorField : Fixing all "
|
||||
<< zonePtr->size() << " points in pointZone " << zonePtr->name()
|
||||
<< endl;
|
||||
}
|
||||
|
||||
// Get the starting locations from the motionSolver
|
||||
const displacementLaplacianFvMotionSolver& motionSolver =
|
||||
mesh.lookupObject<displacementLaplacianFvMotionSolver>
|
||||
(
|
||||
"dynamicMeshDict"
|
||||
);
|
||||
const pointField& points0 = motionSolver.points0();
|
||||
|
||||
forAll(localPoints, i)
|
||||
{
|
||||
if (zonePtr && (zonePtr->whichPoint(meshPoints[i]) >= 0))
|
||||
{
|
||||
// Fixed point. Reset to point0 location.
|
||||
|
||||
//Pout<< " Fixed point:" << meshPoints[i]
|
||||
// << " coord:" << localPoints[i]
|
||||
// << " should be at:" << points0[meshPoints[i]]
|
||||
// << endl;
|
||||
displacement[i] = points0[meshPoints[i]] - localPoints[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
//point start(localPoints[i] + deltaT*motionU[i]);
|
||||
point start(points0[meshPoints[i]] + displacement[i]);
|
||||
|
||||
vector projectVec(projectLen*patch().pointNormals()[i]);
|
||||
|
||||
scalar offset = 0;
|
||||
if (wedgePlane_ >= 0 && wedgePlane_ <= vector::nComponents)
|
||||
{
|
||||
offset = start[wedgePlane_];
|
||||
start[wedgePlane_] = 0;
|
||||
projectVec[wedgePlane_] = 0;
|
||||
}
|
||||
|
||||
pointIndexHit intersection;
|
||||
|
||||
// Check if already on surface
|
||||
surfaces().findNearest(start, sqr(SMALL), intersection);
|
||||
|
||||
if (intersection.hit())
|
||||
{
|
||||
//Pout<< " point:" << start << " near:" << intersection.hit()
|
||||
// << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
// No nearest found. Do intersection
|
||||
|
||||
label rightSurf0, rightSurf1;
|
||||
pointIndexHit rightHit0, rightHit1;
|
||||
surfaces().findNearestIntersection
|
||||
(
|
||||
start,
|
||||
start+projectVec,
|
||||
rightSurf0,
|
||||
rightHit0,
|
||||
rightSurf1,
|
||||
rightHit1
|
||||
);
|
||||
|
||||
// Do intersection
|
||||
label leftSurf0, leftSurf1;
|
||||
pointIndexHit leftHit0, leftHit1;
|
||||
surfaces().findNearestIntersection
|
||||
(
|
||||
start,
|
||||
start-projectVec,
|
||||
leftSurf0,
|
||||
leftHit0,
|
||||
leftSurf1,
|
||||
leftHit1
|
||||
);
|
||||
|
||||
if (rightHit0.hit())
|
||||
{
|
||||
if (leftHit0.hit())
|
||||
{
|
||||
if
|
||||
(
|
||||
magSqr(rightHit0.hitPoint()-start)
|
||||
< magSqr(leftHit0.hitPoint()-start)
|
||||
)
|
||||
{
|
||||
intersection = rightHit0;
|
||||
}
|
||||
else
|
||||
{
|
||||
intersection = leftHit0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
intersection = rightHit0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (leftHit0.hit())
|
||||
{
|
||||
intersection = leftHit0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Update *this from intersection point
|
||||
|
||||
if (intersection.hit())
|
||||
{
|
||||
point interPt = intersection.hitPoint();
|
||||
|
||||
if (wedgePlane_ >= 0 && wedgePlane_ <= vector::nComponents)
|
||||
{
|
||||
interPt[wedgePlane_] += offset;
|
||||
}
|
||||
//motionU[i] = (interPt-localPoints[i])/deltaT;
|
||||
displacement[i] = interPt-points0[meshPoints[i]];
|
||||
}
|
||||
else
|
||||
{
|
||||
Pout<< " point:" << meshPoints[i]
|
||||
<< " coord:" << localPoints[i]
|
||||
<< " did not find any intersection between ray from "
|
||||
<< start-projectVec << " to " << start+projectVec
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get internal field to insert values into
|
||||
Field<vector>& iF = const_cast<Field<vector>&>(this->internalField());
|
||||
|
||||
//setInInternalField(iF, motionU);
|
||||
setInInternalField(iF, displacement);
|
||||
|
||||
pointPatchVectorField::evaluate(commsType);
|
||||
}
|
||||
|
||||
|
||||
void surfaceSlipDisplacementPointPatchVectorField::write(Ostream& os) const
|
||||
{
|
||||
pointPatchVectorField::write(os);
|
||||
os.writeKeyword("projectSurfaces") << surfaceNames_
|
||||
<< token::END_STATEMENT << nl;
|
||||
os.writeKeyword("projectDirection") << projectDir_
|
||||
<< token::END_STATEMENT << nl;
|
||||
os.writeKeyword("wedgePlane") << wedgePlane_
|
||||
<< token::END_STATEMENT << nl;
|
||||
os.writeKeyword("frozenPointsZone") << frozenPointsZone_
|
||||
<< token::END_STATEMENT << nl;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
makePointPatchTypeField
|
||||
(
|
||||
pointPatchVectorField,
|
||||
surfaceSlipDisplacementPointPatchVectorField
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,204 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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::surfaceSlipDisplacementPointPatchVectorField
|
||||
|
||||
Description
|
||||
Displacement follows a triSurface. Use in a displacement fvMotionSolver.
|
||||
|
||||
SourceFiles
|
||||
surfaceSlipDisplacementPointPatchVectorField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef surfaceSlipDisplacementPointPatchVectorField_H
|
||||
#define surfaceSlipDisplacementPointPatchVectorField_H
|
||||
|
||||
#include "pointPatchFields.H"
|
||||
#include "triSurfaceMeshes.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class surfaceSlipDisplacementPointPatchVectorField Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class surfaceSlipDisplacementPointPatchVectorField
|
||||
:
|
||||
public pointPatchVectorField
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- names of surfaces
|
||||
const fileNameList surfaceNames_;
|
||||
|
||||
//- direction to project
|
||||
const vector projectDir_;
|
||||
|
||||
//- plane for 2D wedge case or -1.
|
||||
const label wedgePlane_;
|
||||
|
||||
//- pointZone with frozen points
|
||||
const word frozenPointsZone_;
|
||||
|
||||
//- Demand driven: surface to follow
|
||||
mutable autoPtr<triSurfaceMeshes> surfacesPtr_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
////- Calculate projection direction (normalised) at pointI.
|
||||
//vector projectNormal(const label pointI, const point& pt) const;
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const surfaceSlipDisplacementPointPatchVectorField&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("surfaceSlipDisplacement");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
surfaceSlipDisplacementPointPatchVectorField
|
||||
(
|
||||
const pointPatch&,
|
||||
const DimensionedField<vector, pointMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
surfaceSlipDisplacementPointPatchVectorField
|
||||
(
|
||||
const pointPatch&,
|
||||
const DimensionedField<vector, pointMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given patchField<vector> onto a new patch
|
||||
surfaceSlipDisplacementPointPatchVectorField
|
||||
(
|
||||
const surfaceSlipDisplacementPointPatchVectorField&,
|
||||
const pointPatch&,
|
||||
const DimensionedField<vector, pointMesh>&,
|
||||
const pointPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
surfaceSlipDisplacementPointPatchVectorField
|
||||
(
|
||||
const surfaceSlipDisplacementPointPatchVectorField&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual autoPtr<pointPatchVectorField> clone() const
|
||||
{
|
||||
return autoPtr<pointPatchVectorField>
|
||||
(
|
||||
new surfaceSlipDisplacementPointPatchVectorField
|
||||
(
|
||||
*this
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
surfaceSlipDisplacementPointPatchVectorField
|
||||
(
|
||||
const surfaceSlipDisplacementPointPatchVectorField&,
|
||||
const DimensionedField<vector, pointMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual autoPtr<pointPatchVectorField> clone
|
||||
(
|
||||
const DimensionedField<vector, pointMesh>& iF
|
||||
) const
|
||||
{
|
||||
return autoPtr<pointPatchVectorField>
|
||||
(
|
||||
new surfaceSlipDisplacementPointPatchVectorField
|
||||
(
|
||||
*this,
|
||||
iF
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Surfaces to follow
|
||||
const fileNameList& surfaceNames() const
|
||||
{
|
||||
return surfaceNames_;
|
||||
}
|
||||
|
||||
//- Surface to follow. Demand loads surfaceNames.
|
||||
const triSurfaceMeshes& surfaces() const;
|
||||
|
||||
//- Direction to project back onto surface
|
||||
const vector& projectDir() const
|
||||
{
|
||||
return projectDir_;
|
||||
}
|
||||
|
||||
//- Normal of wedgeplane (0, 1, 2) or -1. Note: should be obtained
|
||||
// from twoDPointCorrector.
|
||||
label wedgePlane() const
|
||||
{
|
||||
return wedgePlane_;
|
||||
}
|
||||
|
||||
//- Zone containing frozen points
|
||||
const word& frozenPointsZone() const
|
||||
{
|
||||
return frozenPointsZone_;
|
||||
}
|
||||
|
||||
//- Update the patch field
|
||||
virtual void evaluate
|
||||
(
|
||||
const Pstream::commsTypes commsType=Pstream::Pstream::blocking
|
||||
);
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
Reference in New Issue
Block a user