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

This commit is contained in:
andy 2013-03-15 16:33:38 +00:00
commit ddeaf2c4c8
16 changed files with 178 additions and 267 deletions

View File

@ -909,6 +909,8 @@ int main(int argc, char *argv[])
{
if (own[faceI] != -1 && nei[faceI] != -1)
{
faceToCell[1].insert(faceI, own[faceI]);
faceToCell[0].insert(faceI, nei[faceI]);
cnt++;
}
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -60,7 +60,7 @@ Foam::tmp<Foam::scalarField> Foam::polyMeshTools::faceOrthogonality
// Coupled faces
pointField neighbourCc;
syncTools::swapBoundaryCellList(mesh, cc, neighbourCc);
syncTools::swapBoundaryCellPositions(mesh, cc, neighbourCc);
forAll(pbm, patchI)
{
@ -123,7 +123,7 @@ Foam::tmp<Foam::scalarField> Foam::polyMeshTools::faceSkewness
// (i.e. treat as if mirror cell on other side)
pointField neighbourCc;
syncTools::swapBoundaryCellList(mesh, cellCtrs, neighbourCc);
syncTools::swapBoundaryCellPositions(mesh, cellCtrs, neighbourCc);
forAll(pbm, patchI)
{

View File

@ -27,6 +27,44 @@ License
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::syncTools::swapBoundaryCellPositions
(
const polyMesh& mesh,
const UList<point>& cellData,
List<point>& neighbourCellData
)
{
if (cellData.size() != mesh.nCells())
{
FatalErrorIn
(
"syncTools<class T>::swapBoundaryCellPositions"
"(const polyMesh&, const UList<T>&, List<T>&)"
) << "Number of cell values " << cellData.size()
<< " is not equal to the number of cells in the mesh "
<< mesh.nCells() << abort(FatalError);
}
const polyBoundaryMesh& patches = mesh.boundaryMesh();
label nBnd = mesh.nFaces()-mesh.nInternalFaces();
neighbourCellData.setSize(nBnd);
forAll(patches, patchI)
{
const polyPatch& pp = patches[patchI];
const labelUList& faceCells = pp.faceCells();
forAll(faceCells, i)
{
label bFaceI = pp.start()+i-mesh.nInternalFaces();
neighbourCellData[bFaceI] = cellData[faceCells[i]];
}
}
syncTools::swapBoundaryFacePositions(mesh, neighbourCellData);
}
Foam::PackedBoolList Foam::syncTools::getMasterPoints(const polyMesh& mesh)
{
PackedBoolList isMasterPoint(mesh.nPoints());

View File

@ -442,18 +442,17 @@ public:
}
//- Swap coupled positions.
template<class T>
static void swapBoundaryFacePositions
(
const polyMesh& mesh,
UList<T>& l
UList<point>& l
)
{
syncBoundaryFaceList
(
mesh,
l,
eqOp<T>(),
eqOp<point>(),
mapDistribute::transformPosition()
);
}
@ -490,6 +489,14 @@ public:
List<T>& neighbourCellData
);
//- Swap to obtain neighbour cell positions for all boundary faces
static void swapBoundaryCellPositions
(
const polyMesh& mesh,
const UList<point>& cellData,
List<point>& neighbourCellData
);
// Sparse versions
//- Synchronize values on selected points.
@ -531,11 +538,11 @@ public:
}
//- Synchronize locations on selected edges.
template<class T, class CombineOp>
template<class CombineOp>
static void syncEdgePositions
(
const polyMesh& mesh,
EdgeMap<T>& l,
EdgeMap<point>& l,
const CombineOp& cop
)
{

View File

@ -104,16 +104,6 @@ Foam::coupledFvPatchField<Type>::coupledFvPatchField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
Foam::tmp<Foam::Field<Type> > Foam::coupledFvPatchField<Type>::snGrad() const
{
notImplemented("coupledFvPatchField<Type>::snGrad()");
return
this->patch().deltaCoeffs()
*(this->patchNeighbourField() - this->patchInternalField());
}
template<class Type>
Foam::tmp<Foam::Field<Type> > Foam::coupledFvPatchField<Type>::snGrad
(

View File

@ -145,7 +145,14 @@ public:
) const;
//- Return patch-normal gradient
virtual tmp<Field<Type> > snGrad() const;
virtual tmp<Field<Type> > snGrad() const
{
notImplemented
(
type() + "::coupledFvPatchField<Type>::snGrad()"
);
return *this;
}
//- Initialise the evaluation of the patch field
virtual void initEvaluate

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -28,15 +28,10 @@ License
#include "demandDrivenData.H"
#include "transformField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
processorCyclicFvPatchField<Type>::processorCyclicFvPatchField
Foam::processorCyclicFvPatchField<Type>::processorCyclicFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF
@ -48,7 +43,7 @@ processorCyclicFvPatchField<Type>::processorCyclicFvPatchField
template<class Type>
processorCyclicFvPatchField<Type>::processorCyclicFvPatchField
Foam::processorCyclicFvPatchField<Type>::processorCyclicFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
@ -63,7 +58,7 @@ processorCyclicFvPatchField<Type>::processorCyclicFvPatchField
// Construct by mapping given processorCyclicFvPatchField<Type>
template<class Type>
processorCyclicFvPatchField<Type>::processorCyclicFvPatchField
Foam::processorCyclicFvPatchField<Type>::processorCyclicFvPatchField
(
const processorCyclicFvPatchField<Type>& ptf,
const fvPatch& p,
@ -97,7 +92,7 @@ processorCyclicFvPatchField<Type>::processorCyclicFvPatchField
template<class Type>
processorCyclicFvPatchField<Type>::processorCyclicFvPatchField
Foam::processorCyclicFvPatchField<Type>::processorCyclicFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
@ -144,7 +139,7 @@ processorCyclicFvPatchField<Type>::processorCyclicFvPatchField
template<class Type>
processorCyclicFvPatchField<Type>::processorCyclicFvPatchField
Foam::processorCyclicFvPatchField<Type>::processorCyclicFvPatchField
(
const processorCyclicFvPatchField<Type>& ptf
)
@ -157,7 +152,7 @@ processorCyclicFvPatchField<Type>::processorCyclicFvPatchField
template<class Type>
processorCyclicFvPatchField<Type>::processorCyclicFvPatchField
Foam::processorCyclicFvPatchField<Type>::processorCyclicFvPatchField
(
const processorCyclicFvPatchField<Type>& ptf,
const DimensionedField<Type, volMesh>& iF
@ -172,107 +167,8 @@ processorCyclicFvPatchField<Type>::processorCyclicFvPatchField
// * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
template<class Type>
processorCyclicFvPatchField<Type>::~processorCyclicFvPatchField()
Foam::processorCyclicFvPatchField<Type>::~processorCyclicFvPatchField()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
//template<class Type>
//tmp<Field<Type> >
//processorCyclicFvPatchField<Type>::patchNeighbourField() const
//{
// return *this;
//}
//
//
//template<class Type>
//void processorCyclicFvPatchField<Type>::initEvaluate
//(
// const Pstream::commsTypes commsType
//)
//{
// if (Pstream::parRun())
// {
// procPatch_.compressedSend(commsType, this->patchInternalField()());
// }
//}
//
//
//template<class Type>
//void processorCyclicFvPatchField<Type>::evaluate
//(
// const Pstream::commsTypes commsType
//)
//{
// if (Pstream::parRun())
// {
// procPatch_.compressedReceive<Type>(commsType, *this);
//
// if (doTransform())
// {
// transform(*this, procPatch_.forwardT(), *this);
// }
// }
//}
//
//
//template<class Type>
//tmp<Field<Type> > processorCyclicFvPatchField<Type>::snGrad() const
//{
// return this->patch().deltaCoeffs()*(*this - this->patchInternalField());
//}
//
//
//template<class Type>
//void processorCyclicFvPatchField<Type>::initInterfaceMatrixUpdate
//(
// scalarField&,
// const scalarField& psiInternal,
// const scalarField&,
// const direction,
// const Pstream::commsTypes commsType
//) const
//{
// procPatch_.compressedSend
// (
// commsType,
// this->patch().patchInternalField(psiInternal)()
// );
//}
//
//
//template<class Type>
//void processorCyclicFvPatchField<Type>::updateInterfaceMatrix
//(
// scalarField& result,
// const scalarField&,
// const scalarField& coeffs,
// const direction cmpt,
// const Pstream::commsTypes commsType
//) const
//{
// scalarField pnf
// (
// procPatch_.compressedReceive<scalar>(commsType, this->size())()
// );
//
// // Transform according to the transformation tensor
// transformCoupleField(pnf, cmpt);
//
// // Multiply the field by coefficients and add into the result
//
// const labelUList& faceCells = this->patch().faceCells();
//
// forAll(faceCells, elemI)
// {
// result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI];
// }
//}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -173,20 +173,10 @@ void Foam::fvPatchField<Type>::check(const fvPatchField<Type>& ptf) const
}
template<class Type>
Foam::tmp<Foam::Field<Type> > Foam::fvPatchField<Type>::snGrad
(
const scalarField& deltaCoeffs
) const
{
return deltaCoeffs*(*this - patchInternalField());
}
template<class Type>
Foam::tmp<Foam::Field<Type> > Foam::fvPatchField<Type>::snGrad() const
{
return this->snGrad(patch_.deltaCoeffs());
return patch_.deltaCoeffs()*(*this - patchInternalField());
}

View File

@ -347,13 +347,21 @@ public:
// Evaluation functions
//- Return patch-normal gradient
virtual tmp<Field<Type> > snGrad() const;
//- Return patch-normal gradient for coupled-patches
// using the deltaCoeffs provided
virtual tmp<Field<Type> > snGrad
(
const scalarField& deltaCoeffs
) const;
//- Return patch-normal gradient
virtual tmp<Field<Type> > snGrad() const;
) const
{
notImplemented
(
type() + "::snGrad(const scalarField& deltaCoeffs)"
);
return *this;
}
//- Update the coefficients associated with the patch field
// Sets Updated to true
@ -421,6 +429,15 @@ public:
//- Return the matrix diagonal coefficients corresponding to the
// evaluation of the gradient of this patchField
virtual tmp<Field<Type> > gradientInternalCoeffs() const
{
notImplemented(type() + "::gradientInternalCoeffs()");
return *this;
}
//- Return the matrix diagonal coefficients corresponding to the
// evaluation of the gradient of this coupled patchField
// using the deltaCoeffs provided
virtual tmp<Field<Type> > gradientInternalCoeffs
(
const scalarField& deltaCoeffs
@ -434,16 +451,17 @@ public:
return *this;
}
//- Return the matrix diagonal coefficients corresponding to the
//- Return the matrix source coefficients corresponding to the
// evaluation of the gradient of this patchField
virtual tmp<Field<Type> > gradientInternalCoeffs() const
virtual tmp<Field<Type> > gradientBoundaryCoeffs() const
{
notImplemented(type() + "::gradientInternalCoeffs()");
notImplemented(type() + "::gradientBoundaryCoeffs()");
return *this;
}
//- Return the matrix source coefficients corresponding to the
// evaluation of the gradient of this patchField
// evaluation of the gradient of this coupled patchField
// using the deltaCoeffs provided
virtual tmp<Field<Type> > gradientBoundaryCoeffs
(
const scalarField& deltaCoeffs
@ -457,14 +475,6 @@ public:
return *this;
}
//- Return the matrix source coefficients corresponding to the
// evaluation of the gradient of this patchField
virtual tmp<Field<Type> > gradientBoundaryCoeffs() const
{
notImplemented(type() + "::gradientBoundaryCoeffs()");
return *this;
}
//- Manipulate matrix
virtual void manipulateMatrix(fvMatrix<Type>& matrix);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -120,7 +120,7 @@ void Foam::searchableSurfaceToFaceZone::applyToSet
// Boundary faces
vectorField nbrCellCentres;
syncTools::swapBoundaryCellList(mesh_, cc, nbrCellCentres);
syncTools::swapBoundaryCellPositions(mesh_, cc, nbrCellCentres);
const polyBoundaryMesh& pbm = mesh_.boundaryMesh();

View File

@ -59,12 +59,13 @@ void Foam::energyRegionCoupledFvPatchScalarField::setMethod() const
{
if (method_ == UNDEFINED)
{
if (
this->db().foundObject<compressible::turbulenceModel>
(
"turbulenceModel"
)
)
if
(
this->db().foundObject<compressible::turbulenceModel>
(
"turbulenceModel"
)
)
{
method_ = FLUID;
}
@ -212,8 +213,7 @@ energyRegionCoupledFvPatchScalarField
const DimensionedField<scalar, volMesh>& iF
)
:
LduInterfaceField<scalar>(refCast<const lduInterface>(p)),
fvPatchScalarField(p, iF),
coupledFvPatchField<scalar>(p, iF),
regionCoupledPatch_(refCast<const regionCoupledBaseFvPatch>(p)),
method_(UNDEFINED),
nbrThermoPtr_(NULL),
@ -230,8 +230,7 @@ energyRegionCoupledFvPatchScalarField
const fvPatchFieldMapper& mapper
)
:
LduInterfaceField<scalar>(refCast<const lduInterface>(p)),
fvPatchScalarField(ptf, p, iF, mapper),
coupledFvPatchField<scalar>(ptf, p, iF, mapper),
regionCoupledPatch_(refCast<const regionCoupledBaseFvPatch>(p)),
method_(ptf.method_),
nbrThermoPtr_(NULL),
@ -247,8 +246,7 @@ energyRegionCoupledFvPatchScalarField
const dictionary& dict
)
:
LduInterfaceField<scalar>(refCast<const lduInterface>(p)),
fvPatchScalarField(p, iF, dict),
coupledFvPatchField<scalar>(p, iF, dict),
regionCoupledPatch_(refCast<const regionCoupledBaseFvPatch>(p)),
method_(UNDEFINED),
nbrThermoPtr_(NULL),
@ -287,8 +285,7 @@ energyRegionCoupledFvPatchScalarField
const energyRegionCoupledFvPatchScalarField& ptf
)
:
LduInterfaceField<scalar>(refCast<const lduInterface>(ptf.patch())),
fvPatchScalarField(ptf),
coupledFvPatchField<scalar>(ptf),
regionCoupledPatch_(ptf.regionCoupledPatch_),
method_(ptf.method_),
nbrThermoPtr_(NULL),
@ -303,8 +300,7 @@ energyRegionCoupledFvPatchScalarField
const DimensionedField<scalar, volMesh>& iF
)
:
LduInterfaceField<scalar>(refCast<const lduInterface>(ptf.patch())),
fvPatchScalarField(ptf, iF),
coupledFvPatchField<scalar>(ptf, iF),
regionCoupledPatch_(ptf.regionCoupledPatch_),
method_(ptf.method_),
nbrThermoPtr_(NULL),
@ -314,24 +310,19 @@ energyRegionCoupledFvPatchScalarField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::tmp<Foam::scalarField> Foam::energyRegionCoupledFvPatchScalarField::
snGrad() const
{
return
(*this - patchInternalField())*regionCoupledPatch_.patch().deltaCoeffs();
regionCoupledPatch_.patch().deltaCoeffs()
*(*this - patchInternalField());
}
void Foam::energyRegionCoupledFvPatchScalarField::initEvaluate
(
const Pstream::commsTypes
)
Foam::tmp<Foam::scalarField> Foam::energyRegionCoupledFvPatchScalarField::
snGrad(const scalarField&) const
{
if (!updated())
{
updateCoeffs();
}
return snGrad();
}
@ -365,42 +356,6 @@ void Foam::energyRegionCoupledFvPatchScalarField::evaluate
}
Foam::tmp<Foam::scalarField> Foam::energyRegionCoupledFvPatchScalarField::
valueInternalCoeffs
(
const tmp<scalarField>& w
) const
{
return scalar(pTraits<scalar>::one)*w;
}
Foam::tmp<Foam::scalarField> Foam::energyRegionCoupledFvPatchScalarField::
valueBoundaryCoeffs
(
const tmp<scalarField>& w
) const
{
return scalar(pTraits<scalar>::one)*(1.0 - w);
}
Foam::tmp<Foam::scalarField> Foam::energyRegionCoupledFvPatchScalarField::
gradientInternalCoeffs() const
{
return
-scalar(pTraits<scalar>::one)
*regionCoupledPatch_.patch().deltaCoeffs();
}
Foam::tmp<Foam::scalarField> Foam::energyRegionCoupledFvPatchScalarField::
gradientBoundaryCoeffs() const
{
return -this->gradientInternalCoeffs();
}
Foam::tmp<Foam::Field<Foam::scalar> >
Foam::energyRegionCoupledFvPatchScalarField::
patchNeighbourField() const
@ -546,6 +501,7 @@ void Foam::energyRegionCoupledFvPatchScalarField::write(Ostream& os) const
this->writeEntry("value", os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -43,22 +43,23 @@ SourceFiles
#include "fvPatchField.H"
#include "NamedEnum.H"
#include "basicThermo.H"
#include "coupledFvPatchField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class energyRegionCoupledFvPatchScalarField Declaration
\*---------------------------------------------------------------------------*/
class energyRegionCoupledFvPatchScalarField
:
public LduInterfaceField<scalar>,
public fvPatchScalarField
public coupledFvPatchField<scalar>
{
public:
enum kappaMethodType
@ -162,12 +163,6 @@ public:
const DimensionedField<scalar, volMesh>&
);
//- Destructor
virtual ~energyRegionCoupledFvPatchScalarField()
{}
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchField<scalar> > clone
(
@ -181,17 +176,15 @@ public:
}
//- Destructor
virtual ~energyRegionCoupledFvPatchScalarField()
{}
// Member functions
// Access
//- Return true if this patch field is coupled
virtual bool coupled() const
{
return true;
}
//- Method to obtain K
word kappaMethod() const
{
@ -207,11 +200,13 @@ public:
//- Return patch-normal gradient
virtual tmp<scalarField> snGrad() const;
//- Initialise the evaluation of the patch field
virtual void initEvaluate
//- Return patch-normal gradient
// Note: the deltaCoeffs supplied are not used
virtual tmp<scalarField> snGrad
(
const Pstream::commsTypes commsType
);
const scalarField& deltaCoeffs
) const;
//- Evaluate the patch field
virtual void evaluate
@ -219,28 +214,6 @@ public:
const Pstream::commsTypes commsType
);
//- Return the matrix diagonal coefficients corresponding to the
// evaluation of the value of this patchField with given weights
virtual tmp<scalarField> valueInternalCoeffs
(
const tmp<scalarField>&
) const;
//- Return the matrix source coefficients corresponding to the
// evaluation of the value of this patchField with given weights
virtual tmp<scalarField> valueBoundaryCoeffs
(
const tmp<scalarField>&
) const;
//- Return the matrix diagonal coefficients corresponding to the
// evaluation of the gradient of this patchField
virtual tmp<scalarField> gradientInternalCoeffs() const;
//- Return the matrix source coefficients corresponding to the
// evaluation of the gradient of this patchField
virtual tmp<scalarField> gradientBoundaryCoeffs() const;
// Coupled interface functionality

View File

@ -49,5 +49,9 @@ adjustTimeStep no;
maxCo 0.2;
functions
{
#include "cuttingPlane"
}
// ************************************************************************* //

View File

@ -0,0 +1,38 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
cuttingPlane
{
type surfaces;
functionObjectLibs ("libsampling.so");
outputControl outputTime;
surfaceFormat vtk;
fields ( p U );
interpolationScheme cellPoint;
surfaces
(
zNormal
{
type cuttingPlane;
planeType pointAndNormal;
pointAndNormalDict
{
basePoint (0 0 0);
normalVector (0 0 1);
}
interpolate true;
}
);
}
// ************************************************************************* //

View File

@ -1,2 +1,2 @@
c++DBUG =
c++OPT = -xSSE3 -O2 -no-prec-div
c++OPT = -xHost -O2 -no-prec-div

View File

@ -1,2 +1,2 @@
c++DBUG =
c++OPT = -xSSE3 -O2 -no-prec-div
c++OPT = -xHost -O2 -no-prec-div