Creation of OpenFOAM-dev repository 15/04/2008

This commit is contained in:
OpenFOAM-admin
2008-04-15 18:56:58 +01:00
commit 3170c7c0c9
9896 changed files with 4016171 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,393 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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::FaceCellWave
Description
Wave propagation of information through grid. Every iteration
information goes through one layer of cells. Templated on information
that is transferred.
Handles parallel and cyclics and non-parallel cyclics.
Note
Whether to propagate depends on the return value of Type::update
which returns true (i.e. propagate) if the value changes by more than a
certain tolerance.
This tolerance can be very strict for normal face-cell and parallel
cyclics (we use a value of 0.01 just to limit propagation of small changes)
but for non-parallel cyclics this tolerance can be critical and if chosen
too small can lead to non-convergence.
SourceFiles
FaceCellWave.C
\*---------------------------------------------------------------------------*/
#ifndef FaceCellWave_H
#define FaceCellWave_H
#include "boolList.H"
#include "labelList.H"
#include "primitiveFieldsFwd.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
class polyMesh;
class polyPatch;
/*---------------------------------------------------------------------------*\
Class FaceCellWaveName Declaration
\*---------------------------------------------------------------------------*/
TemplateName(FaceCellWave);
/*---------------------------------------------------------------------------*\
Class FaceCellWave Declaration
\*---------------------------------------------------------------------------*/
template <class Type>
class FaceCellWave
:
public FaceCellWaveName
{
// Private data
//- Reference to mesh
const polyMesh& mesh_;
//- Information for all faces
UList<Type>& allFaceInfo_;
//- Information for all cells
UList<Type>& allCellInfo_;
//- Has face changed
boolList changedFace_;
//- List of changed faces
labelList changedFaces_;
//- Number of changed faces
label nChangedFaces_;
// Cells that have changed
boolList changedCell_;
labelList changedCells_;
label nChangedCells_;
//- Contains cyclics
bool hasCyclicPatches_;
//- Contains processor patches
bool hasProcPatches_;
//- Number of evaluations
label nEvals_;
//- Number of unvisited cells/faces
label nUnvisitedCells_;
label nUnvisitedFaces_;
//- Iteration counter
label iter_;
// Static Functions
//- Write faces info
static Ostream& writeFaces
(
const label nFaces,
const labelList& faceLabels,
const List<Type>& faceInfo,
Ostream& os
);
//- Read faces info
static Istream& readFaces
(
label& nFaces,
labelList& faceLabels,
List<Type>& faceInfo,
Istream& is
);
// Private Member Functions
//- Disallow default bitwise copy construct
FaceCellWave(const FaceCellWave&);
//- Disallow default bitwise assignment
void operator=(const FaceCellWave&);
//- Updates cellInfo with information from neighbour. Updates all
// statistics.
bool updateCell
(
const label cellI,
const label neighbourFaceI,
const Type& neighbourInfo,
const scalar tol,
Type& cellInfo
);
//- Updates faceInfo with information from neighbour. Updates all
// statistics.
bool updateFace
(
const label faceI,
const label neighbourCellI,
const Type& neighbourInfo,
const scalar tol,
Type& faceInfo
);
//- Updates faceInfo with information from same face. Updates all
// statistics.
bool updateFace
(
const label faceI,
const Type& neighbourInfo,
const scalar tol,
Type& faceInfo
);
// Parallel, cyclic
//- Debugging: check info on both sides of cyclic
void checkCyclic(const polyPatch& pPatch) const;
//- Has patches of certain type?
bool hasPatchType(const word& nameOfType);
//- Merge received patch data into global data
void mergeFaceInfo
(
const polyPatch& patch,
const label nFaces,
const labelList&,
const List<Type>&,
const bool isParallel
);
//- Extract info for single patch only
label getChangedPatchFaces
(
const polyPatch& patch,
const label startFaceI,
const label nFaces,
labelList& changedPatchFaces,
List<Type>& changedPatchFacesInfo
) const;
//- Handle leaving domain. Implementation referred to Type
void leaveDomain
(
const polyPatch& patch,
const label nFaces,
const labelList& faceLabels,
List<Type>& faceInfo
) const;
//- Handle leaving domain. Implementation referred to Type
void enterDomain
(
const polyPatch& patch,
const label nFaces,
const labelList& faceLabels,
List<Type>& faceInfo
) const;
//- Send info to neighbour
void sendPatchInfo
(
const label neighbour,
const label nFaces,
const labelList&,
const List<Type>&
) const;
//- Receive info from neighbour. Returns number of faces received.
label receivePatchInfo
(
const label neighbour,
labelList&,
List<Type>&
) const;
//- Offset face labels by constant value
static void offset
(
const polyPatch& patch,
const label off,
const label nFaces,
labelList& faces
);
//- Apply transformation to Type
void transform
(
const tensorField& rotTensor,
const label nFaces,
List<Type>& faceInfo
);
//- Merge data from across processor boundaries
void handleProcPatches();
//- Merge data from across cyclics
void handleCyclicPatches();
// Private static data
static const scalar geomTol_;
static const scalar propagationTol_;
public:
// Static Functions
//- Access to tolerance
static scalar propagationTol()
{
return propagationTol_;
}
//- Change tolerance
static void setPropagationTol(const scalar tol)
{
propagationTol_ = tol;
}
// Constructors
// Construct from mesh. Use setFaceInfo and iterate() to do actual
// calculation.
FaceCellWave
(
const polyMesh&,
UList<Type>& allFaceInfo,
UList<Type>& allCellInfo
);
//- Construct from mesh and list of changed faces with the Type
// for these faces. Iterates until nothing changes or maxIter reached.
// (maxIter can be 0)
FaceCellWave
(
const polyMesh&,
const labelList& initialChangedFaces,
const List<Type>& changedFacesInfo,
UList<Type>& allFaceInfo,
UList<Type>& allCellInfo,
const label maxIter
);
// Member Functions
// Access
//- Access allFaceInfo
UList<Type>& allFaceInfo()
{
return allFaceInfo_;
}
//- Access allCellInfo
UList<Type>& allCellInfo()
{
return allCellInfo_;
}
//- Access mesh
const polyMesh& mesh() const
{
return mesh_;
}
//- Get number of unvisited cells, i.e. cells that were not (yet)
// reached from walking across mesh. This can happen from
// - not enough iterations done
// - a disconnected mesh
// - a mesh without walls in it
label getUnsetCells() const;
//- Get number of unvisited faces
label getUnsetFaces() const;
// Edit
//- Set initial changed faces
void setFaceInfo
(
const labelList& changedFaces,
const List<Type>& changedFacesInfo
);
//- Propagate from face to cell. Returns total number of cells
// (over all processors) changed.
label faceToCell();
//- Propagate from cell to face. Returns total number of faces
// (over all processors) changed. (Faces on processorpatches are
// counted double)
label cellToFace();
//- Iterate until no changes or maxIter reached. Returns number of
// unset cells (see getUnsetCells)
label iterate(const label maxIter);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "FaceCellWave.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,33 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 "FaceCellWave.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(Foam::FaceCellWaveName, 0);
// ************************************************************************* //

View File

@ -0,0 +1,98 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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
Description
\*---------------------------------------------------------------------------*/
#include "MeshWave.H"
#include "polyMesh.H"
#include "processorPolyPatch.H"
#include "cyclicPolyPatch.H"
#include "OPstream.H"
#include "IPstream.H"
#include "PstreamReduceOps.H"
#include "debug.H"
#include "typeInfo.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Iterate, propagating changedFacesInfo across mesh, until no change (or
// maxIter reached).
template <class Type>
Foam::MeshWave<Type>::MeshWave
(
const polyMesh& mesh,
const labelList& changedFaces,
const List<Type>& changedFacesInfo,
const label maxIter
)
:
allFaceInfo_(mesh.nFaces()),
allCellInfo_(mesh.nCells()),
calc_
(
mesh,
changedFaces,
changedFacesInfo,
allFaceInfo_,
allCellInfo_,
maxIter
)
{}
// Iterate, propagating changedFacesInfo across mesh, until no change (or
// maxIter reached). Initial cell values specified.
template <class Type>
Foam::MeshWave<Type>::MeshWave
(
const polyMesh& mesh,
const labelList& changedFaces,
const List<Type>& changedFacesInfo,
const List<Type>& allCellInfo,
const label maxIter
)
:
allFaceInfo_(mesh.nFaces()),
allCellInfo_(allCellInfo),
calc_
(
mesh,
changedFaces,
changedFacesInfo,
allFaceInfo_,
allCellInfo_,
maxIter
)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
// ************************************************************************* //

View File

@ -0,0 +1,165 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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::MeshWave
Description
FaceCellWave plus data
SourceFiles
MeshWave.C
\*---------------------------------------------------------------------------*/
#ifndef MeshWave_H
#define MeshWave_H
#include "FaceCellWave.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class MeshWaveName Declaration
\*---------------------------------------------------------------------------*/
TemplateName(MeshWave);
/*---------------------------------------------------------------------------*\
Class MeshWave Declaration
\*---------------------------------------------------------------------------*/
template <class Type>
class MeshWave
:
public MeshWaveName
{
// Private data
//- Wall information for all faces
List<Type> allFaceInfo_;
//- Wall information for all cells
List<Type> allCellInfo_;
//- Wave calculation engine.
FaceCellWave<Type> calc_;
// Private Member Functions
//- Disallow default bitwise copy construct
MeshWave(const MeshWave&);
//- Disallow default bitwise assignment
void operator=(const MeshWave&);
public:
// Constructors
//- Construct from mesh and list of changed faces with the Type
// for these faces. Iterates until nothing changes or maxIter reached.
// (maxIter can be 0)
MeshWave
(
const polyMesh& mesh,
const labelList& initialChangedFaces,
const List<Type>& changedFacesInfo,
const label maxIter
);
//- Construct from mesh, list of changed faces with the Type
// for these faces and initial field.
// Iterates until nothing changes or maxIter reached.
// (maxIter can be 0)
MeshWave
(
const polyMesh& mesh,
const labelList& initialChangedFaces,
const List<Type>& changedFacesInfo,
const List<Type>& allCellInfo,
const label maxIter
);
// Member Functions
//- Get allFaceInfo
const List<Type>& allFaceInfo() const
{
return allFaceInfo_;
}
//- Get allCellInfo
const List<Type>& allCellInfo() const
{
return allCellInfo_;
}
//- Iterate until no changes or maxIter reached. Returns number of
// unset cells (see getUnsetCells)
label iterate(const label maxIter)
{
return calc_.iterate(maxIter);
}
//- Get number of unvisited cells, i.e. cells that were not (yet)
// reached from walking across mesh. This can happen from
// - not enough iterations done
// - a disconnected mesh
// - a mesh without walls in it
label getUnsetCells() const
{
return calc_.getUnsetCells();
}
//- Get number of unvisited faces
label getUnsetFaces() const
{
return calc_.getUnsetFaces();
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "MeshWave.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,33 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 "MeshWave.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(Foam::MeshWaveName, 0);
// ************************************************************************* //

View File

@ -0,0 +1,109 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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::subCycle
Description
Perform a subCycleTime on a field
\*---------------------------------------------------------------------------*/
#ifndef subCycle_H
#define subCycle_H
#include "subCycleTime.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class subCycle Declaration
\*---------------------------------------------------------------------------*/
template<class GeometricField>
class subCycle
:
public subCycleTime
{
// Private data
//- Reference to the field being sub-cycled
GeometricField& gf_;
//- Copy of the "real" old-time value of the field
GeometricField gf0_;
// Private Member Functions
//- Disallow default bitwise copy construct
subCycle(const subCycle<GeometricField>&);
//- Disallow default bitwise assignment
void operator=(const subCycle<GeometricField>&);
public:
// Constructors
//- Construct field and number of sub-cycles
subCycle(GeometricField& gf, const label nSubCycles)
:
subCycleTime(const_cast<Time&>(gf.time()), nSubCycles),
gf_(gf),
gf0_(gf.oldTime())
{}
// Destructor
~subCycle()
{
// End the subCycleTime which restores the time state
endSubCycle();
// Correct the time index of the field to correspond to the global
// time
gf_.timeIndex() = gf_.time().timeIndex();
// Reset the old-time field value
gf_.oldTime() = gf0_;
gf_.oldTime().timeIndex() = gf_.time().timeIndex();
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //