Merge branch 'master' of /home/dm4/OpenFOAM/OpenFOAM-dev

This commit is contained in:
andy
2013-05-22 09:23:34 +01:00
25 changed files with 615 additions and 311 deletions

View File

@ -56,6 +56,8 @@ Description
//#include "centredCFCFaceToCellStencilObject.H" //#include "centredCFCFaceToCellStencilObject.H"
#include "centredCECCellToCellStencilObject.H" #include "centredCECCellToCellStencilObject.H"
#include "centredCFCCellToCellStencilObject.H"
#include "centredCPCCellToCellStencilObject.H"
using namespace Foam; using namespace Foam;
@ -460,7 +462,63 @@ int main(int argc, char *argv[])
{ {
writeStencilOBJ writeStencilOBJ
( (
runTime.path()/"centredCell" + Foam::name(cellI) + ".obj", runTime.path()/"centredCECCell" + Foam::name(cellI) + ".obj",
mesh.cellCentres()[cellI],
stencilPoints[cellI]
);
}
}
{
const extendedCentredCellToCellStencil& addressing =
centredCPCCellToCellStencilObject::New
(
mesh
);
Info<< "cellCellCell:" << endl;
writeStencilStats(addressing.stencil());
// Collect stencil cell centres
List<List<point> > stencilPoints(mesh.nCells());
addressing.collectData
(
mesh.C(),
stencilPoints
);
forAll(stencilPoints, cellI)
{
writeStencilOBJ
(
runTime.path()/"centredCPCCell" + Foam::name(cellI) + ".obj",
mesh.cellCentres()[cellI],
stencilPoints[cellI]
);
}
}
{
const extendedCentredCellToCellStencil& addressing =
centredCFCCellToCellStencilObject::New
(
mesh
);
Info<< "cellCellCell:" << endl;
writeStencilStats(addressing.stencil());
// Collect stencil cell centres
List<List<point> > stencilPoints(mesh.nCells());
addressing.collectData
(
mesh.C(),
stencilPoints
);
forAll(stencilPoints, cellI)
{
writeStencilOBJ
(
runTime.path()/"centredCFCCell" + Foam::name(cellI) + ".obj",
mesh.cellCentres()[cellI], mesh.cellCentres()[cellI],
stencilPoints[cellI] stencilPoints[cellI]
); );

View File

@ -493,7 +493,6 @@ int main(int argc, char *argv[])
mesh.nFaces(), // start mesh.nFaces(), // start
patchI, // index patchI, // index
mesh.boundaryMesh(),// polyBoundaryMesh mesh.boundaryMesh(),// polyBoundaryMesh
Pstream::worldComm, // communicator
Pstream::myProcNo(),// myProcNo Pstream::myProcNo(),// myProcNo
nbrProcI // neighbProcNo nbrProcI // neighbProcNo
) )

View File

@ -180,6 +180,12 @@ castellatedMeshControls
// - used if feature snapping (see snapControls below) is used // - used if feature snapping (see snapControls below) is used
resolveFeatureAngle 30; resolveFeatureAngle 30;
// Planar angle:
// - used to determine if neighbouring surface normals
// are roughly the same so e.g. free-standing baffles can be merged
// If not specified same as resolveFeatureAngle
//planarAngle 30;
// Region-wise refinement // Region-wise refinement
// ~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~

View File

@ -14,6 +14,20 @@ FoamFile
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Sample for creating baffles:
// - usually converting internal faces into two boundary faces
// - or converting boundary faces into a boundary face
// (internalFacesOnly=false)(though should use really createPatch
// to do this)
// - can also create duplicate (overlapping) sets of baffles:
// - internalFacesOnly = false
// - have 4 entries in patches:
// - master
// - slave
// - additional master
// - additional slave
// Whether to convert internal faces only (so leave boundary faces intact). // Whether to convert internal faces only (so leave boundary faces intact).
// This is only relevant if your face selection type can pick up boundary // This is only relevant if your face selection type can pick up boundary
// faces. // faces.

View File

@ -240,7 +240,7 @@ int main(int argc, char *argv[])
wordHashSet allCloudNames; wordHashSet allCloudNames;
if (Pstream::master()) if (Pstream::master())
{ {
word geomFileName = prepend + "000"; word geomFileName = prepend + "0000";
// test pre check variable if there is a moving mesh // test pre check variable if there is a moving mesh
if (meshMoving) if (meshMoving)

View File

@ -79,8 +79,9 @@ void Foam::GAMGAgglomeration::compactLevels(const label nCreatedLevels)
<< nl; << nl;
Info<< setw(40) << "nCells" Info<< setw(40) << "nCells"
<< setw(24) << "nFaces/nCells"
<< setw(24) << "nInterfaces" << setw(24) << "nInterfaces"
<< setw(24) << "Ratio" << nl << setw(24) << "nIntFaces/nCells" << nl
<< setw(8) << "Level" << setw(8) << "Level"
<< setw(8) << "nProcs" << setw(8) << "nProcs"
<< " " << " "
@ -89,6 +90,9 @@ void Foam::GAMGAgglomeration::compactLevels(const label nCreatedLevels)
<< " " << " "
<< setw(8) << "avg" << setw(8) << "avg"
<< setw(8) << "max" << setw(8) << "max"
<< " "
<< setw(8) << "avg"
<< setw(8) << "max"
<< " " << setw(4) << "avg" << " " << setw(4) << "avg"
<< " " << setw(4) << "max" << " " << setw(4) << "max"
<< nl << nl
@ -108,6 +112,7 @@ void Foam::GAMGAgglomeration::compactLevels(const label nCreatedLevels)
{ {
label nProcs = 0; label nProcs = 0;
label nCells = 0; label nCells = 0;
scalar faceCellRatio = 0;
label nInterfaces = 0; label nInterfaces = 0;
label nIntFaces = 0; label nIntFaces = 0;
scalar ratio = 0.0; scalar ratio = 0.0;
@ -118,6 +123,8 @@ void Foam::GAMGAgglomeration::compactLevels(const label nCreatedLevels)
const lduMesh& fineMesh = meshLevel(levelI); const lduMesh& fineMesh = meshLevel(levelI);
nCells = fineMesh.lduAddr().size(); nCells = fineMesh.lduAddr().size();
faceCellRatio =
scalar(fineMesh.lduAddr().lowerAddr().size())/nCells;
const lduInterfacePtrsList interfaces = const lduInterfacePtrsList interfaces =
fineMesh.interfaces(); fineMesh.interfaces();
@ -137,6 +144,11 @@ void Foam::GAMGAgglomeration::compactLevels(const label nCreatedLevels)
label maxNCells = returnReduce(nCells, maxOp<label>()); label maxNCells = returnReduce(nCells, maxOp<label>());
label totNCells = returnReduce(nCells, sumOp<label>()); label totNCells = returnReduce(nCells, sumOp<label>());
scalar maxFaceCellRatio =
returnReduce(faceCellRatio, maxOp<scalar>());
scalar totFaceCellRatio =
returnReduce(faceCellRatio, sumOp<scalar>());
label maxNInt = returnReduce(nInterfaces, maxOp<label>()); label maxNInt = returnReduce(nInterfaces, maxOp<label>());
label totNInt = returnReduce(nInterfaces, sumOp<label>()); label totNInt = returnReduce(nInterfaces, sumOp<label>());
@ -145,9 +157,15 @@ void Foam::GAMGAgglomeration::compactLevels(const label nCreatedLevels)
Info<< setw(8) << levelI Info<< setw(8) << levelI
<< setw(8) << totNprocs << setw(8) << totNprocs
<< setw(16) << totNCells/totNprocs << setw(16) << totNCells/totNprocs
<< setw(8) << maxNCells << setw(8) << maxNCells
<< setw(16) << totNInt/totNprocs
<< " "
<< setw(8) << setprecision(4) << totFaceCellRatio/totNprocs
<< setw(8) << setprecision(4) << maxFaceCellRatio
<< " "
<< setw(8) << totNInt/totNprocs
<< setw(8) << maxNInt << setw(8) << maxNInt
<< " " << " "
<< setw(8) << setprecision(4) << totRatio/totNprocs << setw(8) << setprecision(4) << totRatio/totNprocs
@ -261,9 +279,9 @@ const Foam::GAMGAgglomeration& Foam::GAMGAgglomeration::New
"(const lduMesh& mesh, const dictionary& controlDict)" "(const lduMesh& mesh, const dictionary& controlDict)"
) << "Unknown GAMGAgglomeration type " ) << "Unknown GAMGAgglomeration type "
<< agglomeratorType << ".\n" << agglomeratorType << ".\n"
<< "Valid algebraic GAMGAgglomeration types are :" << "Valid matrix GAMGAgglomeration types are :"
<< lduMatrixConstructorTablePtr_->sortedToc() << endl << lduMatrixConstructorTablePtr_->sortedToc() << endl
<< "Valid algebraic GAMGAgglomeration types are :" << "Valid geometric GAMGAgglomeration types are :"
<< lduMeshConstructorTablePtr_->sortedToc() << lduMeshConstructorTablePtr_->sortedToc()
<< exit(FatalError); << exit(FatalError);
} }
@ -356,7 +374,8 @@ Foam::autoPtr<Foam::GAMGAgglomeration> Foam::GAMGAgglomeration::New
FatalErrorIn FatalErrorIn
( (
"GAMGAgglomeration::New" "GAMGAgglomeration::New"
"(const lduMesh& mesh, const dictionary& controlDict)" "(const lduMesh& mesh, const scalarField&"
", const vectorField&, const dictionary& controlDict)"
) << "Unknown GAMGAgglomeration type " ) << "Unknown GAMGAgglomeration type "
<< agglomeratorType << ".\n" << agglomeratorType << ".\n"
<< "Valid geometric GAMGAgglomeration types are :" << "Valid geometric GAMGAgglomeration types are :"

View File

@ -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) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -67,6 +67,10 @@ public:
// setting the arguments pointer to NULL // setting the arguments pointer to NULL
inline autoPtr(const autoPtr<T>&); inline autoPtr(const autoPtr<T>&);
//- Construct either by transfering pointer or cloning. Should
// only be called with type that supports cloning.
inline autoPtr(const autoPtr<T>&, const bool reUse);
//- Destructor, delete object if pointer is not NULL //- Destructor, delete object if pointer is not NULL
inline ~autoPtr(); inline ~autoPtr();

View File

@ -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) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -24,6 +24,7 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "error.H" #include "error.H"
#include <typeinfo>
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -43,6 +44,21 @@ inline Foam::autoPtr<T>::autoPtr(const autoPtr<T>& ap)
} }
template<class T>
inline Foam::autoPtr<T>::autoPtr(const autoPtr<T>& ap, const bool reUse)
{
if (reUse)
{
ptr_ = ap.ptr_;
ap.ptr_ = 0;
}
else
{
ptr_ = ap().clone().ptr();
}
}
template<class T> template<class T>
inline Foam::autoPtr<T>::~autoPtr() inline Foam::autoPtr<T>::~autoPtr()
{ {
@ -81,7 +97,8 @@ inline void Foam::autoPtr<T>::set(T* p)
if (ptr_) if (ptr_)
{ {
FatalErrorIn("void Foam::autoPtr<T>::set(T*)") FatalErrorIn("void Foam::autoPtr<T>::set(T*)")
<< "object already allocated" << "object of type " << typeid(T).name()
<< " already allocated"
<< abort(FatalError); << abort(FatalError);
} }
@ -116,7 +133,8 @@ inline T& Foam::autoPtr<T>::operator()()
if (!ptr_) if (!ptr_)
{ {
FatalErrorIn("T& Foam::autoPtr<T>::operator()()") FatalErrorIn("T& Foam::autoPtr<T>::operator()()")
<< "object is not allocated" << "object of type " << typeid(T).name()
<< " is not allocated"
<< abort(FatalError); << abort(FatalError);
} }
@ -130,7 +148,8 @@ inline const T& Foam::autoPtr<T>::operator()() const
if (!ptr_) if (!ptr_)
{ {
FatalErrorIn("const T& Foam::autoPtr<T>::operator()() const") FatalErrorIn("const T& Foam::autoPtr<T>::operator()() const")
<< "object is not allocated" << "object of type " << typeid(T).name()
<< " is not allocated"
<< abort(FatalError); << abort(FatalError);
} }
@ -151,7 +170,8 @@ inline T* Foam::autoPtr<T>::operator->()
if (!ptr_) if (!ptr_)
{ {
FatalErrorIn("Foam::autoPtr<T>::operator->()") FatalErrorIn("Foam::autoPtr<T>::operator->()")
<< "object is not allocated" << "object of type " << typeid(T).name()
<< " is not allocated"
<< abort(FatalError); << abort(FatalError);
} }

View File

@ -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) 2011-2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -24,6 +24,7 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "error.H" #include "error.H"
#include <typeinfo>
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -62,6 +63,7 @@ inline Foam::tmp<T>::tmp(const tmp<T>& t)
{ {
FatalErrorIn("Foam::tmp<T>::tmp(const tmp<T>&)") FatalErrorIn("Foam::tmp<T>::tmp(const tmp<T>&)")
<< "attempted copy of a deallocated temporary" << "attempted copy of a deallocated temporary"
<< " of type " << typeid(T).name()
<< abort(FatalError); << abort(FatalError);
} }
} }
@ -93,6 +95,7 @@ inline Foam::tmp<T>::tmp(const tmp<T>& t, bool allowTransfer)
( (
"Foam::tmp<T>::tmp(const tmp<T>&, bool allowTransfer)" "Foam::tmp<T>::tmp(const tmp<T>&, bool allowTransfer)"
) << "attempted copy of a deallocated temporary" ) << "attempted copy of a deallocated temporary"
<< " of type " << typeid(T).name()
<< abort(FatalError); << abort(FatalError);
} }
} }
@ -149,7 +152,7 @@ inline T* Foam::tmp<T>::ptr() const
if (!ptr_) if (!ptr_)
{ {
FatalErrorIn("Foam::tmp<T>::ptr() const") FatalErrorIn("Foam::tmp<T>::ptr() const")
<< "temporary deallocated" << "temporary of type " << typeid(T).name() << " deallocated"
<< abort(FatalError); << abort(FatalError);
} }
@ -188,7 +191,7 @@ inline T& Foam::tmp<T>::operator()()
if (!ptr_) if (!ptr_)
{ {
FatalErrorIn("T& Foam::tmp<T>::operator()()") FatalErrorIn("T& Foam::tmp<T>::operator()()")
<< "temporary deallocated" << "temporary of type " << typeid(T).name() << " deallocated"
<< abort(FatalError); << abort(FatalError);
} }
@ -217,7 +220,7 @@ inline const T& Foam::tmp<T>::operator()() const
if (!ptr_) if (!ptr_)
{ {
FatalErrorIn("const T& Foam::tmp<T>::operator()() const") FatalErrorIn("const T& Foam::tmp<T>::operator()() const")
<< "temporary deallocated" << "temporary of type " << typeid(T).name() << " deallocated"
<< abort(FatalError); << abort(FatalError);
} }
@ -245,7 +248,7 @@ inline T* Foam::tmp<T>::operator->()
if (!ptr_) if (!ptr_)
{ {
FatalErrorIn("Foam::tmp<T>::operator->()") FatalErrorIn("Foam::tmp<T>::operator->()")
<< "temporary deallocated" << "temporary of type " << typeid(T).name() << " deallocated"
<< abort(FatalError); << abort(FatalError);
} }
@ -294,6 +297,7 @@ inline void Foam::tmp<T>::operator=(const tmp<T>& t)
{ {
FatalErrorIn("Foam::tmp<T>::operator=(const tmp<T>&)") FatalErrorIn("Foam::tmp<T>::operator=(const tmp<T>&)")
<< "attempted copy of a deallocated temporary" << "attempted copy of a deallocated temporary"
<< " of type " << typeid(T).name()
<< abort(FatalError); << abort(FatalError);
} }
} }
@ -301,6 +305,7 @@ inline void Foam::tmp<T>::operator=(const tmp<T>& t)
{ {
FatalErrorIn("Foam::tmp<T>::operator=(const tmp<T>&)") FatalErrorIn("Foam::tmp<T>::operator=(const tmp<T>&)")
<< "attempted to assign to a const reference to constant object" << "attempted to assign to a const reference to constant object"
<< " of type " << typeid(T).name()
<< abort(FatalError); << abort(FatalError);
} }
} }

View File

@ -54,14 +54,12 @@ Foam::processorPolyPatch::processorPolyPatch
const label start, const label start,
const label index, const label index,
const polyBoundaryMesh& bm, const polyBoundaryMesh& bm,
const label comm,
const int myProcNo, const int myProcNo,
const int neighbProcNo, const int neighbProcNo,
const transformType transform const transformType transform
) )
: :
coupledPolyPatch(name, size, start, index, bm, typeName, transform), coupledPolyPatch(name, size, start, index, bm, typeName, transform),
// comm_(comm),
myProcNo_(myProcNo), myProcNo_(myProcNo),
neighbProcNo_(neighbProcNo), neighbProcNo_(neighbProcNo),
neighbFaceCentres_(), neighbFaceCentres_(),
@ -80,10 +78,6 @@ Foam::processorPolyPatch::processorPolyPatch
) )
: :
coupledPolyPatch(name, dict, index, bm, patchType), coupledPolyPatch(name, dict, index, bm, patchType),
// comm_
// (
// dict.lookupOrDefault("communicator", UPstream::worldComm)
// ),
myProcNo_(readLabel(dict.lookup("myProcNo"))), myProcNo_(readLabel(dict.lookup("myProcNo"))),
neighbProcNo_(readLabel(dict.lookup("neighbProcNo"))), neighbProcNo_(readLabel(dict.lookup("neighbProcNo"))),
neighbFaceCentres_(), neighbFaceCentres_(),
@ -99,7 +93,6 @@ Foam::processorPolyPatch::processorPolyPatch
) )
: :
coupledPolyPatch(pp, bm), coupledPolyPatch(pp, bm),
// comm_(pp.comm_),
myProcNo_(pp.myProcNo_), myProcNo_(pp.myProcNo_),
neighbProcNo_(pp.neighbProcNo_), neighbProcNo_(pp.neighbProcNo_),
neighbFaceCentres_(), neighbFaceCentres_(),
@ -118,7 +111,6 @@ Foam::processorPolyPatch::processorPolyPatch
) )
: :
coupledPolyPatch(pp, bm, index, newSize, newStart), coupledPolyPatch(pp, bm, index, newSize, newStart),
// comm_(pp.comm_),
myProcNo_(pp.myProcNo_), myProcNo_(pp.myProcNo_),
neighbProcNo_(pp.neighbProcNo_), neighbProcNo_(pp.neighbProcNo_),
neighbFaceCentres_(), neighbFaceCentres_(),
@ -137,7 +129,6 @@ Foam::processorPolyPatch::processorPolyPatch
) )
: :
coupledPolyPatch(pp, bm, index, mapAddressing, newStart), coupledPolyPatch(pp, bm, index, mapAddressing, newStart),
// comm_(pp.comm_),
myProcNo_(pp.myProcNo_), myProcNo_(pp.myProcNo_),
neighbProcNo_(pp.neighbProcNo_), neighbProcNo_(pp.neighbProcNo_),
neighbFaceCentres_(), neighbFaceCentres_(),
@ -1091,11 +1082,6 @@ bool Foam::processorPolyPatch::order
void Foam::processorPolyPatch::write(Ostream& os) const void Foam::processorPolyPatch::write(Ostream& os) const
{ {
coupledPolyPatch::write(os); coupledPolyPatch::write(os);
// if (comm_ != UPstream::worldComm)
// {
// os.writeKeyword("communicator") << comm_
// << token::END_STATEMENT << nl;
// }
os.writeKeyword("myProcNo") << myProcNo_ os.writeKeyword("myProcNo") << myProcNo_
<< token::END_STATEMENT << nl; << token::END_STATEMENT << nl;
os.writeKeyword("neighbProcNo") << neighbProcNo_ os.writeKeyword("neighbProcNo") << neighbProcNo_

View File

@ -134,7 +134,6 @@ public:
const label start, const label start,
const label index, const label index,
const polyBoundaryMesh& bm, const polyBoundaryMesh& bm,
const label comm,
const int myProcNo, const int myProcNo,
const int neighbProcNo, const int neighbProcNo,
const transformType transform = UNKNOWN // transformation type const transformType transform = UNKNOWN // transformation type

View File

@ -46,7 +46,6 @@ Foam::processorCyclicPolyPatch::processorCyclicPolyPatch
const label start, const label start,
const label index, const label index,
const polyBoundaryMesh& bm, const polyBoundaryMesh& bm,
const label comm,
const int myProcNo, const int myProcNo,
const int neighbProcNo, const int neighbProcNo,
const word& referPatchName, const word& referPatchName,
@ -60,7 +59,6 @@ Foam::processorCyclicPolyPatch::processorCyclicPolyPatch
start, start,
index, index,
bm, bm,
comm,
myProcNo, myProcNo,
neighbProcNo, neighbProcNo,
transform transform

View File

@ -119,7 +119,6 @@ public:
const label start, const label start,
const label index, const label index,
const polyBoundaryMesh& bm, const polyBoundaryMesh& bm,
const label comm,
const int myProcNo, const int myProcNo,
const int neighbProcNo, const int neighbProcNo,
const word& referPatchName, const word& referPatchName,

View File

@ -945,7 +945,6 @@ void Foam::fvMeshDistribute::addProcPatches
mesh_.nFaces(), mesh_.nFaces(),
mesh_.boundaryMesh().size(), mesh_.boundaryMesh().size(),
mesh_.boundaryMesh(), mesh_.boundaryMesh(),
Pstream::worldComm,
Pstream::myProcNo(), Pstream::myProcNo(),
nbrProc[bFaceI] nbrProc[bFaceI]
); );
@ -989,7 +988,6 @@ void Foam::fvMeshDistribute::addProcPatches
mesh_.nFaces(), mesh_.nFaces(),
mesh_.boundaryMesh().size(), mesh_.boundaryMesh().size(),
mesh_.boundaryMesh(), mesh_.boundaryMesh(),
Pstream::worldComm,
Pstream::myProcNo(), Pstream::myProcNo(),
nbrProc[bFaceI], nbrProc[bFaceI],
cycName, cycName,

View File

@ -46,6 +46,7 @@ timeVaryingMappedFixedValueFvPatchField
fieldTableName_(iF.name()), fieldTableName_(iF.name()),
setAverage_(false), setAverage_(false),
perturb_(0), perturb_(0),
mapperPtr_(NULL),
sampleTimes_(0), sampleTimes_(0),
startSampleTime_(-1), startSampleTime_(-1),
startSampledValues_(0), startSampledValues_(0),
@ -71,7 +72,7 @@ timeVaryingMappedFixedValueFvPatchField
fieldTableName_(ptf.fieldTableName_), fieldTableName_(ptf.fieldTableName_),
setAverage_(ptf.setAverage_), setAverage_(ptf.setAverage_),
perturb_(ptf.perturb_), perturb_(ptf.perturb_),
mapperPtr_(ptf.mapperPtr_), mapperPtr_(NULL),
sampleTimes_(0), sampleTimes_(0),
startSampleTime_(-1), startSampleTime_(-1),
startSampledValues_(0), startSampledValues_(0),
@ -79,7 +80,12 @@ timeVaryingMappedFixedValueFvPatchField
endSampleTime_(-1), endSampleTime_(-1),
endSampledValues_(0), endSampledValues_(0),
endAverage_(pTraits<Type>::zero), endAverage_(pTraits<Type>::zero),
offset_(ptf.offset_().clone().ptr()) offset_
(
ptf.offset_.valid()
? ptf.offset_().clone().ptr()
: NULL
)
{} {}
@ -130,7 +136,7 @@ timeVaryingMappedFixedValueFvPatchField
fieldTableName_(ptf.fieldTableName_), fieldTableName_(ptf.fieldTableName_),
setAverage_(ptf.setAverage_), setAverage_(ptf.setAverage_),
perturb_(ptf.perturb_), perturb_(ptf.perturb_),
mapperPtr_(ptf.mapperPtr_), mapperPtr_(NULL),
sampleTimes_(ptf.sampleTimes_), sampleTimes_(ptf.sampleTimes_),
startSampleTime_(ptf.startSampleTime_), startSampleTime_(ptf.startSampleTime_),
startSampledValues_(ptf.startSampledValues_), startSampledValues_(ptf.startSampledValues_),
@ -138,11 +144,15 @@ timeVaryingMappedFixedValueFvPatchField
endSampleTime_(ptf.endSampleTime_), endSampleTime_(ptf.endSampleTime_),
endSampledValues_(ptf.endSampledValues_), endSampledValues_(ptf.endSampledValues_),
endAverage_(ptf.endAverage_), endAverage_(ptf.endAverage_),
offset_(ptf.offset_().clone().ptr()) offset_
(
ptf.offset_.valid()
? ptf.offset_().clone().ptr()
: NULL
)
{} {}
template<class Type> template<class Type>
timeVaryingMappedFixedValueFvPatchField<Type>:: timeVaryingMappedFixedValueFvPatchField<Type>::
timeVaryingMappedFixedValueFvPatchField timeVaryingMappedFixedValueFvPatchField
@ -155,7 +165,7 @@ timeVaryingMappedFixedValueFvPatchField
fieldTableName_(ptf.fieldTableName_), fieldTableName_(ptf.fieldTableName_),
setAverage_(ptf.setAverage_), setAverage_(ptf.setAverage_),
perturb_(ptf.perturb_), perturb_(ptf.perturb_),
mapperPtr_(ptf.mapperPtr_), mapperPtr_(NULL),
sampleTimes_(ptf.sampleTimes_), sampleTimes_(ptf.sampleTimes_),
startSampleTime_(ptf.startSampleTime_), startSampleTime_(ptf.startSampleTime_),
startSampledValues_(ptf.startSampledValues_), startSampledValues_(ptf.startSampledValues_),
@ -163,7 +173,12 @@ timeVaryingMappedFixedValueFvPatchField
endSampleTime_(ptf.endSampleTime_), endSampleTime_(ptf.endSampleTime_),
endSampledValues_(ptf.endSampledValues_), endSampledValues_(ptf.endSampledValues_),
endAverage_(ptf.endAverage_), endAverage_(ptf.endAverage_),
offset_(ptf.offset_().clone().ptr()) offset_
(
ptf.offset_.valid()
? ptf.offset_().clone().ptr()
: NULL
)
{} {}

View File

@ -59,7 +59,11 @@ Foam::MGridGenGAMGAgglomeration::MGridGenGAMGAgglomeration
// Start geometric agglomeration from the cell volumes and areas of the mesh // Start geometric agglomeration from the cell volumes and areas of the mesh
scalarField* VPtr = const_cast<scalarField*>(&fvMesh_.cellVolumes()); scalarField* VPtr = const_cast<scalarField*>(&fvMesh_.cellVolumes());
vectorField* SfPtr = const_cast<vectorField*>(&fvMesh_.faceAreas()); SubField<vector> Sf(fvMesh_.faceAreas(), fvMesh_.nInternalFaces());
vectorField* SfPtr = const_cast<vectorField*>
(
&Sf.operator const vectorField&()
);
// Create the boundary area cell field // Create the boundary area cell field
scalarField* SbPtr(new scalarField(fvMesh_.nCells(), 0)); scalarField* SbPtr(new scalarField(fvMesh_.nCells(), 0));

View File

@ -522,6 +522,7 @@ void Foam::autoRefineDriver::baffleAndSplitMesh
false, // perpendicular edge connected cells false, // perpendicular edge connected cells
scalarField(0), // per region perpendicular angle scalarField(0), // per region perpendicular angle
!handleSnapProblems, // merge free standing baffles? !handleSnapProblems, // merge free standing baffles?
refineParams.planarAngle(),
motionDict, motionDict,
const_cast<Time&>(mesh.time()), const_cast<Time&>(mesh.time()),
globalToMasterPatch_, globalToMasterPatch_,
@ -606,8 +607,8 @@ void Foam::autoRefineDriver::splitAndMergeBaffles
handleSnapProblems, handleSnapProblems,
handleSnapProblems, // remove perp edge connected cells handleSnapProblems, // remove perp edge connected cells
perpAngle, // perp angle perpAngle, // perp angle
false, // merge free standing baffles? true, // merge free standing baffles?
//true, // merge free standing baffles? refineParams.planarAngle(), // planar angle
motionDict, motionDict,
const_cast<Time&>(mesh.time()), const_cast<Time&>(mesh.time()),
globalToMasterPatch_, globalToMasterPatch_,

View File

@ -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) 2011-2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -41,6 +41,7 @@ Foam::refinementParameters::refinementParameters
maxLocalCells_(readLabel(dict.lookup("procCellLimit"))), maxLocalCells_(readLabel(dict.lookup("procCellLimit"))),
minRefineCells_(readLabel(dict.lookup("minimumRefine"))), minRefineCells_(readLabel(dict.lookup("minimumRefine"))),
curvature_(readScalar(dict.lookup("curvature"))), curvature_(readScalar(dict.lookup("curvature"))),
planarAngle_(dict.lookupOrDefault("planarAngle", curvature_)),
nBufferLayers_(readLabel(dict.lookup("nBufferLayers"))), nBufferLayers_(readLabel(dict.lookup("nBufferLayers"))),
keepPoints_(dict.lookup("keepPoints")), keepPoints_(dict.lookup("keepPoints")),
allowFreeStandingZoneFaces_(dict.lookup("allowFreeStandingZoneFaces")), allowFreeStandingZoneFaces_(dict.lookup("allowFreeStandingZoneFaces")),
@ -53,6 +54,14 @@ Foam::refinementParameters::refinementParameters(const dictionary& dict)
maxGlobalCells_(readLabel(dict.lookup("maxGlobalCells"))), maxGlobalCells_(readLabel(dict.lookup("maxGlobalCells"))),
maxLocalCells_(readLabel(dict.lookup("maxLocalCells"))), maxLocalCells_(readLabel(dict.lookup("maxLocalCells"))),
minRefineCells_(readLabel(dict.lookup("minRefinementCells"))), minRefineCells_(readLabel(dict.lookup("minRefinementCells"))),
planarAngle_
(
dict.lookupOrDefault
(
"planarAngle",
readScalar(dict.lookup("resolveFeatureAngle"))
)
),
nBufferLayers_(readLabel(dict.lookup("nCellsBetweenLevels"))), nBufferLayers_(readLabel(dict.lookup("nCellsBetweenLevels"))),
keepPoints_(pointField(1, dict.lookup("locationInMesh"))), keepPoints_(pointField(1, dict.lookup("locationInMesh"))),
allowFreeStandingZoneFaces_(dict.lookup("allowFreeStandingZoneFaces")), allowFreeStandingZoneFaces_(dict.lookup("allowFreeStandingZoneFaces")),

View File

@ -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) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -67,6 +67,9 @@ class refinementParameters
//- Curvature //- Curvature
scalar curvature_; scalar curvature_;
//- Planarity criterion
scalar planarAngle_;
//- Number of layers between different refinement levels //- Number of layers between different refinement levels
const label nBufferLayers_; const label nBufferLayers_;
@ -129,6 +132,12 @@ public:
return curvature_; return curvature_;
} }
//- Angle when two intersections are considered to be planar
scalar planarAngle() const
{
return planarAngle_;
}
//- Number of layers between different refinement levels //- Number of layers between different refinement levels
label nBufferLayers() const label nBufferLayers() const
{ {

View File

@ -253,6 +253,14 @@ private:
label& nRefine label& nRefine
); );
//- Mark every cell with level of feature passing through it
// (or -1 if not passed through). Uses tracking.
void markFeatureCellLevel
(
const point& keepPoint,
labelList& maxFeatureLevel
) const;
//- Calculate list of cells to refine based on intersection of //- Calculate list of cells to refine based on intersection of
// features. // features.
label markFeatureRefinement label markFeatureRefinement
@ -337,16 +345,6 @@ private:
const labelList& globalToSlavePatch const labelList& globalToSlavePatch
) const; ) const;
//- Geometric test on see whether face needs to be baffled:
// is face boundary face and perpendicular to surface normal?
bool validBaffleTopology
(
const label faceI,
const vector& n1,
const vector& n2,
const vector& testDir
) const;
//- Determine patches for baffles //- Determine patches for baffles
void getBafflePatches void getBafflePatches
( (
@ -435,7 +433,11 @@ private:
//- Extract those baffles (duplicate) faces that are on the edge //- Extract those baffles (duplicate) faces that are on the edge
// of a baffle region. These are candidates for merging. // of a baffle region. These are candidates for merging.
List<labelPair> freeStandingBaffles(const List<labelPair>&) const; List<labelPair> freeStandingBaffles
(
const List<labelPair>&,
const scalar freeStandingAngle
) const;
// Zone handling // Zone handling
@ -489,6 +491,16 @@ private:
labelList& namedSurfaceIndex labelList& namedSurfaceIndex
) const; ) const;
//- Remove any loose standing cells
void handleSnapProblems
(
const bool removeEdgeConnectedCells,
const scalarField& perpendicularAngle,
const dictionary& motionDict,
Time& runTime,
const labelList& globalToMasterPatch,
const labelList& globalToSlavePatch
);
//- Disallow default bitwise copy construct //- Disallow default bitwise copy construct
meshRefinement(const meshRefinement&); meshRefinement(const meshRefinement&);
@ -707,6 +719,7 @@ public:
const bool removeEdgeConnectedCells, const bool removeEdgeConnectedCells,
const scalarField& perpendicularAngle, const scalarField& perpendicularAngle,
const bool mergeFreeStanding, const bool mergeFreeStanding,
const scalar freeStandingAngle,
const dictionary& motionDict, const dictionary& motionDict,
Time& runTime, Time& runTime,
const labelList& globalToMasterPatch, const labelList& globalToMasterPatch,

View File

@ -44,6 +44,7 @@ License
#include "regionSplit.H" #include "regionSplit.H"
#include "removeCells.H" #include "removeCells.H"
#include "unitConversion.H" #include "unitConversion.H"
#include "OBJstream.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -217,43 +218,43 @@ Foam::label Foam::meshRefinement::getBafflePatch
} }
// Check if we are a boundary face and normal of surface does //// Check if we are a boundary face and normal of surface does
// not align with test vector. In this case there'd probably be //// not align with test vector. In this case there'd probably be
// a freestanding 'baffle' so we might as well not create it. //// a freestanding 'baffle' so we might as well not create it.
// Note that since it is not a proper baffle we cannot detect it //// Note that since it is not a proper baffle we cannot detect it
// afterwards so this code cannot be merged with the //// afterwards so this code cannot be merged with the
// filterDuplicateFaces code. //// filterDuplicateFaces code.
bool Foam::meshRefinement::validBaffleTopology //bool Foam::meshRefinement::validBaffleTopology
( //(
const label faceI, // const label faceI,
const vector& n1, // const vector& n1,
const vector& n2, // const vector& n2,
const vector& testDir // const vector& testDir
) const //) const
{ //{
//
label patchI = mesh_.boundaryMesh().whichPatch(faceI); // label patchI = mesh_.boundaryMesh().whichPatch(faceI);
if (patchI == -1 || mesh_.boundaryMesh()[patchI].coupled()) // if (patchI == -1 || mesh_.boundaryMesh()[patchI].coupled())
{ // {
return true; // return true;
} // }
else if (mag(n1&n2) > cos(degToRad(30))) // else if (mag(n1&n2) > cos(degToRad(30)))
{ // {
// Both normals aligned. Check that test vector perpendicularish to // // Both normals aligned. Check that test vector perpendicularish to
// surface normal // // surface normal
scalar magTestDir = mag(testDir); // scalar magTestDir = mag(testDir);
if (magTestDir > VSMALL) // if (magTestDir > VSMALL)
{ // {
if (mag(n1&(testDir/magTestDir)) < cos(degToRad(45))) // if (mag(n1&(testDir/magTestDir)) < cos(degToRad(45)))
{ // {
//Pout<< "** disabling baffling face " // //Pout<< "** disabling baffling face "
// << mesh_.faceCentres()[faceI] << endl; // // << mesh_.faceCentres()[faceI] << endl;
return false; // return false;
} // }
} // }
} // }
return true; // return true;
} //}
// Determine patches for baffles on all intersected unnamed faces // Determine patches for baffles on all intersected unnamed faces
@ -800,7 +801,8 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::createZoneBaffles
// region. // region.
Foam::List<Foam::labelPair> Foam::meshRefinement::freeStandingBaffles Foam::List<Foam::labelPair> Foam::meshRefinement::freeStandingBaffles
( (
const List<labelPair>& couples const List<labelPair>& couples,
const scalar planarAngle
) const ) const
{ {
// All duplicate faces on edge of the patch are to be merged. // All duplicate faces on edge of the patch are to be merged.
@ -809,6 +811,22 @@ Foam::List<Foam::labelPair> Foam::meshRefinement::freeStandingBaffles
labelList nBafflesPerEdge(mesh_.nEdges(), 0); labelList nBafflesPerEdge(mesh_.nEdges(), 0);
// This algorithm is quite tricky. We don't want to use edgeFaces and
// also want it to run in parallel so it is now an algorithm over
// all (boundary) faces instead.
// We want to pick up any edges that are only used by the baffle
// or internal faces but not by any other boundary faces. So
// - increment count on an edge by 1 if it is used by any (uncoupled)
// boundary face.
// - increment count on an edge by 1000000 if it is used by a baffle face
// - sum in parallel
//
// So now any edge that is used by baffle faces only will have the
// value 2*1000000+2*1.
const label baffleValue = 1000000;
// Count number of boundary faces per edge // Count number of boundary faces per edge
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -847,18 +865,22 @@ Foam::List<Foam::labelPair> Foam::meshRefinement::freeStandingBaffles
forAll(couples, i) forAll(couples, i)
{ {
const labelList& fEdges0 = mesh_.faceEdges(couples[i].first(), fe0);
forAll(fEdges0, fEdgeI)
{ {
nBafflesPerEdge[fEdges0[fEdgeI]] += 1000000; label f0 = couples[i].first();
const labelList& fEdges0 = mesh_.faceEdges(f0, fe0);
forAll(fEdges0, fEdgeI)
{
nBafflesPerEdge[fEdges0[fEdgeI]] += baffleValue;
}
} }
const labelList& fEdges1 = mesh_.faceEdges(couples[i].second(), fe1);
forAll(fEdges1, fEdgeI)
{ {
nBafflesPerEdge[fEdges1[fEdgeI]] += 1000000; label f1 = couples[i].second();
const labelList& fEdges1 = mesh_.faceEdges(f1, fe1);
forAll(fEdges1, fEdgeI)
{
nBafflesPerEdge[fEdges1[fEdgeI]] += baffleValue;
}
} }
} }
@ -873,8 +895,8 @@ Foam::List<Foam::labelPair> Foam::meshRefinement::freeStandingBaffles
// Baffles which are not next to other boundaries and baffles will have // Baffles which are not next to other boundaries and baffles will have
// nBafflesPerEdge value 2*1000000+2*1 (from 2 boundary faces which are // nBafflesPerEdge value 2*baffleValue+2*1 (from 2 boundary faces which
// both baffle faces) // are both baffle faces)
List<labelPair> filteredCouples(couples.size()); List<labelPair> filteredCouples(couples.size());
label filterI = 0; label filterI = 0;
@ -889,15 +911,15 @@ Foam::List<Foam::labelPair> Foam::meshRefinement::freeStandingBaffles
== patches.whichPatch(couple.second()) == patches.whichPatch(couple.second())
) )
{ {
const labelList& fEdges = mesh_.faceEdges(couples[i].first()); const labelList& fEdges = mesh_.faceEdges(couple.first());
forAll(fEdges, fEdgeI) forAll(fEdges, fEdgeI)
{ {
label edgeI = fEdges[fEdgeI]; label edgeI = fEdges[fEdgeI];
if (nBafflesPerEdge[edgeI] == 2*1000000+2*1) if (nBafflesPerEdge[edgeI] == 2*baffleValue+2*1)
{ {
filteredCouples[filterI++] = couples[i]; filteredCouples[filterI++] = couple;
break; break;
} }
} }
@ -905,111 +927,127 @@ Foam::List<Foam::labelPair> Foam::meshRefinement::freeStandingBaffles
} }
filteredCouples.setSize(filterI); filteredCouples.setSize(filterI);
//Info<< "freeStandingBaffles : from "
// << returnReduce(couples.size(), sumOp<label>()) label nFiltered = returnReduce(filteredCouples.size(), sumOp<label>());
// << " down to "
// << returnReduce(filteredCouples.size(), sumOp<label>()) Info<< "freeStandingBaffles : detected "
// << " baffles." << nl << endl; << nFiltered
<< " free-standing baffles out of "
<< returnReduce(couples.size(), sumOp<label>())
<< nl << endl;
if (nFiltered > 0)
{
// Collect segments
// ~~~~~~~~~~~~~~~~
//XXXXXX pointField start(filteredCouples.size());
// { pointField end(filteredCouples.size());
// // Collect segments
// // ~~~~~~~~~~~~~~~~
//
// pointField start(filteredCouples.size());
// pointField end(filteredCouples.size());
//
// const pointField& cellCentres = mesh_.cellCentres();
//
// forAll(filteredCouples, i)
// {
// const labelPair& couple = couples[i];
// start[i] = cellCentres[mesh_.faceOwner()[couple.first()]];
// end[i] = cellCentres[mesh_.faceOwner()[couple.second()]];
// }
//
// // Extend segments a bit
// {
// const vectorField smallVec(Foam::sqrt(SMALL)*(end-start));
// start -= smallVec;
// end += smallVec;
// }
//
//
// // Do test for intersections
// // ~~~~~~~~~~~~~~~~~~~~~~~~~
// labelList surface1;
// List<pointIndexHit> hit1;
// labelList region1;
// vectorField normal1;
//
// labelList surface2;
// List<pointIndexHit> hit2;
// labelList region2;
// vectorField normal2;
//
// surfaces_.findNearestIntersection
// (
// surfacesToBaffle,
// start,
// end,
//
// surface1,
// hit1,
// region1,
// normal1,
//
// surface2,
// hit2,
// region2,
// normal2
// );
//
// forAll(testFaces, i)
// {
// if (hit1[i].hit() && hit2[i].hit())
// {
// bool createBaffle = true;
//
// label faceI = couples[i].first();
// label patchI = mesh_.boundaryMesh().whichPatch(faceI);
// if (patchI != -1 && !mesh_.boundaryMesh()[patchI].coupled())
// {
// // Check if we are a boundary face and normal of surface
// // does
// // not align with test vector. In this case there'd
// // probably be
// // a freestanding 'baffle' so we might as well not
// // create it.
// // Note that since it is not a proper baffle we cannot
// // detect it
// // afterwards so this code cannot be merged with the
// // filterDuplicateFaces code.
// if (mag(normal1[i]&normal2[i]) > cos(degToRad(30)))
// {
// // Both normals aligned
// vector n = end[i]-start[i];
// scalar magN = mag(n);
// if (magN > VSMALL)
// {
// n /= magN;
//
// if (mag(normal1[i]&n) < cos(degToRad(45)))
// {
// Pout<< "** disabling baffling face "
// << mesh_.faceCentres()[faceI] << endl;
// createBaffle = false;
// }
// }
// }
// }
//
//
// }
//XXXXXX
const pointField& cellCentres = mesh_.cellCentres();
forAll(filteredCouples, i)
{
const labelPair& couple = filteredCouples[i];
start[i] = cellCentres[mesh_.faceOwner()[couple.first()]];
end[i] = cellCentres[mesh_.faceOwner()[couple.second()]];
}
// Extend segments a bit
{
const vectorField smallVec(Foam::sqrt(SMALL)*(end-start));
start -= smallVec;
end += smallVec;
}
// Do test for intersections
// ~~~~~~~~~~~~~~~~~~~~~~~~~
labelList surface1;
List<pointIndexHit> hit1;
labelList region1;
vectorField normal1;
labelList surface2;
List<pointIndexHit> hit2;
labelList region2;
vectorField normal2;
surfaces_.findNearestIntersection
(
identity(surfaces_.surfaces().size()),
start,
end,
surface1,
hit1,
region1,
normal1,
surface2,
hit2,
region2,
normal2
);
//mkDir(mesh_.time().path()/timeName());
//OBJstream str
//(
// mesh_.time().path()/timeName()/"flatBaffles.obj"
//);
const scalar planarAngleCos = Foam::cos(degToRad(planarAngle));
label filterI = 0;
forAll(filteredCouples, i)
{
const labelPair& couple = filteredCouples[i];
if
(
hit1[i].hit()
&& hit2[i].hit()
&& (
surface1[i] != surface2[i]
|| hit1[i].index() != hit2[i].index()
)
)
{
// Two different hits. Check angle.
//str.write
//(
// linePointRef(hit1[i].hitPoint(), hit2[i].hitPoint()),
// normal1[i],
// normal2[i]
//);
if ((normal1[i]&normal2[i]) > planarAngleCos)
{
// Both normals aligned
vector n = end[i]-start[i];
scalar magN = mag(n);
if (magN > VSMALL)
{
filteredCouples[filterI++] = couple;
}
}
}
else if (hit1[i].hit() || hit2[i].hit())
{
// Single hit. Do not include in freestanding baffles.
}
}
filteredCouples.setSize(filterI);
Info<< "freeStandingBaffles : detected "
<< returnReduce(filterI, sumOp<label>())
<< " planar (within " << planarAngle
<< " degrees) free-standing baffles out of "
<< nFiltered
<< nl << endl;
}
return filteredCouples; return filteredCouples;
} }
@ -1832,15 +1870,102 @@ void Foam::meshRefinement::makeConsistentFaceIndex
} }
void Foam::meshRefinement::handleSnapProblems
(
const bool removeEdgeConnectedCells,
const scalarField& perpendicularAngle,
const dictionary& motionDict,
Time& runTime,
const labelList& globalToMasterPatch,
const labelList& globalToSlavePatch
)
{
Info<< nl
<< "Introducing baffles to block off problem cells" << nl
<< "----------------------------------------------" << nl
<< endl;
labelList facePatch
(
markFacesOnProblemCells
(
motionDict,
removeEdgeConnectedCells,
perpendicularAngle,
globalToMasterPatch
)
);
Info<< "Analyzed problem cells in = "
<< runTime.cpuTimeIncrement() << " s\n" << nl << endl;
if (debug&meshRefinement::MESH)
{
faceSet problemTopo(mesh_, "problemFacesTopo", 100);
const labelList facePatchTopo
(
markFacesOnProblemCells
(
motionDict,
removeEdgeConnectedCells,
perpendicularAngle,
globalToMasterPatch
)
);
forAll(facePatchTopo, faceI)
{
if (facePatchTopo[faceI] != -1)
{
problemTopo.insert(faceI);
}
}
problemTopo.instance() = timeName();
Pout<< "Dumping " << problemTopo.size()
<< " problem faces to " << problemTopo.objectPath() << endl;
problemTopo.write();
}
Info<< "Introducing baffles to delete problem cells." << nl << endl;
if (debug)
{
runTime++;
}
// Create baffles with same owner and neighbour for now.
createBaffles(facePatch, facePatch);
if (debug)
{
// Debug:test all is still synced across proc patches
checkData();
}
Info<< "Created baffles in = "
<< runTime.cpuTimeIncrement() << " s\n" << nl << endl;
printMeshInfo(debug, "After introducing baffles");
if (debug&meshRefinement::MESH)
{
Pout<< "Writing extra baffled mesh to time "
<< timeName() << endl;
write(debug, runTime.path()/"extraBaffles");
Pout<< "Dumped debug data in = "
<< runTime.cpuTimeIncrement() << " s\n" << nl << endl;
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
// Split off unreachable areas of mesh. // Split off unreachable areas of mesh.
void Foam::meshRefinement::baffleAndSplitMesh void Foam::meshRefinement::baffleAndSplitMesh
( (
const bool handleSnapProblems, const bool doHandleSnapProblems,
const bool removeEdgeConnectedCells, const bool removeEdgeConnectedCells,
const scalarField& perpendicularAngle, const scalarField& perpendicularAngle,
const bool mergeFreeStanding, const bool mergeFreeStanding,
const scalar freeStandingAngle,
const dictionary& motionDict, const dictionary& motionDict,
Time& runTime, Time& runTime,
const labelList& globalToMasterPatch, const labelList& globalToMasterPatch,
@ -1902,82 +2027,92 @@ void Foam::meshRefinement::baffleAndSplitMesh
// Create some additional baffles where we want surface cells removed. // Create some additional baffles where we want surface cells removed.
if (handleSnapProblems) if (doHandleSnapProblems)
{ {
Info<< nl //Info<< nl
<< "Introducing baffles to block off problem cells" << nl // << "Introducing baffles to block off problem cells" << nl
<< "----------------------------------------------" << nl // << "----------------------------------------------" << nl
<< endl; // << endl;
//
//labelList facePatch
//(
// markFacesOnProblemCells
// (
// motionDict,
// removeEdgeConnectedCells,
// perpendicularAngle,
// globalToMasterPatch
// )
// //markFacesOnProblemCellsGeometric(motionDict)
//);
//Info<< "Analyzed problem cells in = "
// << runTime.cpuTimeIncrement() << " s\n" << nl << endl;
//
//if (debug&meshRefinement::MESH)
//{
// faceSet problemTopo(mesh_, "problemFacesTopo", 100);
//
// const labelList facePatchTopo
// (
// markFacesOnProblemCells
// (
// motionDict,
// removeEdgeConnectedCells,
// perpendicularAngle,
// globalToMasterPatch
// )
// );
// forAll(facePatchTopo, faceI)
// {
// if (facePatchTopo[faceI] != -1)
// {
// problemTopo.insert(faceI);
// }
// }
// problemTopo.instance() = timeName();
// Pout<< "Dumping " << problemTopo.size()
// << " problem faces to " << problemTopo.objectPath() << endl;
// problemTopo.write();
//}
//
//Info<< "Introducing baffles to delete problem cells." << nl << endl;
//
//if (debug)
//{
// runTime++;
//}
//
//// Create baffles with same owner and neighbour for now.
//createBaffles(facePatch, facePatch);
//
//if (debug)
//{
// // Debug:test all is still synced across proc patches
// checkData();
//}
//Info<< "Created baffles in = "
// << runTime.cpuTimeIncrement() << " s\n" << nl << endl;
//
//printMeshInfo(debug, "After introducing baffles");
//
//if (debug&meshRefinement::MESH)
//{
// Pout<< "Writing extra baffled mesh to time "
// << timeName() << endl;
// write(debug, runTime.path()/"extraBaffles");
// Pout<< "Dumped debug data in = "
// << runTime.cpuTimeIncrement() << " s\n" << nl << endl;
//}
labelList facePatch handleSnapProblems
( (
markFacesOnProblemCells removeEdgeConnectedCells,
( perpendicularAngle,
motionDict, motionDict,
removeEdgeConnectedCells, runTime,
perpendicularAngle, globalToMasterPatch,
globalToMasterPatch globalToSlavePatch
)
//markFacesOnProblemCellsGeometric(motionDict)
); );
Info<< "Analyzed problem cells in = "
<< runTime.cpuTimeIncrement() << " s\n" << nl << endl;
if (debug&meshRefinement::MESH)
{
faceSet problemTopo(mesh_, "problemFacesTopo", 100);
const labelList facePatchTopo
(
markFacesOnProblemCells
(
motionDict,
removeEdgeConnectedCells,
perpendicularAngle,
globalToMasterPatch
)
);
forAll(facePatchTopo, faceI)
{
if (facePatchTopo[faceI] != -1)
{
problemTopo.insert(faceI);
}
}
problemTopo.instance() = timeName();
Pout<< "Dumping " << problemTopo.size()
<< " problem faces to " << problemTopo.objectPath() << endl;
problemTopo.write();
}
Info<< "Introducing baffles to delete problem cells." << nl << endl;
if (debug)
{
runTime++;
}
// Create baffles with same owner and neighbour for now.
createBaffles(facePatch, facePatch);
if (debug)
{
// Debug:test all is still synced across proc patches
checkData();
}
Info<< "Created baffles in = "
<< runTime.cpuTimeIncrement() << " s\n" << nl << endl;
printMeshInfo(debug, "After introducing baffles");
if (debug&meshRefinement::MESH)
{
Pout<< "Writing extra baffled mesh to time "
<< timeName() << endl;
write(debug, runTime.path()/"extraBaffles");
Pout<< "Dumped debug data in = "
<< runTime.cpuTimeIncrement() << " s\n" << nl << endl;
}
} }
@ -2036,7 +2171,8 @@ void Foam::meshRefinement::baffleAndSplitMesh
( (
identity(mesh_.nFaces()-mesh_.nInternalFaces()) identity(mesh_.nFaces()-mesh_.nInternalFaces())
+mesh_.nInternalFaces() +mesh_.nInternalFaces()
) ),
freeStandingAngle
) )
); );
@ -2052,6 +2188,18 @@ void Foam::meshRefinement::baffleAndSplitMesh
// from them. // from them.
mergeBaffles(couples); mergeBaffles(couples);
// Detect any problem cells resulting from merging of baffles
// and delete them
handleSnapProblems
(
removeEdgeConnectedCells,
perpendicularAngle,
motionDict,
runTime,
globalToMasterPatch,
globalToSlavePatch
);
if (debug) if (debug)
{ {
// Debug:test all is still synced across proc patches // Debug:test all is still synced across proc patches
@ -2663,18 +2811,6 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::zonify
if (surface1[i] != -1) if (surface1[i] != -1)
{ {
//- Not allowed not to create baffle - is vital for regioning.
// Have logic instead at erosion!
//bool createBaffle = validBaffleTopology
//(
// faceI,
// normal1[i],
// normal2[i],
// end[i]-start[i]
//);
//
// If both hit should probably choose 'nearest' // If both hit should probably choose 'nearest'
if if
( (

View File

@ -244,14 +244,10 @@ bool Foam::meshRefinement::markForRefine
} }
// Calculates list of cells to refine based on intersection with feature edge. void Foam::meshRefinement::markFeatureCellLevel
Foam::label Foam::meshRefinement::markFeatureRefinement
( (
const point& keepPoint, const point& keepPoint,
const label nAllowRefine, labelList& maxFeatureLevel
labelList& refineCell,
label& nRefine
) const ) const
{ {
// We want to refine all cells containing a feature edge. // We want to refine all cells containing a feature edge.
@ -384,7 +380,7 @@ Foam::label Foam::meshRefinement::markFeatureRefinement
// Largest refinement level of any feature passed through // Largest refinement level of any feature passed through
labelList maxFeatureLevel(mesh_.nCells(), -1); maxFeatureLevel = labelList(mesh_.nCells(), -1);
// Database to pass into trackedParticle::move // Database to pass into trackedParticle::move
trackedParticle::trackingData td(cloud, maxFeatureLevel); trackedParticle::trackingData td(cloud, maxFeatureLevel);
@ -467,8 +463,23 @@ Foam::label Foam::meshRefinement::markFeatureRefinement
// Track all particles to their end position. // Track all particles to their end position.
cloud.move(td, GREAT); cloud.move(td, GREAT);
} }
}
// Calculates list of cells to refine based on intersection with feature edge.
Foam::label Foam::meshRefinement::markFeatureRefinement
(
const point& keepPoint,
const label nAllowRefine,
labelList& refineCell,
label& nRefine
) const
{
// Largest refinement level of any feature passed through
labelList maxFeatureLevel;
markFeatureCellLevel(keepPoint, maxFeatureLevel);
// See which cells to refine. maxFeatureLevel will hold highest level // See which cells to refine. maxFeatureLevel will hold highest level
// of any feature edge that passed through. // of any feature edge that passed through.

View File

@ -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) 2011-2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -38,7 +38,7 @@ Description
type writeRegisteredObject; type writeRegisteredObject;
functionObjectLibs ("libIOFunctionObjects.so"); functionObjectLibs ("libIOFunctionObjects.so");
... ...
objectNames (obj1 obj2); objectNames (obj1 obj2);
} }
\endverbatim \endverbatim

View File

@ -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) 2011-2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -25,6 +25,7 @@ License
#include "thermoSingleLayer.H" #include "thermoSingleLayer.H"
#include "heatTransferModel.H" #include "heatTransferModel.H"
#include "filmRadiationModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -202,7 +202,7 @@ Foam::labelList Foam::structuredRenumber::renumber
if (depthFirst_) if (depthFirst_)
{ {
orderedToOld[nLayers*cellData[cellI].data()+layerI] = cellI; orderedToOld[nLayers*cellData[cellI].data()+layerI] = cellI;
} }
else else
{ {
orderedToOld[cellData[cellI].data()+nLayers*layerI] = cellI; orderedToOld[cellData[cellI].data()+nLayers*layerI] = cellI;