Merge branch 'master' of ssh://noisy/home/noisy3/OpenFOAM/OpenFOAM-dev

This commit is contained in:
Henry
2010-10-25 17:50:04 +01:00
20 changed files with 1737 additions and 71 deletions

View File

@ -43,7 +43,7 @@ Description
#include "polyMeshZipUpCells.H" #include "polyMeshZipUpCells.H"
#include "wallPolyPatch.H" #include "wallPolyPatch.H"
#include "symmetryPolyPatch.H" #include "symmetryPolyPatch.H"
#include "cyclicPolyPatch.H" #include "oldCyclicPolyPatch.H"
#include "Swap.H" #include "Swap.H"
#include "IFstream.H" #include "IFstream.H"
#include "readHexLabel.H" #include "readHexLabel.H"
@ -900,7 +900,7 @@ int main(int argc, char *argv[])
fluentToFoamType.insert("interface", polyPatch::typeName); fluentToFoamType.insert("interface", polyPatch::typeName);
fluentToFoamType.insert("internal", polyPatch::typeName); fluentToFoamType.insert("internal", polyPatch::typeName);
fluentToFoamType.insert("solid", polyPatch::typeName); fluentToFoamType.insert("solid", polyPatch::typeName);
fluentToFoamType.insert("fan", cyclicPolyPatch::typeName); fluentToFoamType.insert("fan", oldCyclicPolyPatch::typeName);
fluentToFoamType.insert("radiator", polyPatch::typeName); fluentToFoamType.insert("radiator", polyPatch::typeName);
fluentToFoamType.insert("porous-jump", polyPatch::typeName); fluentToFoamType.insert("porous-jump", polyPatch::typeName);

View File

@ -41,7 +41,7 @@ Description
#include "wallPolyPatch.H" #include "wallPolyPatch.H"
#include "symmetryPolyPatch.H" #include "symmetryPolyPatch.H"
#include "wedgePolyPatch.H" #include "wedgePolyPatch.H"
#include "cyclicPolyPatch.H" #include "oldCyclicPolyPatch.H"
#include "unitConversion.H" #include "unitConversion.H"
using namespace Foam; using namespace Foam;

View File

@ -196,7 +196,7 @@ const word* kivaPatchTypes[nBCs] =
&polyPatch::typeName, &polyPatch::typeName,
&polyPatch::typeName, &polyPatch::typeName,
&symmetryPolyPatch::typeName, &symmetryPolyPatch::typeName,
&cyclicPolyPatch::typeName &oldCyclicPolyPatch::typeName
}; };
enum patchTypeNames enum patchTypeNames

View File

@ -29,7 +29,7 @@ Description
#include "sammMesh.H" #include "sammMesh.H"
#include "Time.H" #include "Time.H"
#include "wallPolyPatch.H" #include "wallPolyPatch.H"
#include "cyclicPolyPatch.H" #include "oldCyclicPolyPatch.H"
#include "symmetryPolyPatch.H" #include "symmetryPolyPatch.H"
#include "preservePatchTypes.H" #include "preservePatchTypes.H"
#include "IFstream.H" #include "IFstream.H"
@ -208,7 +208,7 @@ void sammMesh::readBoundary()
{ {
// incorrect. should be cyclicPatch but this // incorrect. should be cyclicPatch but this
// requires info on connected faces. // requires info on connected faces.
patchTypes_[patchLabel] = cyclicPolyPatch::typeName; patchTypes_[patchLabel] = oldCyclicPolyPatch::typeName;
} }
else else
{ {

View File

@ -29,7 +29,7 @@ Description
#include "starMesh.H" #include "starMesh.H"
#include "Time.H" #include "Time.H"
#include "wallPolyPatch.H" #include "wallPolyPatch.H"
#include "cyclicPolyPatch.H" #include "oldCyclicPolyPatch.H"
#include "symmetryPolyPatch.H" #include "symmetryPolyPatch.H"
#include "preservePatchTypes.H" #include "preservePatchTypes.H"
#include "IFstream.H" #include "IFstream.H"
@ -206,7 +206,7 @@ void starMesh::readBoundary()
{ {
// incorrect. should be cyclicPatch but this // incorrect. should be cyclicPatch but this
// requires info on connected faces. // requires info on connected faces.
patchTypes_[patchLabel] = cyclicPolyPatch::typeName; patchTypes_[patchLabel] = oldCyclicPolyPatch::typeName;
} }
else else
{ {

View File

@ -4,4 +4,5 @@ EXE_INC = \
EXE_LIBS = \ EXE_LIBS = \
-lfiniteVolume \ -lfiniteVolume \
-lmeshTools -lmeshTools \
-lgenericPatchFields

View File

@ -346,6 +346,7 @@ $(basicPolyPatches)/generic/genericPolyPatch.C
constraintPolyPatches = $(polyPatches)/constraint constraintPolyPatches = $(polyPatches)/constraint
$(constraintPolyPatches)/cyclic/cyclicPolyPatch.C $(constraintPolyPatches)/cyclic/cyclicPolyPatch.C
$(constraintPolyPatches)/cyclicSlip/cyclicSlipPolyPatch.C $(constraintPolyPatches)/cyclicSlip/cyclicSlipPolyPatch.C
$(constraintPolyPatches)/oldCyclic/oldCyclicPolyPatch.C
$(constraintPolyPatches)/empty/emptyPolyPatch.C $(constraintPolyPatches)/empty/emptyPolyPatch.C
$(constraintPolyPatches)/nonuniformTransformCyclic/nonuniformTransformCyclicPolyPatch.C $(constraintPolyPatches)/nonuniformTransformCyclic/nonuniformTransformCyclicPolyPatch.C
$(constraintPolyPatches)/processorCyclic/processorCyclicPolyPatch.C $(constraintPolyPatches)/processorCyclic/processorCyclicPolyPatch.C

View File

@ -0,0 +1,318 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::oldCyclicPolyPatch
Description
'old' style cyclic polyPatch with all faces in single patch. Does ordering
but cannot be used to run. Writes 'type cyclic' so foamUpgradeCyclics
can be run afterwards.
Used to get cyclics from mesh converters that assume cyclics in single
patch (e.g. fluent3DMeshToFoam)
SourceFiles
oldCyclicPolyPatch.C
\*---------------------------------------------------------------------------*/
#ifndef oldCyclicPolyPatch_H
#define oldCyclicPolyPatch_H
#include "coupledPolyPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class oldCyclicPolyPatch Declaration
\*---------------------------------------------------------------------------*/
class oldCyclicPolyPatch
:
public coupledPolyPatch
{
public:
enum transformType
{
UNKNOWN,
ROTATIONAL,
TRANSLATIONAL
};
static const NamedEnum<transformType, 3> transformTypeNames;
private:
// Private data
//- Morph:angle between normals of neighbouring faces.
// Used to split cyclic into halves.
scalar featureCos_;
//- Type of transformation - rotational or translational
transformType transform_;
// For rotation
//- Axis of rotation for rotational cyclics
vector rotationAxis_;
//- point on axis of rotation for rotational cyclics
point rotationCentre_;
// For translation
//- Translation vector
vector separationVector_;
// Private member functions
//- Find amongst selected faces the one with the largest area
static label findMaxArea(const pointField&, const faceList&);
void calcTransforms();
//- Calculate face centres
static pointField calcFaceCentres
(
const UList<face>&,
const pointField&
);
//- Get f[0] for all faces
static pointField getAnchorPoints
(
const UList<face>&,
const pointField&
);
// Face ordering
//- Find the two parts of the faces of pp using feature edges.
// Returns true if successfull.
bool getGeometricHalves
(
const primitivePatch&,
labelList&,
labelList&
) const;
//- Calculate geometric factors of the two halves.
void getCentresAndAnchors
(
const primitivePatch&,
const faceList& half0Faces,
const faceList& half1Faces,
pointField& ppPoints,
pointField& half0Ctrs,
pointField& half1Ctrs,
pointField& anchors0,
scalarField& tols
) const;
//- Given matched faces matches the anchor point. Sets faceMap,
// rotation. Returns true if all matched.
bool matchAnchors
(
const bool report,
const primitivePatch&,
const labelList&,
const pointField&,
const labelList&,
const faceList&,
const labelList&,
const scalarField&,
labelList& faceMap,
labelList& rotation
) const;
//- For rotational cases, try to find a unique face on each side
// of the cyclic.
label getConsistentRotationFace
(
const pointField& faceCentres
) const;
protected:
// 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&);
public:
//- Runtime type information
TypeName("oldCyclic");
// Constructors
//- Construct from components
oldCyclicPolyPatch
(
const word& name,
const label size,
const label start,
const label index,
const polyBoundaryMesh& bm
);
//- Construct from dictionary
oldCyclicPolyPatch
(
const word& name,
const dictionary& dict,
const label index,
const polyBoundaryMesh& bm
);
//- Construct as copy, resetting the boundary mesh
oldCyclicPolyPatch(const oldCyclicPolyPatch&, const polyBoundaryMesh&);
//- Construct given the original patch and resetting the
// face list and boundary mesh information
oldCyclicPolyPatch
(
const oldCyclicPolyPatch& pp,
const polyBoundaryMesh& bm,
const label index,
const label newSize,
const label newStart
);
//- Construct and return a clone, resetting the boundary mesh
virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const
{
return autoPtr<polyPatch>(new oldCyclicPolyPatch(*this, bm));
}
//- Construct and return a clone, resetting the face list
// and boundary mesh
virtual autoPtr<polyPatch> clone
(
const polyBoundaryMesh& bm,
const label index,
const label newSize,
const label newStart
) const
{
return autoPtr<polyPatch>
(
new oldCyclicPolyPatch(*this, bm, index, newSize, newStart)
);
}
// Destructor
virtual ~oldCyclicPolyPatch();
// Member Functions
// Access
//- Does this side own the patch ?
virtual bool owner() const
{
notImplemented("oldCyclicPolyPatch::owner()");
return true;
}
//- Transform a patch-based position from other side to this side
virtual void transformPosition(pointField& l) const
{
notImplemented("transformPosition(pointField&)");
}
//- Calculate the patch geometry
virtual void calcGeometry
(
const primitivePatch& referPatch,
const UList<point>& thisCtrs,
const UList<point>& thisAreas,
const UList<point>& thisCc,
const UList<point>& nbrCtrs,
const UList<point>& nbrAreas,
const UList<point>& nbrCc
);
//- Initialize ordering for primitivePatch. Does not
// refer to *this (except for name() and type() etc.)
virtual void initOrder
(
PstreamBuffers&,
const primitivePatch&
) const;
//- Return new ordering for primitivePatch.
// Ordering is -faceMap: for every face
// index of the new face -rotation:for every new face the clockwise
// shift of the original face. Return false if nothing changes
// (faceMap is identity, rotation is 0), true otherwise.
virtual bool order
(
PstreamBuffers&,
const primitivePatch&,
labelList& faceMap,
labelList& rotation
) const;
//- Write the polyPatch data as a dictionary
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -171,6 +171,23 @@ tmp<Field<Type> > cyclicFvPatchField<Type>::patchNeighbourField() const
} }
template<class Type>
const cyclicFvPatchField<Type>& cyclicFvPatchField<Type>::neighbourPatchField()
const
{
const GeometricField<Type, fvPatchField, volMesh>& fld =
static_cast<const GeometricField<Type, fvPatchField, volMesh>&>
(
this->internalField()
);
return refCast<const cyclicFvPatchField<Type> >
(
fld.boundaryField()[this->cyclicPatch().neighbPatchID()]
);
}
template<class Type> template<class Type>
void cyclicFvPatchField<Type>::updateInterfaceMatrix void cyclicFvPatchField<Type>::updateInterfaceMatrix
( (

View File

@ -150,9 +150,12 @@ public:
// Evaluation functions // Evaluation functions
//- Return neighbour coupled given internal cell data //- Return neighbour coupled internal cell data
tmp<Field<Type> > patchNeighbourField() const; tmp<Field<Type> > patchNeighbourField() const;
//- Return reference to neighbour patchField
const cyclicFvPatchField<Type>& neighbourPatchField() const;
//- Update result field based on interface functionality //- Update result field based on interface functionality
virtual void updateInterfaceMatrix virtual void updateInterfaceMatrix
( (

View File

@ -139,9 +139,19 @@ public:
//- Return the "jump" across the patch. //- Return the "jump" across the patch.
virtual tmp<Field<Type> > jump() const virtual tmp<Field<Type> > jump() const
{
if (this->cyclicPatch().owner())
{ {
return jump_; return jump_;
} }
else
{
return refCast<const fanFvPatchField<Type> >
(
this->neighbourPatchField()
).jump();
}
}
// Mapping functions // Mapping functions

View File

@ -180,17 +180,31 @@ Foam::label Foam::ptscotchDecomp::decompose
// Info<< "Dumping Scotch graph file to " << str.name() << endl // Info<< "Dumping Scotch graph file to " << str.name() << endl
// << "Use this in combination with gpart." << endl; // << "Use this in combination with gpart." << endl;
// //
// label version = 0; // // Distributed graph file (.grf)
// label version = 2;
// str << version << nl; // str << version << nl;
// // Numer of vertices // // Number of files
// str << xadj.size()-1 << ' ' << adjncy.size() << nl;
// // Number of files (procglbnbr)
// str << Pstream::nProcs();
// // My file number (procloc)
// str << ' ' << Pstream::myProcNo() << nl;
//
// // Total number of vertices (vertglbnbr)
// str << returnReduce(mesh.nCells(), sumOp<label>());
// // Total number of connections (edgeglbnbr)
// str << ' ' << returnReduce(xadj[mesh.nCells()], sumOp<label>())
// << nl;
// // Local number of vertices (vertlocnbr)
// str << mesh.nCells();
// // Local number of connections (edgelocnbr)
// str << ' ' << xadj[mesh.nCells()] << nl;
// // Numbering starts from 0 // // Numbering starts from 0
// label baseval = 0; // label baseval = 0;
// // Has weights? // // Start of my global vertices (procdsptab[proclocnum])
// label hasEdgeWeights = 0; // str << ' ' << globalCells.toGlobal(0);
// label hasVertexWeights = 0; // 100*hasVertlabels+10*hasEdgeWeights+1*hasVertWeighs
// label numericflag = 10*hasEdgeWeights+hasVertexWeights; // str << ' ' << "0" << nl;
// str << baseval << ' ' << numericflag << nl;
// for (label cellI = 0; cellI < xadj.size()-1; cellI++) // for (label cellI = 0; cellI < xadj.size()-1; cellI++)
// { // {
// label start = xadj[cellI]; // label start = xadj[cellI];

View File

@ -47,15 +47,15 @@ boundaryField
{ {
type cyclic; type cyclic;
} }
fan_half1
{
type cyclic;
}
defaultFaces defaultFaces
{ {
type fixedValue; type fixedValue;
value uniform (0 0 0); value uniform (0 0 0);
} }
fan_half1
{
type cyclic;
}
} }

View File

@ -42,21 +42,27 @@ boundaryField
baffles baffles
{ {
type epsilonWallFunction; type epsilonWallFunction;
value uniform 1; Cmu 0.09;
kappa 0.41;
E 9.8;
value uniform 0;
} }
fan_half0 fan_half0
{ {
type cyclic; type cyclic;
} }
fan_half1
{
type cyclic;
}
defaultFaces defaultFaces
{ {
type epsilonWallFunction; type epsilonWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
value uniform 1; value uniform 1;
} }
fan_half1
{
type cyclic;
}
} }

View File

@ -42,21 +42,21 @@ boundaryField
baffles baffles
{ {
type kqRWallFunction; type kqRWallFunction;
value uniform 1; value uniform 0;
} }
fan_half0 fan_half0
{ {
type cyclic; type cyclic;
} }
fan_half1
{
type cyclic;
}
defaultFaces defaultFaces
{ {
type kqRWallFunction; type kqRWallFunction;
value uniform 1; value uniform 1;
} }
fan_half1
{
type cyclic;
}
} }

View File

@ -41,14 +41,14 @@ boundaryField
{ {
type cyclic; type cyclic;
} }
defaultFaces
{
type zeroGradient;
}
fan_half1 fan_half1
{ {
type cyclic; type cyclic;
} }
defaultFaces
{
type zeroGradient;
}
} }

View File

@ -39,21 +39,27 @@ boundaryField
baffles baffles
{ {
type nutkWallFunction; type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
value uniform 0; value uniform 0;
} }
fan_half0 fan_half0
{ {
type cyclic; type cyclic;
} }
defaultFaces
{
type nutkWallFunction;
value uniform 0;
}
fan_half1 fan_half1
{ {
type cyclic; type cyclic;
} }
defaultFaces
{
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
value uniform 0;
}
} }

View File

@ -24,14 +24,12 @@ boundaryField
inlet inlet
{ {
type timeVaryingTotalPressure; type timeVaryingTotalPressure;
p0 100040;
outOfBounds clamp;
fileName "$FOAM_CASE/constant/p0vsTime";
U U;
phi phi;
rho none; rho none;
psi none; psi none;
gamma 1; gamma 1;
p0 100040;
fileName "$FOAM_CASE/constant/p0vsTime";
outOfBounds clamp;
value uniform 100040; value uniform 100040;
} }
outlet1 outlet1
@ -52,19 +50,19 @@ boundaryField
{ {
type fan; type fan;
patchType cyclic; patchType cyclic;
f 2 ( 50 -0.1 ); f 2(100 -0.1);
value $internalField; value uniform 0;
}
defaultFaces
{
type zeroGradient;
} }
fan_half1 fan_half1
{ {
type fan; type fan;
patchType cyclic; patchType cyclic;
f 2 ( 50 -0.1 ); f 2(100 -0.1);
value $internalField; value uniform 0;
}
defaultFaces
{
type zeroGradient;
} }
} }

View File

@ -28,7 +28,6 @@ endTime 1;
deltaT 0.001; deltaT 0.001;
writeControl adjustableRunTime; writeControl adjustableRunTime;
writeInterval 0.1; writeInterval 0.1;
purgeWrite 0; purgeWrite 0;
@ -47,7 +46,7 @@ runTimeModifiable true;
adjustTimeStep yes; adjustTimeStep yes;
maxCo 5; maxCo 3;
libs libs
( (