Merging master, fixing conflict in searchableBox.C

This commit is contained in:
graham
2009-06-18 15:26:01 +01:00
775 changed files with 31691 additions and 7312 deletions

View File

@ -177,7 +177,7 @@ Foam::sigFpe::~sigFpe()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::sigFpe::set()
void Foam::sigFpe::set(const bool verbose)
{
if (oldAction_.sa_handler)
{
@ -190,6 +190,12 @@ void Foam::sigFpe::set()
if (env("FOAM_SIGFPE"))
{
if (verbose)
{
Info<< "SigFpe : Enabling floating point exception trapping"
<< " (FOAM_SIGFPE)." << endl;
}
# ifdef LINUX_GNUC
feenableexcept
@ -240,6 +246,12 @@ void Foam::sigFpe::set()
if (env("FOAM_SETNAN"))
{
if (verbose)
{
Info<< "SetNaN : Initialising allocated memory to NaN"
<< " (FOAM_SETNAN)." << endl;
}
# ifdef LINUX_GNUC
// Set our malloc

View File

@ -107,7 +107,7 @@ public:
// Member functions
void set();
void set(const bool verbose);
};

View File

@ -81,7 +81,7 @@ Foam::sigInt::~sigInt()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::sigInt::set()
void Foam::sigInt::set(const bool verbose)
{
if (oldAction_.sa_handler)
{

View File

@ -78,7 +78,7 @@ public:
// Member functions
void set();
void set(const bool verbose);
};

View File

@ -83,7 +83,7 @@ Foam::sigQuit::~sigQuit()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::sigQuit::set()
void Foam::sigQuit::set(const bool verbose)
{
if (oldAction_.sa_handler)
{

View File

@ -78,7 +78,7 @@ public:
// Member functions
void set();
void set(const bool verbose);
};

View File

@ -83,7 +83,7 @@ Foam::sigSegv::~sigSegv()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::sigSegv::set()
void Foam::sigSegv::set(const bool verbose)
{
if (oldAction_.sa_handler)
{

View File

@ -78,7 +78,7 @@ public:
// Member functions
void set();
void set(const bool verbose);
};

View File

@ -72,6 +72,7 @@ primitiveLists = primitives/Lists
$(primitiveLists)/boolList.C
$(primitiveLists)/labelIOList.C
$(primitiveLists)/scalarList.C
$(primitiveLists)/scalarIOList.C
$(primitiveLists)/vectorList.C
$(primitiveLists)/sphericalTensorList.C
$(primitiveLists)/symmTensorList.C

View File

@ -63,6 +63,21 @@ Foam::IOPtrList<T>::IOPtrList(const IOobject& io)
}
template<class T>
Foam::IOPtrList<T>::IOPtrList(const IOobject& io, const label s)
:
regIOobject(io),
PtrList<T>(s)
{
if (io.readOpt() != IOobject::NO_READ)
{
FatalErrorIn("IOPtrList<T>::IOPtrList(const IOobject&, const label)")
<< "NO_READ must be set if specifying size" << nl
<< exit(FatalError);
}
}
template<class T>
Foam::IOPtrList<T>::IOPtrList(const IOobject& io, const PtrList<T>& list)
:

View File

@ -70,6 +70,9 @@ public:
//- Construct from IOobject
IOPtrList(const IOobject&);
//- Construct from IOobject with given size
IOPtrList(const IOobject&, const label);
//- Construct from IOobject and a PtrList
IOPtrList(const IOobject&, const PtrList<T>&);

View File

@ -140,7 +140,7 @@ bool Foam::regIOobject::checkIn()
{
WarningIn("regIOobject::checkIn()")
<< "failed to register object " << objectPath()
<< " the name already exists in the objectRegistry"
<< " the name already exists in the objectRegistry"
<< endl;
}
}

View File

@ -0,0 +1,112 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "DynamicField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * Static Members * * * * * * * * * * * * * * //
template<class Type>
const char* const DynamicField<Type>::typeName("DynamicField");
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
DynamicField<Type>::DynamicField(Istream& is)
:
Field<Type>(is),
capacity_(Field<Type>::size())
{}
template<class Type>
tmp<DynamicField<Type> > DynamicField<Type>::clone() const
{
return tmp<DynamicField<Type> >(new DynamicField<Type>(*this));
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void DynamicField<Type>::setSize(const label nElem)
{
// allocate more capacity?
if (nElem > capacity_)
{
capacity_ = max(nElem, label(1 + capacity_*2));
Field<Type>::setSize(capacity_);
}
// adjust addressed size
Field<Type>::size(nElem);
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * IOstream Operator * * * * * * * * * * * * * //
template<class Type>
Ostream& operator<<(Ostream& os, const DynamicField<Type>& f)
{
os << static_cast<const Field<Type>&>(f);
return os;
}
template<class Type>
Ostream& operator<<(Ostream& os, const tmp<DynamicField<Type> >& tf)
{
os << tf();
tf.clear();
return os;
}
template<class Type>
Istream& operator>>(Istream& is, DynamicField<Type>& lst)
{
is >> static_cast<Field<Type>&>(lst);
lst.capacity_ = lst.Field<Type>::size();
return is;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,227 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::DynamicField
Description
Dynamically sized Field. WIP.
SourceFiles
DynamicField.C
\*---------------------------------------------------------------------------*/
#ifndef DynamicField_H
#define DynamicField_H
#include "Field.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of friend functions and operators
template<class Type>
class DynamicField;
template<class Type>
Ostream& operator<<(Ostream&, const DynamicField<Type>&);
template<class Type>
Ostream& operator<<(Ostream&, const tmp<DynamicField<Type> >&);
template<class Type>
Istream& operator>>(Istream&, DynamicField<Type>&);
/*---------------------------------------------------------------------------*\
Class DynamicField Declaration
\*---------------------------------------------------------------------------*/
#include "CintDefs.H"
template<class Type>
class DynamicField
:
public Field<Type> //private Field<Type>
{
// Private data
//- The capacity (allocated size) of the underlying field.
label capacity_;
//- Construct given size and initial value
DynamicField(const label, const Type&);
//- Construct as copy of tmp<DynamicField>
# ifdef ConstructFromTmp
DynamicField(const tmp<DynamicField<Type> >&);
# endif
//- Construct from a dictionary entry
DynamicField(const word&, const dictionary&, const label);
public:
// Static data members
static const char* const typeName;
// Static Member Functions
//- Return a null field
inline static const DynamicField<Type>& null()
{
return *reinterpret_cast< DynamicField<Type>* >(0);
}
// Constructors
//- Construct null
// Used for temporary fields which are initialised after construction
DynamicField();
//- Construct given size
// Used for temporary fields which are initialised after construction
explicit inline DynamicField(const label);
//- Construct as copy of a UList\<Type\>
explicit inline DynamicField(const UList<Type>&);
//- Construct by transferring the List contents
explicit inline DynamicField(const Xfer<List<Type> >&);
//- Construct by 1 to 1 mapping from the given field
inline DynamicField
(
const UList<Type>& mapF,
const labelList& mapAddressing
);
//- Construct by interpolative mapping from the given field
inline DynamicField
(
const UList<Type>& mapF,
const labelListList& mapAddressing,
const scalarListList& weights
);
//- Construct by mapping from the given field
inline DynamicField
(
const UList<Type>& mapF,
const FieldMapper& map
);
//- Construct as copy
inline DynamicField(const DynamicField<Type>&);
//- Construct as copy or re-use as specified.
inline DynamicField(DynamicField<Type>&, bool reUse);
//- Construct by transferring the Field contents
inline DynamicField(const Xfer<DynamicField<Type> >&);
//- Construct from Istream
inline DynamicField(Istream&);
//- Clone
tmp<DynamicField<Type> > clone() const;
// Member Functions
//- Size of the underlying storage.
inline label capacity() const;
//- Append an element at the end of the list
inline void append(const Type&);
//- Alter the addressed list size.
// New space will be allocated if required.
// Use this to resize the list prior to using the operator[] for
// setting values (as per List usage).
void setSize(const label nElem);
// Member operators
inline void operator=(const DynamicField<Type>&);
inline void operator=(const UList<Type>&);
inline void operator=(const tmp<DynamicField<Type> >&);
//- Return element of Field.
inline Type& operator[](const label i);
//- Return element of constant Field.
inline const Type& operator[](const label) const;
// IOstream operators
friend Ostream& operator<<
#ifndef __CINT__
<Type>
#endif
(Ostream&, const DynamicField<Type>&);
friend Ostream& operator<<
#ifndef __CINT__
<Type>
#endif
(Ostream&, const tmp<DynamicField<Type> >&);
friend Istream& operator>>
#ifndef __CINT__
<Type>
#endif
(Istream&, DynamicField<Type>&);
};
#include "CintUndefs.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "DynamicFieldI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "DynamicField.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,221 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "DynamicField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
DynamicField<Type>::DynamicField()
:
Field<Type>(),
capacity_(0)
{}
template<class Type>
DynamicField<Type>::DynamicField(const label size)
:
Field<Type>(size),
capacity_(Field<Type>::size())
{
Field<Type>::size(0);
}
template<class Type>
inline Foam::DynamicField<Type>::DynamicField
(
const UList<Type>& lst
)
:
Field<Type>(lst),
capacity_(Field<Type>::size())
{}
template<class Type>
inline Foam::DynamicField<Type>::DynamicField
(
const Xfer<List<Type> >& lst
)
:
Field<Type>(lst),
capacity_(Field<Type>::size())
{}
template<class Type>
DynamicField<Type>::DynamicField
(
const UList<Type>& mapF,
const labelList& mapAddressing
)
:
Field<Type>(mapF, mapAddressing),
capacity_(Field<Type>::size())
{}
template<class Type>
DynamicField<Type>::DynamicField
(
const UList<Type>& mapF,
const labelListList& mapAddressing,
const scalarListList& weights
)
:
Field<Type>(mapF, mapAddressing, weights),
capacity_(Field<Type>::size())
{}
//- Construct by mapping from the given field
template<class Type>
DynamicField<Type>::DynamicField
(
const UList<Type>& mapF,
const FieldMapper& map
)
:
DynamicField<Type>(mapF, map),
capacity_(Field<Type>::size())
{}
template<class Type>
DynamicField<Type>::DynamicField(const DynamicField<Type>& f)
:
Field<Type>(f),
capacity_(Field<Type>::size())
{}
template<class Type>
DynamicField<Type>::DynamicField(DynamicField<Type>& f, bool reUse)
:
Field<Type>(f, reUse),
capacity_(Field<Type>::size())
{}
template<class Type>
DynamicField<Type>::DynamicField(const Xfer<DynamicField<Type> >& f)
:
Field<Type>(f),
capacity_(Field<Type>::size())
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
Foam::label DynamicField<Type>::capacity() const
{
return capacity_;
}
template<class Type>
void DynamicField<Type>::append(const Type& t)
{
label elemI = Field<Type>::size();
setSize(elemI + 1);
this->operator[](elemI) = t;
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<class Type>
void DynamicField<Type>::operator=(const DynamicField<Type>& rhs)
{
if (this == &rhs)
{
FatalErrorIn("DynamicField<Type>::operator=(const DynamicField<Type>&)")
<< "attempted assignment to self"
<< abort(FatalError);
}
Field<Type>::operator=(rhs);
capacity_ = Field<Type>::size();
}
template<class Type>
void DynamicField<Type>::operator=(const UList<Type>& rhs)
{
Field<Type>::operator=(rhs);
capacity_ = Field<Type>::size();
}
template<class Type>
void DynamicField<Type>::operator=(const tmp<DynamicField>& rhs)
{
if (this == &(rhs()))
{
FatalErrorIn("DynamicField<Type>::operator=(const tmp<DynamicField>&)")
<< "attempted assignment to self"
<< abort(FatalError);
}
// This is dodgy stuff, don't try it at home.
DynamicField* fieldPtr = rhs.ptr();
List<Type>::transfer(*fieldPtr);
delete fieldPtr;
capacity_ = Field<Type>::size();
}
template<class Type>
Type& DynamicField<Type>::operator[](const label i)
{
return Field<Type>::operator[](i);
}
template<class Type>
const Type& DynamicField<Type>::operator[](const label i) const
{
return Field<Type>::operator[](i);
}
// * * * * * * * * * * * * * * * IOstream Operator * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -526,10 +526,10 @@ Foam::argList::argList
// Switch on signal trapping. We have to wait until after Pstream::init
// since this sets up its own ones.
sigFpe_.set();
sigInt_.set();
sigQuit_.set();
sigSegv_.set();
sigFpe_.set(bannerEnabled);
sigInt_.set(bannerEnabled);
sigQuit_.set(bannerEnabled);
sigSegv_.set(bannerEnabled);
if (Pstream::master() && bannerEnabled)
{

View File

@ -137,7 +137,7 @@ const Type& Foam::MeshObject<Mesh, Type>::New
{
if (!mesh.thisDb().objectRegistry::foundObject<Type>(Type::typeName))
{
return store(new Type(mesh, d3, d4));
return store(new Type(mesh, d1, d2, d3, d4));
}
else
{

View File

@ -84,6 +84,9 @@ public:
//- Start of procI+1 data
inline const labelList& offsets() const;
//- my local size
inline label localSize() const;
//- Global sum of localSizes
inline label size() const;

View File

@ -34,6 +34,17 @@ inline const Foam::labelList& Foam::globalIndex::offsets() const
}
inline Foam::label Foam::globalIndex::localSize() const
{
return
(
Pstream::myProcNo() == 0
? offsets_[Pstream::myProcNo()]
: offsets_[Pstream::myProcNo()] - offsets_[Pstream::myProcNo()-1]
);
}
inline Foam::label Foam::globalIndex::size() const
{
return offsets_[Pstream::nProcs()-1];

View File

@ -273,6 +273,15 @@ Foam::mapDistribute::mapDistribute
}
Foam::mapDistribute::mapDistribute(const mapDistribute& map)
:
constructSize_(map.constructSize_),
subMap_(map.subMap_),
constructMap_(map.constructMap_),
schedulePtr_()
{}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::mapDistribute::compact(const boolList& elemIsUsed)
@ -413,4 +422,24 @@ void Foam::mapDistribute::compact(const boolList& elemIsUsed)
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
void Foam::mapDistribute::operator=(const mapDistribute& rhs)
{
// Check for assignment to self
if (this == &rhs)
{
FatalErrorIn
(
"Foam::mapDistribute::operator=(const Foam::mapDistribute&)"
) << "Attempted assignment to self"
<< abort(FatalError);
}
constructSize_ = rhs.constructSize_;
subMap_ = rhs.subMap_;
constructMap_ = rhs.constructMap_;
schedulePtr_.clear();
}
// ************************************************************************* //

View File

@ -81,16 +81,6 @@ class mapDistribute
mutable autoPtr<List<labelPair> > schedulePtr_;
// Private Member Functions
//- Disallow default bitwise copy construct
mapDistribute(const mapDistribute&);
//- Disallow default bitwise assignment
void operator=(const mapDistribute&);
public:
// Constructors
@ -120,6 +110,9 @@ public:
const labelList& recvProcs
);
//- Construct copy
mapDistribute(const mapDistribute&);
// Member Functions
@ -262,6 +255,11 @@ public:
"mapDistribute::updateMesh(const mapPolyMesh&)"
);
}
// Member Operators
void operator=(const mapDistribute&);
};

View File

@ -22,27 +22,25 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
Declaration of scalar IOList containers
\*---------------------------------------------------------------------------*/
#include "basicReactingParcel.H"
#include "ReactingCloud.H"
#include "SinglePhaseMixture.H"
#include "scalarIOList.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
makeCompositionModel(ReactingCloud<basicReactingParcel>);
// Add instances of composition model to the table
makeCompositionModelType
defineTemplateTypeNameAndDebugWithName(scalarIOList, "scalarList", 0);
defineTemplateTypeNameAndDebugWithName
(
SinglePhaseMixture,
ReactingCloud,
basicReactingParcel
scalarListIOList,
"scalarListList",
0
);
};
}
// ************************************************************************* //

View File

@ -22,23 +22,30 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Typedef
Foam::scalarIOList
Description
Scalar container classes
\*---------------------------------------------------------------------------*/
#include "basicThermoParcel.H"
#include "KinematicCloud.H"
#include "NoDrag.H"
#include "SphereDrag.H"
#ifndef scalarIOList_H
#define scalarIOList_H
#include "scalarList.H"
#include "IOList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
makeDragModel(KinematicCloud<basicThermoParcel>);
typedef IOList<scalar> scalarIOList;
typedef IOList<scalarList> scalarListIOList;
}
// Add instances of drag model to the table
makeDragModelType(NoDrag, KinematicCloud, basicThermoParcel);
makeDragModelType(SphereDrag, KinematicCloud, basicThermoParcel);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -148,6 +148,7 @@ Foam::scalar Foam::autoHexMeshDriver::getMergeDistance(const scalar mergeTol)
Foam::autoHexMeshDriver::autoHexMeshDriver
(
fvMesh& mesh,
const bool overwrite,
const dictionary& dict,
const dictionary& decomposeDict
)
@ -292,6 +293,41 @@ Foam::autoHexMeshDriver::autoHexMeshDriver
meshRefinement::checkCoupledFaceZones(mesh_);
// Refinement engine
// ~~~~~~~~~~~~~~~~~
{
Info<< nl
<< "Determining initial surface intersections" << nl
<< "-----------------------------------------" << nl
<< endl;
// Main refinement engine
meshRefinerPtr_.reset
(
new meshRefinement
(
mesh,
mergeDist_, // tolerance used in sorting coordinates
overwrite,
surfaces(),
shells()
)
);
Info<< "Calculated surface intersections in = "
<< mesh_.time().cpuTimeIncrement() << " s" << endl;
// Some stats
meshRefinerPtr_().printMeshInfo(debug_, "Initial mesh");
meshRefinerPtr_().write
(
debug_&meshRefinement::OBJINTERSECTIONS,
mesh_.time().path()/meshRefinerPtr_().timeName()
);
}
// Add all the surface regions as patches
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -319,9 +355,8 @@ Foam::autoHexMeshDriver::autoHexMeshDriver
forAll(regNames, i)
{
label patchI = meshRefinement::addPatch
label patchI = meshRefinerPtr_().addMeshedPatch
(
mesh,
regNames[i],
wallPolyPatch::typeName
);
@ -404,40 +439,6 @@ Foam::autoHexMeshDriver::autoHexMeshDriver
// Mesh distribution engine (uses tolerance to reconstruct meshes)
distributorPtr_.reset(new fvMeshDistribute(mesh_, mergeDist_));
}
// Refinement engine
// ~~~~~~~~~~~~~~~~~
{
Info<< nl
<< "Determining initial surface intersections" << nl
<< "-----------------------------------------" << nl
<< endl;
// Main refinement engine
meshRefinerPtr_.reset
(
new meshRefinement
(
mesh,
mergeDist_, // tolerance used in sorting coordinates
surfaces(),
shells()
)
);
Info<< "Calculated surface intersections in = "
<< mesh_.time().cpuTimeIncrement() << " s" << endl;
// Some stats
meshRefinerPtr_().printMeshInfo(debug_, "Initial mesh");
meshRefinerPtr_().write
(
debug_&meshRefinement::OBJINTERSECTIONS,
mesh_.time().path()/mesh_.time().timeName()
);
}
}
@ -448,7 +449,7 @@ void Foam::autoHexMeshDriver::writeMesh(const string& msg) const
const meshRefinement& meshRefiner = meshRefinerPtr_();
meshRefiner.printMeshInfo(debug_, msg);
Info<< "Writing mesh to time " << mesh_.time().timeName() << endl;
Info<< "Writing mesh to time " << meshRefiner.timeName() << endl;
meshRefiner.write(meshRefinement::MESH|meshRefinement::SCALARLEVELS, "");
if (debug_ & meshRefinement::OBJINTERSECTIONS)
@ -456,7 +457,7 @@ void Foam::autoHexMeshDriver::writeMesh(const string& msg) const
meshRefiner.write
(
meshRefinement::OBJINTERSECTIONS,
mesh_.time().path()/mesh_.time().timeName()
mesh_.time().path()/meshRefiner.timeName()
);
}
Info<< "Written mesh in = "
@ -522,11 +523,7 @@ void Foam::autoHexMeshDriver::doMesh()
const dictionary& shrinkDict = dict_.subDict("shrinkDict");
PtrList<dictionary> surfaceDicts(dict_.lookup("surfaces"));
autoLayerDriver layerDriver
(
meshRefinerPtr_(),
globalToPatch_
);
autoLayerDriver layerDriver(meshRefinerPtr_());
// Get all the layer specific params
layerParameters layerParams

View File

@ -174,6 +174,7 @@ public:
autoHexMeshDriver
(
fvMesh& mesh,
const bool overwrite,
const dictionary& meshDict,
const dictionary& decomposeDict
);

View File

@ -75,7 +75,7 @@ Foam::label Foam::autoLayerDriver::mergePatchFacesUndo
labelHashSet boundaryCells(mesh.nFaces()-mesh.nInternalFaces());
{
labelList patchIDs(meshRefinement::addedPatches(globalToPatch_));
labelList patchIDs(meshRefiner_.meshedPatches());
const polyBoundaryMesh& patches = mesh.boundaryMesh();
@ -159,12 +159,16 @@ Foam::label Foam::autoLayerDriver::mergePatchFacesUndo
mesh.clearOut();
}
if (meshRefiner_.overwrite())
{
mesh.setInstance(meshRefiner_.oldInstance());
}
faceCombiner.updateMesh(map);
meshRefiner_.updateMesh(map, labelList(0));
for (label iteration = 0; iteration < 100; iteration++)
{
Info<< nl
@ -313,6 +317,11 @@ Foam::label Foam::autoLayerDriver::mergePatchFacesUndo
mesh.clearOut();
}
if (meshRefiner_.overwrite())
{
mesh.setInstance(meshRefiner_.oldInstance());
}
faceCombiner.updateMesh(map);
// Renumber restore maps
@ -336,7 +345,7 @@ Foam::label Foam::autoLayerDriver::mergePatchFacesUndo
if (debug)
{
Pout<< "Writing merged-faces mesh to time "
<< mesh.time().timeName() << nl << endl;
<< meshRefiner_.timeName() << nl << endl;
mesh.write();
}
}
@ -380,6 +389,11 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::autoLayerDriver::doRemovePoints
mesh.clearOut();
}
if (meshRefiner_.overwrite())
{
mesh.setInstance(meshRefiner_.oldInstance());
}
pointRemover.updateMesh(map);
meshRefiner_.updateMesh(map, labelList(0));
@ -433,6 +447,11 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::autoLayerDriver::doRestorePoints
mesh.clearOut();
}
if (meshRefiner_.overwrite())
{
mesh.setInstance(meshRefiner_.oldInstance());
}
pointRemover.updateMesh(map);
meshRefiner_.updateMesh(map, labelList(0));
@ -656,7 +675,7 @@ Foam::label Foam::autoLayerDriver::mergeEdgesUndo
if (debug)
{
Pout<< "Writing merged-edges mesh to time "
<< mesh.time().timeName() << nl << endl;
<< meshRefiner_.timeName() << nl << endl;
mesh.write();
}
}
@ -2446,14 +2465,9 @@ void Foam::autoLayerDriver::getLayerCellsFaces
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::autoLayerDriver::autoLayerDriver
(
meshRefinement& meshRefiner,
const labelList& globalToPatch
)
Foam::autoLayerDriver::autoLayerDriver(meshRefinement& meshRefiner)
:
meshRefiner_(meshRefiner),
globalToPatch_(globalToPatch)
meshRefiner_(meshRefiner)
{}
@ -2729,7 +2743,7 @@ void Foam::autoLayerDriver::addLayers
IOobject
(
"pointMedialDist",
mesh.time().timeName(),
meshRefiner_.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
@ -2744,7 +2758,7 @@ void Foam::autoLayerDriver::addLayers
IOobject
(
"dispVec",
mesh.time().timeName(),
meshRefiner_.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
@ -2759,7 +2773,7 @@ void Foam::autoLayerDriver::addLayers
IOobject
(
"medialRatio",
mesh.time().timeName(),
meshRefiner_.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
@ -2911,7 +2925,7 @@ void Foam::autoLayerDriver::addLayers
);
const_cast<Time&>(mesh.time())++;
Info<< "Writing shrunk mesh to " << mesh.time().timeName() << endl;
Info<< "Writing shrunk mesh to " << meshRefiner_.timeName() << endl;
// See comment in autoSnapDriver why we should not remove meshPhi
// using mesh.clearPout().
@ -3012,6 +3026,11 @@ void Foam::autoLayerDriver::addLayers
//?neccesary? Update fields
newMesh.updateMesh(map);
if (meshRefiner_.overwrite())
{
newMesh.setInstance(meshRefiner_.oldInstance());
}
// Update numbering on addLayer:
// - cell/point labels to be newMesh.
// - patchFaces to remain in oldMesh order.
@ -3034,7 +3053,7 @@ void Foam::autoLayerDriver::addLayers
if (debug)
{
Info<< "Writing layer mesh to " << mesh.time().timeName() << endl;
Info<< "Writing layer mesh to " << meshRefiner_.timeName() << endl;
newMesh.write();
cellSet addedCellSet
(
@ -3113,6 +3132,11 @@ void Foam::autoLayerDriver::addLayers
mesh.clearOut();
}
if (meshRefiner_.overwrite())
{
mesh.setInstance(meshRefiner_.oldInstance());
}
meshRefiner_.updateMesh(map, labelList(0));
@ -3181,8 +3205,6 @@ void Foam::autoLayerDriver::doLayers
<< "----------------------------------" << nl
<< endl;
const_cast<Time&>(mesh.time())++;
Info<< "Using mesh parameters " << motionDict << nl << endl;
// Merge coplanar boundary faces

View File

@ -101,9 +101,6 @@ class autoLayerDriver
//- Mesh+surface
meshRefinement& meshRefiner_;
//- From surface region to patch
const labelList globalToPatch_;
// Private Member Functions
@ -509,11 +506,7 @@ public:
// Constructors
//- Construct from components
autoLayerDriver
(
meshRefinement& meshRefiner,
const labelList& globalToPatch
);
autoLayerDriver(meshRefinement& meshRefiner);
// Member Functions

View File

@ -344,8 +344,8 @@ void Foam::autoRefineDriver::removeInsideCells
if (debug)
{
Pout<< "Writing subsetted mesh to time "
<< mesh.time().timeName() << '.' << endl;
meshRefiner_.write(debug, mesh.time().path()/mesh.time().timeName());
<< meshRefiner_.timeName() << '.' << endl;
meshRefiner_.write(debug, mesh.time().path()/meshRefiner_.timeName());
Pout<< "Dumped mesh in = "
<< mesh.time().cpuTimeIncrement() << " s\n" << nl << endl;
}
@ -561,11 +561,11 @@ void Foam::autoRefineDriver::zonify
if (debug)
{
Pout<< "Writing zoned mesh to time "
<< mesh.time().timeName() << '.' << endl;
<< meshRefiner_.timeName() << '.' << endl;
meshRefiner_.write
(
debug,
mesh.time().path()/mesh.time().timeName()
mesh.time().path()/meshRefiner_.timeName()
);
}
@ -653,8 +653,8 @@ void Foam::autoRefineDriver::splitAndMergeBaffles
if (debug)
{
Pout<< "Writing handleProblemCells mesh to time "
<< mesh.time().timeName() << '.' << endl;
meshRefiner_.write(debug, mesh.time().path()/mesh.time().timeName());
<< meshRefiner_.timeName() << '.' << endl;
meshRefiner_.write(debug, mesh.time().path()/meshRefiner_.timeName());
}
}
@ -680,7 +680,7 @@ void Foam::autoRefineDriver::mergePatchFaces
(
Foam::cos(45*mathematicalConstant::pi/180.0),
Foam::cos(45*mathematicalConstant::pi/180.0),
meshRefinement::addedPatches(globalToPatch_)
meshRefiner_.meshedPatches()
);
if (debug)
@ -712,9 +712,6 @@ void Foam::autoRefineDriver::doRefine
const fvMesh& mesh = meshRefiner_.mesh();
const_cast<Time&>(mesh.time())++;
// Check that all the keep points are inside the mesh.
refineParams.findCells(mesh);

View File

@ -557,7 +557,7 @@ Foam::tmp<Foam::scalarField> Foam::autoSnapDriver::edgePatchDist
// IOobject
// (
// "pointDist",
// mesh.DB().timeName(),
// meshRefiner_.timeName(),
// mesh.DB(),
// IOobject::NO_READ,
// IOobject::AUTO_WRITE
@ -580,7 +580,7 @@ Foam::tmp<Foam::scalarField> Foam::autoSnapDriver::edgePatchDist
// pointDist[pointI] /= mesh.pointEdges()[pointI].size();
// }
// Info<< "Writing patch distance to " << pointDist.name()
// << " at time " << mesh.DB().timeName() << endl;
// << " at time " << meshRefiner_.timeName() << endl;
//
// pointDist.write();
//}
@ -750,7 +750,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::autoSnapDriver::createZoneBaffles
{
const_cast<Time&>(mesh.time())++;
Pout<< "Writing baffled mesh to time "
<< mesh.time().timeName() << endl;
<< meshRefiner_.timeName() << endl;
mesh.write();
}
}
@ -830,35 +830,6 @@ Foam::scalarField Foam::autoSnapDriver::calcSnapDistance
}
//// Invert globalToPatch_ to get the patches related to surfaces.
//Foam::labelList Foam::autoSnapDriver::getSurfacePatches() const
//{
// // Set of patches originating from surface
// labelHashSet surfacePatchSet(globalToPatch_.size());
//
// forAll(globalToPatch_, i)
// {
// if (globalToPatch_[i] != -1)
// {
// surfacePatchSet.insert(globalToPatch_[i]);
// }
// }
//
// const fvMesh& mesh = meshRefiner_.mesh();
//
// DynamicList<label> surfacePatches(surfacePatchSet.size());
//
// for (label patchI = 0; patchI < mesh.boundaryMesh().size(); patchI++)
// {
// if (surfacePatchSet.found(patchI))
// {
// surfacePatches.append(patchI);
// }
// }
// return surfacePatches.shrink();
//}
void Foam::autoSnapDriver::preSmoothPatch
(
const snapParameters& snapParams,
@ -928,7 +899,7 @@ void Foam::autoSnapDriver::preSmoothPatch
if (debug)
{
const_cast<Time&>(mesh.time())++;
Pout<< "Writing patch smoothed mesh to time " << mesh.time().timeName()
Pout<< "Writing patch smoothed mesh to time " << meshRefiner_.timeName()
<< endl;
mesh.write();
@ -1222,7 +1193,7 @@ void Foam::autoSnapDriver::smoothDisplacement
if (debug)
{
const_cast<Time&>(mesh.time())++;
Pout<< "Writing smoothed mesh to time " << mesh.time().timeName()
Pout<< "Writing smoothed mesh to time " << meshRefiner_.timeName()
<< endl;
// Moving mesh creates meshPhi. Can be cleared out by a mesh.clearOut
@ -1284,7 +1255,7 @@ void Foam::autoSnapDriver::scaleMesh
if (debug)
{
const_cast<Time&>(mesh.time())++;
Pout<< "Writing scaled mesh to time " << mesh.time().timeName()
Pout<< "Writing scaled mesh to time " << meshRefiner_.timeName()
<< endl;
mesh.write();
@ -1476,10 +1447,8 @@ void Foam::autoSnapDriver::doSnap
<< "--------------" << nl
<< endl;
const_cast<Time&>(mesh.time())++;
// Get the labels of added patches.
labelList adaptPatchIDs(meshRefinement::addedPatches(globalToPatch_));
labelList adaptPatchIDs(meshRefiner_.meshedPatches());
// Create baffles (pairs of faces that share the same points)
// Baffles stored as owner and neighbour face that have been created.

View File

@ -170,9 +170,6 @@ public:
const indirectPrimitivePatch&
) const;
////- Get patches generated for surfaces.
//labelList getSurfacePatches() const;
//- Smooth the mesh (patch and internal) to increase visibility
// of surface points (on castellated mesh) w.r.t. surface.
void preSmoothPatch

View File

@ -84,12 +84,15 @@ void Foam::meshRefinement::calcNeighbourData
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
labelHashSet addedPatchIDSet(meshedPatches());
forAll(patches, patchI)
{
const polyPatch& pp = patches[patchI];
const unallocLabelList& faceCells = pp.faceCells();
const vectorField::subField faceCentres = pp.faceCentres();
const vectorField::subField faceAreas = pp.faceAreas();
label bFaceI = pp.start()-mesh_.nInternalFaces();
@ -102,6 +105,36 @@ void Foam::meshRefinement::calcNeighbourData
bFaceI++;
}
}
else if (addedPatchIDSet.found(patchI))
{
// Face was introduced from cell-cell intersection. Try to
// reconstruct other side cell(centre). Three possibilities:
// - cells same size.
// - preserved cell smaller. Not handled.
// - preserved cell larger.
forAll(faceCells, i)
{
// Extrapolate the face centre.
vector fn = faceAreas[i];
fn /= mag(fn)+VSMALL;
label own = faceCells[i];
label ownLevel = cellLevel[own];
label faceLevel = meshCutter_.getAnchorLevel(pp.start()+i);
// Normal distance from face centre to cell centre
scalar d = ((faceCentres[i] - cellCentres[own]) & fn);
if (faceLevel > ownLevel)
{
// Other cell more refined. Adjust normal distance
d *= 0.5;
}
neiLevel[bFaceI] = cellLevel[ownLevel];
// Calculate other cell centre by extrapolation
neiCc[bFaceI] = faceCentres[i] + d*fn;
bFaceI++;
}
}
else
{
forAll(faceCells, i)
@ -432,6 +465,11 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::doRemoveCells
mesh_.clearOut();
}
if (overwrite_)
{
mesh_.setInstance(oldInstance_);
}
// Update local mesh data
cellRemover.updateMesh(map);
@ -784,12 +822,15 @@ Foam::meshRefinement::meshRefinement
(
fvMesh& mesh,
const scalar mergeDistance,
const bool overwrite,
const refinementSurfaces& surfaces,
const shellSurfaces& shells
)
:
mesh_(mesh),
mergeDistance_(mergeDistance),
overwrite_(overwrite),
oldInstance_(mesh.pointsInstance()),
surfaces_(surfaces),
shells_(shells),
meshCutter_
@ -1166,8 +1207,6 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::meshRefinement::balance
// Helper function to get intersected faces
Foam::labelList Foam::meshRefinement::intersectedFaces() const
{
// Mark all faces that will become baffles
label nBoundaryFaces = 0;
forAll(surfaceIndex_, faceI)
@ -1193,10 +1232,7 @@ Foam::labelList Foam::meshRefinement::intersectedFaces() const
// Helper function to get points used by faces
Foam::labelList Foam::meshRefinement::intersectedPoints
(
// const labelList& globalToPatch
) const
Foam::labelList Foam::meshRefinement::intersectedPoints() const
{
const faceList& faces = mesh_.faces();
@ -1221,9 +1257,10 @@ Foam::labelList Foam::meshRefinement::intersectedPoints
}
//// Insert all meshed patches.
//forAll(globalToPatch, i)
//labelList adaptPatchIDs(meshedPatches());
//forAll(adaptPatchIDs, i)
//{
// label patchI = globalToPatch[i];
// label patchI = adaptPatchIDs[i];
//
// if (patchI != -1)
// {
@ -1262,27 +1299,6 @@ Foam::labelList Foam::meshRefinement::intersectedPoints
}
Foam::labelList Foam::meshRefinement::addedPatches
(
const labelList& globalToPatch
)
{
labelList patchIDs(globalToPatch.size());
label addedI = 0;
forAll(globalToPatch, i)
{
if (globalToPatch[i] != -1)
{
patchIDs[addedI++] = globalToPatch[i];
}
}
patchIDs.setSize(addedI);
return patchIDs;
}
//- Create patch from set of patches
Foam::autoPtr<Foam::indirectPrimitivePatch> Foam::meshRefinement::makePatch
(
@ -1372,7 +1388,7 @@ Foam::tmp<Foam::pointVectorField> Foam::meshRefinement::makeDisplacementField
IOobject
(
"pointDisplacement",
mesh.time().timeName(),
mesh.time().timeName(), //timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
@ -1653,6 +1669,53 @@ Foam::label Foam::meshRefinement::addPatch
}
Foam::label Foam::meshRefinement::addMeshedPatch
(
const word& name,
const word& type
)
{
label meshedI = findIndex(meshedPatches_, name);
if (meshedI != -1)
{
// Already there. Get corresponding polypatch
return mesh_.boundaryMesh().findPatchID(name);
}
else
{
// Add patch
label patchI = addPatch(mesh_, name, type);
// Store
label sz = meshedPatches_.size();
meshedPatches_.setSize(sz+1);
meshedPatches_[sz] = name;
return patchI;
}
}
Foam::labelList Foam::meshRefinement::meshedPatches() const
{
labelList patchIDs(meshedPatches_.size());
forAll(meshedPatches_, i)
{
patchIDs[i] = mesh_.boundaryMesh().findPatchID(meshedPatches_[i]);
if (patchIDs[i] == -1)
{
FatalErrorIn("meshRefinement::meshedPatches() const")
<< "Problem : did not find patch " << meshedPatches_[i]
<< abort(FatalError);
}
}
return patchIDs;
}
Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::splitMeshRegions
(
const point& keepPoint
@ -2000,6 +2063,20 @@ void Foam::meshRefinement::printMeshInfo(const bool debug, const string& msg)
}
//- Return either time().constant() or oldInstance
Foam::word Foam::meshRefinement::timeName() const
{
if (overwrite_ && mesh_.time().timeIndex() == 0)
{
return oldInstance_;
}
else
{
return mesh_.time().timeName();
}
}
void Foam::meshRefinement::dumpRefinementLevel() const
{
volScalarField volRefLevel
@ -2007,7 +2084,7 @@ void Foam::meshRefinement::dumpRefinementLevel() const
IOobject
(
"cellLevel",
mesh_.time().timeName(),
timeName(),
mesh_,
IOobject::NO_READ,
IOobject::AUTO_WRITE,
@ -2034,7 +2111,7 @@ void Foam::meshRefinement::dumpRefinementLevel() const
IOobject
(
"pointLevel",
mesh_.time().timeName(),
timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE,

View File

@ -110,6 +110,12 @@ private:
//- tolerance used for sorting coordinates (used in 'less' routine)
const scalar mergeDistance_;
//- overwrite the mesh?
const bool overwrite_;
//- Instance of mesh upon construction. Used when in overwrite_ mode.
const word oldInstance_;
//- All surface-intersection interaction
const refinementSurfaces& surfaces_;
@ -125,6 +131,10 @@ private:
//- user supplied face based data.
List<Tuple2<mapType, labelList> > userFaceData_;
//- Meshed patches - are treated differently. Stored as wordList since
// order changes.
wordList meshedPatches_;
// Private Member Functions
@ -163,9 +173,6 @@ private:
//- Find any intersection of surface. Store in surfaceIndex_.
void updateIntersections(const labelList& changedFaces);
//- Set instance of all local IOobjects
void setInstance(const fileName&);
//- Remove cells. Put exposedFaces into exposedPatchIDs.
autoPtr<mapPolyMesh> doRemoveCells
(
@ -400,12 +407,11 @@ private:
const labelList& globalToPatch
) const;
//- Initial test of marking faces using geometric information.
labelList markFacesOnProblemCellsGeometric
(
const dictionary& motionDict,
const labelList& globalToPatch
) const;
////- Initial test of marking faces using geometric information.
//labelList markFacesOnProblemCellsGeometric
//(
// const dictionary& motionDict
//) const;
// Baffle merging
@ -475,6 +481,7 @@ public:
(
fvMesh& mesh,
const scalar mergeDistance,
const bool overwrite,
const refinementSurfaces&,
const shellSurfaces&
);
@ -499,6 +506,18 @@ public:
return mergeDistance_;
}
//- Overwrite the mesh?
bool overwrite() const
{
return overwrite_;
}
//- (points)instance of mesh upon construction
const word& oldInstance() const
{
return oldInstance_;
}
//- reference to surface search engines
const refinementSurfaces& surfaces() const
{
@ -578,9 +597,6 @@ public:
//- Get points on surfaces with intersection and boundary faces.
labelList intersectedPoints() const;
//- Get added patches (inverse of globalToPatch)
static labelList addedPatches(const labelList& globalToPatch);
//- Create patch from set of patches
static autoPtr<indirectPrimitivePatch> makePatch
(
@ -688,9 +704,16 @@ public:
// Other topo changes
//- Helper function to add patch to mesh
//- Helper:add patch to mesh. Update all registered fields.
// Use addMeshedPatch to add patches originating from surfaces.
static label addPatch(fvMesh&, const word& name, const word& type);
//- Add patch originating from meshing. Update meshedPatches_.
label addMeshedPatch(const word& name, const word& type);
//- Get patchIDs for patches added in addMeshedPatch.
labelList meshedPatches() const;
//- Split mesh. Keep part containing point.
autoPtr<mapPolyMesh> splitMeshRegions(const point& keepPoint);
@ -699,7 +722,11 @@ public:
//- Update for external change to mesh. changedFaces are in new mesh
// face labels.
void updateMesh(const mapPolyMesh&, const labelList& changedFaces);
void updateMesh
(
const mapPolyMesh&,
const labelList& changedFaces
);
// Restoring : is where other processes delete and reinsert data.
@ -757,6 +784,13 @@ public:
//- Print some mesh stats.
void printMeshInfo(const bool, const string&) const;
//- Replacement for Time::timeName() : return oldInstance (if
// overwrite_)
word timeName() const;
//- Set instance of all local IOobjects
void setInstance(const fileName&);
//- Write mesh and all data
bool write() const;

View File

@ -226,7 +226,13 @@ void Foam::meshRefinement::getBafflePatches
label vertI = 0;
if (debug&OBJINTERSECTIONS)
{
str.reset(new OFstream(mesh_.time().timePath()/"intersections.obj"));
str.reset
(
new OFstream
(
mesh_.time().path()/timeName()/"intersections.obj"
)
);
Pout<< "getBafflePatches : Writing surface intersections to file "
<< str().name() << nl << endl;
@ -461,6 +467,11 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::createBaffles
mesh_.clearOut();
}
if (overwrite())
{
mesh_.setInstance(oldInstance());
}
//- Redo the intersections on the newly create baffle faces. Note that
// this changes also the cell centre positions.
faceSet baffledFacesSet(mesh_, "baffledFacesSet", 2*nBaffles);
@ -820,6 +831,11 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::mergeBaffles
mesh_.clearOut();
}
if (overwrite())
{
mesh_.setInstance(oldInstance());
}
// Update intersections. Recalculate intersections on merged faces since
// this seems to give problems? Note: should not be nessecary since
// baffles preserve intersections from when they were created.
@ -1482,7 +1498,7 @@ void Foam::meshRefinement::baffleAndSplitMesh
if (debug)
{
Pout<< "Writing baffled mesh to time " << mesh_.time().timeName()
Pout<< "Writing baffled mesh to time " << timeName()
<< endl;
write(debug, runTime.path()/"baffles");
Pout<< "Dumped debug data in = "
@ -1511,11 +1527,7 @@ void Foam::meshRefinement::baffleAndSplitMesh
perpendicularAngle,
globalToPatch
)
//markFacesOnProblemCellsGeometric
//(
// motionDict,
// globalToPatch
//)
//markFacesOnProblemCellsGeometric(motionDict)
);
Info<< "Analyzed problem cells in = "
<< runTime.cpuTimeIncrement() << " s\n" << nl << endl;
@ -1569,7 +1581,7 @@ void Foam::meshRefinement::baffleAndSplitMesh
if (debug)
{
Pout<< "Writing extra baffled mesh to time "
<< mesh_.time().timeName() << endl;
<< timeName() << endl;
write(debug, runTime.path()/"extraBaffles");
Pout<< "Dumped debug data in = "
<< runTime.cpuTimeIncrement() << " s\n" << nl << endl;
@ -1604,9 +1616,9 @@ void Foam::meshRefinement::baffleAndSplitMesh
if (debug)
{
Pout<< "Writing subsetted mesh to time " << mesh_.time().timeName()
Pout<< "Writing subsetted mesh to time " << timeName()
<< endl;
write(debug, runTime.timePath());
write(debug, runTime.path()/timeName());
Pout<< "Dumped debug data in = "
<< runTime.cpuTimeIncrement() << " s\n" << nl << endl;
}
@ -1665,7 +1677,7 @@ void Foam::meshRefinement::baffleAndSplitMesh
// Split off (with optional buffer layers) unreachable areas of mesh.
Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::splitMesh
Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::splitMesh
(
const label nBufferLayers,
const labelList& globalToPatch,
@ -1998,6 +2010,11 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::dupNonManifoldPoints()
mesh_.clearOut();
}
if (overwrite())
{
mesh_.setInstance(oldInstance());
}
// Update intersections. Is mapping only (no faces created, positions stay
// same) so no need to recalculate intersections.
updateMesh(map, labelList(0));
@ -2429,6 +2446,11 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::zonify
mesh_.clearOut();
}
if (overwrite())
{
mesh_.setInstance(oldInstance());
}
// None of the faces has changed, only the zones. Still...
updateMesh(map, labelList());

View File

@ -29,10 +29,6 @@ License
#include "polyTopoChange.H"
#include "removePoints.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
// Merge faces that are in-line.
@ -108,6 +104,11 @@ Foam::label Foam::meshRefinement::mergePatchFaces
mesh_.clearOut();
}
if (overwrite())
{
mesh_.setInstance(oldInstance());
}
faceCombiner.updateMesh(map);
// Get the kept faces that need to be recalculated.
@ -203,6 +204,11 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::mergeEdges
mesh_.clearOut();
}
if (overwrite())
{
mesh_.setInstance(oldInstance());
}
pointRemover.updateMesh(map);
// Get the kept faces that need to be recalculated.

View File

@ -136,15 +136,13 @@ Foam::Map<Foam::label> Foam::meshRefinement::findEdgeConnectedProblemCells
const labelList& globalToPatch
) const
{
labelList adaptPatchIDs(meshRefinement::addedPatches(globalToPatch));
// Construct addressing engine.
// Construct addressing engine from all patches added for meshing.
autoPtr<indirectPrimitivePatch> ppPtr
(
meshRefinement::makePatch
(
mesh_,
adaptPatchIDs
meshedPatches()
)
);
const indirectPrimitivePatch& pp = ppPtr();
@ -386,11 +384,6 @@ Foam::labelList Foam::meshRefinement::markFacesOnProblemCells
const labelList& pointLevel = meshCutter_.pointLevel();
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
// Swap neighbouring cell centres and cell level
labelList neiLevel(mesh_.nFaces()-mesh_.nInternalFaces());
pointField neiCc(mesh_.nFaces()-mesh_.nInternalFaces());
calcNeighbourData(neiLevel, neiCc);
// Per internal face (boundary faces not used) the patch that the
// baffle should get (or -1)
labelList facePatch(mesh_.nFaces(), -1);
@ -403,7 +396,7 @@ Foam::labelList Foam::meshRefinement::markFacesOnProblemCells
// Fill boundary data. All elements on meshed patches get marked.
// Get the labels of added patches.
labelList adaptPatchIDs(meshRefinement::addedPatches(globalToPatch));
labelList adaptPatchIDs(meshedPatches());
forAll(adaptPatchIDs, i)
{
@ -427,6 +420,12 @@ Foam::labelList Foam::meshRefinement::markFacesOnProblemCells
}
}
// Swap neighbouring cell centres and cell level
labelList neiLevel(mesh_.nFaces()-mesh_.nInternalFaces());
pointField neiCc(mesh_.nFaces()-mesh_.nInternalFaces());
calcNeighbourData(neiLevel, neiCc);
// Count of faces marked for baffling
label nBaffleFaces = 0;
@ -961,20 +960,16 @@ Foam::labelList Foam::meshRefinement::markFacesOnProblemCells
//// test to find nearest surface and checks which faces would get squashed.
//Foam::labelList Foam::meshRefinement::markFacesOnProblemCellsGeometric
//(
// const dictionary& motionDict,
// const labelList& globalToPatch
// const dictionary& motionDict
//) const
//{
// // Get the labels of added patches.
// labelList adaptPatchIDs(meshRefinement::addedPatches(globalToPatch));
//
// // Construct addressing engine.
// autoPtr<indirectPrimitivePatch> ppPtr
// (
// meshRefinement::makePatch
// (
// mesh_,
// adaptPatchIDs
// meshedPatches()
// )
// );
// const indirectPrimitivePatch& pp = ppPtr();

View File

@ -1232,6 +1232,11 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::refine
mesh_.clearOut();
}
if (overwrite())
{
mesh_.setInstance(oldInstance());
}
// Update intersection info
updateMesh(map, getChangedFaces(map, cellsToRefine));
@ -1256,12 +1261,12 @@ Foam::meshRefinement::refineAndBalance
if (debug)
{
Pout<< "Writing refined but unbalanced " << msg
<< " mesh to time " << mesh_.time().timeName() << endl;
<< " mesh to time " << timeName() << endl;
write
(
debug,
mesh_.time().path()
/mesh_.time().timeName()
/timeName()
);
Pout<< "Dumped debug data in = "
<< mesh_.time().cpuTimeIncrement() << " s" << endl;
@ -1299,12 +1304,11 @@ Foam::meshRefinement::refineAndBalance
if (debug)
{
Pout<< "Writing balanced " << msg
<< " mesh to time " << mesh_.time().timeName() << endl;
<< " mesh to time " << timeName() << endl;
write
(
debug,
mesh_.time().path()
/mesh_.time().timeName()
mesh_.time().path()/timeName()
);
Pout<< "Dumped debug data in = "
<< mesh_.time().cpuTimeIncrement() << " s" << endl;

View File

@ -115,6 +115,28 @@ bool Foam::trackedParticle::move(trackedParticle::trackData& td)
}
bool Foam::trackedParticle::hitPatch
(
const polyPatch&,
trackedParticle::trackData& td,
const label patchI
)
{
return false;
}
bool Foam::trackedParticle::hitPatch
(
const polyPatch&,
int&,
const label
)
{
return false;
}
void Foam::trackedParticle::hitWedgePatch
(
const wedgePolyPatch&,

View File

@ -169,6 +169,21 @@ public:
bool move(trackData&);
//- Overridable function to handle the particle hitting a patch
// Executed before other patch-hitting functions
bool hitPatch
(
const polyPatch&,
trackedParticle::trackData& td,
const label patchI
);
bool hitPatch
(
const polyPatch&,
int&,
const label patchI
);
//- Overridable function to handle the particle hitting a wedge
void hitWedgePatch
(

View File

@ -75,6 +75,24 @@ extern "C"
}
// Hack: scotch generates floating point errors so need to switch of error
// trapping!
#if defined(linux) || defined(linuxAMD64) || defined(linuxIA64)
# define LINUX
#endif
#if defined(LINUX) && defined(__GNUC__)
# define LINUX_GNUC
#endif
#ifdef LINUX_GNUC
# ifndef __USE_GNU
# define __USE_GNU
# endif
# include <fenv.h>
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
@ -113,13 +131,30 @@ Foam::label Foam::scotchDecomp::decompose
{
// Strategy
// ~~~~~~~~
// Default.
SCOTCH_Strat stradat;
check(SCOTCH_stratInit(&stradat), "SCOTCH_stratInit");
//SCOTCH_stratGraphMap(&stradat, &argv[i][2]);
//fprintf(stdout, "S\tStrat=");
//SCOTCH_stratSave(&stradat, stdout);
//fprintf(stdout, "\n");
if (decompositionDict_.found("scotchCoeffs"))
{
const dictionary& scotchCoeffs =
decompositionDict_.subDict("scotchCoeffs");
string strategy;
if (scotchCoeffs.readIfPresent("strategy", strategy))
{
if (debug)
{
Info<< "scotchDecomp : Using strategy " << strategy << endl;
}
SCOTCH_stratGraphMap(&stradat, strategy.c_str());
//fprintf(stdout, "S\tStrat=");
//SCOTCH_stratSave(&stradat, stdout);
//fprintf(stdout, "\n");
}
}
// Graph
@ -153,37 +188,40 @@ Foam::label Foam::scotchDecomp::decompose
const dictionary& scotchCoeffs =
decompositionDict_.subDict("scotchCoeffs");
Switch writeGraph(scotchCoeffs.lookup("writeGraph"));
if (writeGraph)
if (scotchCoeffs.found("writeGraph"))
{
OFstream str(mesh_.time().path() / mesh_.name() + ".grf");
Switch writeGraph(scotchCoeffs.lookup("writeGraph"));
Info<< "Dumping Scotch graph file to " << str.name() << endl
<< "Use this in combination with gpart." << endl;
label version = 0;
str << version << nl;
// Numer of vertices
str << xadj.size()-1 << ' ' << adjncy.size() << nl;
// Numbering starts from 0
label baseval = 0;
// Has weights?
label hasEdgeWeights = 0;
label hasVertexWeights = 0;
label numericflag = 10*hasEdgeWeights+hasVertexWeights;
str << baseval << ' ' << numericflag << nl;
for (label cellI = 0; cellI < xadj.size()-1; cellI++)
if (writeGraph)
{
label start = xadj[cellI];
label end = xadj[cellI+1];
str << end-start;
OFstream str(mesh_.time().path() / mesh_.name() + ".grf");
for (label i = start; i < end; i++)
Info<< "Dumping Scotch graph file to " << str.name() << endl
<< "Use this in combination with gpart." << endl;
label version = 0;
str << version << nl;
// Numer of vertices
str << xadj.size()-1 << ' ' << adjncy.size() << nl;
// Numbering starts from 0
label baseval = 0;
// Has weights?
label hasEdgeWeights = 0;
label hasVertexWeights = 0;
label numericflag = 10*hasEdgeWeights+hasVertexWeights;
str << baseval << ' ' << numericflag << nl;
for (label cellI = 0; cellI < xadj.size()-1; cellI++)
{
str << ' ' << adjncy[i];
label start = xadj[cellI];
label end = xadj[cellI+1];
str << end-start;
for (label i = start; i < end; i++)
{
str << ' ' << adjncy[i];
}
str << nl;
}
str << nl;
}
}
}
@ -195,12 +233,36 @@ Foam::label Foam::scotchDecomp::decompose
SCOTCH_Arch archdat;
check(SCOTCH_archInit(&archdat), "SCOTCH_archInit");
check
(
// SCOTCH_archCmpltw for weighted.
SCOTCH_archCmplt(&archdat, nProcessors_),
"SCOTCH_archCmplt"
);
List<label> processorWeights;
if (decompositionDict_.found("scotchCoeffs"))
{
const dictionary& scotchCoeffs =
decompositionDict_.subDict("scotchCoeffs");
scotchCoeffs.readIfPresent("processorWeights", processorWeights);
}
if (processorWeights.size())
{
if (debug)
{
Info<< "scotchDecomp : Using procesor weights " << processorWeights
<< endl;
}
check
(
SCOTCH_archCmpltw(&archdat, nProcessors_, processorWeights.begin()),
"SCOTCH_archCmpltw"
);
}
else
{
check
(
SCOTCH_archCmplt(&archdat, nProcessors_),
"SCOTCH_archCmplt"
);
}
//SCOTCH_Mapping mapdat;
@ -209,6 +271,16 @@ Foam::label Foam::scotchDecomp::decompose
//SCOTCH_graphMapExit(&grafdat, &mapdat);
// Hack:switch off fpu error trapping
# ifdef LINUX_GNUC
int oldExcepts = fedisableexcept
(
FE_DIVBYZERO
| FE_INVALID
| FE_OVERFLOW
);
# endif
finalDecomp.setSize(xadj.size()-1);
finalDecomp = 0;
check
@ -223,6 +295,11 @@ Foam::label Foam::scotchDecomp::decompose
"SCOTCH_graphMap"
);
# ifdef LINUX_GNUC
feenableexcept(oldExcepts);
# endif
//finalDecomp.setSize(xadj.size()-1);
//check

View File

@ -185,8 +185,6 @@ class hexRef8
const bool searchForward,
const label wantedLevel
) const;
//- Gets level such that the face has four points <= level.
label getAnchorLevel(const label faceI) const;
////- Print levels of list of points.
//void printLevels(Ostream&, const labelList&) const;
@ -370,6 +368,9 @@ public:
// Refinement
//- Gets level such that the face has four points <= level.
label getAnchorLevel(const label faceI) const;
//- Given valid mesh and current cell level and proposed
// cells to refine calculate any clashes (due to 2:1) and return
// ok list of cells to refine.

View File

@ -383,6 +383,35 @@ void Foam::polyTopoChange::checkFace
<< " own:" << own << " nei:" << nei
<< " patchI:" << patchI << abort(FatalError);
}
if (faceI >= 0 && faceI < faces_.size() && faceRemoved(faceI))
{
FatalErrorIn
(
"polyTopoChange::checkFace(const face&, const label"
", const label, const label, const label)"
) << "Face already marked for removal"
<< nl
<< "f:" << f
<< " faceI(-1 if added face):" << faceI
<< " own:" << own << " nei:" << nei
<< " patchI:" << patchI << abort(FatalError);
}
forAll(f, fp)
{
if (f[fp] < points_.size() && pointRemoved(f[fp]))
{
FatalErrorIn
(
"polyTopoChange::checkFace(const face&, const label"
", const label, const label, const label)"
) << "Face uses removed vertices"
<< nl
<< "f:" << f
<< " faceI(-1 if added face):" << faceI
<< " own:" << own << " nei:" << nei
<< " patchI:" << patchI << abort(FatalError);
}
}
}

View File

@ -39,26 +39,41 @@ fvMeshMapper = fvMesh/fvMeshMapper
$(fvMeshMapper)/fvPatchMapper.C
$(fvMeshMapper)/fvSurfaceMapper.C
extendedStencil = fvMesh/extendedStencil
$(extendedStencil)/extendedStencil.C
$(extendedStencil)/extendedUpwindStencil.C
$(extendedStencil)/extendedCentredStencil.C
$(extendedStencil)/faceStencil/faceStencil.C
$(extendedStencil)/faceStencil/faceEdgeCellStencil.C
$(extendedStencil)/faceStencil/cellFaceCellStencil.C
$(extendedStencil)/faceStencil/cellPointCellStencil.C
$(extendedStencil)/faceStencil/cellEdgeCellStencil.C
cellToCell = $(extendedStencil)/cellToCell
$(cellToCell)/fullStencils/cellToCellStencil.C
$(cellToCell)/fullStencils/CFCCellToCellStencil.C
$(cellToCell)/fullStencils/CPCCellToCellStencil.C
$(cellToCell)/fullStencils/CECCellToCellStencil.C
$(extendedStencil)/extendedStencilMeshObjects/centredCECStencilObject.C
$(extendedStencil)/extendedStencilMeshObjects/centredCFCStencilObject.C
$(extendedStencil)/extendedStencilMeshObjects/centredCPCStencilObject.C
$(extendedStencil)/extendedStencilMeshObjects/centredFECStencilObject.C
cellToFace = $(extendedStencil)/cellToFace
$(cellToFace)/fullStencils/cellToFaceStencil.C
$(cellToFace)/fullStencils/CFCCellToFaceStencil.C
$(cellToFace)/fullStencils/CECCellToFaceStencil.C
$(cellToFace)/fullStencils/CPCCellToFaceStencil.C
$(cellToFace)/fullStencils/FECCellToFaceStencil.C
$(cellToFace)/extendedCellToFaceStencil.C
$(cellToFace)/extendedCentredCellToFaceStencil.C
$(cellToFace)/extendedUpwindCellToFaceStencil.C
$(cellToFace)/MeshObjects/centredCECCellToFaceStencilObject.C
$(cellToFace)/MeshObjects/centredCFCCellToFaceStencilObject.C
$(cellToFace)/MeshObjects/centredCPCCellToFaceStencilObject.C
$(cellToFace)/MeshObjects/centredFECCellToFaceStencilObject.C
$(cellToFace)/MeshObjects/upwindCECCellToFaceStencilObject.C
$(cellToFace)/MeshObjects/upwindCFCCellToFaceStencilObject.C
$(cellToFace)/MeshObjects/upwindCPCCellToFaceStencilObject.C
$(cellToFace)/MeshObjects/upwindFECCellToFaceStencilObject.C
$(cellToFace)/MeshObjects/pureUpwindCFCCellToFaceStencilObject.C
faceToCell = $(extendedStencil)/faceToCell
$(faceToCell)/fullStencils/faceToCellStencil.C
$(faceToCell)/fullStencils/CFCFaceToCellStencil.C
$(faceToCell)/extendedFaceToCellStencil.C
$(faceToCell)/extendedCentredFaceToCellStencil.C
$(faceToCell)/MeshObjects/centredCFCFaceToCellStencilObject.C
$(extendedStencil)/extendedStencilMeshObjects/upwindCECStencilObject.C
$(extendedStencil)/extendedStencilMeshObjects/upwindCFCStencilObject.C
$(extendedStencil)/extendedStencilMeshObjects/upwindCPCStencilObject.C
$(extendedStencil)/extendedStencilMeshObjects/upwindFECStencilObject.C
fvPatchFields = fields/fvPatchFields
$(fvPatchFields)/fvPatchField/fvPatchFields.C
@ -202,6 +217,10 @@ $(schemes)/quadraticFit/quadraticFit.C
$(schemes)/quadraticLinearUpwindFit/quadraticLinearUpwindFit.C
$(schemes)/quadraticUpwindFit/quadraticUpwindFit.C
$(schemes)/cubicUpwindFit/cubicUpwindFit.C
/*
$(schemes)/quadraticLinearPureUpwindFit/quadraticLinearPureUpwindFit.C
*/
$(schemes)/linearPureUpwindFit/linearPureUpwindFit.C
limitedSchemes = $(surfaceInterpolation)/limitedSchemes
$(limitedSchemes)/limitedSurfaceInterpolationScheme/limitedSurfaceInterpolationSchemes.C
@ -297,18 +316,32 @@ $(laplacianSchemes)/gaussLaplacianScheme/gaussLaplacianSchemes.C
finiteVolume/fvc/fvcMeshPhi.C
cfdTools/general/findRefCell/findRefCell.C
cfdTools/general/adjustPhi/adjustPhi.C
cfdTools/general/bound/bound.C
cfdTools/general/porousMedia/porousZone.C
cfdTools/general/porousMedia/porousZones.C
cfdTools/general/MRF/MRFZone.C
cfdTools/general/MRF/MRFZones.C
cfdTools/general/fieldSources/pressureGradientExplicitSource/pressureGradientExplicitSource.C
cfdTools/general/fieldSources/timeActivatedExplicitSource/timeActivatedExplicitSource.C
cfdTools/general/SRF/SRFModel/SRFModel/SRFModel.C
cfdTools/general/SRF/SRFModel/SRFModel/newSRFModel.C
cfdTools/general/SRF/SRFModel/rpm/rpm.C
cfdTools/general/SRF/derivedFvPatchFields/SRFVelocityFvPatchVectorField/SRFVelocityFvPatchVectorField.C
general = cfdTools/general
$(general)/findRefCell/findRefCell.C
$(general)/adjustPhi/adjustPhi.C
$(general)/bound/bound.C
porousMedia = $(general)/porousMedia
$(porousMedia)/porousZone.C
$(porousMedia)/porousZones.C
MRF = $(general)/MRF
$(MRF)/MRFZone.C
$(MRF)/MRFZones.C
SRF = $(general)/SRF
$(SRF)/SRFModel/SRFModel/SRFModel.C
$(SRF)/SRFModel/SRFModel/newSRFModel.C
$(SRF)/SRFModel/rpm/rpm.C
$(SRF)/derivedFvPatchFields/SRFVelocityFvPatchVectorField/SRFVelocityFvPatchVectorField.C
fieldSources = $(general)/fieldSources
$(fieldSources)/pressureGradientExplicitSource/pressureGradientExplicitSource.C
$(fieldSources)/timeActivatedExplicitSource/timeActivatedExplicitSource.C
$(fieldSources)/timeActivatedExplicitCellSource/timeActivatedExplicitCellSource.C
$(fieldSources)/timeActivatedExplicitMulticomponentPointSource/timeActivatedExplicitMulticomponentPointSource.C
$(fieldSources)/timeActivatedExplicitMulticomponentPointSource/pointSourceProperties/pointSourceProperties.C
$(fieldSources)/timeActivatedExplicitMulticomponentPointSource/pointSourceProperties/pointSourcePropertiesIO.C
LIB = $(FOAM_LIBBIN)/libfiniteVolume

View File

@ -312,6 +312,31 @@ void Foam::MRFZone::addCoriolis(fvVectorMatrix& UEqn) const
}
void Foam::MRFZone::addCoriolis
(
const volScalarField& rho,
fvVectorMatrix& UEqn
) const
{
if (cellZoneID_ == -1)
{
return;
}
const labelList& cells = mesh_.cellZones()[cellZoneID_];
const scalarField& V = mesh_.V();
vectorField& Usource = UEqn.source();
const vectorField& U = UEqn.psi();
const vector& Omega = Omega_.value();
forAll(cells, i)
{
label celli = cells[i];
Usource[celli] -= V[celli]*rho[celli]*(Omega ^ U[celli]);
}
}
void Foam::MRFZone::relativeVelocity(volVectorField& U) const
{
const volVectorField& C = mesh_.C();

View File

@ -154,6 +154,9 @@ public:
//- Add the Coriolis force contribution to the momentum equation
void addCoriolis(fvVectorMatrix& UEqn) const;
//- Add the Coriolis force contribution to the momentum equation
void addCoriolis(const volScalarField& rho, fvVectorMatrix& UEqn) const;
//- Make the given absolute velocity relative within the MRF region
void relativeVelocity(volVectorField& U) const;

View File

@ -65,6 +65,19 @@ void Foam::MRFZones::addCoriolis(fvVectorMatrix& UEqn) const
}
void Foam::MRFZones::addCoriolis
(
const volScalarField& rho,
fvVectorMatrix& UEqn
) const
{
forAll(*this, i)
{
operator[](i).addCoriolis(rho, UEqn);
}
}
void Foam::MRFZones::relativeVelocity(volVectorField& U) const
{
forAll(*this, i)

View File

@ -76,6 +76,9 @@ public:
//- Add the Coriolis force contribution to the momentum equation
void addCoriolis(fvVectorMatrix& UEqn) const;
//- Add the Coriolis force contribution to the momentum equation
void addCoriolis(const volScalarField& rho, fvVectorMatrix& UEqn) const;
//- Make the given absolute velocity relative within the MRF region
void relativeVelocity(volVectorField& U) const;

View File

@ -0,0 +1,175 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "timeActivatedExplicitCellSource.H"
#include "volFields.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::timeActivatedExplicitCellSource::updateCellSet()
{
cellSelector_->applyToSet(topoSetSource::NEW, selectedCellSet_);
Info<< " " << name_ << ": selected "
<< returnReduce(selectedCellSet_.size(), sumOp<label>())
<< " cells" << nl << endl;
V_ = scalarField(selectedCellSet_.size(), 1.0);
if (volumeType_ == vtAbsolute)
{
label i = 0;
forAllConstIter(cellSet, selectedCellSet_, iter)
{
V_[i++] = mesh_.V()[iter.key()];
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::timeActivatedExplicitCellSource::timeActivatedExplicitCellSource
(
const word& name,
const fvMesh& mesh,
const dimensionSet& dims
)
:
timeActivatedExplicitSource(name, mesh, dims),
onValue_(readScalar(lookup("onValue"))),
offValue_(readScalar(lookup("offValue"))),
V_(0),
cellSource_(lookup("cellSource")),
cellSelector_
(
topoSetSource::New
(
cellSource_,
mesh,
subDict(cellSource_ + "Coeffs")
)
),
selectedCellSet_
(
mesh,
name + "SourceCellSet",
mesh.nCells()/10 + 1 // Reasonable size estimate.
)
{
// Create the cell set
updateCellSet();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::scalar Foam::timeActivatedExplicitCellSource::onValue() const
{
return onValue_;
}
Foam::scalar Foam::timeActivatedExplicitCellSource::offValue() const
{
return offValue_;
}
Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >
Foam::timeActivatedExplicitCellSource::Su()
{
tmp<DimensionedField<scalar, volMesh> > tSource
(
new DimensionedField<scalar, volMesh>
(
IOobject
(
name_ + "Su",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimensionedScalar("zero", dimensions_, 0.0)
)
);
scalar value = offValue_;
if
(
active_
&& (runTime_.time().value() >= timeStart_)
&& (runTime_.time().value() <= timeStart_ + duration_)
)
{
// Update the cell set if the mesh is changing
if (mesh_.changing())
{
updateCellSet();
}
value = onValue_;
}
DimensionedField<scalar, volMesh>& sourceField = tSource();
label i = 0;
forAllConstIter(cellSet, selectedCellSet_, iter)
{
sourceField[iter.key()] = value/V_[i++];
}
return tSource;
}
bool Foam::timeActivatedExplicitCellSource::read()
{
if (timeActivatedExplicitSource::read())
{
lookup("onValue") >> onValue_;
lookup("offValue") >> offValue_;
lookup("cellSource") >> cellSource_;
cellSelector_ =
topoSetSource::New
(
cellSource_,
mesh_,
subDict(cellSource_ + "Coeffs")
);
updateCellSet();
return true;
}
else
{
return false;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,143 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::timeActivatedExplicitSourceNew
Description
Creates a cell set source that is activated at a given time, and remains
active for a specified duration. The source value is either in specific
(XX/m3) or absolute (XX) units.
SourceFiles
timeActivatedExplicitCellSource.C
\*---------------------------------------------------------------------------*/
#ifndef timeActivatedExplicitCellSource_H
#define timeActivatedExplicitCellSource_H
#include "timeActivatedExplicitSource.H"
#include "topoSetSource.H"
#include "cellSet.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class timeActivatedExplicitCellSource Declaration
\*---------------------------------------------------------------------------*/
class timeActivatedExplicitCellSource
:
public timeActivatedExplicitSource
{
private:
// Private member functions
//- Update the cell set that the source is acting on
void updateCellSet();
// Private Member Functions
//- Disallow default bitwise copy construct
timeActivatedExplicitCellSource(const timeActivatedExplicitCellSource&);
//- Disallow default bitwise assignment
void operator=(const timeActivatedExplicitCellSource&);
protected:
// Protected data
// Source properties
//- Value when "on"
scalar onValue_;
//- Value when "off"
scalar offValue_;
// Cell set
//- Cell volumes
scalarList V_;
//- Name of cell source (XXXToCell)
word cellSource_;
//- Method by which the cells will be selected
autoPtr<topoSetSource> cellSelector_;
//- Set of selected cells
cellSet selectedCellSet_;
public:
// Constructors
//- Construct from explicit source name and mesh
timeActivatedExplicitCellSource
(
const word&,
const fvMesh&,
const dimensionSet&
);
// Member Functions
// Access
//- Return the "on" value
virtual scalar onValue() const;
//- Return the "off" value
virtual scalar offValue() const;
//- Return a tmp field of the source
virtual tmp<DimensionedField<scalar, volMesh> > Su();
//- Read properties dictionary
virtual bool read();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,87 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "pointSourceProperties.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::pointSourceProperties::pointSourceProperties()
:
name_("unknownPointSourceName"),
timeStart_(0.0),
duration_(0.0),
location_(point::zero),
fieldData_()
{}
Foam::pointSourceProperties::pointSourceProperties(const dictionary& dict)
:
name_(dict.name().name()),
timeStart_(readScalar(dict.lookup("timeStart"))),
duration_(readScalar(dict.lookup("duration"))),
location_(dict.lookup("location")),
fieldData_(dict.lookup("fieldData"))
{}
Foam::pointSourceProperties::pointSourceProperties
(
const pointSourceProperties& psp
)
:
name_(psp.name_),
timeStart_(psp.timeStart_),
duration_(psp.duration_),
location_(psp.location_),
fieldData_(psp.fieldData_)
{}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
void Foam::pointSourceProperties::operator=(const pointSourceProperties& rhs)
{
// Check for assignment to self
if (this == &rhs)
{
FatalErrorIn
(
"pointSourceProperties::operator=(const pointSourceProperties&)"
) << "Attempted assignment to self" << nl
<< abort(FatalError);
}
// Set updated values
name_ = rhs.name_;
timeStart_ = rhs.timeStart_;
duration_ = rhs.duration_;
location_ = rhs.location_;
fieldData_ = rhs.fieldData_;}
// ************************************************************************* //

View File

@ -0,0 +1,158 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::pointSourceProperties
Description
Helper class to describe point source properties
SourceFiles
pointSourceProperties.C
\*---------------------------------------------------------------------------*/
#ifndef pointSourceProperties_H
#define pointSourceProperties_H
#include "IOdictionary.H"
#include "fvMesh.H"
#include "Time.H"
#include "Tuple2.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class pointSourceProperties Declaration
\*---------------------------------------------------------------------------*/
class pointSourceProperties
{
protected:
// Protected data
typedef Tuple2<word, scalar> fieldNameValuePair;
//- Source name
word name_;
//- Time start
scalar timeStart_;
//- Duration
scalar duration_;
//- Point location
point location_;
//- List of source field name vs value pairs
List<fieldNameValuePair> fieldData_;
public:
// Constructors
//- Construct null
pointSourceProperties();
//- Construct from dictionary
pointSourceProperties(const dictionary& dict);
//- Construct from Istream
pointSourceProperties(Istream& is);
//- Copy constructor
pointSourceProperties(const pointSourceProperties&);
// Member Functions
// Access
//- Return const access to the source name
inline const word& name() const;
//- Return const access to the time start
inline scalar timeStart() const;
//- Return const access to the time end
inline scalar timeEnd() const;
//- Return const access to the duration
inline scalar duration() const;
//- Return const access to the point location
inline const point& location() const;
//- Return const access to the source field name vs value pairs
inline const List<fieldNameValuePair>& fieldData() const;
// Edit
//- Return access to the source name
inline word& name();
//- Return access to the time start
inline scalar& timeStart();
//- Return access to the duration
inline scalar& duration();
//- Return access to the point location
inline point& location();
//- Return access to the source field name vs value pairs
inline List<fieldNameValuePair>& fieldData();
// Member Operators
void operator=(const pointSourceProperties&);
// IOstream operators
friend Istream& operator>>(Istream&, pointSourceProperties&);
friend Ostream& operator<<(Ostream&, const pointSourceProperties&);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "pointSourcePropertiesI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,99 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "pointSourceProperties.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline const Foam::word& Foam::pointSourceProperties::name() const
{
return name_;
}
inline Foam::scalar Foam::pointSourceProperties::timeStart() const
{
return timeStart_;
}
inline Foam::scalar Foam::pointSourceProperties::timeEnd() const
{
return timeStart_ + duration_;
}
inline Foam::scalar Foam::pointSourceProperties::duration() const
{
return duration_;
}
inline const Foam::point& Foam::pointSourceProperties::location() const
{
return location_;
}
inline const Foam::List<Foam::pointSourceProperties::fieldNameValuePair>&
Foam::pointSourceProperties::fieldData() const
{
return fieldData_;
}
inline Foam::word& Foam::pointSourceProperties::name()
{
return name_;
}
inline Foam::scalar& Foam::pointSourceProperties::timeStart()
{
return timeStart_;
}
inline Foam::scalar& Foam::pointSourceProperties::duration()
{
return duration_;
}
inline Foam::point& Foam::pointSourceProperties::location()
{
return location_;
}
inline Foam::List<Foam::pointSourceProperties::fieldNameValuePair>&
Foam::pointSourceProperties::fieldData()
{
return fieldData_;
}
// ************************************************************************* //

View File

@ -0,0 +1,88 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "pointSourceProperties.H"
#include "dictionaryEntry.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::pointSourceProperties::pointSourceProperties(Istream& is)
:
name_("unknownPointSourceName"),
timeStart_(0.0),
duration_(0.0),
location_(point::zero),
fieldData_()
{
is.check("pointSourceProperties(Istream&)");
const dictionaryEntry entry(dictionary::null, is);
name_ = entry.keyword();
entry.lookup("timeStart") >> timeStart_;
entry.lookup("duration") >> duration_;
entry.lookup("location") >> location_;
entry.lookup("fieldData") >> fieldData_;
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::Istream& Foam::operator>>(Istream& is, pointSourceProperties& psp)
{
is.check("Istream& operator>>(Istream&, pointSourceProperties&)");
const dictionaryEntry entry(dictionary::null, is);
psp.name_ = entry.keyword();
entry.lookup("timeStart") >> psp.timeStart_;
entry.lookup("duration") >> psp.duration_;
entry.lookup("location") >> psp.location_;
entry.lookup("fieldData") >> psp.fieldData_;
return is;
}
Foam::Ostream& Foam::operator<<(Ostream& os, const pointSourceProperties& psp)
{
os.check("Ostream& operator<<(Ostream&, const pointSourceProperties&)");
os << psp.name_ << nl << token::BEGIN_BLOCK << nl;
os.writeKeyword("timeStart") << psp.timeStart_ << token::END_STATEMENT << nl;
os.writeKeyword("duration") << psp.duration_ << token::END_STATEMENT << nl;
os.writeKeyword("location") << psp.location_ << token::END_STATEMENT << nl;
os.writeKeyword("fieldData") << psp.fieldData_ << token::END_STATEMENT << nl;
os << token::END_BLOCK << nl;
os.check("Ostream& operator<<(Ostream&, const pointSourceProperties&)");
return os;
}
// ************************************************************************* //

View File

@ -0,0 +1,292 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "timeActivatedExplicitMulticomponentPointSource.H"
#include "volFields.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
Foam::label
Foam::timeActivatedExplicitMulticomponentPointSource::carrierFieldId
(
const word& fieldName
)
{
forAll(carrierFields_, fieldI)
{
if (carrierFields_[fieldI].name() == fieldName)
{
return fieldI;
}
}
return -1;
}
void Foam::timeActivatedExplicitMulticomponentPointSource::updateAddressing()
{
forAll(pointSources_, sourceI)
{
const pointSourceProperties& psp = pointSources_[sourceI];
bool foundCell = false;
label cid = mesh_.findCell(psp.location());
if (cid >= 0)
{
foundCell = mesh_.pointInCell(psp.location(), cid);
}
reduce(foundCell, orOp<bool>());
if (!foundCell)
{
label cid = mesh_.findNearestCell(psp.location());
if (cid >= 0)
{
foundCell = mesh_.pointInCell(psp.location(), cid);
}
}
reduce(foundCell, orOp<bool>());
if (!foundCell)
{
FatalErrorIn
(
"timeActivatedExplicitMulticomponentPointSource::"
"updateAddressing()"
) << "Unable to find location " << psp.location() << " in mesh "
<< "for source " << psp.name() << nl
<< exit(FatalError);
}
else
{
cellOwners_[sourceI] = cid;
}
fieldIds_[sourceI].setSize(psp.fieldData().size());
forAll(psp.fieldData(), fieldI)
{
const word& fieldName = psp.fieldData()[fieldI].first();
label cfid = carrierFieldId(fieldName);
if (cfid < 0)
{
FatalErrorIn
(
"timeActivatedExplicitMulticomponentPointSource::"
"updateAddressing()"
) << "Unable to find field " << fieldName << " in carrier "
<< "fields for source " << psp.name() << nl
<< exit(FatalError);
}
else
{
fieldIds_[sourceI][fieldI] = cfid;
}
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::timeActivatedExplicitMulticomponentPointSource::
timeActivatedExplicitMulticomponentPointSource
(
const word& name,
const fvMesh& mesh,
const PtrList<volScalarField>& carrierFields,
const dimensionSet& dims
)
:
IOdictionary
(
IOobject
(
name + "Properties",
mesh.time().constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
),
name_(name),
mesh_(mesh),
runTime_(mesh.time()),
dimensions_(dims),
carrierFields_(carrierFields),
active_(lookup("active")),
pointSources_(lookup("pointSources")),
cellOwners_(pointSources_.size()),
fieldIds_(pointSources_.size())
{
// Initialise the field addressing
updateAddressing();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >
Foam::timeActivatedExplicitMulticomponentPointSource::Su
(
const label fieldI
)
{
if (mesh_.changing())
{
updateAddressing();
}
tmp<DimensionedField<scalar, volMesh> > tSource
(
new DimensionedField<scalar, volMesh>
(
IOobject
(
name_ + carrierFields_[fieldI].name() + "Su",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimensionedScalar("zero", dimensions_, 0.0)
)
);
if (active_)
{
DimensionedField<scalar, volMesh>& sourceField = tSource();
const scalarField& V = mesh_.V();
const scalar dt = runTime_.deltaT().value();
forAll(pointSources_, sourceI)
{
const pointSourceProperties& psp = pointSources_[sourceI];
forAll(fieldIds_[sourceI], i)
{
if
(
fieldIds_[sourceI][i] == fieldI
&& (runTime_.time().value() >= psp.timeStart())
&& (runTime_.time().value() <= psp.timeEnd())
)
{
const label cid = cellOwners_[sourceI];
if (cid >= 0)
{
sourceField[cid] +=
dt*psp.fieldData()[i].second()/V[cid];
}
}
}
}
}
return tSource;
}
Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >
Foam::timeActivatedExplicitMulticomponentPointSource::Su()
{
if (mesh_.changing())
{
updateAddressing();
}
tmp<DimensionedField<scalar, volMesh> > tSource
(
new DimensionedField<scalar, volMesh>
(
IOobject
(
name_ + "TotalSu",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimensionedScalar("zero", dimensions_, 0.0)
)
);
if (active_)
{
DimensionedField<scalar, volMesh>& sourceField = tSource();
const scalarField& V = mesh_.V();
const scalar dt = runTime_.deltaT().value();
forAll(pointSources_, sourceI)
{
const pointSourceProperties& psp = pointSources_[sourceI];
forAll(fieldIds_[sourceI], i)
{
if
(
(runTime_.time().value() >= psp.timeStart())
&& (runTime_.time().value() <= psp.timeEnd())
)
{
const label cid = cellOwners_[sourceI];
if (cid >= 0)
{
sourceField[cid] +=
dt*psp.fieldData()[i].second()/V[cid];
}
}
}
}
}
return tSource;
}
bool Foam::timeActivatedExplicitMulticomponentPointSource::read()
{
if (regIOobject::read())
{
lookup("active") >> active_;
lookup("pointSources") >> pointSources_;
cellOwners_.setSize(pointSources_.size());
updateAddressing();
return true;
}
else
{
return false;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,185 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::timeActivatedExplicitMulticomponentPointSourceNew
Description
Provides a mechanism to introduce point sources to a set of carrier fields.
Carrier fields are supplied on consruction, and interrogated to provide the
field indices of the sources.
Source values are assumed to be in <quantity>/s, and divided through by the
cell volumes before being returned, e.g. for a kg/s source
Properties are described in a <name>Properties dictionary
active true; // are sources active (true/false)
pointSources
(
source1 // source name
{
timeStart 0.0;
duration 1.0;
location (0 0 0);
fieldData
(
(H2O 0.1) // kg/s
(O2 0.05) // kg/s
);
}
source2 // source name
{
timeStart 0.5;
duration 2.0;
location (1 1 1);
fieldData
(
(NO 0.1) // kg/s
(CO2 0.05) // kg/s
(H2 0.001) // kg/s
);
}
);
SourceFiles
timeActivatedExplicitMulticomponentPointSourceNew.C
\*---------------------------------------------------------------------------*/
#ifndef timeActivatedExplicitMulticomponentPointSource_H
#define timeActivatedExplicitMulticomponentPointSource_H
#include "IOdictionary.H"
#include "fvMesh.H"
#include "Time.H"
#include "pointSourceProperties.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class timeActivatedExplicitMulitcomponentPointSource Declaration
\*---------------------------------------------------------------------------*/
class timeActivatedExplicitMulticomponentPointSource
:
public IOdictionary
{
protected:
// Protected data
//- Name of the source
word name_;
//- Reference to the mesh
const fvMesh& mesh_;
//- Reference to time database
const Time& runTime_;
//- Source dimensions
const dimensionSet& dimensions_;
//- Reference to the multicomponent carrier fields
const PtrList<volScalarField>& carrierFields_;
//- Active flag
bool active_;
//- List of point source properties
List<pointSourceProperties> pointSources_;
//- List of cell owners for point source locations
List<label> cellOwners_;
//- List of field ids for each source
List<labelList> fieldIds_;
// Protected Member Functions
//- Return the id of field given its name
label carrierFieldId(const word& fieldName);
//- Update the addressing between source and carrier fields
void updateAddressing();
//- Disallow default bitwise copy construct
timeActivatedExplicitMulticomponentPointSource
(
const timeActivatedExplicitMulticomponentPointSource&
);
//- Disallow default bitwise assignment
void operator=(const timeActivatedExplicitMulticomponentPointSource&);
public:
// Constructors
//- Construct from components
timeActivatedExplicitMulticomponentPointSource
(
const word&,
const fvMesh&,
const PtrList<volScalarField>&,
const dimensionSet&
);
// Member Functions
// Access
//- Return a tmp field of the source for field fieldI
virtual tmp<DimensionedField<scalar, volMesh> > Su
(
const label fieldI
);
//- Return a tmp field of the total source
virtual tmp<DimensionedField<scalar, volMesh> > Su();
//- Read properties dictionary
virtual bool read();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -44,33 +44,11 @@ const Foam::NamedEnum<Foam::timeActivatedExplicitSource::volumeType, 2>
Foam::timeActivatedExplicitSource::volumeTypeNames_;
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::timeActivatedExplicitSource::updateCellSet()
{
cellSelector_->applyToSet(topoSetSource::NEW, selectedCellSet_);
Info<< " " << sourceName_ << ": selected "
<< returnReduce(selectedCellSet_.size(), sumOp<label>())
<< " cells" << nl << endl;
V_ = scalarField(selectedCellSet_.size(), 1.0);
if (volumeType_ == vtAbsolute)
{
label i = 0;
forAllConstIter(cellSet, selectedCellSet_, iter)
{
V_[i++] = mesh_.V()[iter.key()];
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::timeActivatedExplicitSource::timeActivatedExplicitSource
(
const word& sourceName,
const word& name,
const fvMesh& mesh,
const dimensionSet& dims
)
@ -79,51 +57,63 @@ Foam::timeActivatedExplicitSource::timeActivatedExplicitSource
(
IOobject
(
sourceName + "Properties",
name + "Properties",
mesh.time().constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
),
sourceName_(sourceName),
mesh_(mesh),
runTime_(mesh.time()),
name_(name),
active_(lookup("active")),
dimensions_(dims),
volumeType_(volumeTypeNames_.read(lookup("volumeType"))),
timeStart_(readScalar(lookup("timeStart"))),
duration_(readScalar(lookup("duration"))),
onValue_(readScalar(lookup("onValue"))),
offValue_(readScalar(lookup("offValue"))),
currentValue_(0.0),
V_(0),
cellSource_(lookup("cellSource")),
cellSelector_
(
topoSetSource::New
(
cellSource_,
mesh,
subDict(cellSource_ + "Coeffs")
)
),
selectedCellSet_
(
mesh,
sourceName + "SourceCellSet",
mesh.nCells()/10 + 1 // Reasonable size estimate.
)
{
// Create the cell set
updateCellSet();
// Initialise the value
update();
}
duration_(readScalar(lookup("duration")))
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const Foam::fvMesh& Foam::timeActivatedExplicitSource::mesh() const
{
return mesh_;
}
const Foam::Time& Foam::timeActivatedExplicitSource::runTime() const
{
return runTime_;
}
const Foam::word& Foam::timeActivatedExplicitSource::name() const
{
return name_;
}
const Foam::Switch& Foam::timeActivatedExplicitSource::active() const
{
return active_;
}
const Foam::dimensionSet& Foam::timeActivatedExplicitSource::dimensions() const
{
return dimensions_;
}
const Foam::timeActivatedExplicitSource::volumeType&
Foam::timeActivatedExplicitSource::volume() const
{
return volumeType_;
}
Foam::scalar Foam::timeActivatedExplicitSource::timeStart() const
{
return timeStart_;
@ -136,70 +126,22 @@ Foam::scalar Foam::timeActivatedExplicitSource::duration() const
}
const Foam::dimensionedScalar
Foam::timeActivatedExplicitSource::currentValue() const
{
return dimensionedScalar
(
sourceName_,
dimensions_,
currentValue_
);
}
Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >
Foam::timeActivatedExplicitSource::Su() const
{
tmp<DimensionedField<scalar, volMesh> > tSource
(
new DimensionedField<scalar, volMesh>
(
IOobject
(
sourceName_ + "Su",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimensionedScalar("zero", dimensions_, 0.0)
)
);
DimensionedField<scalar, volMesh>& sourceField = tSource();
label i = 0;
forAllConstIter(cellSet, selectedCellSet_, iter)
{
sourceField[iter.key()] = currentValue_/V_[i++];
}
return tSource;
}
bool Foam::timeActivatedExplicitSource::read()
{
if (regIOobject::read())
{
volumeType_ = volumeTypeNames_.read(lookup("volumeType"));
lookup("timeStart") >> duration_;
lookup("duration") >> duration_;
lookup("onValue") >> onValue_;
lookup("offValue") >> offValue_;
lookup("cellSource") >> cellSource_;
cellSelector_ =
topoSetSource::New
(
cellSource_,
mesh_,
subDict(cellSource_ + "Coeffs")
);
updateCellSet();
return true;
lookup("active") >> active_;
if (active_)
{
volumeType_ = volumeTypeNames_.read(lookup("volumeType"));
lookup("timeStart") >> duration_;
lookup("duration") >> duration_;
return true;
}
else
{
return false;
}
}
else
{
@ -208,28 +150,6 @@ bool Foam::timeActivatedExplicitSource::read()
}
void Foam::timeActivatedExplicitSource::update()
{
// Set the source value
if
(
(runTime_.time().value() >= timeStart_)
&& (runTime_.time().value() <= timeStart_ + duration_)
)
{
currentValue_ = onValue_;
}
else
{
currentValue_ = offValue_;
}
// Update the cell set if the mesh is changing
if (mesh_.changing())
{
updateCellSet();
}
}
// ************************************************************************* //

View File

@ -23,15 +23,20 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::timeActivatedExplicitSourceNew
Foam::timeActivatedExplicitSource
Description
Creates a cell set source that is activated at a given time, and remains
active for a specified duration. The source value is either in specific
(XX/m3) or absolute (XX) units.
Base class for field sources. Provides:
- name
- references to mesh and time
- dimensions
- volume type
- startTime
- duration
- read (from <sourceName>Properties dictionary)
SourceFiles
timeActivatedExplicitSourceNew.C
timeActivatedExplicitSource.C
\*---------------------------------------------------------------------------*/
@ -40,8 +45,6 @@ SourceFiles
#include "IOdictionary.H"
#include "autoPtr.H"
#include "topoSetSource.H"
#include "cellSet.H"
#include "fvMesh.H"
#include "Time.H"
#include "NamedEnum.H"
@ -72,19 +75,19 @@ public:
private:
// Private member functions
// Private Member Functions
//- Update the cell set that the source is acting on
void updateCellSet();
//- Disallow default bitwise copy construct
timeActivatedExplicitSource(const timeActivatedExplicitSource&);
//- Disallow default bitwise assignment
void operator=(const timeActivatedExplicitSource&);
protected:
// Protected data
//- Name of the source
word sourceName_;
//- Reference to the mesh
const fvMesh& mesh_;
@ -94,6 +97,12 @@ protected:
// Source properties
//- Name of the source
word name_;
//- Active flag
Switch active_;
//- Dimensions
const dimensionSet dimensions_;
@ -106,39 +115,6 @@ protected:
//- Duration [s]
scalar duration_;
//- Value when "on"
scalar onValue_;
//- Value when "off"
scalar offValue_;
//- Current source value
scalar currentValue_;
// Cell set
//- Cell volumes
scalarList V_;
//- Name of cell source (XXXToCell)
word cellSource_;
//- Method by which the cells will be selected
autoPtr<topoSetSource> cellSelector_;
//- Set of selected cells
cellSet selectedCellSet_;
// Protected Member Functions
//- Disallow default bitwise copy construct
timeActivatedExplicitSource(const timeActivatedExplicitSource&);
//- Disallow default bitwise assignment
void operator=(const timeActivatedExplicitSource&);
public:
@ -157,24 +133,33 @@ public:
// Access
//- Return the reference to the mesh
virtual const fvMesh& mesh() const;
//- Return the reference to the time database
virtual const Time& runTime() const;
//- Return the source name
virtual const word& name() const;
//- Return the active flag
virtual const Switch& active() const;
//- Return the dimensions
virtual const dimensionSet& dimensions() const;
//- Return the volume type
virtual const volumeType& volume() const;
//- Return the start time
scalar timeStart() const;
virtual scalar timeStart() const;
//- Return the duration
scalar duration() const;
//- Return the current value of the source
const dimensionedScalar currentValue() const;
//- Return a tmp field of the source
virtual tmp<DimensionedField<scalar, volMesh> > Su() const;
virtual scalar duration() const;
//- Read properties dictionary
virtual bool read();
//- Update
virtual void update();
};

View File

@ -108,7 +108,7 @@ void Foam::setRefCell
" bool\n"
")",
dict
) << "Unable to set reference cell for field" << field.name()
) << "Unable to set reference cell for field " << field.name()
<< nl
<< " Please supply either " << refCellName
<< " or " << refPointName << nl << exit(FatalIOError);

View File

@ -79,6 +79,8 @@ Foam::porousZone::porousZone
D_("D", dimensionSet(0, -2, 0, 0, 0), tensor::zero),
F_("F", dimensionSet(0, -1, 0, 0, 0), tensor::zero)
{
Info<< "Creating porous zone: " << name_ << endl;
if (cellZoneID_ == -1 && !Pstream::parRun())
{
FatalErrorIn

View File

@ -113,7 +113,17 @@ void fixedFluxBuoyantPressureFvPatchScalarField::updateCoeffs()
const fvPatchField<scalar>& rho =
patch().lookupPatchField<volScalarField, scalar>("rho");
gradient() = -rho.snGrad()*(g.value() & patch().Cf());
// If the variable name is "pd" assume it is p - rho*g.h
// and set the gradient appropriately.
// Otherwise assume the variable is the static pressure.
if (dimensionedInternalField().name() == "pd")
{
gradient() = -rho.snGrad()*(g.value() & patch().Cf());
}
else
{
gradient() = rho*(g.value() & patch().nf());
}
fixedGradientFvPatchScalarField::updateCoeffs();
}

View File

@ -26,7 +26,10 @@ Class
Foam::fixedFluxBuoyantPressureFvPatchScalarField
Description
Foam::fixedFluxBuoyantPressureFvPatchScalarField
Set the pressure gradient boundary condition appropriately for buoyant flow.
If the variable name is "pd" assume it is p - rho*g.h and set the gradient
appropriately. Otherwise assume the variable is the static pressure.
SourceFiles
fixedFluxBuoyantPressureFvPatchScalarField.C

View File

@ -21,7 +21,7 @@ License
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "gaussLaplacianScheme.H"

View File

@ -39,7 +39,7 @@ SourceFiles
#include "snGradScheme.H"
#include "quadraticFitSnGradData.H"
#include "extendedStencil.H"
#include "extendedCellToFaceStencil.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -133,7 +133,7 @@ public:
centralWeight_
);
const extendedStencil& stencil = qfd.stencil();
const extendedCellToFaceStencil& stencil = qfd.stencil();
const List<scalarList>& f = qfd.fit();
tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > sft

View File

@ -38,7 +38,7 @@ SourceFiles
#include "MeshObject.H"
#include "fvMesh.H"
#include "extendedStencil.H"
#include "extendedCellToFaceStencil.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -62,7 +62,7 @@ class quadraticFitSnGradData
const label minSize_;
//- Extended stencil addressing
extendedStencil stencil_;
extendedCellToFaceStencil stencil_;
//- For each cell in the mesh store the values which multiply the
// values of the stencil to obtain the gradient for each direction
@ -107,7 +107,7 @@ public:
// Member functions
//- Return reference to the stencil
const extendedStencil& stencil() const
const extendedCellToFaceStencil& stencil() const
{
return stencil_;
}

View File

@ -480,7 +480,7 @@ void Foam::fvMatrix<Type>::setReference
const bool forceReference
)
{
if (celli >= 0 && (psi_.needReference() || forceReference))
if ((forceReference || psi_.needReference()) && celli >= 0)
{
source()[celli] += diag()[celli]*value;
diag()[celli] += diag()[celli];

View File

@ -24,16 +24,13 @@ License
\*---------------------------------------------------------------------------*/
#include "cellEdgeCellStencil.H"
#include "CECCellToCellStencil.H"
#include "syncTools.H"
//#include "meshTools.H"
//#include "OFstream.H"
//#include "Time.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// Calculates per edge the neighbour data (= edgeCells)
void Foam::cellEdgeCellStencil::calcEdgeBoundaryData
void Foam::CECCellToCellStencil::calcEdgeBoundaryData
(
const boolList& isValidBFace,
const labelList& boundaryEdges,
@ -72,7 +69,7 @@ void Foam::cellEdgeCellStencil::calcEdgeBoundaryData
// Calculates per cell the neighbour data (= cell or boundary in global
// numbering). First element is always cell itself!
void Foam::cellEdgeCellStencil::calcCellStencil
void Foam::CECCellToCellStencil::calcCellStencil
(
labelListList& globalCellCells
) const
@ -189,20 +186,12 @@ void Foam::cellEdgeCellStencil::calcCellStencil
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::cellEdgeCellStencil::cellEdgeCellStencil(const polyMesh& mesh)
Foam::CECCellToCellStencil::CECCellToCellStencil(const polyMesh& mesh)
:
faceStencil(mesh)
cellToCellStencil(mesh)
{
// Calculate per cell the (edge) connected cells (in global numbering)
labelListList globalCellCells;
calcCellStencil(globalCellCells);
// Add stencils of neighbouring cells to create faceStencil
labelListList faceStencil;
calcFaceStencil(globalCellCells, faceStencil);
// Transfer to *this
transfer(faceStencil);
calcCellStencil(*this);
}

View File

@ -23,19 +23,19 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::cellEdgeCellStencil
Foam::CECCellToCellStencil
Description
SourceFiles
cellEdgeCellStencil.C
CECCellToCellStencil.C
\*---------------------------------------------------------------------------*/
#ifndef cellEdgeCellStencil_H
#define cellEdgeCellStencil_H
#ifndef CECCellToCellStencil_H
#define CECCellToCellStencil_H
#include "faceStencil.H"
#include "cellToCellStencil.H"
#include "boolList.H"
#include "HashSet.H"
#include "Map.H"
@ -47,12 +47,12 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
Class cellEdgeCellStencil Declaration
Class CECCellToCellStencil Declaration
\*---------------------------------------------------------------------------*/
class cellEdgeCellStencil
class CECCellToCellStencil
:
public faceStencil
public cellToCellStencil
{
// Private Member Functions
@ -68,10 +68,10 @@ class cellEdgeCellStencil
//- Disallow default bitwise copy construct
cellEdgeCellStencil(const cellEdgeCellStencil&);
CECCellToCellStencil(const CECCellToCellStencil&);
//- Disallow default bitwise assignment
void operator=(const cellEdgeCellStencil&);
void operator=(const CECCellToCellStencil&);
public:
@ -79,7 +79,7 @@ public:
// Constructors
//- Construct from all cells and boundary faces
explicit cellEdgeCellStencil(const polyMesh&);
explicit CECCellToCellStencil(const polyMesh&);
};

View File

@ -24,7 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "cellFaceCellStencil.H"
#include "CFCCellToCellStencil.H"
#include "syncTools.H"
#include "SortableList.H"
#include "emptyPolyPatch.H"
@ -32,7 +32,7 @@ License
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// Calculates per face the neighbour data (= cell or boundary face)
void Foam::cellFaceCellStencil::calcFaceBoundaryData
void Foam::CFCCellToCellStencil::calcFaceBoundaryData
(
labelList& neiGlobal
) const
@ -85,7 +85,7 @@ void Foam::cellFaceCellStencil::calcFaceBoundaryData
// Calculates per cell the neighbour data (= cell or boundary in global
// numbering). First element is always cell itself!
void Foam::cellFaceCellStencil::calcCellStencil(labelListList& globalCellCells)
void Foam::CFCCellToCellStencil::calcCellStencil(labelListList& globalCellCells)
const
{
const label nBnd = mesh().nFaces()-mesh().nInternalFaces();
@ -147,20 +147,12 @@ void Foam::cellFaceCellStencil::calcCellStencil(labelListList& globalCellCells)
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::cellFaceCellStencil::cellFaceCellStencil(const polyMesh& mesh)
Foam::CFCCellToCellStencil::CFCCellToCellStencil(const polyMesh& mesh)
:
faceStencil(mesh)
cellToCellStencil(mesh)
{
// Calculate per cell the (face) connected cells (in global numbering)
labelListList globalCellCells;
calcCellStencil(globalCellCells);
// Add stencils of neighbouring cells to create faceStencil
labelListList faceStencil;
calcFaceStencil(globalCellCells, faceStencil);
// Transfer to *this
transfer(faceStencil);
calcCellStencil(*this);
}

View File

@ -23,19 +23,19 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::cellFaceCellStencil
Foam::CFCCellToCellStencil
Description
SourceFiles
cellFaceCellStencil.C
CFCCellToCellStencil.C
\*---------------------------------------------------------------------------*/
#ifndef cellFaceCellStencil_H
#define cellFaceCellStencil_H
#ifndef CFCCellToCellStencil_H
#define CFCCellToCellStencil_H
#include "faceStencil.H"
#include "cellToCellStencil.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -43,12 +43,12 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
Class cellFaceCellStencil Declaration
Class CFCCellToCellStencil Declaration
\*---------------------------------------------------------------------------*/
class cellFaceCellStencil
class CFCCellToCellStencil
:
public faceStencil
public cellToCellStencil
{
// Private Member Functions
@ -57,17 +57,17 @@ class cellFaceCellStencil
void calcCellStencil(labelListList& globalCellCells) const;
//- Disallow default bitwise copy construct
cellFaceCellStencil(const cellFaceCellStencil&);
CFCCellToCellStencil(const CFCCellToCellStencil&);
//- Disallow default bitwise assignment
void operator=(const cellFaceCellStencil&);
void operator=(const CFCCellToCellStencil&);
public:
// Constructors
//- Construct from mesh
explicit cellFaceCellStencil(const polyMesh& mesh);
explicit CFCCellToCellStencil(const polyMesh& mesh);
};

View File

@ -24,13 +24,13 @@ License
\*---------------------------------------------------------------------------*/
#include "cellPointCellStencil.H"
#include "CPCCellToCellStencil.H"
#include "syncTools.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// Calculates per point the neighbour data (= pointCells)
void Foam::cellPointCellStencil::calcPointBoundaryData
void Foam::CPCCellToCellStencil::calcPointBoundaryData
(
const boolList& isValidBFace,
const labelList& boundaryPoints,
@ -69,7 +69,7 @@ void Foam::cellPointCellStencil::calcPointBoundaryData
// Calculates per cell the neighbour data (= cell or boundary in global
// numbering). First element is always cell itself!
void Foam::cellPointCellStencil::calcCellStencil
void Foam::CPCCellToCellStencil::calcCellStencil
(
labelListList& globalCellCells
) const
@ -154,20 +154,13 @@ void Foam::cellPointCellStencil::calcCellStencil
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::cellPointCellStencil::cellPointCellStencil(const polyMesh& mesh)
Foam::CPCCellToCellStencil::CPCCellToCellStencil(const polyMesh& mesh)
:
faceStencil(mesh)
cellToCellStencil(mesh)
{
// Calculate per cell the (point) connected cells (in global numbering)
labelListList globalCellCells;
calcCellStencil(globalCellCells);
// Add stencils of neighbouring cells to create faceStencil
labelListList faceStencil;
calcFaceStencil(globalCellCells, faceStencil);
// Transfer to *this
transfer(faceStencil);
calcCellStencil(*this);
}

View File

@ -23,19 +23,19 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::cellPointCellStencil
Foam::CPCCellToCellStencil
Description
SourceFiles
cellPointCellStencil.C
CPCCellToCellStencil.C
\*---------------------------------------------------------------------------*/
#ifndef cellPointCellStencil_H
#define cellPointCellStencil_H
#ifndef CPCCellToCellStencil_H
#define CPCCellToCellStencil_H
#include "faceStencil.H"
#include "cellToCellStencil.H"
#include "boolList.H"
#include "HashSet.H"
#include "Map.H"
@ -46,12 +46,12 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
Class cellPointCellStencil Declaration
Class CPCCellToCellStencil Declaration
\*---------------------------------------------------------------------------*/
class cellPointCellStencil
class CPCCellToCellStencil
:
public faceStencil
public cellToCellStencil
{
// Private Member Functions
@ -67,10 +67,10 @@ class cellPointCellStencil
//- Disallow default bitwise copy construct
cellPointCellStencil(const cellPointCellStencil&);
CPCCellToCellStencil(const CPCCellToCellStencil&);
//- Disallow default bitwise assignment
void operator=(const cellPointCellStencil&);
void operator=(const CPCCellToCellStencil&);
public:
@ -78,7 +78,7 @@ public:
// Constructors
//- Construct from all cells and boundary faces
explicit cellPointCellStencil(const polyMesh&);
explicit CPCCellToCellStencil(const polyMesh&);
};

View File

@ -0,0 +1,350 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "cellToCellStencil.H"
#include "syncTools.H"
#include "SortableList.H"
#include "emptyPolyPatch.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// Merge two list and guarantee global0,global1 are first.
void Foam::cellToCellStencil::merge
(
const label global0,
const label global1,
const labelList& listA,
labelList& listB
)
{
sort(listB);
// See if global0, global1 already present in listB
label nGlobalInsert = 0;
if (global0 != -1)
{
label index0 = findSortedIndex(listB, global0);
if (index0 == -1)
{
nGlobalInsert++;
}
}
if (global1 != -1)
{
label index1 = findSortedIndex(listB, global1);
if (index1 == -1)
{
nGlobalInsert++;
}
}
// For all in listA see if they are present
label nInsert = 0;
forAll(listA, i)
{
label elem = listA[i];
if (elem != global0 && elem != global1)
{
if (findSortedIndex(listB, elem) == -1)
{
nInsert++;
}
}
}
// Extend B with nInsert and whether global0,global1 need to be inserted.
labelList result(listB.size() + nGlobalInsert + nInsert);
label resultI = 0;
// Insert global0,1 first
if (global0 != -1)
{
result[resultI++] = global0;
}
if (global1 != -1)
{
result[resultI++] = global1;
}
// Insert listB
forAll(listB, i)
{
label elem = listB[i];
if (elem != global0 && elem != global1)
{
result[resultI++] = elem;
}
}
// Insert listA
forAll(listA, i)
{
label elem = listA[i];
if (elem != global0 && elem != global1)
{
if (findSortedIndex(listB, elem) == -1)
{
result[resultI++] = elem;
}
}
}
if (resultI != result.size())
{
FatalErrorIn("cellToCellStencil::merge(..)")
<< "problem" << abort(FatalError);
}
listB.transfer(result);
}
// Merge two list and guarantee globalI is first.
void Foam::cellToCellStencil::merge
(
const label globalI,
const labelList& pGlobals,
labelList& cCells
)
{
labelHashSet set;
forAll(cCells, i)
{
if (cCells[i] != globalI)
{
set.insert(cCells[i]);
}
}
forAll(pGlobals, i)
{
if (pGlobals[i] != globalI)
{
set.insert(pGlobals[i]);
}
}
cCells.setSize(set.size()+1);
label n = 0;
cCells[n++] = globalI;
forAllConstIter(labelHashSet, set, iter)
{
cCells[n++] = iter.key();
}
}
void Foam::cellToCellStencil::validBoundaryFaces(boolList& isValidBFace) const
{
const polyBoundaryMesh& patches = mesh().boundaryMesh();
isValidBFace.setSize(mesh().nFaces()-mesh().nInternalFaces(), true);
forAll(patches, patchI)
{
const polyPatch& pp = patches[patchI];
if (pp.coupled() || isA<emptyPolyPatch>(pp))
{
label bFaceI = pp.start()-mesh().nInternalFaces();
forAll(pp, i)
{
isValidBFace[bFaceI++] = false;
}
}
}
}
Foam::autoPtr<Foam::indirectPrimitivePatch>
Foam::cellToCellStencil::allCoupledFacesPatch() const
{
const polyBoundaryMesh& patches = mesh().boundaryMesh();
label nCoupled = 0;
forAll(patches, patchI)
{
const polyPatch& pp = patches[patchI];
if (pp.coupled())
{
nCoupled += pp.size();
}
}
labelList coupledFaces(nCoupled);
nCoupled = 0;
forAll(patches, patchI)
{
const polyPatch& pp = patches[patchI];
if (pp.coupled())
{
label faceI = pp.start();
forAll(pp, i)
{
coupledFaces[nCoupled++] = faceI++;
}
}
}
return autoPtr<indirectPrimitivePatch>
(
new indirectPrimitivePatch
(
IndirectList<face>
(
mesh().faces(),
coupledFaces
),
mesh().points()
)
);
}
void Foam::cellToCellStencil::unionEqOp::operator()
(
labelList& x,
const labelList& y
) const
{
if (y.size())
{
if (x.empty())
{
x = y;
}
else
{
labelHashSet set(x);
forAll(y, i)
{
set.insert(y[i]);
}
x = set.toc();
}
}
}
void Foam::cellToCellStencil::insertFaceCells
(
const label exclude0,
const label exclude1,
const boolList& isValidBFace,
const labelList& faceLabels,
labelHashSet& globals
) const
{
const labelList& own = mesh().faceOwner();
const labelList& nei = mesh().faceNeighbour();
forAll(faceLabels, i)
{
label faceI = faceLabels[i];
label globalOwn = globalNumbering().toGlobal(own[faceI]);
if (globalOwn != exclude0 && globalOwn != exclude1)
{
globals.insert(globalOwn);
}
if (mesh().isInternalFace(faceI))
{
label globalNei = globalNumbering().toGlobal(nei[faceI]);
if (globalNei != exclude0 && globalNei != exclude1)
{
globals.insert(globalNei);
}
}
else
{
label bFaceI = faceI-mesh().nInternalFaces();
if (isValidBFace[bFaceI])
{
label globalI = globalNumbering().toGlobal
(
mesh().nCells()
+ bFaceI
);
if (globalI != exclude0 && globalI != exclude1)
{
globals.insert(globalI);
}
}
}
}
}
Foam::labelList Foam::cellToCellStencil::calcFaceCells
(
const boolList& isValidBFace,
const labelList& faceLabels,
labelHashSet& globals
) const
{
globals.clear();
insertFaceCells
(
-1,
-1,
isValidBFace,
faceLabels,
globals
);
return globals.toc();
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::cellToCellStencil::cellToCellStencil(const polyMesh& mesh)
:
mesh_(mesh),
globalNumbering_(mesh_.nCells()+mesh_.nFaces()-mesh_.nInternalFaces())
{}
// ************************************************************************* //

View File

@ -0,0 +1,152 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::cellToCellStencil
Description
baseclass for extended cell centred addressing. Contains per cell a
list of neighbouring cells and/or boundaryfaces in global addressing.
SourceFiles
cellToCellStencil.C
\*---------------------------------------------------------------------------*/
#ifndef cellToCellStencil_H
#define cellToCellStencil_H
#include "globalIndex.H"
#include "boolList.H"
#include "HashSet.H"
#include "indirectPrimitivePatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class polyMesh;
/*---------------------------------------------------------------------------*\
Class cellToCellStencil Declaration
\*---------------------------------------------------------------------------*/
class cellToCellStencil
:
public labelListList
{
// Private data
const polyMesh& mesh_;
//- Global numbering for cells and boundary faces
const globalIndex globalNumbering_;
// Private Member Functions
//- Disallow default bitwise assignment
void operator=(const cellToCellStencil&);
protected:
//- Merge two lists.
static void merge
(
const label,
const label,
const labelList&,
labelList&
);
//- Merge two lists.
static void merge(const label, const labelList&, labelList&);
//- Valid boundary faces (not empty and not coupled)
void validBoundaryFaces(boolList& isValidBFace) const;
//- Return patch of all coupled faces.
autoPtr<indirectPrimitivePatch> allCoupledFacesPatch() const;
//- Combine operator for labelLists
class unionEqOp
{
public:
void operator()( labelList& x, const labelList& y ) const;
};
//- Collect cell neighbours of faces in global numbering
void insertFaceCells
(
const label exclude0,
const label exclude1,
const boolList& nonEmptyFace,
const labelList& faceLabels,
labelHashSet& globals
) const;
//- Collect cell neighbours of faces in global numbering
labelList calcFaceCells
(
const boolList& nonEmptyFace,
const labelList& faceLabels,
labelHashSet& globals
) const;
public:
// Constructors
//- Construct from mesh
explicit cellToCellStencil(const polyMesh&);
// Member Functions
const polyMesh& mesh() const
{
return mesh_;
}
//- Global numbering for cells and boundary faces
const globalIndex& globalNumbering() const
{
return globalNumbering_;
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,38 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "centredCECCellToFaceStencilObject.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(centredCECCellToFaceStencilObject, 0);
}
// ************************************************************************* //

View File

@ -23,7 +23,7 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::centredCPCStencilObject
Foam::centredCECCellToFaceStencilObject
Description
@ -31,11 +31,11 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef centredCPCStencilObject_H
#define centredCPCStencilObject_H
#ifndef centredCECCellToFaceStencilObject_H
#define centredCECCellToFaceStencilObject_H
#include "extendedCentredStencil.H"
#include "cellPointCellStencil.H"
#include "extendedCentredCellToFaceStencil.H"
#include "CECCellToFaceStencil.H"
#include "MeshObject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -44,35 +44,42 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
Class centredCPCStencilObject Declaration
Class centredCECCellToFaceStencilObject Declaration
\*---------------------------------------------------------------------------*/
class centredCPCStencilObject
class centredCECCellToFaceStencilObject
:
public MeshObject<fvMesh, centredCPCStencilObject>,
public extendedCentredStencil
public MeshObject<fvMesh, centredCECCellToFaceStencilObject>,
public extendedCentredCellToFaceStencil
{
public:
TypeName("centredCFCStencil");
TypeName("centredCECCellToFaceStencil");
// Constructors
//- Construct from uncompacted face stencil
explicit centredCPCStencilObject
explicit centredCECCellToFaceStencilObject
(
const fvMesh& mesh
)
:
MeshObject<fvMesh, centredCPCStencilObject>(mesh),
extendedCentredStencil(cellPointCellStencil(mesh))
{}
MeshObject<fvMesh, centredCECCellToFaceStencilObject>(mesh),
extendedCentredCellToFaceStencil(CECCellToFaceStencil(mesh))
{
if (extendedCellToFaceStencil::debug)
{
Info<< "Generated centred stencil " << type()
<< nl << endl;
writeStencilStats(Info, stencil(), map());
}
}
// Destructor
virtual ~centredCPCStencilObject()
virtual ~centredCECCellToFaceStencilObject()
{}
};

View File

@ -0,0 +1,38 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "centredCFCCellToFaceStencilObject.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(centredCFCCellToFaceStencilObject, 0);
}
// ************************************************************************* //

View File

@ -0,0 +1,94 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::centredCFCCellToFaceStencilObject
Description
SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef centredCFCCellToFaceStencilObject_H
#define centredCFCCellToFaceStencilObject_H
#include "extendedCentredCellToFaceStencil.H"
#include "CFCCellToFaceStencil.H"
#include "MeshObject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class centredCFCCellToFaceStencilObject Declaration
\*---------------------------------------------------------------------------*/
class centredCFCCellToFaceStencilObject
:
public MeshObject<fvMesh, centredCFCCellToFaceStencilObject>,
public extendedCentredCellToFaceStencil
{
public:
TypeName("centredCFCCellToFaceStencil");
// Constructors
//- Construct from uncompacted face stencil
explicit centredCFCCellToFaceStencilObject
(
const fvMesh& mesh
)
:
MeshObject<fvMesh, centredCFCCellToFaceStencilObject>(mesh),
extendedCentredCellToFaceStencil(CFCCellToFaceStencil(mesh))
{
if (extendedCellToFaceStencil::debug)
{
Info<< "Generated centred stencil " << type()
<< nl << endl;
writeStencilStats(Info, stencil(), map());
}
}
//- Destructor
virtual ~centredCFCCellToFaceStencilObject()
{}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,38 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "centredCPCCellToFaceStencilObject.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(centredCPCCellToFaceStencilObject, 0);
}
// ************************************************************************* //

View File

@ -0,0 +1,95 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::centredCPCCellToFaceStencilObject
Description
SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef centredCPCCellToFaceStencilObject_H
#define centredCPCCellToFaceStencilObject_H
#include "extendedCentredCellToFaceStencil.H"
#include "CPCCellToFaceStencil.H"
#include "MeshObject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class centredCPCCellToFaceStencilObject Declaration
\*---------------------------------------------------------------------------*/
class centredCPCCellToFaceStencilObject
:
public MeshObject<fvMesh, centredCPCCellToFaceStencilObject>,
public extendedCentredCellToFaceStencil
{
public:
TypeName("centredCFCCellToFaceStencil");
// Constructors
//- Construct from uncompacted face stencil
explicit centredCPCCellToFaceStencilObject
(
const fvMesh& mesh
)
:
MeshObject<fvMesh, centredCPCCellToFaceStencilObject>(mesh),
extendedCentredCellToFaceStencil(CPCCellToFaceStencil(mesh))
{
if (extendedCellToFaceStencil::debug)
{
Info<< "Generated centred stencil " << type()
<< nl << endl;
writeStencilStats(Info, stencil(), map());
}
}
// Destructor
virtual ~centredCPCCellToFaceStencilObject()
{}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,38 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "centredFECCellToFaceStencilObject.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(centredFECCellToFaceStencilObject, 0);
}
// ************************************************************************* //

View File

@ -0,0 +1,95 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::centredFECCellToFaceStencilObject
Description
SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef centredFECCellToFaceStencilObject_H
#define centredFECCellToFaceStencilObject_H
#include "extendedCentredCellToFaceStencil.H"
#include "FECCellToFaceStencil.H"
#include "MeshObject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class centredFECCellToFaceStencilObject Declaration
\*---------------------------------------------------------------------------*/
class centredFECCellToFaceStencilObject
:
public MeshObject<fvMesh, centredFECCellToFaceStencilObject>,
public extendedCentredCellToFaceStencil
{
public:
TypeName("centredCFCCellToFaceStencil");
// Constructors
//- Construct from uncompacted face stencil
explicit centredFECCellToFaceStencilObject
(
const fvMesh& mesh
)
:
MeshObject<fvMesh, centredFECCellToFaceStencilObject>(mesh),
extendedCentredCellToFaceStencil(FECCellToFaceStencil(mesh))
{
if (extendedCellToFaceStencil::debug)
{
Info<< "Generated centred stencil " << type()
<< nl << endl;
writeStencilStats(Info, stencil(), map());
}
}
// Destructor
virtual ~centredFECCellToFaceStencilObject()
{}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,38 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "pureUpwindCFCCellToFaceStencilObject.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(pureUpwindCFCCellToFaceStencilObject, 0);
}
// ************************************************************************* //

View File

@ -0,0 +1,95 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::upwindCFCCellToFaceStencilObject
Description
SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef pureUpwindCFCCellToFaceStencilObject_H
#define pureUpwindCFCCellToFaceStencilObject_H
#include "extendedUpwindCellToFaceStencil.H"
#include "CFCCellToFaceStencil.H"
#include "MeshObject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class pureUpwindCFCCellToFaceStencilObject Declaration
\*---------------------------------------------------------------------------*/
class pureUpwindCFCCellToFaceStencilObject
:
public MeshObject<fvMesh, pureUpwindCFCCellToFaceStencilObject>,
public extendedUpwindCellToFaceStencil
{
public:
TypeName("pureUpwindCFCCellToFaceStencil");
// Constructors
//- Construct from uncompacted face stencil
explicit pureUpwindCFCCellToFaceStencilObject
(
const fvMesh& mesh
)
:
MeshObject<fvMesh, pureUpwindCFCCellToFaceStencilObject>(mesh),
extendedUpwindCellToFaceStencil(CFCCellToFaceStencil(mesh))
{
if (extendedCellToFaceStencil::debug)
{
Info<< "Generated pure upwind stencil " << type()
<< nl << endl;
writeStencilStats(Info, ownStencil(), ownMap());
}
}
// Destructor
virtual ~pureUpwindCFCCellToFaceStencilObject()
{}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -24,14 +24,14 @@ License
\*---------------------------------------------------------------------------*/
#include "centredFECStencilObject.H"
#include "upwindCECCellToFaceStencilObject.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(centredFECStencilObject, 0);
defineTypeNameAndDebug(upwindCECCellToFaceStencilObject, 0);
}

View File

@ -23,7 +23,7 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::upwindCFCStencilObject
Foam::upwindCECCellToFaceStencilObject
Description
@ -31,11 +31,11 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef upwindCFCStencilObject_H
#define upwindCFCStencilObject_H
#ifndef upwindCECCellToFaceStencilObject_H
#define upwindCECCellToFaceStencilObject_H
#include "extendedUpwindStencil.H"
#include "cellFaceCellStencil.H"
#include "extendedUpwindCellToFaceStencil.H"
#include "CECCellToFaceStencil.H"
#include "MeshObject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -44,36 +44,49 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
Class upwindCFCStencilObject Declaration
Class upwindCECCellToFaceStencilObject Declaration
\*---------------------------------------------------------------------------*/
class upwindCFCStencilObject
class upwindCECCellToFaceStencilObject
:
public MeshObject<fvMesh, upwindCFCStencilObject>,
public extendedUpwindStencil
public MeshObject<fvMesh, upwindCECCellToFaceStencilObject>,
public extendedUpwindCellToFaceStencil
{
public:
TypeName("upwindCFCStencil");
TypeName("upwindCFCCellToFaceStencil");
// Constructors
//- Construct from uncompacted face stencil
explicit upwindCFCStencilObject
explicit upwindCECCellToFaceStencilObject
(
const fvMesh& mesh,
const bool pureUpwind,
const scalar minOpposedness
)
:
MeshObject<fvMesh, upwindCFCStencilObject>(mesh),
extendedUpwindStencil(cellFaceCellStencil(mesh), minOpposedness)
{}
MeshObject<fvMesh, upwindCECCellToFaceStencilObject>(mesh),
extendedUpwindCellToFaceStencil
(
CECCellToFaceStencil(mesh),
pureUpwind,
minOpposedness
)
{
if (extendedCellToFaceStencil::debug)
{
Info<< "Generated off-centred stencil " << type()
<< nl << endl;
writeStencilStats(Info, ownStencil(), ownMap());
}
}
// Destructor
virtual ~upwindCFCStencilObject()
virtual ~upwindCECCellToFaceStencilObject()
{}
};

View File

@ -24,14 +24,14 @@ License
\*---------------------------------------------------------------------------*/
#include "centredCECStencilObject.H"
#include "upwindCFCCellToFaceStencilObject.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(centredCECStencilObject, 0);
defineTypeNameAndDebug(upwindCFCCellToFaceStencilObject, 0);
}

View File

@ -23,7 +23,7 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::upwindCPCStencilObject
Foam::upwindCFCCellToFaceStencilObject
Description
@ -31,11 +31,11 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef upwindCPCStencilObject_H
#define upwindCPCStencilObject_H
#ifndef upwindCFCCellToFaceStencilObject_H
#define upwindCFCCellToFaceStencilObject_H
#include "extendedUpwindStencil.H"
#include "cellPointCellStencil.H"
#include "extendedUpwindCellToFaceStencil.H"
#include "CFCCellToFaceStencil.H"
#include "MeshObject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -44,36 +44,49 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
Class upwindCPCStencilObject Declaration
Class upwindCFCCellToFaceStencilObject Declaration
\*---------------------------------------------------------------------------*/
class upwindCPCStencilObject
class upwindCFCCellToFaceStencilObject
:
public MeshObject<fvMesh, upwindCPCStencilObject>,
public extendedUpwindStencil
public MeshObject<fvMesh, upwindCFCCellToFaceStencilObject>,
public extendedUpwindCellToFaceStencil
{
public:
TypeName("upwindCFCStencil");
TypeName("upwindCFCCellToFaceStencil");
// Constructors
//- Construct from uncompacted face stencil
explicit upwindCPCStencilObject
explicit upwindCFCCellToFaceStencilObject
(
const fvMesh& mesh,
const bool pureUpwind,
const scalar minOpposedness
)
:
MeshObject<fvMesh, upwindCPCStencilObject>(mesh),
extendedUpwindStencil(cellPointCellStencil(mesh), minOpposedness)
{}
MeshObject<fvMesh, upwindCFCCellToFaceStencilObject>(mesh),
extendedUpwindCellToFaceStencil
(
CFCCellToFaceStencil(mesh),
pureUpwind,
minOpposedness
)
{
if (extendedCellToFaceStencil::debug)
{
Info<< "Generated off-centred stencil " << type()
<< nl << endl;
writeStencilStats(Info, ownStencil(), ownMap());
}
}
// Destructor
virtual ~upwindCPCStencilObject()
virtual ~upwindCFCCellToFaceStencilObject()
{}
};

View File

@ -24,14 +24,14 @@ License
\*---------------------------------------------------------------------------*/
#include "centredCPCStencilObject.H"
#include "upwindCPCCellToFaceStencilObject.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(centredCPCStencilObject, 0);
defineTypeNameAndDebug(upwindCPCCellToFaceStencilObject, 0);
}

View File

@ -23,7 +23,7 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::upwindFECStencilObject
Foam::upwindCPCCellToFaceStencilObject
Description
@ -31,11 +31,11 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef upwindFECStencilObject_H
#define upwindFECStencilObject_H
#ifndef upwindCPCCellToFaceStencilObject_H
#define upwindCPCCellToFaceStencilObject_H
#include "extendedUpwindStencil.H"
#include "faceEdgeCellStencil.H"
#include "extendedUpwindCellToFaceStencil.H"
#include "CPCCellToFaceStencil.H"
#include "MeshObject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -44,36 +44,49 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
Class upwindFECStencilObject Declaration
Class upwindCPCCellToFaceStencilObject Declaration
\*---------------------------------------------------------------------------*/
class upwindFECStencilObject
class upwindCPCCellToFaceStencilObject
:
public MeshObject<fvMesh, upwindFECStencilObject>,
public extendedUpwindStencil
public MeshObject<fvMesh, upwindCPCCellToFaceStencilObject>,
public extendedUpwindCellToFaceStencil
{
public:
TypeName("upwindCFCStencil");
TypeName("upwindCFCCellToFaceStencil");
// Constructors
//- Construct from uncompacted face stencil
explicit upwindFECStencilObject
explicit upwindCPCCellToFaceStencilObject
(
const fvMesh& mesh,
const bool pureUpwind,
const scalar minOpposedness
)
:
MeshObject<fvMesh, upwindFECStencilObject>(mesh),
extendedUpwindStencil(faceEdgeCellStencil(mesh), minOpposedness)
{}
MeshObject<fvMesh, upwindCPCCellToFaceStencilObject>(mesh),
extendedUpwindCellToFaceStencil
(
CPCCellToFaceStencil(mesh),
pureUpwind,
minOpposedness
)
{
if (extendedCellToFaceStencil::debug)
{
Info<< "Generated off-centred stencil " << type()
<< nl << endl;
writeStencilStats(Info, ownStencil(), ownMap());
}
}
// Destructor
virtual ~upwindFECStencilObject()
virtual ~upwindCPCCellToFaceStencilObject()
{}
};

View File

@ -24,14 +24,14 @@ License
\*---------------------------------------------------------------------------*/
#include "centredCFCStencilObject.H"
#include "upwindFECCellToFaceStencilObject.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(centredCFCStencilObject, 0);
defineTypeNameAndDebug(upwindFECCellToFaceStencilObject, 0);
}

View File

@ -23,7 +23,7 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::upwindCECStencilObject
Foam::upwindFECCellToFaceStencilObject
Description
@ -31,11 +31,11 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef upwindCECStencilObject_H
#define upwindCECStencilObject_H
#ifndef upwindFECCellToFaceStencilObject_H
#define upwindFECCellToFaceStencilObject_H
#include "extendedUpwindStencil.H"
#include "cellEdgeCellStencil.H"
#include "extendedUpwindCellToFaceStencil.H"
#include "FECCellToFaceStencil.H"
#include "MeshObject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -44,36 +44,49 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
Class upwindCECStencilObject Declaration
Class upwindFECCellToFaceStencilObject Declaration
\*---------------------------------------------------------------------------*/
class upwindCECStencilObject
class upwindFECCellToFaceStencilObject
:
public MeshObject<fvMesh, upwindCECStencilObject>,
public extendedUpwindStencil
public MeshObject<fvMesh, upwindFECCellToFaceStencilObject>,
public extendedUpwindCellToFaceStencil
{
public:
TypeName("upwindCFCStencil");
TypeName("upwindCFCCellToFaceStencil");
// Constructors
//- Construct from uncompacted face stencil
explicit upwindCECStencilObject
explicit upwindFECCellToFaceStencilObject
(
const fvMesh& mesh,
const bool pureUpwind,
const scalar minOpposedness
)
:
MeshObject<fvMesh, upwindCECStencilObject>(mesh),
extendedUpwindStencil(cellEdgeCellStencil(mesh), minOpposedness)
{}
MeshObject<fvMesh, upwindFECCellToFaceStencilObject>(mesh),
extendedUpwindCellToFaceStencil
(
FECCellToFaceStencil(mesh),
pureUpwind,
minOpposedness
)
{
if (extendedCellToFaceStencil::debug)
{
Info<< "Generated off-centred stencil " << type()
<< nl << endl;
writeStencilStats(Info, ownStencil(), ownMap());
}
}
// Destructor
virtual ~upwindCECStencilObject()
virtual ~upwindFECCellToFaceStencilObject()
{}
};

View File

@ -24,184 +24,83 @@ License
\*---------------------------------------------------------------------------*/
#include "extendedStencil.H"
#include "extendedCellToFaceStencil.H"
#include "globalIndex.H"
#include "syncTools.H"
#include "SortableList.H"
/* * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * */
defineTypeNameAndDebug(Foam::extendedCellToFaceStencil, 0);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// Calculates per face a list of global cell/face indices.
void Foam::extendedStencil::calcFaceStencil
void Foam::extendedCellToFaceStencil::writeStencilStats
(
const labelListList& globalCellCells,
labelListList& faceStencil
Ostream& os,
const labelListList& stencil,
const mapDistribute& map
)
{
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
const label nBnd = mesh_.nFaces()-mesh_.nInternalFaces();
const labelList& own = mesh_.faceOwner();
const labelList& nei = mesh_.faceNeighbour();
label sumSize = 0;
label nSum = 0;
label minSize = labelMax;
label maxSize = labelMin;
// Determine neighbouring global cell Cells
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
labelListList neiGlobalCellCells(nBnd);
forAll(patches, patchI)
forAll(stencil, i)
{
const polyPatch& pp = patches[patchI];
const labelList& sCells = stencil[i];
if (pp.coupled())
if (sCells.size() > 0)
{
label faceI = pp.start();
forAll(pp, i)
{
neiGlobalCellCells[faceI-mesh_.nInternalFaces()] =
globalCellCells[own[faceI]];
faceI++;
}
sumSize += sCells.size();
nSum++;
minSize = min(minSize, sCells.size());
maxSize = max(maxSize, sCells.size());
}
}
syncTools::swapBoundaryFaceList(mesh_, neiGlobalCellCells, false);
reduce(sumSize, sumOp<label>());
reduce(nSum, sumOp<label>());
reduce(minSize, minOp<label>());
reduce(maxSize, maxOp<label>());
os << "Stencil size :" << nl
<< " average : " << scalar(sumSize)/nSum << nl
<< " min : " << minSize << nl
<< " max : " << maxSize << nl
<< endl;
// Construct stencil in global numbering
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
faceStencil.setSize(mesh_.nFaces());
labelHashSet faceStencilSet;
for (label faceI = 0; faceI < mesh_.nInternalFaces(); faceI++)
// Sum all sent data
label nSent = 0;
label nLocal = 0;
forAll(map.subMap(), procI)
{
faceStencilSet.clear();
const labelList& ownCCells = globalCellCells[own[faceI]];
label globalOwn = ownCCells[0];
// Insert cellCells
forAll(ownCCells, i)
if (procI != Pstream::myProcNo())
{
faceStencilSet.insert(ownCCells[i]);
nSent += map.subMap()[procI].size();
}
const labelList& neiCCells = globalCellCells[nei[faceI]];
label globalNei = neiCCells[0];
// Insert cellCells
forAll(neiCCells, i)
else
{
faceStencilSet.insert(neiCCells[i]);
}
// Guarantee owner first, neighbour second.
faceStencil[faceI].setSize(faceStencilSet.size());
label n = 0;
faceStencil[faceI][n++] = globalOwn;
faceStencil[faceI][n++] = globalNei;
forAllConstIter(labelHashSet, faceStencilSet, iter)
{
if (iter.key() != globalOwn && iter.key() != globalNei)
{
faceStencil[faceI][n++] = iter.key();
}
}
//Pout<< "internalface:" << faceI << " toc:" << faceStencilSet.toc()
// << " faceStencil:" << faceStencil[faceI] << endl;
}
forAll(patches, patchI)
{
const polyPatch& pp = patches[patchI];
label faceI = pp.start();
if (pp.coupled())
{
forAll(pp, i)
{
faceStencilSet.clear();
const labelList& ownCCells = globalCellCells[own[faceI]];
label globalOwn = ownCCells[0];
forAll(ownCCells, i)
{
faceStencilSet.insert(ownCCells[i]);
}
// And the neighbours of the coupled cell
const labelList& neiCCells =
neiGlobalCellCells[faceI-mesh_.nInternalFaces()];
label globalNei = neiCCells[0];
forAll(neiCCells, i)
{
faceStencilSet.insert(neiCCells[i]);
}
// Guarantee owner first, neighbour second.
faceStencil[faceI].setSize(faceStencilSet.size());
label n = 0;
faceStencil[faceI][n++] = globalOwn;
faceStencil[faceI][n++] = globalNei;
forAllConstIter(labelHashSet, faceStencilSet, iter)
{
if (iter.key() != globalOwn && iter.key() != globalNei)
{
faceStencil[faceI][n++] = iter.key();
}
}
//Pout<< "coupledface:" << faceI
// << " toc:" << faceStencilSet.toc()
// << " faceStencil:" << faceStencil[faceI] << endl;
faceI++;
}
}
else if (!isA<emptyPolyPatch>(pp))
{
forAll(pp, i)
{
faceStencilSet.clear();
const labelList& ownCCells = globalCellCells[own[faceI]];
label globalOwn = ownCCells[0];
forAll(ownCCells, i)
{
faceStencilSet.insert(ownCCells[i]);
}
// Guarantee owner first, neighbour second.
faceStencil[faceI].setSize(faceStencilSet.size());
label n = 0;
faceStencil[faceI][n++] = globalOwn;
forAllConstIter(labelHashSet, faceStencilSet, iter)
{
if (iter.key() != globalOwn)
{
faceStencil[faceI][n++] = iter.key();
}
}
//Pout<< "boundaryface:" << faceI
// << " toc:" << faceStencilSet.toc()
// << " faceStencil:" << faceStencil[faceI] << endl;
faceI++;
}
nLocal += map.subMap()[procI].size();
}
}
os << "Local data size : " << returnReduce(nLocal, sumOp<label>()) << nl
<< "Sent data size : " << returnReduce(nSent, sumOp<label>()) << nl
<< endl;
}
Foam::autoPtr<Foam::mapDistribute> Foam::extendedStencil::calcDistributeMap
Foam::autoPtr<Foam::mapDistribute>
Foam::extendedCellToFaceStencil::calcDistributeMap
(
const polyMesh& mesh,
const globalIndex& globalNumbering,
labelListList& faceStencil
)
{
const label nBnd = mesh_.nFaces()-mesh_.nInternalFaces();
// Convert stencil to schedule
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -215,8 +114,8 @@ Foam::autoPtr<Foam::mapDistribute> Foam::extendedStencil::calcDistributeMap
// these are always all needed.
List<Map<label> > globalToProc(Pstream::nProcs());
{
const labelList& procPatchMap = mesh_.globalData().procPatchMap();
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
const labelList& procPatchMap = mesh.globalData().procPatchMap();
const polyBoundaryMesh& patches = mesh.boundaryMesh();
// Presize with (as estimate) size of patch to neighbour.
forAll(procPatchMap, procI)
@ -280,12 +179,12 @@ Foam::autoPtr<Foam::mapDistribute> Foam::extendedStencil::calcDistributeMap
// 2. The overall compact addressing is
// - myProcNo first
// - myProcNo data first (uncompacted)
// - all other processors consecutively
labelList compactStart(Pstream::nProcs());
compactStart[Pstream::myProcNo()] = 0;
label nCompact = mesh_.nCells()+nBnd;
label nCompact = globalNumbering.localSize();
forAll(compactStart, procI)
{
if (procI != Pstream::myProcNo())
@ -321,7 +220,7 @@ Foam::autoPtr<Foam::mapDistribute> Foam::extendedStencil::calcDistributeMap
{
recvCompact[procI] =
compactStart[procI]
+ identity(mesh_.nCells()+nBnd);
+ identity(globalNumbering.localSize());
}
}
labelListList sendCompact(Pstream::nProcs());
@ -374,8 +273,9 @@ Foam::autoPtr<Foam::mapDistribute> Foam::extendedStencil::calcDistributeMap
}
}
// Constuct map for distribution of compact data.
return autoPtr<mapDistribute>
autoPtr<mapDistribute> mapPtr
(
new mapDistribute
(
@ -385,15 +285,40 @@ Foam::autoPtr<Foam::mapDistribute> Foam::extendedStencil::calcDistributeMap
true // reuse send/recv maps.
)
);
return mapPtr;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::extendedStencil::extendedStencil(const polyMesh& mesh)
Foam::extendedCellToFaceStencil::extendedCellToFaceStencil(const polyMesh& mesh)
:
mesh_(mesh)
{}
{
// Check for transformation - not supported.
const polyBoundaryMesh& patches = mesh.boundaryMesh();
forAll(patches, patchI)
{
if (isA<coupledPolyPatch>(patches[patchI]))
{
const coupledPolyPatch& cpp =
refCast<const coupledPolyPatch>(patches[patchI]);
if (!cpp.parallel() || cpp.separated())
{
FatalErrorIn
(
"extendedCellToFaceStencil::extendedCellToFaceStencil"
"(const polyMesh&)"
) << "Coupled patches with transformations not supported."
<< endl
<< "Problematic patch " << cpp.name() << exit(FatalError);
}
}
}
}
// ************************************************************************* //

View File

@ -23,10 +23,10 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::extendedStencil
Foam::extendedCellToFaceStencil
Description
Calculates/constains the extended face stencil.
Calculates/constains the extended cell-to-face stencil.
The stencil is a list of indices into either cells or boundary faces
in a compact way. (element 0 is owner, 1 is neighbour). The index numbering
@ -41,13 +41,13 @@ Description
- sum the weights*field.
SourceFiles
extendedStencil.C
extendedStencilTemplates.C
extendedCellToFaceStencil.C
extendedCellToFaceStencilTemplates.C
\*---------------------------------------------------------------------------*/
#ifndef extendedStencil_H
#define extendedStencil_H
#ifndef extendedCellToFaceStencil_H
#define extendedCellToFaceStencil_H
#include "mapDistribute.H"
#include "volFields.H"
@ -61,10 +61,10 @@ namespace Foam
class globalIndex;
/*---------------------------------------------------------------------------*\
Class extendedStencil Declaration
Class extendedCellToFaceStencil Declaration
\*---------------------------------------------------------------------------*/
class extendedStencil
class extendedCellToFaceStencil
{
protected:
@ -75,19 +75,6 @@ protected:
// Protected Member Functions
//- Collect cell neighbours into extended stencil
void calcFaceStencil
(
const labelListList& globalCellCells,
labelListList& faceStencil
);
//- Calculate distribute map
autoPtr<mapDistribute> calcDistributeMap
(
const globalIndex& globalNumbering,
labelListList& faceStencil
);
private:
@ -95,22 +82,44 @@ private:
// Private Member Functions
//- Disallow default bitwise copy construct
extendedStencil(const extendedStencil&);
extendedCellToFaceStencil(const extendedCellToFaceStencil&);
//- Disallow default bitwise assignment
void operator=(const extendedStencil&);
void operator=(const extendedCellToFaceStencil&);
protected:
//- Write some statistics about stencil
static void writeStencilStats
(
Ostream& os,
const labelListList& stencil,
const mapDistribute& map
);
public:
// Declare name of the class and its debug switch
ClassName("extendedCellToFaceStencil");
// Constructors
//- Construct from mesh
explicit extendedStencil(const polyMesh&);
explicit extendedCellToFaceStencil(const polyMesh&);
// Member Functions
//- Calculate distribute map
static autoPtr<mapDistribute> calcDistributeMap
(
const polyMesh& mesh,
const globalIndex& globalNumbering,
labelListList& faceStencil
);
//- Use map to get the data into stencil order
template<class T>
static void collectData
@ -141,7 +150,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "extendedStencilTemplates.C"
# include "extendedCellToFaceStencilTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -24,12 +24,12 @@ License
\*---------------------------------------------------------------------------*/
#include "extendedStencil.H"
#include "extendedCellToFaceStencil.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void Foam::extendedStencil::collectData
void Foam::extendedCellToFaceStencil::collectData
(
const mapDistribute& map,
const labelListList& stencil,
@ -79,7 +79,7 @@ void Foam::extendedStencil::collectData
template<class Type>
Foam::tmp<Foam::GeometricField<Type, Foam::fvsPatchField, Foam::surfaceMesh> >
Foam::extendedStencil::weightedSum
Foam::extendedCellToFaceStencil::weightedSum
(
const mapDistribute& map,
const labelListList& stencil,
@ -101,7 +101,10 @@ Foam::extendedStencil::weightedSum
(
fld.name(),
mesh.time().timeName(),
mesh
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
mesh,
dimensioned<Type>

View File

@ -25,26 +25,34 @@ License
\*---------------------------------------------------------------------------*/
#include "mapDistribute.H"
#include "extendedCentredStencil.H"
#include "faceStencil.H"
#include "extendedCentredCellToFaceStencil.H"
#include "cellToFaceStencil.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::extendedCentredStencil::extendedCentredStencil(const faceStencil& stencil)
Foam::extendedCentredCellToFaceStencil::extendedCentredCellToFaceStencil
(
const cellToFaceStencil& stencil
)
:
extendedStencil(stencil.mesh())
extendedCellToFaceStencil(stencil.mesh())
{
stencil_ = stencil;
// Calculate distribute map (also renumbers stencil)
mapPtr_ = calcDistributeMap(stencil.globalNumbering(), stencil_);
// Calculate distribute map (also renumbers elements in stencil)
mapPtr_ = calcDistributeMap
(
stencil.mesh(),
stencil.globalNumbering(),
stencil_
);
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
// Per face which elements of the stencil to keep.
void Foam::extendedCentredStencil::compact()
void Foam::extendedCentredCellToFaceStencil::compact()
{
boolList isInStencil(map().constructSize(), false);

View File

@ -23,34 +23,34 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::extendedCentredStencil
Foam::extendedCentredCellToFaceStencil
Description
SourceFiles
extendedCentredStencil.C
extendedCentredCellToFaceStencil.C
\*---------------------------------------------------------------------------*/
#ifndef extendedCentredStencil_H
#define extendedCentredStencil_H
#ifndef extendedCentredCellToFaceStencil_H
#define extendedCentredCellToFaceStencil_H
#include "extendedStencil.H"
#include "extendedCellToFaceStencil.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class faceStencil;
class cellToFaceStencil;
/*---------------------------------------------------------------------------*\
Class extendedCentredStencil Declaration
Class extendedCentredCellToFaceStencil Declaration
\*---------------------------------------------------------------------------*/
class extendedCentredStencil
class extendedCentredCellToFaceStencil
:
public extendedStencil
public extendedCellToFaceStencil
{
// Private data
@ -64,10 +64,13 @@ class extendedCentredStencil
// Private Member Functions
//- Disallow default bitwise copy construct
extendedCentredStencil(const extendedCentredStencil&);
extendedCentredCellToFaceStencil
(
const extendedCentredCellToFaceStencil&
);
//- Disallow default bitwise assignment
void operator=(const extendedCentredStencil&);
void operator=(const extendedCentredCellToFaceStencil&);
public:
@ -75,7 +78,7 @@ public:
// Constructors
//- Construct from uncompacted face stencil
explicit extendedCentredStencil(const faceStencil&);
explicit extendedCentredCellToFaceStencil(const cellToFaceStencil&);
// Member Functions
@ -103,7 +106,13 @@ public:
List<List<T> >& stencilFld
) const
{
extendedStencil::collectData(map(), stencil(), fld, stencilFld);
extendedCellToFaceStencil::collectData
(
map(),
stencil(),
fld,
stencilFld
);
}
//- Sum vol field contributions to create face values
@ -114,7 +123,7 @@ public:
const List<List<scalar> >& stencilWeights
) const
{
return extendedStencil::weightedSum
return extendedCellToFaceStencil::weightedSum
(
map(),
stencil(),

View File

@ -24,14 +24,14 @@ License
\*---------------------------------------------------------------------------*/
#include "extendedUpwindStencil.H"
#include "faceStencil.H"
#include "extendedUpwindCellToFaceStencil.H"
#include "cellToFaceStencil.H"
#include "syncTools.H"
#include "SortableList.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::extendedUpwindStencil::selectOppositeFaces
void Foam::extendedUpwindCellToFaceStencil::selectOppositeFaces
(
const boolList& nonEmptyFace,
const scalar minOpposedness,
@ -103,7 +103,7 @@ void Foam::extendedUpwindStencil::selectOppositeFaces
}
void Foam::extendedUpwindStencil::transportStencil
void Foam::extendedUpwindCellToFaceStencil::transportStencil
(
const boolList& nonEmptyFace,
const labelListList& faceStencil,
@ -168,8 +168,10 @@ void Foam::extendedUpwindStencil::transportStencil
}
if (n != transportedStencil.size())
{
FatalErrorIn("extendedUpwindStencil::transportStencil(..)")
<< "problem:" << faceStencilSet
FatalErrorIn
(
"extendedUpwindCellToFaceStencil::transportStencil(..)"
) << "problem:" << faceStencilSet
<< abort(FatalError);
}
}
@ -188,15 +190,17 @@ void Foam::extendedUpwindStencil::transportStencil
}
if (n != transportedStencil.size())
{
FatalErrorIn("extendedUpwindStencil::transportStencil(..)")
<< "problem:" << faceStencilSet
FatalErrorIn
(
"extendedUpwindCellToFaceStencil::transportStencil(..)"
) << "problem:" << faceStencilSet
<< abort(FatalError);
}
}
}
void Foam::extendedUpwindStencil::transportStencils
void Foam::extendedUpwindCellToFaceStencil::transportStencils
(
const labelListList& faceStencil,
const scalar minOpposedness,
@ -240,6 +244,7 @@ void Foam::extendedUpwindStencil::transportStencils
// Internal faces
for (label faceI = 0; faceI < mesh_.nInternalFaces(); faceI++)
{
// Get stencil as owner + neighbour + stencil from 'opposite' faces
transportStencil
(
nonEmptyFace,
@ -367,13 +372,15 @@ void Foam::extendedUpwindStencil::transportStencils
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::extendedUpwindStencil::extendedUpwindStencil
Foam::extendedUpwindCellToFaceStencil::extendedUpwindCellToFaceStencil
(
const faceStencil& stencil,
const cellToFaceStencil& stencil,
const bool pureUpwind,
const scalar minOpposedness
)
:
extendedStencil(stencil.mesh())
extendedCellToFaceStencil(stencil.mesh()),
pureUpwind_(pureUpwind)
{
//forAll(stencil, faceI)
//{
@ -414,15 +421,145 @@ Foam::extendedUpwindStencil::extendedUpwindStencil
ownMapPtr_ = calcDistributeMap
(
stencil.mesh(),
stencil.globalNumbering(),
ownStencil_
);
neiMapPtr_ = calcDistributeMap
(
stencil.mesh(),
stencil.globalNumbering(),
neiStencil_
);
// stencil now in compact form
if (pureUpwind_)
{
const fvMesh& mesh = dynamic_cast<const fvMesh&>(stencil.mesh());
List<List<point> > stencilPoints(ownStencil_.size());
// Owner stencil
// ~~~~~~~~~~~~~
collectData(ownMapPtr_(), ownStencil_, mesh.C(), stencilPoints);
// Mask off all stencil points on wrong side of face
forAll(stencilPoints, faceI)
{
const point& fc = mesh.faceCentres()[faceI];
const vector& fArea = mesh.faceAreas()[faceI];
const List<point>& points = stencilPoints[faceI];
const labelList& stencil = ownStencil_[faceI];
DynamicList<label> newStencil(stencil.size());
forAll(points, i)
{
if (((points[i]-fc) & fArea) < 0)
{
newStencil.append(stencil[i]);
}
}
if (newStencil.size() != stencil.size())
{
ownStencil_[faceI].transfer(newStencil);
}
}
// Neighbour stencil
// ~~~~~~~~~~~~~~~~~
collectData(neiMapPtr_(), neiStencil_, mesh.C(), stencilPoints);
// Mask off all stencil points on wrong side of face
forAll(stencilPoints, faceI)
{
const point& fc = mesh.faceCentres()[faceI];
const vector& fArea = mesh.faceAreas()[faceI];
const List<point>& points = stencilPoints[faceI];
const labelList& stencil = neiStencil_[faceI];
DynamicList<label> newStencil(stencil.size());
forAll(points, i)
{
if (((points[i]-fc) & fArea) > 0)
{
newStencil.append(stencil[i]);
}
}
if (newStencil.size() != stencil.size())
{
neiStencil_[faceI].transfer(newStencil);
}
}
// Note: could compact schedule as well. for if cells are not needed
// across any boundary anymore. However relatively rare.
}
}
Foam::extendedUpwindCellToFaceStencil::extendedUpwindCellToFaceStencil
(
const cellToFaceStencil& stencil
)
:
extendedCellToFaceStencil(stencil.mesh()),
pureUpwind_(true)
{
// Calculate stencil points with full stencil
ownStencil_ = stencil;
ownMapPtr_ = calcDistributeMap
(
stencil.mesh(),
stencil.globalNumbering(),
ownStencil_
);
const fvMesh& mesh = dynamic_cast<const fvMesh&>(stencil.mesh());
List<List<point> > stencilPoints(ownStencil_.size());
collectData(ownMapPtr_(), ownStencil_, mesh.C(), stencilPoints);
// Split stencil into owner and neighbour
neiStencil_.setSize(ownStencil_.size());
forAll(stencilPoints, faceI)
{
const point& fc = mesh.faceCentres()[faceI];
const vector& fArea = mesh.faceAreas()[faceI];
const List<point>& points = stencilPoints[faceI];
const labelList& stencil = ownStencil_[faceI];
DynamicList<label> newOwnStencil(stencil.size());
DynamicList<label> newNeiStencil(stencil.size());
forAll(points, i)
{
if (((points[i]-fc) & fArea) > 0)
{
newNeiStencil.append(stencil[i]);
}
else
{
newOwnStencil.append(stencil[i]);
}
}
if (newNeiStencil.size() > 0)
{
ownStencil_[faceI].transfer(newOwnStencil);
neiStencil_[faceI].transfer(newNeiStencil);
}
}
// Should compact schedule. Or have both return the same schedule.
neiMapPtr_.reset(new mapDistribute(ownMapPtr_()));
}

View File

@ -23,38 +23,50 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::extendedUpwindStencil
Foam::extendedUpwindCellToFaceStencil
Description
Creates upwind stencil by shifting a centred stencil to upwind and downwind
faces and optionally removing all non-(up/down)wind faces ('pureUpwind').
Note: the minOpposedness parameter is to decide which upwind and
downwind faces to combine the stencils from. If myArea is the
local area and upwindArea
the area of the possible upwind candidate it will be included if
(upwindArea & myArea)/magSqr(myArea) > minOpposedness
so this includes both cosine and area. WIP.
SourceFiles
extendedUpwindStencil.C
extendedUpwindStencilTemplates.C
extendedUpwindCellToFaceStencil.C
extendedUpwindCellToFaceStencilTemplates.C
\*---------------------------------------------------------------------------*/
#ifndef extendedUpwindStencil_H
#define extendedUpwindStencil_H
#ifndef extendedUpwindCellToFaceStencil_H
#define extendedUpwindCellToFaceStencil_H
#include "extendedStencil.H"
#include "extendedCellToFaceStencil.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class faceStencil;
class cellToFaceStencil;
/*---------------------------------------------------------------------------*\
Class extendedUpwindStencil Declaration
Class extendedUpwindCellToFaceStencil Declaration
\*---------------------------------------------------------------------------*/
class extendedUpwindStencil
class extendedUpwindCellToFaceStencil
:
public extendedStencil
public extendedCellToFaceStencil
{
// Private data
//- Does stencil contain upwind points only
const bool pureUpwind_;
//- Swap map for getting neigbouring data
autoPtr<mapDistribute> ownMapPtr_;
autoPtr<mapDistribute> neiMapPtr_;
@ -103,26 +115,41 @@ class extendedUpwindStencil
//- Disallow default bitwise copy construct
extendedUpwindStencil(const extendedUpwindStencil&);
extendedUpwindCellToFaceStencil(const extendedUpwindCellToFaceStencil&);
//- Disallow default bitwise assignment
void operator=(const extendedUpwindStencil&);
void operator=(const extendedUpwindCellToFaceStencil&);
public:
// Constructors
//- Construct from mesh and uncompacted face stencil
extendedUpwindStencil
//- Construct from mesh and uncompacted centred face stencil.
// Transports facestencil to create owner and neighbour versions.
// pureUpwind to remove any remaining downwind cells.
extendedUpwindCellToFaceStencil
(
const faceStencil&,
const cellToFaceStencil&,
const bool pureUpwind,
const scalar minOpposedness
);
//- Construct from mesh and uncompacted centred face stencil. Splits
// stencil into owner and neighbour (so always pure upwind)
extendedUpwindCellToFaceStencil
(
const cellToFaceStencil&
);
// Member Functions
bool pureUpwind() const
{
return pureUpwind_;
}
//- Return reference to the parallel distribution map
const mapDistribute& ownMap() const
{
@ -167,7 +194,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "extendedUpwindStencilTemplates.C"
# include "extendedUpwindCellToFaceStencilTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -24,13 +24,13 @@ License
\*---------------------------------------------------------------------------*/
#include "extendedStencil.H"
#include "extendedCellToFaceStencil.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
Foam::tmp<Foam::GeometricField<Type, Foam::fvsPatchField, Foam::surfaceMesh> >
Foam::extendedUpwindStencil::weightedSum
Foam::extendedUpwindCellToFaceStencil::weightedSum
(
const surfaceScalarField& phi,
const GeometricField<Type, fvPatchField, volMesh>& fld,
@ -54,7 +54,10 @@ Foam::extendedUpwindStencil::weightedSum
(
fld.name(),
mesh.time().timeName(),
mesh
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
mesh,
dimensioned<Type>

View File

@ -0,0 +1,50 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "CECCellToFaceStencil.H"
#include "CECCellToCellStencil.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::CECCellToFaceStencil::CECCellToFaceStencil(const polyMesh& mesh)
:
cellToFaceStencil(mesh)
{
// Calculate per cell the (edge) connected cells (in global numbering)
CECCellToCellStencil globalCellCells(mesh);
// Add stencils of neighbouring cells to create faceStencil
labelListList faceStencil;
calcFaceStencil(globalCellCells, faceStencil);
// Transfer to *this
transfer(faceStencil);
}
// ************************************************************************* //

View File

@ -0,0 +1,81 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::CECCellToFaceStencil
Description
Combined corresponding cellToCellStencil of owner and neighbour.
SourceFiles
CECCellToFaceStencil.C
\*---------------------------------------------------------------------------*/
#ifndef CECCellToFaceStencil_H
#define CECCellToFaceStencil_H
#include "cellToFaceStencil.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class CECCellToFaceStencil Declaration
\*---------------------------------------------------------------------------*/
class CECCellToFaceStencil
:
public cellToFaceStencil
{
// Private Member Functions
//- Disallow default bitwise copy construct
CECCellToFaceStencil(const CECCellToFaceStencil&);
//- Disallow default bitwise assignment
void operator=(const CECCellToFaceStencil&);
public:
// Constructors
//- Construct from all cells and boundary faces
explicit CECCellToFaceStencil(const polyMesh&);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

Some files were not shown because too many files have changed in this diff Show More