Merge branch 'master' into cvm

Conflicts:
	applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtract.C
This commit is contained in:
graham
2010-02-22 13:59:07 +00:00
430 changed files with 10549 additions and 4779 deletions

View File

@ -453,7 +453,9 @@ $(constraintPointPatches)/processor/processorPointPatch.C
derivedPointPatches = $(pointPatches)/derived
$(derivedPointPatches)/coupled/coupledFacePointPatch.C
/*
$(derivedPointPatches)/global/globalPointPatch.C
*/
$(derivedPointPatches)/wall/wallPointPatch.C
pointBoundaryMesh = $(pointMesh)/pointBoundaryMesh
@ -508,7 +510,9 @@ $(constraintPointPatchFields)/processor/processorPointPatchFields.C
derivedPointPatchFields = $(pointPatchFields)/derived
$(derivedPointPatchFields)/slip/slipPointPatchFields.C
/*
$(derivedPointPatchFields)/global/globalPointPatchFields.C
*/
$(derivedPointPatchFields)/uniformFixedValue/uniformFixedValuePointPatchFields.C
$(derivedPointPatchFields)/timeVaryingUniformFixedValue/timeVaryingUniformFixedValuePointPatchFields.C

View File

@ -38,7 +38,8 @@ Foam::IPstream::IPstream
)
:
Pstream(commsType, bufSize),
UIPstream(commsType, fromProcNo, buf_)
UIPstream(commsType, fromProcNo, buf_, externalBufPosition_),
externalBufPosition_(0)
{}

View File

@ -55,6 +55,9 @@ class IPstream
public UIPstream
{
//- Receive index
label externalBufPosition_;
public:
// Constructors

View File

@ -51,10 +51,31 @@ Foam::PstreamBuffers::PstreamBuffers
version_(version),
sendBuf_(UPstream::nProcs()),
recvBuf_(UPstream::nProcs()),
recvBufPos_(UPstream::nProcs(), 0),
finishedSendsCalled_(false)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::PstreamBuffers::~PstreamBuffers()
{
// Check that all data has been consumed.
forAll(recvBufPos_, procI)
{
if (recvBufPos_[procI] < recvBuf_[procI].size())
{
FatalErrorIn("PstreamBuffers::~PstreamBuffers()")
<< "Message from processor " << procI
<< " not fully consumed. messageSize:" << recvBuf_[procI].size()
<< " bytes of which only " << recvBufPos_[procI]
<< " consumed."
<< Foam::abort(FatalError);
}
}
}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
void Foam::PstreamBuffers::finishedSends(const bool block)

View File

@ -106,6 +106,9 @@ class PstreamBuffers
//- receive buffer
List<DynamicList<char> > recvBuf_;
//- read position in recvBuf_
labelList recvBufPos_;
bool finishedSendsCalled_;
// Private member functions
@ -129,6 +132,10 @@ public:
IOstream::versionNumber version=IOstream::currentVersion
);
// Destructor
~PstreamBuffers();
// Member functions

View File

@ -77,20 +77,6 @@ inline void Foam::UIPstream::readFromBuffer
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::UIPstream::~UIPstream()
{
if (externalBufPosition_ < messageSize_)
{
FatalErrorIn("UIPstream::~UIPstream()")
<< "Message not fully consumed. messageSize:" << messageSize_
<< " bytes of which only " << externalBufPosition_
<< " consumed." << Foam::abort(FatalError);
}
}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
Foam::Istream& Foam::UIPstream::read(token& t)

View File

@ -63,7 +63,7 @@ class UIPstream
DynamicList<char>& externalBuf_;
label externalBufPosition_;
label& externalBufPosition_;
const int tag_;
@ -94,6 +94,7 @@ public:
const commsTypes commsType,
const int fromProcNo,
DynamicList<char>& externalBuf,
label& externalBufPosition,
const int tag = UPstream::msgType(),
streamFormat format=BINARY,
versionNumber version=currentVersion
@ -103,11 +104,6 @@ public:
UIPstream(const int fromProcNo, PstreamBuffers&);
// Destructor
~UIPstream();
// Member functions
// Inquiry

View File

@ -121,11 +121,19 @@ public:
) = 0;
//- Initialise swap of patch point values
virtual void initSwapAdd(Field<Type>&) const
virtual void initSwapAddSeparated
(
const Pstream::commsTypes,
Field<Type>&
) const
{}
//- Complete swap of patch point values and add to local values
virtual void swapAdd(Field<Type>&) const = 0;
virtual void swapAddSeparated
(
const Pstream::commsTypes,
Field<Type>&
) const = 0;
};

View File

@ -122,7 +122,11 @@ cyclicPointPatchField<Type>::cyclicPointPatchField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void cyclicPointPatchField<Type>::swapAdd(Field<Type>& pField) const
void cyclicPointPatchField<Type>::swapAddSeparated
(
const Pstream::commsTypes,
Field<Type>& pField
) const
{
Field<Type> pf(this->patchInternalField(pField));
@ -145,7 +149,7 @@ void cyclicPointPatchField<Type>::swapAdd(Field<Type>& pField) const
}
}
addToInternalField(pField, pf);
addToInternalField(pField, pf, cyclicPatch_.separatedPoints());
}

View File

@ -159,7 +159,11 @@ public:
{}
//- Complete swap of patch point values and add to local values
virtual void swapAdd(Field<Type>&) const;
virtual void swapAddSeparated
(
const Pstream::commsTypes commsType,
Field<Type>&
) const;
};

View File

@ -96,16 +96,28 @@ processorPointPatchField<Type>::~processorPointPatchField()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void processorPointPatchField<Type>::initSwapAdd(Field<Type>& pField) const
void processorPointPatchField<Type>::initSwapAddSeparated
(
const Pstream::commsTypes commsType,
Field<Type>& pField
)
const
{
if (Pstream::parRun())
{
// Get internal field into my point order
Field<Type> pf(this->patchInternalField(pField));
// Get internal field into correct order for opposite side
Field<Type> pf
(
this->patchInternalField
(
pField,
procPatch_.reverseMeshPoints()
)
);
OPstream::write
(
Pstream::blocking,
commsType,
procPatch_.neighbProcNo(),
reinterpret_cast<const char*>(pf.begin()),
pf.byteSize()
@ -115,7 +127,11 @@ void processorPointPatchField<Type>::initSwapAdd(Field<Type>& pField) const
template<class Type>
void processorPointPatchField<Type>::swapAdd(Field<Type>& pField) const
void processorPointPatchField<Type>::swapAddSeparated
(
const Pstream::commsTypes commsType,
Field<Type>& pField
) const
{
if (Pstream::parRun())
{
@ -123,7 +139,7 @@ void processorPointPatchField<Type>::swapAdd(Field<Type>& pField) const
IPstream::read
(
Pstream::blocking,
commsType,
procPatch_.neighbProcNo(),
reinterpret_cast<char*>(pnf.begin()),
pnf.byteSize()
@ -140,22 +156,20 @@ void processorPointPatchField<Type>::swapAdd(Field<Type>& pField) const
}
else
{
const labelList& nonGlobalPatchPoints =
procPatch_.nonGlobalPatchPoints();
const labelListList& pointFaces = ppp.pointFaces();
forAll(nonGlobalPatchPoints, pfi)
forAll(pointFaces, pfi)
{
pnf[pfi] = transform
(
forwardT[pointFaces[nonGlobalPatchPoints[pfi]][0]],
forwardT[pointFaces[pfi][0]],
pnf[pfi]
);
}
}
}
addToInternalField(pField, pnf);
addToInternalField(pField, pnf, procPatch_.separatedPoints());
}
}

View File

@ -169,11 +169,19 @@ public:
)
{}
//- Initialise swap of patch point values
virtual void initSwapAdd(Field<Type>&) const;
//- Initialise swap of non-collocated patch point values
virtual void initSwapAddSeparated
(
const Pstream::commsTypes commsType,
Field<Type>&
) const;
//- Complete swap of patch point values and add to local values
virtual void swapAdd(Field<Type>&) const;
virtual void swapAddSeparated
(
const Pstream::commsTypes commsType,
Field<Type>&
) const;
};

View File

@ -1,169 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 "globalPointPatchField.H"
#include "PstreamCombineReduceOps.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * //
template<class Type>
globalPointPatchField<Type>::globalPointPatchField
(
const pointPatch& p,
const DimensionedField<Type, pointMesh>& iF
)
:
coupledPointPatchField<Type>(p, iF),
globalPointPatch_(refCast<const globalPointPatch>(p))
{}
template<class Type>
globalPointPatchField<Type>::globalPointPatchField
(
const pointPatch& p,
const DimensionedField<Type, pointMesh>& iF,
const dictionary& dict
)
:
coupledPointPatchField<Type>(p, iF, dict),
globalPointPatch_(refCast<const globalPointPatch>(p))
{
if (!isType<globalPointPatch>(p))
{
FatalIOErrorIn
(
"globalPointPatchField<Type>::globalPointPatchField\n"
"(\n"
" const pointPatch& p,\n"
" const Field<Type>& field,\n"
" const dictionary& dict\n"
")\n",
dict
) << "patch " << this->patch().index()
<< " not processorPoint type. "
<< "Patch type = " << p.type()
<< exit(FatalIOError);
}
}
template<class Type>
globalPointPatchField<Type>::globalPointPatchField
(
const globalPointPatchField<Type>& ptf,
const pointPatch& p,
const DimensionedField<Type, pointMesh>& iF,
const pointPatchFieldMapper& mapper
)
:
coupledPointPatchField<Type>(ptf, p, iF, mapper),
globalPointPatch_(refCast<const globalPointPatch>(ptf.patch()))
{
if (!isType<globalPointPatch>(this->patch()))
{
FatalErrorIn
(
"globalPointPatchField<Type>::globalPointPatchField\n"
"(\n"
" const globalPointPatchField<Type>& ptf,\n"
" const pointPatch& p,\n"
" const DimensionedField<Type, pointMesh>& iF,\n"
" const pointPatchFieldMapper& mapper\n"
")\n"
) << "Field type does not correspond to patch type for patch "
<< this->patch().index() << "." << endl
<< "Field type: " << typeName << endl
<< "Patch type: " << this->patch().type()
<< exit(FatalError);
}
}
template<class Type>
globalPointPatchField<Type>::globalPointPatchField
(
const globalPointPatchField<Type>& ptf,
const DimensionedField<Type, pointMesh>& iF
)
:
coupledPointPatchField<Type>(ptf, iF),
globalPointPatch_(refCast<const globalPointPatch>(ptf.patch()))
{}
// * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class Type>
globalPointPatchField<Type>::~globalPointPatchField()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
template<class Type>
void globalPointPatchField<Type>::swapAdd(Field<Type>& pField) const
{
// Create the global list and insert local values
if (globalPointPatch_.globalPointSize() > 0)
{
Field<Type> lpf = patchInternalField(pField);
const labelList& addr = globalPointPatch_.sharedPointAddr();
Field<Type> gpf
(
globalPointPatch_.globalPointSize(),
pTraits<Type>::zero
);
forAll(addr, i)
{
gpf[addr[i]] += lpf[i];
}
combineReduce(gpf, plusEqOp<Field<Type> >());
// Extract local data
forAll (addr, i)
{
lpf[i] = gpf[addr[i]];
}
setInInternalField(pField, lpf);
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -1,166 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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::globalPointPatchField
Description
Foam::globalPointPatchField
SourceFiles
globalPointPatchField.C
\*---------------------------------------------------------------------------*/
#ifndef globalPointPatchField_H
#define globalPointPatchField_H
#include "coupledPointPatchField.H"
#include "globalPointPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class globalPointPatchField Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class globalPointPatchField
:
public coupledPointPatchField<Type>
{
// Private data
//- Local reference to processorPoint patch
const globalPointPatch& globalPointPatch_;
public:
//- Runtime type information
TypeName("global");
// Constructors
//- Construct from patch and internal field
globalPointPatchField
(
const pointPatch&,
const DimensionedField<Type, pointMesh>&
);
//- Construct from patch, internal field and dictionary
globalPointPatchField
(
const pointPatch&,
const DimensionedField<Type, pointMesh>&,
const dictionary&
);
//- Construct by mapping given patchField<Type> onto a new patch
globalPointPatchField
(
const globalPointPatchField<Type>&,
const pointPatch&,
const DimensionedField<Type, pointMesh>&,
const pointPatchFieldMapper&
);
//- Construct and return a clone
virtual autoPtr<pointPatchField<Type> > clone() const
{
return autoPtr<pointPatchField<Type> >
(
new globalPointPatchField<Type>
(
*this
)
);
}
//- Construct as copy setting internal field reference
globalPointPatchField
(
const globalPointPatchField<Type>&,
const DimensionedField<Type, pointMesh>&
);
//- Construct and return a clone setting internal field reference
virtual autoPtr<pointPatchField<Type> > clone
(
const DimensionedField<Type, pointMesh>& iF
) const
{
return autoPtr<pointPatchField<Type> >
(
new globalPointPatchField
<Type>
(
*this,
iF
)
);
}
// Destructor
~globalPointPatchField();
// Member functions
// Evaluation functions
//- Evaluate the patch field
virtual void evaluate
(
const Pstream::commsTypes commsType=Pstream::blocking
)
{}
//- Complete swap of patch point values and add to local values
virtual void swapAdd(Field<Type>&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "globalPointPatchField.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -124,7 +124,8 @@ template<class Type>
template<class Type1>
tmp<Field<Type1> > pointPatchField<Type>::patchInternalField
(
const Field<Type1>& iF
const Field<Type1>& iF,
const labelList& meshPoints
) const
{
// Check size
@ -141,9 +142,6 @@ tmp<Field<Type1> > pointPatchField<Type>::patchInternalField
<< abort(FatalError);
}
// get addressing
const labelList& meshPoints = patch().meshPoints();
tmp<Field<Type1> > tvalues(new Field<Type1>(meshPoints.size()));
Field<Type1>& values = tvalues();
@ -156,6 +154,17 @@ tmp<Field<Type1> > pointPatchField<Type>::patchInternalField
}
template<class Type>
template<class Type1>
tmp<Field<Type1> > pointPatchField<Type>::patchInternalField
(
const Field<Type1>& iF
) const
{
return patchInternalField(iF, patch().meshPoints());
}
template<class Type>
template<class Type1>
void pointPatchField<Type>::addToInternalField
@ -201,6 +210,53 @@ void pointPatchField<Type>::addToInternalField
}
template<class Type>
template<class Type1>
void pointPatchField<Type>::addToInternalField
(
Field<Type1>& iF,
const Field<Type1>& pF,
const labelList& points
) const
{
// Check size
if (iF.size() != internalField().size())
{
FatalErrorIn
(
"void pointPatchField<Type>::"
"addToInternalField("
"Field<Type1>& iF, const Field<Type1>& iF, const labelList&) const"
) << "given internal field does not correspond to the mesh. "
<< "Field size: " << iF.size()
<< " mesh size: " << internalField().size()
<< abort(FatalError);
}
if (pF.size() != size())
{
FatalErrorIn
(
"void pointPatchField<Type>::"
"addToInternalField("
"Field<Type1>& iF, const Field<Type1>& iF, const labelList&) const"
) << "given patch field does not correspond to the mesh. "
<< "Field size: " << pF.size()
<< " mesh size: " << size()
<< abort(FatalError);
}
// Get the addressing
const labelList& mp = patch().meshPoints();
forAll(points, i)
{
label pointI = points[i];
iF[mp[pointI]] += pF[pointI];
}
}
template<class Type>
template<class Type1>
void pointPatchField<Type>::setInInternalField

View File

@ -291,6 +291,15 @@ public:
const Field<Type1>& iF
) const;
//- Return field created from selected internal field values
// given internal field reference
template<class Type1>
tmp<Field<Type1> > patchInternalField
(
const Field<Type1>& iF,
const labelList& meshPoints
) const;
//- Given the internal field and a patch field,
// add the patch field to the internal field
template<class Type1>
@ -300,6 +309,16 @@ public:
const Field<Type1>& pF
) const;
//- Given the internal field and a patch field,
// add selected elements of the patch field to the internal field
template<class Type1>
void addToInternalField
(
Field<Type1>& iF,
const Field<Type1>& pF,
const labelList& points
) const;
//- Given the internal field and a patch field,
// set the patch field in the internal field
template<class Type1>

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -251,7 +251,7 @@ bool Foam::argList::regroupArgv(int& argc, char**& argv)
// note: we also re-write directly into args_
// and use a second pass to sort out args/options
for (int argI = 0; argI < argc; argI++)
for (int argI = 0; argI < argc; ++argI)
{
if (strcmp(argv[argI], "(") == 0)
{
@ -369,7 +369,7 @@ Foam::argList::argList
{
// Check if this run is a parallel run by searching for any parallel option
// If found call runPar which might filter argv
for (int argI = 0; argI < argc; argI++)
for (int argI = 0; argI < argc; ++argI)
{
if (argv[argI][0] == '-')
{
@ -395,7 +395,7 @@ Foam::argList::argList
int nArgs = 1;
string argListString = args_[0];
for (int argI = 1; argI < args_.size(); argI++)
for (int argI = 1; argI < args_.size(); ++argI)
{
argListString += ' ';
argListString += args_[argI];
@ -751,12 +751,6 @@ Foam::argList::~argList()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::stringList::subList Foam::argList::additionalArgs() const
{
return stringList::subList(args_, args_.size() - 1, 1);
}
void Foam::argList::printUsage() const
{
Info<< "\nUsage: " << executable_ << " [OPTIONS]";

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -193,7 +193,7 @@ public:
// Access
//- Name of executable
//- Name of executable without the path
inline const word& executable() const;
//- Return root path
@ -211,9 +211,25 @@ public:
//- Return arguments
inline const stringList& args() const;
//- Return additional arguments,
// i.e. those additional to the executable itself
stringList::subList additionalArgs() const;
//- Return the argument corresponding to index.
inline const string& arg(const label index) const;
//- Return the number of arguments
inline label size() const;
//- Read a value from the argument at index.
// Index 0 corresponds to the name of the executable.
// Index 1 corresponds to the first argument.
template<class T>
inline T argRead(const label index) const;
//- Return arguments that are additional to the executable
// @deprecated use operator[] directly (deprecated Feb 2010)
stringList::subList additionalArgs() const
{
return stringList::subList(args_, args_.size()-1, 1);
}
//- Return options
inline const Foam::HashTable<string>& options() const;
@ -264,6 +280,14 @@ public:
}
//- Return the argument corresponding to index.
// Index 0 corresponds to the name of the executable.
// Index 1 corresponds to the first argument.
inline const string& operator[](const label index) const;
//- Return the argument string associated with the named option
// @sa option()
inline const string& operator[](const word& opt) const;
// Edit

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -64,6 +64,18 @@ inline const Foam::stringList& Foam::argList::args() const
}
inline const Foam::string& Foam::argList::arg(const label index) const
{
return args_[index];
}
inline Foam::label Foam::argList::size() const
{
return args_.size();
}
inline const Foam::HashTable<Foam::string>& Foam::argList::options() const
{
return options_;
@ -72,7 +84,7 @@ inline const Foam::HashTable<Foam::string>& Foam::argList::options() const
inline const Foam::string& Foam::argList::option(const word& opt) const
{
return options_.operator[](opt);
return options_[opt];
}
@ -84,7 +96,7 @@ inline bool Foam::argList::optionFound(const word& opt) const
inline Foam::IStringStream Foam::argList::optionLookup(const word& opt) const
{
return IStringStream(option(opt));
return IStringStream(options_[opt]);
}
@ -92,12 +104,36 @@ inline Foam::IStringStream Foam::argList::optionLookup(const word& opt) const
namespace Foam
{
// Template specialization for string
template<>
inline Foam::string
Foam::argList::argRead<Foam::string>(const label index) const
{
return args_[index];
}
// Template specialization for word
template<>
inline Foam::word
Foam::argList::argRead<Foam::word>(const label index) const
{
return args_[index];
}
// Template specialization for fileName
template<>
inline Foam::fileName
Foam::argList::argRead<Foam::fileName>(const label index) const
{
return args_[index];
}
// Template specialization for string
template<>
inline Foam::string
Foam::argList::optionRead<Foam::string>(const word& opt) const
{
return option(opt);
return options_[opt];
}
// Template specialization for word
@ -105,7 +141,7 @@ namespace Foam
inline Foam::word
Foam::argList::optionRead<Foam::word>(const word& opt) const
{
return option(opt);
return options_[opt];
}
// Template specialization for fileName
@ -113,13 +149,23 @@ namespace Foam
inline Foam::fileName
Foam::argList::optionRead<Foam::fileName>(const word& opt) const
{
return option(opt);
return options_[opt];
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class T>
inline T Foam::argList::argRead(const label index) const
{
T val;
IStringStream(args_[index])() >> val;
return val;
}
template<class T>
inline T Foam::argList::optionRead(const word& opt) const
{
@ -187,4 +233,18 @@ inline T Foam::argList::optionLookupOrDefault
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
inline const Foam::string& Foam::argList::operator[](const label index) const
{
return args_[index];
}
inline const Foam::string& Foam::argList::operator[](const word& opt) const
{
return options_[opt];
}
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -44,6 +44,40 @@ Description
SourceFiles
global.Cver
@mainpage OpenFOAM&reg;: open source CFD
@section about About OpenFOAM
OpenFOAM is a free, open source CFD software package produced by
a commercial company,
<a href="http://www.openfoam.com/about">OpenCFD Ltd</a>.
It has a
large user base across most areas of engineering and science,
from both commercial and academic organisations. OpenFOAM has an
extensive range of features to solve anything from complex fluid
flows involving chemical reactions, turbulence and heat transfer,
to solid dynamics and electromagnetics.
<a href="http://www.openfoam.com/features">More ...</a>
@section users Our commitment to the users
OpenFOAM comes with full commercial support from OpenCFD, including
<a href="http://www.openfoam.com/support/software.php">software support</a>,
<a href="http://www.openfoam.com/support/development.php">contracted developments</a> and
a programme of <a href="http://www.openfoam.com/training">training courses</a>.
These activities fund the development, maintenance and release of
OpenFOAM to make it an extremely viable commercial open source product.
@section opensource Our commitment to open source
OpenCFD is committed to open source software, continually developing and
maintaining OpenFOAM under the
<a href="http://www.gnu.org/copyleft/gpl.html">GNU General Public Licence</a>.
OpenFOAM will <strong>always</strong> be free of charge and open source.
In addition, we endeavour to support other viable open source initiatives
that will benefit science and engineering.
\*---------------------------------------------------------------------------*/
#ifndef foamVersion_H

View File

@ -0,0 +1,10 @@
//
// addOverwriteOption.H
// ~~~~~~~~~~~~~~~~~~~~
Foam::argList::addOption
(
"overwrite",
"overwrite existing mesh/results files"
);

View File

@ -39,6 +39,7 @@ SourceFiles
#include "labelField.H"
#include "typeInfo.H"
#include "Pstream.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -39,6 +39,7 @@ SourceFiles
#include "lduInterface.H"
#include "primitiveFieldsFwd.H"
#include "Pstream.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -32,7 +32,7 @@ Description
Deprecated
This solver is present for backward-compatibility and the PBiCG solver
should be used instead.
should be used instead. (deprecated Apr 2008)
SourceFiles
BICCG.C

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -32,7 +32,7 @@ Description
Deprecated
This solver is present for backward-compatibility and the PCG solver
should be used for preference.
should be used for preference. (deprecated Apr 2008)
SourceFiles
ICCG.C

View File

@ -27,7 +27,7 @@ License
#include "pointBoundaryMesh.H"
#include "polyBoundaryMesh.H"
#include "facePointPatch.H"
#include "globalPointPatch.H"
#include "pointMesh.H"
#include "PstreamBuffers.H"
#include "lduSchedule.H"
#include "globalMeshData.H"
@ -105,31 +105,6 @@ void Foam::pointBoundaryMesh::calcGeometry()
}
const Foam::globalPointPatch&
Foam::pointBoundaryMesh::globalPatch() const
{
const pointPatchList& patches = *this;
forAll (patches, patchI)
{
if (isType<globalPointPatch>(patches[patchI]))
{
return refCast<const globalPointPatch>(patches[patchI]);
}
}
FatalErrorIn
(
"const pointBoundaryMesh::"
"globalPointPatch& globalPatch() const"
) << "patch not found."
<< abort(FatalError);
// Dummy return
return refCast<const globalPointPatch>(patches[0]);
}
void Foam::pointBoundaryMesh::movePoints(const pointField& p)
{
PstreamBuffers pBufs(Pstream::defaultCommsType);

View File

@ -46,7 +46,6 @@ namespace Foam
// Forward declaration of classes
class pointMesh;
class polyBoundaryMesh;
class globalPointPatch;
/*---------------------------------------------------------------------------*\
Class pointBoundaryMesh Declaration
@ -98,9 +97,6 @@ public:
return mesh_;
}
//- Return reference to globalPointPatch
const globalPointPatch& globalPatch() const;
//- Correct polyBoundaryMesh after moving points
void movePoints(const pointField&);

View File

@ -26,7 +26,6 @@ License
#include "pointMesh.H"
#include "globalMeshData.H"
#include "globalPointPatch.H"
#include "pointMeshMapper.H"
#include "pointFields.H"
#include "MapGeometricFields.H"
@ -56,36 +55,12 @@ void Foam::pointMesh::mapFields(const mapPolyMesh& mpm)
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::pointMesh::pointMesh
(
const polyMesh& pMesh,
bool alwaysConstructGlobalPatch
)
Foam::pointMesh::pointMesh(const polyMesh& pMesh)
:
MeshObject<polyMesh, pointMesh>(pMesh),
GeoMesh<polyMesh>(pMesh),
boundary_(*this, pMesh.boundaryMesh())
{
// Add the globalPointPatch if there are global points
if
(
alwaysConstructGlobalPatch
|| GeoMesh<polyMesh>::mesh_.globalData().nGlobalPoints()
)
{
boundary_.setSize(boundary_.size() + 1);
boundary_.set
(
boundary_.size() - 1,
new globalPointPatch
(
boundary_,
boundary_.size() - 1
)
);
}
// Calculate the geometry for the patches (transformation tensors etc.)
boundary_.calcGeometry();
}

View File

@ -79,11 +79,7 @@ public:
// Constructors
//- Construct from polyMesh
explicit pointMesh
(
const polyMesh& pMesh,
bool alwaysConstructGlobalPatch = false
);
explicit pointMesh(const polyMesh& pMesh);
// Member Functions

View File

@ -26,7 +26,8 @@ Class
Foam::genericPointPatch
Description
DirectMapped patch.
Substitute for unknown patches. Used for postprocessing when only
basic polyPatch info is needed.
SourceFiles
genericPointPatch.C

View File

@ -28,7 +28,6 @@ License
#include "pointBoundaryMesh.H"
#include "addToRunTimeSelectionTable.H"
#include "pointMesh.H"
#include "globalPointPatch.H"
#include "edgeList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -51,9 +50,7 @@ addToRunTimeSelectionTable
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
void Foam::cyclicPointPatch::initGeometry(PstreamBuffers&)
{
transformPairs_.setSize(0);
}
{}
void Foam::cyclicPointPatch::calcGeometry(PstreamBuffers&)
@ -61,94 +58,22 @@ void Foam::cyclicPointPatch::calcGeometry(PstreamBuffers&)
const edgeList& cp = cyclicPolyPatch_.coupledPoints();
const labelList& mp = cyclicPolyPatch_.meshPoints();
// If there are no global points create a 1->1 map
if (!boundaryMesh().mesh().globalData().nGlobalPoints())
DynamicList<label> separated;
forAll(cp, i)
{
nonGlobalPatchPoints_.setSize(mp.size());
forAll(nonGlobalPatchPoints_, i)
{
nonGlobalPatchPoints_[i] = i;
}
const edge& coupledSet = cp[i];
meshPoints_ = cyclicPolyPatch_.meshPoints();
transformPairs_ = cp;
// Assume all points are separated.
separated.append(coupledSet[0]);
separated.append(coupledSet[1]);
}
else
separatedPoints_.transfer(separated);
if (debug)
{
// Get reference to shared points
const labelList& sharedPoints =
boundaryMesh().globalPatch().meshPoints();
nonGlobalPatchPoints_.setSize(mp.size());
meshPoints_.setSize(mp.size());
labelList pointMap(mp.size(), -1);
label noFiltPoints = 0;
forAll (mp, pointI)
{
label curP = mp[pointI];
bool found = false;
forAll (sharedPoints, sharedI)
{
if (sharedPoints[sharedI] == curP)
{
found = true;
break;
}
}
if (!found)
{
pointMap[pointI] = noFiltPoints;
nonGlobalPatchPoints_[noFiltPoints] = pointI;
meshPoints_[noFiltPoints] = curP;
noFiltPoints++;
}
}
nonGlobalPatchPoints_.setSize(noFiltPoints);
meshPoints_.setSize(noFiltPoints);
transformPairs_.setSize(cp.size());
label noFiltPointPairs = 0;
forAll(cp, i)
{
if (pointMap[cp[i][0]] != -1 && pointMap[cp[i][1]] != -1)
{
transformPairs_[noFiltPointPairs][0] = pointMap[cp[i][0]];
transformPairs_[noFiltPointPairs][1] = pointMap[cp[i][1]];
noFiltPointPairs++;
}
else if (pointMap[cp[i][0]] == -1 && pointMap[cp[i][1]] != -1)
{
FatalErrorIn
(
"cyclicPointPatch::calcGeometry(PstreamBuffers&) const"
) << "Point " << cp[i][0] << "of point-pair " << i
<< " is a global point but the other point "
<< cp[i][1] << " is not"
<< exit(FatalError);
}
else if (pointMap[cp[i][0]] != -1 && pointMap[cp[i][1]] == -1)
{
FatalErrorIn
(
"cyclicPointPatch::calcGeometry(PstreamBuffers&) const"
) << "Point " << cp[i][1] << "of point-pair " << i
<< " is a global point but the other point "
<< cp[i][0] << " is not"
<< exit(FatalError);
}
}
transformPairs_.setSize(noFiltPointPairs);
Pout<< "cyclic:" << cyclicPolyPatch_.name()
<< " separated:" << separatedPoints_.size()
<< " out of points:" << mp.size() << endl;
}
}
@ -198,7 +123,13 @@ cyclicPointPatch::~cyclicPointPatch()
const edgeList& cyclicPointPatch::transformPairs() const
{
return transformPairs_;
return cyclicPolyPatch_.coupledPoints();
}
const labelList& cyclicPointPatch::separatedPoints() const
{
return separatedPoints_;
}

View File

@ -57,6 +57,8 @@ class cyclicPointPatch
//- Local reference cast into the cyclic patch
const cyclicPolyPatch& cyclicPolyPatch_;
//- List of local points that are not collocated
mutable labelList separatedPoints_;
// Private Member Functions
@ -69,10 +71,6 @@ class cyclicPointPatch
// Demand driven private data
//- The set of pairs of points that require transformation
// and/or mapping
edgeList transformPairs_;
//- Initialise the calculation of the patch geometry
virtual void initGeometry(PstreamBuffers&);
@ -147,6 +145,9 @@ public:
//- Return the set of pairs of points that require transformation
// and/or mapping
virtual const edgeList& transformPairs() const;
//- List of separated coupled points
virtual const labelList& separatedPoints() const;
};

View File

@ -28,7 +28,6 @@ License
#include "pointBoundaryMesh.H"
#include "addToRunTimeSelectionTable.H"
#include "pointMesh.H"
#include "globalPointPatch.H"
#include "faceList.H"
#include "primitiveFacePatch.H"
#include "emptyPolyPatch.H"
@ -58,34 +57,22 @@ void Foam::processorPointPatch::initGeometry(PstreamBuffers& pBufs)
// Depending on whether the patch is a master or a slave, get the primitive
// patch points and filter away the points from the global patch.
if (isMaster())
// Create the reversed patch and pick up its points
// so that the order is correct
const polyPatch& pp = patch();
faceList masterFaces(pp.size());
forAll (pp, faceI)
{
meshPoints_ = procPolyPatch_.meshPoints();
}
else
{
// Slave side. Create the reversed patch and pick up its points
// so that the order is correct
const polyPatch& pp = patch();
faceList masterFaces(pp.size());
forAll (pp, faceI)
{
masterFaces[faceI] = pp[faceI].reverseFace();
}
meshPoints_ = primitiveFacePatch
(
masterFaces,
pp.points()
).meshPoints();
masterFaces[faceI] = pp[faceI].reverseFace();
}
if (Pstream::parRun())
{
initPatchPatchPoints(pBufs);
}
reverseMeshPoints_ = primitiveFacePatch
(
masterFaces,
pp.points()
).meshPoints();
}
@ -93,261 +80,46 @@ void Foam::processorPointPatch::calcGeometry(PstreamBuffers& pBufs)
{
if (Pstream::parRun())
{
calcPatchPatchPoints(pBufs);
}
const boolList& collocated = procPolyPatch_.collocated();
// If it is not runing parallel or there are no global points
// create a 1->1 map
if
(
!Pstream::parRun()
|| !boundaryMesh().mesh().globalData().nGlobalPoints()
)
{
nonGlobalPatchPoints_.setSize(meshPoints_.size());
forAll(nonGlobalPatchPoints_, i)
if (collocated.size() == 0)
{
nonGlobalPatchPoints_[i] = i;
separatedPoints_.setSize(0);
}
}
else
{
// Get reference to shared points
const labelList& sharedPoints =
boundaryMesh().globalPatch().meshPoints();
nonGlobalPatchPoints_.setSize(meshPoints_.size());
label noFiltPoints = 0;
forAll (meshPoints_, pointI)
else if (collocated.size() == 1)
{
label curP = meshPoints_[pointI];
bool found = false;
forAll (sharedPoints, sharedI)
// Uniformly
if (collocated[0])
{
if (sharedPoints[sharedI] == curP)
separatedPoints_.setSize(0);
}
else
{
separatedPoints_ = identity(size());
}
}
else
{
// Per face collocated or not.
const labelListList& pointFaces = procPolyPatch_.pointFaces();
DynamicList<label> separated;
forAll(pointFaces, pfi)
{
if (!collocated[pointFaces[pfi][0]])
{
found = true;
break;
separated.append(pfi);
}
}
if (!found)
{
nonGlobalPatchPoints_[noFiltPoints] = pointI;
meshPoints_[noFiltPoints] = curP;
noFiltPoints++;
}
}
nonGlobalPatchPoints_.setSize(noFiltPoints);
meshPoints_.setSize(noFiltPoints);
}
}
void processorPointPatch::initPatchPatchPoints(PstreamBuffers& pBufs)
{
if (debug)
{
Info<< "processorPointPatch::initPatchPatchPoints(PstreamBuffers&) : "
<< "constructing patch-patch points"
<< endl;
}
const polyBoundaryMesh& bm = boundaryMesh().mesh()().boundaryMesh();
// Get the mesh points for this patch corresponding to the faces
const labelList& ppmp = meshPoints();
// Create a HashSet of the point labels for this patch
Map<label> patchPointSet(2*ppmp.size());
forAll (ppmp, ppi)
{
patchPointSet.insert(ppmp[ppi], ppi);
}
// Create the lists of patch-patch points
labelListList patchPatchPoints(bm.size());
// Create the lists of patch-patch point normals
List<List<vector> > patchPatchPointNormals(bm.size());
// Loop over all patches looking for other patches that share points
forAll(bm, patchi)
{
if
(
patchi != index() // Ignore self-self
&& !isA<emptyPolyPatch>(bm[patchi]) // Ignore empty
&& !bm[patchi].coupled() // Ignore other couples
)
{
// Get the meshPoints for the other patch
const labelList& meshPoints = bm[patchi].meshPoints();
// Get the normals for the other patch
const vectorField& normals = bm[patchi].pointNormals();
label pppi = 0;
forAll(meshPoints, pointi)
{
label ppp = meshPoints[pointi];
// Check to see if the point of the other patch is shared with
// this patch
Map<label>::iterator iter = patchPointSet.find(ppp);
if (iter != patchPointSet.end())
{
// If it is shared initialise the patchPatchPoints for this
// patch
if (!patchPatchPoints[patchi].size())
{
patchPatchPoints[patchi].setSize(ppmp.size());
patchPatchPointNormals[patchi].setSize(ppmp.size());
}
// and add the entry
patchPatchPoints[patchi][pppi] = iter();
patchPatchPointNormals[patchi][pppi] = normals[pointi];
pppi++;
}
}
// Resise the list of shared points and normals for the patch
// being considerd
patchPatchPoints[patchi].setSize(pppi);
patchPatchPointNormals[patchi].setSize(pppi);
separatedPoints_.transfer(separated);
}
}
// Send the patchPatchPoints to the neighbouring processor
UOPstream toNeighbProc(neighbProcNo(), pBufs);
toNeighbProc
<< ppmp.size() // number of points for checking
<< patchPatchPoints
<< patchPatchPointNormals;
if (debug)
{
Info<< "processorPointPatch::initPatchPatchPoints() : "
<< "constructed patch-patch points"
<< endl;
}
}
void Foam::processorPointPatch::calcPatchPatchPoints(PstreamBuffers& pBufs)
{
// Get the patchPatchPoints from the neighbouring processor
UIPstream fromNeighbProc(neighbProcNo(), pBufs);
label nbrNPoints(readLabel(fromNeighbProc));
labelListList patchPatchPoints(fromNeighbProc);
List<List<vector> > patchPatchPointNormals(fromNeighbProc);
pointBoundaryMesh& pbm = const_cast<pointBoundaryMesh&>(boundaryMesh());
const labelList& ppmp = meshPoints();
// Simple check for the very rare situation when not the same number
// of points on both sides. This can happen with decomposed cyclics.
// If on one side the cyclic shares a point with proc faces coming from
// internal faces it will have a different number of points from
// the situation where the cyclic and the 'normal' proc faces are fully
// separate.
if (nbrNPoints != ppmp.size())
{
WarningIn("processorPointPatch::calcPatchPatchPoints(PstreamBuffers&)")
<< "Processor patch " << name()
<< " has " << ppmp.size() << " points; coupled patch has "
<< nbrNPoints << " points." << endl
<< " (usually due to decomposed cyclics)."
<< " This might give problems" << endl
<< " when using point fields (interpolation, mesh motion)."
<< endl;
}
// Loop over the patches looking for other patches that share points
forAll(patchPatchPoints, patchi)
{
const labelList& patchPoints = patchPatchPoints[patchi];
const List<vector>& patchPointNormals = patchPatchPointNormals[patchi];
// If there are potentially shared points for the patch being considered
if (patchPoints.size())
{
// Get the current meshPoints list for the patch
facePointPatch& fpp = refCast<facePointPatch>(pbm[patchi]);
const labelList& fmp = fpp.meshPoints();
labelList& mp = fpp.meshPoints_;
const vectorField& fnormals = fpp.pointNormals();
vectorField& normals = fpp.pointNormals_;
// Create a HashSet of the point labels for the patch
Map<label> patchPointSet(2*fmp.size());
forAll (fmp, ppi)
{
patchPointSet.insert(fmp[ppi], ppi);
}
label nPoints = mp.size();
label lpi = 0;
bool resized = false;
// For each potentially shared point...
forAll(patchPoints, ppi)
{
// Check if it is not already in the patch,
// i.e. not part of a face of the patch
if (!patchPointSet.found(ppmp[patchPoints[ppi]]))
{
// If it isn't already in the patch check if the local
// meshPoints is already set and if not initialise the
// meshPoints_ and pointNormals_
if (!resized)
{
if (!mp.size() && fmp.size())
{
mp = fmp;
normals = fnormals;
nPoints = mp.size();
}
mp.setSize(nPoints + patchPoints.size());
loneMeshPoints_.setSize(patchPoints.size());
normals.setSize(nPoints + patchPoints.size());
resized = true;
}
// Add the new point to the patch
mp[nPoints] = ppmp[patchPoints[ppi]];
loneMeshPoints_[lpi++] = ppmp[patchPoints[ppi]];
normals[nPoints++] = patchPointNormals[ppi];
}
}
// If the lists have been resized points have been added.
// Shrink the lists to the current size.
if (resized)
{
mp.setSize(nPoints);
loneMeshPoints_.setSize(lpi);
normals.setSize(nPoints);
}
}
Pout<< "processor:" << name()
<< " separated:" << separatedPoints_.size()
<< " out of points:" << size() << endl;
}
}
@ -393,6 +165,20 @@ processorPointPatch::~processorPointPatch()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const labelList& processorPointPatch::reverseMeshPoints() const
{
return reverseMeshPoints_;
}
const labelList& processorPointPatch::separatedPoints() const
{
return separatedPoints_;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam

View File

@ -64,6 +64,9 @@ class processorPointPatch
const processorPolyPatch& procPolyPatch_;
mutable labelList reverseMeshPoints_;
mutable labelList separatedPoints_;
// Private Member Functions
@ -73,14 +76,6 @@ class processorPointPatch
//- Calculate the patch geometry
virtual void calcGeometry(PstreamBuffers&);
//- Initialise the points on this patch which are should also be
// on a neighbouring patch but are not part of faces of that patch
void initPatchPatchPoints(PstreamBuffers&);
//- Calculate the points on this patch which are should also be
// on a neighbouring patch but are not part of faces of that patch
void calcPatchPatchPoints(PstreamBuffers&);
//- Initialise the patches for moving points
virtual void initMovePoints(PstreamBuffers&, const pointField&);
@ -165,6 +160,13 @@ public:
{
return procPolyPatch_;
}
//- Return mesh points in the correct order for the receiving side
const labelList& reverseMeshPoints() const;
//- List of separated coupled points
virtual const labelList& separatedPoints() const;
};

View File

@ -57,25 +57,6 @@ coupledFacePointPatch::~coupledFacePointPatch()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const labelList& coupledFacePointPatch::nonGlobalPatchPoints() const
{
return nonGlobalPatchPoints_;
}
const labelList& coupledFacePointPatch::loneMeshPoints() const
{
return loneMeshPoints_;
}
const vectorField& coupledFacePointPatch::pointNormals() const
{
notImplemented("coupledFacePointPatch::pointNormals() const");
return Field<vector>::null();
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam

View File

@ -73,16 +73,6 @@ class coupledFacePointPatch
protected:
// Demand driven private data
//- The set of labels of the pointPatch points which are
// non-global, i.e. present only in this coupledPointPatch.
// MUST be initialised by calcGeometry()!
labelList nonGlobalPatchPoints_;
labelList loneMeshPoints_;
// Construction of demand-driven data
//- Calculate mesh points
@ -120,20 +110,8 @@ public:
return true;
}
// Access functions for demand driven data
//- Return the set of labels of the pointPatch points which are
// non-global, i.e. present in this coupledFacePointPatch
virtual const labelList& nonGlobalPatchPoints() const;
//- Return the set of labels of the pointPatch points which are
// lone, i.e. present in this coupledFacePointPatch but not
// associated with any faces
virtual const labelList& loneMeshPoints() const;
//- Return point unit normals. Not implemented.
virtual const vectorField& pointNormals() const;
//- List of separated coupled points
virtual const labelList& separatedPoints() const = 0;
};

View File

@ -1,209 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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::globalPointPatch
Description
Foam::globalPointPatch
SourceFiles
globalPointPatch.C
\*---------------------------------------------------------------------------*/
#ifndef globalPointPatch_H
#define globalPointPatch_H
#include "pointPatch.H"
#include "coupledPointPatch.H"
#include "globalMeshData.H"
#include "pointMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class globalPointPatch Declaration
\*---------------------------------------------------------------------------*/
class globalPointPatch
:
public pointPatch,
public coupledPointPatch
{
// Private data
// //- Reference to the basic globalMeshData
// const globalMeshData& globalMeshData_;
//- Index in the boundary mesh
label index_;
// Protected Member Functions
//- Initialise the calculation of the patch geometry
virtual void initGeometry(PstreamBuffers&)
{}
//- Calculate the patch geometry
virtual void calcGeometry(PstreamBuffers&)
{}
//- Initialise the patches for moving points
virtual void initMovePoints(PstreamBuffers&, const pointField&)
{}
//- Correct patches after moving points
virtual void movePoints(PstreamBuffers&, const pointField&)
{}
//- Initialise the update of the patch topology
virtual void initUpdateMesh(PstreamBuffers&)
{}
//- Update of the patch topology
virtual void updateMesh(PstreamBuffers&)
{}
// Private Member Functions
//- Disallow default construct as copy
globalPointPatch
(
const globalPointPatch&
);
//- Disallow default assignment
void operator=(const globalPointPatch&);
public:
//- Runtime type information
TypeName("global");
// Constructors
//- Construct from components
globalPointPatch
(
const pointBoundaryMesh&,
const label index
);
// Destructor
virtual ~globalPointPatch();
// Member functions
//- Return name
virtual const word& name() const
{
// There can only be a single patch of this type - therefore
// its name is hard-coded.
return type();
}
//- Return size
virtual label size() const
{
return meshPoints().size();
}
//- Return true if running parallel
virtual bool coupled() const
{
if (Pstream::parRun())
{
return true;
}
else
{
return false;
}
}
//- Return number of faces
virtual label nFaces() const
{
return 0;
}
//- Return the index of this patch in the pointBoundaryMesh
virtual label index() const
{
return index_;
}
//- Return mesh points
virtual const labelList& meshPoints() const
{
return boundaryMesh().mesh().globalData().sharedPointLabels();
}
//- Return local points. Not implemented
virtual const pointField& localPoints() const
{
notImplemented("globalPointPatch::localPoints() const");
return pointField::null();
}
//- Return point normals. Not implemented
virtual const vectorField& pointNormals() const
{
notImplemented("globalPointPatch::pointNormals() const");
return vectorField::null();
}
//- Return total number of shared points
virtual label globalPointSize() const
{
return boundaryMesh().mesh().globalData().nGlobalPoints();
}
//- Return addressing into the global points list
const labelList& sharedPointAddr() const
{
return boundaryMesh().mesh().globalData().sharedPointAddr();
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -52,11 +52,7 @@ addToRunTimeSelectionTable
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
void facePointPatch::initGeometry(PstreamBuffers&)
{
meshPoints_.setSize(0);
localPoints_.setSize(0);
pointNormals_.setSize(0);
}
{}
void facePointPatch::calcGeometry(PstreamBuffers&)
@ -94,60 +90,6 @@ facePointPatch::facePointPatch
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const labelList& facePointPatch::meshPoints() const
{
if (meshPoints_.size())
{
return meshPoints_;
}
else
{
return polyPatch_.meshPoints();
}
}
const pointField& facePointPatch::localPoints() const
{
if (meshPoints_.size())
{
if (localPoints_.size() != meshPoints_.size())
{
const labelList& meshPts = meshPoints();
localPoints_.setSize(meshPts.size());
const pointField& points = polyPatch_.points();
forAll (meshPts, pointi)
{
localPoints_[pointi] = points[meshPts[pointi]];
}
}
return localPoints_;
}
else
{
return polyPatch_.localPoints();
}
}
const vectorField& facePointPatch::pointNormals() const
{
if (pointNormals_.size())
{
return pointNormals_;
}
else
{
return polyPatch_.pointNormals();
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam

View File

@ -30,7 +30,6 @@ Description
SourceFiles
facePointPatch.C
facePointPatchM.C
newPointPatch.C
\*---------------------------------------------------------------------------*/
@ -65,13 +64,6 @@ protected:
//- Reference to the underlying polyPatch
const polyPatch& polyPatch_;
// Optional data used if the pointPatch has points not associated
// with faces, i.e. not accessible via polyPatch
mutable labelList meshPoints_;
mutable pointField localPoints_;
mutable vectorField pointNormals_;
// Protected Member Functions
@ -182,13 +174,24 @@ public:
}
//- Return mesh points
virtual const labelList& meshPoints() const;
virtual const labelList& meshPoints() const
{
return polyPatch_.meshPoints();
}
//- Return pointField of points in patch
virtual const pointField& localPoints() const;
virtual const pointField& localPoints() const
{
return polyPatch_.localPoints();
}
//- Return point unit normals
virtual const vectorField& pointNormals() const;
virtual const vectorField& pointNormals() const
{
return polyPatch_.pointNormals();
}
};

View File

@ -1705,7 +1705,7 @@ Foam::autoPtr<Foam::globalIndex> Foam::globalMeshData::mergePoints
const labelList& meshPoints,
const Map<label>& meshPointMap,
labelList& pointToGlobal,
labelList& uniquePoints
labelList& uniqueMeshPoints
) const
{
const indirectPrimitivePatch& cpp = coupledPatch();
@ -1713,125 +1713,175 @@ Foam::autoPtr<Foam::globalIndex> Foam::globalMeshData::mergePoints
const mapDistribute& pointSlavesMap = globalPointSlavesMap();
// 1. Count number of masters on my processor.
label nCoupledMaster = 0;
label nCoupledSlave = 0;
PackedBoolList isMaster(meshPoints.size(), 1);
// The patch points come in two variants:
// - not on a coupled patch so guaranteed unique
// - on a coupled patch
// If the point is on a coupled patch the problem is that the
// master-slave structure (globalPointSlaves etc.) assigns one of the
// coupled points to be the master but this master point is not
// necessarily on the patch itself! (it might just be connected to the
// patch point via coupled patches).
// So this means that all master point loops should be over the
// master-slave structure, not over the patch points and that the unique
// point returned is a mesh point.
// (unless we want to do the whole master-slave analysis again for the
// current patch only).
forAll(meshPoints, localPointI)
// Determine mapping from coupled point to patch point and vice versa
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
labelList patchToCoupled(meshPoints.size(), -1);
label nCoupled = 0;
labelList coupledToPatch(pointSlavesMap.constructSize(), -1);
// Note: loop over patch since usually smaller
forAll(meshPoints, patchPointI)
{
label meshPointI = meshPoints[localPointI];
label meshPointI = meshPoints[patchPointI];
Map<label>::const_iterator iter = cpp.meshPointMap().find(meshPointI);
if (iter != cpp.meshPointMap().end())
{
// My localPointI is a coupled point.
patchToCoupled[patchPointI] = iter();
coupledToPatch[iter()] = patchPointI;
nCoupled++;
}
}
label coupledPointI = iter();
//Pout<< "Patch:" << nl
// << " points:" << meshPoints.size() << nl
// << " of which on coupled patch:" << nCoupled << endl;
if (pointSlaves[coupledPointI].size() > 0)
// Pull coupled-to-patch information to master
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pointSlavesMap.distribute(coupledToPatch);
// Check on master whether point is anywhere on patch
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// List of master points that are on the patch
DynamicList<label> masterPoints(pointSlaves.size());
forAll(pointSlaves, coupledPointI)
{
const labelList& slaves = pointSlaves[coupledPointI];
if (slaves.size() > 0)
{
// I am master. Is this point on the patch on myself or on any
// any slave?
if (coupledToPatch[coupledPointI] != -1)
{
nCoupledMaster++;
masterPoints.append(coupledPointI);
}
else
{
isMaster[localPointI] = 0;
nCoupledSlave++;
}
}
}
label myUniquePoints = meshPoints.size() - nCoupledSlave;
Pout<< "Points :" << nl
<< " patch : " << meshPoints.size() << nl
<< " of which coupled : " << nCoupledMaster+nCoupledSlave << nl
<< " of which master : " << nCoupledMaster << nl
<< " of which slave : " << nCoupledSlave << nl
<< endl;
// 2. Create global indexing for unique points.
autoPtr<globalIndex> globalPointsPtr(new globalIndex(myUniquePoints));
// 3. Assign global point numbers. Keep slaves unset.
pointToGlobal.setSize(meshPoints.size());
pointToGlobal = -1;
uniquePoints.setSize(myUniquePoints);
label nMaster = 0;
forAll(isMaster, localPointI)
{
if (isMaster[localPointI])
{
pointToGlobal[localPointI] = globalPointsPtr().toGlobal(nMaster);
uniquePoints[nMaster] = localPointI;
nMaster++;
}
}
// 4. Push global index for coupled points to slaves.
{
labelList masterToGlobal(pointSlavesMap.constructSize(), -1);
forAll(meshPoints, localPointI)
{
label meshPointI = meshPoints[localPointI];
Map<label>::const_iterator iter = cpp.meshPointMap().find
(
meshPointI
);
if (iter != cpp.meshPointMap().end())
{
// My localPointI is a coupled point.
label coupledPointI = iter();
const labelList& slaves = pointSlaves[coupledPointI];
if (slaves.size() > 0)
forAll(slaves, i)
{
// Duplicate master globalpoint into slave slots
masterToGlobal[coupledPointI] = pointToGlobal[localPointI];
forAll(slaves, i)
if (coupledToPatch[slaves[i]] != -1)
{
masterToGlobal[slaves[i]] = pointToGlobal[localPointI];
masterPoints.append(coupledPointI);
break;
}
}
}
}
}
// Send back
pointSlavesMap.reverseDistribute(cpp.nPoints(), masterToGlobal);
// On slave copy master index into overal map.
forAll(meshPoints, localPointI)
// Create global indexing
// ~~~~~~~~~~~~~~~~~~~~~~
// 1. patch points that are not on coupled patch:
// meshPoints.size()-nCoupled
// 2. master points that are on patch:
// masterPoints.size()
label myUniquePoints = meshPoints.size()-nCoupled+masterPoints.size();
autoPtr<globalIndex> globalPointsPtr(new globalIndex(myUniquePoints));
//Pout<< "CoupledPatch:" << nl
// << " points:" << cpp.nPoints() << nl
// << " of which on patch:" << masterPoints.size() << endl;
// Allocate unique points
// ~~~~~~~~~~~~~~~~~~~~~~
pointToGlobal.setSize(meshPoints.size());
pointToGlobal = -1;
uniqueMeshPoints.setSize(myUniquePoints);
// Allocate globals for uncoupled patch points
label nMaster = 0;
forAll(patchToCoupled, patchPointI)
{
if (patchToCoupled[patchPointI] == -1)
{
label meshPointI = meshPoints[localPointI];
// Allocate global point
label globalI = globalPointsPtr().toGlobal(nMaster);
pointToGlobal[patchPointI] = globalI;
uniqueMeshPoints[nMaster] = meshPoints[patchPointI];
nMaster++;
}
}
Map<label>::const_iterator iter = cpp.meshPointMap().find
(
meshPointI
);
// Allocate globals for master
labelList masterToGlobal(pointSlavesMap.constructSize(), -456);
if (iter != cpp.meshPointMap().end())
forAll(masterPoints, i)
{
label coupledPointI = masterPoints[i];
// Allocate global point
label globalI = globalPointsPtr().toGlobal(nMaster);
if (coupledToPatch[coupledPointI] != -1)
{
pointToGlobal[coupledToPatch[coupledPointI]] = globalI;
}
uniqueMeshPoints[nMaster] = cpp.meshPoints()[coupledPointI];
nMaster++;
// Put global into slave slots
const labelList& slaves = pointSlaves[coupledPointI];
masterToGlobal[coupledPointI] = globalI; // not really necessary
forAll(slaves, i)
{
masterToGlobal[slaves[i]] = globalI;
}
}
if (nMaster != myUniquePoints)
{
FatalErrorIn("globalMeshData::mergePoints(..)")
<< "problem." << abort(FatalError);
}
// Send back (from slave slots) to originating processor
pointSlavesMap.reverseDistribute(cpp.nPoints(), masterToGlobal);
// On slaves take over global number
forAll(patchToCoupled, patchPointI)
{
label coupledPointI = patchToCoupled[patchPointI];
if (coupledPointI != -1)
{
const labelList& slaves = pointSlaves[coupledPointI];
if (slaves.size() == 0)
{
// My localPointI is a coupled point.
label coupledPointI = iter();
const labelList& slaves = pointSlaves[coupledPointI];
if (slaves.size() == 0)
{
pointToGlobal[localPointI] = masterToGlobal[coupledPointI];
}
pointToGlobal[patchPointI] = masterToGlobal[coupledPointI];
}
}
}
return globalPointsPtr;
}

View File

@ -319,6 +319,17 @@ class globalMeshData
void calcGlobalEdgeAllSlaves() const;
//- Synchronise pointwise data
template<class Type, class CombineOp>
void syncPointData
(
List<Type>& pointData,
const labelListList& slaves,
const mapDistribute& slavesMap,
const CombineOp& cop
) const;
//- Disallow default bitwise copy construct
globalMeshData(const globalMeshData&);
@ -505,6 +516,13 @@ public:
// distributed by below map.
const labelListList& globalPointSlaves() const;
const mapDistribute& globalPointSlavesMap() const;
//- Helper to synchronise mesh data
template<class Type, class CombineOp>
void syncPointData
(
List<Type>& pointData,
const CombineOp& cop
) const;
// Coupled edge to coupled edges.
@ -539,6 +557,13 @@ public:
const globalIndex& globalPointAllNumbering()const;
const labelListList& globalPointAllSlaves() const;
const mapDistribute& globalPointAllSlavesMap() const;
//- Helper to synchronise mesh data
template<class Type, class CombineOp>
void syncPointAllData
(
List<Type>& pointData,
const CombineOp& cop
) const;
// Coupled edge to all coupled edges (same numbering as
// collocated)
@ -560,13 +585,17 @@ public:
) const;
//- Helper for merging patch point data. Takes maps from
// local points to/from mesh
// local points to/from mesh. Determines
// - my unique points. These are mesh points, not patch points
// since the master might not be on the patch.
// - global numbering over all unique indices.
// - the global number for all local points.
autoPtr<globalIndex> mergePoints
(
const labelList& meshPoints,
const Map<label>& meshPointMap,
labelList& pointToGlobal,
labelList& uniquePoints
labelList& uniqueMeshPoints
) const;
@ -596,6 +625,13 @@ public:
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "globalMeshDataTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif

View File

@ -0,0 +1,128 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 "globalMeshData.H"
#include "polyMesh.H"
#include "mapDistribute.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type, class CombineOp>
void Foam::globalMeshData::syncPointData
(
List<Type>& pointData,
const labelListList& slaves,
const mapDistribute& slavesMap,
const CombineOp& cop
) const
{
if (pointData.size() != mesh_.nPoints())
{
FatalErrorIn("globalMeshData::syncPointData(..)")
<< "Number of elements in data:" << pointData.size()
<< " differs from number of points in mesh:" << mesh_.nPoints()
<< abort(FatalError);
}
const indirectPrimitivePatch& cpp = coupledPatch();
const labelList& meshPoints = cpp.meshPoints();
// Copy mesh (point)data to coupled patch (point)data
Field<Type> cppFld(slavesMap.constructSize());
forAll(meshPoints, patchPointI)
{
cppFld[patchPointI] = pointData[meshPoints[patchPointI]];
}
// Pull slave data onto master
slavesMap.distribute(cppFld);
// Combine master data with slave data
forAll(slaves, patchPointI)
{
const labelList& slavePoints = slaves[patchPointI];
// Combine master with slave data
forAll(slavePoints, i)
{
cop(cppFld[patchPointI], cppFld[slavePoints[i]]);
}
// Copy result back to slave slots
forAll(slavePoints, i)
{
cppFld[slavePoints[i]] = cppFld[patchPointI];
}
}
// Push master data back to slaves
slavesMap.reverseDistribute(meshPoints.size(), cppFld);
// Update mesh (point)data from coupled patch (point)data
forAll(meshPoints, patchPointI)
{
pointData[meshPoints[patchPointI]] = cppFld[patchPointI];
}
}
template<class Type, class CombineOp>
void Foam::globalMeshData::syncPointData
(
List<Type>& pointData,
const CombineOp& cop
) const
{
const labelListList& slaves = globalPointSlaves();
const mapDistribute& map = globalPointSlavesMap();
syncPointData
(
pointData,
slaves,
map,
cop
);
}
template<class Type, class CombineOp>
void Foam::globalMeshData::syncPointAllData
(
List<Type>& pointData,
const CombineOp& cop
) const
{
syncPointData
(
pointData,
globalPointAllSlaves(),
globalPointAllSlavesMap(),
cop
);
}
// ************************************************************************* //

View File

@ -35,141 +35,50 @@ defineTypeNameAndDebug(Foam::globalPoints, 0);
const Foam::label Foam::globalPoints::fromCollocated = labelMax/2;
const Foam::scalar Foam::globalPoints::mergeDist = ROOTVSMALL;
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// Routines to handle global indices
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bool Foam::globalPoints::noTransform(const tensor& tt, const scalar mergeDist)
{
return
(mag(tt.xx()-1) < mergeDist)
&& (mag(tt.yy()-1) < mergeDist)
&& (mag(tt.zz()-1) < mergeDist)
&& (mag(tt.xy()) < mergeDist)
&& (mag(tt.xz()) < mergeDist)
&& (mag(tt.yx()) < mergeDist)
&& (mag(tt.yz()) < mergeDist)
&& (mag(tt.zx()) < mergeDist)
&& (mag(tt.zy()) < mergeDist);
}
// Calculates per face whether couple is collocated.
Foam::PackedBoolList Foam::globalPoints::collocatedFaces
(
const coupledPolyPatch& pp,
const scalar mergeDist
)
{
// Initialise to false
PackedBoolList collocated(pp.size());
const vectorField& separation = pp.separation();
const tensorField& forwardT = pp.forwardT();
if (forwardT.size() == 0)
{
// Parallel.
if (separation.size() == 0)
{
collocated = 1u;
}
else if (separation.size() == 1)
{
// Fully separate. Do not synchronise.
}
else
{
// Per face separation.
forAll(pp, faceI)
{
if (mag(separation[faceI]) < mergeDist)
{
collocated[faceI] = 1u;
}
}
}
}
else if (forwardT.size() == 1)
{
// Fully transformed.
}
else
{
// Per face transformation.
forAll(pp, faceI)
{
if (noTransform(forwardT[faceI], mergeDist))
{
collocated[faceI] = 1u;
}
}
}
return collocated;
}
Foam::PackedBoolList Foam::globalPoints::collocatedPoints
(
const coupledPolyPatch& pp,
const scalar mergeDist
const coupledPolyPatch& pp
)
{
// Initialise to false
PackedBoolList collocated(pp.nPoints());
PackedBoolList isCollocated(pp.nPoints());
const vectorField& separation = pp.separation();
const tensorField& forwardT = pp.forwardT();
const boolList& collocated = pp.collocated();
if (forwardT.size() == 0)
if (collocated.size() == 0)
{
// Parallel.
if (separation.size() == 0)
{
collocated = 1u;
}
else if (separation.size() == 1)
{
// Fully separate.
}
else
{
// Per face separation.
for (label pointI = 0; pointI < pp.nPoints(); pointI++)
{
label faceI = pp.pointFaces()[pointI][0];
if (mag(separation[faceI]) < mergeDist)
{
collocated[pointI] = 1u;
}
}
}
isCollocated = 1;
}
else if (forwardT.size() == 1)
else if (collocated.size() == 1)
{
// Fully transformed.
// Uniform.
if (collocated[0])
{
isCollocated = 1;
}
}
else
{
// Per face transformation.
for (label pointI = 0; pointI < pp.nPoints(); pointI++)
{
label faceI = pp.pointFaces()[pointI][0];
// Per face collocated or not.
const labelListList& pointFaces = pp.pointFaces();
if (noTransform(forwardT[faceI], mergeDist))
forAll(pointFaces, pfi)
{
if (collocated[pointFaces[pfi][0]])
{
collocated[pointI] = 1u;
isCollocated[pfi] = 1;
}
}
}
return collocated;
return isCollocated;
}
Foam::label Foam::globalPoints::toGlobal
(
@ -467,8 +376,7 @@ void Foam::globalPoints::initOwnPoints
(
collocatedPoints
(
refCast<const coupledPolyPatch>(pp),
mergeDist
refCast<const coupledPolyPatch>(pp)
)
);
@ -563,8 +471,7 @@ void Foam::globalPoints::sendPatchPoints
(
collocatedPoints
(
procPatch,
mergeDist
procPatch
)
);
@ -663,8 +570,7 @@ void Foam::globalPoints::receivePatchPoints
(
collocatedPoints
(
procPatch,
mergeDist
procPatch
)
);
@ -726,8 +632,7 @@ void Foam::globalPoints::receivePatchPoints
(
collocatedPoints
(
cycPatch,
mergeDist
cycPatch
)
);
@ -1233,8 +1138,7 @@ void Foam::globalPoints::receiveSharedPoints
(
collocatedPoints
(
cycPatch,
mergeDist
cycPatch
)
);

View File

@ -127,9 +127,6 @@ class globalPoints
// collocated coupled points.
static const label fromCollocated;
//- Distance to check whether points/faces are collocated.
static const scalar mergeDist;
// Private data
@ -162,22 +159,9 @@ class globalPoints
// Private Member Functions
//- Is identity transform?
static bool noTransform(const tensor&, const scalar mergeDist);
//- Return per face collocated status
static PackedBoolList collocatedFaces
(
const coupledPolyPatch&,
const scalar mergeDist
);
//- Return per point collocated status
static PackedBoolList collocatedPoints
(
const coupledPolyPatch&,
const scalar mergeDist
);
static PackedBoolList collocatedPoints(const coupledPolyPatch&);
// Wrappers around global point numbering to add collocated bit

View File

@ -294,13 +294,13 @@ Foam::polyMesh::polyMesh(const IOobject& io)
// Calculate the geometry for the patches (transformation tensors etc.)
boundary_.calcGeometry();
// Warn if global empty mesh (constructs globalData!)
if (globalData().nTotalPoints() == 0)
// Warn if global empty mesh
if (returnReduce(nPoints(), sumOp<label>()) == 0)
{
WarningIn("polyMesh(const IOobject&)")
<< "no points in mesh" << endl;
}
if (globalData().nTotalCells() == 0)
if (returnReduce(nCells(), sumOp<label>()) == 0)
{
WarningIn("polyMesh(const IOobject&)")
<< "no cells in mesh" << endl;
@ -743,8 +743,12 @@ void Foam::polyMesh::resetPrimitives
// Calculate the geometry for the patches (transformation tensors etc.)
boundary_.calcGeometry();
// Warn if global empty mesh (constructs globalData!)
if (globalData().nTotalPoints() == 0 || globalData().nTotalCells() == 0)
// Warn if global empty mesh
if
(
(returnReduce(nPoints(), sumOp<label>()) == 0)
|| (returnReduce(nCells(), sumOp<label>()) == 0)
)
{
FatalErrorIn
(

View File

@ -285,6 +285,7 @@ void Foam::coupledPolyPatch::calcTransformTensors
separation_.setSize(0);
forwardT_ = I;
reverseT_ = I;
collocated_.setSize(0);
}
else
{
@ -299,10 +300,14 @@ void Foam::coupledPolyPatch::calcTransformTensors
{
// Rotation, no separation
// Assume per-face differening transformation, correct later
separation_.setSize(0);
forwardT_.setSize(Cf.size());
reverseT_.setSize(Cf.size());
collocated_.setSize(Cf.size());
collocated_ = false;
forAll (forwardT_, facei)
{
@ -321,6 +326,7 @@ void Foam::coupledPolyPatch::calcTransformTensors
{
forwardT_.setSize(1);
reverseT_.setSize(1);
collocated_.setSize(1);
if (debug)
{
@ -332,11 +338,15 @@ void Foam::coupledPolyPatch::calcTransformTensors
}
else
{
// No rotation, possible separation
forwardT_.setSize(0);
reverseT_.setSize(0);
separation_ = (nf&(Cr - Cf))*nf;
collocated_.setSize(separation_.size());
// Three situations:
// - separation is zero. No separation.
// - separation is same. Single separation vector.
@ -344,15 +354,23 @@ void Foam::coupledPolyPatch::calcTransformTensors
// Check for different separation per face
bool sameSeparation = true;
bool doneWarning = false;
forAll(separation_, facei)
{
scalar smallSqr = sqr(smallDist[facei]);
collocated_[facei] = (magSqr(separation_[facei]) < smallSqr);
// Check if separation differing w.r.t. face 0.
if (magSqr(separation_[facei] - separation_[0]) > smallSqr)
{
if (debug)
sameSeparation = false;
if (!doneWarning && debug)
{
doneWarning = true;
Pout<< " separation " << separation_[facei]
<< " at " << facei
<< " differs from separation[0] " << separation_[0]
@ -360,15 +378,13 @@ void Foam::coupledPolyPatch::calcTransformTensors
<< smallDist[facei]
<< ". Assuming non-uniform separation." << endl;
}
sameSeparation = false;
break;
}
}
if (sameSeparation)
{
// Check for zero separation (at 0 so everywhere)
if (magSqr(separation_[0]) < sqr(smallDist[0]))
if (collocated_[0])
{
if (debug)
{
@ -378,6 +394,7 @@ void Foam::coupledPolyPatch::calcTransformTensors
}
separation_.setSize(0);
collocated_ = boolList(1, true);
}
else
{
@ -389,6 +406,7 @@ void Foam::coupledPolyPatch::calcTransformTensors
}
separation_.setSize(1);
collocated_ = boolList(1, false);
}
}
}

View File

@ -64,6 +64,9 @@ class coupledPolyPatch
//- Neighbour-cell transformation tensor
mutable tensorField reverseT_;
//- Are faces collocated. Either size 0,1 or length of patch.
mutable boolList collocated_;
public:
// Static data members
@ -261,7 +264,6 @@ public:
return separation_;
}
//- Are the cyclic planes parallel
bool parallel() const
{
@ -280,6 +282,12 @@ public:
return reverseT_;
}
//- Are faces collocated. Either size 0,1 or length of patch
const boolList& collocated() const
{
return collocated_;
}
//- Initialize ordering for primitivePatch. Does not
// refer to *this (except for name() and type() etc.)

View File

@ -26,8 +26,8 @@ Class
Foam::genericPolyPatch
Description
Determines a mapping between patch face centres and mesh cell centres and
processors they're on.
Substitute for unknown patches. Used for postprocessing when only
basic polyPatch info is needed.
Note
Storage is not optimal. It stores all face centres and cells on all

View File

@ -74,6 +74,17 @@ public:
//- The various text representations for a switch value.
// These also correspond to the entries in names.
# undef FALSE
# undef TRUE
# undef OFF
# undef ON
# undef NO
# undef YES
# undef NO_1
# undef YES_1
# undef NONE
# undef PLACEHOLDER
# undef INVALID
enum switchType
{
FALSE = 0, TRUE = 1,

View File

@ -82,6 +82,8 @@ EqOp(orEq, x = (x || y))
EqOp(eqMinus, x = -y)
EqOp(nopEq, (void)x)
#undef EqOp

View File

@ -36,6 +36,7 @@ Foam::UIPstream::UIPstream
const commsTypes commsType,
const int fromProcNo,
DynamicList<char>& externalBuf,
label& externalBufPosition,
const int tag,
streamFormat format,
versionNumber version
@ -45,7 +46,7 @@ Foam::UIPstream::UIPstream
Istream(format, version),
fromProcNo_(fromProcNo),
externalBuf_(externalBuf),
externalBufPosition_(0),
externalBufPosition_(externalBufPosition),
tag_(tag),
messageSize_(0)
{
@ -56,6 +57,7 @@ Foam::UIPstream::UIPstream
"const commsTypes,"
"const int fromProcNo,"
"DynamicList<char>&,"
"label&,"
"const int tag,"
"streamFormat, versionNumber"
")"

View File

@ -40,6 +40,7 @@ Foam::UIPstream::UIPstream
const commsTypes commsType,
const int fromProcNo,
DynamicList<char>& externalBuf,
label& externalBufPosition,
const int tag,
streamFormat format,
versionNumber version
@ -49,7 +50,7 @@ Foam::UIPstream::UIPstream
Istream(format, version),
fromProcNo_(fromProcNo),
externalBuf_(externalBuf),
externalBufPosition_(0),
externalBufPosition_(externalBufPosition),
tag_(tag),
messageSize_(0)
{
@ -122,7 +123,7 @@ Foam::UIPstream::UIPstream(const int fromProcNo, PstreamBuffers& buffers)
Istream(buffers.format_, buffers.version_),
fromProcNo_(fromProcNo),
externalBuf_(buffers.recvBuf_[fromProcNo]),
externalBufPosition_(0),
externalBufPosition_(buffers.recvBufPos_[fromProcNo]),
tag_(buffers.tag_),
messageSize_(0)
{

View File

@ -45,7 +45,7 @@ bool Foam::UOPstream::write
{
if (debug)
{
Pout<< "UIPstream::write : starting write to:" << toProcNo
Pout<< "UOPstream::write : starting write to:" << toProcNo
<< " tag:" << tag << " size:" << label(bufSize)
<< " commsType:" << UPstream::commsTypeNames[commsType]
<< Foam::endl;
@ -67,7 +67,7 @@ bool Foam::UOPstream::write
if (debug)
{
Pout<< "UIPstream::write : finished write to:" << toProcNo
Pout<< "UOPstream::write : finished write to:" << toProcNo
<< " tag:" << tag << " size:" << label(bufSize)
<< " commsType:" << UPstream::commsTypeNames[commsType]
<< Foam::endl;
@ -87,7 +87,7 @@ bool Foam::UOPstream::write
if (debug)
{
Pout<< "UIPstream::write : finished write to:" << toProcNo
Pout<< "UOPstream::write : finished write to:" << toProcNo
<< " tag:" << tag << " size:" << label(bufSize)
<< " commsType:" << UPstream::commsTypeNames[commsType]
<< Foam::endl;
@ -110,7 +110,7 @@ bool Foam::UOPstream::write
if (debug)
{
Pout<< "UIPstream::write : started write to:" << toProcNo
Pout<< "UOPstream::write : started write to:" << toProcNo
<< " tag:" << tag << " size:" << label(bufSize)
<< " commsType:" << UPstream::commsTypeNames[commsType]
<< " request:" << PstreamGlobals::outstandingRequests_.size()

View File

@ -29,6 +29,9 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
Foam::string Foam::meshWriter::defaultMeshName = "meshExport";
const Foam::cellModel* Foam::meshWriter::unknownModel = Foam::cellModeller::
lookup
(
@ -64,10 +67,6 @@ lookup
);
Foam::string Foam::meshWriter::defaultMeshName = "meshExport";
Foam::string Foam::meshWriter::defaultSurfaceName = "surfExport";
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::meshWriter::meshWriter(const polyMesh& mesh, const scalar scaleFactor)

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -85,7 +85,7 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
Class meshWriter Declaration
Class meshWriter Declaration
\*---------------------------------------------------------------------------*/
class meshWriter
@ -133,13 +133,12 @@ public:
// Static data members
//- Specify a default mesh name
static string defaultMeshName;
static string defaultSurfaceName;
// Constructors
//- Ccreate a writer obejct
//- Create a writer obejct
meshWriter
(
const polyMesh&,
@ -167,26 +166,14 @@ public:
writeBoundary_ = false;
}
// Write
//- Write volume mesh
// subclass must to supply this method
//- Write volume mesh. Subclass must supply this method
virtual bool write
(
const fileName& timeName = fileName::null
) const = 0;
//- Write surface mesh with optional triangulation
// subclass could supply this information
virtual bool writeSurface
(
const fileName& timeName = fileName::null,
const bool triangulate = false
) const
{
return false;
}
};

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -527,201 +527,4 @@ bool Foam::meshWriters::STARCD::write(const fileName& meshName) const
}
bool Foam::meshWriters::STARCD::writeSurface
(
const fileName& meshName,
const bool triangulate
) const
{
fileName baseName(meshName);
if (baseName.empty())
{
baseName = meshWriter::defaultSurfaceName;
if
(
mesh_.time().timeName() != "0"
&& mesh_.time().timeName() != "constant"
)
{
baseName += "_" + mesh_.time().timeName();
}
}
rmFiles(baseName);
OFstream celFile(baseName + ".cel");
writeHeader(celFile, "CELL");
Info<< "Writing " << celFile.name() << endl;
// mesh and patch info
const pointField& points = mesh_.points();
const labelList& owner = mesh_.faceOwner();
const faceList& meshFaces = mesh_.faces();
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
label shapeId = 3; // shell/baffle element
label typeId = 4; // 4(shell)
// remember which points need to be written
labelHashSet pointHash;
// write boundary faces as normal STAR-CD mesh
if (triangulate)
{
// cell Id has no particular meaning - just increment
// use the cellTable id from the patch Number
label cellId = 0;
forAll(patches, patchI)
{
label patchStart = patches[patchI].start();
label patchSize = patches[patchI].size();
label ctableId = patchI + 1;
for
(
label faceI = patchStart;
faceI < (patchStart + patchSize);
++faceI
)
{
const face& f = meshFaces[faceI];
label nTri = f.nTriangles(points);
faceList triFaces;
// triangulate polygons, but not quads
if (nTri <= 2)
{
triFaces.setSize(1);
triFaces[0] = f;
}
else
{
triFaces.setSize(nTri);
nTri = 0;
f.triangles(points, nTri, triFaces);
}
forAll(triFaces, faceI)
{
const labelList& vrtList = triFaces[faceI];
celFile
<< cellId + 1 << " "
<< shapeId << " "
<< vrtList.size() << " "
<< ctableId << " "
<< typeId;
// must be 3 (triangle) but could be quad
label count = 0;
forAll(vrtList, i)
{
if ((count % 8) == 0)
{
celFile
<< nl
<< " " << cellId + 1;
}
// remember which points we'll need to write
pointHash.insert(vrtList[i]);
celFile << " " << vrtList[i] + 1;
count++;
}
celFile << endl;
cellId++;
}
}
}
}
else
{
// cell Id is the OpenFOAM face Id
// use the cellTable id from the face owner
// - allows separation of parts
forAll(patches, patchI)
{
label patchStart = patches[patchI].start();
label patchSize = patches[patchI].size();
for
(
label faceI = patchStart;
faceI < (patchStart + patchSize);
++faceI
)
{
const labelList& vrtList = meshFaces[faceI];
label cellId = faceI;
celFile
<< cellId + 1 << " "
<< shapeId << " "
<< vrtList.size() << " "
<< cellTableId_[owner[faceI]] << " "
<< typeId;
// likely <= 8 vertices, but prevent overrun anyhow
label count = 0;
forAll(vrtList, i)
{
if ((count % 8) == 0)
{
celFile
<< nl
<< " " << cellId + 1;
}
// remember which points we'll need to write
pointHash.insert(vrtList[i]);
celFile << " " << vrtList[i] + 1;
count++;
}
celFile << endl;
}
}
}
OFstream vrtFile(baseName + ".vrt");
writeHeader(vrtFile, "VERTEX");
vrtFile.precision(10);
vrtFile.setf(std::ios::showpoint); // force decimal point for Fortran
Info<< "Writing " << vrtFile.name() << endl;
// build sorted table of contents
SortableList<label> toc(pointHash.size());
{
label i = 0;
forAllConstIter(labelHashSet, pointHash, iter)
{
toc[i++] = iter.key();
}
}
toc.sort();
toc.shrink();
pointHash.clear();
// write points in sorted order
forAll(toc, i)
{
label vrtId = toc[i];
vrtFile
<< vrtId + 1
<< " " << scaleFactor_ * points[vrtId].x()
<< " " << scaleFactor_ * points[vrtId].y()
<< " " << scaleFactor_ * points[vrtId].z()
<< endl;
}
return true;
}
// ************************************************************************* //

View File

@ -28,11 +28,6 @@ Class
Description
Writes polyMesh in pro-STAR (v4) bnd/cel/vrt format
Alternatively, extracts the surface of the FOAM mesh into
pro-STAR (v4) .cel/.vrt/ format.
This can be useful, for example, for surface morphing in an external
package.
The cellTableId and cellTable information are used (if available).
Otherwise the cellZones are used (if available).
@ -131,12 +126,6 @@ public:
const fileName& meshName = fileName::null
) const;
//- Write surface mesh with optional triangulation
virtual bool writeSurface
(
const fileName& meshName = fileName::null,
const bool triangulate = false
) const;
};

View File

@ -27,7 +27,6 @@ License
#include "motionSmoother.H"
#include "meshTools.H"
#include "processorPointPatchFields.H"
#include "globalPointPatchFields.H"
#include "pointConstraint.H"
#include "syncTools.H"

View File

@ -187,7 +187,7 @@ $(interpolation)/interpolationCellPointWallModified/cellPointWeightWallModified/
$(interpolation)/interpolationCellPointWallModified/makeInterpolationCellPointWallModified.C
volPointInterpolation = interpolation/volPointInterpolation
$(volPointInterpolation)/pointPatchInterpolation/pointPatchInterpolation.C
/* $(volPointInterpolation)/pointPatchInterpolation/pointPatchInterpolation.C */
$(volPointInterpolation)/volPointInterpolation.C
surfaceInterpolation = interpolation/surfaceInterpolation

View File

@ -1,208 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 "pointPatchInterpolation.H"
#include "volFields.H"
#include "pointFields.H"
#include "emptyFvPatch.H"
#include "valuePointPatchField.H"
#include "coupledPointPatchField.H"
#include "coupledFacePointPatch.H"
#include "transform.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type>
void pointPatchInterpolation::interpolate
(
const GeometricField<Type, fvPatchField, volMesh>& vf,
GeometricField<Type, pointPatchField, pointMesh>& pf,
bool overrideFixedValue
) const
{
if (debug)
{
Info<< "pointPatchInterpolation::interpolate("
<< "const GeometricField<Type, fvPatchField, volMesh>&, "
<< "GeometricField<Type, pointPatchField, pointMesh>&) : "
<< "interpolating field from cells to points"
<< endl;
}
// Interpolate patch values: over-ride the internal values for the points
// on the patch with the interpolated point values from the faces of the
// patch
const fvBoundaryMesh& bm = fvMesh_.boundary();
const pointBoundaryMesh& pbm = pointMesh::New(fvMesh_).boundary();
forAll(bm, patchi)
{
if (!isA<emptyFvPatch>(bm[patchi]) && !bm[patchi].coupled())
{
pointPatchField<Type>& ppf = pf.boundaryField()[patchi];
// Only map the values corresponding to the points associated with
// faces, not "lone" points due to decomposition
ppf.setInInternalField
(
pf.internalField(),
patchInterpolators_[patchi]
.faceToPointInterpolate(vf.boundaryField()[patchi])(),
bm[patchi].patch().meshPoints()
);
if
(
overrideFixedValue
&& isA<valuePointPatchField<Type> >(ppf)
)
{
refCast<valuePointPatchField<Type> >(ppf) = ppf;
}
}
else if (bm[patchi].coupled())
{
// Initialise the "lone" points on the coupled patch to zero,
// these values are obtained from the couple-transfer
const labelList& loneMeshPoints =
refCast<const coupledFacePointPatch>(pbm[patchi])
.loneMeshPoints();
forAll(loneMeshPoints, i)
{
pf[loneMeshPoints[i]] = pTraits<Type>::zero;
}
}
}
// Correct patch-patch boundary points by interpolation "around" corners
const labelListList& PointFaces = fvMesh_.pointFaces();
forAll(patchPatchPoints_, pointi)
{
const label curPoint = patchPatchPoints_[pointi];
const labelList& curFaces = PointFaces[curPoint];
label fI = 0;
// Reset the boundary value before accumulation
pf[curPoint] = pTraits<Type>::zero;
// Go through all the faces
forAll(curFaces, facei)
{
if (!fvMesh_.isInternalFace(curFaces[facei]))
{
label patchi =
fvMesh_.boundaryMesh().whichPatch(curFaces[facei]);
if (!isA<emptyFvPatch>(bm[patchi]) && !bm[patchi].coupled())
{
label faceInPatchi =
bm[patchi].patch().whichFace(curFaces[facei]);
pf[curPoint] +=
patchPatchPointWeights_[pointi][fI]
*vf.boundaryField()[patchi][faceInPatchi];
fI++;
}
}
}
}
// Update coupled boundaries
forAll(pf.boundaryField(), patchi)
{
if (pf.boundaryField()[patchi].coupled())
{
refCast<coupledPointPatchField<Type> >(pf.boundaryField()[patchi])
.initSwapAdd(pf.internalField());
}
}
forAll(pf.boundaryField(), patchi)
{
if (pf.boundaryField()[patchi].coupled())
{
refCast<coupledPointPatchField<Type> >(pf.boundaryField()[patchi])
.swapAdd(pf.internalField());
}
}
// Override constrained pointPatchField types with the constraint value.
// This relys on only constrained pointPatchField implementing the evaluate
// function
pf.correctBoundaryConditions();
// Apply multiple constraints on edge/corner points
applyCornerConstraints(pf);
if (debug)
{
Info<< "pointPatchInterpolation::interpolate("
<< "const GeometricField<Type, fvPatchField, volMesh>&, "
<< "GeometricField<Type, pointPatchField, pointMesh>&) : "
<< "finished interpolating field from cells to points"
<< endl;
}
}
template<class Type>
void pointPatchInterpolation::applyCornerConstraints
(
GeometricField<Type, pointPatchField, pointMesh>& pf
) const
{
forAll(patchPatchPointConstraintPoints_, pointi)
{
pf[patchPatchPointConstraintPoints_[pointi]] = transform
(
patchPatchPointConstraintTensors_[pointi],
pf[patchPatchPointConstraintPoints_[pointi]]
);
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -1,337 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 "pointPatchInterpolation.H"
#include "fvMesh.H"
#include "volFields.H"
#include "pointFields.H"
#include "emptyFvPatch.H"
#include "demandDrivenData.H"
#include "coupledPointPatchFields.H"
#include "pointConstraint.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(pointPatchInterpolation, 0);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void pointPatchInterpolation::makePatchPatchAddressing()
{
if (debug)
{
Info<< "pointPatchInterpolation::makePatchPatchAddressing() : "
<< "constructing boundary addressing"
<< endl;
}
const fvBoundaryMesh& bm = fvMesh_.boundary();
const pointBoundaryMesh& pbm = pointMesh::New(fvMesh_).boundary();
// first count the total number of patch-patch points
label nPatchPatchPoints = 0;
forAll(bm, patchi)
{
if (!isA<emptyFvPatch>(bm[patchi]) && !bm[patchi].coupled())
{
nPatchPatchPoints += bm[patchi].patch().boundaryPoints().size();
}
}
// Go through all patches and mark up the external edge points
Map<label> patchPatchPointSet(2*nPatchPatchPoints);
patchPatchPoints_.setSize(nPatchPatchPoints);
List<pointConstraint> patchPatchPointConstraints(nPatchPatchPoints);
label pppi = 0;
forAll(bm, patchi)
{
if (!isA<emptyFvPatch>(bm[patchi]) && !bm[patchi].coupled())
{
const labelList& bp = bm[patchi].patch().boundaryPoints();
const labelList& meshPoints = bm[patchi].patch().meshPoints();
forAll(bp, pointi)
{
label ppp = meshPoints[bp[pointi]];
Map<label>::iterator iter = patchPatchPointSet.find(ppp);
if (iter == patchPatchPointSet.end())
{
patchPatchPointSet.insert(ppp, pppi);
patchPatchPoints_[pppi] = ppp;
pbm[patchi].applyConstraint
(
bp[pointi],
patchPatchPointConstraints[pppi]
);
pppi++;
}
else
{
pbm[patchi].applyConstraint
(
bp[pointi],
patchPatchPointConstraints[iter()]
);
}
}
}
}
nPatchPatchPoints = pppi;
patchPatchPoints_.setSize(nPatchPatchPoints);
patchPatchPointConstraints.setSize(nPatchPatchPoints);
patchPatchPointConstraintPoints_.setSize(nPatchPatchPoints);
patchPatchPointConstraintTensors_.setSize(nPatchPatchPoints);
label nConstraints = 0;
forAll(patchPatchPointConstraints, i)
{
if (patchPatchPointConstraints[i].first() != 0)
{
patchPatchPointConstraintPoints_[nConstraints] =
patchPatchPoints_[i];
patchPatchPointConstraintTensors_[nConstraints] =
patchPatchPointConstraints[i].constraintTransformation();
nConstraints++;
}
}
patchPatchPointConstraintPoints_.setSize(nConstraints);
patchPatchPointConstraintTensors_.setSize(nConstraints);
patchInterpolators_.clear();
patchInterpolators_.setSize(bm.size());
forAll(bm, patchi)
{
patchInterpolators_.set
(
patchi,
new primitivePatchInterpolation(bm[patchi].patch())
);
}
if (debug)
{
Info<< "pointPatchInterpolation::makePatchPatchAddressing() : "
<< "finished constructing boundary addressing"
<< endl;
}
}
void pointPatchInterpolation::makePatchPatchWeights()
{
if (debug)
{
Info<< "pointPatchInterpolation::makePatchPatchWeights() : "
<< "constructing boundary weighting factors"
<< endl;
}
patchPatchPointWeights_.clear();
patchPatchPointWeights_.setSize(patchPatchPoints_.size());
const labelListList& pf = fvMesh_.pointFaces();
const volVectorField& centres = fvMesh_.C();
const fvBoundaryMesh& bm = fvMesh_.boundary();
pointScalarField sumWeights
(
IOobject
(
"sumWeights",
fvMesh_.polyMesh::instance(),
fvMesh_
),
pointMesh::New(fvMesh_),
dimensionedScalar("zero", dimless, 0)
);
forAll(patchPatchPoints_, pointi)
{
const label curPoint = patchPatchPoints_[pointi];
const labelList& curFaces = pf[curPoint];
patchPatchPointWeights_[pointi].setSize(curFaces.size());
scalarList& pw = patchPatchPointWeights_[pointi];
label nFacesAroundPoint = 0;
const vector& pointLoc = fvMesh_.points()[curPoint];
forAll(curFaces, facei)
{
if (!fvMesh_.isInternalFace(curFaces[facei]))
{
label patchi =
fvMesh_.boundaryMesh().whichPatch(curFaces[facei]);
if (!isA<emptyFvPatch>(bm[patchi]) && !bm[patchi].coupled())
{
vector d =
pointLoc
- centres.boundaryField()[patchi]
[bm[patchi].patch().whichFace(curFaces[facei])];
pw[nFacesAroundPoint] = 1.0/(mag(d)+VSMALL);
nFacesAroundPoint++;
}
}
}
// Reset the sizes of the local weights
pw.setSize(nFacesAroundPoint);
// Collect the sum of weights for parallel correction
sumWeights[curPoint] += sum(pw);
}
// Do parallel correction of weights
// Update coupled boundaries
forAll(sumWeights.boundaryField(), patchi)
{
if (sumWeights.boundaryField()[patchi].coupled())
{
refCast<coupledPointPatchScalarField>
(sumWeights.boundaryField()[patchi]).initSwapAdd
(
sumWeights.internalField()
);
}
}
forAll(sumWeights.boundaryField(), patchi)
{
if (sumWeights.boundaryField()[patchi].coupled())
{
refCast<coupledPointPatchScalarField>
(sumWeights.boundaryField()[patchi]).swapAdd
(
sumWeights.internalField()
);
}
}
// Re-scale the weights for the current point
forAll(patchPatchPoints_, pointi)
{
scalarList& pw = patchPatchPointWeights_[pointi];
scalar sumw = sumWeights[patchPatchPoints_[pointi]];
forAll(pw, facei)
{
pw[facei] /= sumw;
}
}
if (debug)
{
Info<< "pointPatchInterpolation::makePatchPatchWeights() : "
<< "finished constructing boundary weighting factors"
<< endl;
}
}
// * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * //
pointPatchInterpolation::pointPatchInterpolation(const fvMesh& vm)
:
fvMesh_(vm)
{
updateMesh();
}
// * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * //
pointPatchInterpolation::~pointPatchInterpolation()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void pointPatchInterpolation::updateMesh()
{
makePatchPatchAddressing();
makePatchPatchWeights();
}
bool pointPatchInterpolation::movePoints()
{
forAll(patchInterpolators_, patchi)
{
patchInterpolators_[patchi].movePoints();
}
makePatchPatchWeights();
return true;
}
// Specialisaion of applyCornerConstraints for scalars because
// no constraint need be applied
template<>
void pointPatchInterpolation::applyCornerConstraints<scalar>
(
GeometricField<scalar, pointPatchField, pointMesh>& pf
) const
{}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -1,169 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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::pointPatchInterpolation
Description
Foam::pointPatchInterpolation
SourceFiles
pointPatchInterpolation.C
\*---------------------------------------------------------------------------*/
#ifndef pointPatchInterpolation_H
#define pointPatchInterpolation_H
#include "primitivePatchInterpolation.H"
#include "PtrList.H"
#include "volFieldsFwd.H"
#include "pointFieldsFwd.H"
#include "scalarList.H"
#include "className.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
class fvMesh;
class pointMesh;
/*---------------------------------------------------------------------------*\
Class pointPatchInterpolation Declaration
\*---------------------------------------------------------------------------*/
class pointPatchInterpolation
{
// Private data
const fvMesh& fvMesh_;
//- Primitive patch interpolators
PtrList<primitivePatchInterpolation> patchInterpolators_;
//- List of patch-patch edge points that require special treatement
labelList patchPatchPoints_;
//- Weights for patch-patch boundary points
scalarListList patchPatchPointWeights_;
labelList patchPatchPointConstraintPoints_;
tensorField patchPatchPointConstraintTensors_;
// Private member functions
//- Construct addressing for patch-patch boundary points
void makePatchPatchAddressing();
//- Construct weights for patch-patch boundary points
void makePatchPatchWeights();
//- Disallow default bitwise copy construct
pointPatchInterpolation(const pointPatchInterpolation&);
//- Disallow default bitwise assignment
void operator=(const pointPatchInterpolation&);
public:
// Declare name of the class and its debug switch
ClassName("pointPatchInterpolation");
// Constructors
//- Constructor given fvMesh and pointMesh.
pointPatchInterpolation(const fvMesh&);
// Destructor
~pointPatchInterpolation();
// Member functions
// Access
const fvMesh& mesh() const
{
return fvMesh_;
}
// Edit
//- Update mesh topology using the morph engine
void updateMesh();
//- Correct weighting factors for moving mesh.
bool movePoints();
// Interpolation functions
template<class Type>
void interpolate
(
const GeometricField<Type, fvPatchField, volMesh>&,
GeometricField<Type, pointPatchField, pointMesh>&,
bool overrideFixedValue
) const;
template<class Type>
void applyCornerConstraints
(
GeometricField<Type, pointPatchField, pointMesh>& pf
) const;
};
template<>
void pointPatchInterpolation::applyCornerConstraints<scalar>
(
GeometricField<scalar, pointPatchField, pointMesh>& pf
) const;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "pointPatchInterpolate.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -27,7 +27,11 @@ License
#include "volPointInterpolation.H"
#include "volFields.H"
#include "pointFields.H"
#include "globalPointPatch.H"
#include "emptyFvPatch.H"
#include "mapDistribute.H"
#include "coupledPointPatchField.H"
#include "valuePointPatchField.H"
#include "transform.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -36,6 +40,48 @@ namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type>
void volPointInterpolation::addSeparated
(
GeometricField<Type, pointPatchField, pointMesh>& pf
) const
{
if (debug)
{
Pout<< "volPointInterpolation::addSeparated" << endl;
}
forAll(pf.boundaryField(), patchI)
{
if (pf.boundaryField()[patchI].coupled())
{
refCast<coupledPointPatchField<Type> >
(pf.boundaryField()[patchI]).initSwapAddSeparated
(
Pstream::blocking, //Pstream::nonBlocking,
pf.internalField()
);
}
}
// Block for any outstanding requests
//Pstream::waitRequests();
forAll(pf.boundaryField(), patchI)
{
if (pf.boundaryField()[patchI].coupled())
{
refCast<coupledPointPatchField<Type> >
(pf.boundaryField()[patchI]).swapAddSeparated
(
Pstream::blocking, //Pstream::nonBlocking,
pf.internalField()
);
}
}
}
template<class Type>
void volPointInterpolation::interpolateInternalField
(
@ -45,7 +91,7 @@ void volPointInterpolation::interpolateInternalField
{
if (debug)
{
Info<< "volPointInterpolation::interpolateInternalField("
Pout<< "volPointInterpolation::interpolateInternalField("
<< "const GeometricField<Type, fvPatchField, volMesh>&, "
<< "GeometricField<Type, pointPatchField, pointMesh>&) : "
<< "interpolating field from cells to points"
@ -57,19 +103,166 @@ void volPointInterpolation::interpolateInternalField
// Multiply volField by weighting factor matrix to create pointField
forAll(pointCells, pointi)
{
const scalarList& pw = pointWeights_[pointi];
const labelList& ppc = pointCells[pointi];
pf[pointi] = pTraits<Type>::zero;
forAll(ppc, pointCelli)
if (!isPatchPoint_[pointi])
{
pf[pointi] += pw[pointCelli]*vf[ppc[pointCelli]];
const scalarList& pw = pointWeights_[pointi];
const labelList& ppc = pointCells[pointi];
pf[pointi] = pTraits<Type>::zero;
forAll(ppc, pointCelli)
{
pf[pointi] += pw[pointCelli]*vf[ppc[pointCelli]];
}
}
}
}
template<class Type>
tmp<Field<Type> > volPointInterpolation::flatBoundaryField
(
const GeometricField<Type, fvPatchField, volMesh>& vf
) const
{
const fvMesh& mesh = vf.mesh();
const fvBoundaryMesh& bm = mesh.boundary();
tmp<Field<Type> > tboundaryVals
(
new Field<Type>(mesh.nFaces()-mesh.nInternalFaces())
);
Field<Type>& boundaryVals = tboundaryVals();
forAll(vf.boundaryField(), patchI)
{
label bFaceI = bm[patchI].patch().start() - mesh.nInternalFaces();
if (!isA<emptyFvPatch>(bm[patchI]) && !bm[patchI].coupled())
{
SubList<Type>
(
boundaryVals,
vf.boundaryField()[patchI].size(),
bFaceI
).assign(vf.boundaryField()[patchI]);
}
else
{
const polyPatch& pp = bm[patchI].patch();
forAll(pp, i)
{
boundaryVals[bFaceI++] = pTraits<Type>::zero;
}
}
}
return tboundaryVals;
}
template<class Type>
void volPointInterpolation::interpolateBoundaryField
(
const GeometricField<Type, fvPatchField, volMesh>& vf,
GeometricField<Type, pointPatchField, pointMesh>& pf,
const bool overrideFixedValue
) const
{
const primitivePatch& boundary = boundaryPtr_();
Field<Type>& pfi = pf.internalField();
// Get face data in flat list
tmp<Field<Type> > tboundaryVals(flatBoundaryField(vf));
const Field<Type>& boundaryVals = tboundaryVals();
// Do points on 'normal' patches from the surrounding patch faces
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
forAll(boundary.meshPoints(), i)
{
label pointI = boundary.meshPoints()[i];
if (isPatchPoint_[pointI])
{
const labelList& pFaces = boundary.pointFaces()[i];
const scalarList& pWeights = boundaryPointWeights_[i];
Type& val = pfi[pointI];
val = pTraits<Type>::zero;
forAll(pFaces, j)
{
if (boundaryIsPatchFace_[pFaces[j]])
{
val += pWeights[j]*boundaryVals[pFaces[j]];
}
}
}
}
// Sum collocated contributions
mesh().globalData().syncPointData(pfi, plusEqOp<Type>());
// And add separated contributions
addSeparated(pf);
// Push master data to slaves. It is possible (not sure how often) for
// a coupled point to have its master on a different patch so
// to make sure just push master data to slaves. Reuse the syncPointData
// structure.
mesh().globalData().syncPointData(pfi, nopEqOp<Type>());
if (overrideFixedValue)
{
forAll(pf.boundaryField(), patchI)
{
pointPatchField<Type>& ppf = pf.boundaryField()[patchI];
if (isA<valuePointPatchField<Type> >(ppf))
{
refCast<valuePointPatchField<Type> >(ppf) =
ppf.patchInternalField();
}
}
}
// Override constrained pointPatchField types with the constraint value.
// This relys on only constrained pointPatchField implementing the evaluate
// function
pf.correctBoundaryConditions();
// Sync any dangling points
mesh().globalData().syncPointData(pfi, nopEqOp<Type>());
// Apply multiple constraints on edge/corner points
applyCornerConstraints(pf);
}
template<class Type>
void volPointInterpolation::applyCornerConstraints
(
GeometricField<Type, pointPatchField, pointMesh>& pf
) const
{
forAll(patchPatchPointConstraintPoints_, pointi)
{
pf[patchPatchPointConstraintPoints_[pointi]] = transform
(
patchPatchPointConstraintTensors_[pointi],
pf[patchPatchPointConstraintPoints_[pointi]]
);
}
}
template<class Type>
void volPointInterpolation::interpolate
(
@ -79,7 +272,7 @@ void volPointInterpolation::interpolate
{
if (debug)
{
Info<< "volPointInterpolation::interpolate("
Pout<< "volPointInterpolation::interpolate("
<< "const GeometricField<Type, fvPatchField, volMesh>&, "
<< "GeometricField<Type, pointPatchField, pointMesh>&) : "
<< "interpolating field from cells to points"
@ -89,7 +282,7 @@ void volPointInterpolation::interpolate
interpolateInternalField(vf, pf);
// Interpolate to the patches preserving fixed value BCs
boundaryInterpolator_.interpolate(vf, pf, false);
interpolateBoundaryField(vf, pf, false);
}
@ -101,23 +294,7 @@ volPointInterpolation::interpolate
const wordList& patchFieldTypes
) const
{
wordList types(patchFieldTypes);
const pointMesh& pMesh = pointMesh::New(vf.mesh());
// If the last patch of the pointBoundaryMesh is the global patch
// it must be added to the list of patchField types
if
(
isType<globalPointPatch>
(
pMesh.boundary()[pMesh.boundary().size() - 1]
)
)
{
types.setSize(types.size() + 1);
types[types.size()-1] = pMesh.boundary()[types.size()-1].type();
}
const pointMesh& pm = pointMesh::New(vf.mesh());
// Construct tmp<pointField>
tmp<GeometricField<Type, pointPatchField, pointMesh> > tpf
@ -128,18 +305,18 @@ volPointInterpolation::interpolate
(
"volPointInterpolate(" + vf.name() + ')',
vf.instance(),
pMesh.thisDb()
pm.thisDb()
),
pMesh,
pm,
vf.dimensions(),
types
patchFieldTypes
)
);
interpolateInternalField(vf, tpf());
// Interpolate to the patches overriding fixed value BCs
boundaryInterpolator_.interpolate(vf, tpf(), true);
interpolateBoundaryField(vf, tpf(), true);
return tpf;
}
@ -186,7 +363,7 @@ volPointInterpolation::interpolate
);
interpolateInternalField(vf, tpf());
boundaryInterpolator_.interpolate(vf, tpf(), false);
interpolateBoundaryField(vf, tpf(), false);
return tpf;
}

View File

@ -44,15 +44,114 @@ defineTypeNameAndDebug(volPointInterpolation, 0);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void volPointInterpolation::makeWeights()
void volPointInterpolation::calcBoundaryAddressing()
{
if (debug)
{
Info<< "volPointInterpolation::makeWeights() : "
<< "constructing weighting factors"
Pout<< "volPointInterpolation::calcBoundaryAddressing() : "
<< "constructing boundary addressing"
<< endl;
}
boundaryPtr_.reset
(
new primitivePatch
(
SubList<face>
(
mesh().faces(),
mesh().nFaces()-mesh().nInternalFaces(),
mesh().nInternalFaces()
),
mesh().points()
)
);
const primitivePatch& boundary = boundaryPtr_();
boundaryIsPatchFace_.setSize(boundary.size());
boundaryIsPatchFace_ = false;
isPatchPoint_.setSize(mesh().nPoints());
isPatchPoint_ = false;
const polyBoundaryMesh& pbm = mesh().boundaryMesh();
forAll(pbm, patchI)
{
const polyPatch& pp = pbm[patchI];
if (!isA<emptyPolyPatch>(pp) && !pp.coupled())
{
label bFaceI = pp.start()-mesh().nInternalFaces();
forAll(pp, i)
{
boundaryIsPatchFace_[bFaceI] = true;
const face& f = boundary[bFaceI++];
forAll(f, fp)
{
isPatchPoint_[f[fp]] = true;
}
}
}
}
// Make sure point status is synchronised so even processor that holds
// no face of a certain patch still can have boundary points marked.
if (debug)
{
boolList oldData(isPatchPoint_);
mesh().globalData().syncPointData(isPatchPoint_, orEqOp<bool>());
forAll(isPatchPoint_, pointI)
{
if (isPatchPoint_[pointI] != oldData[pointI])
{
Pout<< "volPointInterpolation::calcBoundaryAddressing():"
<< " added dangling mesh point:" << pointI
<< " at:" << mesh().points()[pointI]
<< endl;
}
}
label nPatchFace = 0;
forAll(boundaryIsPatchFace_, i)
{
if (boundaryIsPatchFace_[i])
{
nPatchFace++;
}
}
label nPatchPoint = 0;
forAll(isPatchPoint_, i)
{
if (isPatchPoint_[i])
{
nPatchPoint++;
}
}
Pout<< "boundary:" << nl
<< " faces :" << boundary.size() << nl
<< " of which on proper patch:" << nPatchFace << nl
<< " points:" << boundary.nPoints() << nl
<< " of which on proper patch:" << nPatchPoint << endl;
}
}
void volPointInterpolation::makeInternalWeights(scalarField& sumWeights)
{
if (debug)
{
Pout<< "volPointInterpolation::makeInternalWeights() : "
<< "constructing weighting factors for internal and non-coupled"
<< " points." << endl;
}
const pointField& points = mesh().points();
const labelListList& pointCells = mesh().pointCells();
const vectorField& cellCentres = mesh().cellCentres();
@ -61,11 +160,91 @@ void volPointInterpolation::makeWeights()
pointWeights_.clear();
pointWeights_.setSize(points.size());
forAll(pointWeights_, pointi)
// Calculate inverse distances between cell centres and points
// and store in weighting factor array
forAll(points, pointi)
{
pointWeights_[pointi].setSize(pointCells[pointi].size());
if (!isPatchPoint_[pointi])
{
const labelList& pcp = pointCells[pointi];
scalarList& pw = pointWeights_[pointi];
pw.setSize(pcp.size());
forAll(pcp, pointCelli)
{
pw[pointCelli] =
1.0/mag(points[pointi] - cellCentres[pcp[pointCelli]]);
sumWeights[pointi] += pw[pointCelli];
}
}
}
}
void volPointInterpolation::makeBoundaryWeights(scalarField& sumWeights)
{
if (debug)
{
Pout<< "volPointInterpolation::makeBoundaryWeights() : "
<< "constructing weighting factors for boundary points." << endl;
}
const pointField& points = mesh().points();
const pointField& faceCentres = mesh().faceCentres();
const primitivePatch& boundary = boundaryPtr_();
boundaryPointWeights_.clear();
boundaryPointWeights_.setSize(boundary.meshPoints().size());
forAll(boundary.meshPoints(), i)
{
label pointI = boundary.meshPoints()[i];
if (isPatchPoint_[pointI])
{
const labelList& pFaces = boundary.pointFaces()[i];
scalarList& pw = boundaryPointWeights_[i];
pw.setSize(pFaces.size());
sumWeights[pointI] = 0.0;
forAll(pFaces, i)
{
if (boundaryIsPatchFace_[pFaces[i]])
{
label faceI = mesh().nInternalFaces() + pFaces[i];
pw[i] = 1.0/mag(points[pointI] - faceCentres[faceI]);
sumWeights[pointI] += pw[i];
}
else
{
pw[i] = 0.0;
}
}
}
}
}
void volPointInterpolation::makeWeights()
{
if (debug)
{
Pout<< "volPointInterpolation::makeWeights() : "
<< "constructing weighting factors"
<< endl;
}
// Update addressing over all boundary faces
calcBoundaryAddressing();
// Running sum of weights
pointScalarField sumWeights
(
IOobject
@ -78,60 +257,344 @@ void volPointInterpolation::makeWeights()
dimensionedScalar("zero", dimless, 0)
);
// Calculate inverse distances between cell centres and points
// and store in weighting factor array
forAll(points, pointi)
// Create internal weights; add to sumWeights
makeInternalWeights(sumWeights);
// Create boundary weights; add to sumWeights
makeBoundaryWeights(sumWeights);
//forAll(boundary.meshPoints(), i)
//{
// label pointI = boundary.meshPoints()[i];
//
// if (isPatchPoint_[pointI])
// {
// Pout<< "Calculated Weight at boundary point:" << i
// << " at:" << mesh().points()[pointI]
// << " sumWeight:" << sumWeights[pointI]
// << " from:" << boundaryPointWeights_[i]
// << endl;
// }
//}
// Sum collocated contributions
mesh().globalData().syncPointData(sumWeights, plusEqOp<scalar>());
// And add separated contributions
addSeparated(sumWeights);
// Push master data to slaves. It is possible (not sure how often) for
// a coupled point to have its master on a different patch so
// to make sure just push master data to slaves. Reuse the syncPointData
// structure.
mesh().globalData().syncPointData(sumWeights, nopEqOp<scalar>());
// Normalise internal weights
forAll(pointWeights_, pointI)
{
scalarList& pw = pointWeights_[pointi];
const labelList& pcp = pointCells[pointi];
forAll(pcp, pointCelli)
scalarList& pw = pointWeights_[pointI];
// Note:pw only sized for !isPatchPoint
forAll(pw, i)
{
pw[pointCelli] =
1.0/mag(points[pointi] - cellCentres[pcp[pointCelli]]);
sumWeights[pointi] += pw[pointCelli];
pw[i] /= sumWeights[pointI];
}
}
forAll(sumWeights.boundaryField(), patchi)
// Normalise boundary weights
const primitivePatch& boundary = boundaryPtr_();
forAll(boundary.meshPoints(), i)
{
if (sumWeights.boundaryField()[patchi].coupled())
label pointI = boundary.meshPoints()[i];
scalarList& pw = boundaryPointWeights_[i];
// Note:pw only sized for isPatchPoint
forAll(pw, i)
{
refCast<coupledPointPatchScalarField>
(sumWeights.boundaryField()[patchi]).initSwapAdd
(
sumWeights.internalField()
);
pw[i] /= sumWeights[pointI];
}
}
forAll(sumWeights.boundaryField(), patchi)
if (debug)
{
if (sumWeights.boundaryField()[patchi].coupled())
{
refCast<coupledPointPatchScalarField>
(sumWeights.boundaryField()[patchi]).swapAdd
(
sumWeights.internalField()
);
}
Pout<< "volPointInterpolation::makeWeights() : "
<< "finished constructing weighting factors"
<< endl;
}
}
void volPointInterpolation::makePatchPatchAddressing()
{
if (debug)
{
Pout<< "volPointInterpolation::makePatchPatchAddressing() : "
<< "constructing boundary addressing"
<< endl;
}
forAll(points, pointi)
{
scalarList& pw = pointWeights_[pointi];
const fvBoundaryMesh& bm = mesh().boundary();
const pointBoundaryMesh& pbm = pointMesh::New(mesh()).boundary();
forAll(pw, pointCelli)
// first count the total number of patch-patch points
label nPatchPatchPoints = 0;
forAll(bm, patchi)
{
if (!isA<emptyFvPatch>(bm[patchi]) && !bm[patchi].coupled())
{
pw[pointCelli] /= sumWeights[pointi];
nPatchPatchPoints += bm[patchi].patch().boundaryPoints().size();
if (debug)
{
Pout<< "On patch:" << bm[patchi].patch()
<< " nBoundaryPoints:"
<< bm[patchi].patch().boundaryPoints().size() << endl;
}
}
}
if (debug)
{
Info<< "volPointInterpolation::makeWeights() : "
<< "finished constructing weighting factors"
Pout<< "Found nPatchPatchPoints:" << nPatchPatchPoints << endl;
}
// Go through all patches and mark up the external edge points
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// From meshpoint to index in patchPatchPointConstraints.
Map<label> patchPatchPointSet(2*nPatchPatchPoints);
// Constraints (initialised to unconstrained)
List<pointConstraint> patchPatchPointConstraints(nPatchPatchPoints);
// From constraint index to mesh point
labelList patchPatchPoints(nPatchPatchPoints);
label pppi = 0;
forAll(bm, patchi)
{
if (!isA<emptyFvPatch>(bm[patchi]) && !bm[patchi].coupled())
{
const labelList& bp = bm[patchi].patch().boundaryPoints();
const labelList& meshPoints = bm[patchi].patch().meshPoints();
forAll(bp, pointi)
{
label ppp = meshPoints[bp[pointi]];
Map<label>::iterator iter = patchPatchPointSet.find(ppp);
label constraintI = -1;
if (iter == patchPatchPointSet.end())
{
patchPatchPointSet.insert(ppp, pppi);
patchPatchPoints[pppi] = ppp;
constraintI = pppi++;
}
else
{
constraintI = iter();
}
// Apply to patch constraints
pbm[patchi].applyConstraint
(
bp[pointi],
patchPatchPointConstraints[constraintI]
);
}
}
}
if (debug)
{
Pout<< "Have (local) constrained points:"
<< nPatchPatchPoints << endl;
}
// Extend set with constraints across coupled points
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
{
const globalMeshData& gd = mesh().globalData();
const labelListList& globalPointSlaves = gd.globalPointSlaves();
const mapDistribute& globalPointSlavesMap = gd.globalPointSlavesMap();
const Map<label>& cpPointMap = gd.coupledPatch().meshPointMap();
const labelList& cpMeshPoints = gd.coupledPatch().meshPoints();
// Constraints on coupled points
List<pointConstraint> constraints
(
globalPointSlavesMap.constructSize()
);
// Copy from patchPatch constraints into coupledConstraints.
forAll(bm, patchi)
{
if (!isA<emptyFvPatch>(bm[patchi]) && !bm[patchi].coupled())
{
const labelList& bp = bm[patchi].patch().boundaryPoints();
const labelList& meshPoints = bm[patchi].patch().meshPoints();
forAll(bp, pointi)
{
label ppp = meshPoints[bp[pointi]];
Map<label>::const_iterator fnd = cpPointMap.find(ppp);
if (fnd != cpPointMap.end())
{
// Can just copy (instead of apply) constraint
// will already be consistent across multiple patches.
constraints[fnd()] = patchPatchPointConstraints
[
patchPatchPointSet[ppp]
];
}
}
}
}
// Exchange data
globalPointSlavesMap.distribute(constraints);
// Combine master with slave constraints
forAll(globalPointSlaves, pointI)
{
const labelList& slaves = globalPointSlaves[pointI];
// Combine master constraint with slave constraints
forAll(slaves, i)
{
constraints[pointI].combine(constraints[slaves[i]]);
}
// Duplicate master constraint into slave slots
forAll(slaves, i)
{
constraints[slaves[i]] = constraints[pointI];
}
}
// Send back
globalPointSlavesMap.reverseDistribute
(
cpMeshPoints.size(),
constraints
);
// Add back into patchPatch constraints
forAll(constraints, coupledPointI)
{
if (constraints[coupledPointI].first() != 0)
{
label meshPointI = cpMeshPoints[coupledPointI];
Map<label>::iterator iter = patchPatchPointSet.find(meshPointI);
label constraintI = -1;
if (iter == patchPatchPointSet.end())
{
//Pout<< "on meshpoint:" << meshPointI
// << " coupled:" << coupledPointI
// << " at:" << mesh().points()[meshPointI]
// << " have new constraint:"
// << constraints[coupledPointI]
// << endl;
// Allocate new constraint
if (patchPatchPoints.size() <= pppi)
{
patchPatchPoints.setSize(pppi+100);
}
patchPatchPointSet.insert(meshPointI, pppi);
patchPatchPoints[pppi] = meshPointI;
constraintI = pppi++;
}
else
{
//Pout<< "on meshpoint:" << meshPointI
// << " coupled:" << coupledPointI
// << " at:" << mesh().points()[meshPointI]
// << " have possibly extended constraint:"
// << constraints[coupledPointI]
// << endl;
constraintI = iter();
}
// Combine (new or existing) constraint with one
// on coupled.
patchPatchPointConstraints[constraintI].combine
(
constraints[coupledPointI]
);
}
}
}
nPatchPatchPoints = pppi;
patchPatchPoints.setSize(nPatchPatchPoints);
patchPatchPointConstraints.setSize(nPatchPatchPoints);
if (debug)
{
Pout<< "Have (global) constrained points:"
<< nPatchPatchPoints << endl;
}
// Copy out all non-trivial constraints
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patchPatchPointConstraintPoints_.setSize(nPatchPatchPoints);
patchPatchPointConstraintTensors_.setSize(nPatchPatchPoints);
label nConstraints = 0;
forAll(patchPatchPointConstraints, i)
{
if (patchPatchPointConstraints[i].first() != 0)
{
patchPatchPointConstraintPoints_[nConstraints] =
patchPatchPoints[i];
patchPatchPointConstraintTensors_[nConstraints] =
patchPatchPointConstraints[i].constraintTransformation();
nConstraints++;
}
}
if (debug)
{
Pout<< "Have non-trivial constrained points:"
<< nConstraints << endl;
}
patchPatchPointConstraintPoints_.setSize(nConstraints);
patchPatchPointConstraintTensors_.setSize(nConstraints);
if (debug)
{
Pout<< "volPointInterpolation::makePatchPatchAddressing() : "
<< "finished constructing boundary addressing"
<< endl;
}
}
@ -141,8 +604,7 @@ void volPointInterpolation::makeWeights()
volPointInterpolation::volPointInterpolation(const fvMesh& vm)
:
MeshObject<fvMesh, volPointInterpolation>(vm),
boundaryInterpolator_(vm)
MeshObject<fvMesh, volPointInterpolation>(vm)
{
updateMesh();
}
@ -159,19 +621,27 @@ volPointInterpolation::~volPointInterpolation()
void volPointInterpolation::updateMesh()
{
makeWeights();
boundaryInterpolator_.updateMesh();
}
bool volPointInterpolation::movePoints()
{
makeWeights();
boundaryInterpolator_.movePoints();
return true;
}
// Specialisaion of applyCornerConstraints for scalars because
// no constraint need be applied
template<>
void volPointInterpolation::applyCornerConstraints<scalar>
(
GeometricField<scalar, pointPatchField, pointMesh>& pf
) const
{}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam

View File

@ -38,7 +38,9 @@ SourceFiles
#define volPointInterpolation_H
#include "MeshObject.H"
#include "pointPatchInterpolation.H"
#include "scalarList.H"
#include "volFields.H"
#include "pointFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -58,18 +60,80 @@ class volPointInterpolation
{
// Private data
//- Boundary interpolation engine.
pointPatchInterpolation boundaryInterpolator_;
//- Interpolation scheme weighting factor array.
scalarListList pointWeights_;
// Boundary handling
//- Boundary addressing
autoPtr<primitivePatch> boundaryPtr_;
//- Per boundary face whether is on non-coupled patch
boolList boundaryIsPatchFace_;
//- Per mesh(!) point whether is on non-coupled patch (on any
// processor)
boolList isPatchPoint_;
//- Per boundary point the weights per pointFaces.
scalarListList boundaryPointWeights_;
// Patch-patch constraints
//- Mesh points on which to apply special constraints
labelList patchPatchPointConstraintPoints_;
//- Special constraints
tensorField patchPatchPointConstraintTensors_;
// Private member functions
//- Construct point weighting factors
//- Construct addressing over all boundary faces
void calcBoundaryAddressing();
//- Make weights for internal and coupled-only boundarypoints
void makeInternalWeights(scalarField& sumWeights);
//- Make weights for points on uncoupled patches
void makeBoundaryWeights(scalarField& sumWeights);
//- Construct all point weighting factors
void makeWeights();
//- Make patch-patch constraints
void makePatchPatchAddressing();
//- Get boundary field in same order as boundary faces. Field is
// zero on all coupled and empty patches
template<class Type>
tmp<Field<Type> > flatBoundaryField
(
const GeometricField<Type, fvPatchField, volMesh>& vf
) const;
template<class Type>
void interpolateBoundaryField
(
const GeometricField<Type, fvPatchField, volMesh>& vf,
GeometricField<Type, pointPatchField, pointMesh>& pf,
const bool overrideFixedValue
) const;
template<class Type>
void applyCornerConstraints
(
GeometricField<Type, pointPatchField, pointMesh>& pf
) const;
//- Add separated contributions
template<class Type>
void addSeparated
(
GeometricField<Type, pointPatchField, pointMesh>&
) const;
//- Disallow default bitwise copy construct
volPointInterpolation(const volPointInterpolation&);
@ -96,14 +160,6 @@ public:
// Member functions
// Access
const fvMesh& mesh() const
{
return boundaryInterpolator_.mesh();
}
// Edit
//- Update mesh topology using the morph engine
@ -169,6 +225,13 @@ public:
};
template<>
void volPointInterpolation::applyCornerConstraints<scalar>
(
GeometricField<scalar, pointPatchField, pointMesh>& pf
) const;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam

View File

@ -151,6 +151,34 @@ displacementComponentLaplacianFvMotionSolver
: -1
)
{
if (points0_.size() != mesh.nPoints())
{
FatalErrorIn
(
"displacementComponentLaplacianFvMotionSolver::"
"displacementComponentLaplacianFvMotionSolver\n"
"(\n"
" const polyMesh&,\n"
" Istream&\n"
")"
) << "Number of points in mesh " << mesh.nPoints()
<< " differs from number of points " << points0_.size()
<< " read from file "
<<
IOobject
(
"points",
mesh.time().constant(),
polyMesh::meshSubDir,
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
).filePath()
<< exit(FatalError);
}
IOobject io
(
"pointLocation",

View File

@ -247,7 +247,7 @@ bool Foam::parcel::move(spray& sDB)
{
oMass[i] = m()*oYf[i];
label j = sDB.liquidToGasIndex()[i];
oHg += oYf[i]*sDB.gasProperties()[j].H(T());
oHg += oYf[i]*sDB.gasProperties()[j].Hs(T());
}
vector oMom = m()*U();
@ -273,7 +273,7 @@ bool Foam::parcel::move(spray& sDB)
{
nMass[i] = m()*nYf[i];
label j = sDB.liquidToGasIndex()[i];
nHg += nYf[i]*sDB.gasProperties()[j].H(T());
nHg += nYf[i]*sDB.gasProperties()[j].Hs(T());
}
vector nMom = m()*U();
@ -286,11 +286,9 @@ bool Foam::parcel::move(spray& sDB)
{
sDB.srhos()[i][celli] += oMass[i] - nMass[i];
}
sDB.sms()[celli] += oMom - nMom;
sDB.sms()[celli] += oMom - nMom;
sDB.shs()[celli] +=
oTotMass*(oH + oPE)
- m()*(nH + nPE);
sDB.shs()[celli] += oTotMass*(oH + oPE) - m()*(nH + nPE);
// Remove evaporated mass from stripped mass
ms() -= ms()*(oTotMass-m())/oTotMass;
@ -446,7 +444,7 @@ void Foam::parcel::updateParcelProperties
for (label i=0; i<Nf; i++)
{
label j = sDB.liquidToGasIndex()[i];
oldhg += Yf0[i]*sDB.gasProperties()[j].H(T());
oldhg += Yf0[i]*sDB.gasProperties()[j].Hs(T());
}
scalar oldhv = fuels.hl(pg, T(), X());
@ -478,7 +476,7 @@ void Foam::parcel::updateParcelProperties
for (label i=0; i<Nf; i++)
{
label j = sDB.liquidToGasIndex()[i];
newhg += Ynew[i]*sDB.gasProperties()[j].H(Tnew);
newhg += Ynew[i]*sDB.gasProperties()[j].Hs(Tnew);
}
newhv = fuels.hl(pg, Tnew, X());
@ -616,7 +614,8 @@ void Foam::parcel::updateParcelProperties
{
if (n>100)
{
Info<< "n = " << n << ", T = " << Td << ", pv = " << pAtSurface << endl;
Info<< "n = " << n << ", T = " << Td << ", pv = "
<< pAtSurface << endl;
}
}
}

View File

@ -185,7 +185,8 @@ public:
//- Return the names of the liquid components
inline const List<word>& liquidNames() const;
//- Return the names of the liquid fuel components - identical with liquidNames
//- Return the names of the liquid fuel components
// - identical with liquidNames
inline const List<word>& fuelNames() const;
//- Return diameter of droplets in parcel

View File

@ -260,6 +260,9 @@ void Foam::KinematicCloud<ParcelType>::evolve()
evolveCloud();
postEvolve();
info();
Info<< endl;
}
}

View File

@ -272,6 +272,9 @@ void Foam::ReactingCloud<ParcelType>::evolve()
evolveCloud();
postEvolve();
info();
Info<< endl;
}
}

View File

@ -228,6 +228,9 @@ void Foam::ReactingMultiphaseCloud<ParcelType>::evolve()
evolveCloud();
postEvolve();
info();
Info<< endl;
}
}

View File

@ -160,20 +160,6 @@ Foam::ThermoCloud<ParcelType>::ThermoCloud
),
this->mesh(),
dimensionedScalar("zero", dimEnergy, 0.0)
),
hcTrans_
(
IOobject
(
this->name() + "hcTrans",
this->db().time().timeName(),
this->db(),
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
this->mesh(),
dimensionedScalar("zero", dimEnergy, 0.0)
)
{
if (readFields)
@ -220,7 +206,6 @@ void Foam::ThermoCloud<ParcelType>::resetSourceTerms()
{
KinematicCloud<ParcelType>::resetSourceTerms();
hsTrans_.field() = 0.0;
hcTrans_.field() = 0.0;
}
@ -234,6 +219,9 @@ void Foam::ThermoCloud<ParcelType>::evolve()
evolveCloud();
postEvolve();
info();
Info<< endl;
}
}

View File

@ -108,15 +108,9 @@ protected:
// Sources
//- Sensible enthalpy transfer
//- Sensible enthalpy transfer [J/kg]
DimensionedField<scalar, volMesh> hsTrans_;
//- Chemical enthalpy transfer
// - If solving for total enthalpy, the carrier phase enthalpy will
// receive the full enthalpy of reaction via creation of reaction
// products
DimensionedField<scalar, volMesh> hcTrans_;
// Protected member functions
@ -194,19 +188,10 @@ public:
// Enthalpy
//- Return reference to sensible enthalpy source
//- Sensible enthalpy transfer [J/kg]
inline DimensionedField<scalar, volMesh>& hsTrans();
//- Return tmp total sensible enthalpy source term
inline tmp<DimensionedField<scalar, volMesh> > Shs() const;
//- Return reference to chemical enthalpy source
inline DimensionedField<scalar, volMesh>& hcTrans();
//- Return tmp chemical enthalpy source term
inline tmp<DimensionedField<scalar, volMesh> > Shc() const;
//- Return tmp total enthalpy source term
//- Return enthalpy source [J/kg/m3/s]
inline tmp<DimensionedField<scalar, volMesh> > Sh() const;

View File

@ -85,82 +85,6 @@ Foam::ThermoCloud<ParcelType>::hsTrans()
}
template<class ParcelType>
inline Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >
Foam::ThermoCloud<ParcelType>::Shs() const
{
tmp<DimensionedField<scalar, volMesh> > tShs
(
new DimensionedField<scalar, volMesh>
(
IOobject
(
this->name() + "Shs",
this->db().time().timeName(),
this->mesh(),
IOobject::NO_READ,
IOobject::AUTO_WRITE,
false
),
this->mesh(),
dimensionedScalar
(
"zero",
dimMass/dimLength/pow3(dimTime),
0.0
)
)
);
scalarField& Shs = tShs().field();
Shs = hsTrans_/(this->mesh().V()*this->db().time().deltaT());
return tShs;
}
template<class ParcelType>
inline Foam::DimensionedField<Foam::scalar, Foam::volMesh>&
Foam::ThermoCloud<ParcelType>::hcTrans()
{
return hcTrans_;
}
template<class ParcelType>
inline Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >
Foam::ThermoCloud<ParcelType>::Shc() const
{
tmp<DimensionedField<scalar, volMesh> > tShc
(
new DimensionedField<scalar, volMesh>
(
IOobject
(
this->name() + "Shc",
this->db().time().timeName(),
this->mesh(),
IOobject::NO_READ,
IOobject::AUTO_WRITE,
false
),
this->mesh(),
dimensionedScalar
(
"zero",
dimMass/dimLength/pow3(dimTime),
0.0
)
)
);
scalarField& Shc = tShc().field();
Shc = hcTrans_/(this->mesh().V()*this->db().time().deltaT());
return tShc;
}
template<class ParcelType>
inline Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >
Foam::ThermoCloud<ParcelType>::Sh() const
@ -178,19 +102,10 @@ Foam::ThermoCloud<ParcelType>::Sh() const
IOobject::AUTO_WRITE,
false
),
this->mesh(),
dimensionedScalar
(
"zero",
dimMass/dimLength/pow3(dimTime),
0.0
)
hsTrans_/(this->mesh().V()*this->db().time().deltaT())
)
);
scalarField& Sh = tSh().field();
Sh = (hsTrans_ + hcTrans_)/(this->mesh().V()*this->db().time().deltaT());
return tSh;
}
@ -205,7 +120,7 @@ Foam::ThermoCloud<ParcelType>::Ep() const
(
IOobject
(
this->name() + "radiationEp",
this->name() + "radiation::Ep",
this->db().time().timeName(),
this->db(),
IOobject::NO_READ,
@ -248,7 +163,7 @@ Foam::ThermoCloud<ParcelType>::ap() const
(
IOobject
(
this->name() + "radiationAp",
this->name() + "radiation::ap",
this->db().time().timeName(),
this->db(),
IOobject::NO_READ,
@ -291,7 +206,7 @@ Foam::ThermoCloud<ParcelType>::sigmap() const
(
IOobject
(
this->name() + "radiationSigmap",
this->name() + "radiation::sigmap",
this->db().time().timeName(),
this->db(),
IOobject::NO_READ,

View File

@ -267,7 +267,6 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc
YLiquid_,
dMassPC,
Sh,
dhsTrans,
Ne,
NCpW,
Cs
@ -296,7 +295,6 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc
canCombust_,
dMassDV,
Sh,
dhsTrans,
Ne,
NCpW,
Cs
@ -398,19 +396,11 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc
{
label gid = td.cloud().composition().localToGlobalCarrierId(GAS, i);
td.cloud().rhoTrans(gid)[cellI] += np0*dMassGas[i];
td.cloud().hcTrans()[cellI] +=
np0
*dMassGas[i]
*td.cloud().mcCarrierThermo().speciesData()[gid].Hc();
}
forAll(YLiquid_, i)
{
label gid = td.cloud().composition().localToGlobalCarrierId(LIQ, i);
td.cloud().rhoTrans(gid)[cellI] += np0*dMassLiquid[i];
td.cloud().hcTrans()[cellI] +=
np0
*dMassLiquid[i]
*td.cloud().mcCarrierThermo().speciesData()[gid].Hc();
}
/*
// No mapping between solid components and carrier phase
@ -418,19 +408,11 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc
{
label gid = td.cloud().composition().localToGlobalCarrierId(SLD, i);
td.cloud().rhoTrans(gid)[cellI] += np0*dMassSolid[i];
td.cloud().hcTrans()[cellI] +=
np0
*dMassSolid[i]
*td.cloud().mcCarrierThermo().speciesData()[gid].Hc();
}
*/
forAll(dMassSRCarrier, i)
{
td.cloud().rhoTrans(i)[cellI] += np0*dMassSRCarrier[i];
td.cloud().hcTrans()[cellI] +=
np0
*dMassSRCarrier[i]
*td.cloud().mcCarrierThermo().speciesData()[i].Hc();
}
// Update momentum transfer
@ -476,7 +458,7 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc
*/
td.cloud().UTrans()[cellI] += np0*mass1*U1;
td.cloud().hsTrans()[cellI] +=
np0*mass1*HEff(td, pc, T1, idG, idL, idS);
np0*mass1*HEff(td, pc, T1, idG, idL, idS); // using total h
}
}
@ -520,7 +502,6 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calcDevolatilisation
bool& canCombust,
scalarField& dMassDV,
scalar& Sh,
scalar& dhsTrans,
scalar& N,
scalar& NCpW,
scalarField& Cs

View File

@ -238,7 +238,6 @@ protected:
bool& canCombust, // 'can combust' flag
scalarField& dMassDV, // mass transfer - local to particle
scalar& Sh, // explicit particle enthalpy source
scalar& dhsTrans, // sensible enthalpy transfer to carrier
scalar& N, // flux of species emitted from particle
scalar& NCpW, // sum of N*Cp*W of emission species
scalarField& Cs // carrier conc. of emission species

View File

@ -287,7 +287,6 @@ void Foam::ReactingParcel<ParcelType>::calc
Y_,
dMassPC,
Sh,
dhsTrans,
Ne,
NCpW,
Cs
@ -341,10 +340,6 @@ void Foam::ReactingParcel<ParcelType>::calc
{
label gid = td.cloud().composition().localToGlobalCarrierId(0, i);
td.cloud().rhoTrans(gid)[cellI] += np0*dMassPC[i];
td.cloud().hcTrans()[cellI] +=
np0
*dMassPC[i]
*td.cloud().mcCarrierThermo().speciesData()[gid].Hc();
}
// Update momentum transfer
@ -371,7 +366,7 @@ void Foam::ReactingParcel<ParcelType>::calc
td.cloud().rhoTrans(gid)[cellI] += np0*mass1*Y_[i];
}
td.cloud().UTrans()[cellI] += np0*mass1*U1;
td.cloud().hcTrans()[cellI] +=
td.cloud().hsTrans()[cellI] +=
np0*mass1*td.cloud().composition().H(0, Y_, pc_, T1);
}
}
@ -417,7 +412,6 @@ void Foam::ReactingParcel<ParcelType>::calcPhaseChange
const scalarField& YComponents,
scalarField& dMassPC,
scalar& Sh,
scalar& dhsTrans, // TODO: not used
scalar& N,
scalar& NCpW,
scalarField& Cs
@ -469,6 +463,7 @@ void Foam::ReactingParcel<ParcelType>::calcPhaseChange
td.cloud().composition().localToGlobalCarrierId(idPhase, i);
const label idl = td.cloud().composition().globalIds(idPhase)[i];
// Calculate enthalpy transfer
if
(
td.cloud().phaseChange().enthalpyTransfer()

View File

@ -209,7 +209,6 @@ protected:
const scalarField& YComponents, // component mass fractions
scalarField& dMassPC, // mass transfer - local to particle
scalar& Sh, // explicit particle enthalpy source
scalar& dhsTrans, // sensible enthalpy transfer to carrier
scalar& N, // flux of species emitted from particle
scalar& NCpW, // sum of N*Cp*W of emission species
scalarField& Cs // carrier conc. of emission species

View File

@ -410,6 +410,130 @@ Foam::scalar Foam::CompositionModel<CloudType>::H
}
template<class CloudType>
Foam::scalar Foam::CompositionModel<CloudType>::Hs
(
const label phaseI,
const scalarField& Y,
const scalar p,
const scalar T
) const
{
const phaseProperties& props = phaseProps_[phaseI];
scalar HsMixture = 0.0;
switch (props.phase())
{
case phaseProperties::GAS:
{
forAll(Y, i)
{
label gid = props.globalIds()[i];
HsMixture += Y[i]*mcCarrierThermo_.speciesData()[gid].Hs(T);
}
break;
}
case phaseProperties::LIQUID:
{
forAll(Y, i)
{
label gid = props.globalIds()[i];
HsMixture +=
Y[i]
*(
this->liquids().properties()[gid].h(p, T)
- this->liquids().properties()[gid].h(p, 298.25)
);
}
break;
}
case phaseProperties::SOLID:
{
forAll(Y, i)
{
label gid = props.globalIds()[i];
HsMixture += Y[i]*this->solids().properties()[gid].cp()*T;
}
break;
}
default:
{
FatalErrorIn
(
"Foam::scalar Foam::CompositionModel<CloudType>::Hs"
"("
" const label, "
" const scalarField&, "
" const scalar, "
" const scalar"
") const"
) << "Unknown phase enumeration" << nl << abort(FatalError);
}
}
return HsMixture;
}
template<class CloudType>
Foam::scalar Foam::CompositionModel<CloudType>::Hc
(
const label phaseI,
const scalarField& Y,
const scalar p,
const scalar T
) const
{
const phaseProperties& props = phaseProps_[phaseI];
scalar HcMixture = 0.0;
switch (props.phase())
{
case phaseProperties::GAS:
{
forAll(Y, i)
{
label gid = props.globalIds()[i];
HcMixture += Y[i]*mcCarrierThermo_.speciesData()[gid].Hc();
}
break;
}
case phaseProperties::LIQUID:
{
forAll(Y, i)
{
label gid = props.globalIds()[i];
HcMixture +=
Y[i]*this->liquids().properties()[gid].h(p, 298.15);
}
break;
}
case phaseProperties::SOLID:
{
forAll(Y, i)
{
label gid = props.globalIds()[i];
HcMixture += Y[i]*this->solids().properties()[gid].Hf();
}
break;
}
default:
{
FatalErrorIn
(
"Foam::scalar Foam::CompositionModel<CloudType>::Hc"
"("
" const label, "
" const scalarField&, "
" const scalar, "
" const scalar"
") const"
) << "Unknown phase enumeration" << nl << abort(FatalError);
}
}
return HcMixture;
}
template<class CloudType>
Foam::scalar Foam::CompositionModel<CloudType>::cp
(

View File

@ -226,7 +226,7 @@ public:
// Evaluation
//- Return enthalpy for the phase phaseI
//- Return total enthalpy for the phase phaseI
virtual scalar H
(
const label phaseI,
@ -235,6 +235,24 @@ public:
const scalar T
) const;
//- Return sensible enthalpy for the phase phaseI
virtual scalar Hs
(
const label phaseI,
const scalarField& Y,
const scalar p,
const scalar T
) const;
//- Return chemical enthalpy for the phase phaseI
virtual scalar Hc
(
const label phaseI,
const scalarField& Y,
const scalar p,
const scalar T
) const;
//- Return specific heat caoacity for the phase phaseI
virtual scalar cp
(

View File

@ -44,7 +44,6 @@ License
#include "pointFields.H"
#include "slipPointPatchFields.H"
#include "fixedValuePointPatchFields.H"
#include "globalPointPatchFields.H"
#include "calculatedPointPatchFields.H"
#include "processorPointPatch.H"
#include "globalIndex.H"
@ -1409,11 +1408,7 @@ Foam::tmp<Foam::pointVectorField> Foam::meshRefinement::makeDisplacementField
forAll(pointPatches, patchI)
{
if (isA<globalPointPatch>(pointPatches[patchI]))
{
patchFieldTypes[patchI] = globalPointPatchVectorField::typeName;
}
else if (isA<processorPointPatch>(pointPatches[patchI]))
if (isA<processorPointPatch>(pointPatches[patchI]))
{
patchFieldTypes[patchI] = calculatedPointPatchVectorField::typeName;
}

View File

@ -65,6 +65,7 @@ Deprecated
Specifying the local vectors as an @c axis (corresponding to e3) and a
@c direction (corresponding to e1), is allowed for backwards
compatibility, but this terminology is generally a bit confusing.
(deprecated Apr 2008)
\*---------------------------------------------------------------------------*/

View File

@ -365,14 +365,14 @@ public:
}
//- Return axis (e3: local Cartesian z-axis)
// @deprecated method e3 is preferred
// @deprecated method e3 is preferred (deprecated Apr 2008)
const vector& axis() const
{
return Rtr_.z();
}
//- Return direction (e1: local Cartesian x-axis)
// @deprecated method e1 is preferred
// @deprecated method e1 is preferred (deprecated Apr 2008)
const vector& direction() const
{
return Rtr_.x();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -411,9 +411,8 @@ Foam::booleanSurface::booleanSurface
Pout<< "booleanSurface : Generated cutSurf1: " << endl;
cutSurf1.writeStats(Pout);
Pout<< "Writing to file cutSurf1.ftr" << endl;
OFstream cutSurf1Stream("cutSurf1.ftr");
cutSurf1.write(cutSurf1Stream);
Pout<< "Writing to file cutSurf1.obj" << endl;
cutSurf1.write("cutSurf1.obj");
}
if (debug)
@ -430,9 +429,8 @@ Foam::booleanSurface::booleanSurface
Pout<< "booleanSurface : Generated cutSurf2: " << endl;
cutSurf2.writeStats(Pout);
Pout<< "Writing to file cutSurf2.ftr" << endl;
OFstream cutSurf2Stream("cutSurf2.ftr");
cutSurf2.write(cutSurf2Stream);
Pout<< "Writing to file cutSurf2.obj" << endl;
cutSurf2.write("cutSurf2.obj");
}
@ -768,9 +766,8 @@ Foam::booleanSurface::booleanSurface
Pout<< "booleanSurface : Generated cutSurf1: " << endl;
cutSurf1.writeStats(Pout);
Pout<< "Writing to file cutSurf1.ftr" << endl;
OFstream cutSurf1Stream("cutSurf1.ftr");
cutSurf1.write(cutSurf1Stream);
Pout<< "Writing to file cutSurf1.obj" << endl;
cutSurf1.write("cutSurf1.obj");
}
@ -792,9 +789,8 @@ Foam::booleanSurface::booleanSurface
Pout<< "booleanSurface : Generated cutSurf2: " << endl;
cutSurf2.writeStats(Pout);
Pout<< "Writing to file cutSurf2.ftr" << endl;
OFstream cutSurf2Stream("cutSurf2.ftr");
cutSurf2.write(cutSurf2Stream);
Pout<< "Writing to file cutSurf2.obj" << endl;
cutSurf2.write("cutSurf2.obj");
}
@ -920,9 +916,8 @@ Foam::booleanSurface::booleanSurface
Pout<< "booleanSurface : Generated combinedSurf: " << endl;
combinedSurf.writeStats(Pout);
Pout<< "Writing to file combinedSurf.ftr" << endl;
OFstream combinedSurfStream("combinedSurf.ftr");
combinedSurf.write(combinedSurfStream);
Pout<< "Writing to file combinedSurf.obj" << endl;
combinedSurf.write("combinedSurf.obj");
}

View File

@ -138,7 +138,11 @@ public:
//- Reconstruct and write all fields
template<class Type>
void reconstructFields(const IOobjectList& objects);
void reconstructFields
(
const IOobjectList& objects,
const HashSet<word>& selectedFields
);
};

View File

@ -143,7 +143,8 @@ Foam::pointFieldReconstructor::reconstructField(const IOobject& fieldIoObject)
template<class Type>
void Foam::pointFieldReconstructor::reconstructFields
(
const IOobjectList& objects
const IOobjectList& objects,
const HashSet<word>& selectedFields
)
{
word fieldClassName
@ -157,16 +158,18 @@ void Foam::pointFieldReconstructor::reconstructFields
{
Info<< " Reconstructing " << fieldClassName << "s\n" << endl;
for
(
IOobjectList::iterator fieldIter = fields.begin();
fieldIter != fields.end();
++fieldIter
)
forAllConstIter(IOobjectList, fields, fieldIter)
{
Info<< " " << fieldIter()->name() << endl;
if
(
!selectedFields.size()
|| selectedFields.found(fieldIter()->name())
)
{
Info<< " " << fieldIter()->name() << endl;
reconstructField<Type>(*fieldIter())().write();
reconstructField<Type>(*fieldIter())().write();
}
}
Info<< endl;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -213,8 +213,8 @@ void Foam::calcTypes::addSubtract::preCalc
const fvMesh& mesh
)
{
baseFieldName_ = args.additionalArgs()[1];
word calcModeName = args.additionalArgs()[2];
baseFieldName_ = args[2];
const word calcModeName = args[3];
if (calcModeName == "add")
{
@ -232,14 +232,12 @@ void Foam::calcTypes::addSubtract::preCalc
<< exit(FatalError);
}
if (args.optionFound("field"))
if (args.optionReadIfPresent("field", addSubtractFieldName_))
{
addSubtractFieldName_ = args.option("field");
calcType_ = FIELD;
}
else if (args.optionFound("value"))
else if (args.optionReadIfPresent("value", addSubtractValueStr_))
{
addSubtractValueStr_ = args.option("value");
calcType_ = VALUE;
}
else
@ -249,10 +247,7 @@ void Foam::calcTypes::addSubtract::preCalc
<< nl << exit(FatalError);
}
if (args.optionFound("resultName"))
{
resultName_ = args.option("resultName");
}
args.optionReadIfPresent("resultName", resultName_);
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -78,7 +78,7 @@ void Foam::calcTypes::components::calc
const fvMesh& mesh
)
{
const word& fieldName = args.additionalArgs()[1];
const word fieldName = args[2];
IOobject fieldHeader
(

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -78,7 +78,7 @@ void Foam::calcTypes::div::calc
const fvMesh& mesh
)
{
const word& fieldName = args.additionalArgs()[1];
const word fieldName = args[2];
IOobject fieldHeader
(

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -78,7 +78,7 @@ void Foam::calcTypes::interpolate::calc
const fvMesh& mesh
)
{
const word& fieldName = args.additionalArgs()[1];
const word fieldName = args[2];
IOobject fieldHeader
(

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -78,7 +78,7 @@ void Foam::calcTypes::mag::calc
const fvMesh& mesh
)
{
const word& fieldName = args.additionalArgs()[1];
const word fieldName = args[2];
IOobject fieldHeader
(

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -78,7 +78,7 @@ void Foam::calcTypes::magGrad::calc
const fvMesh& mesh
)
{
const word& fieldName = args.additionalArgs()[1];
const word fieldName = args[2];
IOobject fieldHeader
(

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -78,7 +78,7 @@ void Foam::calcTypes::magSqr::calc
const fvMesh& mesh
)
{
const word& fieldName = args.additionalArgs()[1];
const word fieldName = args[2];
IOobject fieldHeader
(

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -79,9 +79,8 @@ void Foam::calcTypes::randomise::calc
const fvMesh& mesh
)
{
const stringList& params = args.additionalArgs();
const scalar pertMag = readScalar(IStringStream(params[1])());
const word& fieldName = params[2];
const scalar pertMag = args.argRead<scalar>(2);
const word fieldName = args[3];
Random rand(1234567);

View File

@ -29,6 +29,9 @@ Description
Reading of the (now deprecated and infrequently used)
Foam Trisurface Format.
Deprecated
Other formats are better. (deprecated Mar 2009)
SourceFiles
FTRsurfaceFormat.C

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -225,9 +225,9 @@ void Foam::fileFormats::OBJsurfaceFormat<Face>::write
// for no zones, suppress the group name
const List<surfZone>& zones =
(
surf.surfZones().size() > 1
? surf.surfZones()
: oneZone(faceLst, "")
surf.surfZones().empty()
? oneZone(faceLst, "")
: surf.surfZones()
);
const bool useFaceMap = (surf.useFaceMap() && zones.size() > 1);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -52,9 +52,9 @@ void Foam::fileFormats::SMESHsurfaceFormat<Face>::write
const List<surfZone>& zones =
(
surf.surfZones().size() > 1
? surf.surfZones()
: oneZone(faceLst)
surf.surfZones().empty()
? oneZone(faceLst)
: surf.surfZones()
);
const bool useFaceMap = (surf.useFaceMap() && zones.size() > 1);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -256,9 +256,9 @@ void Foam::fileFormats::STARCDsurfaceFormat<Face>::write
const List<surfZone>& zones =
(
surf.surfZones().size() > 1
? surf.surfZones()
: oneZone(faceLst)
surf.surfZones().empty()
? oneZone(faceLst)
: surf.surfZones()
);
const bool useFaceMap = (surf.useFaceMap() && zones.size() > 1);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -213,9 +213,9 @@ void Foam::fileFormats::STLsurfaceFormat<Face>::writeAscii
const List<surfZone>& zones =
(
surf.surfZones().size() > 1
? surf.surfZones()
: oneZone(faceLst)
surf.surfZones().empty()
? oneZone(faceLst)
: surf.surfZones()
);
const bool useFaceMap = (surf.useFaceMap() && zones.size() > 1);

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