Skip to content

Commit

Permalink
Merge branch 'master' of github.com:OpenCFD/OpenFOAM-1.7.x
Browse files Browse the repository at this point in the history
  • Loading branch information
Henry authored and Henry committed Jun 13, 2011
2 parents d1e8e84 + 89fc6e6 commit 653d403
Show file tree
Hide file tree
Showing 6 changed files with 304 additions and 11 deletions.
1 change: 1 addition & 0 deletions src/meshTools/Make/files
Expand Up @@ -94,6 +94,7 @@ $(cellSources)/zoneToCell/zoneToCell.C
$(cellSources)/sphereToCell/sphereToCell.C
$(cellSources)/cylinderToCell/cylinderToCell.C
$(cellSources)/faceZoneToCell/faceZoneToCell.C
$(cellSources)/cylinderAnnulusToCell/cylinderAnnulusToCell.C

faceSources = sets/faceSources
$(faceSources)/faceToFace/faceToFace.C
Expand Down
8 changes: 4 additions & 4 deletions src/meshTools/octree/pointHitSort.H
Expand Up @@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 1991-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
Expand Down Expand Up @@ -65,7 +65,7 @@ public:
//- Construct null
pointHitSort()
:
inter_(false, vector::zero, GREAT),
inter_(false, vector::zero, GREAT, false),
index_(-1)
{}

Expand Down Expand Up @@ -96,9 +96,9 @@ public:
return inter_.distance() == rhs.inter().distance();
}

bool operator>(const pointHitSort& rhs) const
bool operator<(const pointHitSort& rhs) const
{
return inter_.distance() > rhs.inter().distance();
return inter_.distance() < rhs.inter().distance();
}

};
Expand Down
@@ -0,0 +1,161 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2011 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/>.
\*---------------------------------------------------------------------------*/

#include "cylinderAnnulusToCell.H"
#include "polyMesh.H"
#include "addToRunTimeSelectionTable.H"

// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //

namespace Foam
{
defineTypeNameAndDebug(cylinderAnnulusToCell, 0);
addToRunTimeSelectionTable(topoSetSource, cylinderAnnulusToCell, word);
addToRunTimeSelectionTable(topoSetSource, cylinderAnnulusToCell, istream);
}


Foam::topoSetSource::addToUsageTable Foam::cylinderAnnulusToCell::usage_
(
cylinderAnnulusToCell::typeName,
"\n Usage: cylinderAnnulusToCell (p1X p1Y p1Z) (p2X p2Y p2Z)"
" outerRadius innerRadius\n\n"
" Select all cells with cell centre within bounding cylinder annulus\n\n"
);


// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //

void Foam::cylinderAnnulusToCell::combine(topoSet& set, const bool add) const
{
const vector axis = p2_ - p1_;
const scalar orad2 = sqr(outerRadius_);
const scalar irad2 = sqr(innerRadius_);
const scalar magAxis2 = magSqr(axis);

const pointField& ctrs = mesh_.cellCentres();

forAll(ctrs, cellI)
{
vector d = ctrs[cellI] - p1_;
scalar magD = d & axis;

if ((magD > 0) && (magD < magAxis2))
{
scalar d2 = (d & d) - sqr(magD)/magAxis2;
if ((d2 < orad2) && (d2 > irad2))
{
addOrDelete(set, cellI, add);
}
}
}
}


// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //

Foam::cylinderAnnulusToCell::cylinderAnnulusToCell
(
const polyMesh& mesh,
const vector& p1,
const vector& p2,
const scalar outerRadius,
const scalar innerRadius
)
:
topoSetSource(mesh),
p1_(p1),
p2_(p2),
outerRadius_(outerRadius),
innerRadius_(innerRadius)
{}


Foam::cylinderAnnulusToCell::cylinderAnnulusToCell
(
const polyMesh& mesh,
const dictionary& dict
)
:
topoSetSource(mesh),
p1_(dict.lookup("p1")),
p2_(dict.lookup("p2")),
outerRadius_(readScalar(dict.lookup("outerRadius"))),
innerRadius_(readScalar(dict.lookup("innerRadius")))
{}


// Construct from Istream
Foam::cylinderAnnulusToCell::cylinderAnnulusToCell
(
const polyMesh& mesh,
Istream& is
)
:
topoSetSource(mesh),
p1_(checkIs(is)),
p2_(checkIs(is)),
outerRadius_(readScalar(checkIs(is))),
innerRadius_(readScalar(checkIs(is)))
{}


// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //

Foam::cylinderAnnulusToCell::~cylinderAnnulusToCell()
{}


// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //

void Foam::cylinderAnnulusToCell::applyToSet
(
const topoSetSource::setAction action,
topoSet& set
) const
{
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
{
Info<< " Adding cells with centre within cylinder annulus,"
<< " with p1 = "
<< p1_ << ", p2 = " << p2_ << " and outer radius = " << outerRadius_
<< " and inner radius = " << innerRadius_
<< endl;

combine(set, true);
}
else if (action == topoSetSource::DELETE)
{
Info<< " Removing cells with centre within cylinder, with p1 = "
<< p1_ << ", p2 = " << p2_ << " and outer radius = " << outerRadius_
<< " and inner radius " << innerRadius_
<< endl;

combine(set, false);
}
}


// ************************************************************************* //
@@ -0,0 +1,135 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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::cylinderAnnulusToCell
Description
A topoSetSource to select cells based on cell centres inside a
cylinder annulus.
SourceFiles
cylinderAnnulusToCell.C
\*---------------------------------------------------------------------------*/

#ifndef cylinderAnnulusToCell_H
#define cylinderAnnulusToCell_H

#include "topoSetSource.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

namespace Foam
{

/*---------------------------------------------------------------------------*\
Class cylinderAnnulusToCell Declaration
\*---------------------------------------------------------------------------*/

class cylinderAnnulusToCell
:
public topoSetSource
{

// Private data

//- Add usage string
static addToUsageTable usage_;

//- First point on cylinder axis
vector p1_;

//- Second point on cylinder axis
vector p2_;

//- Outer Radius
scalar outerRadius_;

//- Inner Radius
scalar innerRadius_;


// Private Member Functions

void combine(topoSet& set, const bool add) const;


public:

//- Runtime type information
TypeName("cylinderAnnulusToCell");


// Constructors

//- Construct from components
cylinderAnnulusToCell
(
const polyMesh& mesh,
const vector& p1,
const vector& p2,
const scalar outerRadius,
const scalar innerRadius
);

//- Construct from dictionary
cylinderAnnulusToCell
(
const polyMesh& mesh,
const dictionary& dict
);

//- Construct from Istream
cylinderAnnulusToCell
(
const polyMesh& mesh,
Istream&
);


// Destructor

virtual ~cylinderAnnulusToCell();


// Member Functions

virtual void applyToSet
(
const topoSetSource::setAction action,
topoSet&
) const;

};


// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

} // End namespace Foam

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

#endif

// ************************************************************************* //
Expand Up @@ -397,7 +397,7 @@ void kOmegaSSTSAS::correct(const tmp<volTensorField>& gradU)
*max
(
dimensionedScalar("zero",dimensionSet(0, 0 , -2, 0, 0),0. ),
zetaTilda2_*kappa_*S2*(L/Lvk2(S2))
zetaTilda2_*kappa_*S2*sqr(L/Lvk2(S2))
- 2.0/alphaPhi_*k_*grad_omega_k
)
);
Expand Down
Expand Up @@ -27,17 +27,13 @@ Class
Description
kOmegaSSTSAS LES turbulence model for incompressible flows
References:
A Scale-Adaptive Simulation Model using Two-Equation Models
AIAA 2005-1095
F. R. Menter and Y. Egorov
Reference:
DESider A European Effort on Hybrid RANS-LES Modelling:
Results of the European-Union Funded Project, 2004 - 2007
(Notes on Numerical Fluid Mechanics and Multidisciplinary Design).
Chapter 8 Formulation of the Scale-Adaptive Simulation (SAS) Model during
the DESIDER Project.
the DESIDER Project. Published in Springer-Verlag Berlin Heidelberg 2009.
F. R. Menter and Y. Egorov.
SourceFiles
Expand Down

0 comments on commit 653d403

Please sign in to comment.