Merge branch 'master' of ssh://dm/home/dm4/OpenFOAM/OpenFOAM-dev

This commit is contained in:
Henry
2012-02-29 16:40:17 +00:00
12 changed files with 201 additions and 92 deletions

View File

@ -49,6 +49,11 @@
singlePhaseTransportModel laminarTransport(U, phi);
autoPtr<incompressible::turbulenceModel> turbulence
(
incompressible::turbulenceModel::New(U, phi, laminarTransport)
);
const volScalarField nu(laminarTransport.nu());
volScalarField mu

View File

@ -849,7 +849,10 @@ autoDensity::autoDensity
:
initialPointsMethod(typeName, initialPointsDict, cvMesh),
globalTrialPoints_(0),
minCellSizeLimit_(readScalar(detailsDict().lookup("minCellSizeLimit"))),
minCellSizeLimit_
(
detailsDict().lookupOrDefault<scalar>("minCellSizeLimit", 0.0)
),
minLevels_(readLabel(detailsDict().lookup("minLevels"))),
maxSizeRatio_(readScalar(detailsDict().lookup("maxSizeRatio"))),
volRes_(readLabel(detailsDict().lookup("sampleResolution"))),
@ -899,18 +902,7 @@ List<Vb::Point> autoDensity::initialPoints() const
);
}
// Initialise size of points list.
const scalar volumeBoundBox = Foam::pow3(hierBB.typDim());
const scalar volumeSmallestCell = Foam::pow3(minCellSizeLimit_);
const int initialPointEstimate
= min
(
static_cast<int>(volumeBoundBox/(volumeSmallestCell + SMALL)/10),
1e6
);
DynamicList<Vb::Point> initialPoints(initialPointEstimate);
DynamicList<Vb::Point> initialPoints;
Info<< nl << " " << typeName << endl;

View File

@ -163,6 +163,49 @@ Foam::tmp<Foam::pointField> Foam::boundBox::points() const
}
Foam::faceList Foam::boundBox::faces()
{
faceList faces(6);
forAll(faces, fI)
{
faces[fI].setSize(4);
}
faces[0][0] = 0;
faces[0][1] = 1;
faces[0][2] = 2;
faces[0][3] = 3;
faces[1][0] = 2;
faces[1][1] = 6;
faces[1][2] = 7;
faces[1][3] = 3;
faces[2][0] = 0;
faces[2][1] = 4;
faces[2][2] = 5;
faces[2][3] = 1;
faces[3][0] = 4;
faces[3][1] = 7;
faces[3][2] = 6;
faces[3][3] = 5;
faces[4][0] = 3;
faces[4][1] = 7;
faces[4][2] = 4;
faces[4][3] = 0;
faces[5][0] = 1;
faces[5][1] = 5;
faces[5][2] = 6;
faces[5][3] = 2;
return faces;
}
void Foam::boundBox::inflate(const scalar s)
{
vector ext = vector::one*s*mag();

View File

@ -33,6 +33,7 @@ Description
#define boundBox_H
#include "pointField.H"
#include "faceList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -160,6 +161,9 @@ public:
//- Return corner points in an order corresponding to a 'hex' cell
tmp<pointField> points() const;
//- Return faces with correct point order
static faceList faces();
// Manipulate

View File

@ -14,10 +14,7 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/radiationModels/lnInclude \
-I$(LIB_SRC)/turbulenceModels \
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel/lnInclude \
-I$(LIB_SRC)/turbulenceModels/compressible/RAS/lnInclude \
-I$(LIB_SRC)/turbulenceModels/LES/LESdeltas/lnInclude \
-I$(LIB_SRC)/turbulenceModels/compressible/LES/lnInclude \
-I$(LIB_SRC)/transportModels \
-I$(LIB_SRC)/regionModels/regionModel/lnInclude \
-I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \
@ -42,6 +39,7 @@ LIB_LIBS = \
-lcompressibleRASModels \
-lcompressibleLESModels \
-lLESdeltas \
-lincompressibleTransportModels \
-lregionModels \
-lsurfaceFilmModels \
-ldynamicFvMesh \

View File

@ -13,10 +13,7 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/radiationModels/lnInclude \
-I$(LIB_SRC)/turbulenceModels \
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel/lnInclude \
-I$(LIB_SRC)/turbulenceModels/compressible/RAS/lnInclude \
-I$(LIB_SRC)/turbulenceModels/LES/LESdeltas/lnInclude \
-I$(LIB_SRC)/turbulenceModels/compressible/LES/lnInclude \
-I$(LIB_SRC)/transportModels \
-I$(LIB_SRC)/regionModels/regionModel/lnInclude \
-I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \
@ -36,10 +33,14 @@ LIB_LIBS = \
-lreactionThermophysicalModels \
-lSLGThermo \
-lradiationModels \
-lincompressibleTurbulenceModel \
-lincompressibleRASModels \
-lincompressibleLESModels \
-lcompressibleTurbulenceModel \
-lcompressibleRASModels \
-lcompressibleLESModels \
-lLESdeltas \
-lincompressibleTransportModels \
-lregionModels \
-lsurfaceFilmModels \
-ldynamicFvMesh \

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -25,6 +25,80 @@ License
#include "DispersionRASModel.H"
#include "demandDrivenData.H"
#include "incompressible/turbulenceModel/turbulenceModel.H"
#include "compressible/turbulenceModel/turbulenceModel.H"
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
template<class CloudType>
Foam::tmp<Foam::volScalarField>
Foam::DispersionRASModel<CloudType>::kModel() const
{
const objectRegistry& obr = this->owner().mesh();
const word turbName = "turbulenceModel";
if (obr.foundObject<compressible::turbulenceModel>(turbName))
{
const compressible::turbulenceModel& model =
obr.lookupObject<compressible::turbulenceModel>(turbName);
return model.k();
}
else if (obr.foundObject<incompressible::turbulenceModel>(turbName))
{
const incompressible::turbulenceModel& model =
obr.lookupObject<incompressible::turbulenceModel>(turbName);
return model.k();
}
else
{
FatalErrorIn
(
"Foam::tmp<Foam::volScalarField>"
"Foam::DispersionRASModel<CloudType>::kModel() const"
)
<< "Turbulence model not found in mesh database" << nl
<< "Database objects include: " << obr.sortedToc()
<< abort(FatalError);
return tmp<volScalarField>(NULL);
}
}
template<class CloudType>
Foam::tmp<Foam::volScalarField>
Foam::DispersionRASModel<CloudType>::epsilonModel() const
{
const objectRegistry& obr = this->owner().mesh();
const word turbName = "turbulenceModel";
if (obr.foundObject<compressible::turbulenceModel>(turbName))
{
const compressible::turbulenceModel& model =
obr.lookupObject<compressible::turbulenceModel>(turbName);
return model.epsilon();
}
else if (obr.foundObject<incompressible::turbulenceModel>(turbName))
{
const incompressible::turbulenceModel& model =
obr.lookupObject<incompressible::turbulenceModel>(turbName);
return model.epsilon();
}
else
{
FatalErrorIn
(
"Foam::tmp<Foam::volScalarField>"
"Foam::DispersionRASModel<CloudType>::epsilonModel() const"
)
<< "Turbulence model not found in mesh database" << nl
<< "Database objects include: " << obr.sortedToc()
<< abort(FatalError);
return tmp<volScalarField>(NULL);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -36,16 +110,6 @@ Foam::DispersionRASModel<CloudType>::DispersionRASModel
)
:
DispersionModel<CloudType>(owner),
turbulence_
(
owner.mesh().objectRegistry::template lookupObject
<
compressible::RASModel
>
(
"RASProperties"
)
),
kPtr_(NULL),
ownK_(false),
epsilonPtr_(NULL),
@ -60,7 +124,6 @@ Foam::DispersionRASModel<CloudType>::DispersionRASModel
)
:
DispersionModel<CloudType>(dm),
turbulence_(dm.turbulence_),
kPtr_(dm.kPtr_),
ownK_(dm.ownK_),
epsilonPtr_(dm.epsilonPtr_),
@ -87,7 +150,7 @@ void Foam::DispersionRASModel<CloudType>::cacheFields(const bool store)
{
if (store)
{
tmp<volScalarField> tk = this->turbulence().k();
tmp<volScalarField> tk = this->kModel();
if (tk.isTmp())
{
kPtr_ = tk.ptr();
@ -99,7 +162,7 @@ void Foam::DispersionRASModel<CloudType>::cacheFields(const bool store)
ownK_ = false;
}
tmp<volScalarField> tepsilon = this->turbulence().epsilon();
tmp<volScalarField> tepsilon = this->epsilonModel();
if (tepsilon.isTmp())
{
epsilonPtr_ = tepsilon.ptr();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -25,6 +25,7 @@ Class
Foam::DispersionRASModel
Description
Base class for particle dispersion models based on RAS turbulence.
\*---------------------------------------------------------------------------*/
@ -32,7 +33,6 @@ Description
#define DispersionRASModel_H
#include "DispersionModel.H"
#include "RASModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -53,9 +53,6 @@ protected:
// Protected data
//- Reference to the compressible turbulence model
const compressible::RASModel& turbulence_;
// Locally cached turbulence fields
//- Turbulence k
@ -71,6 +68,15 @@ protected:
bool ownEpsilon_;
// Protected Functions
//- Return the k field from the turbulence model
tmp<volScalarField> kModel() const;
//- Return the epsilon field from the turbulence model
tmp<volScalarField> epsilonModel() const;
public:
//- Runtime type information
@ -104,12 +110,6 @@ public:
//- Cache carrier fields
virtual void cacheFields(const bool store);
//- Return const access to the turbulence model
const compressible::RASModel& turbulence() const
{
return turbulence_;
}
// I-O

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -26,6 +26,8 @@ License
#include "BrownianMotionForce.H"
#include "mathematicalConstants.H"
#include "demandDrivenData.H"
#include "incompressible/turbulenceModel/turbulenceModel.H"
#include "compressible/turbulenceModel/turbulenceModel.H"
using namespace Foam::constant;
@ -50,6 +52,41 @@ Foam::scalar Foam::BrownianMotionForce<CloudType>::erfInv(const scalar y) const
}
template<class CloudType>
Foam::tmp<Foam::volScalarField>
Foam::BrownianMotionForce<CloudType>::kModel() const
{
const objectRegistry& obr = this->owner().mesh();
const word turbName = "turbulenceModel";
if (obr.foundObject<compressible::turbulenceModel>(turbName))
{
const compressible::turbulenceModel& model =
obr.lookupObject<compressible::turbulenceModel>(turbName);
return model.k();
}
else if (obr.foundObject<incompressible::turbulenceModel>(turbName))
{
const incompressible::turbulenceModel& model =
obr.lookupObject<incompressible::turbulenceModel>(turbName);
return model.k();
}
else
{
FatalErrorIn
(
"Foam::tmp<Foam::volScalarField>"
"Foam::BrownianMotionForce<CloudType>::kModel() const"
)
<< "Turbulence model not found in mesh database" << nl
<< "Database objects include: " << obr.sortedToc()
<< abort(FatalError);
return tmp<volScalarField>(NULL);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class CloudType>
@ -64,37 +101,9 @@ Foam::BrownianMotionForce<CloudType>::BrownianMotionForce
rndGen_(owner.rndGen()),
lambda_(readScalar(this->coeffs().lookup("lambda"))),
turbulence_(readBool(this->coeffs().lookup("turbulence"))),
turbulenceModelPtr_(NULL),
kPtr_(NULL),
ownK_(false)
{
if (turbulence_)
{
HashTable<const compressible::turbulenceModel*> models =
this->mesh().objectRegistry::template lookupClass
<
compressible::turbulenceModel
>();
if (models.size() == 1)
{
turbulenceModelPtr_ = models.begin()();
}
else
{
FatalErrorIn
(
"Foam::BrownianMotionForce<CloudType>::BrownianMotionForce"
"("
"CloudType&, "
"const fvMesh&, "
"const dictionary&"
")"
) << "Unable to find a valid turbulence model in mesh database"
<< exit(FatalError);
}
}
}
{}
template<class CloudType>
@ -107,7 +116,6 @@ Foam::BrownianMotionForce<CloudType>::BrownianMotionForce
rndGen_(bmf.rndGen_),
lambda_(bmf.lambda_),
turbulence_(bmf.turbulence_),
turbulenceModelPtr_(NULL),
kPtr_(NULL),
ownK_(false)
{}
@ -117,9 +125,7 @@ Foam::BrownianMotionForce<CloudType>::BrownianMotionForce
template<class CloudType>
Foam::BrownianMotionForce<CloudType>::~BrownianMotionForce()
{
turbulenceModelPtr_ = NULL;
}
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
@ -131,7 +137,7 @@ void Foam::BrownianMotionForce<CloudType>::cacheFields(const bool store)
{
if (store)
{
tmp<volScalarField> tk = turbulenceModelPtr_->k();
tmp<volScalarField> tk = kModel();
if (tk.isTmp())
{
kPtr_ = tk.ptr();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -38,7 +38,6 @@ SourceFiles
#include "ParticleForce.H"
#include "cachedRandom.H"
#include "turbulenceModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -65,9 +64,6 @@ class BrownianMotionForce
//- Turbulence flag
bool turbulence_;
//- Reference to a compressible turbulence model
const compressible::turbulenceModel* turbulenceModelPtr_;
//- Pointer to the turbulence kinetic energy field
const volScalarField* kPtr_;
@ -80,6 +76,9 @@ class BrownianMotionForce
//- Inverse erf for Gaussian distribution
scalar erfInv(const scalar y) const;
//- Return the k field from the turbulence model
tmp<volScalarField> kModel() const;
public:

View File

@ -14,10 +14,7 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/radiationModels/lnInclude \
-I$(LIB_SRC)/turbulenceModels \
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel/lnInclude \
-I$(LIB_SRC)/turbulenceModels/compressible/RAS/lnInclude \
-I$(LIB_SRC)/turbulenceModels/LES/LESdeltas/lnInclude \
-I$(LIB_SRC)/turbulenceModels/compressible/LES/lnInclude \
-I$(LIB_SRC)/transportModels \
-I$(LIB_SRC)/regionModels/regionModel/lnInclude \
-I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \
@ -42,6 +39,7 @@ LIB_LIBS = \
-lcompressibleRASModels \
-lcompressibleLESModels \
-lLESdeltas \
-lincompressibleTransportModels \
-lregionModels \
-lsurfaceFilmModels \
-ldynamicFvMesh \

View File

@ -1,7 +1,7 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
@ -52,7 +52,7 @@ solvers
solver GAMG;
tolerance 0;
relTol 0.1;
smoother GaussSeidel;
smoother DICGaussSeidel;
nPreSweeps 0;
nPostSweeps 2;
cacheAgglomeration true;