Dynamic mesh with multiple GGI rotors
This commit is contained in:
parent
f85e54b3a2
commit
b18df8c99e
5 changed files with 530 additions and 0 deletions
|
@ -13,6 +13,8 @@ dynamicRefineFvMesh/dynamicRefineFvMesh.C
|
|||
|
||||
mixerGgiFvMesh/mixerGgiFvMesh.C
|
||||
turboFvMesh/turboFvMesh.C
|
||||
multiGgiRotorFvMesh/ggiRotor.C
|
||||
multiGgiRotorFvMesh/multiGgiRotorFvMesh.C
|
||||
|
||||
fvMeshAdder/fvMeshAdder.C
|
||||
fvMeshDistribute/fvMeshDistribute.C
|
||||
|
|
166
src/dynamicMesh/dynamicFvMesh/multiGgiRotorFvMesh/ggiRotor.C
Normal file
166
src/dynamicMesh/dynamicFvMesh/multiGgiRotorFvMesh/ggiRotor.C
Normal file
|
@ -0,0 +1,166 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | foam-extend: Open Source CFD
|
||||
\\ / O peration | Version: 4.1
|
||||
\\ / A nd | Web: http://www.foam-extend.org
|
||||
\\/ M anipulation | For copyright notice see file Copyright
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of foam-extend.
|
||||
|
||||
foam-extend is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation, either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "ggiRotor.H"
|
||||
#include "foamTime.H"
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::ggiRotor::calcMovingMask() const
|
||||
{
|
||||
if (movingPointsMaskPtr_)
|
||||
{
|
||||
FatalErrorIn("void ggiRotor::calcMovingMask() const")
|
||||
<< "point mask already calculated"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
// Set the point mask
|
||||
movingPointsMaskPtr_ = new scalarField(mesh_.allPoints().size(), 0);
|
||||
scalarField& movingPointsMask = *movingPointsMaskPtr_;
|
||||
|
||||
const cellList& c = mesh_.cells();
|
||||
const faceList& f = mesh_.allFaces();
|
||||
|
||||
const labelList& cellAddr = mesh_.cellZones()
|
||||
[mesh_.cellZones().findZoneID(movingCellsZoneName_)];
|
||||
|
||||
forAll (cellAddr, cellI)
|
||||
{
|
||||
const cell& curCell = c[cellAddr[cellI]];
|
||||
|
||||
forAll (curCell, faceI)
|
||||
{
|
||||
// Mark all the points as moving
|
||||
const face& curFace = f[curCell[faceI]];
|
||||
|
||||
forAll (curFace, pointI)
|
||||
{
|
||||
movingPointsMask[curFace[pointI]] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Return moving points mask. Moving points marked with 1
|
||||
const Foam::scalarField& Foam::ggiRotor::movingPointsMask() const
|
||||
{
|
||||
if (!movingPointsMaskPtr_)
|
||||
{
|
||||
calcMovingMask();
|
||||
}
|
||||
|
||||
return *movingPointsMaskPtr_;
|
||||
}
|
||||
|
||||
|
||||
void Foam::ggiRotor::clearPointMask()
|
||||
{
|
||||
deleteDemandDrivenData(movingPointsMaskPtr_);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::ggiRotor::ggiRotor
|
||||
(
|
||||
const word& name,
|
||||
const polyMesh& mesh,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
name_(name),
|
||||
mesh_(mesh),
|
||||
cs_
|
||||
(
|
||||
"coordinateSystem",
|
||||
dict.subDict("coordinateSystem")
|
||||
),
|
||||
rpm_(readScalar(dict.lookup("rpm"))),
|
||||
movingCellsZoneName_(dict.lookup("movingCells")),
|
||||
movingPointsMaskPtr_(NULL)
|
||||
{
|
||||
// Make sure the coordinate system does not operate in degrees
|
||||
// Bug fix, HJ, 3/Oct/2011
|
||||
if (!cs_.inDegrees())
|
||||
{
|
||||
WarningIn
|
||||
(
|
||||
"ggiRotor::ggiRotor\n"
|
||||
"(\n"
|
||||
" const word& name,\n"
|
||||
" const polyMesh& mesh,\n"
|
||||
" const dictionary& dict\n"
|
||||
")"
|
||||
) << "Mixer coordinate system is set to operate in radians. "
|
||||
<< "Changing to rad for correct calculation of angular velocity."
|
||||
<< nl
|
||||
<< "To remove this message please add entry" << nl << nl
|
||||
<< "inDegrees true;" << nl << nl
|
||||
<< "to the specification of the coordinate system"
|
||||
<< endl;
|
||||
|
||||
cs_.inDegrees() = true;
|
||||
}
|
||||
|
||||
Info<< "Rotor " << name << ":" << nl
|
||||
<< " origin : " << cs().origin() << nl
|
||||
<< " axis : " << cs().axis() << nl
|
||||
<< " rpm : " << rpm_ << endl;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::ggiRotor::~ggiRotor()
|
||||
{
|
||||
clearPointMask();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
Foam::tmp<Foam::vectorField> Foam::ggiRotor::pointMotion() const
|
||||
{
|
||||
// Rotational speed needs to be converted from rpm
|
||||
scalarField mpm = movingPointsMask();
|
||||
|
||||
return cs_.globalPosition
|
||||
(
|
||||
// Motion vector in cylindrical coordinate system (x theta z)
|
||||
cs_.localPosition(mesh_.allPoints())
|
||||
+ vector(0, rpm_*360.0*mesh_.time().deltaT().value()/60.0, 0)*mpm
|
||||
) - mesh_.allPoints();
|
||||
}
|
||||
|
||||
|
||||
void Foam::ggiRotor::updateTopology()
|
||||
{
|
||||
clearPointMask();
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
141
src/dynamicMesh/dynamicFvMesh/multiGgiRotorFvMesh/ggiRotor.H
Normal file
141
src/dynamicMesh/dynamicFvMesh/multiGgiRotorFvMesh/ggiRotor.H
Normal file
|
@ -0,0 +1,141 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | foam-extend: Open Source CFD
|
||||
\\ / O peration | Version: 4.1
|
||||
\\ / A nd | Web: http://www.foam-extend.org
|
||||
\\/ M anipulation | For copyright notice see file Copyright
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of foam-extend.
|
||||
|
||||
foam-extend is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation, either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
ggiRotor
|
||||
|
||||
Description
|
||||
Single rotating region with GGI interfaces
|
||||
|
||||
Author
|
||||
Hrvoje Jasak, Wikki Ltd. All rights reserved.
|
||||
|
||||
SourceFiles
|
||||
ggiRotor.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef ggiRotor_H
|
||||
#define ggiRotor_H
|
||||
|
||||
#include "cylindricalCS.H"
|
||||
#include "Switch.H"
|
||||
#include "polyMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
class regionSplit;
|
||||
class polyTopoChanger;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class ggiRotor Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class ggiRotor
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Name
|
||||
const word name_;
|
||||
|
||||
//- Reference to mesh
|
||||
const polyMesh& mesh_;
|
||||
|
||||
//- Coordinate system
|
||||
cylindricalCS cs_;
|
||||
|
||||
// - Rotational speed in rotations per minute (rpm)
|
||||
const scalar rpm_;
|
||||
|
||||
//- Moving cells zone
|
||||
const word movingCellsZoneName_;
|
||||
|
||||
//- Markup field for points. Moving points marked with 1
|
||||
mutable scalarField* movingPointsMaskPtr_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
ggiRotor(const ggiRotor&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const ggiRotor&);
|
||||
|
||||
|
||||
//- Return coordinate system
|
||||
const cylindricalCS& cs() const
|
||||
{
|
||||
return cs_;
|
||||
}
|
||||
|
||||
//- Calculate moving mask
|
||||
void calcMovingMask() const;
|
||||
|
||||
//- Return moving points mask
|
||||
const scalarField& movingPointsMask() const;
|
||||
|
||||
//- Clear moving points mask
|
||||
void clearPointMask();
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from dictionary
|
||||
ggiRotor
|
||||
(
|
||||
const word& name,
|
||||
const polyMesh& mesh,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~ggiRotor();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return accumulative point motion
|
||||
virtual tmp<vectorField> pointMotion() const;
|
||||
|
||||
//- Update topology
|
||||
void updateTopology();
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
|
@ -0,0 +1,115 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | foam-extend: Open Source CFD
|
||||
\\ / O peration | Version: 4.1
|
||||
\\ / A nd | Web: http://www.foam-extend.org
|
||||
\\/ M anipulation | For copyright notice see file Copyright
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of foam-extend.
|
||||
|
||||
foam-extend is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation, either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "multiGgiRotorFvMesh.H"
|
||||
#include "foamTime.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(multiGgiRotorFvMesh, 0);
|
||||
addToRunTimeSelectionTable(dynamicFvMesh, multiGgiRotorFvMesh, IOobject);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
// Construct from components
|
||||
Foam::multiGgiRotorFvMesh::multiGgiRotorFvMesh
|
||||
(
|
||||
const IOobject& io
|
||||
)
|
||||
:
|
||||
dynamicFvMesh(io),
|
||||
dict_
|
||||
(
|
||||
IOdictionary
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"dynamicMeshDict",
|
||||
time().constant(),
|
||||
*this,
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
).subDict(typeName + "Coeffs")
|
||||
),
|
||||
rotors_()
|
||||
{
|
||||
// Read rotors from the dictionary
|
||||
PtrList<entry> rotorEntries(dict_.lookup("rotors"));
|
||||
rotors_.setSize(rotorEntries.size());
|
||||
|
||||
forAll (rotorEntries, rotorI)
|
||||
{
|
||||
rotors_.set
|
||||
(
|
||||
rotorI,
|
||||
new ggiRotor
|
||||
(
|
||||
rotorEntries[rotorI].keyword(),
|
||||
*this,
|
||||
rotorEntries[rotorI].dict()
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::multiGgiRotorFvMesh::~multiGgiRotorFvMesh()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::multiGgiRotorFvMesh::update()
|
||||
{
|
||||
forAll (rotors_, rotorI)
|
||||
{
|
||||
rotors_[rotorI].updateTopology();
|
||||
}
|
||||
|
||||
// Accumulate point motion
|
||||
vectorField pointMotion(allPoints().size(), vector::zero);
|
||||
|
||||
forAll (rotors_, rotorI)
|
||||
{
|
||||
pointMotion += rotors_[rotorI].pointMotion();
|
||||
}
|
||||
|
||||
// Move points
|
||||
movePoints(allPoints() + pointMotion);
|
||||
|
||||
// Motion only - return false
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
|
@ -0,0 +1,106 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | foam-extend: Open Source CFD
|
||||
\\ / O peration | Version: 4.1
|
||||
\\ / A nd | Web: http://www.foam-extend.org
|
||||
\\/ M anipulation | For copyright notice see file Copyright
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of foam-extend.
|
||||
|
||||
foam-extend is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation, either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
multiGgiRotorFvMesh
|
||||
|
||||
Description
|
||||
Mixer mesh with multiple rotors.
|
||||
|
||||
Author
|
||||
Hrvoje Jasak, Wikki Ltd. All rights reserved.
|
||||
|
||||
SourceFiles
|
||||
multiGgiRotorFvMesh.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef multiGgiRotorFvMesh_H
|
||||
#define multiGgiRotorFvMesh_H
|
||||
|
||||
#include "dynamicFvMesh.H"
|
||||
#include "ggiRotor.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class multiGgiRotorFvMesh Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class multiGgiRotorFvMesh
|
||||
:
|
||||
public dynamicFvMesh
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Motion dictionary
|
||||
dictionary dict_;
|
||||
|
||||
//- Mixer rotors
|
||||
PtrList<ggiRotor> rotors_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
multiGgiRotorFvMesh(const multiGgiRotorFvMesh&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const multiGgiRotorFvMesh&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("multiGgiRotorFvMesh");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from IOobject
|
||||
explicit multiGgiRotorFvMesh(const IOobject& io);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~multiGgiRotorFvMesh();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Update the mesh for both mesh motion and topology change
|
||||
virtual bool update();
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
Reference in a new issue