mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' into combustionModel
This commit is contained in:
@ -1,5 +1,7 @@
|
|||||||
EXE_INC = \
|
EXE_INC = \
|
||||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||||
|
-I$(LIB_SRC)/thermophysicalModels/basicSolidThermo/lnInclude \
|
||||||
|
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
|
||||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||||
-I$(LIB_SRC)/turbulenceModels \
|
-I$(LIB_SRC)/turbulenceModels \
|
||||||
-I$(LIB_SRC)/turbulenceModels/compressible/RAS/lnInclude \
|
-I$(LIB_SRC)/turbulenceModels/compressible/RAS/lnInclude \
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -757,9 +757,23 @@ int main(int argc, char *argv[])
|
|||||||
"retain raw orientation for prisms/hexs"
|
"retain raw orientation for prisms/hexs"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
# include "addRegionOption.H"
|
||||||
|
|
||||||
# include "setRootCase.H"
|
# include "setRootCase.H"
|
||||||
# include "createTime.H"
|
# include "createTime.H"
|
||||||
|
|
||||||
|
Foam::word regionName;
|
||||||
|
|
||||||
|
if (args.optionReadIfPresent("region", regionName))
|
||||||
|
{
|
||||||
|
Foam::Info
|
||||||
|
<< "Creating polyMesh for region " << regionName << endl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
regionName = Foam::polyMesh::defaultRegion;
|
||||||
|
}
|
||||||
|
|
||||||
const bool keepOrientation = args.optionFound("keepOrientation");
|
const bool keepOrientation = args.optionFound("keepOrientation");
|
||||||
IFstream inFile(args[1]);
|
IFstream inFile(args[1]);
|
||||||
|
|
||||||
@ -894,7 +908,7 @@ int main(int argc, char *argv[])
|
|||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
polyMesh::defaultRegion,
|
regionName,
|
||||||
runTime.constant(),
|
runTime.constant(),
|
||||||
runTime
|
runTime
|
||||||
),
|
),
|
||||||
@ -984,6 +998,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
|
|
||||||
//Get polyMesh to write to constant
|
//Get polyMesh to write to constant
|
||||||
|
|
||||||
runTime.setTime(instant(runTime.constant()), 0);
|
runTime.setTime(instant(runTime.constant()), 0);
|
||||||
|
|
||||||
repatcher.repatch();
|
repatcher.repatch();
|
||||||
@ -1079,6 +1094,32 @@ int main(int argc, char *argv[])
|
|||||||
mesh.addZones(List<pointZone*>(0), fz, cz);
|
mesh.addZones(List<pointZone*>(0), fz, cz);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Remove empty defaultFaces
|
||||||
|
label defaultPatchID = mesh.boundaryMesh().findPatchID(defaultFacesName);
|
||||||
|
if (mesh.boundaryMesh()[defaultPatchID].size() == 0)
|
||||||
|
{
|
||||||
|
List<polyPatch*> newPatchPtrList((mesh.boundaryMesh().size() - 1));
|
||||||
|
label newPatchI = 0;
|
||||||
|
forAll(mesh.boundaryMesh(), patchI)
|
||||||
|
{
|
||||||
|
if (patchI != defaultPatchID)
|
||||||
|
{
|
||||||
|
const polyPatch& patch = mesh.boundaryMesh()[patchI];
|
||||||
|
|
||||||
|
newPatchPtrList[newPatchI] = patch.clone
|
||||||
|
(
|
||||||
|
mesh.boundaryMesh(),
|
||||||
|
newPatchI,
|
||||||
|
patch.size(),
|
||||||
|
patch.start()
|
||||||
|
).ptr();
|
||||||
|
|
||||||
|
newPatchI++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
repatcher.changePatches(newPatchPtrList);
|
||||||
|
}
|
||||||
|
|
||||||
mesh.write();
|
mesh.write();
|
||||||
|
|
||||||
Info<< "End\n" << endl;
|
Info<< "End\n" << endl;
|
||||||
|
|||||||
@ -49,6 +49,9 @@ formatOptions
|
|||||||
// cell : use cell-centre value only; constant over cells (default)
|
// cell : use cell-centre value only; constant over cells (default)
|
||||||
// cellPoint : use cell-centre and vertex values
|
// cellPoint : use cell-centre and vertex values
|
||||||
// cellPointFace : use cell-centre, vertex and face values.
|
// cellPointFace : use cell-centre, vertex and face values.
|
||||||
|
// pointMVC : use point values only (Mean Value Coordinates)
|
||||||
|
// cellPatchConstrained : use cell-centre except on boundary faces where
|
||||||
|
// it uses the boundary value. For use with e.g. patchCloudSet.
|
||||||
// 1] vertex values determined from neighbouring cell-centre values
|
// 1] vertex values determined from neighbouring cell-centre values
|
||||||
// 2] face values determined using the current face interpolation scheme
|
// 2] face values determined using the current face interpolation scheme
|
||||||
// for the field (linear, gamma, etc.)
|
// for the field (linear, gamma, etc.)
|
||||||
@ -83,6 +86,7 @@ fields
|
|||||||
// uniform, face, midPoint, midPointAndFace : start and end coordinate
|
// uniform, face, midPoint, midPointAndFace : start and end coordinate
|
||||||
// uniform: extra number of sampling points
|
// uniform: extra number of sampling points
|
||||||
// polyLine, cloud: list of coordinates
|
// polyLine, cloud: list of coordinates
|
||||||
|
// patchCloud: list of coordinates and set of patches to look for nearest
|
||||||
sets
|
sets
|
||||||
(
|
(
|
||||||
lineX1
|
lineX1
|
||||||
@ -113,8 +117,21 @@ sets
|
|||||||
points ((0.049 0.049 0.00501)(0.051 0.049 0.00501));
|
points ((0.049 0.049 0.00501)(0.051 0.049 0.00501));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
somePatchPoints
|
||||||
|
{
|
||||||
|
// Sample nearest points on selected patches. Use with
|
||||||
|
// interpolations:
|
||||||
|
// - cell (cell value)
|
||||||
|
// - cellPatchConstrained (boundary value)
|
||||||
|
// - cellPoint (interpolated boundary value)
|
||||||
|
type patchCloud;
|
||||||
|
axis xyz;
|
||||||
|
points ((0.049 0.099 0.005)(0.051 0.054 0.005));
|
||||||
|
patches (".*Wall.*");
|
||||||
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
// Surface sampling definition
|
// Surface sampling definition
|
||||||
//
|
//
|
||||||
// 1] patches are not triangulated by default
|
// 1] patches are not triangulated by default
|
||||||
@ -241,4 +258,5 @@ surfaces
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
// *********************************************************************** //
|
// *********************************************************************** //
|
||||||
|
|||||||
@ -39,12 +39,14 @@ int Foam::entry::disableFunctionEntries
|
|||||||
|
|
||||||
Foam::entry::entry(const keyType& keyword)
|
Foam::entry::entry(const keyType& keyword)
|
||||||
:
|
:
|
||||||
|
IDLList<entry>::link(),
|
||||||
keyword_(keyword)
|
keyword_(keyword)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::entry::entry(const entry& e)
|
Foam::entry::entry(const entry& e)
|
||||||
:
|
:
|
||||||
|
IDLList<entry>::link(),
|
||||||
keyword_(e.keyword_)
|
keyword_(e.keyword_)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|||||||
@ -1352,10 +1352,10 @@ void Foam::syncTools::syncBoundaryFaceList
|
|||||||
label sz = cycPatch.size();
|
label sz = cycPatch.size();
|
||||||
|
|
||||||
// Transform (copy of) data on both sides
|
// Transform (copy of) data on both sides
|
||||||
Field<T> ownVals(SubField<T>(faceValues, sz, ownStart));
|
Field<T> ownVals = SubField<T>(faceValues, sz, ownStart);
|
||||||
top(nbrPatch, ownVals);
|
top(nbrPatch, ownVals);
|
||||||
|
|
||||||
Field<T> nbrVals(SubField<T>(faceValues, sz, nbrStart));
|
Field<T> nbrVals = SubField<T>(faceValues, sz, nbrStart);
|
||||||
top(cycPatch, nbrVals);
|
top(cycPatch, nbrVals);
|
||||||
|
|
||||||
label i0 = ownStart;
|
label i0 = ownStart;
|
||||||
|
|||||||
@ -512,7 +512,7 @@ Foam::labelList Foam::globalIndexAndTransform::transformIndicesForPatches
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
label nUsedTrans = sum(mag(permutation));
|
label nUsedTrans = round(sum(mag(permutation)));
|
||||||
|
|
||||||
if (nUsedTrans == 0)
|
if (nUsedTrans == 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -148,6 +148,7 @@ void Foam::edgeMesh::calcPointEdges() const
|
|||||||
|
|
||||||
Foam::edgeMesh::edgeMesh()
|
Foam::edgeMesh::edgeMesh()
|
||||||
:
|
:
|
||||||
|
fileFormats::edgeFormatsCore(),
|
||||||
points_(0),
|
points_(0),
|
||||||
edges_(0),
|
edges_(0),
|
||||||
pointEdgesPtr_(NULL)
|
pointEdgesPtr_(NULL)
|
||||||
@ -160,6 +161,7 @@ Foam::edgeMesh::edgeMesh
|
|||||||
const edgeList& edges
|
const edgeList& edges
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
|
fileFormats::edgeFormatsCore(),
|
||||||
points_(points),
|
points_(points),
|
||||||
edges_(edges),
|
edges_(edges),
|
||||||
pointEdgesPtr_(NULL)
|
pointEdgesPtr_(NULL)
|
||||||
@ -172,6 +174,7 @@ Foam::edgeMesh::edgeMesh
|
|||||||
const Xfer<edgeList>& edgeLst
|
const Xfer<edgeList>& edgeLst
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
|
fileFormats::edgeFormatsCore(),
|
||||||
points_(0),
|
points_(0),
|
||||||
edges_(0),
|
edges_(0),
|
||||||
pointEdgesPtr_(NULL)
|
pointEdgesPtr_(NULL)
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -27,6 +27,7 @@ License
|
|||||||
|
|
||||||
inline Foam::edgeMesh::edgeMesh(const edgeMesh& em)
|
inline Foam::edgeMesh::edgeMesh(const edgeMesh& em)
|
||||||
:
|
:
|
||||||
|
fileFormats::edgeFormatsCore(),
|
||||||
points_(em.points_),
|
points_(em.points_),
|
||||||
edges_(em.edges_),
|
edges_(em.edges_),
|
||||||
pointEdgesPtr_(NULL)
|
pointEdgesPtr_(NULL)
|
||||||
|
|||||||
@ -201,6 +201,7 @@ interpolation = interpolation/interpolation
|
|||||||
$(interpolation)/interpolation/interpolations.C
|
$(interpolation)/interpolation/interpolations.C
|
||||||
|
|
||||||
$(interpolation)/interpolationCell/makeInterpolationCell.C
|
$(interpolation)/interpolationCell/makeInterpolationCell.C
|
||||||
|
$(interpolation)/interpolationCellPatchConstrained/makeInterpolationCellPatchConstrained.C
|
||||||
$(interpolation)/interpolationCellPoint/cellPointWeight/cellPointWeight.C
|
$(interpolation)/interpolationCellPoint/cellPointWeight/cellPointWeight.C
|
||||||
$(interpolation)/interpolationCellPoint/makeInterpolationCellPoint.C
|
$(interpolation)/interpolationCellPoint/makeInterpolationCellPoint.C
|
||||||
$(interpolation)/interpolationCellPointFace/makeInterpolationCellPointFace.C
|
$(interpolation)/interpolationCellPointFace/makeInterpolationCellPointFace.C
|
||||||
|
|||||||
@ -0,0 +1,76 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 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 "interpolationCellPatchConstrained.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
interpolationCellPatchConstrained<Type>::interpolationCellPatchConstrained
|
||||||
|
(
|
||||||
|
const GeometricField<Type, fvPatchField, volMesh>& psi
|
||||||
|
)
|
||||||
|
:
|
||||||
|
interpolation<Type>(psi)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Type interpolationCellPatchConstrained<Type>::interpolate
|
||||||
|
(
|
||||||
|
const vector& pt,
|
||||||
|
const label cellI,
|
||||||
|
const label faceI
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
if (faceI >= 0 && faceI >= this->psi_.mesh().nInternalFaces())
|
||||||
|
{
|
||||||
|
// Use boundary value
|
||||||
|
const polyBoundaryMesh& pbm = this->psi_.mesh().boundaryMesh();
|
||||||
|
label patchI = pbm.patchID()[faceI-this->psi_.mesh().nInternalFaces()];
|
||||||
|
label patchFaceI = pbm[patchI].whichFace(faceI);
|
||||||
|
|
||||||
|
return this->psi_.boundaryField()[patchI][patchFaceI];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return this->psi_[cellI];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,97 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 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::interpolationCellPatchConstrained
|
||||||
|
|
||||||
|
Description
|
||||||
|
Uses the cell value for any point in the cell apart from a boundary face
|
||||||
|
where it uses the boundary value directly.
|
||||||
|
Note: will not work on an empty patch.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef interpolationCellPatchConstrained_H
|
||||||
|
#define interpolationCellPatchConstrained_H
|
||||||
|
|
||||||
|
#include "interpolation.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
class fvMesh;
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class interpolationCellPatchConstrained Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
class interpolationCellPatchConstrained
|
||||||
|
:
|
||||||
|
public interpolation<Type>
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("cellPatchConstrained");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
interpolationCellPatchConstrained
|
||||||
|
(
|
||||||
|
const GeometricField<Type, fvPatchField, volMesh>& psi
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Interpolate field to the given point in the given cell
|
||||||
|
Type interpolate
|
||||||
|
(
|
||||||
|
const vector& position,
|
||||||
|
const label cellI,
|
||||||
|
const label faceI = -1
|
||||||
|
) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#ifdef NoRepository
|
||||||
|
# include "interpolationCellPatchConstrained.C"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,41 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 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 "interpolationCellPatchConstrained.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
makeInterpolation(interpolationCellPatchConstrained);
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -193,7 +193,7 @@ public:
|
|||||||
void trackingRescue() const
|
void trackingRescue() const
|
||||||
{
|
{
|
||||||
nTrackingRescues_++;
|
nTrackingRescues_++;
|
||||||
if (cloud::debug && nTrackingRescues_ % size() == 0)
|
if (cloud::debug && size() && (nTrackingRescues_ % size() == 0))
|
||||||
{
|
{
|
||||||
Pout<< " " << nTrackingRescues_
|
Pout<< " " << nTrackingRescues_
|
||||||
<< " tracking rescues " << endl;
|
<< " tracking rescues " << endl;
|
||||||
|
|||||||
@ -32,6 +32,7 @@ License
|
|||||||
#include "NoInteraction.H"
|
#include "NoInteraction.H"
|
||||||
#include "Rebound.H"
|
#include "Rebound.H"
|
||||||
#include "StandardWallInteraction.H"
|
#include "StandardWallInteraction.H"
|
||||||
|
#include "MultiInteraction.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -42,7 +43,8 @@ License
|
|||||||
makePatchInteractionModelType(LocalInteraction, CloudType); \
|
makePatchInteractionModelType(LocalInteraction, CloudType); \
|
||||||
makePatchInteractionModelType(NoInteraction, CloudType); \
|
makePatchInteractionModelType(NoInteraction, CloudType); \
|
||||||
makePatchInteractionModelType(Rebound, CloudType); \
|
makePatchInteractionModelType(Rebound, CloudType); \
|
||||||
makePatchInteractionModelType(StandardWallInteraction, CloudType);
|
makePatchInteractionModelType(StandardWallInteraction, CloudType); \
|
||||||
|
makePatchInteractionModelType(MultiInteraction, CloudType);
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|||||||
@ -0,0 +1,188 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 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 "MultiInteraction.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class CloudType>
|
||||||
|
bool Foam::MultiInteraction<CloudType>::read(const dictionary& dict)
|
||||||
|
{
|
||||||
|
// Count dictionaries
|
||||||
|
|
||||||
|
Info<< "Patch interaction model " << typeName << nl
|
||||||
|
<< "Executing in turn " << endl;
|
||||||
|
|
||||||
|
label nModels = 0;
|
||||||
|
forAllConstIter(dictionary, dict, iter)
|
||||||
|
{
|
||||||
|
if (iter().isDict())
|
||||||
|
{
|
||||||
|
Info<< " " << iter().name() << endl;
|
||||||
|
|
||||||
|
nModels++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
models_.setSize(nModels);
|
||||||
|
nModels = 0;
|
||||||
|
forAllConstIter(dictionary, dict, iter)
|
||||||
|
{
|
||||||
|
if (iter().isDict())
|
||||||
|
{
|
||||||
|
models_.set
|
||||||
|
(
|
||||||
|
nModels++,
|
||||||
|
PatchInteractionModel<CloudType>::New
|
||||||
|
(
|
||||||
|
iter().dict(),
|
||||||
|
this->owner()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
oneInteractionOnly_ = Switch(dict.lookup("oneInteractionOnly"));
|
||||||
|
|
||||||
|
if (oneInteractionOnly_)
|
||||||
|
{
|
||||||
|
Info<< "Stopping upon first model that interacts with particle."
|
||||||
|
<< nl << endl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Info<< "Allowing multiple models to interact."
|
||||||
|
<< nl << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class CloudType>
|
||||||
|
Foam::MultiInteraction<CloudType>::MultiInteraction
|
||||||
|
(
|
||||||
|
const dictionary& dict,
|
||||||
|
CloudType& cloud
|
||||||
|
)
|
||||||
|
:
|
||||||
|
PatchInteractionModel<CloudType>(dict, cloud, typeName)
|
||||||
|
{
|
||||||
|
read(this->coeffDict());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class CloudType>
|
||||||
|
Foam::MultiInteraction<CloudType>::MultiInteraction
|
||||||
|
(
|
||||||
|
const MultiInteraction<CloudType>& pim
|
||||||
|
)
|
||||||
|
:
|
||||||
|
PatchInteractionModel<CloudType>(pim),
|
||||||
|
oneInteractionOnly_(pim.oneInteractionOnly_),
|
||||||
|
models_(pim.models_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template <class CloudType>
|
||||||
|
Foam::MultiInteraction<CloudType>::~MultiInteraction()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class CloudType>
|
||||||
|
bool Foam::MultiInteraction<CloudType>::active() const
|
||||||
|
{
|
||||||
|
forAll(models_, i)
|
||||||
|
{
|
||||||
|
if (models_[i].active())
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template <class CloudType>
|
||||||
|
bool Foam::MultiInteraction<CloudType>::correct
|
||||||
|
(
|
||||||
|
typename CloudType::parcelType& p,
|
||||||
|
const polyPatch& pp,
|
||||||
|
bool& keepParticle,
|
||||||
|
const scalar trackFraction,
|
||||||
|
const tetIndices& tetIs
|
||||||
|
)
|
||||||
|
{
|
||||||
|
label origFacei = p.face();
|
||||||
|
label patchi = pp.index();
|
||||||
|
|
||||||
|
bool interacted = false;
|
||||||
|
|
||||||
|
forAll(models_, i)
|
||||||
|
{
|
||||||
|
bool myInteracted = models_[i].correct
|
||||||
|
(
|
||||||
|
p,
|
||||||
|
this->owner().pMesh().boundaryMesh()[patchi],
|
||||||
|
keepParticle,
|
||||||
|
trackFraction,
|
||||||
|
tetIs
|
||||||
|
);
|
||||||
|
|
||||||
|
if (myInteracted && oneInteractionOnly_)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
interacted = (interacted || myInteracted);
|
||||||
|
|
||||||
|
|
||||||
|
// Check if perhaps the interaction model has changed patches
|
||||||
|
// (CoincidentBaffleInteraction can do this)
|
||||||
|
|
||||||
|
if (p.face() != origFacei)
|
||||||
|
{
|
||||||
|
origFacei = p.face();
|
||||||
|
patchi = p.patch(p.face());
|
||||||
|
|
||||||
|
// Interaction model has moved particle off wall?
|
||||||
|
if (patchi == -1)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return interacted;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,165 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 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::MultiInteraction
|
||||||
|
|
||||||
|
Description
|
||||||
|
Runs multiple patch interaction models in turn. Takes dictionary
|
||||||
|
where all the subdictionaries are the interaction models.
|
||||||
|
|
||||||
|
// Exit upon first successful interaction or continue doing other
|
||||||
|
// models. Returned nteraction status will be true if there has been any
|
||||||
|
// interaction (so logical or)
|
||||||
|
oneInteractionOnly true;
|
||||||
|
|
||||||
|
model1
|
||||||
|
{
|
||||||
|
patchInteractionModel coincidentBaffleInteraction;
|
||||||
|
coincidentBaffleInteractionCoeffs
|
||||||
|
{
|
||||||
|
coincidentPatches
|
||||||
|
(
|
||||||
|
(pipetteWall_A pipetteCyclic_half0)
|
||||||
|
(pipetteWall_B pipetteCyclic_half1)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
model2
|
||||||
|
{
|
||||||
|
patchInteractionModel localInteraction;
|
||||||
|
localInteractionCoeffs
|
||||||
|
{
|
||||||
|
patches
|
||||||
|
(
|
||||||
|
cWall
|
||||||
|
{
|
||||||
|
type rebound;
|
||||||
|
}
|
||||||
|
pipetteWall_A
|
||||||
|
{
|
||||||
|
type rebound;
|
||||||
|
}
|
||||||
|
pipetteWall_B
|
||||||
|
{
|
||||||
|
type rebound;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef MultiInteraction_H
|
||||||
|
#define MultiInteraction_H
|
||||||
|
|
||||||
|
#include "PatchInteractionModel.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class MultiInteraction Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
template<class CloudType>
|
||||||
|
class MultiInteraction
|
||||||
|
:
|
||||||
|
public PatchInteractionModel<CloudType>
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
Switch oneInteractionOnly_;
|
||||||
|
|
||||||
|
//- Submodels
|
||||||
|
PtrList<PatchInteractionModel<CloudType> > models_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Read settings
|
||||||
|
bool read(const dictionary&);
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("multiInteraction");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from dictionary
|
||||||
|
MultiInteraction(const dictionary& dict, CloudType& cloud);
|
||||||
|
|
||||||
|
//- Construct copy from owner cloud and patch interaction model
|
||||||
|
MultiInteraction(const MultiInteraction<CloudType>& pim);
|
||||||
|
|
||||||
|
//- Construct and return a clone using supplied owner cloud
|
||||||
|
virtual autoPtr<PatchInteractionModel<CloudType> > clone() const
|
||||||
|
{
|
||||||
|
return autoPtr<PatchInteractionModel<CloudType> >
|
||||||
|
(
|
||||||
|
new MultiInteraction<CloudType>(*this)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~MultiInteraction();
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Flag to indicate whether model activates patch interaction model
|
||||||
|
virtual bool active() const;
|
||||||
|
|
||||||
|
//- Apply velocity correction
|
||||||
|
// Returns true if particle remains in same cell
|
||||||
|
virtual bool correct
|
||||||
|
(
|
||||||
|
typename CloudType::parcelType& p,
|
||||||
|
const polyPatch& pp,
|
||||||
|
bool& keepParticle,
|
||||||
|
const scalar trackFraction,
|
||||||
|
const tetIndices& tetIs
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#ifdef NoRepository
|
||||||
|
# include "MultiInteraction.C"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -14,6 +14,10 @@ FoamFile
|
|||||||
}
|
}
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
// So we get a decent warning if we have multiple functionObject entries
|
||||||
|
// with the same name.
|
||||||
|
#inputMode error;
|
||||||
|
|
||||||
application icoFoam;
|
application icoFoam;
|
||||||
|
|
||||||
startFrom startTime;
|
startFrom startTime;
|
||||||
@ -56,11 +60,16 @@ functions
|
|||||||
// Where to load it from
|
// Where to load it from
|
||||||
functionObjectLibs ("libIOFunctionObjects.so");
|
functionObjectLibs ("libIOFunctionObjects.so");
|
||||||
|
|
||||||
|
// Optional mesh region to operate on. Only one partialWrite per
|
||||||
|
// region allowed.
|
||||||
|
region wallFilmRegion;
|
||||||
|
|
||||||
// Execute upon outputTime
|
// Execute upon outputTime
|
||||||
outputControl outputTime;
|
outputControl outputTime;
|
||||||
|
|
||||||
// Objects to write every outputTime
|
// Objects (fields or lagrangian fields in any of the clouds)
|
||||||
objectNames (p);
|
// to write every outputTime
|
||||||
|
objectNames (p positions nParticle);
|
||||||
// Write as normal every writeInterval'th outputTime.
|
// Write as normal every writeInterval'th outputTime.
|
||||||
writeInterval 3;
|
writeInterval 3;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,6 +28,7 @@ License
|
|||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
#include "IOobjectList.H"
|
#include "IOobjectList.H"
|
||||||
#include "polyMesh.H"
|
#include "polyMesh.H"
|
||||||
|
#include "cloud.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -132,7 +133,12 @@ void Foam::partialWrite::write()
|
|||||||
|
|
||||||
IOobjectList objects(obr_, obr_.time().timeName());
|
IOobjectList objects(obr_, obr_.time().timeName());
|
||||||
|
|
||||||
forAllConstIter(HashPtrTable<IOobject>, objects, iter)
|
if (debug)
|
||||||
|
{
|
||||||
|
Pout<< "For region:" << obr_.name() << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
forAllConstIter(IOobjectList, objects, iter)
|
||||||
{
|
{
|
||||||
if (!objectNames_.found(iter()->name()))
|
if (!objectNames_.found(iter()->name()))
|
||||||
{
|
{
|
||||||
@ -147,6 +153,47 @@ void Foam::partialWrite::write()
|
|||||||
rm(f);
|
rm(f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Do the lagrangian files as well.
|
||||||
|
fileNameList cloudDirs
|
||||||
|
(
|
||||||
|
readDir
|
||||||
|
(
|
||||||
|
obr_.time().timePath()/dbDir/cloud::prefix,
|
||||||
|
fileName::DIRECTORY
|
||||||
|
)
|
||||||
|
);
|
||||||
|
forAll(cloudDirs, i)
|
||||||
|
{
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Pout<< "For cloud:" << cloudDirs[i] << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
IOobjectList sprayObjs
|
||||||
|
(
|
||||||
|
obr_,
|
||||||
|
obr_.time().timeName(),
|
||||||
|
cloud::prefix/cloudDirs[i]
|
||||||
|
);
|
||||||
|
forAllConstIter(IOobjectList, sprayObjs, iter)
|
||||||
|
{
|
||||||
|
if (!objectNames_.found(iter()->name()))
|
||||||
|
{
|
||||||
|
const fileName f =
|
||||||
|
obr_.time().timePath()
|
||||||
|
/dbDir
|
||||||
|
/cloud::prefix
|
||||||
|
/cloudDirs[i]
|
||||||
|
/iter()->name();
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Pout<< " rm " << f << endl;
|
||||||
|
}
|
||||||
|
rm(f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,6 +5,7 @@ probes/probesFunctionObject/probesFunctionObject.C
|
|||||||
|
|
||||||
sampledSet/cloud/cloudSet.C
|
sampledSet/cloud/cloudSet.C
|
||||||
sampledSet/coordSet/coordSet.C
|
sampledSet/coordSet/coordSet.C
|
||||||
|
sampledSet/patchCloud/patchCloudSet.C
|
||||||
sampledSet/polyLine/polyLineSet.C
|
sampledSet/polyLine/polyLineSet.C
|
||||||
sampledSet/face/faceOnlySet.C
|
sampledSet/face/faceOnlySet.C
|
||||||
sampledSet/midPoint/midPointSet.C
|
sampledSet/midPoint/midPointSet.C
|
||||||
|
|||||||
322
src/sampling/sampledSet/patchCloud/patchCloudSet.C
Normal file
322
src/sampling/sampledSet/patchCloud/patchCloudSet.C
Normal file
@ -0,0 +1,322 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 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 "patchCloudSet.H"
|
||||||
|
#include "polyMesh.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "pointIndexHit.H"
|
||||||
|
#include "Tuple2.H"
|
||||||
|
#include "treeBoundBox.H"
|
||||||
|
#include "indexedOctree.H"
|
||||||
|
#include "treeDataFace.H"
|
||||||
|
#include "Time.H"
|
||||||
|
#include "meshTools.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(patchCloudSet, 0);
|
||||||
|
addToRunTimeSelectionTable(sampledSet, patchCloudSet, word);
|
||||||
|
|
||||||
|
|
||||||
|
//- Helper class for finding nearest
|
||||||
|
// Nearest:
|
||||||
|
// - point+local index
|
||||||
|
// - sqr(distance)
|
||||||
|
// - processor
|
||||||
|
typedef Tuple2<pointIndexHit, Tuple2<scalar, label> > nearInfo;
|
||||||
|
|
||||||
|
class nearestEqOp
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
void operator()(nearInfo& x, const nearInfo& y) const
|
||||||
|
{
|
||||||
|
if (y.first().hit())
|
||||||
|
{
|
||||||
|
if (!x.first().hit())
|
||||||
|
{
|
||||||
|
x = y;
|
||||||
|
}
|
||||||
|
else if (y.second().first() < x.second().first())
|
||||||
|
{
|
||||||
|
x = y;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::patchCloudSet::calcSamples
|
||||||
|
(
|
||||||
|
DynamicList<point>& samplingPts,
|
||||||
|
DynamicList<label>& samplingCells,
|
||||||
|
DynamicList<label>& samplingFaces,
|
||||||
|
DynamicList<label>& samplingSegments,
|
||||||
|
DynamicList<scalar>& samplingCurveDist
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "patchCloudSet : sampling on patches :" << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Construct search tree for all patch faces.
|
||||||
|
label sz = 0;
|
||||||
|
forAllConstIter(labelHashSet, patchSet_, iter)
|
||||||
|
{
|
||||||
|
const polyPatch& pp = mesh().boundaryMesh()[iter.key()];
|
||||||
|
|
||||||
|
sz += pp.size();
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< " " << pp.name() << " size " << pp.size() << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
labelList patchFaces(sz);
|
||||||
|
sz = 0;
|
||||||
|
treeBoundBox bb(point::max, point::min);
|
||||||
|
forAllConstIter(labelHashSet, patchSet_, iter)
|
||||||
|
{
|
||||||
|
const polyPatch& pp = mesh().boundaryMesh()[iter.key()];
|
||||||
|
|
||||||
|
forAll(pp, i)
|
||||||
|
{
|
||||||
|
patchFaces[sz++] = pp.start()+i;
|
||||||
|
}
|
||||||
|
|
||||||
|
const boundBox patchBb(pp.points(), pp.meshPoints());
|
||||||
|
|
||||||
|
bb.min() = min(bb.min(), patchBb.min());
|
||||||
|
bb.max() = max(bb.max(), patchBb.max());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Not very random
|
||||||
|
Random rndGen(123456);
|
||||||
|
// Make bb asymetric just to avoid problems on symmetric meshes
|
||||||
|
bb = bb.extend(rndGen, 1E-4);
|
||||||
|
|
||||||
|
bb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||||
|
bb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||||
|
|
||||||
|
|
||||||
|
indexedOctree<treeDataFace> patchTree
|
||||||
|
(
|
||||||
|
treeDataFace // all information needed to search faces
|
||||||
|
(
|
||||||
|
false, // do not cache bb
|
||||||
|
mesh(),
|
||||||
|
patchFaces // boundary faces only
|
||||||
|
),
|
||||||
|
bb, // overall search domain
|
||||||
|
8, // maxLevel
|
||||||
|
10, // leafsize
|
||||||
|
3.0 // duplicity
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// All the info for nearest. Construct to miss
|
||||||
|
List<nearInfo> nearest(sampleCoords_.size());
|
||||||
|
|
||||||
|
forAll(sampleCoords_, sampleI)
|
||||||
|
{
|
||||||
|
const point& sample = sampleCoords_[sampleI];
|
||||||
|
|
||||||
|
pointIndexHit& nearInfo = nearest[sampleI].first();
|
||||||
|
|
||||||
|
// Find the nearest locally
|
||||||
|
nearInfo = patchTree.findNearest(sample, magSqr(bb.span()));
|
||||||
|
|
||||||
|
// Fill in the distance field and the processor field
|
||||||
|
if (!nearInfo.hit())
|
||||||
|
{
|
||||||
|
nearest[sampleI].second().first() = Foam::sqr(GREAT);
|
||||||
|
nearest[sampleI].second().second() = Pstream::myProcNo();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Set nearest to mesh face label
|
||||||
|
nearInfo.setIndex(patchFaces[nearInfo.index()]);
|
||||||
|
|
||||||
|
nearest[sampleI].second().first() = magSqr
|
||||||
|
(
|
||||||
|
nearInfo.hitPoint()
|
||||||
|
- sample
|
||||||
|
);
|
||||||
|
nearest[sampleI].second().second() = Pstream::myProcNo();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Find nearest.
|
||||||
|
Pstream::listCombineGather(nearest, nearestEqOp());
|
||||||
|
Pstream::listCombineScatter(nearest);
|
||||||
|
|
||||||
|
|
||||||
|
if (debug && Pstream::master())
|
||||||
|
{
|
||||||
|
OFstream str
|
||||||
|
(
|
||||||
|
mesh().time().path()
|
||||||
|
/ name()
|
||||||
|
+ "_nearest.obj"
|
||||||
|
);
|
||||||
|
Info<< "Dumping mapping as lines from supplied points to"
|
||||||
|
<< " nearest patch face to file " << str.name() << endl;
|
||||||
|
|
||||||
|
label vertI = 0;
|
||||||
|
|
||||||
|
forAll(nearest, i)
|
||||||
|
{
|
||||||
|
meshTools::writeOBJ(str, sampleCoords_[i]);
|
||||||
|
vertI++;
|
||||||
|
meshTools::writeOBJ(str, nearest[i].first().hitPoint());
|
||||||
|
vertI++;
|
||||||
|
str << "l " << vertI-1 << ' ' << vertI << nl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Store the sampling locations on the nearest processor
|
||||||
|
forAll(nearest, sampleI)
|
||||||
|
{
|
||||||
|
if (nearest[sampleI].second().second() == Pstream::myProcNo())
|
||||||
|
{
|
||||||
|
const pointIndexHit& nearInfo = nearest[sampleI].first();
|
||||||
|
|
||||||
|
label faceI = nearInfo.index();
|
||||||
|
|
||||||
|
samplingPts.append(nearInfo.hitPoint());
|
||||||
|
samplingCells.append(mesh().faceOwner()[faceI]);
|
||||||
|
samplingFaces.append(faceI);
|
||||||
|
samplingSegments.append(0);
|
||||||
|
samplingCurveDist.append(1.0 * sampleI);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::patchCloudSet::genSamples()
|
||||||
|
{
|
||||||
|
// Storage for sample points
|
||||||
|
DynamicList<point> samplingPts;
|
||||||
|
DynamicList<label> samplingCells;
|
||||||
|
DynamicList<label> samplingFaces;
|
||||||
|
DynamicList<label> samplingSegments;
|
||||||
|
DynamicList<scalar> samplingCurveDist;
|
||||||
|
|
||||||
|
calcSamples
|
||||||
|
(
|
||||||
|
samplingPts,
|
||||||
|
samplingCells,
|
||||||
|
samplingFaces,
|
||||||
|
samplingSegments,
|
||||||
|
samplingCurveDist
|
||||||
|
);
|
||||||
|
|
||||||
|
samplingPts.shrink();
|
||||||
|
samplingCells.shrink();
|
||||||
|
samplingFaces.shrink();
|
||||||
|
samplingSegments.shrink();
|
||||||
|
samplingCurveDist.shrink();
|
||||||
|
|
||||||
|
setSamples
|
||||||
|
(
|
||||||
|
samplingPts,
|
||||||
|
samplingCells,
|
||||||
|
samplingFaces,
|
||||||
|
samplingSegments,
|
||||||
|
samplingCurveDist
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::patchCloudSet::patchCloudSet
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const polyMesh& mesh,
|
||||||
|
meshSearch& searchEngine,
|
||||||
|
const word& axis,
|
||||||
|
const List<point>& sampleCoords,
|
||||||
|
const labelHashSet& patchSet
|
||||||
|
)
|
||||||
|
:
|
||||||
|
sampledSet(name, mesh, searchEngine, axis),
|
||||||
|
sampleCoords_(sampleCoords),
|
||||||
|
patchSet_(patchSet)
|
||||||
|
{
|
||||||
|
genSamples();
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
write(Info);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::patchCloudSet::patchCloudSet
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const polyMesh& mesh,
|
||||||
|
meshSearch& searchEngine,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
sampledSet(name, mesh, searchEngine, dict),
|
||||||
|
sampleCoords_(dict.lookup("points")),
|
||||||
|
patchSet_
|
||||||
|
(
|
||||||
|
mesh.boundaryMesh().patchSet
|
||||||
|
(
|
||||||
|
wordReList(dict.lookup("patches"))
|
||||||
|
)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
genSamples();
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
write(Info);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::patchCloudSet::~patchCloudSet()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
122
src/sampling/sampledSet/patchCloud/patchCloudSet.H
Normal file
122
src/sampling/sampledSet/patchCloud/patchCloudSet.H
Normal file
@ -0,0 +1,122 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 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::patchCloudSet
|
||||||
|
|
||||||
|
Description
|
||||||
|
Like cloudSet but samples nearest patch face
|
||||||
|
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
patchCloudSet.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef patchCloudSet_H
|
||||||
|
#define patchCloudSet_H
|
||||||
|
|
||||||
|
#include "sampledSet.H"
|
||||||
|
#include "DynamicList.H"
|
||||||
|
#include "HashSet.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class patchCloudSet Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class patchCloudSet
|
||||||
|
:
|
||||||
|
public sampledSet
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Sampling points
|
||||||
|
List<point> sampleCoords_;
|
||||||
|
|
||||||
|
//- Patches to sample
|
||||||
|
labelHashSet patchSet_;
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Samples all points in sampleCoords.
|
||||||
|
void calcSamples
|
||||||
|
(
|
||||||
|
DynamicList<point>& samplingPts,
|
||||||
|
DynamicList<label>& samplingCells,
|
||||||
|
DynamicList<label>& samplingFaces,
|
||||||
|
DynamicList<label>& samplingSegments,
|
||||||
|
DynamicList<scalar>& samplingCurveDist
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Uses calcSamples to obtain samples. Copies them into *this.
|
||||||
|
void genSamples();
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("patchCloud");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
patchCloudSet
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const polyMesh& mesh,
|
||||||
|
meshSearch& searchEngine,
|
||||||
|
const word& axis,
|
||||||
|
const List<point>& sampleCoords,
|
||||||
|
const labelHashSet& patchSet
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from dictionary
|
||||||
|
patchCloudSet
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const polyMesh& mesh,
|
||||||
|
meshSearch& searchEngine,
|
||||||
|
const dictionary& dict
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~patchCloudSet();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
Reference in New Issue
Block a user