Merge branch 'master' of github.com:OpenFOAM/OpenFOAM-2.3.x

This commit is contained in:
Henry 2014-04-23 10:12:44 +01:00
commit 38a16bcb9b
13 changed files with 605 additions and 54 deletions

View file

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -1385,25 +1385,12 @@ int main(int argc, char *argv[])
label sz = bFaces.size();
labelList meshFaces(sz,-1);
//make face set and write (seperate from rest for clarity)
//internal and external Fluent boundaries
// Search faces by point matching
forAll(bFaces, j)
{
faceSet pFaceSet(pShapeMesh, patchNames[patchI], sz);
forAll(bFaces, j)
{
const face& f = bFaces[j];
label cMeshFace = findFace(pShapeMesh, f);
meshFaces[j] = cMeshFace;
pFaceSet.insert(cMeshFace);
}
if (writeSets)
{
Info<< "Writing patch " << patchNames[patchI]
<< " of size " << sz << " to faceSet." << endl;
pFaceSet.write();
}
const face& f = bFaces[j];
label cMeshFace = findFace(pShapeMesh, f);
meshFaces[j] = cMeshFace;
}
@ -1546,6 +1533,31 @@ int main(int argc, char *argv[])
IOstream::defaultPrecision(max(10u, IOstream::defaultPrecision()));
// Re-do face matching to write sets
if (writeSets)
{
forAll(patches, patchI)
{
const faceList& bFaces = patches[patchI];
label sz = bFaces.size();
faceSet pFaceSet(pShapeMesh, patchNames[patchI], sz);
forAll(bFaces, j)
{
const face& f = bFaces[j];
label cMeshFace = findFace(pShapeMesh, f);
pFaceSet.insert(cMeshFace);
}
Info<< "Writing patch " << patchNames[patchI]
<< " of size " << sz << " to faceSet" << endl;
pFaceSet.instance() = pShapeMesh.instance();
pFaceSet.write();
}
}
// Zones
// will write out cell zones and internal faces for those zones
// note: zone boundary faces are not added to face zones

View file

@ -394,6 +394,8 @@ int main(int argc, char *argv[])
Info<< endl;
}
Info<< "End\n" << endl;
return 0;
}

View file

@ -3,7 +3,7 @@
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
# \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
# \\/ M anipulation |
#-------------------------------------------------------------------------------
# License
@ -126,8 +126,8 @@ if [ "$WM_PROJECT" ]
then
for i in \
$HOME/.WM_PROJECT/$WM_PROJECT_VERSION \
$HOME/.WM_PROJECT \
$HOME/.$WM_PROJECT/$WM_PROJECT_VERSION \
$HOME/.$WM_PROJECT \
$WM_PROJECT_DIR/etc \
;
do

View file

@ -135,7 +135,7 @@ Foam::pointField Foam::autoSnapDriver::smoothPatchDisplacement
pp.localPoints(),
nonManifoldPoint
);
Info<< "Found " << nNonManifoldPoints << " non-mainfold point(s)."
Info<< "Found " << nNonManifoldPoints << " non-manifold point(s)."
<< endl;

View file

@ -39,6 +39,7 @@ License
//#include "globalIndex.H"
#include "OBJstream.H"
#include "cellSet.H"
#include "treeDataCell.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -353,7 +354,14 @@ void Foam::meshRefinement::markFeatureCellLevel
label tetFaceI = -1;
label tetPtI = -1;
mesh_.findCellFacePt(keepPoint, cellI, tetFaceI, tetPtI);
// Force construction of search tree even if processor holds no
// cells
(void)mesh_.cellTree();
if (mesh_.nCells())
{
mesh_.findCellFacePt(keepPoint, cellI, tetFaceI, tetPtI);
}
if (cellI != -1)
{
@ -402,7 +410,8 @@ void Foam::meshRefinement::markFeatureCellLevel
featureMesh.points()[pointI], // endpos
featureLevel, // level
featI, // featureMesh
pointI // end point
pointI, // end point
-1 // feature edge
)
);
@ -446,7 +455,8 @@ void Foam::meshRefinement::markFeatureCellLevel
featureMesh.points()[pointI], // endpos
featureLevel, // level
featI, // featureMesh
pointI // end point
pointI, // end point
-1 // feature edge
)
);
}
@ -459,8 +469,22 @@ void Foam::meshRefinement::markFeatureCellLevel
// Largest refinement level of any feature passed through
maxFeatureLevel = labelList(mesh_.nCells(), -1);
// Whether edge has been visited.
List<PackedBoolList> featureEdgeVisited(features_.size());
forAll(features_, featI)
{
featureEdgeVisited[featI].setSize(features_[featI].edges().size());
featureEdgeVisited[featI] = 0u;
}
// Database to pass into trackedParticle::move
trackedParticle::trackingData td(startPointCloud, maxFeatureLevel);
trackedParticle::trackingData td
(
startPointCloud,
maxFeatureLevel,
featureEdgeVisited
);
// Track all particles to their end position (= starting feature point)
@ -477,15 +501,10 @@ void Foam::meshRefinement::markFeatureCellLevel
startPointCloud.move(td, maxTrackLen);
// Reset level
// Reset levels
maxFeatureLevel = -1;
// Whether edge has been visited.
List<PackedBoolList> featureEdgeVisited(features_.size());
forAll(features_, featI)
{
featureEdgeVisited[featI].setSize(features_[featI].edges().size());
featureEdgeVisited[featI] = 0u;
}
@ -528,6 +547,7 @@ void Foam::meshRefinement::markFeatureCellLevel
trackedParticle* tp(new trackedParticle(startTp));
tp->end() = featureMesh.points()[otherPointI];
tp->j() = otherPointI;
tp->k() = edgeI;
if (debug&meshRefinement::FEATURESEEDS)
{
@ -587,6 +607,7 @@ void Foam::meshRefinement::markFeatureCellLevel
tp.end() = featureMesh.points()[otherPointI];
tp.j() = otherPointI;
tp.k() = edgeI;
keepParticle = true;
break;
}

View file

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -25,6 +25,7 @@ License
#include "trackedParticle.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::trackedParticle::trackedParticle
@ -37,14 +38,16 @@ Foam::trackedParticle::trackedParticle
const point& end,
const label level,
const label i,
const label j
const label j,
const label k
)
:
particle(mesh, position, cellI, tetFaceI, tetPtI),
end_(end),
level_(level),
i_(i),
j_(j)
j_(j),
k_(k)
{}
@ -65,13 +68,15 @@ Foam::trackedParticle::trackedParticle
level_ = readLabel(is);
i_ = readLabel(is);
j_ = readLabel(is);
k_ = readLabel(is);
}
else
{
is.read
(
reinterpret_cast<char*>(&end_),
sizeof(end_) + sizeof(level_) + sizeof(i_) + sizeof(j_)
sizeof(end_) + sizeof(level_)
+ sizeof(i_) + sizeof(j_) + sizeof(k_)
);
}
}
@ -113,7 +118,7 @@ bool Foam::trackedParticle::move
scalar dt = min(dtMax, tEnd);
// mark visited cell with max level.
td.maxLevel()[cell()] = max(td.maxLevel()[cell()], level_);
td.maxLevel_[cell()] = max(td.maxLevel_[cell()], level_);
dt *= trackToFace(end_, td);
@ -217,6 +222,26 @@ void Foam::trackedParticle::hitPatch
}
void Foam::trackedParticle::correctAfterParallelTransfer
(
const label patchI,
trackingData& td
)
{
particle::correctAfterParallelTransfer(patchI, td);
label edgeI = k();
if (edgeI != -1)
{
label featI = i();
// Mark edge we're currently on (was set on sending processor but not
// receiving sender)
td.featureEdgeVisited_[featI].set(edgeI, 1u);
}
}
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<(Ostream& os, const trackedParticle& p)
@ -227,7 +252,8 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const trackedParticle& p)
<< token::SPACE << p.end_
<< token::SPACE << p.level_
<< token::SPACE << p.i_
<< token::SPACE << p.j_;
<< token::SPACE << p.j_
<< token::SPACE << p.k_;
}
else
{
@ -235,7 +261,8 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const trackedParticle& p)
os.write
(
reinterpret_cast<const char*>(&p.end_),
sizeof(p.end_) + sizeof(p.level_) + sizeof(p.i_) + sizeof(p.j_)
sizeof(p.end_) + sizeof(p.level_)
+ sizeof(p.i_) + sizeof(p.j_) + sizeof(p.k_)
);
}

View file

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -62,12 +62,15 @@ class trackedParticle
//- level of this particle
label level_;
//- passive label
//- passive label (used to store feature edge mesh)
label i_;
//- passive label
//- passive label (used to store feature edge point)
label j_;
//- passive label (used to store feature edge label)
label k_;
public:
@ -78,26 +81,27 @@ public:
:
public particle::TrackingData<Cloud<trackedParticle> >
{
public:
labelList& maxLevel_;
public:
List<PackedBoolList>& featureEdgeVisited_;
// Constructors
trackingData(Cloud<trackedParticle>& cloud, labelList& maxLevel)
trackingData
(
Cloud<trackedParticle>& cloud,
labelList& maxLevel,
List<PackedBoolList>& featureEdgeVisited
)
:
particle::TrackingData<Cloud<trackedParticle> >(cloud),
maxLevel_(maxLevel)
maxLevel_(maxLevel),
featureEdgeVisited_(featureEdgeVisited)
{}
// Member functions
labelList& maxLevel()
{
return maxLevel_;
}
};
@ -115,7 +119,8 @@ public:
const point& end,
const label level,
const label i,
const label j
const label j,
const label k
);
//- Construct from Istream
@ -187,6 +192,18 @@ public:
return j_;
}
//- transported label
label k() const
{
return k_;
}
//- transported label
label& k()
{
return k_;
}
// Tracking
@ -259,6 +276,10 @@ public:
trackingData& td
);
//- Convert processor patch addressing to the global equivalents
// and set the cellI to the face-neighbour
void correctAfterParallelTransfer(const label, trackingData&);
// Ostream Operator

View file

@ -33,6 +33,9 @@ timeActivatedFileUpdate/timeActivatedFileUpdateFunctionObject.C
turbulenceFields/turbulenceFields.C
turbulenceFields/turbulenceFieldsFunctionObject.C
vorticity/vorticity.C
vorticity/vorticityFunctionObject.C
wallShearStress/wallShearStress.C
wallShearStress/wallShearStressFunctionObject.C

View file

@ -0,0 +1,49 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2014 OpenFOAM Foundation
\\/ 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/>.
Typedef
Foam::IOvorticity
Description
Instance of the generic IOOutputFilter for vorticity.
\*---------------------------------------------------------------------------*/
#ifndef IOvorticity_H
#define IOvorticity_H
#include "vorticity.H"
#include "IOOutputFilter.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef IOOutputFilter<vorticity> IOvorticity;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View file

@ -0,0 +1,169 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2014 OpenFOAM Foundation
\\/ 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/>.
\*---------------------------------------------------------------------------*/
#include "vorticity.H"
#include "volFields.H"
#include "dictionary.H"
#include "fvcCurl.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(vorticity, 0);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::vorticity::vorticity
(
const word& name,
const objectRegistry& obr,
const dictionary& dict,
const bool loadFromFiles
)
:
name_(name),
obr_(obr),
active_(true),
UName_("U"),
outputName_(typeName)
{
// Check if the available mesh is an fvMesh, otherwise deactivate
if (!isA<fvMesh>(obr_))
{
active_ = false;
WarningIn
(
"vorticity::vorticity"
"("
"const word&, "
"const objectRegistry&, "
"const dictionary&, "
"const bool"
")"
) << "No fvMesh available, deactivating " << name_ << nl
<< endl;
}
read(dict);
if (active_)
{
const fvMesh& mesh = refCast<const fvMesh>(obr_);
volVectorField* vorticityPtr
(
new volVectorField
(
IOobject
(
outputName_,
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionedVector("0", dimless/dimTime, vector::zero)
)
);
mesh.objectRegistry::store(vorticityPtr);
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::vorticity::~vorticity()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::vorticity::read(const dictionary& dict)
{
if (active_)
{
UName_ = dict.lookupOrDefault<word>("UName", "U");
if (UName_ != "U")
{
outputName_ = typeName + "(" + UName_ + ")";
}
}
}
void Foam::vorticity::execute()
{
if (active_)
{
const volVectorField& U = obr_.lookupObject<volVectorField>(UName_);
volVectorField& vorticity =
const_cast<volVectorField&>
(
obr_.lookupObject<volVectorField>(outputName_)
);
vorticity = fvc::curl(U);
}
}
void Foam::vorticity::end()
{
if (active_)
{
execute();
}
}
void Foam::vorticity::timeSet()
{
// Do nothing
}
void Foam::vorticity::write()
{
if (active_)
{
const volVectorField& vorticity =
obr_.lookupObject<volVectorField>(outputName_);
Info<< type() << " " << name_ << " output:" << nl
<< " writing field " << vorticity.name() << nl
<< endl;
vorticity.write();
}
}
// ************************************************************************* //

View file

@ -0,0 +1,152 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2014 OpenFOAM Foundation
\\/ 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::vorticity
Group
grpUtilitiesFunctionObjects
Description
This function object calculates the vorticity, the curl of the velocity.
SourceFiles
vorticity.C
IOvorticity.H
\*---------------------------------------------------------------------------*/
#ifndef vorticity_H
#define vorticity_H
#include "volFieldsFwd.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
class objectRegistry;
class dictionary;
class polyMesh;
class mapPolyMesh;
/*---------------------------------------------------------------------------*\
Class vorticity Declaration
\*---------------------------------------------------------------------------*/
class vorticity
{
// Private data
//- Name of this set of vorticity objects
word name_;
//- Reference to the database
const objectRegistry& obr_;
//- On/off switch
bool active_;
//- Name of velocity field, default is "U"
word UName_;
//- Name of vorticity field
word outputName_;
// Private Member Functions
//- Disallow default bitwise copy construct
vorticity(const vorticity&);
//- Disallow default bitwise assignment
void operator=(const vorticity&);
public:
//- Runtime type information
TypeName("vorticity");
// Constructors
//- Construct for given objectRegistry and dictionary.
// Allow the possibility to load fields from files
vorticity
(
const word& name,
const objectRegistry&,
const dictionary&,
const bool loadFromFiles = false
);
//- Destructor
virtual ~vorticity();
// Member Functions
//- Return name of the set of vorticity
virtual const word& name() const
{
return name_;
}
//- Read the vorticity data
virtual void read(const dictionary&);
//- Execute, currently does nothing
virtual void execute();
//- Execute at the final time-loop, currently does nothing
virtual void end();
//- Called when time was set at the end of the Time::operator++
virtual void timeSet();
//- Calculate the vorticity and write
virtual void write();
//- Update for changes of mesh
virtual void updateMesh(const mapPolyMesh&)
{}
//- Update for changes of mesh
virtual void movePoints(const polyMesh&)
{}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View file

@ -0,0 +1,42 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2014 OpenFOAM Foundation
\\/ 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/>.
\*---------------------------------------------------------------------------*/
#include "vorticityFunctionObject.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineNamedTemplateTypeNameAndDebug(vorticityFunctionObject, 0);
addToRunTimeSelectionTable
(
functionObject,
vorticityFunctionObject,
dictionary
);
}
// ************************************************************************* //

View file

@ -0,0 +1,53 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2014 OpenFOAM Foundation
\\/ 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/>.
Typedef
Foam::vorticityFunctionObject
Description
FunctionObject wrapper around vorticity to allow it to be created
via the functions entry within controlDict.
SourceFiles
vorticityFunctionObject.C
\*---------------------------------------------------------------------------*/
#ifndef vorticityFunctionObject_H
#define vorticityFunctionObject_H
#include "vorticity.H"
#include "OutputFilterFunctionObject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef OutputFilterFunctionObject<vorticity> vorticityFunctionObject;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //