mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Finite area port, Hrvoje Jasak
- with sphereSurfactantFoam and sphereTransport test case
This commit is contained in:
committed by
Andrew Heather
parent
4c81ee202d
commit
0c64622341
400
src/finiteArea/faMesh/faBoundaryMesh/faBoundaryMesh.C
Normal file
400
src/finiteArea/faMesh/faBoundaryMesh/faBoundaryMesh.C
Normal file
@ -0,0 +1,400 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd |
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2016-2017 Wikki Ltd
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "faBoundaryMesh.H"
|
||||
#include "faMesh.H"
|
||||
#include "primitiveMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(faBoundaryMesh, 0);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
// Construct from dictionary
|
||||
faBoundaryMesh::faBoundaryMesh
|
||||
(
|
||||
const IOobject& io,
|
||||
const faMesh& mesh
|
||||
)
|
||||
:
|
||||
faPatchList(),
|
||||
regIOobject(io),
|
||||
mesh_(mesh)
|
||||
{
|
||||
if (readOpt() == IOobject::MUST_READ)
|
||||
{
|
||||
faPatchList& patches = *this;
|
||||
|
||||
// Read polyPatchList
|
||||
Istream& is = readStream(typeName);
|
||||
|
||||
PtrList<entry> patchEntries(is);
|
||||
patches.setSize(patchEntries.size());
|
||||
|
||||
forAll(patches, patchI)
|
||||
{
|
||||
patches.set
|
||||
(
|
||||
patchI,
|
||||
faPatch::New
|
||||
(
|
||||
patchEntries[patchI].keyword(),
|
||||
patchEntries[patchI].dict(),
|
||||
patchI,
|
||||
*this
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Check state of IOstream
|
||||
is.check
|
||||
(
|
||||
"faBoundaryMesh::polyBoundaryMesh"
|
||||
"(const IOobject&, const faMesh&)"
|
||||
);
|
||||
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Construct given size. Patches will be set later
|
||||
faBoundaryMesh::faBoundaryMesh
|
||||
(
|
||||
const IOobject& io,
|
||||
const faMesh& pm,
|
||||
const label size
|
||||
)
|
||||
:
|
||||
faPatchList(size),
|
||||
regIOobject(io),
|
||||
mesh_(pm)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
// Calculate the geometry for the patches (transformation tensors etc.)
|
||||
void faBoundaryMesh::calcGeometry()
|
||||
{
|
||||
forAll(*this, patchi)
|
||||
{
|
||||
operator[](patchi).initGeometry();
|
||||
}
|
||||
|
||||
forAll(*this, patchi)
|
||||
{
|
||||
operator[](patchi).calcGeometry();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Return the mesh reference
|
||||
const faMesh& faBoundaryMesh::mesh() const
|
||||
{
|
||||
return mesh_;
|
||||
}
|
||||
|
||||
|
||||
lduInterfacePtrsList faBoundaryMesh::interfaces() const
|
||||
{
|
||||
lduInterfacePtrsList interfaces(size());
|
||||
|
||||
forAll (interfaces, patchi)
|
||||
{
|
||||
if (isA<lduInterface>(this->operator[](patchi)))
|
||||
{
|
||||
interfaces.set
|
||||
(
|
||||
patchi,
|
||||
&refCast<const lduInterface>(this->operator[](patchi))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return interfaces;
|
||||
}
|
||||
|
||||
|
||||
// Return a list of patch types
|
||||
wordList faBoundaryMesh::types() const
|
||||
{
|
||||
const faPatchList& patches = *this;
|
||||
|
||||
wordList t(patches.size());
|
||||
|
||||
forAll (patches, patchI)
|
||||
{
|
||||
t[patchI] = patches[patchI].type();
|
||||
}
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
|
||||
// Return a list of patch names
|
||||
wordList faBoundaryMesh::names() const
|
||||
{
|
||||
const faPatchList& patches = *this;
|
||||
|
||||
wordList t(patches.size());
|
||||
|
||||
forAll (patches, patchI)
|
||||
{
|
||||
t[patchI] = patches[patchI].name();
|
||||
}
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
|
||||
label faBoundaryMesh::findPatchID(const word& patchName) const
|
||||
{
|
||||
const faPatchList& patches = *this;
|
||||
|
||||
forAll (patches, patchI)
|
||||
{
|
||||
if (patches[patchI].name() == patchName)
|
||||
{
|
||||
return patchI;
|
||||
}
|
||||
}
|
||||
|
||||
// Patch not found
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
Foam::labelList Foam::faBoundaryMesh::findIndices
|
||||
(
|
||||
const keyType& key,
|
||||
const bool usePatchGroups
|
||||
) const
|
||||
{
|
||||
DynamicList<label> indices;
|
||||
|
||||
if (!key.empty())
|
||||
{
|
||||
if (key.isPattern())
|
||||
{
|
||||
indices = findStrings(key, this->names());
|
||||
}
|
||||
else
|
||||
{
|
||||
// Literal string. Special version of above to avoid
|
||||
// unnecessary memory allocations
|
||||
|
||||
indices.setCapacity(1);
|
||||
forAll(*this, i)
|
||||
{
|
||||
if (key == operator[](i).name())
|
||||
{
|
||||
indices.append(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return indices;
|
||||
}
|
||||
|
||||
|
||||
// Return patch index for a given edge label
|
||||
label faBoundaryMesh::whichPatch(const label edgeIndex) const
|
||||
{
|
||||
// Find out which patch the current face belongs to by comparing label
|
||||
// with patch start labels.
|
||||
// If the face is internal, return -1;
|
||||
// if it is off the end of the list, abort
|
||||
if (edgeIndex >= mesh().nEdges())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"faBoundaryMesh::whichPatch(const label edgeIndex) const"
|
||||
) << "given label greater than the number of edges"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
if (edgeIndex < mesh().nInternalEdges())
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
forAll (*this, patchI)
|
||||
{
|
||||
label start = mesh_.patchStarts()[patchI];
|
||||
label size = operator[](patchI).faPatch::size();
|
||||
|
||||
if
|
||||
(
|
||||
edgeIndex >= start
|
||||
&& edgeIndex < start + size
|
||||
)
|
||||
{
|
||||
return patchI;
|
||||
}
|
||||
}
|
||||
|
||||
// If not in any of above, it's trouble!
|
||||
FatalErrorIn
|
||||
(
|
||||
"label faBoundaryMesh::whichPatch(const label edgeIndex) const"
|
||||
) << "error in patch search algorithm"
|
||||
<< abort(FatalError);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
bool faBoundaryMesh::checkDefinition(const bool report) const
|
||||
{
|
||||
label nextPatchStart = mesh().nInternalEdges();
|
||||
const faBoundaryMesh& bm = *this;
|
||||
|
||||
bool boundaryError = false;
|
||||
|
||||
forAll (bm, patchI)
|
||||
{
|
||||
if (bm[patchI].start() != nextPatchStart)
|
||||
{
|
||||
boundaryError = true;
|
||||
|
||||
Info
|
||||
<< "bool faBoundaryMesh::checkDefinition("
|
||||
<< "const bool report) const : "
|
||||
<< "Problem with boundary patch " << patchI
|
||||
<< ".\nThe patch should start on face no " << nextPatchStart
|
||||
<< " and the boundary file specifies " << bm[patchI].start()
|
||||
<< "." << nl << endl;
|
||||
}
|
||||
|
||||
nextPatchStart += bm[patchI].faPatch::size();
|
||||
}
|
||||
|
||||
if (boundaryError)
|
||||
{
|
||||
SeriousErrorIn
|
||||
(
|
||||
"bool faBoundaryMesh::checkDefinition("
|
||||
"const bool report) const"
|
||||
) << "This mesh is not valid: boundary definition is in error."
|
||||
<< endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (debug || report)
|
||||
{
|
||||
Info << "Boundary definition OK." << endl;
|
||||
}
|
||||
}
|
||||
|
||||
return boundaryError;
|
||||
}
|
||||
|
||||
|
||||
// Correct faBoundaryMesh after moving points
|
||||
void faBoundaryMesh::movePoints(const pointField& p)
|
||||
{
|
||||
faPatchList& patches = *this;
|
||||
|
||||
forAll (patches, patchI)
|
||||
{
|
||||
patches[patchI].initMovePoints(p);
|
||||
}
|
||||
|
||||
forAll (patches, patchI)
|
||||
{
|
||||
patches[patchI].movePoints(p);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void faBoundaryMesh::updateMesh()
|
||||
{
|
||||
faPatchList& patches = *this;
|
||||
|
||||
forAll(patches, patchi)
|
||||
{
|
||||
patches[patchi].initUpdateMesh();
|
||||
}
|
||||
|
||||
forAll(patches, patchi)
|
||||
{
|
||||
patches[patchi].updateMesh();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// writeData member function required by regIOobject
|
||||
bool faBoundaryMesh::writeData(Ostream& os) const
|
||||
{
|
||||
const faPatchList& patches = *this;
|
||||
|
||||
os << patches.size() << nl << token::BEGIN_LIST << incrIndent << nl;
|
||||
|
||||
forAll(patches, patchi)
|
||||
{
|
||||
os << indent << patches[patchi].name() << nl
|
||||
<< indent << token::BEGIN_BLOCK << nl
|
||||
<< incrIndent << patches[patchi] << decrIndent
|
||||
<< indent << token::END_BLOCK << endl;
|
||||
}
|
||||
|
||||
os << decrIndent << token::END_LIST;
|
||||
|
||||
// Check state of IOstream
|
||||
os.check("polyBoundaryMesh::writeData(Ostream& os) const");
|
||||
|
||||
return os.good();
|
||||
}
|
||||
|
||||
|
||||
Ostream& operator<<(Ostream& os, const faBoundaryMesh& bm)
|
||||
{
|
||||
bm.writeData(os);
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
171
src/finiteArea/faMesh/faBoundaryMesh/faBoundaryMesh.H
Normal file
171
src/finiteArea/faMesh/faBoundaryMesh/faBoundaryMesh.H
Normal file
@ -0,0 +1,171 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd |
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2016-2017 Wikki Ltd
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
faBoundaryMesh
|
||||
|
||||
Description
|
||||
Finite area boundary mesh
|
||||
|
||||
SourceFiles
|
||||
faBoundaryMesh.C
|
||||
|
||||
Author
|
||||
Zeljko Tukovic, FMENA
|
||||
Hrvoje Jasak, Wikki Ltd.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef faBoundaryMesh_H
|
||||
#define faBoundaryMesh_H
|
||||
|
||||
#include "faPatchList.H"
|
||||
#include "lduInterfacePtrsList.H"
|
||||
#include "wordList.H"
|
||||
#include "pointField.H"
|
||||
#include "regIOobject.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
class faMesh;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class faBoundaryMesh Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class faBoundaryMesh
|
||||
:
|
||||
public faPatchList,
|
||||
public regIOobject
|
||||
{
|
||||
// private data
|
||||
|
||||
//- Reference to mesh
|
||||
const faMesh& mesh_;
|
||||
|
||||
//- Disallow construct as copy
|
||||
faBoundaryMesh(const faBoundaryMesh&);
|
||||
|
||||
//- Disallow assignment
|
||||
void operator=(const faBoundaryMesh&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("faBoundaryMesh");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from dictionary
|
||||
faBoundaryMesh
|
||||
(
|
||||
const IOobject& io,
|
||||
const faMesh& fam
|
||||
);
|
||||
|
||||
//- Construct given size
|
||||
faBoundaryMesh
|
||||
(
|
||||
const IOobject& io,
|
||||
const faMesh& fam,
|
||||
const label size
|
||||
);
|
||||
|
||||
|
||||
// Destructor - default
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
// Access
|
||||
|
||||
//- Calculate the geometry for the patches
|
||||
// (transformation tensors etc.)
|
||||
void calcGeometry();
|
||||
|
||||
//- Return the mesh reference
|
||||
const faMesh& mesh() const;
|
||||
|
||||
//- Return a list of pointers for each patch
|
||||
// with only those pointing to interfaces being set
|
||||
lduInterfacePtrsList interfaces() const;
|
||||
|
||||
//- Return a list of patch types
|
||||
wordList types() const;
|
||||
|
||||
//- Return a list of patch names
|
||||
wordList names() const;
|
||||
|
||||
//- Find patch index given a name
|
||||
label findPatchID(const word& patchName) const;
|
||||
|
||||
//- Find patch indices given a name
|
||||
// Compatibility change HJ, 12/Aug/2017
|
||||
labelList findIndices
|
||||
(
|
||||
const keyType&,
|
||||
const bool useGroups = false
|
||||
) const;
|
||||
|
||||
//- Return patch index for a given edge label
|
||||
label whichPatch(const label edgeIndex) const;
|
||||
|
||||
//- Check boundary definition
|
||||
bool checkDefinition(const bool report = false) const;
|
||||
|
||||
// Edit
|
||||
|
||||
//- Correct faBoundaryMesh after moving points
|
||||
void movePoints(const pointField&);
|
||||
|
||||
//- Correct faBoundaryMesh after topology update
|
||||
void updateMesh();
|
||||
|
||||
//- writeData member function required by regIOobject
|
||||
bool writeData(Ostream&) const;
|
||||
|
||||
|
||||
// Ostream operator
|
||||
|
||||
friend Ostream& operator<<(Ostream&, const faBoundaryMesh&);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
140
src/finiteArea/faMesh/faGlobalMeshData/faGlobalMeshData.C
Normal file
140
src/finiteArea/faMesh/faGlobalMeshData/faGlobalMeshData.C
Normal file
@ -0,0 +1,140 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd |
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2016-2017 Wikki Ltd
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Description
|
||||
|
||||
Author
|
||||
Hrvoje Jasak
|
||||
|
||||
\*----------------------------------------------------------------------------*/
|
||||
|
||||
#include "faGlobalMeshData.H"
|
||||
#include "faMesh.H"
|
||||
#include "globalMeshData.H"
|
||||
#include "PstreamCombineReduceOps.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::faGlobalMeshData::faGlobalMeshData(const faMesh& mesh)
|
||||
:
|
||||
faProcessorTopology(mesh.boundary(), UPstream::worldComm),
|
||||
mesh_(mesh),
|
||||
nGlobalPoints_(-1),
|
||||
sharedPointLabels_(0),
|
||||
sharedPointAddr_(0)
|
||||
{
|
||||
updateMesh();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::faGlobalMeshData::~faGlobalMeshData()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
const Foam::faMesh& Foam::faGlobalMeshData::mesh() const
|
||||
{
|
||||
return mesh_;
|
||||
}
|
||||
|
||||
|
||||
// Update all data after morph
|
||||
void Foam::faGlobalMeshData::updateMesh()
|
||||
{
|
||||
label polyMeshNGlobalPoints =
|
||||
mesh_().globalData().nGlobalPoints();
|
||||
|
||||
const labelList& polyMeshSharedPointLabels =
|
||||
mesh_().globalData().sharedPointLabels();
|
||||
|
||||
const labelList& polyMeshSharedPointAddr =
|
||||
mesh_().globalData().sharedPointAddr();
|
||||
|
||||
labelHashSet sharedPointLabels;
|
||||
|
||||
labelField globalList(polyMeshNGlobalPoints, 0);
|
||||
|
||||
forAll(mesh_.boundary(), patchI)
|
||||
{
|
||||
if(mesh_.boundary()[patchI].type() == processorFaPatch::typeName)
|
||||
{
|
||||
const labelList& localPointLabels =
|
||||
mesh_.boundary()[patchI].pointLabels();
|
||||
|
||||
forAll(localPointLabels, pointI)
|
||||
{
|
||||
label polyMeshPoint =
|
||||
mesh_.patch().meshPoints()[localPointLabels[pointI]];
|
||||
|
||||
label sharedPolyMeshPoint =
|
||||
findIndex(polyMeshSharedPointLabels, polyMeshPoint);
|
||||
|
||||
if
|
||||
(
|
||||
sharedPolyMeshPoint != -1
|
||||
&& !sharedPointLabels.found(localPointLabels[pointI])
|
||||
)
|
||||
{
|
||||
globalList[polyMeshSharedPointAddr[sharedPolyMeshPoint]]
|
||||
+= 1;
|
||||
|
||||
sharedPointLabels.insert(localPointLabels[pointI]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sharedPointLabels_ = sharedPointLabels.toc();
|
||||
|
||||
combineReduce(globalList, plusEqOp<labelField >());
|
||||
|
||||
nGlobalPoints_ = 0;
|
||||
for (label i=0; i<globalList.size(); i++)
|
||||
{
|
||||
if(globalList[i] > 0)
|
||||
{
|
||||
globalList[i] = ++nGlobalPoints_;
|
||||
}
|
||||
}
|
||||
|
||||
sharedPointAddr_.setSize(sharedPointLabels_.size());
|
||||
forAll(sharedPointAddr_, pointI)
|
||||
{
|
||||
label polyMeshSharedPointIndex = findIndex
|
||||
(
|
||||
polyMeshSharedPointLabels,
|
||||
mesh_.patch().meshPoints()[sharedPointLabels_[pointI]]
|
||||
);
|
||||
|
||||
sharedPointAddr_[pointI] =
|
||||
globalList[polyMeshSharedPointAddr[polyMeshSharedPointIndex]]
|
||||
- 1;
|
||||
}
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
143
src/finiteArea/faMesh/faGlobalMeshData/faGlobalMeshData.H
Normal file
143
src/finiteArea/faMesh/faGlobalMeshData/faGlobalMeshData.H
Normal file
@ -0,0 +1,143 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd |
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2016-2017 Wikki Ltd
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
faGlobalMeshData
|
||||
|
||||
Description
|
||||
Various mesh related information for a parallel run
|
||||
|
||||
Author
|
||||
Zeljko Tukovic, FMENA
|
||||
Hrvoje Jasak, Wikki Ltd.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef faGlobalMeshData_H
|
||||
#define faGlobalMeshData_H
|
||||
|
||||
#include "faProcessorTopology.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Class forward declarations
|
||||
class faMesh;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class faGlobalMeshData Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class faGlobalMeshData
|
||||
:
|
||||
public faProcessorTopology
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Reference to mesh
|
||||
const faMesh& mesh_;
|
||||
|
||||
// Globally shared point addressing
|
||||
|
||||
//- Total number of global points
|
||||
label nGlobalPoints_;
|
||||
|
||||
//- Indices of local points that are globally shared
|
||||
labelList sharedPointLabels_;
|
||||
|
||||
//- Indices of globally shared points in the master list
|
||||
// This list contains all the shared points in the mesh
|
||||
labelList sharedPointAddr_;
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
faGlobalMeshData(const faGlobalMeshData&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const faGlobalMeshData&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
ClassName("faGlobalMeshData");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from mesh
|
||||
faGlobalMeshData(const faMesh& mesh);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
~faGlobalMeshData();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Access
|
||||
|
||||
//- Return mesh reference
|
||||
const faMesh& mesh() const;
|
||||
|
||||
// Globally shared point addressing
|
||||
|
||||
//- Return number of globally shared points
|
||||
label nGlobalPoints() const
|
||||
{
|
||||
return nGlobalPoints_;
|
||||
}
|
||||
|
||||
//- Return indices of local points that are globally shared
|
||||
const labelList& sharedPointLabels() const
|
||||
{
|
||||
return sharedPointLabels_;
|
||||
}
|
||||
|
||||
//- Return addressing into the complete globally shared points
|
||||
// list
|
||||
const labelList& sharedPointAddr() const
|
||||
{
|
||||
return sharedPointAddr_;
|
||||
}
|
||||
|
||||
//- Change global mesh data given a topological change.
|
||||
void updateMesh();
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
61
src/finiteArea/faMesh/faGlobalMeshData/faProcessorTopology.H
Normal file
61
src/finiteArea/faMesh/faGlobalMeshData/faProcessorTopology.H
Normal file
@ -0,0 +1,61 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd |
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2016-2017 Wikki Ltd
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
faProcessorTopology
|
||||
|
||||
Description
|
||||
|
||||
Author
|
||||
Zeljko Tukovic, FMENA
|
||||
Hrvoje Jasak, Wikki Ltd.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef faProcessorTopology_H
|
||||
#define faProcessorTopology_H
|
||||
|
||||
#include "ProcessorTopology.H"
|
||||
#include "faPatchList.H"
|
||||
#include "processorFaPatch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
typedef ProcessorTopology<faPatchList, processorFaPatch> faProcessorTopology;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
1387
src/finiteArea/faMesh/faMesh.C
Normal file
1387
src/finiteArea/faMesh/faMesh.C
Normal file
File diff suppressed because it is too large
Load Diff
552
src/finiteArea/faMesh/faMesh.H
Normal file
552
src/finiteArea/faMesh/faMesh.H
Normal file
@ -0,0 +1,552 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd |
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2016-2017 Wikki Ltd
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
faMesh
|
||||
|
||||
Description
|
||||
Finite area mesh. Used for 2-D non-Euclidian finite area method.
|
||||
|
||||
SourceFiles
|
||||
faMesh.C
|
||||
faMeshDemandDrivenData.C
|
||||
|
||||
Author
|
||||
Zeljko Tukovic, FMENA
|
||||
Hrvoje Jasak, Wikki Ltd.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef faMesh_H
|
||||
#define faMesh_H
|
||||
|
||||
#include "GeoMesh.H"
|
||||
#include "MeshObject.H"
|
||||
#include "polyMesh.H"
|
||||
#include "lduMesh.H"
|
||||
#include "faBoundaryMesh.H"
|
||||
#include "edgeList.H"
|
||||
#include "faceList.H"
|
||||
#include "primitiveFieldsFwd.H"
|
||||
#include "DimensionedField.H"
|
||||
#include "areaFieldsFwd.H"
|
||||
#include "edgeFieldsFwd.H"
|
||||
#include "indirectPrimitivePatch.H"
|
||||
#include "edgeInterpolation.H"
|
||||
#include "labelIOList.H"
|
||||
#include "scalarIOField.H"
|
||||
#include "FieldFields.H"
|
||||
#include "faGlobalMeshData.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Class forward declarations
|
||||
class faMeshLduAddressing;
|
||||
class faMeshMapper;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class faMesh Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class faMesh
|
||||
:
|
||||
public GeoMesh<polyMesh>,
|
||||
public MeshObject<polyMesh, UpdateableMeshObject, faMesh>,
|
||||
public lduMesh,
|
||||
public edgeInterpolation
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Face labels
|
||||
labelIOList faceLabels_;
|
||||
|
||||
//- Boundary mesh
|
||||
faBoundaryMesh boundary_;
|
||||
|
||||
|
||||
// Primitive mesh data
|
||||
|
||||
//- Edges, addressing into local point list
|
||||
edgeList edges_;
|
||||
|
||||
//- Edge owner
|
||||
labelList edgeOwner_;
|
||||
|
||||
//- Edge neighbour
|
||||
labelList edgeNeighbour_;
|
||||
|
||||
|
||||
// Primitive size data
|
||||
|
||||
//- Number of points
|
||||
mutable label nPoints_;
|
||||
|
||||
//- Number of edges
|
||||
mutable label nEdges_;
|
||||
|
||||
//- Number of internal edges
|
||||
mutable label nInternalEdges_;
|
||||
|
||||
//- Number of faces
|
||||
mutable label nFaces_;
|
||||
|
||||
|
||||
// Communication support
|
||||
|
||||
//- Communicator used for parallel communication
|
||||
label comm_;
|
||||
|
||||
|
||||
// Demand-driven data
|
||||
|
||||
//- Primitive patch
|
||||
mutable indirectPrimitivePatch* patchPtr_;
|
||||
|
||||
//- Ldu addressing data
|
||||
mutable faMeshLduAddressing* lduPtr_;
|
||||
|
||||
//- Current time index for motion
|
||||
// Note. The whole mechanism will be replaced once the
|
||||
// dimensionedField is created and the dimensionedField
|
||||
// will take care of the old-time levels.
|
||||
mutable label curTimeIndex_;
|
||||
|
||||
//- Face areas
|
||||
mutable DimensionedField<scalar, areaMesh>* SPtr_;
|
||||
|
||||
//- Face areas old time level
|
||||
mutable DimensionedField<scalar, areaMesh>* S0Ptr_;
|
||||
|
||||
//- Face areas old-old time level
|
||||
mutable DimensionedField<scalar, areaMesh>* S00Ptr_;
|
||||
|
||||
//- Patch starts in the edge list
|
||||
mutable labelList* patchStartsPtr_;
|
||||
|
||||
//- Edge length vectors
|
||||
mutable edgeVectorField* LePtr_;
|
||||
|
||||
//- Mag edge length vectors
|
||||
mutable edgeScalarField* magLePtr_;
|
||||
|
||||
//- Face centres
|
||||
mutable areaVectorField* centresPtr_;
|
||||
|
||||
//- Edge centres
|
||||
mutable edgeVectorField* edgeCentresPtr_;
|
||||
|
||||
//- Face area normals
|
||||
mutable areaVectorField* faceAreaNormalsPtr_;
|
||||
|
||||
//- Edge area normals
|
||||
mutable edgeVectorField* edgeAreaNormalsPtr_;
|
||||
|
||||
//- Edge area normals
|
||||
mutable vectorField* pointAreaNormalsPtr_;
|
||||
|
||||
//- Face curvatures
|
||||
mutable areaScalarField* faceCurvaturesPtr_;
|
||||
|
||||
//- Edge transformation tensors
|
||||
mutable FieldField<Field, tensor>* edgeTransformTensorsPtr_;
|
||||
|
||||
//- Whether point normals must be corrected for a patch
|
||||
mutable boolList* correctPatchPointNormalsPtr_;
|
||||
|
||||
// Other mesh-related data
|
||||
|
||||
//- Parallel info
|
||||
mutable faGlobalMeshData* globalMeshDataPtr_;
|
||||
|
||||
|
||||
// Static Private Data
|
||||
|
||||
//- Use quadrics fit
|
||||
static const int quadricsFit_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
faMesh(const faMesh&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const faMesh&);
|
||||
|
||||
|
||||
//- Set primitive mesh data
|
||||
void setPrimitiveMeshData();
|
||||
|
||||
// Private member functions to calculate demand driven data
|
||||
|
||||
//- Calculate ldu addressing
|
||||
void calcLduAddressing() const;
|
||||
|
||||
//- Calculate patch starts in the edge list
|
||||
void calcPatchStarts() const;
|
||||
|
||||
//- Calculate edge lengths
|
||||
void calcLe() const;
|
||||
|
||||
//- Calculate mag edge lengths
|
||||
void calcMagLe() const;
|
||||
|
||||
//- Calculate face centres
|
||||
void calcAreaCentres() const;
|
||||
|
||||
//- Calculate edge centres
|
||||
void calcEdgeCentres() const;
|
||||
|
||||
//- Calculate face areas
|
||||
void calcS() const;
|
||||
|
||||
//- Calculate face area normals
|
||||
void calcFaceAreaNormals() const;
|
||||
|
||||
//- Calculate edge area normals
|
||||
void calcEdgeAreaNormals() const;
|
||||
|
||||
//- Calculate point area normals
|
||||
void calcPointAreaNormals() const;
|
||||
|
||||
//- Calculate point area normals by quadrics fit
|
||||
void calcPointAreaNormalsByQuadricsFit() const;
|
||||
|
||||
//- Calculate face curvatures
|
||||
void calcFaceCurvatures() const;
|
||||
|
||||
//- Calculate edge transformation tensors
|
||||
void calcEdgeTransformTensors() const;
|
||||
|
||||
//- Clear geometry but not the face areas
|
||||
void clearGeomNotAreas() const;
|
||||
|
||||
//- Clear geometry
|
||||
void clearGeom() const;
|
||||
|
||||
//- Clear addressing
|
||||
void clearAddressing() const;
|
||||
|
||||
//- Clear demand-driven data
|
||||
void clearOut() const;
|
||||
|
||||
public:
|
||||
|
||||
// Public typedefs
|
||||
|
||||
typedef faMesh Mesh;
|
||||
typedef faBoundaryMesh BoundaryMesh;
|
||||
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("faMesh");
|
||||
|
||||
|
||||
//- Return the mesh sub-directory name (usually "faMesh")
|
||||
static word meshSubDir;
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from polyMesh
|
||||
explicit faMesh(const polyMesh& m);
|
||||
|
||||
//- Construct from components without boundary.
|
||||
// Boundary is added using addFaPatches() member function
|
||||
faMesh
|
||||
(
|
||||
const polyMesh& m,
|
||||
const labelList& faceLabels
|
||||
);
|
||||
|
||||
//- Construct from finite area mesh definition file
|
||||
faMesh
|
||||
(
|
||||
const polyMesh& m,
|
||||
const fileName& defFile
|
||||
);
|
||||
|
||||
//- Construct from polyPatch
|
||||
faMesh
|
||||
(
|
||||
const polyMesh& m,
|
||||
const label polyPatchID
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~faMesh();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Helpers
|
||||
|
||||
//- Add boundary patches. Constructor helper
|
||||
void addFaPatches(const List<faPatch*> &);
|
||||
|
||||
|
||||
// Database
|
||||
|
||||
//- Return access to polyMesh
|
||||
const polyMesh& mesh() const
|
||||
{
|
||||
return
|
||||
MeshObject<polyMesh, UpdateableMeshObject, faMesh>::mesh();
|
||||
}
|
||||
|
||||
//- Return the local mesh directory (dbDir()/meshSubDir)
|
||||
fileName meshDir() const;
|
||||
|
||||
//- Return reference to time
|
||||
const Time& time() const;
|
||||
|
||||
//- Return the current instance directory for points
|
||||
// Used in the consruction of gemometric mesh data dependent
|
||||
// on points
|
||||
const fileName& pointsInstance() const;
|
||||
|
||||
//- Return the current instance directory for faces
|
||||
const fileName& facesInstance() const;
|
||||
|
||||
|
||||
//- Mesh size parameters
|
||||
|
||||
inline label nPoints() const
|
||||
{
|
||||
return nPoints_;
|
||||
}
|
||||
|
||||
inline label nEdges() const
|
||||
{
|
||||
return nEdges_;
|
||||
}
|
||||
|
||||
inline label nInternalEdges() const
|
||||
{
|
||||
return nInternalEdges_;
|
||||
}
|
||||
|
||||
inline label nFaces() const
|
||||
{
|
||||
return nFaces_;
|
||||
}
|
||||
|
||||
// Primitive mesh data
|
||||
|
||||
//- Return mesh points
|
||||
const pointField& points() const;
|
||||
|
||||
//- Return edges
|
||||
const edgeList& edges() const;
|
||||
|
||||
//- Return faces
|
||||
const faceList& faces() const;
|
||||
|
||||
//- Edge owner addresing
|
||||
inline const labelList& edgeOwner() const
|
||||
{
|
||||
return edgeOwner_;
|
||||
}
|
||||
|
||||
//- Edge neighbour addressing
|
||||
inline const labelList& edgeNeighbour() const
|
||||
{
|
||||
return edgeNeighbour_;
|
||||
}
|
||||
|
||||
|
||||
// Communication support
|
||||
|
||||
//- Return communicator used for parallel communication
|
||||
label comm() const;
|
||||
|
||||
//- Return communicator used for parallel communication
|
||||
label& comm();
|
||||
|
||||
|
||||
// Access
|
||||
|
||||
//- Return reference to the mesh database
|
||||
virtual const objectRegistry& thisDb() const;
|
||||
|
||||
//- Return constant reference to boundary mesh
|
||||
const faBoundaryMesh& boundary() const;
|
||||
|
||||
//- Return faMesh face labels
|
||||
const labelList& faceLabels() const
|
||||
{
|
||||
return faceLabels_;
|
||||
}
|
||||
|
||||
|
||||
//- Return parallel info
|
||||
const faGlobalMeshData& globalData() const;
|
||||
|
||||
//- Return ldu addressing
|
||||
virtual const lduAddressing& lduAddr() const;
|
||||
|
||||
//- Return a list of pointers for each patch
|
||||
// with only those pointing to interfaces being set
|
||||
virtual lduInterfacePtrsList interfaces() const
|
||||
{
|
||||
return boundary().interfaces();
|
||||
}
|
||||
|
||||
//- Internal face owner
|
||||
const labelUList& owner() const
|
||||
{
|
||||
return lduAddr().lowerAddr();
|
||||
}
|
||||
|
||||
//- Internal face neighbour
|
||||
const labelUList& neighbour() const
|
||||
{
|
||||
return lduAddr().upperAddr();
|
||||
}
|
||||
|
||||
//- Return true if given edge label is internal to the mesh
|
||||
inline bool isInternalEdge(const label edgeIndex) const
|
||||
{
|
||||
return edgeIndex < nInternalEdges();
|
||||
}
|
||||
|
||||
|
||||
// Mesh motion and mophing
|
||||
|
||||
//- Is mesh moving
|
||||
bool moving() const
|
||||
{
|
||||
return mesh().moving();
|
||||
}
|
||||
|
||||
//- Update after mesh motion
|
||||
virtual bool movePoints();
|
||||
|
||||
//- Update after topo change
|
||||
virtual void updateMesh(const mapPolyMesh&);
|
||||
|
||||
|
||||
// Mapping
|
||||
|
||||
//- Map all fields in time using given map.
|
||||
virtual void mapFields(const faMeshMapper& mapper) const;
|
||||
|
||||
//- Map face areas in time using given map.
|
||||
virtual void mapOldAreas(const faMeshMapper& mapper) const;
|
||||
|
||||
|
||||
// Demand-driven data
|
||||
|
||||
//- Return constant reference to primitive patch
|
||||
const indirectPrimitivePatch& patch() const;
|
||||
|
||||
//- Return reference to primitive patch
|
||||
indirectPrimitivePatch& patch();
|
||||
|
||||
//- Return patch starts
|
||||
const labelList& patchStarts() const;
|
||||
|
||||
//- Return edge length vectors
|
||||
const edgeVectorField& Le() const;
|
||||
|
||||
//- Return edge length magnitudes
|
||||
const edgeScalarField& magLe() const;
|
||||
|
||||
//- Return face centres as areaVectorField
|
||||
const areaVectorField& areaCentres() const;
|
||||
|
||||
//- Return edge centres as edgeVectorField
|
||||
const edgeVectorField& edgeCentres() const;
|
||||
|
||||
//- Return face areas
|
||||
const DimensionedField<scalar, areaMesh>& S() const;
|
||||
|
||||
//- Return old-time face areas
|
||||
const DimensionedField<scalar, areaMesh>& S0() const;
|
||||
|
||||
//- Return old-old-time face areas
|
||||
const DimensionedField<scalar, areaMesh>& S00() const;
|
||||
|
||||
//- Return face area normals
|
||||
const areaVectorField& faceAreaNormals() const;
|
||||
|
||||
//- Return edge area normals
|
||||
const edgeVectorField& edgeAreaNormals() const;
|
||||
|
||||
//- Return point area normals
|
||||
const vectorField& pointAreaNormals() const;
|
||||
|
||||
//- Return face curvatures
|
||||
const areaScalarField& faceCurvatures() const;
|
||||
|
||||
//- Return edge transformation tensors
|
||||
const FieldField<Field, tensor>& edgeTransformTensors() const;
|
||||
|
||||
//- Return internal point labels
|
||||
labelList internalPoints() const;
|
||||
|
||||
//- Return boundary point labels
|
||||
labelList boundaryPoints() const;
|
||||
|
||||
//- Return edge length correction
|
||||
tmp<edgeScalarField> edgeLengthCorrection() const;
|
||||
|
||||
//- Whether point normals should be corrected for a patch
|
||||
bool correctPatchPointNormals(const label patchID) const;
|
||||
|
||||
//- Set whether point normals should be corrected for a patch
|
||||
boolList& correctPatchPointNormals() const;
|
||||
|
||||
//- Write mesh
|
||||
virtual bool write() const;
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
bool operator!=(const faMesh& m) const;
|
||||
|
||||
bool operator==(const faMesh& m) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "faPatchFaMeshTemplates.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
2028
src/finiteArea/faMesh/faMeshDemandDrivenData.C
Normal file
2028
src/finiteArea/faMesh/faMeshDemandDrivenData.C
Normal file
File diff suppressed because it is too large
Load Diff
158
src/finiteArea/faMesh/faMeshLduAddressing.H
Normal file
158
src/finiteArea/faMesh/faMeshLduAddressing.H
Normal file
@ -0,0 +1,158 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd |
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2016-2017 Wikki Ltd
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
faMeshLduAddressing
|
||||
|
||||
Description
|
||||
lduAddressing wrapper for faMesh
|
||||
|
||||
SourceFiles
|
||||
faMeshLduAddressing.C
|
||||
|
||||
Author
|
||||
Zeljko Tukovic, FMENA
|
||||
Hrvoje Jasak, Wikki Ltd.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef faMeshLduAddressing_H
|
||||
#define faMeshLduAddressing_H
|
||||
|
||||
#include "lduAddressing.H"
|
||||
#include "faMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class faMeshLduAddressing Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class faMeshLduAddressing
|
||||
:
|
||||
public lduAddressing
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Lower as a subList of allOwner
|
||||
labelList::subList lowerAddr_;
|
||||
|
||||
//- Upper as a reference to neighbour
|
||||
const labelList& upperAddr_;
|
||||
|
||||
//- Patch addressing as a list of sublists
|
||||
List<const labelUList*> patchAddr_;
|
||||
|
||||
//- Patch field evaluation schedule
|
||||
const lduSchedule& patchSchedule_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
faMeshLduAddressing(const faMeshLduAddressing&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const faMeshLduAddressing&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
faMeshLduAddressing(const faMesh& mesh)
|
||||
:
|
||||
lduAddressing(mesh.nFaces()),
|
||||
lowerAddr_
|
||||
(
|
||||
labelList::subList
|
||||
(
|
||||
mesh.edgeOwner(),
|
||||
mesh.nInternalEdges()
|
||||
)
|
||||
),
|
||||
upperAddr_(mesh.edgeNeighbour()),
|
||||
patchAddr_(mesh.boundary().size()),
|
||||
patchSchedule_(mesh.globalData().patchSchedule())
|
||||
{
|
||||
forAll (mesh.boundary(), patchI)
|
||||
{
|
||||
patchAddr_[patchI] = &mesh.boundary()[patchI].edgeFaces();
|
||||
}
|
||||
}
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~faMeshLduAddressing()
|
||||
{}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return number of interfaces
|
||||
virtual label nPatches() const
|
||||
{
|
||||
return patchAddr_.size();
|
||||
}
|
||||
|
||||
//- Return lower addressing (i.e. lower label = upper triangle)
|
||||
virtual const labelUList& lowerAddr() const
|
||||
{
|
||||
return lowerAddr_;
|
||||
}
|
||||
|
||||
//- Return upper addressing (i.e. upper label)
|
||||
virtual const labelUList& upperAddr() const
|
||||
{
|
||||
return upperAddr_;
|
||||
}
|
||||
|
||||
//- Return patch addressing
|
||||
virtual const labelUList& patchAddr(const label i) const
|
||||
{
|
||||
return *patchAddr_[i];
|
||||
}
|
||||
|
||||
// Return patch field evaluation schedule
|
||||
virtual const lduSchedule& patchSchedule() const
|
||||
{
|
||||
return patchSchedule_;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
434
src/finiteArea/faMesh/faMeshMapper/faAreaMapper.C
Normal file
434
src/finiteArea/faMesh/faMeshMapper/faAreaMapper.C
Normal file
@ -0,0 +1,434 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd |
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2016-2017 Wikki Ltd
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Description
|
||||
FV surface mapper.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "faAreaMapper.H"
|
||||
#include "mapPolyMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::faAreaMapper::calcAddressing() const
|
||||
{
|
||||
if
|
||||
(
|
||||
newFaceLabelsPtr_
|
||||
|| newFaceLabelsMapPtr_
|
||||
|| directAddrPtr_
|
||||
|| interpolationAddrPtr_
|
||||
|| weightsPtr_
|
||||
|| insertedObjectLabelsPtr_
|
||||
)
|
||||
{
|
||||
FatalErrorIn("void faAreaMapper::calcAddressing() const)")
|
||||
<< "Addressing already calculated"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
// Mapping
|
||||
|
||||
const label oldNInternal = mpm_.nOldInternalFaces();
|
||||
|
||||
hasUnmapped_ = false;
|
||||
|
||||
// Calculate new face labels
|
||||
|
||||
// Copy old face labels
|
||||
const labelList& oldFaces = mesh_.faceLabels();
|
||||
|
||||
// Prepare a list of new face labels and (preliminary) addressing
|
||||
// Note: dimensioned to number of boundary faces of polyMesh
|
||||
// HJ, 10/Aug/2011
|
||||
newFaceLabelsPtr_ = new labelList
|
||||
(
|
||||
mesh_().nFaces() - mesh_().nInternalFaces(),
|
||||
-1
|
||||
);
|
||||
labelList& newFaceLabels = *newFaceLabelsPtr_;
|
||||
|
||||
newFaceLabelsMapPtr_ = new labelList
|
||||
(
|
||||
mesh_().nFaces() - mesh_().nInternalFaces(),
|
||||
-1
|
||||
);
|
||||
labelList& newFaceLabelsMap = *newFaceLabelsMapPtr_;
|
||||
label nNewFaces = 0;
|
||||
|
||||
Info<< "Old face list size: " << oldFaces.size()
|
||||
<< " estimated new size " << newFaceLabels.size() << endl;
|
||||
|
||||
// Get reverse face map
|
||||
const labelList& reverseFaceMap = mpm_.reverseFaceMap();
|
||||
|
||||
// Pick up live old faces
|
||||
forAll (oldFaces, faceI)
|
||||
{
|
||||
if (reverseFaceMap[oldFaces[faceI]] > -1)
|
||||
{
|
||||
// Face is live, add it and record addressing
|
||||
newFaceLabels[nNewFaces] = reverseFaceMap[oldFaces[faceI]];
|
||||
newFaceLabelsMap[nNewFaces] = faceI;
|
||||
|
||||
nNewFaces++;
|
||||
}
|
||||
}
|
||||
|
||||
// Assemble the maps
|
||||
if (direct())
|
||||
{
|
||||
Info<< "Direct"<< endl;
|
||||
// Direct mapping: no further faces to add. Resize list
|
||||
newFaceLabels.setSize(nNewFaces);
|
||||
|
||||
directAddrPtr_ = new labelList(newFaceLabels.size());
|
||||
labelList& addr = *directAddrPtr_;
|
||||
|
||||
// Adjust for creation of a boundary face from an internal face
|
||||
forAll (addr, faceI)
|
||||
{
|
||||
if (newFaceLabelsMap[faceI] < oldNInternal)
|
||||
{
|
||||
addr[faceI] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
addr[faceI] = newFaceLabelsMap[faceI];
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// There are further faces to add. Prepare interpolation addressing
|
||||
// and weights to full size
|
||||
interpolationAddrPtr_ = new labelListList(newFaceLabels.size());
|
||||
labelListList& addr = *interpolationAddrPtr_;
|
||||
|
||||
weightsPtr_ = new scalarListList(newFaceLabels.size());
|
||||
scalarListList& w = *weightsPtr_;
|
||||
|
||||
// Insert single addressing and weights
|
||||
for (label addrI = 0; addrI < nNewFaces; addrI++)
|
||||
{
|
||||
addr[addrI] = labelList(1, newFaceLabelsMap[addrI]);
|
||||
w[addrI] = scalarList(1, scalar(1));
|
||||
}
|
||||
|
||||
// Pick up faces from points, edges and faces where the origin
|
||||
// Only map from faces which were previously in the faMesh, using
|
||||
// fast lookup
|
||||
|
||||
// Set of faces previously in the mesh
|
||||
labelHashSet oldFaceLookup(oldFaces);
|
||||
|
||||
// Go through faces-from lists and add the ones where all
|
||||
// old face labels belonged to the faMesh
|
||||
|
||||
const List<objectMap>& ffp = mpm_.facesFromPointsMap();
|
||||
|
||||
forAll (ffp, ffpI)
|
||||
{
|
||||
// Get addressing
|
||||
const labelList& mo = ffp[ffpI].masterObjects();
|
||||
|
||||
// Check if master objects are in faMesh
|
||||
labelList validMo(mo.size());
|
||||
label nValidMo = 0;
|
||||
|
||||
forAll (mo, moI)
|
||||
{
|
||||
if (oldFaceLookup.found(mo[moI]))
|
||||
{
|
||||
validMo[nValidMo] = oldFaceLookup[mo[moI]];
|
||||
nValidMo++;
|
||||
}
|
||||
}
|
||||
|
||||
if (nValidMo > 0)
|
||||
{
|
||||
// Some objects found: add face and interpolation to list
|
||||
newFaceLabels[nNewFaces] = ffp[ffpI].index();
|
||||
|
||||
// No old face available
|
||||
newFaceLabelsMap[nNewFaces] = -1;
|
||||
|
||||
// Map from masters, uniform weights
|
||||
addr[nNewFaces] = validMo;
|
||||
w[nNewFaces] = scalarList(validMo.size(), 1.0/validMo.size());
|
||||
|
||||
nNewFaces++;
|
||||
}
|
||||
}
|
||||
|
||||
const List<objectMap>& ffe = mpm_.facesFromEdgesMap();
|
||||
|
||||
forAll (ffe, ffeI)
|
||||
{
|
||||
// Get addressing
|
||||
const labelList& mo = ffe[ffeI].masterObjects();
|
||||
|
||||
// Check if master objects are in faMesh
|
||||
labelList validMo(mo.size());
|
||||
label nValidMo = 0;
|
||||
|
||||
forAll (mo, moI)
|
||||
{
|
||||
if (oldFaceLookup.found(mo[moI]))
|
||||
{
|
||||
validMo[nValidMo] = oldFaceLookup[mo[moI]];
|
||||
nValidMo++;
|
||||
}
|
||||
}
|
||||
|
||||
if (nValidMo > 0)
|
||||
{
|
||||
// Some objects found: add face and interpolation to list
|
||||
newFaceLabels[nNewFaces] = ffe[ffeI].index();
|
||||
|
||||
// No old face available
|
||||
newFaceLabelsMap[nNewFaces] = -1;
|
||||
|
||||
// Map from masters, uniform weights
|
||||
addr[nNewFaces] = validMo;
|
||||
w[nNewFaces] = scalarList(validMo.size(), 1.0/validMo.size());
|
||||
|
||||
nNewFaces++;
|
||||
}
|
||||
}
|
||||
|
||||
const List<objectMap>& fff = mpm_.facesFromFacesMap();
|
||||
|
||||
forAll (fff, fffI)
|
||||
{
|
||||
// Get addressing
|
||||
const labelList& mo = fff[fffI].masterObjects();
|
||||
|
||||
// Check if master objects are in faMesh
|
||||
labelList validMo(mo.size());
|
||||
label nValidMo = 0;
|
||||
|
||||
forAll (mo, moI)
|
||||
{
|
||||
if (oldFaceLookup.found(mo[moI]))
|
||||
{
|
||||
validMo[nValidMo] = oldFaceLookup[mo[moI]];
|
||||
nValidMo++;
|
||||
}
|
||||
}
|
||||
|
||||
if (nValidMo > 0)
|
||||
{
|
||||
// Some objects found: add face and interpolation to list
|
||||
newFaceLabels[nNewFaces] = fff[fffI].index();
|
||||
|
||||
// No old face available
|
||||
newFaceLabelsMap[nNewFaces] = -1;
|
||||
|
||||
// Map from masters, uniform weights
|
||||
addr[nNewFaces] = validMo;
|
||||
w[nNewFaces] = scalarList(validMo.size(), 1.0/validMo.size());
|
||||
|
||||
nNewFaces++;
|
||||
}
|
||||
}
|
||||
|
||||
// All faces collected. Reset sizes of lists
|
||||
newFaceLabels.setSize(nNewFaces);
|
||||
newFaceLabelsMap.setSize(nNewFaces);
|
||||
addr.setSize(nNewFaces);
|
||||
w.setSize(nNewFaces);
|
||||
Info<< "addr: " << addr << nl
|
||||
<< "w: " << w << endl;
|
||||
}
|
||||
|
||||
// Inserted objects cannot appear in the new faMesh as they have no master
|
||||
// HJ, 10/Aug/2011
|
||||
insertedObjectLabelsPtr_ = new labelList(0);
|
||||
}
|
||||
|
||||
|
||||
void Foam::faAreaMapper::clearOut()
|
||||
{
|
||||
deleteDemandDrivenData(newFaceLabelsPtr_);
|
||||
deleteDemandDrivenData(newFaceLabelsMapPtr_);
|
||||
|
||||
deleteDemandDrivenData(directAddrPtr_);
|
||||
deleteDemandDrivenData(interpolationAddrPtr_);
|
||||
deleteDemandDrivenData(weightsPtr_);
|
||||
|
||||
deleteDemandDrivenData(insertedObjectLabelsPtr_);
|
||||
hasUnmapped_ = false;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
// Construct from components
|
||||
Foam::faAreaMapper::faAreaMapper
|
||||
(
|
||||
const faMesh& mesh,
|
||||
const mapPolyMesh& mpm
|
||||
)
|
||||
:
|
||||
mesh_(mesh),
|
||||
mpm_(mpm),
|
||||
insertedFaces_(false),
|
||||
direct_(false),
|
||||
hasUnmapped_(false),
|
||||
sizeBeforeMapping_(mesh.nFaces()),
|
||||
newFaceLabelsPtr_(NULL),
|
||||
newFaceLabelsMapPtr_(NULL),
|
||||
directAddrPtr_(NULL),
|
||||
interpolationAddrPtr_(NULL),
|
||||
weightsPtr_(NULL),
|
||||
insertedObjectLabelsPtr_(NULL)
|
||||
{
|
||||
// Check for possibility of direct mapping
|
||||
if
|
||||
(
|
||||
mpm_.facesFromPointsMap().empty()
|
||||
&& mpm_.facesFromEdgesMap().empty()
|
||||
&& mpm_.facesFromFacesMap().empty()
|
||||
)
|
||||
{
|
||||
direct_ = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
direct_ = false;
|
||||
}
|
||||
|
||||
// Inserted objects not suported: no master
|
||||
// HJ, 10/Aug/2011
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::faAreaMapper::~faAreaMapper()
|
||||
{
|
||||
clearOut();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
const Foam::labelList& Foam::faAreaMapper::newFaceLabels() const
|
||||
{
|
||||
if (!newFaceLabelsPtr_)
|
||||
{
|
||||
calcAddressing();
|
||||
}
|
||||
|
||||
return *newFaceLabelsPtr_;
|
||||
}
|
||||
|
||||
|
||||
const Foam::labelList& Foam::faAreaMapper::newFaceLabelsMap() const
|
||||
{
|
||||
if (!newFaceLabelsMapPtr_)
|
||||
{
|
||||
calcAddressing();
|
||||
}
|
||||
|
||||
return *newFaceLabelsMapPtr_;
|
||||
}
|
||||
|
||||
|
||||
const Foam::labelUList& Foam::faAreaMapper::directAddressing() const
|
||||
{
|
||||
if (!direct())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"const labelUList& faAreaMapper::"
|
||||
"directAddressing() const"
|
||||
) << "Requested direct addressing for an interpolative mapper."
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
if (!directAddrPtr_)
|
||||
{
|
||||
calcAddressing();
|
||||
}
|
||||
|
||||
return *directAddrPtr_;
|
||||
}
|
||||
|
||||
|
||||
const Foam::labelListList& Foam::faAreaMapper::addressing() const
|
||||
{
|
||||
if (direct())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"const labelListList& faAreaMapper::addressing() const"
|
||||
) << "Requested interpolative addressing for a direct mapper."
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
if (!interpolationAddrPtr_)
|
||||
{
|
||||
calcAddressing();
|
||||
}
|
||||
|
||||
return *interpolationAddrPtr_;
|
||||
}
|
||||
|
||||
|
||||
const Foam::scalarListList& Foam::faAreaMapper::weights() const
|
||||
{
|
||||
if (direct())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"const scalarListList& faAreaMapper::weights() const"
|
||||
) << "Requested interpolative weights for a direct mapper."
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
if (!weightsPtr_)
|
||||
{
|
||||
calcAddressing();
|
||||
}
|
||||
|
||||
return *weightsPtr_;
|
||||
}
|
||||
|
||||
|
||||
const Foam::labelList& Foam::faAreaMapper::insertedObjectLabels() const
|
||||
{
|
||||
if (!insertedObjectLabelsPtr_)
|
||||
{
|
||||
calcAddressing();
|
||||
}
|
||||
|
||||
return *insertedObjectLabelsPtr_;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
200
src/finiteArea/faMesh/faMeshMapper/faAreaMapper.H
Normal file
200
src/finiteArea/faMesh/faMeshMapper/faAreaMapper.H
Normal file
@ -0,0 +1,200 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd |
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2016-2017 Wikki Ltd
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::faAreaMapper
|
||||
|
||||
Description
|
||||
FA area mapper.
|
||||
|
||||
Author
|
||||
Zeljko Tukovic, FMENA
|
||||
Hrvoje Jasak, Wikki Ltd.
|
||||
|
||||
SourceFiles
|
||||
faAreaMapper.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef faAreaMapper_H
|
||||
#define faAreaMapper_H
|
||||
|
||||
#include "morphFieldMapper.H"
|
||||
#include "faMesh.H"
|
||||
#include "faceMapper.H"
|
||||
#include "HashSet.H"
|
||||
#include "mapPolyMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class faAreaMapper Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class faAreaMapper
|
||||
:
|
||||
public morphFieldMapper
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Reference to mesh mapper
|
||||
const faMesh& mesh_;
|
||||
|
||||
//- Reference to mapPolyMesh
|
||||
const mapPolyMesh& mpm_;
|
||||
|
||||
//- Are there any inserted (unmapped) faces
|
||||
bool insertedFaces_;
|
||||
|
||||
//- Is the mapping direct
|
||||
bool direct_;
|
||||
|
||||
|
||||
// Demand-driven private data
|
||||
|
||||
mutable bool hasUnmapped_;
|
||||
|
||||
//- Old mesh size
|
||||
label sizeBeforeMapping_;
|
||||
|
||||
//- New face labels after mapping
|
||||
mutable labelList* newFaceLabelsPtr_;
|
||||
|
||||
//- New face labels after mapping
|
||||
mutable labelList* newFaceLabelsMapPtr_;
|
||||
|
||||
|
||||
//- Direct addressing (only one form of addressing is used)
|
||||
mutable labelList* directAddrPtr_;
|
||||
|
||||
//- Interpolated addressing (only one form of addressing is used)
|
||||
mutable labelListList* interpolationAddrPtr_;
|
||||
|
||||
//- Interpolation weights
|
||||
mutable scalarListList* weightsPtr_;
|
||||
|
||||
//- Inserted faces
|
||||
mutable labelList* insertedObjectLabelsPtr_;
|
||||
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
faAreaMapper(const faAreaMapper&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const faAreaMapper&);
|
||||
|
||||
|
||||
//- Calculate addressing
|
||||
void calcAddressing() const;
|
||||
|
||||
//- Clear out local storage
|
||||
void clearOut();
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
faAreaMapper
|
||||
(
|
||||
const faMesh& mesh,
|
||||
const mapPolyMesh& mpm
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~faAreaMapper();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return new face labels
|
||||
const labelList& newFaceLabels() const;
|
||||
|
||||
//- Return new face labels map
|
||||
// For new faces return old face index if it exists
|
||||
// If the face has been added, index will be -1
|
||||
const labelList& newFaceLabelsMap() const;
|
||||
|
||||
//- Return size
|
||||
virtual label size() const
|
||||
{
|
||||
return newFaceLabels().size();
|
||||
}
|
||||
|
||||
//- Return size of field before mapping
|
||||
virtual label sizeBeforeMapping() const
|
||||
{
|
||||
return sizeBeforeMapping_;
|
||||
}
|
||||
|
||||
//- Is the mapping direct
|
||||
virtual bool direct() const
|
||||
{
|
||||
return direct_;
|
||||
}
|
||||
|
||||
virtual bool hasUnmapped() const
|
||||
{
|
||||
return hasUnmapped_;
|
||||
}
|
||||
|
||||
//- Return direct addressing
|
||||
virtual const labelUList& directAddressing() const;
|
||||
|
||||
//- Return interpolated addressing
|
||||
virtual const labelListList& addressing() const;
|
||||
|
||||
//- Return interpolaion weights
|
||||
virtual const scalarListList& weights() const;
|
||||
|
||||
//- Are there any inserted faces
|
||||
virtual bool insertedObjects() const
|
||||
{
|
||||
return !insertedObjectLabels().empty();
|
||||
}
|
||||
|
||||
//- Return list of inserted faces
|
||||
virtual const labelList& insertedObjectLabels() const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
101
src/finiteArea/faMesh/faMeshMapper/faBoundaryMeshMapper.H
Normal file
101
src/finiteArea/faMesh/faMeshMapper/faBoundaryMeshMapper.H
Normal file
@ -0,0 +1,101 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd |
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2016-2017 Wikki Ltd
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::faBoundaryMeshMapper
|
||||
|
||||
Description
|
||||
Foam::faBoundaryMeshMapper
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef faBoundaryMeshMapper_H
|
||||
#define faBoundaryMeshMapper_H
|
||||
|
||||
#include "PtrList.H"
|
||||
#include "faPatchMapper.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class faBoundaryMeshMapper Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class faBoundaryMeshMapper
|
||||
:
|
||||
public PtrList<faPatchMapper>
|
||||
{
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
faBoundaryMeshMapper(const faBoundaryMeshMapper&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const faBoundaryMeshMapper&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
faBoundaryMeshMapper
|
||||
(
|
||||
const faMesh& mesh,
|
||||
const mapPolyMesh& mpm
|
||||
)
|
||||
:
|
||||
PtrList<faPatchMapper>(mesh.boundary().size())
|
||||
{
|
||||
const faBoundaryMesh& patches = mesh.boundary();
|
||||
|
||||
forAll (patches, patchI)
|
||||
{
|
||||
set
|
||||
(
|
||||
patchI,
|
||||
new faPatchMapper
|
||||
(
|
||||
patches[patchI],
|
||||
mpm
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
121
src/finiteArea/faMesh/faMeshMapper/faEdgeMapper.C
Normal file
121
src/finiteArea/faMesh/faMeshMapper/faEdgeMapper.C
Normal file
@ -0,0 +1,121 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd |
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2016-2017 Wikki Ltd
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Description
|
||||
FV edge mapper.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "faEdgeMapper.H"
|
||||
#include "mapPolyMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::faEdgeMapper::calcAddressing() const
|
||||
{
|
||||
if (directAddrPtr_)
|
||||
{
|
||||
FatalErrorIn("void faEdgeMapper::calcAddressing() const)")
|
||||
<< "Addressing already calculated"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
hasUnmapped_ = false;
|
||||
|
||||
// Dummy mapping: take value from edge 0
|
||||
directAddrPtr_ = new labelList(size(), 0);
|
||||
}
|
||||
|
||||
|
||||
void Foam::faEdgeMapper::clearOut()
|
||||
{
|
||||
deleteDemandDrivenData(directAddrPtr_);
|
||||
hasUnmapped_ = false;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
// Construct from components
|
||||
Foam::faEdgeMapper::faEdgeMapper
|
||||
(
|
||||
const faMesh& mesh,
|
||||
const mapPolyMesh& mpm
|
||||
)
|
||||
:
|
||||
mesh_(mesh),
|
||||
mpm_(mpm),
|
||||
sizeBeforeMapping_(mesh.nInternalEdges()),
|
||||
hasUnmapped_(false),
|
||||
directAddrPtr_(NULL)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::faEdgeMapper::~faEdgeMapper()
|
||||
{
|
||||
clearOut();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
const Foam::labelUList& Foam::faEdgeMapper::directAddressing() const
|
||||
{
|
||||
if (!directAddrPtr_)
|
||||
{
|
||||
calcAddressing();
|
||||
}
|
||||
|
||||
return *directAddrPtr_;
|
||||
}
|
||||
|
||||
|
||||
const Foam::labelListList& Foam::faEdgeMapper::addressing() const
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"const labelListList& faEdgeMapper::addressing() const"
|
||||
) << "Requested interpolative addressing for a direct mapper."
|
||||
<< abort(FatalError);
|
||||
|
||||
return labelListList::null();
|
||||
}
|
||||
|
||||
|
||||
const Foam::scalarListList& Foam::faEdgeMapper::weights() const
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"const scalarListList& faEdgeMapper::weights() const"
|
||||
) << "Requested interpolative weights for a direct mapper."
|
||||
<< abort(FatalError);
|
||||
|
||||
return scalarListList::null();
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
173
src/finiteArea/faMesh/faMeshMapper/faEdgeMapper.H
Normal file
173
src/finiteArea/faMesh/faMeshMapper/faEdgeMapper.H
Normal file
@ -0,0 +1,173 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd |
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2016-2017 Wikki Ltd
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::faEdgeMapper
|
||||
|
||||
Description
|
||||
FA edge mapper. Currently, edge-based finite area data is not mapped,
|
||||
but only resized, since edge-based mapping data is not available
|
||||
|
||||
Author
|
||||
Zeljko Tukovic, FMENA
|
||||
Hrvoje Jasak, Wikki Ltd.
|
||||
|
||||
SourceFiles
|
||||
faEdgeMapper.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef faEdgeMapper_H
|
||||
#define faEdgeMapper_H
|
||||
|
||||
#include "morphFieldMapper.H"
|
||||
#include "faMesh.H"
|
||||
#include "faceMapper.H"
|
||||
#include "HashSet.H"
|
||||
#include "mapPolyMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class faEdgeMapper Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class faEdgeMapper
|
||||
:
|
||||
public morphFieldMapper
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Reference to mesh
|
||||
const faMesh& mesh_;
|
||||
|
||||
//- Reference to mapPolyMesh
|
||||
const mapPolyMesh& mpm_;
|
||||
|
||||
//- Old mesh size
|
||||
label sizeBeforeMapping_;
|
||||
|
||||
|
||||
// Demand-driven private data
|
||||
|
||||
mutable bool hasUnmapped_;
|
||||
|
||||
//- Direct addressing
|
||||
mutable labelList* directAddrPtr_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
faEdgeMapper(const faEdgeMapper&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const faEdgeMapper&);
|
||||
|
||||
|
||||
//- Calculate addressing
|
||||
void calcAddressing() const;
|
||||
|
||||
//- Clear out local storage
|
||||
void clearOut();
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
faEdgeMapper
|
||||
(
|
||||
const faMesh& mesh,
|
||||
const mapPolyMesh& mpm
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~faEdgeMapper();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return size
|
||||
virtual label size() const
|
||||
{
|
||||
return mesh_.nInternalEdges();
|
||||
}
|
||||
|
||||
//- Return size of field before mapping
|
||||
virtual label sizeBeforeMapping() const
|
||||
{
|
||||
return sizeBeforeMapping_;
|
||||
}
|
||||
|
||||
//- Is the mapping direct
|
||||
virtual bool direct() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual bool hasUnmapped() const
|
||||
{
|
||||
return hasUnmapped_;
|
||||
}
|
||||
|
||||
//- Return direct addressing
|
||||
virtual const labelUList& directAddressing() const;
|
||||
|
||||
//- Return interpolated addressing
|
||||
virtual const labelListList& addressing() const;
|
||||
|
||||
//- Return interpolaion weights
|
||||
virtual const scalarListList& weights() const;
|
||||
|
||||
//- Are there any inserted faces
|
||||
virtual bool insertedObjects() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//- Return list of inserted faces
|
||||
virtual const labelList& insertedObjectLabels() const
|
||||
{
|
||||
return labelList::null();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
66
src/finiteArea/faMesh/faMeshMapper/faMeshMapper.C
Normal file
66
src/finiteArea/faMesh/faMeshMapper/faMeshMapper.C
Normal file
@ -0,0 +1,66 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd |
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2016-2017 Wikki Ltd
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "faMeshMapper.H"
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::faMeshMapper::faMeshMapper
|
||||
(
|
||||
const faMesh& mesh,
|
||||
const mapPolyMesh& mpm
|
||||
)
|
||||
:
|
||||
mesh_(mesh),
|
||||
nOldPoints_(mesh.nPoints()),
|
||||
nOldEdges_(mesh.nEdges()),
|
||||
nOldInternalEdges_(mesh.nInternalEdges()),
|
||||
nOldFaces_(mesh.nFaces()),
|
||||
oldPatchSizes_(mesh.boundary().size(), 0),
|
||||
oldPatchStarts_(mesh.boundary().size(), -1),
|
||||
oldPatchEdgeFaces_(mesh.boundary().size()),
|
||||
areaMap_(mesh, mpm),
|
||||
edgeMap_(mesh, mpm),
|
||||
boundaryMap_(mesh, mpm)
|
||||
{
|
||||
// Capture old patch information
|
||||
const faBoundaryMesh& patches = mesh.boundary();
|
||||
|
||||
forAll (patches, patchI)
|
||||
{
|
||||
oldPatchSizes_[patchI] = patches[patchI].size();
|
||||
oldPatchStarts_[patchI] = patches[patchI].start();
|
||||
|
||||
oldPatchEdgeFaces_[patchI] = patches[patchI].edgeFaces();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
221
src/finiteArea/faMesh/faMeshMapper/faMeshMapper.H
Normal file
221
src/finiteArea/faMesh/faMeshMapper/faMeshMapper.H
Normal file
@ -0,0 +1,221 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd |
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2016-2017 Wikki Ltd
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::faMeshMapper
|
||||
|
||||
Description
|
||||
Class holds all the necessary information for mapping fields associated
|
||||
with faMesh
|
||||
|
||||
Note
|
||||
In order to capture all necessary mesh sizes and mapping data, mapper
|
||||
is created with the OLD mesh, and provides new mesh data.
|
||||
In the process, field mapping information is assembled from the old faMesh
|
||||
and the mapping data
|
||||
|
||||
Author
|
||||
Zeljko Tukovic, FMENA
|
||||
Hrvoje Jasak, Wikki Ltd.
|
||||
|
||||
SourceFiles
|
||||
faMeshMapper.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef faMeshMapper_H
|
||||
#define faMeshMapper_H
|
||||
|
||||
#include "faceMapper.H"
|
||||
#include "faAreaMapper.H"
|
||||
#include "faEdgeMapper.H"
|
||||
#include "faBoundaryMeshMapper.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
class faMesh;
|
||||
class mapPolyMesh;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class faMeshMapper Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class faMeshMapper
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Reference to mesh
|
||||
const faMesh& mesh_;
|
||||
|
||||
|
||||
// Old mesh data
|
||||
|
||||
//- Number of old points
|
||||
label nOldPoints_;
|
||||
|
||||
//- Number of old edges
|
||||
label nOldEdges_;
|
||||
|
||||
//- Number of old internal edges
|
||||
label nOldInternalEdges_;
|
||||
|
||||
//- Number of old faces
|
||||
label nOldFaces_;
|
||||
|
||||
//- Old patch sizes
|
||||
labelList oldPatchSizes_;
|
||||
|
||||
//- Old patch starts
|
||||
labelList oldPatchStarts_;
|
||||
|
||||
//- Old patch edgeFaces
|
||||
labelListList oldPatchEdgeFaces_;
|
||||
|
||||
|
||||
// Mappers
|
||||
|
||||
//- Area mapper
|
||||
faAreaMapper areaMap_;
|
||||
|
||||
//- Edge mapper
|
||||
faEdgeMapper edgeMap_;
|
||||
|
||||
//- Boundary mapper
|
||||
faBoundaryMeshMapper boundaryMap_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
faMeshMapper(const faMeshMapper&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const faMeshMapper&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
faMeshMapper(const faMesh& mesh, const mapPolyMesh& mpm);
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return reference to mesh
|
||||
const faMesh& mesh() const
|
||||
{
|
||||
return mesh_;
|
||||
}
|
||||
|
||||
//- Return reference to objectRegistry storing fields. Can be
|
||||
// removed once fields stored on pointMesh.
|
||||
const objectRegistry& thisDb() const
|
||||
{
|
||||
return mesh_.thisDb();
|
||||
}
|
||||
|
||||
|
||||
// Basic sizing information
|
||||
|
||||
//- Return number of old points
|
||||
label nOldPoints() const
|
||||
{
|
||||
return nOldPoints_;
|
||||
}
|
||||
|
||||
//- Return number of old edges
|
||||
label nOldEdges() const
|
||||
{
|
||||
return nOldEdges_;
|
||||
};
|
||||
|
||||
//- Return number of old internal edges
|
||||
label nOldInternalEdges() const
|
||||
{
|
||||
return nOldInternalEdges_;
|
||||
};
|
||||
|
||||
//- Return number of old faces
|
||||
label nOldFaces() const
|
||||
{
|
||||
return nOldFaces_;
|
||||
};
|
||||
|
||||
//- Return old patch sizes
|
||||
const labelList& oldPatchSizes() const
|
||||
{
|
||||
return oldPatchSizes_;
|
||||
};
|
||||
|
||||
//- Return old patch starts
|
||||
const labelList& oldPatchStarts() const
|
||||
{
|
||||
return oldPatchStarts_;
|
||||
};
|
||||
|
||||
//- Return old patch edgeFaces
|
||||
const labelListList& oldPatchEdgeFaces() const
|
||||
{
|
||||
return oldPatchEdgeFaces_;
|
||||
};
|
||||
|
||||
|
||||
// Mappers
|
||||
|
||||
//- Return surface mapper
|
||||
const faAreaMapper& areaMap() const
|
||||
{
|
||||
return areaMap_;
|
||||
}
|
||||
|
||||
//- Return edge mapper
|
||||
const faEdgeMapper& edgeMap() const
|
||||
{
|
||||
return edgeMap_;
|
||||
}
|
||||
|
||||
//- Return boundary mapper
|
||||
const faBoundaryMeshMapper& boundaryMap() const
|
||||
{
|
||||
return boundaryMap_;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
162
src/finiteArea/faMesh/faMeshMapper/faPatchMapper.C
Normal file
162
src/finiteArea/faMesh/faMeshMapper/faPatchMapper.C
Normal file
@ -0,0 +1,162 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd |
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2016-2017 Wikki Ltd
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "faPatchMapper.H"
|
||||
#include "faPatch.H"
|
||||
#include "faBoundaryMesh.H"
|
||||
#include "faMesh.H"
|
||||
#include "mapPolyMesh.H"
|
||||
#include "faceMapper.H"
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::faPatchMapper::calcAddressing() const
|
||||
{
|
||||
if (directAddrPtr_)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"void faPatchMapper::calcAddressing() const)"
|
||||
) << "Addressing already calculated"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
// Compatibility change HJ, 12/Aug/2017
|
||||
hasUnmapped_ = false;
|
||||
|
||||
directAddrPtr_ = new labelList(patch_.size(), 0);
|
||||
labelList& addr = *directAddrPtr_;
|
||||
|
||||
// Make a map of old edgeFaces, giving edge index in patch given the new
|
||||
// face label next to the patch
|
||||
|
||||
// Create edge index lookup
|
||||
Map<label> edgeIndexLookup;
|
||||
|
||||
const labelList& reverseFaceMap = mpm_.reverseFaceMap();
|
||||
|
||||
forAll (oldEdgeFaces_, oefI)
|
||||
{
|
||||
if (reverseFaceMap[oldEdgeFaces_[oefI]] > -1)
|
||||
{
|
||||
// Face has survived. Insert its label under new face index
|
||||
edgeIndexLookup.insert(reverseFaceMap[oldEdgeFaces_[oefI]], oefI);
|
||||
}
|
||||
}
|
||||
|
||||
// Go through new edgeFaces and for each edge try to locate old index
|
||||
const labelList& ef = patch_.edgeFaces();
|
||||
|
||||
forAll (ef, efI)
|
||||
{
|
||||
if (edgeIndexLookup.found(ef[efI]))
|
||||
{
|
||||
addr[efI] = edgeIndexLookup[ef[efI]];
|
||||
}
|
||||
else
|
||||
{
|
||||
// Not found: map from zero
|
||||
addr[efI] = 0;
|
||||
|
||||
// Compatibility change HJ, 12/Aug/2017
|
||||
hasUnmapped_ = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::faPatchMapper::clearOut()
|
||||
{
|
||||
deleteDemandDrivenData(directAddrPtr_);
|
||||
hasUnmapped_ = false;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
// Construct from components
|
||||
Foam::faPatchMapper::faPatchMapper
|
||||
(
|
||||
const faPatch& patch,
|
||||
const mapPolyMesh& mpm
|
||||
)
|
||||
:
|
||||
patch_(patch),
|
||||
mpm_(mpm),
|
||||
sizeBeforeMapping_(patch.size()),
|
||||
oldEdgeFaces_(patch.edgeFaces()),
|
||||
hasUnmapped_(false),
|
||||
directAddrPtr_(NULL)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::faPatchMapper::~faPatchMapper()
|
||||
{
|
||||
clearOut();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
const Foam::labelUList& Foam::faPatchMapper::directAddressing() const
|
||||
{
|
||||
if (!directAddrPtr_)
|
||||
{
|
||||
calcAddressing();
|
||||
}
|
||||
|
||||
return *directAddrPtr_;
|
||||
}
|
||||
|
||||
|
||||
const Foam::labelListList& Foam::faPatchMapper::addressing() const
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"const labelListList& faPatchMapper::addressing() const"
|
||||
) << "Requested interpolative addressing for a direct mapper."
|
||||
<< abort(FatalError);
|
||||
|
||||
return labelListList::null();
|
||||
}
|
||||
|
||||
|
||||
const Foam::scalarListList& Foam::faPatchMapper::weights() const
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"const scalarListList& faPatchMapper::weights() const"
|
||||
) << "Requested interpolative weights for a direct mapper."
|
||||
<< abort(FatalError);
|
||||
|
||||
return scalarListList::null();
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
166
src/finiteArea/faMesh/faMeshMapper/faPatchMapper.H
Normal file
166
src/finiteArea/faMesh/faMeshMapper/faPatchMapper.H
Normal file
@ -0,0 +1,166 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd |
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2016-2017 Wikki Ltd
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::faPatchMapper
|
||||
|
||||
Description
|
||||
Mapping class for a faPatchField. Edge mapping is calculated based on
|
||||
faceCells comparison of old and new patch
|
||||
|
||||
Author
|
||||
Zeljko Tukovic, FMENA
|
||||
Hrvoje Jasak, Wikki Ltd.
|
||||
|
||||
SourceFiles
|
||||
faPatchMapper.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef faPatchMapper_H
|
||||
#define faPatchMapper_H
|
||||
|
||||
#include "faPatchFieldMapper.H"
|
||||
#include "faceMapper.H"
|
||||
#include "faPatch.H"
|
||||
#include "primitiveFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
class faPatch;
|
||||
class mapPolyMesh;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class faPatchMapper Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class faPatchMapper
|
||||
:
|
||||
public faPatchFieldMapper
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Reference to patch
|
||||
const faPatch& patch_;
|
||||
|
||||
//- Reference to mapPolyMesh
|
||||
const mapPolyMesh& mpm_;
|
||||
|
||||
//- Size before mapping
|
||||
const label sizeBeforeMapping_;
|
||||
|
||||
//- faceCells before mapping
|
||||
const labelList oldEdgeFaces_;
|
||||
|
||||
|
||||
// Demand-driven private data
|
||||
|
||||
mutable bool hasUnmapped_;
|
||||
|
||||
//- Direct addressing
|
||||
mutable labelList* directAddrPtr_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
faPatchMapper(const faPatchMapper&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const faPatchMapper&);
|
||||
|
||||
|
||||
//- Calculate addressing for mapping with inserted cells
|
||||
void calcAddressing() const;
|
||||
|
||||
//- Clear out local storage
|
||||
void clearOut();
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from mappers
|
||||
faPatchMapper
|
||||
(
|
||||
const faPatch& patch,
|
||||
const mapPolyMesh& mpm
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
virtual ~faPatchMapper();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return size
|
||||
virtual label size() const
|
||||
{
|
||||
return patch_.size();
|
||||
}
|
||||
|
||||
//- Return size of field before mapping
|
||||
virtual label sizeBeforeMapping() const
|
||||
{
|
||||
return sizeBeforeMapping_;
|
||||
}
|
||||
|
||||
//- Is the mapping direct
|
||||
virtual bool direct() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual bool hasUnmapped() const
|
||||
{
|
||||
return hasUnmapped_;
|
||||
}
|
||||
|
||||
//- Return direct addressing
|
||||
virtual const labelUList& directAddressing() const;
|
||||
|
||||
//- Return interpolated addressing
|
||||
virtual const labelListList& addressing() const;
|
||||
|
||||
//- Return interpolaion weights
|
||||
virtual const scalarListList& weights() const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
246
src/finiteArea/faMesh/faMeshUpdate.C
Normal file
246
src/finiteArea/faMesh/faMeshUpdate.C
Normal file
@ -0,0 +1,246 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd |
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2016-2017 Wikki Ltd
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "faMesh.H"
|
||||
#include "mapPolyMesh.H"
|
||||
#include "MapFaFields.H"
|
||||
#include "faMeshMapper.H"
|
||||
#include "areaFields.H"
|
||||
#include "edgeFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::faMesh::updateMesh(const mapPolyMesh& mpm)
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Info<< "bool faMesh::updateMesh(const mapPolyMesh& mpm) : "
|
||||
<< "Updating mesh" << endl;
|
||||
}
|
||||
|
||||
// if (!mpm.morphing())
|
||||
// {
|
||||
// // No topo change
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// Create fa mesh mapper, using the old mesh
|
||||
const faMeshMapper mapper(*this, mpm);
|
||||
|
||||
|
||||
// Rebuild mesh
|
||||
|
||||
// Cast away const for interface reasons. HJ, 12/Aug/2011
|
||||
faMesh& m = const_cast<faMesh&>(*this);
|
||||
|
||||
|
||||
// Clear existing mesh data
|
||||
clearOut();
|
||||
|
||||
// Set new labels
|
||||
m.faceLabels_ = mapper.areaMap().newFaceLabels();
|
||||
|
||||
const indirectPrimitivePatch& bp = patch();
|
||||
|
||||
// Collect patch data
|
||||
const label nTotalEdges = bp.nEdges();
|
||||
const label nInternalEdges = bp.nInternalEdges();
|
||||
const labelListList& edgeFaces = bp.edgeFaces();
|
||||
|
||||
labelListList patchEdges(boundary_.size());
|
||||
|
||||
// Special handling required for faces that have more than one edge
|
||||
// Each patch will be visited separately
|
||||
|
||||
labelList edgeToPatch(nTotalEdges - nInternalEdges, -1);
|
||||
const labelList& newFaceLabelsMap = mapper.areaMap().newFaceLabelsMap();
|
||||
|
||||
const labelListList& oldPatchEdgeFaces = mapper.oldPatchEdgeFaces();
|
||||
|
||||
forAll (oldPatchEdgeFaces, patchI)
|
||||
{
|
||||
labelList& curPatchEdges = patchEdges[patchI];
|
||||
curPatchEdges.setSize(nTotalEdges - nInternalEdges);
|
||||
label nCurPatchEdges = 0;
|
||||
|
||||
// Note: it is possible to pick up the old-to-new boundary patch
|
||||
// mapping, but currently this is not done. HJ, 13/Aug/2011
|
||||
|
||||
// Make a fast lookup
|
||||
labelHashSet oldFaceLookup(oldPatchEdgeFaces[patchI]);
|
||||
|
||||
for (label edgeI = nInternalEdges; edgeI < nTotalEdges; edgeI++)
|
||||
{
|
||||
if (edgeToPatch[edgeI - nInternalEdges] > -1)
|
||||
{
|
||||
// Edge already found; continue with the next one
|
||||
continue;
|
||||
}
|
||||
|
||||
// Boundary edges will only have one face next to them
|
||||
const label oldFaceIndex = newFaceLabelsMap[edgeFaces[edgeI][0]];
|
||||
|
||||
if (oldFaceIndex > -1)
|
||||
{
|
||||
// Old face exists. See if it has got an edge in this patch
|
||||
if (oldFaceLookup.found(oldFaceIndex))
|
||||
{
|
||||
// Face found, add it to the patch
|
||||
curPatchEdges[nCurPatchEdges] = edgeI;
|
||||
nCurPatchEdges++;
|
||||
|
||||
edgeToPatch[edgeI - nInternalEdges] = patchI;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Collected all faces for the current patch
|
||||
curPatchEdges.setSize(nCurPatchEdges);
|
||||
}
|
||||
|
||||
// Set new edges for all patches
|
||||
forAll (m.boundary_, patchI)
|
||||
{
|
||||
m.boundary_[patchI].resetEdges(patchEdges[patchI]);
|
||||
}
|
||||
|
||||
m.setPrimitiveMeshData();
|
||||
|
||||
// Create global mesh data
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
globalData();
|
||||
}
|
||||
|
||||
// Calculate topology for the patches (processor-processor comms etc.)
|
||||
m.boundary_.updateMesh();
|
||||
|
||||
// Calculate the geometry for the patches (transformation tensors etc.)
|
||||
m.boundary_.calcGeometry();
|
||||
|
||||
|
||||
// Map fields
|
||||
mapFields(mapper);
|
||||
|
||||
// Map old areas
|
||||
mapOldAreas(mapper);
|
||||
|
||||
// Update edge interpolation
|
||||
edgeInterpolation::movePoints();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void Foam::faMesh::mapFields(const faMeshMapper& mapper) const
|
||||
{
|
||||
// Map all the areaFields in the objectRegistry
|
||||
MapGeometricFields<scalar, faPatchField, faMeshMapper, areaMesh>(mapper);
|
||||
MapGeometricFields<vector, faPatchField, faMeshMapper, areaMesh>(mapper);
|
||||
MapGeometricFields<sphericalTensor, faPatchField, faMeshMapper, areaMesh>
|
||||
(mapper);
|
||||
MapGeometricFields<symmTensor, faPatchField, faMeshMapper, areaMesh>
|
||||
(mapper);
|
||||
MapGeometricFields<tensor, faPatchField, faMeshMapper, areaMesh>(mapper);
|
||||
|
||||
// Map all the edgeFields in the objectRegistry
|
||||
MapGeometricFields<scalar, faePatchField, faMeshMapper, edgeMesh>(mapper);
|
||||
MapGeometricFields<vector, faePatchField, faMeshMapper, edgeMesh>(mapper);
|
||||
MapGeometricFields<sphericalTensor, faePatchField, faMeshMapper, edgeMesh>
|
||||
(mapper);
|
||||
MapGeometricFields<symmTensor, faePatchField, faMeshMapper, edgeMesh>
|
||||
(mapper);
|
||||
MapGeometricFields<tensor, faePatchField, faMeshMapper, edgeMesh>(mapper);
|
||||
}
|
||||
|
||||
|
||||
void Foam::faMesh::mapOldAreas(const faMeshMapper& mapper) const
|
||||
{
|
||||
if (S0Ptr_)
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
InfoIn("void faMesh::mapOldAreas(const faMeshMapper& mapper)")
|
||||
<< "Mapping old face areas." << endl;
|
||||
}
|
||||
|
||||
scalarField& S0 = *S0Ptr_;
|
||||
|
||||
scalarField savedS0(S0);
|
||||
S0.setSize(nFaces());
|
||||
|
||||
const labelList& faceMap = mapper.areaMap().newFaceLabelsMap();
|
||||
|
||||
// Map existing old areas; for new faces set area to zero
|
||||
forAll (faceMap, faceI)
|
||||
{
|
||||
if (faceMap[faceI] > -1)
|
||||
{
|
||||
S0[faceI] = savedS0[faceMap[faceI]];
|
||||
}
|
||||
else
|
||||
{
|
||||
S0[faceI] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (S00Ptr_)
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
InfoIn("void faMesh::mapOldAreas(const faMeshMapper& mapper)")
|
||||
<< "Mapping old-old face areas." << endl;
|
||||
}
|
||||
|
||||
scalarField& S00 = *S00Ptr_;
|
||||
|
||||
scalarField savedS00(S00);
|
||||
S00.setSize(nFaces());
|
||||
|
||||
const labelList& faceMap = mapper.areaMap().newFaceLabelsMap();
|
||||
|
||||
// Map old areas for existing faces; for new faces, set area to zero
|
||||
forAll (faceMap, faceI)
|
||||
{
|
||||
if (faceMap[faceI] > -1)
|
||||
{
|
||||
S00[faceI] = savedS00[faceMap[faceI]];
|
||||
}
|
||||
else
|
||||
{
|
||||
S00[faceI] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
132
src/finiteArea/faMesh/faPatches/basic/coupled/coupledFaPatch.C
Normal file
132
src/finiteArea/faMesh/faPatches/basic/coupled/coupledFaPatch.C
Normal file
@ -0,0 +1,132 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd |
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2016-2017 Wikki Ltd
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "coupledFaPatch.H"
|
||||
#include "transform.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(coupledFaPatch, 0);
|
||||
|
||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||
|
||||
void coupledFaPatch::calcTransformTensors
|
||||
(
|
||||
const vector& Cf,
|
||||
const vector& Cr,
|
||||
const vector& nf,
|
||||
const vector& nr
|
||||
) const
|
||||
{
|
||||
if (mag(nf & nr) < 1 - SMALL)
|
||||
{
|
||||
separation_.setSize(0);
|
||||
|
||||
forwardT_ = tensorField(1, rotationTensor(-nr, nf));
|
||||
reverseT_ = tensorField(1, rotationTensor(nf, -nr));
|
||||
}
|
||||
else
|
||||
{
|
||||
forwardT_.setSize(0);
|
||||
reverseT_.setSize(0);
|
||||
|
||||
vector separation = (nf & (Cr - Cf))*nf;
|
||||
|
||||
if (mag(separation) > SMALL)
|
||||
{
|
||||
separation_ = vectorField(1, separation);
|
||||
}
|
||||
else
|
||||
{
|
||||
separation_.setSize(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void coupledFaPatch::calcTransformTensors
|
||||
(
|
||||
const vectorField& Cf,
|
||||
const vectorField& Cr,
|
||||
const vectorField& nf,
|
||||
const vectorField& nr
|
||||
) const
|
||||
{
|
||||
if (sum(mag(nf & nr)) < Cf.size() - SMALL)
|
||||
{
|
||||
separation_.setSize(0);
|
||||
|
||||
forwardT_.setSize(size());
|
||||
reverseT_.setSize(size());
|
||||
|
||||
forAll (forwardT_, facei)
|
||||
{
|
||||
forwardT_[facei] = rotationTensor(-nr[facei], nf[facei]);
|
||||
reverseT_[facei] = rotationTensor(nf[facei], -nr[facei]);
|
||||
}
|
||||
|
||||
if (sum(mag(forwardT_ - forwardT_[0])) < SMALL)
|
||||
{
|
||||
forwardT_.setSize(1);
|
||||
reverseT_.setSize(1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
forwardT_.setSize(0);
|
||||
reverseT_.setSize(0);
|
||||
|
||||
separation_ = (nf&(Cr - Cf))*nf;
|
||||
|
||||
if (sum(mag(separation_)) < SMALL)
|
||||
{
|
||||
separation_.setSize(0);
|
||||
}
|
||||
else if (sum(mag(separation_ - separation_[0])) < SMALL)
|
||||
{
|
||||
separation_.setSize(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
coupledFaPatch::~coupledFaPatch()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
279
src/finiteArea/faMesh/faPatches/basic/coupled/coupledFaPatch.H
Normal file
279
src/finiteArea/faMesh/faPatches/basic/coupled/coupledFaPatch.H
Normal file
@ -0,0 +1,279 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd |
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2016-2017 Wikki Ltd
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
coupledFaPatch
|
||||
|
||||
Author
|
||||
Zeljko Tukovic and Hrvoje Jasak
|
||||
|
||||
Description
|
||||
coupledFaPatch is an abstract base class for patches that couple regions
|
||||
of the computational domain e.g. cyclic, arbitrary interfaces, sliding
|
||||
interfaces and processor-processor links.
|
||||
|
||||
SourceFiles
|
||||
coupledFaPatch.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef coupledFaPatch_H
|
||||
#define coupledFaPatch_H
|
||||
|
||||
#include "lduInterface.H"
|
||||
#include "faPatch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class coupledFaPatch Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class coupledFaPatch
|
||||
:
|
||||
public lduInterface,
|
||||
public faPatch
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- offset (distance) vector from one side of the couple to the other
|
||||
mutable vectorField separation_;
|
||||
|
||||
//- Face transformation tensor
|
||||
mutable tensorField forwardT_;
|
||||
|
||||
//- Neighbour-cell transformation tensor
|
||||
mutable tensorField reverseT_;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- Make patch weighting factors
|
||||
virtual void makeWeights(scalarField&) const = 0;
|
||||
|
||||
//- Make patch face - neighbour cell distances
|
||||
virtual void makeDeltaCoeffs(scalarField&) const = 0;
|
||||
|
||||
//- Calculate the uniform transformation tensors
|
||||
void calcTransformTensors
|
||||
(
|
||||
const vector& Cf,
|
||||
const vector& Cr,
|
||||
const vector& nf,
|
||||
const vector& nr
|
||||
) const;
|
||||
|
||||
//- Calculate the transformation tensors
|
||||
void calcTransformTensors
|
||||
(
|
||||
const vectorField& Cf,
|
||||
const vectorField& Cr,
|
||||
const vectorField& nf,
|
||||
const vectorField& nr
|
||||
) const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("coupled");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
coupledFaPatch
|
||||
(
|
||||
const word& name,
|
||||
const labelList& edgeLabels,
|
||||
const label index,
|
||||
const faBoundaryMesh& bm,
|
||||
const label ngbPolyPatchIndex
|
||||
)
|
||||
:
|
||||
faPatch(name, edgeLabels, index, bm, ngbPolyPatchIndex)
|
||||
{}
|
||||
|
||||
//- Construct from dictionary
|
||||
coupledFaPatch
|
||||
(
|
||||
const word& name,
|
||||
const dictionary& dict,
|
||||
const label index,
|
||||
const faBoundaryMesh& bm
|
||||
)
|
||||
:
|
||||
faPatch(name, dict, index, bm)
|
||||
{}
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~coupledFaPatch();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Access
|
||||
|
||||
//- Return true because this patch is coupled
|
||||
virtual bool coupled() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//- Are the coupled planes separated
|
||||
bool separated() const
|
||||
{
|
||||
return separation_.size();
|
||||
}
|
||||
|
||||
//- Return the offset (distance) vector from one side of the couple
|
||||
// to the other
|
||||
const vectorField& separation() const
|
||||
{
|
||||
if (!separation_.size())
|
||||
{
|
||||
FatalErrorIn("coupledFaPatch::separation() const")
|
||||
<< "Coupled patches are not separated"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
return separation_;
|
||||
}
|
||||
|
||||
//- Return face transformation tensor
|
||||
const tensorField& forwardT() const
|
||||
{
|
||||
if (!forwardT_.size())
|
||||
{
|
||||
FatalErrorIn("coupledFaPatch::forwardT() const")
|
||||
<< "Coupled planes do not need transformation"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
return forwardT_;
|
||||
}
|
||||
|
||||
//- Return neighbour-cell transformation tensor
|
||||
const tensorField& reverseT() const
|
||||
{
|
||||
if (!reverseT_.size())
|
||||
{
|
||||
FatalErrorIn("coupledFaPatch::forwardT() const")
|
||||
<< "Coupled planes do not need transformation"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
return reverseT_;
|
||||
}
|
||||
|
||||
//- Are the cyclic planes parallel
|
||||
bool parallel() const
|
||||
{
|
||||
return forwardT_.size() == 0;
|
||||
}
|
||||
|
||||
|
||||
//- Initialise the calculation of the patch geometry
|
||||
virtual void initGeometry() = 0;
|
||||
|
||||
//- Calculate the patch geometry
|
||||
virtual void calcGeometry() = 0;
|
||||
|
||||
//- Initialise the patches for moving points
|
||||
virtual void initMovePoints(const pointField&) = 0;
|
||||
|
||||
//- Correct patches after moving points
|
||||
virtual void movePoints(const pointField&) = 0;
|
||||
|
||||
|
||||
// Access functions for demand driven data
|
||||
|
||||
//- Return delta (P to N) vectors across coupled patch
|
||||
virtual tmp<vectorField> delta() const = 0;
|
||||
|
||||
|
||||
// Interface transfer functions
|
||||
|
||||
//- Return faceCell addressing: lduInterface virtual function
|
||||
virtual const labelUList& faceCells() const
|
||||
{
|
||||
return edgeFaces();
|
||||
}
|
||||
|
||||
//- Return the values of the given internal data adjacent to
|
||||
// the interface as a field
|
||||
virtual tmp<labelField> interfaceInternalField
|
||||
(
|
||||
const labelUList& internalData
|
||||
) const = 0;
|
||||
|
||||
//- Initialise interface data transfer
|
||||
virtual void initTransfer
|
||||
(
|
||||
const Pstream::commsTypes commsType,
|
||||
const labelUList& interfaceData
|
||||
) const
|
||||
{}
|
||||
|
||||
//- Transfer and return neighbour field
|
||||
virtual tmp<labelField> transfer
|
||||
(
|
||||
const Pstream::commsTypes commsType,
|
||||
const labelUList& interfaceData
|
||||
) const = 0;
|
||||
|
||||
//- Initialise neighbour field transfer
|
||||
virtual void initInternalFieldTransfer
|
||||
(
|
||||
const Pstream::commsTypes commsType,
|
||||
labelUList& iF
|
||||
) const
|
||||
{}
|
||||
|
||||
//- Return neighbour field
|
||||
virtual tmp<labelField> internalFieldTransfer
|
||||
(
|
||||
const Pstream::commsTypes commsType,
|
||||
const labelUList& iF
|
||||
) const = 0;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,356 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd |
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2016-2017 Wikki Ltd
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "cyclicFaPatch.H"
|
||||
#include "coupledPolyPatch.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "transform.H"
|
||||
#include "faMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(cyclicFaPatch, 0);
|
||||
addToRunTimeSelectionTable(faPatch, cyclicFaPatch, dictionary);
|
||||
|
||||
const Foam::scalar cyclicFaPatch::matchTol_ = 1e-3;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::cyclicFaPatch::calcTransforms()
|
||||
{
|
||||
if (size() > 0)
|
||||
{
|
||||
pointField half0Ctrs(size()/2);
|
||||
pointField half1Ctrs(size()/2);
|
||||
for (label i=0; i<size()/2; i++)
|
||||
{
|
||||
half0Ctrs[i] = this->edgeCentres()[i];
|
||||
half1Ctrs[i] = this->edgeCentres()[i+size()/2];
|
||||
}
|
||||
|
||||
vectorField half0Normals(size()/2);
|
||||
vectorField half1Normals(size()/2);
|
||||
|
||||
vectorField eN = edgeNormals()*magEdgeLengths();
|
||||
|
||||
scalar maxMatchError = 0;
|
||||
label errorEdge = -1;
|
||||
|
||||
for (label edgei = 0; edgei < size()/2; edgei++)
|
||||
{
|
||||
half0Normals[edgei] = eN[edgei];
|
||||
label nbrEdgei = edgei + size()/2;
|
||||
half1Normals[edgei] = eN[nbrEdgei];
|
||||
|
||||
scalar magLe = mag(half0Normals[edgei]);
|
||||
scalar nbrMagLe = mag(half1Normals[edgei]);
|
||||
scalar avLe = (magLe + nbrMagLe)/2.0;
|
||||
|
||||
if (magLe < ROOTVSMALL && nbrMagLe < ROOTVSMALL)
|
||||
{
|
||||
// Undetermined normal. Use dummy normal to force separation
|
||||
// check. (note use of sqrt(VSMALL) since that is how mag
|
||||
// scales)
|
||||
half0Normals[edgei] = point(1, 0, 0);
|
||||
half1Normals[edgei] = half0Normals[edgei];
|
||||
}
|
||||
else if(mag(magLe - nbrMagLe)/avLe > matchTol_)
|
||||
{
|
||||
// Error in area matching. Find largest error
|
||||
maxMatchError =
|
||||
Foam::max(maxMatchError, mag(magLe - nbrMagLe)/avLe);
|
||||
errorEdge = edgei;
|
||||
}
|
||||
else
|
||||
{
|
||||
half0Normals[edgei] /= magLe;
|
||||
half1Normals[edgei] /= nbrMagLe;
|
||||
}
|
||||
}
|
||||
|
||||
// Check for error in edge matching
|
||||
if (maxMatchError > matchTol_)
|
||||
{
|
||||
label nbrEdgei = errorEdge + size()/2;
|
||||
scalar magLe = mag(half0Normals[errorEdge]);
|
||||
scalar nbrMagLe = mag(half1Normals[errorEdge]);
|
||||
scalar avLe = (magLe + nbrMagLe)/2.0;
|
||||
|
||||
FatalErrorIn
|
||||
(
|
||||
"cyclicFaPatch::calcTransforms()"
|
||||
) << "edge " << errorEdge
|
||||
<< " area does not match neighbour "
|
||||
<< nbrEdgei << " by "
|
||||
<< 100*mag(magLe - nbrMagLe)/avLe
|
||||
<< "% -- possible edge ordering problem." << endl
|
||||
<< "patch:" << name()
|
||||
<< " my area:" << magLe
|
||||
<< " neighbour area:" << nbrMagLe
|
||||
<< " matching tolerance:" << matchTol_
|
||||
<< endl
|
||||
<< "Mesh edge:" << start() + errorEdge
|
||||
<< endl
|
||||
<< "Neighbour edge:" << start() + nbrEdgei
|
||||
<< endl
|
||||
<< "Other errors also exist, only the largest is reported. "
|
||||
<< "Please rerun with cyclic debug flag set"
|
||||
<< " for more information." << exit(FatalError);
|
||||
}
|
||||
|
||||
// Calculate transformation tensors
|
||||
calcTransformTensors
|
||||
(
|
||||
half0Ctrs,
|
||||
half1Ctrs,
|
||||
half0Normals,
|
||||
half1Normals
|
||||
);
|
||||
|
||||
// Check transformation tensors
|
||||
if (!parallel())
|
||||
{
|
||||
if (forwardT().size() > 1 || reverseT().size() > 1)
|
||||
{
|
||||
SeriousErrorIn
|
||||
(
|
||||
"void cyclicFaPatch::calcTransforms()"
|
||||
) << "Transformation tensor is not constant for the cyclic "
|
||||
<< "patch. Please reconsider your setup and definition of "
|
||||
<< "cyclic boundaries." << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Make patch weighting factors
|
||||
void cyclicFaPatch::makeWeights(scalarField& w) const
|
||||
{
|
||||
const scalarField& magL = magEdgeLengths();
|
||||
|
||||
scalarField deltas = edgeNormals() & faPatch::delta();
|
||||
label sizeby2 = deltas.size()/2;
|
||||
|
||||
scalar maxMatchError = 0;
|
||||
label errorEdge = -1;
|
||||
|
||||
for (label edgei = 0; edgei < sizeby2; edgei++)
|
||||
{
|
||||
scalar avL = (magL[edgei] + magL[edgei + sizeby2])/2.0;
|
||||
|
||||
if
|
||||
(
|
||||
mag(magL[edgei] - magL[edgei + sizeby2])/avL
|
||||
> matchTol_
|
||||
)
|
||||
{
|
||||
// Found error. Look for largest matching error
|
||||
maxMatchError =
|
||||
Foam::max
|
||||
(
|
||||
maxMatchError,
|
||||
mag(magL[edgei] - magL[edgei + sizeby2])/avL
|
||||
);
|
||||
|
||||
errorEdge = edgei;
|
||||
}
|
||||
|
||||
scalar di = deltas[edgei];
|
||||
scalar dni = deltas[edgei + sizeby2];
|
||||
|
||||
w[edgei] = dni/(di + dni);
|
||||
w[edgei + sizeby2] = 1 - w[edgei];
|
||||
}
|
||||
|
||||
// Check for error in matching
|
||||
if (maxMatchError > matchTol_)
|
||||
{
|
||||
scalar avL = (magL[errorEdge] + magL[errorEdge + sizeby2])/2.0;
|
||||
|
||||
FatalErrorIn("cyclicFaPatch::makeWeights(scalarField& w) const")
|
||||
<< "edge " << errorEdge << " and " << errorEdge + sizeby2
|
||||
<< " areas do not match by "
|
||||
<< 100*mag(magL[errorEdge] - magL[errorEdge + sizeby2])/avL
|
||||
<< "% -- possible edge ordering problem." << nl
|
||||
<< "Cyclic area match tolerance = "
|
||||
<< matchTol_ << " patch: " << name()
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Make patch edge - neighbour cell distances
|
||||
void cyclicFaPatch::makeDeltaCoeffs(scalarField& dc) const
|
||||
{
|
||||
scalarField deltas = edgeNormals() & faPatch::delta();
|
||||
label sizeby2 = deltas.size()/2;
|
||||
|
||||
for (label edgei = 0; edgei < sizeby2; edgei++)
|
||||
{
|
||||
scalar di = deltas[edgei];
|
||||
scalar dni = deltas[edgei + sizeby2];
|
||||
|
||||
dc[edgei] = 1.0/(di + dni);
|
||||
dc[edgei + sizeby2] = dc[edgei];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::cyclicFaPatch::initGeometry()
|
||||
{
|
||||
faPatch::initGeometry();
|
||||
}
|
||||
|
||||
|
||||
void Foam::cyclicFaPatch::calcGeometry()
|
||||
{
|
||||
faPatch::calcGeometry();
|
||||
calcTransforms();
|
||||
}
|
||||
|
||||
|
||||
void Foam::cyclicFaPatch::initMovePoints(const pointField& p)
|
||||
{
|
||||
faPatch::initMovePoints(p);
|
||||
}
|
||||
|
||||
|
||||
void Foam::cyclicFaPatch::movePoints(const pointField& p)
|
||||
{
|
||||
faPatch::movePoints(p);
|
||||
calcTransforms();
|
||||
}
|
||||
|
||||
// Return delta (P to N) vectors across coupled patch
|
||||
tmp<vectorField> cyclicFaPatch::delta() const
|
||||
{
|
||||
vectorField patchD = faPatch::delta();
|
||||
label sizeby2 = patchD.size()/2;
|
||||
|
||||
tmp<vectorField> tpdv(new vectorField(patchD.size()));
|
||||
vectorField& pdv = tpdv.ref();
|
||||
|
||||
// Do the transformation if necessary
|
||||
if (parallel())
|
||||
{
|
||||
for (label edgei = 0; edgei < sizeby2; edgei++)
|
||||
{
|
||||
vector ddi = patchD[edgei];
|
||||
vector dni = patchD[edgei + sizeby2];
|
||||
|
||||
pdv[edgei] = ddi - dni;
|
||||
pdv[edgei + sizeby2] = -pdv[edgei];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (label edgei = 0; edgei < sizeby2; edgei++)
|
||||
{
|
||||
vector ddi = patchD[edgei];
|
||||
vector dni = patchD[edgei + sizeby2];
|
||||
|
||||
pdv[edgei] = ddi - transform(forwardT()[0], dni);
|
||||
pdv[edgei + sizeby2] = -transform(reverseT()[0], pdv[edgei]);
|
||||
}
|
||||
}
|
||||
|
||||
return tpdv;
|
||||
}
|
||||
|
||||
|
||||
label Foam::cyclicPolyPatch::neighbPatchID() const
|
||||
{
|
||||
NotImplemented;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
tmp<labelField> cyclicFaPatch::interfaceInternalField
|
||||
(
|
||||
const labelUList& internalData
|
||||
) const
|
||||
{
|
||||
return patchInternalField(internalData);
|
||||
}
|
||||
|
||||
|
||||
tmp<labelField> cyclicFaPatch::transfer
|
||||
(
|
||||
const Pstream::commsTypes,
|
||||
const labelUList& interfaceData
|
||||
) const
|
||||
{
|
||||
tmp<labelField> tpnf(new labelField(this->size()));
|
||||
labelField& pnf = tpnf.ref();
|
||||
|
||||
label sizeby2 = this->size()/2;
|
||||
|
||||
for (label edgei=0; edgei<sizeby2; edgei++)
|
||||
{
|
||||
pnf[edgei] = interfaceData[edgei + sizeby2];
|
||||
pnf[edgei + sizeby2] = interfaceData[edgei];
|
||||
}
|
||||
|
||||
return tpnf;
|
||||
}
|
||||
|
||||
|
||||
tmp<labelField> cyclicFaPatch::internalFieldTransfer
|
||||
(
|
||||
const Pstream::commsTypes commsType,
|
||||
const labelUList& iF
|
||||
) const
|
||||
{
|
||||
const labelUList& edgeCells = this->faceCells();
|
||||
|
||||
tmp<labelField> tpnf(new labelField(this->size()));
|
||||
labelField& pnf = tpnf.ref();
|
||||
|
||||
label sizeby2 = this->size()/2;
|
||||
|
||||
for (label edgei=0; edgei<sizeby2; edgei++)
|
||||
{
|
||||
pnf[edgei] = iF[edgeCells[edgei + sizeby2]];
|
||||
pnf[edgei + sizeby2] = iF[edgeCells[edgei]];
|
||||
}
|
||||
|
||||
return tpnf;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,201 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd |
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2016-2017 Wikki Ltd
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::cyclicFaPatch
|
||||
|
||||
Description
|
||||
Cyclic-plane patch.
|
||||
|
||||
Author
|
||||
Zeljko Tukovic, FMENA
|
||||
Hrvoje Jasak, Wikki Ltd.
|
||||
|
||||
SourceFiles
|
||||
cyclicFaPatch.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef cyclicFaPatch_H
|
||||
#define cyclicFaPatch_H
|
||||
|
||||
#include "coupledFaPatch.H"
|
||||
#include "cyclicLduInterface.H"
|
||||
#include "cyclicPolyPatch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class cyclicFaPatch Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class cyclicFaPatch
|
||||
:
|
||||
public coupledFaPatch,
|
||||
public cyclicLduInterface
|
||||
{
|
||||
// Private data
|
||||
|
||||
// Private member functions
|
||||
|
||||
void calcTransforms();
|
||||
|
||||
protected:
|
||||
|
||||
// Protected static data
|
||||
|
||||
//- Relative tolerance (for geometric matching). Is factor of
|
||||
// maximum edge length per face.
|
||||
static const scalar matchTol_;
|
||||
|
||||
// Protected Member functions
|
||||
|
||||
//- Make patch weighting factors
|
||||
void makeWeights(scalarField&) const;
|
||||
|
||||
//- Make patch face - neighbour cell distances
|
||||
void makeDeltaCoeffs(scalarField&) const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("cyclic");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from dictionary
|
||||
cyclicFaPatch
|
||||
(
|
||||
const word& name,
|
||||
const dictionary& dict,
|
||||
const label index,
|
||||
const faBoundaryMesh& bm
|
||||
)
|
||||
:
|
||||
coupledFaPatch(name, dict, index, bm)
|
||||
{}
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~cyclicFaPatch()
|
||||
{}
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
// Access
|
||||
|
||||
//- Is this the master side? Yes: it contains both sets of faces
|
||||
virtual bool master() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//- Return neighbour
|
||||
virtual label neighbPatchID() const
|
||||
{
|
||||
NotImplemented;
|
||||
return index();
|
||||
}
|
||||
|
||||
virtual bool owner() const
|
||||
{
|
||||
return master();
|
||||
}
|
||||
|
||||
//- Return processor number
|
||||
virtual const cyclicLduInterface& neighbPatch() const
|
||||
{
|
||||
NotImplemented;
|
||||
return *this;
|
||||
}
|
||||
|
||||
//- Return face transformation tensor
|
||||
virtual const tensorField& forwardT() const
|
||||
{
|
||||
return coupledFaPatch::forwardT();
|
||||
}
|
||||
|
||||
//- Return neighbour-cell transformation tensor
|
||||
virtual const tensorField& reverseT() const
|
||||
{
|
||||
return coupledFaPatch::reverseT();
|
||||
}
|
||||
|
||||
//- Initialise the calculation of the patch geometry
|
||||
virtual void initGeometry();
|
||||
|
||||
//- Calculate the patch geometry
|
||||
virtual void calcGeometry();
|
||||
|
||||
//- Initialise the patches for moving points
|
||||
virtual void initMovePoints(const pointField&);
|
||||
|
||||
//- Correct patches after moving points
|
||||
virtual void movePoints(const pointField&);
|
||||
|
||||
//- Return delta (P to N) vectors across coupled patch
|
||||
virtual tmp<vectorField> delta() const;
|
||||
|
||||
|
||||
// Interface transfer functions
|
||||
|
||||
//- Return the values of the given internal data adjacent to
|
||||
// the interface as a field
|
||||
virtual tmp<labelField> interfaceInternalField
|
||||
(
|
||||
const labelUList& internalData
|
||||
) const;
|
||||
|
||||
//- Transfer and return neighbour field
|
||||
virtual tmp<labelField> transfer
|
||||
(
|
||||
const Pstream::commsTypes commsType,
|
||||
const labelUList& interfaceData
|
||||
) const;
|
||||
|
||||
//- Return neighbour field
|
||||
virtual tmp<labelField> internalFieldTransfer
|
||||
(
|
||||
const Pstream::commsTypes commsType,
|
||||
const labelUList& internalData
|
||||
) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,63 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd |
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2016-2017 Wikki Ltd
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "emptyFaPatch.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Patch name
|
||||
defineTypeNameAndDebug(emptyFaPatch, 0);
|
||||
|
||||
// Add the patch constructor functions to the hash tables
|
||||
addToRunTimeSelectionTable(faPatch, emptyFaPatch, dictionary);
|
||||
|
||||
// Over-riding the face normals return from the underlying patch
|
||||
// This is the only piece of info used out of the underlying primitivePatch
|
||||
// I choose to store it there because it is used in primitive patch operations
|
||||
// and it should not be duplicated as before. However, to ensure everything
|
||||
// in the empty patch is sized to zero, we shall here return a regerence to
|
||||
// a zero-sized field (it does not matter what the field is
|
||||
//
|
||||
// const vectorField& emptyFaPatch::edgeNormals() const
|
||||
// {
|
||||
// return faceAreas();
|
||||
// }
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
139
src/finiteArea/faMesh/faPatches/constraint/empty/emptyFaPatch.H
Normal file
139
src/finiteArea/faMesh/faPatches/constraint/empty/emptyFaPatch.H
Normal file
@ -0,0 +1,139 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd |
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2016-2017 Wikki Ltd
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
emptyFaPatch
|
||||
|
||||
Description
|
||||
A patch which will not exist in the faMesh. Typical example is a front and
|
||||
back plane of a 2-D geometry
|
||||
|
||||
Author
|
||||
Zeljko Tukovic, FMENA
|
||||
Hrvoje Jasak, Wikki Ltd.
|
||||
|
||||
SourceFiles
|
||||
emptyFaPatch.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef emptyFaPatch_H
|
||||
#define emptyFaPatch_H
|
||||
|
||||
#include "faPatch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class emptyFaPatch Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class emptyFaPatch
|
||||
:
|
||||
public faPatch
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("empty");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
emptyFaPatch
|
||||
(
|
||||
const word& name,
|
||||
const labelList& edgeLabels,
|
||||
const label index,
|
||||
const faBoundaryMesh& bm,
|
||||
const label ngbPolyPatchIndex
|
||||
)
|
||||
:
|
||||
faPatch(name, edgeLabels, index, bm, ngbPolyPatchIndex)
|
||||
{}
|
||||
|
||||
//- Construct from dictionary
|
||||
emptyFaPatch
|
||||
(
|
||||
const word& name,
|
||||
const dictionary& dict,
|
||||
const label index,
|
||||
const faBoundaryMesh& bm
|
||||
)
|
||||
:
|
||||
faPatch(name, dict, index, bm)
|
||||
{}
|
||||
|
||||
//- Construct and return a clone, resetting the edge list
|
||||
// and boundary mesh
|
||||
virtual autoPtr<faPatch> clone
|
||||
(
|
||||
const faBoundaryMesh& bm,
|
||||
const labelList& edgeLabels,
|
||||
const label index,
|
||||
const label ngbPolyPatchIndex
|
||||
) const
|
||||
{
|
||||
return autoPtr<faPatch>
|
||||
(
|
||||
new emptyFaPatch
|
||||
(
|
||||
name(),
|
||||
edgeLabels,
|
||||
index,
|
||||
bm,
|
||||
ngbPolyPatchIndex
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Member Functions
|
||||
|
||||
virtual label size() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
//- Return face normals. Over-riding base class return to get zero size
|
||||
//
|
||||
// virtual const vectorField& edgeNormals() const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,534 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd |
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2016-2017 Wikki Ltd
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "processorFaPatch.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "IPstream.H"
|
||||
#include "OPstream.H"
|
||||
#include "transformField.H"
|
||||
#include "faBoundaryMesh.H"
|
||||
#include "faMesh.H"
|
||||
#include "globalMeshData.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(processorFaPatch, 0);
|
||||
addToRunTimeSelectionTable(faPatch, processorFaPatch, dictionary);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
processorFaPatch::~processorFaPatch()
|
||||
{
|
||||
deleteDemandDrivenData(neighbPointsPtr_);
|
||||
deleteDemandDrivenData(nonGlobalPatchPointsPtr_);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::label Foam::processorFaPatch::comm() const
|
||||
{
|
||||
return boundaryMesh().mesh().comm();
|
||||
}
|
||||
|
||||
|
||||
int Foam::processorFaPatch::tag() const
|
||||
{
|
||||
return Pstream::msgType();
|
||||
}
|
||||
|
||||
|
||||
void processorFaPatch::makeNonGlobalPatchPoints() const
|
||||
{
|
||||
// If it is not runing parallel or there are no global points
|
||||
// create a 1->1 map
|
||||
|
||||
// Can not use faGlobalMeshData at this point yet
|
||||
|
||||
if
|
||||
(
|
||||
!Pstream::parRun()
|
||||
|| !boundaryMesh().mesh()().globalData().nGlobalPoints()
|
||||
// || !boundaryMesh().mesh().globalData().nGlobalPoints()
|
||||
)
|
||||
{
|
||||
nonGlobalPatchPointsPtr_ = new labelList(nPoints());
|
||||
labelList& ngpp = *nonGlobalPatchPointsPtr_;
|
||||
forAll(ngpp, i)
|
||||
{
|
||||
ngpp[i] = i;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
// Get reference to shared points
|
||||
const labelList& sharedPoints =
|
||||
boundaryMesh().mesh()().globalData().sharedPointLabels();
|
||||
|
||||
nonGlobalPatchPointsPtr_ = new labelList(nPoints());
|
||||
labelList& ngpp = *nonGlobalPatchPointsPtr_;
|
||||
|
||||
const labelList& faMeshPatchPoints = pointLabels();
|
||||
|
||||
const labelList& meshPoints =
|
||||
boundaryMesh().mesh().patch().meshPoints();
|
||||
|
||||
label noFiltPoints = 0;
|
||||
|
||||
forAll (faMeshPatchPoints, pointI)
|
||||
{
|
||||
label curP = meshPoints[faMeshPatchPoints[pointI]];
|
||||
|
||||
bool found = false;
|
||||
|
||||
forAll (sharedPoints, sharedI)
|
||||
{
|
||||
if (sharedPoints[sharedI] == curP)
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found)
|
||||
{
|
||||
ngpp[noFiltPoints] = pointI;
|
||||
noFiltPoints++;
|
||||
}
|
||||
}
|
||||
|
||||
ngpp.setSize(noFiltPoints);
|
||||
|
||||
|
||||
// // Get reference to shared points
|
||||
// const labelList& sharedPoints =
|
||||
// boundaryMesh().mesh().globalData().sharedPointLabels();
|
||||
|
||||
// nonGlobalPatchPointsPtr_ = new labelList(nPoints());
|
||||
// labelList& ngpp = *nonGlobalPatchPointsPtr_;
|
||||
|
||||
// const labelList& patchPoints = pointLabels();
|
||||
|
||||
// label noFiltPoints = 0;
|
||||
|
||||
// forAll (patchPoints, pointI)
|
||||
// {
|
||||
// label curP = patchPoints[pointI];
|
||||
|
||||
// bool found = false;
|
||||
|
||||
// forAll (sharedPoints, pI)
|
||||
// {
|
||||
// if (sharedPoints[pI] == curP)
|
||||
// {
|
||||
// found = true;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
// if (!found)
|
||||
// {
|
||||
// ngpp[noFiltPoints] = pointI;
|
||||
// noFiltPoints++;
|
||||
// }
|
||||
// }
|
||||
|
||||
// ngpp.setSize(noFiltPoints);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void processorFaPatch::initGeometry()
|
||||
{
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
OPstream toNeighbProc
|
||||
(
|
||||
Pstream::commsTypes::blocking,
|
||||
neighbProcNo(),
|
||||
3*(sizeof(label) + size()*sizeof(vector))
|
||||
);
|
||||
|
||||
toNeighbProc
|
||||
<< edgeCentres()
|
||||
<< edgeLengths()
|
||||
<< edgeFaceCentres();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void processorFaPatch::calcGeometry()
|
||||
{
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
{
|
||||
IPstream fromNeighbProc
|
||||
(
|
||||
Pstream::commsTypes::blocking,
|
||||
neighbProcNo(),
|
||||
3*(sizeof(label) + size()*sizeof(vector))
|
||||
);
|
||||
fromNeighbProc
|
||||
>> neighbEdgeCentres_
|
||||
>> neighbEdgeLengths_
|
||||
>> neighbEdgeFaceCentres_;
|
||||
}
|
||||
|
||||
const scalarField& magEl = magEdgeLengths();
|
||||
|
||||
forAll(magEl, edgei)
|
||||
{
|
||||
scalar nmagEl = mag(neighbEdgeLengths_[edgei]);
|
||||
scalar avEl = (magEl[edgei] + nmagEl)/2.0;
|
||||
|
||||
if (mag(magEl[edgei] - nmagEl)/avEl > 1e-6)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"processorFvPatch::makeWeights(scalarField& w) const"
|
||||
) << "edge " << edgei
|
||||
<< " length does not match neighbour by "
|
||||
<< 100*mag(magEl[edgei] - nmagEl)/avEl
|
||||
<< "% -- possible edge ordering problem"
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
calcTransformTensors
|
||||
(
|
||||
edgeCentres(),
|
||||
neighbEdgeCentres_,
|
||||
edgeNormals(),
|
||||
neighbEdgeLengths_/mag(neighbEdgeLengths_)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void processorFaPatch::initMovePoints(const pointField& p)
|
||||
{
|
||||
faPatch::movePoints(p);
|
||||
initGeometry();
|
||||
}
|
||||
|
||||
|
||||
void processorFaPatch::movePoints(const pointField&)
|
||||
{
|
||||
calcGeometry();
|
||||
}
|
||||
|
||||
|
||||
void processorFaPatch::initUpdateMesh()
|
||||
{
|
||||
// For completeness
|
||||
faPatch::initUpdateMesh();
|
||||
|
||||
deleteDemandDrivenData(neighbPointsPtr_);
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
// Express all points as patch edge and index in edge.
|
||||
labelList patchEdge(nPoints());
|
||||
labelList indexInEdge(nPoints());
|
||||
|
||||
const edgeList::subList patchEdges =
|
||||
patchSlice(boundaryMesh().mesh().edges());
|
||||
|
||||
const labelListList& ptEdges = pointEdges();
|
||||
|
||||
for (label patchPointI = 0; patchPointI < nPoints(); patchPointI++)
|
||||
{
|
||||
label edgeI = ptEdges[patchPointI][0];
|
||||
|
||||
patchEdge[patchPointI] = edgeI;
|
||||
|
||||
const edge& e = patchEdges[edgeI];
|
||||
|
||||
indexInEdge[patchPointI] =
|
||||
findIndex
|
||||
(
|
||||
e,
|
||||
pointLabels()[patchPointI]
|
||||
);
|
||||
}
|
||||
|
||||
OPstream toNeighbProc
|
||||
(
|
||||
Pstream::commsTypes::blocking,
|
||||
neighbProcNo(),
|
||||
2*sizeof(label) + 2*nPoints()*sizeof(label)
|
||||
);
|
||||
|
||||
toNeighbProc
|
||||
<< patchEdge
|
||||
<< indexInEdge;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void processorFaPatch::updateMesh()
|
||||
{
|
||||
// For completeness
|
||||
faPatch::updateMesh();
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
labelList nbrPatchEdge(nPoints());
|
||||
labelList nbrIndexInEdge(nPoints());
|
||||
|
||||
{
|
||||
// Note cannot predict exact size since edgeList not (yet) sent as
|
||||
// binary entity but as List of edges.
|
||||
IPstream fromNeighbProc
|
||||
(
|
||||
Pstream::commsTypes::blocking,
|
||||
neighbProcNo()
|
||||
);
|
||||
|
||||
fromNeighbProc
|
||||
>> nbrPatchEdge
|
||||
>> nbrIndexInEdge;
|
||||
}
|
||||
|
||||
if (nbrPatchEdge.size() == nPoints())
|
||||
{
|
||||
// Convert neighbour edges and indices into face back into
|
||||
// my edges and points.
|
||||
neighbPointsPtr_ = new labelList(nPoints());
|
||||
labelList& neighbPoints = *neighbPointsPtr_;
|
||||
|
||||
const edgeList::subList patchEdges =
|
||||
patchSlice(boundaryMesh().mesh().edges());
|
||||
|
||||
forAll(nbrPatchEdge, nbrPointI)
|
||||
{
|
||||
// Find edge and index in edge on this side.
|
||||
const edge& e = patchEdges[nbrPatchEdge[nbrPointI]];
|
||||
|
||||
label index = 1 - nbrIndexInEdge[nbrPointI];
|
||||
|
||||
label patchPointI = findIndex(pointLabels(), e[index]);
|
||||
|
||||
neighbPoints[patchPointI] = nbrPointI;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Differing number of points. Probably patch includes
|
||||
// part of a cyclic.
|
||||
neighbPointsPtr_ = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const labelList& processorFaPatch::neighbPoints() const
|
||||
{
|
||||
if (!neighbPointsPtr_)
|
||||
{
|
||||
// Was probably created from cyclic patch and hence the
|
||||
// number of edges or points might differ on both
|
||||
// sides of the processor patch since one side might have
|
||||
// it merged with another bit of geometry
|
||||
|
||||
FatalErrorIn("processorFaPatch::neighbPoints() const")
|
||||
<< "No extended addressing calculated for patch " << name()
|
||||
<< nl
|
||||
<< "This can happen if the number of points on both"
|
||||
<< " sides of the two coupled patches differ." << nl
|
||||
<< "This happens if the processorPatch was constructed from"
|
||||
<< " part of a cyclic patch."
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
return *neighbPointsPtr_;
|
||||
}
|
||||
|
||||
|
||||
// Make patch weighting factors
|
||||
void processorFaPatch::makeWeights(scalarField& w) const
|
||||
{
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
// The face normals point in the opposite direction on the other side
|
||||
scalarField neighbEdgeCentresCn
|
||||
(
|
||||
(
|
||||
neighbEdgeLengths()
|
||||
/mag(neighbEdgeLengths())
|
||||
)
|
||||
& (
|
||||
neighbEdgeCentres()
|
||||
- neighbEdgeFaceCentres())
|
||||
);
|
||||
|
||||
w = neighbEdgeCentresCn/
|
||||
(
|
||||
(edgeNormals() & faPatch::delta())
|
||||
+ neighbEdgeCentresCn
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
w = 1.0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Make patch edge - neighbour face distances
|
||||
void processorFaPatch::makeDeltaCoeffs(scalarField& dc) const
|
||||
{
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
dc = (1.0 - weights())/(edgeNormals() & faPatch::delta());
|
||||
}
|
||||
else
|
||||
{
|
||||
dc = 1.0/(edgeNormals() & faPatch::delta());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Return delta (P to N) vectors across coupled patch
|
||||
tmp<vectorField> processorFaPatch::delta() const
|
||||
{
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
// To the transformation if necessary
|
||||
if (parallel())
|
||||
{
|
||||
return
|
||||
faPatch::delta()
|
||||
- (
|
||||
neighbEdgeCentres()
|
||||
- neighbEdgeFaceCentres()
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
return
|
||||
faPatch::delta()
|
||||
- transform
|
||||
(
|
||||
forwardT(),
|
||||
(
|
||||
neighbEdgeCentres()
|
||||
- neighbEdgeFaceCentres()
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return faPatch::delta();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const labelList& processorFaPatch::nonGlobalPatchPoints() const
|
||||
{
|
||||
if (!nonGlobalPatchPointsPtr_)
|
||||
{
|
||||
makeNonGlobalPatchPoints();
|
||||
}
|
||||
|
||||
return *nonGlobalPatchPointsPtr_;
|
||||
}
|
||||
|
||||
tmp<labelField> processorFaPatch::interfaceInternalField
|
||||
(
|
||||
const labelUList& internalData
|
||||
) const
|
||||
{
|
||||
return patchInternalField(internalData);
|
||||
}
|
||||
|
||||
|
||||
void processorFaPatch::initTransfer
|
||||
(
|
||||
const Pstream::commsTypes commsType,
|
||||
const labelUList& interfaceData
|
||||
) const
|
||||
{
|
||||
send(commsType, interfaceData);
|
||||
}
|
||||
|
||||
|
||||
tmp<labelField> processorFaPatch::transfer
|
||||
(
|
||||
const Pstream::commsTypes commsType,
|
||||
const labelUList&
|
||||
) const
|
||||
{
|
||||
return receive<label>(commsType, this->size());
|
||||
}
|
||||
|
||||
|
||||
void processorFaPatch::initInternalFieldTransfer
|
||||
(
|
||||
const Pstream::commsTypes commsType,
|
||||
const labelUList& iF
|
||||
) const
|
||||
{
|
||||
send(commsType, patchInternalField(iF)());
|
||||
}
|
||||
|
||||
|
||||
tmp<labelField> processorFaPatch::internalFieldTransfer
|
||||
(
|
||||
const Pstream::commsTypes commsType,
|
||||
const labelUList&
|
||||
) const
|
||||
{
|
||||
return receive<label>(commsType, this->size());
|
||||
}
|
||||
|
||||
|
||||
// Write
|
||||
void processorFaPatch::write(Ostream& os) const
|
||||
{
|
||||
faPatch::write(os);
|
||||
os.writeKeyword("myProcNo") << myProcNo_
|
||||
<< token::END_STATEMENT << nl;
|
||||
os.writeKeyword("neighbProcNo") << neighbProcNo_
|
||||
<< token::END_STATEMENT << nl;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,315 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd |
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2016-2017 Wikki Ltd
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
processorFaPatch
|
||||
|
||||
Description
|
||||
Processor patch.
|
||||
|
||||
Author
|
||||
Zeljko Tukovic, FMENA
|
||||
Hrvoje Jasak, Wikki Ltd.
|
||||
|
||||
SourceFiles
|
||||
processorFaPatch.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef processorFaPatch_H
|
||||
#define processorFaPatch_H
|
||||
|
||||
#include "coupledFaPatch.H"
|
||||
#include "processorLduInterface.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class processorFaPatch Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class processorFaPatch
|
||||
:
|
||||
public coupledFaPatch,
|
||||
public processorLduInterface
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- My processro number
|
||||
int myProcNo_;
|
||||
|
||||
//- Neighbour processor number
|
||||
int neighbProcNo_;
|
||||
|
||||
//- Processor-neighbbour patch edge centres
|
||||
vectorField neighbEdgeCentres_;
|
||||
|
||||
//- Processor-neighbbour patch edge lengths
|
||||
vectorField neighbEdgeLengths_;
|
||||
|
||||
//- Processor-neighbbour patch neighbour face centres
|
||||
vectorField neighbEdgeFaceCentres_;
|
||||
|
||||
//- Corresponding neighbouring local point label for every local point
|
||||
// (so localPoints()[i] == neighb.localPoints()[neighbPoints_[i]])
|
||||
mutable labelList* neighbPointsPtr_;
|
||||
|
||||
//- The set of labels of the processor patch points which are
|
||||
// non-global, i.e. present in this processor patch
|
||||
mutable labelList* nonGlobalPatchPointsPtr_;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected Member functions
|
||||
|
||||
//- Make patch weighting factors
|
||||
void makeWeights(scalarField&) const;
|
||||
|
||||
//- Make patch face - neighbour cell distances
|
||||
void makeDeltaCoeffs(scalarField&) const;
|
||||
|
||||
//- Find non-globa patch points
|
||||
void makeNonGlobalPatchPoints() const;
|
||||
|
||||
|
||||
// Geometry functions
|
||||
|
||||
//- Initialise the calculation of the patch geometry
|
||||
void initGeometry();
|
||||
|
||||
//- Calculate the patch geometry
|
||||
void calcGeometry();
|
||||
|
||||
//- Initialise the patches for moving points
|
||||
void initMovePoints(const pointField&);
|
||||
|
||||
//- Correct patches after moving points
|
||||
void movePoints(const pointField&);
|
||||
|
||||
//- Initialise the update of the patch topology
|
||||
virtual void initUpdateMesh();
|
||||
|
||||
//- Update of the patch topology
|
||||
virtual void updateMesh();
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
// TypeName(processorPolyPatch::typeName_());
|
||||
TypeName("processor");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
processorFaPatch
|
||||
(
|
||||
const word& name,
|
||||
const labelList& edgeLabels,
|
||||
const label index,
|
||||
const faBoundaryMesh& bm,
|
||||
const label ngbPolyPatchIndex,
|
||||
const label myProcNo,
|
||||
const label neighbProcNo
|
||||
)
|
||||
:
|
||||
coupledFaPatch(name, edgeLabels, index, bm, ngbPolyPatchIndex),
|
||||
myProcNo_(myProcNo),
|
||||
neighbProcNo_(neighbProcNo),
|
||||
neighbEdgeCentres_(),
|
||||
neighbEdgeLengths_(),
|
||||
neighbEdgeFaceCentres_(),
|
||||
neighbPointsPtr_(NULL),
|
||||
nonGlobalPatchPointsPtr_(NULL)
|
||||
{}
|
||||
|
||||
//- Construct from dictionary
|
||||
processorFaPatch
|
||||
(
|
||||
const word& name,
|
||||
const dictionary& dict,
|
||||
const label index,
|
||||
const faBoundaryMesh& bm
|
||||
)
|
||||
:
|
||||
coupledFaPatch(name, dict, index, bm),
|
||||
myProcNo_(readLabel(dict.lookup("myProcNo"))),
|
||||
neighbProcNo_(readLabel(dict.lookup("neighbProcNo"))),
|
||||
neighbEdgeCentres_(),
|
||||
neighbEdgeLengths_(),
|
||||
neighbEdgeFaceCentres_(),
|
||||
neighbPointsPtr_(NULL),
|
||||
nonGlobalPatchPointsPtr_(NULL)
|
||||
{}
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~processorFaPatch();
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
//- Return interface size
|
||||
virtual label interfaceSize() const
|
||||
{
|
||||
return size();
|
||||
}
|
||||
|
||||
//- Return processor number
|
||||
int myProcNo() const
|
||||
{
|
||||
return myProcNo_;
|
||||
}
|
||||
|
||||
//- Return neigbour processor number
|
||||
int neighbProcNo() const
|
||||
{
|
||||
return neighbProcNo_;
|
||||
}
|
||||
|
||||
//- Return true if running parallel
|
||||
virtual bool coupled() const
|
||||
{
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//- Is this the master side?
|
||||
virtual bool master() const
|
||||
{
|
||||
return (myProcNo_ < neighbProcNo_);
|
||||
}
|
||||
|
||||
|
||||
// Communications support
|
||||
|
||||
//- Return communicator used for communication
|
||||
virtual label comm() const;
|
||||
|
||||
//- Return message tag to use for communication
|
||||
virtual int tag() const;
|
||||
|
||||
|
||||
//- Return face transformation tensor
|
||||
virtual const tensorField& forwardT() const
|
||||
{
|
||||
return coupledFaPatch::forwardT();
|
||||
}
|
||||
|
||||
//- Return delta (P to N) vectors across coupled patch
|
||||
virtual tmp<vectorField> delta() const;
|
||||
|
||||
|
||||
//- Return processor-neighbbour patch edge centres
|
||||
const vectorField& neighbEdgeCentres() const
|
||||
{
|
||||
return neighbEdgeCentres_;
|
||||
}
|
||||
|
||||
//- Return processor-neighbbour patch edge lengths
|
||||
const vectorField& neighbEdgeLengths() const
|
||||
{
|
||||
return neighbEdgeLengths_;
|
||||
}
|
||||
|
||||
//- Return processor-neighbbour patch neighbour face centres
|
||||
const vectorField& neighbEdgeFaceCentres() const
|
||||
{
|
||||
return neighbEdgeFaceCentres_;
|
||||
}
|
||||
|
||||
//- Return neighbour point labels. This is for my local point the
|
||||
// corresponding local point on the other side. Call
|
||||
// faBoundaryMesh::updateMesh() on all processors
|
||||
// before using this.
|
||||
const labelList& neighbPoints() const;
|
||||
|
||||
//- Return the set of labels of the processor patch points which are
|
||||
// non-global, i.e. present in this processorFaPatch
|
||||
const labelList& nonGlobalPatchPoints() const;
|
||||
|
||||
|
||||
// Interface transfer functions
|
||||
|
||||
//- Return the values of the given internal data adjacent to
|
||||
// the interface as a field
|
||||
virtual tmp<labelField> interfaceInternalField
|
||||
(
|
||||
const labelUList& internalData
|
||||
) const;
|
||||
|
||||
//- Initialise interface data transfer
|
||||
virtual void initTransfer
|
||||
(
|
||||
const Pstream::commsTypes commsType,
|
||||
const labelUList& interfaceData
|
||||
) const;
|
||||
|
||||
//- Transfer and return neighbour field
|
||||
virtual tmp<labelField> transfer
|
||||
(
|
||||
const Pstream::commsTypes commsType,
|
||||
const labelUList& interfaceData
|
||||
) const;
|
||||
|
||||
//- Initialise neighbour field transfer
|
||||
virtual void initInternalFieldTransfer
|
||||
(
|
||||
const Pstream::commsTypes commsType,
|
||||
const labelUList& internalData
|
||||
) const;
|
||||
|
||||
//- Return neighbour field
|
||||
virtual tmp<labelField> internalFieldTransfer
|
||||
(
|
||||
const Pstream::commsTypes commsType,
|
||||
const labelUList& internalData
|
||||
) const;
|
||||
|
||||
//- Write the patch data as a dictionary
|
||||
virtual void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,92 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd |
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2016-2017 Wikki Ltd
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "symmetryFaPatch.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(symmetryFaPatch, 0);
|
||||
addToRunTimeSelectionTable(faPatch, symmetryFaPatch, dictionary);
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void symmetryFaPatch::makeCorrVecs(vectorField& cv) const
|
||||
{
|
||||
// Non-orthogonal correction not allowed. HJ, 16/Apr/2009
|
||||
cv = vector::zero;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Construct from components
|
||||
symmetryFaPatch::symmetryFaPatch
|
||||
(
|
||||
const word& name,
|
||||
const labelList& edgeLabels,
|
||||
const label index,
|
||||
const faBoundaryMesh& bm,
|
||||
const label ngbPolyPatchIndex
|
||||
)
|
||||
:
|
||||
faPatch(name, edgeLabels, index, bm, ngbPolyPatchIndex)
|
||||
{}
|
||||
|
||||
//- Construct from dictionary
|
||||
symmetryFaPatch::symmetryFaPatch
|
||||
(
|
||||
const word& name,
|
||||
const dictionary& dict,
|
||||
const label index,
|
||||
const faBoundaryMesh& bm
|
||||
)
|
||||
:
|
||||
faPatch(name, dict, index, bm)
|
||||
{
|
||||
if(ngbPolyPatchIndex() == -1)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"symmetryFaPatch::symmetryFaPatch(const word&, const dictionary&, const label, const faBoundaryMesh&)"
|
||||
) << "Neighbour polyPatch index is not specified for faPatch "
|
||||
<< this->name() << exit(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,130 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd |
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2016-2017 Wikki Ltd
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::symmetryFaPatch
|
||||
|
||||
Description
|
||||
Symmetry-plane patch.
|
||||
|
||||
Author
|
||||
Zeljko Tukovic, FMENA
|
||||
Hrvoje Jasak, Wikki Ltd.
|
||||
|
||||
SourceFiles
|
||||
symmetryFaPatch.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef symmetryFaPatch_H
|
||||
#define symmetryFaPatch_H
|
||||
|
||||
#include "faPatch.H"
|
||||
#include "symmetryPolyPatch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class symmetryFaPatch Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class symmetryFaPatch
|
||||
:
|
||||
public faPatch
|
||||
{
|
||||
|
||||
protected:
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- Make patch face non-orthogonality correction vectors
|
||||
virtual void makeCorrVecs(vectorField&) const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName(symmetryPolyPatch::typeName_());
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
symmetryFaPatch
|
||||
(
|
||||
const word& name,
|
||||
const labelList& edgeLabels,
|
||||
const label index,
|
||||
const faBoundaryMesh& bm,
|
||||
const label ngbPolyPatchIndex
|
||||
);
|
||||
|
||||
//- Construct from dictionary
|
||||
symmetryFaPatch
|
||||
(
|
||||
const word& name,
|
||||
const dictionary& dict,
|
||||
const label index,
|
||||
const faBoundaryMesh& bm
|
||||
);
|
||||
|
||||
//- Construct and return a clone, resetting the edge list
|
||||
// and boundary mesh
|
||||
virtual autoPtr<faPatch> clone
|
||||
(
|
||||
const faBoundaryMesh& bm,
|
||||
const labelList& edgeLabels,
|
||||
const label index,
|
||||
const label ngbPolyPatchIndex
|
||||
) const
|
||||
{
|
||||
return autoPtr<faPatch>
|
||||
(
|
||||
new symmetryFaPatch
|
||||
(
|
||||
name(), edgeLabels, index, bm, ngbPolyPatchIndex
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~symmetryFaPatch()
|
||||
{}
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
134
src/finiteArea/faMesh/faPatches/constraint/wedge/wedgeFaPatch.C
Normal file
134
src/finiteArea/faMesh/faPatches/constraint/wedge/wedgeFaPatch.C
Normal file
@ -0,0 +1,134 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd |
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2016-2017 Wikki Ltd
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "wedgeFaPatch.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "faBoundaryMesh.H"
|
||||
#include "wedgePolyPatch.H"
|
||||
#include "polyMesh.H"
|
||||
#include "faMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(wedgeFaPatch, 0);
|
||||
addToRunTimeSelectionTable(faPatch, wedgeFaPatch, dictionary);
|
||||
|
||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||
|
||||
void wedgeFaPatch::findAxisPoint() const
|
||||
{
|
||||
// Find axis point
|
||||
|
||||
labelList ptLabels = pointLabels();
|
||||
|
||||
labelListList ptEdges = pointEdges();
|
||||
|
||||
const vectorField& points = boundaryMesh().mesh().points();
|
||||
|
||||
const scalarField& magL = magEdgeLengths();
|
||||
|
||||
forAll(ptEdges, pointI)
|
||||
{
|
||||
if( ptEdges[pointI].size() == 1 )
|
||||
{
|
||||
scalar r = mag((I-axis()*axis())&points[ptLabels[pointI]]);
|
||||
|
||||
if( r < magL[ptEdges[pointI][0]] )
|
||||
{
|
||||
axisPoint_ = ptLabels[pointI];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
axisPointChecked_ = true;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
//- Construct from polyPatch
|
||||
wedgeFaPatch::wedgeFaPatch
|
||||
(
|
||||
const word& name,
|
||||
const dictionary& dict,
|
||||
const label index,
|
||||
const faBoundaryMesh& bm
|
||||
)
|
||||
:
|
||||
faPatch(name, dict, index, bm),
|
||||
wedgePolyPatchPtr_(NULL),
|
||||
axisPoint_(-1),
|
||||
axisPointChecked_(false)
|
||||
{
|
||||
if(ngbPolyPatchIndex() == -1)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"wedgeFaPatch::wedgeFaPatch(const word&, const dictionary&, const label, const faBoundaryMesh&)"
|
||||
) << "Neighbour polyPatch index is not specified for faPatch "
|
||||
<< this->name() << exit(FatalError);
|
||||
}
|
||||
|
||||
if
|
||||
(
|
||||
bm.mesh()().boundaryMesh()[ngbPolyPatchIndex()].type()
|
||||
== wedgePolyPatch::typeName
|
||||
)
|
||||
{
|
||||
const wedgePolyPatch& wedge =
|
||||
refCast<const wedgePolyPatch>
|
||||
(
|
||||
bm.mesh()().boundaryMesh()[ngbPolyPatchIndex()]
|
||||
);
|
||||
|
||||
wedgePolyPatchPtr_ = ∧
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"wedgeFaPatch::wedgeFaPatch(const word&, const dictionary&, const label, const faBoundaryMesh&)"
|
||||
) << "Neighbour polyPatch is not of type "
|
||||
<< wedgePolyPatch::typeName
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
146
src/finiteArea/faMesh/faPatches/constraint/wedge/wedgeFaPatch.H
Normal file
146
src/finiteArea/faMesh/faPatches/constraint/wedge/wedgeFaPatch.H
Normal file
@ -0,0 +1,146 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd |
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2016-2017 Wikki Ltd
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
wedgeFaPatch
|
||||
|
||||
Description
|
||||
Wedge front and back plane patch.
|
||||
|
||||
Author
|
||||
Zeljko Tukovic, FMENA
|
||||
Hrvoje Jasak, Wikki Ltd.
|
||||
|
||||
SourceFiles
|
||||
wedgeFaPatch.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef wedgeFaPatch_H
|
||||
#define wedgeFaPatch_H
|
||||
|
||||
#include "faPatch.H"
|
||||
#include "wedgePolyPatch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class wedgeFaPatch Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class wedgeFaPatch
|
||||
:
|
||||
public faPatch
|
||||
{
|
||||
// Private data
|
||||
|
||||
const wedgePolyPatch* wedgePolyPatchPtr_;
|
||||
|
||||
//- Axis point label
|
||||
mutable label axisPoint_;
|
||||
|
||||
//- Is it axis point looked for?
|
||||
mutable bool axisPointChecked_;
|
||||
|
||||
//- Finde axis point
|
||||
void findAxisPoint() const;
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("wedge");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from dictionary
|
||||
wedgeFaPatch
|
||||
(
|
||||
const word& name,
|
||||
const dictionary& dict,
|
||||
const label index,
|
||||
const faBoundaryMesh& bm
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~wedgeFaPatch()
|
||||
{}
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
// Access
|
||||
|
||||
//- Return axis of the wedge
|
||||
const vector& axis() const
|
||||
{
|
||||
return wedgePolyPatchPtr_->axis();
|
||||
}
|
||||
|
||||
//- Return plane normal between the wedge boundaries
|
||||
const vector& centreNormal() const
|
||||
{
|
||||
return wedgePolyPatchPtr_->centreNormal();
|
||||
}
|
||||
|
||||
//- Return face transformation tensor
|
||||
const tensor& edgeT() const
|
||||
{
|
||||
return wedgePolyPatchPtr_->faceT();
|
||||
}
|
||||
|
||||
//- Return neighbour-cell transformation tensor
|
||||
const tensor& faceT() const
|
||||
{
|
||||
return wedgePolyPatchPtr_->cellT();
|
||||
}
|
||||
|
||||
//- Return axis point label
|
||||
label axisPoint() const
|
||||
{
|
||||
if(axisPoint_ == -1 && !axisPointChecked_)
|
||||
{
|
||||
findAxisPoint();
|
||||
}
|
||||
|
||||
return axisPoint_;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
504
src/finiteArea/faMesh/faPatches/faPatch/faPatch.C
Normal file
504
src/finiteArea/faMesh/faPatches/faPatch/faPatch.C
Normal file
@ -0,0 +1,504 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd |
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2016-2017 Wikki Ltd
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "faPatch.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "faBoundaryMesh.H"
|
||||
#include "faMesh.H"
|
||||
#include "areaFields.H"
|
||||
#include "edgeFields.H"
|
||||
#include "polyMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(faPatch, 0);
|
||||
defineRunTimeSelectionTable(faPatch, dictionary);
|
||||
addToRunTimeSelectionTable(faPatch, faPatch, dictionary);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::faPatch::clearOut()
|
||||
{
|
||||
deleteDemandDrivenData(edgeFacesPtr_);
|
||||
deleteDemandDrivenData(pointLabelsPtr_);
|
||||
deleteDemandDrivenData(pointEdgesPtr_);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
// Construct from components
|
||||
Foam::faPatch::faPatch
|
||||
(
|
||||
const word& name,
|
||||
const labelList& edgeLabels,
|
||||
const label index,
|
||||
const faBoundaryMesh& bm,
|
||||
const label ngbPolyPatchIndex
|
||||
)
|
||||
:
|
||||
labelList(edgeLabels),
|
||||
patchIdentifier(name, index),
|
||||
ngbPolyPatchIndex_(ngbPolyPatchIndex),
|
||||
boundaryMesh_(bm),
|
||||
edgeFacesPtr_(NULL),
|
||||
pointLabelsPtr_(NULL),
|
||||
pointEdgesPtr_(NULL)
|
||||
{}
|
||||
|
||||
|
||||
// Construct from dictionary
|
||||
Foam::faPatch::faPatch
|
||||
(
|
||||
const word& name,
|
||||
const dictionary& dict,
|
||||
const label index,
|
||||
const faBoundaryMesh& bm
|
||||
)
|
||||
:
|
||||
labelList(dict.lookup("edgeLabels")),
|
||||
patchIdentifier(name, dict, index),
|
||||
ngbPolyPatchIndex_(readInt(dict.lookup("ngbPolyPatchIndex"))),
|
||||
boundaryMesh_(bm),
|
||||
edgeFacesPtr_(NULL),
|
||||
pointLabelsPtr_(NULL),
|
||||
pointEdgesPtr_(NULL)
|
||||
{}
|
||||
|
||||
Foam::faPatch::faPatch(const faPatch& p, const faBoundaryMesh& bm)
|
||||
:
|
||||
labelList(p),
|
||||
patchIdentifier(p, p.index()),
|
||||
ngbPolyPatchIndex_(p.ngbPolyPatchIndex_),
|
||||
boundaryMesh_(bm),
|
||||
edgeFacesPtr_(NULL),
|
||||
pointLabelsPtr_(NULL),
|
||||
pointEdgesPtr_(NULL)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::faPatch::~faPatch()
|
||||
{
|
||||
clearOut();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
Foam::label Foam::faPatch::ngbPolyPatchIndex() const
|
||||
{
|
||||
return ngbPolyPatchIndex_;
|
||||
}
|
||||
|
||||
const Foam::faBoundaryMesh& Foam::faPatch::boundaryMesh() const
|
||||
{
|
||||
return boundaryMesh_;
|
||||
}
|
||||
|
||||
|
||||
Foam::label Foam::faPatch::start() const
|
||||
{
|
||||
return boundaryMesh().mesh().patchStarts()[index()];
|
||||
}
|
||||
|
||||
|
||||
const Foam::labelList& Foam::faPatch::pointLabels() const
|
||||
{
|
||||
if (!pointLabelsPtr_)
|
||||
{
|
||||
calcPointLabels();
|
||||
}
|
||||
|
||||
return *pointLabelsPtr_;
|
||||
}
|
||||
|
||||
|
||||
void Foam::faPatch::calcPointLabels() const
|
||||
{
|
||||
SLList<label> labels;
|
||||
|
||||
UList<edge> edges =
|
||||
patchSlice(boundaryMesh().mesh().edges());
|
||||
|
||||
forAll(edges, edgeI)
|
||||
{
|
||||
bool existStart = false;
|
||||
bool existEnd = false;
|
||||
|
||||
for
|
||||
(
|
||||
SLList<label>::iterator iter = labels.begin();
|
||||
iter != labels.end();
|
||||
++iter
|
||||
)
|
||||
{
|
||||
if(*iter == edges[edgeI].start())
|
||||
{
|
||||
existStart = true;
|
||||
}
|
||||
|
||||
if(*iter == edges[edgeI].end())
|
||||
{
|
||||
existEnd = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(!existStart)
|
||||
{
|
||||
labels.append(edges[edgeI].start());
|
||||
}
|
||||
|
||||
if(!existEnd)
|
||||
{
|
||||
labels.append(edges[edgeI].end());
|
||||
}
|
||||
}
|
||||
|
||||
pointLabelsPtr_ = new labelList(labels);
|
||||
}
|
||||
|
||||
|
||||
void Foam::faPatch::calcPointEdges() const
|
||||
{
|
||||
labelList points = pointLabels();
|
||||
|
||||
const edgeList::subList e =
|
||||
patchSlice(boundaryMesh().mesh().edges());
|
||||
|
||||
// set up storage for pointEdges
|
||||
List<SLList<label> > pointEdgs(points.size());
|
||||
|
||||
forAll (e, edgeI)
|
||||
{
|
||||
const edge& curPoints = e[edgeI];
|
||||
|
||||
forAll (curPoints, pointI)
|
||||
{
|
||||
label localPointIndex =
|
||||
findIndex(points, curPoints[pointI]);
|
||||
|
||||
pointEdgs[localPointIndex].append(edgeI);
|
||||
}
|
||||
}
|
||||
|
||||
// sort out the list
|
||||
pointEdgesPtr_ = new labelListList(pointEdgs.size());
|
||||
labelListList& pEdges = *pointEdgesPtr_;
|
||||
|
||||
forAll (pointEdgs, pointI)
|
||||
{
|
||||
pEdges[pointI].setSize(pointEdgs[pointI].size());
|
||||
|
||||
label i = 0;
|
||||
for
|
||||
(
|
||||
SLList<label>::iterator curEdgesIter = pointEdgs[pointI].begin();
|
||||
curEdgesIter != pointEdgs[pointI].end();
|
||||
++curEdgesIter, ++i
|
||||
)
|
||||
{
|
||||
pEdges[pointI][i] = curEdgesIter();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const Foam::labelListList& Foam::faPatch::pointEdges() const
|
||||
{
|
||||
if (!pointEdgesPtr_)
|
||||
{
|
||||
calcPointEdges();
|
||||
}
|
||||
|
||||
return *pointEdgesPtr_;
|
||||
}
|
||||
|
||||
|
||||
Foam::labelList Foam::faPatch::ngbPolyPatchFaces() const
|
||||
{
|
||||
labelList ngbFaces;
|
||||
|
||||
if(ngbPolyPatchIndex() == -1)
|
||||
{
|
||||
return ngbFaces;
|
||||
}
|
||||
|
||||
ngbFaces.setSize(faPatch::size());
|
||||
|
||||
const faMesh& aMesh = boundaryMesh().mesh();
|
||||
const polyMesh& pMesh = aMesh();
|
||||
const indirectPrimitivePatch& patch = aMesh.patch();
|
||||
|
||||
const labelListList& edgeFaces = pMesh.edgeFaces();
|
||||
|
||||
labelList faceCells (patch.size(), -1);
|
||||
|
||||
forAll (faceCells, faceI)
|
||||
{
|
||||
label faceID = aMesh.faceLabels()[faceI];
|
||||
|
||||
faceCells[faceI] = pMesh.faceOwner()[faceID];
|
||||
}
|
||||
|
||||
labelList meshEdges =
|
||||
patch.meshEdges
|
||||
(
|
||||
pMesh.edges(),
|
||||
pMesh.cellEdges(),
|
||||
faceCells
|
||||
);
|
||||
|
||||
forAll(ngbFaces, edgeI)
|
||||
{
|
||||
ngbFaces[edgeI] = -1;
|
||||
|
||||
label curEdge = (*this)[edgeI];
|
||||
|
||||
label curPMeshEdge = meshEdges[curEdge];
|
||||
|
||||
forAll(edgeFaces[curPMeshEdge], faceI)
|
||||
{
|
||||
label curFace = edgeFaces[curPMeshEdge][faceI];
|
||||
|
||||
label curPatchID = pMesh.boundaryMesh().whichPatch(curFace);
|
||||
|
||||
if (curPatchID == ngbPolyPatchIndex())
|
||||
{
|
||||
ngbFaces[edgeI] = curFace;
|
||||
}
|
||||
}
|
||||
|
||||
if(ngbFaces[edgeI] == -1)
|
||||
{
|
||||
Info<< "faPatch::edgeNgbPolyPatchFaces(): "
|
||||
<< "Problem with determination of edge ngb faces!" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
return ngbFaces;
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::vectorField> Foam::faPatch::ngbPolyPatchFaceNormals() const
|
||||
{
|
||||
tmp<vectorField> tfN(new vectorField());
|
||||
vectorField& fN = tfN.ref();
|
||||
|
||||
if (ngbPolyPatchIndex() == -1)
|
||||
{
|
||||
return tfN;
|
||||
}
|
||||
|
||||
fN.setSize(faPatch::size());
|
||||
|
||||
labelList ngbFaces = ngbPolyPatchFaces();
|
||||
|
||||
const polyMesh& pMesh = boundaryMesh().mesh()();
|
||||
|
||||
const faceList& faces = pMesh.faces();
|
||||
const pointField& points = pMesh.points();
|
||||
|
||||
forAll(fN, faceI)
|
||||
{
|
||||
fN[faceI] = faces[ngbFaces[faceI]].normal(points)
|
||||
/faces[ngbFaces[faceI]].mag(points);
|
||||
}
|
||||
|
||||
return tfN;
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::vectorField> Foam::faPatch::ngbPolyPatchPointNormals() const
|
||||
{
|
||||
if (ngbPolyPatchIndex() == -1)
|
||||
{
|
||||
return tmp<vectorField>(new vectorField());
|
||||
}
|
||||
|
||||
labelListList pntEdges = pointEdges();
|
||||
|
||||
tmp<vectorField> tpN(new vectorField(pntEdges.size(), vector::zero));
|
||||
vectorField& pN = tpN.ref();
|
||||
|
||||
vectorField faceNormals = ngbPolyPatchFaceNormals();
|
||||
|
||||
forAll(pN, pointI)
|
||||
{
|
||||
forAll(pntEdges[pointI], edgeI)
|
||||
{
|
||||
pN[pointI] += faceNormals[pntEdges[pointI][edgeI]];
|
||||
}
|
||||
}
|
||||
|
||||
pN /= mag(pN);
|
||||
|
||||
return tpN;
|
||||
}
|
||||
|
||||
|
||||
const Foam::labelUList& Foam::faPatch::edgeFaces() const
|
||||
{
|
||||
if (!edgeFacesPtr_)
|
||||
{
|
||||
edgeFacesPtr_ = new labelList::subList
|
||||
(
|
||||
patchSlice(boundaryMesh().mesh().edgeOwner())
|
||||
);
|
||||
}
|
||||
|
||||
return *edgeFacesPtr_;
|
||||
}
|
||||
|
||||
|
||||
// Return the patch edge centres
|
||||
const Foam::vectorField& Foam::faPatch::edgeCentres() const
|
||||
{
|
||||
return boundaryMesh().mesh().edgeCentres().boundaryField()[index()];
|
||||
}
|
||||
|
||||
|
||||
// Return the patch edges length vectors
|
||||
const Foam::vectorField& Foam::faPatch::edgeLengths() const
|
||||
{
|
||||
return boundaryMesh().mesh().Le().boundaryField()[index()];
|
||||
}
|
||||
|
||||
|
||||
// Return the patch edge length magnitudes
|
||||
const Foam::scalarField& Foam::faPatch::magEdgeLengths() const
|
||||
{
|
||||
return boundaryMesh().mesh().magLe().boundaryField()[index()];
|
||||
}
|
||||
|
||||
|
||||
// Return the patch edge unit normals
|
||||
Foam::tmp<Foam::vectorField> Foam::faPatch::edgeNormals() const
|
||||
{
|
||||
tmp<vectorField> eN(new vectorField(size()));
|
||||
|
||||
eN.ref() = edgeLengths()/magEdgeLengths();
|
||||
|
||||
return eN;
|
||||
}
|
||||
|
||||
|
||||
// Return the patch edge neighbour face centres
|
||||
Foam::tmp<Foam::vectorField> Foam::faPatch::edgeFaceCentres() const
|
||||
{
|
||||
tmp<vectorField> tfc(new vectorField(size()));
|
||||
vectorField& fc = tfc.ref();
|
||||
|
||||
// get reference to global face centres
|
||||
const vectorField& gfc =
|
||||
boundaryMesh().mesh().areaCentres().internalField();
|
||||
|
||||
const labelUList& faceLabels = edgeFaces();
|
||||
|
||||
forAll (faceLabels, edgeI)
|
||||
{
|
||||
fc[edgeI] = gfc[faceLabels[edgeI]];
|
||||
}
|
||||
|
||||
return tfc;
|
||||
}
|
||||
|
||||
|
||||
// Return cell-centre to face-centre vector
|
||||
Foam::tmp<Foam::vectorField> Foam::faPatch::delta() const
|
||||
{
|
||||
return edgeCentres() - edgeFaceCentres();
|
||||
}
|
||||
|
||||
|
||||
// Make delta coefficients as patch face - neighbour cell distances
|
||||
void Foam::faPatch::makeDeltaCoeffs(scalarField& dc) const
|
||||
{
|
||||
dc = 1.0/(edgeNormals() & delta());
|
||||
}
|
||||
|
||||
|
||||
// Return delta coefficients
|
||||
const Foam::scalarField& Foam::faPatch::deltaCoeffs() const
|
||||
{
|
||||
return boundaryMesh().mesh().deltaCoeffs().boundaryField()[index()];
|
||||
}
|
||||
|
||||
|
||||
void Foam::faPatch::makeWeights(scalarField& w) const
|
||||
{
|
||||
w = 1.0;
|
||||
}
|
||||
|
||||
|
||||
const Foam::scalarField& Foam::faPatch::weights() const
|
||||
{
|
||||
return boundaryMesh().mesh().weights().boundaryField()[index()];
|
||||
}
|
||||
|
||||
|
||||
void Foam::faPatch::movePoints(const pointField& points)
|
||||
{}
|
||||
|
||||
|
||||
void Foam::faPatch::resetEdges(const labelList& newEdges)
|
||||
{
|
||||
Info<< "Resetting patch edges" << endl;
|
||||
labelList::operator=(newEdges);
|
||||
|
||||
clearOut();
|
||||
}
|
||||
|
||||
|
||||
void Foam::faPatch::write(Ostream& os) const
|
||||
{
|
||||
os.writeKeyword("type") << type() << token::END_STATEMENT << nl;
|
||||
patchIdentifier::write(os);
|
||||
|
||||
const labelList& edgeLabels = *this;
|
||||
edgeLabels.writeEntry("edgeLabels", os);
|
||||
os.writeKeyword("ngbPolyPatchIndex") << ngbPolyPatchIndex_
|
||||
<< token::END_STATEMENT << nl;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
||||
|
||||
Foam::Ostream& Foam::operator<<(Ostream& os, const faPatch& p)
|
||||
{
|
||||
p.write(os);
|
||||
os.check("Ostream& operator<<(Ostream& f, const faPatch& p)");
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
380
src/finiteArea/faMesh/faPatches/faPatch/faPatch.H
Normal file
380
src/finiteArea/faMesh/faPatches/faPatch/faPatch.H
Normal file
@ -0,0 +1,380 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd |
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2016-2017 Wikki Ltd
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
faPatch
|
||||
|
||||
Description
|
||||
Finite area patch class. Used for 2-D non-Euclidian finite area method.
|
||||
|
||||
Author
|
||||
Zeljko Tukovic, FMENA
|
||||
Hrvoje Jasak, Wikki Ltd.
|
||||
|
||||
SourceFiles
|
||||
faPatch.C
|
||||
newFaPatch.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef faPatch_H
|
||||
#define faPatch_H
|
||||
|
||||
#include "patchIdentifier.H"
|
||||
#include "labelList.H"
|
||||
#include "pointField.H"
|
||||
#include "typeInfo.H"
|
||||
#include "faPatchFieldsFwd.H"
|
||||
#include "autoPtr.H"
|
||||
#include "runTimeSelectionTables.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
class faBoundaryMesh;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class faPatch Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class faPatch
|
||||
:
|
||||
public labelList,
|
||||
public patchIdentifier
|
||||
{
|
||||
private:
|
||||
|
||||
// Private data
|
||||
|
||||
//- Neighbour polyPatch index
|
||||
const label ngbPolyPatchIndex_;
|
||||
|
||||
//- Reference to boundary mesh
|
||||
const faBoundaryMesh& boundaryMesh_;
|
||||
|
||||
|
||||
// Demand-driven private data
|
||||
|
||||
//- Edge-face addressing
|
||||
mutable labelList::subList* edgeFacesPtr_;
|
||||
|
||||
//- Local points labels
|
||||
mutable labelList* pointLabelsPtr_;
|
||||
|
||||
//- Point-edge addressing
|
||||
mutable labelListList* pointEdgesPtr_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow construct as copy
|
||||
faPatch(const faPatch&);
|
||||
|
||||
//- Disallow assignment
|
||||
void operator=(const faPatch&);
|
||||
|
||||
|
||||
//- Clear out topological patch data
|
||||
void clearOut();
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// The faPatch geometry initialisation is called by faBoundaryMesh
|
||||
friend class faBoundaryMesh;
|
||||
|
||||
//- Calculate patch point labels
|
||||
void calcPointLabels() const;
|
||||
|
||||
//- Calculate patch point-edge addressing
|
||||
void calcPointEdges() const;
|
||||
|
||||
//- Initialise the calculation of the patch geometry
|
||||
virtual void initGeometry()
|
||||
{}
|
||||
|
||||
//- Calculate the patch geometry
|
||||
virtual void calcGeometry()
|
||||
{}
|
||||
|
||||
//- Initialise the patches for moving points
|
||||
virtual void initMovePoints(const pointField&)
|
||||
{}
|
||||
|
||||
//- Correct patch after moving points
|
||||
virtual void movePoints(const pointField&);
|
||||
|
||||
//- Initialise the update of the patch topology
|
||||
virtual void initUpdateMesh()
|
||||
{}
|
||||
|
||||
//- Update of the patch topology
|
||||
virtual void updateMesh()
|
||||
{}
|
||||
|
||||
|
||||
public:
|
||||
|
||||
typedef faBoundaryMesh BoundaryMesh;
|
||||
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("patch");
|
||||
|
||||
// Declare run-time constructor selection tables
|
||||
|
||||
declareRunTimeSelectionTable
|
||||
(
|
||||
autoPtr,
|
||||
faPatch,
|
||||
dictionary,
|
||||
(
|
||||
const word& name,
|
||||
const dictionary& dict,
|
||||
const label index,
|
||||
const faBoundaryMesh& bm
|
||||
),
|
||||
(name, dict, index, bm)
|
||||
);
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
faPatch
|
||||
(
|
||||
const word& name,
|
||||
const labelList& edgeLabels,
|
||||
const label index,
|
||||
const faBoundaryMesh& bm,
|
||||
const label ngbPolyPatchIndex
|
||||
);
|
||||
|
||||
//- Construct from dictionary
|
||||
faPatch
|
||||
(
|
||||
const word& name,
|
||||
const dictionary& dict,
|
||||
const label index,
|
||||
const faBoundaryMesh& bm
|
||||
);
|
||||
|
||||
//- Construct as copy, resetting the boundary mesh
|
||||
faPatch(const faPatch&, const faBoundaryMesh&);
|
||||
|
||||
//- Construct and return a clone, resetting the edge list
|
||||
// and boundary mesh
|
||||
virtual autoPtr<faPatch> clone
|
||||
(
|
||||
const faBoundaryMesh& bm,
|
||||
const labelList& edgeLabels,
|
||||
const label index,
|
||||
const label ngbPolyPatchIndex
|
||||
) const
|
||||
{
|
||||
return autoPtr<faPatch>
|
||||
(
|
||||
new faPatch(name(), edgeLabels, index, bm, ngbPolyPatchIndex)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Selectors
|
||||
|
||||
//- Return a pointer to a new patch created
|
||||
// on freestore from dictionary
|
||||
static autoPtr<faPatch> New
|
||||
(
|
||||
const word& name,
|
||||
const dictionary& dict,
|
||||
const label index,
|
||||
const faBoundaryMesh& bm
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~faPatch();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return number of patch points
|
||||
label nPoints() const
|
||||
{
|
||||
return pointLabels().size();
|
||||
}
|
||||
|
||||
//- Return neighbour polyPatch index
|
||||
label ngbPolyPatchIndex() const;
|
||||
|
||||
//- Return boundaryMesh reference
|
||||
const faBoundaryMesh& boundaryMesh() const;
|
||||
|
||||
//- Return true if this patch is coupled
|
||||
virtual bool coupled() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//- Patch start in edge list
|
||||
label start() const;
|
||||
|
||||
//- Patch size
|
||||
virtual label size() const
|
||||
{
|
||||
return labelList::size();
|
||||
}
|
||||
|
||||
//- Return label of edge in patch from global edge label
|
||||
inline label whichEdge(const label l) const
|
||||
{
|
||||
return l - start();
|
||||
}
|
||||
|
||||
//- Slice list to patch
|
||||
template<class T>
|
||||
typename List<T>::subList patchSlice(const List<T>& l) const
|
||||
{
|
||||
return typename List<T>::subList(l, size(), start());
|
||||
}
|
||||
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
|
||||
|
||||
// Acces functions for geometrical data
|
||||
|
||||
//- Return patch point labels
|
||||
const labelList& pointLabels() const;
|
||||
|
||||
//- Return patch point-edge addressing
|
||||
const labelListList& pointEdges() const;
|
||||
|
||||
//- Return edge neighbour polyPatch faces
|
||||
labelList ngbPolyPatchFaces() const;
|
||||
|
||||
//- Return normals of neighbour polyPatch faces
|
||||
tmp<vectorField> ngbPolyPatchFaceNormals() const;
|
||||
|
||||
//- Return normals of neighbour polyPatch joined points
|
||||
tmp<vectorField> ngbPolyPatchPointNormals() const;
|
||||
|
||||
//- Return edge-face addressing
|
||||
const labelUList& edgeFaces() const;
|
||||
|
||||
//- Return edge centres
|
||||
const vectorField& edgeCentres() const;
|
||||
|
||||
//- Return edge length vectors
|
||||
const vectorField& edgeLengths() const;
|
||||
|
||||
//- Return edge length magnitudes
|
||||
const scalarField& magEdgeLengths() const;
|
||||
|
||||
//- Return edge normals
|
||||
tmp<vectorField> edgeNormals() const;
|
||||
|
||||
//- Return neighbour face centres
|
||||
tmp<vectorField> edgeFaceCentres() const;
|
||||
|
||||
//- Return cell-centre to face-centre vector
|
||||
// except for coupled patches for which the cell-centre
|
||||
// to coupled-cell-centre vector is returned
|
||||
virtual tmp<vectorField> delta() const;
|
||||
|
||||
|
||||
// Access functions for demand driven data
|
||||
|
||||
//- Make patch weighting factors
|
||||
virtual void makeWeights(scalarField&) const;
|
||||
|
||||
//- Return patch weighting factors
|
||||
const scalarField& weights() const;
|
||||
|
||||
//- Make patch edge - neighbour face distances
|
||||
virtual void makeDeltaCoeffs(scalarField&) const;
|
||||
|
||||
//- Return patch edge - neighbour face distances
|
||||
const scalarField& deltaCoeffs() const;
|
||||
|
||||
|
||||
// Topological changes
|
||||
|
||||
//- Reset edge list
|
||||
void resetEdges(const labelList&);
|
||||
|
||||
|
||||
// Evaluation functions
|
||||
|
||||
//- Return given internal field next to patch as patch field
|
||||
template<class Type>
|
||||
tmp<Field<Type> > patchInternalField(const UList<Type>&) const;
|
||||
|
||||
//- Return the corresponding patchField of the named field
|
||||
template<class GeometricField, class Type>
|
||||
const typename GeometricField::Patch& patchField
|
||||
(
|
||||
const GeometricField&
|
||||
) const;
|
||||
|
||||
//- Lookup and return the patchField of the named field from the
|
||||
// local objectRegistry.
|
||||
// N.B. The dummy pointer arguments are used if this function is
|
||||
// instantiated within a templated function to avoid a bug in gcc.
|
||||
// See inletOutletFvPatchField.C and outletInletFvPatchField.C
|
||||
template<class GeometricField, class Type>
|
||||
const typename GeometricField::Patch& lookupPatchField
|
||||
(
|
||||
const word& name,
|
||||
const GeometricField* = NULL,
|
||||
const Type* = NULL
|
||||
) const;
|
||||
|
||||
|
||||
// Ostream Operator
|
||||
|
||||
friend Ostream& operator<<(Ostream&, const faPatch&);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "faPatchTemplates.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
79
src/finiteArea/faMesh/faPatches/faPatch/faPatchData.H
Normal file
79
src/finiteArea/faMesh/faPatches/faPatch/faPatchData.H
Normal file
@ -0,0 +1,79 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd |
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2016-2017 Wikki Ltd
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
faPatchData
|
||||
|
||||
Description
|
||||
Class which holds data needed for faPatch construction
|
||||
|
||||
SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef faPatchData_H
|
||||
#define faPatchData_H
|
||||
|
||||
#include "labelList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class faPatchData Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
struct faPatchData
|
||||
{
|
||||
word name_;
|
||||
word type_;
|
||||
dictionary dict_;
|
||||
label ownPolyPatchID_;
|
||||
label ngbPolyPatchID_;
|
||||
labelList edgeLabels_;
|
||||
faPatchData()
|
||||
:
|
||||
name_(word::null),
|
||||
type_(word::null),
|
||||
ownPolyPatchID_(-1),
|
||||
ngbPolyPatchID_(-1)
|
||||
{}
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,50 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd |
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2016-2017 Wikki Ltd
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "faPatch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class GeometricField, class Type>
|
||||
const typename GeometricField::Patch& Foam::faPatch::lookupPatchField
|
||||
(
|
||||
const word& name,
|
||||
const GeometricField*,
|
||||
const Type*
|
||||
) const
|
||||
{
|
||||
return patchField<GeometricField, Type>
|
||||
(
|
||||
boundaryMesh().mesh()().objectRegistry::lookupObject<GeometricField>
|
||||
(
|
||||
name
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
57
src/finiteArea/faMesh/faPatches/faPatch/faPatchList.H
Normal file
57
src/finiteArea/faMesh/faPatches/faPatch/faPatchList.H
Normal file
@ -0,0 +1,57 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd |
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2016-2017 Wikki Ltd
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Typedef
|
||||
faPatchList
|
||||
|
||||
Description
|
||||
Container classes for faPatch
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef faPatchList_H
|
||||
#define faPatchList_H
|
||||
|
||||
#include "faPatch.H"
|
||||
#include "PtrList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
typedef PtrList<faPatch> faPatchList;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
62
src/finiteArea/faMesh/faPatches/faPatch/faPatchTemplates.C
Normal file
62
src/finiteArea/faMesh/faPatches/faPatch/faPatchTemplates.C
Normal file
@ -0,0 +1,62 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd |
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2016-2017 Wikki Ltd
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*----------------------------------------------------------------------------*/
|
||||
|
||||
#include "faPatch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::Field<Type> > Foam::faPatch::patchInternalField
|
||||
(
|
||||
const UList<Type>& f
|
||||
) const
|
||||
{
|
||||
tmp<Field<Type> > tpif(new Field<Type>(size()));
|
||||
Field<Type>& pif = tpif.ref();
|
||||
|
||||
const labelUList& edgeFaces = this->edgeFaces();
|
||||
|
||||
forAll(pif, facei)
|
||||
{
|
||||
pif[facei] = f[edgeFaces[facei]];
|
||||
}
|
||||
|
||||
return tpif;
|
||||
}
|
||||
|
||||
|
||||
template<class GeometricField, class Type>
|
||||
const typename GeometricField::Patch& Foam::faPatch::patchField
|
||||
(
|
||||
const GeometricField& gf
|
||||
) const
|
||||
{
|
||||
return gf.boundaryField()[index()];
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
81
src/finiteArea/faMesh/faPatches/faPatch/newFaPatch.C
Normal file
81
src/finiteArea/faMesh/faPatches/faPatch/newFaPatch.C
Normal file
@ -0,0 +1,81 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd |
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2016-2017 Wikki Ltd
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "faPatch.H"
|
||||
#include "dictionary.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
autoPtr<faPatch> faPatch::New
|
||||
(
|
||||
const word& name,
|
||||
const dictionary& dict,
|
||||
const label index,
|
||||
const faBoundaryMesh& bm
|
||||
)
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Info<< "faPatch::New(const word&, const dictionary&, const label, "
|
||||
"const faBoundaryMesh&) : constructing faPatch"
|
||||
<< endl;
|
||||
}
|
||||
|
||||
word patchType(dict.lookup("type"));
|
||||
|
||||
dictionaryConstructorTable::iterator cstrIter =
|
||||
dictionaryConstructorTablePtr_->find(patchType);
|
||||
|
||||
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
||||
{
|
||||
FatalIOErrorIn
|
||||
(
|
||||
"faPatch::New(const word&, const dictionary&, "
|
||||
"const label, const faBoundaryMesh&)",
|
||||
dict
|
||||
) << "Unknown faPatch type " << patchType << endl << endl
|
||||
<< "Valid faPatch types are :" << endl
|
||||
<< dictionaryConstructorTablePtr_->sortedToc()
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
return autoPtr<faPatch>(cstrIter()(name, dict, index, bm));
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
Reference in New Issue
Block a user