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

This commit is contained in:
mattijs 2014-04-09 17:19:25 +01:00
commit 51c188248a
22 changed files with 647 additions and 163 deletions

View file

@ -40,6 +40,7 @@ wallLubricationModels/wallLubricationModel/newWallLubricationModel.C
wallLubricationModels/noWallLubrication/noWallLubrication.C
wallLubricationModels/Antal/Antal.C
wallLubricationModels/Frank/Frank.C
wallLubricationModels/TomiyamaWallLubrication/TomiyamaWallLubrication.C
turbulentDispersionModels/turbulentDispersionModel/turbulentDispersionModel.C
turbulentDispersionModels/turbulentDispersionModel/newTurbulentDispersionModel.C
@ -51,6 +52,7 @@ turbulentDispersionModels/Gosman/Gosman.C
aspectRatioModels/aspectRatioModel/aspectRatioModel.C
aspectRatioModels/aspectRatioModel/newAspectRatioModel.C
aspectRatioModels/constantAspectRatio/constantAspectRatio.C
aspectRatioModels/TomiyamaAspectRatio/TomiyamaAspectRatio.C
aspectRatioModels/VakhrushevEfremov/VakhrushevEfremov.C
aspectRatioModels/Wellek/Wellek.C

View file

@ -0,0 +1,81 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 "TomiyamaAspectRatio.H"
#include "orderedPhasePair.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace aspectRatioModels
{
defineTypeNameAndDebug(TomiyamaAspectRatio, 0);
addToRunTimeSelectionTable
(
aspectRatioModel,
TomiyamaAspectRatio,
dictionary
);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::aspectRatioModels::TomiyamaAspectRatio::TomiyamaAspectRatio
(
const dictionary& dict,
const orderedPhasePair& pair
)
:
aspectRatioModel(dict, pair),
yWall_(pair.phase1().mesh().lookupObject<volScalarField>("yWall"))
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::aspectRatioModels::TomiyamaAspectRatio::~TomiyamaAspectRatio()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
Foam::tmp<Foam::volScalarField>
Foam::aspectRatioModels::TomiyamaAspectRatio::E() const
{
return
pair_.Eo()
*max
(
scalar(1) - 0.35*yWall_/pair_.dispersed().d(),
scalar(0.65)
);
}
// ************************************************************************* //

View file

@ -0,0 +1,108 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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::aspectRatioModels::TomiyamaAspectRatio
Description
Aspect ratio model of Tomiyama.
Reference:
\verbatim
"Implementation and Comparison of Correlations for interfacial Forces
in a Gas-Liquid System within an Euler-Euler Framework"
M Otromke
PhD Thesis
April 2013
\endverbatim
SourceFiles
TomiyamaAspectRatio.C
\*---------------------------------------------------------------------------*/
#ifndef TomiyamaAspectRatio_H
#define TomiyamaAspectRatio_H
#include "aspectRatioModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace aspectRatioModels
{
/*---------------------------------------------------------------------------*\
Class TomiyamaAspectRatio Declaration
\*---------------------------------------------------------------------------*/
class TomiyamaAspectRatio
:
public aspectRatioModel
{
private:
// Private data
//- Wall distance
const volScalarField& yWall_;
public:
//- Runtime type information
TypeName("Tomiyama");
// Constructors
//- Construct from a dictionary and an ordered phase pair
TomiyamaAspectRatio
(
const dictionary& dict,
const orderedPhasePair& pair
);
//- Destructor
virtual ~TomiyamaAspectRatio();
// Member Functions
//- Aspect ratio
virtual tmp<volScalarField> E() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace aspectRatioModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View file

@ -0,0 +1,97 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 "TomiyamaWallLubrication.H"
#include "phasePair.H"
#include "fvc.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace wallLubricationModels
{
defineTypeNameAndDebug(TomiyamaWallLubrication, 0);
addToRunTimeSelectionTable
(
wallLubricationModel,
TomiyamaWallLubrication,
dictionary
);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::wallLubricationModels::TomiyamaWallLubrication::TomiyamaWallLubrication
(
const dictionary& dict,
const phasePair& pair
)
:
wallLubricationModel(dict, pair),
D_("Cwd", dimLength, dict.lookup("D"))
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::wallLubricationModels::TomiyamaWallLubrication::~TomiyamaWallLubrication()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::tmp<Foam::volVectorField>
Foam::wallLubricationModels::TomiyamaWallLubrication::F() const
{
volVectorField Ur(pair_.Ur());
volVectorField nWall(- fvc::grad(yWall_));
nWall /= mag(nWall) + SMALL;
volScalarField Eo(pair_.Eo());
return
(
pos(Eo - 1.0)*neg(Eo - 5.0)*exp(-0.933*Eo + 0.179)
+ pos(Eo - 5.0)*neg(Eo - 33.0)*(0.00599*Eo - 0.0187)
+ pos(Eo - 33.0)*0.179
)
*0.5
*pair_.dispersed().d()
*(
1/sqr(yWall_)
- 1/sqr(D_ - yWall_)
)
*pair_.dispersed()
*pair_.continuous().rho()
*magSqr(Ur - (Ur & nWall)*nWall)
*nWall;
}
// ************************************************************************* //

View file

@ -0,0 +1,118 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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::wallLubricationModels::TomiyamaWallLubrication
Description
Wall lubrication model of Tomiyama.
References:
\verbatim
"Implementation and Comparison of Correlations for interfacial Forces
in a Gas-Liquid System within an Euler-Euler Framework"
M Otromke
PhD Thesis
April 2013
\endverbatim
\verbatim
"Struggle with Computational Bubble Dynamics"
A Tomiyama
Multiphase Science and Technology
Volume 10, Issue 4, Pages 369-405, 1998
\endverbatim
SourceFiles
TomiyamaWallLubrication.C
\*---------------------------------------------------------------------------*/
#ifndef TomiyamaWallLubrication_H
#define TomiyamaWallLubrication_H
#include "wallLubricationModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class phasePair;
namespace wallLubricationModels
{
/*---------------------------------------------------------------------------*\
Class TomiyamaWallLubrication Declaration
\*---------------------------------------------------------------------------*/
class TomiyamaWallLubrication
:
public wallLubricationModel
{
private:
// Private data
//- Characteristic channel dimension
const dimensionedScalar D_;
public:
//- Runtime type information
TypeName("Tomiyama");
// Constructors
//- Construct from components
TomiyamaWallLubrication
(
const dictionary& dict,
const phasePair& pair
);
//- Destructor
virtual ~TomiyamaWallLubrication();
// Member Functions
//- Wall lubrication force
tmp<volVectorField> F() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace wallLubricationModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View file

@ -1047,6 +1047,18 @@ const Foam::pointField& Foam::polyMesh::points() const
}
bool Foam::polyMesh::upToDatePoints(const regIOobject& io) const
{
return io.upToDate(points_);
}
void Foam::polyMesh::setUpToDatePoints(regIOobject& io) const
{
io.eventNo() = points_.eventNo();
}
const Foam::faceList& Foam::polyMesh::faces() const
{
if (clearedPrimitives_)
@ -1132,7 +1144,7 @@ Foam::tmp<Foam::scalarField> Foam::polyMesh::movePoints
points_.writeOpt() = IOobject::AUTO_WRITE;
points_.instance() = time().timeName();
points_.eventNo() = getEvent();
tmp<scalarField> sweptVols = primitiveMesh::movePoints
(

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
@ -394,6 +394,12 @@ public:
//- Return raw points
virtual const pointField& points() const;
//- Return true if io is up-to-date with points
virtual bool upToDatePoints(const regIOobject& io) const;
//- Set io to be up-to-date with points
virtual void setUpToDatePoints(regIOobject& io) const;
//- Return raw faces
virtual const faceList& faces() const;

View file

@ -28,6 +28,7 @@ License
#include "volFields.H"
#include "transformField.H"
#include "cellZoneMesh.H"
#include "cellSet.H"
#include "boolList.H"
#include "syncTools.H"
@ -74,8 +75,9 @@ Foam::solidBodyMotionFvMesh::solidBodyMotionFvMesh(const IOobject& io)
false
)
),
zoneID_(-1),
pointIDs_()
pointIDs_(),
moveAllCells_(false),
UName_(dynamicMeshCoeffs_.lookupOrDefault<word>("UName", "U"))
{
if (undisplacedPoints_.size() != nPoints())
{
@ -92,14 +94,31 @@ Foam::solidBodyMotionFvMesh::solidBodyMotionFvMesh(const IOobject& io)
word cellZoneName =
dynamicMeshCoeffs_.lookupOrDefault<word>("cellZone", "none");
word cellSetName =
dynamicMeshCoeffs_.lookupOrDefault<word>("cellSet", "none");
if ((cellZoneName != "none") && (cellSetName != "none"))
{
FatalIOErrorIn
(
"solidBodyMotionFvMesh::solidBodyMotionFvMesh(const IOobject&)",
dynamicMeshCoeffs_
)
<< "Either cellZone OR cellSet can be supplied, but not both. "
<< "If neither is supplied, all cells will be included"
<< exit(FatalIOError);
}
labelList cellIDs;
if (cellZoneName != "none")
{
Info<< "Applying solid body motion to cellZone " << cellZoneName
<< endl;
zoneID_ = cellZones().findZoneID(cellZoneName);
label zoneID = cellZones().findZoneID(cellZoneName);
if (zoneID_ == -1)
if (zoneID == -1)
{
FatalErrorIn
(
@ -111,16 +130,35 @@ Foam::solidBodyMotionFvMesh::solidBodyMotionFvMesh(const IOobject& io)
<< exit(FatalError);
}
const cellZone& cz = cellZones()[zoneID_];
cellIDs = cellZones()[zoneID];
}
if (cellSetName != "none")
{
Info<< "Applying solid body motion to cellSet " << cellSetName
<< endl;
cellSet set(*this, cellSetName);
cellIDs = set.toc();
}
label nCells = returnReduce(cellIDs.size(), sumOp<label>());
moveAllCells_ = nCells == 0;
if (moveAllCells_)
{
Info<< "Applying solid body motion to entire mesh" << endl;
}
else
{
// collect point IDs of points in cell zone
boolList movePts(nPoints(), false);
forAll(cz, i)
forAll(cellIDs, i)
{
label cellI = cz[i];
label cellI = cellIDs[i];
const cell& c = cells()[cellI];
forAll(c, j)
{
@ -146,10 +184,6 @@ Foam::solidBodyMotionFvMesh::solidBodyMotionFvMesh(const IOobject& io)
pointIDs_.transfer(ptIDs);
}
else
{
Info<< "Applying solid body motion to entire mesh" << endl;
}
}
@ -165,7 +199,18 @@ bool Foam::solidBodyMotionFvMesh::update()
{
static bool hasWarned = false;
if (zoneID_ != -1)
if (moveAllCells_)
{
fvMesh::movePoints
(
transform
(
SBMFPtr_().transformation(),
undisplacedPoints_
)
);
}
else
{
pointField transformedPts(undisplacedPoints_);
@ -178,31 +223,22 @@ bool Foam::solidBodyMotionFvMesh::update()
fvMesh::movePoints(transformedPts);
}
else
{
fvMesh::movePoints
(
transform
(
SBMFPtr_().transformation(),
undisplacedPoints_
)
);
}
if (foundObject<volVectorField>("U"))
if (foundObject<volVectorField>(UName_))
{
const_cast<volVectorField&>(lookupObject<volVectorField>("U"))
.correctBoundaryConditions();
const volVectorField& U = lookupObject<volVectorField>(UName_);
const_cast<volVectorField&>(U).correctBoundaryConditions();
}
else if (!hasWarned)
{
hasWarned = true;
WarningIn("solidBodyMotionFvMesh::update()")
<< "Did not find volVectorField U."
<< " Not updating U boundary conditions." << endl;
<< "Did not find volVectorField " << UName_
<< " Not updating " << UName_ << "boundary conditions."
<< endl;
}
return true;

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-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -65,12 +65,15 @@ class solidBodyMotionFvMesh
//- The reference points which are transformed
pointIOField undisplacedPoints_;
//- Specified cellZone or -1 for whole-body
label zoneID_;
//- Points to move when cell zone is supplied
labelList pointIDs_;
//- Flag to indicate whether all cells should move
bool moveAllCells_;
//- Name of velocity field
word UName_;
// Private Member Functions

View file

@ -52,19 +52,31 @@ Foam::porosityModels::DarcyForchheimer::DarcyForchheimer
)
:
porosityModel(name, modelType, mesh, dict, cellZoneName),
dXYZ_(coeffs_.lookup("d")),
fXYZ_(coeffs_.lookup("f")),
D_(cellZoneIDs_.size()),
F_(cellZoneIDs_.size()),
rhoName_(coeffs_.lookupOrDefault<word>("rho", "rho")),
muName_(coeffs_.lookupOrDefault<word>("mu", "thermo:mu")),
nuName_(coeffs_.lookupOrDefault<word>("nu", "nu"))
{
adjustNegativeResistance(dXYZ_);
adjustNegativeResistance(fXYZ_);
dimensionedVector d(coeffs_.lookup("d"));
dimensionedVector f(coeffs_.lookup("f"));
calcTranformModelData();
}
adjustNegativeResistance(d);
adjustNegativeResistance(f);
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::porosityModels::DarcyForchheimer::~DarcyForchheimer()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::porosityModels::DarcyForchheimer::calcTranformModelData()
{
if (coordSys_.R().uniform())
{
forAll (cellZoneIDs_, zoneI)
@ -72,20 +84,19 @@ Foam::porosityModels::DarcyForchheimer::DarcyForchheimer
D_[zoneI].setSize(1, tensor::zero);
F_[zoneI].setSize(1, tensor::zero);
D_[zoneI][0].xx() = d.value().x();
D_[zoneI][0].yy() = d.value().y();
D_[zoneI][0].zz() = d.value().z();
D_[zoneI][0].xx() = dXYZ_.value().x();
D_[zoneI][0].yy() = dXYZ_.value().y();
D_[zoneI][0].zz() = dXYZ_.value().z();
D_[zoneI][0] = coordSys_.R().transformTensor(D_[zoneI][0]);
// leading 0.5 is from 1/2*rho
F_[zoneI][0].xx() = 0.5*f.value().x();
F_[zoneI][0].yy() = 0.5*f.value().y();
F_[zoneI][0].zz() = 0.5*f.value().z();
F_[zoneI][0].xx() = 0.5*fXYZ_.value().x();
F_[zoneI][0].yy() = 0.5*fXYZ_.value().y();
F_[zoneI][0].zz() = 0.5*fXYZ_.value().z();
F_[zoneI][0] = coordSys_.R().transformTensor(F_[zoneI][0]);
}
}
else
{
@ -98,14 +109,14 @@ Foam::porosityModels::DarcyForchheimer::DarcyForchheimer
forAll(cells, i)
{
D_[zoneI][i].xx() = d.value().x();
D_[zoneI][i].yy() = d.value().y();
D_[zoneI][i].zz() = d.value().z();
D_[zoneI][i].xx() = dXYZ_.value().x();
D_[zoneI][i].yy() = dXYZ_.value().y();
D_[zoneI][i].zz() = dXYZ_.value().z();
// leading 0.5 is from 1/2*rho
F_[zoneI][i].xx() = 0.5*f.value().x();
F_[zoneI][i].yy() = 0.5*f.value().y();
F_[zoneI][i].zz() = 0.5*f.value().z();
F_[zoneI][i].xx() = 0.5*fXYZ_.value().x();
F_[zoneI][i].yy() = 0.5*fXYZ_.value().y();
F_[zoneI][i].zz() = 0.5*fXYZ_.value().z();
}
D_[zoneI] = coordSys_.R().transformTensor(D_[zoneI], cells);
@ -115,14 +126,6 @@ Foam::porosityModels::DarcyForchheimer::DarcyForchheimer
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::porosityModels::DarcyForchheimer::~DarcyForchheimer()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::porosityModels::DarcyForchheimer::calcForce
(
const volVectorField& U,

View file

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -74,11 +74,16 @@ private:
// Private data
//- Darcy coeffient XYZ components (user-supplied) [1/m2]
dimensionedVector dXYZ_;
//- Darcy coefficient [1/m2]
//- Forchheimer coeffient XYZ components (user-supplied) [1/m]
dimensionedVector fXYZ_;
//- Darcy coefficient - converted from dXYZ [1/m2]
List<tensorField> D_;
//- Forchheimer coefficient [1/m]
//- Forchheimer coefficient - converted from fXYZ [1/m]
List<tensorField> F_;
//- Name of density field
@ -143,6 +148,9 @@ public:
// Member Functions
//- Transform the model data wrt mesh changes
virtual void calcTranformModelData();
//- Calculate the porosity force
virtual void calcForce
(

View file

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -111,15 +111,28 @@ Foam::porosityModels::fixedCoeff::fixedCoeff
)
:
porosityModel(name, modelType, mesh, dict, cellZoneName),
alphaXYZ_(coeffs_.lookup("alpha")),
betaXYZ_(coeffs_.lookup("beta")),
alpha_(cellZoneIDs_.size()),
beta_(cellZoneIDs_.size())
{
dimensionedVector alpha(coeffs_.lookup("alpha"));
dimensionedVector beta(coeffs_.lookup("beta"));
adjustNegativeResistance(alphaXYZ_);
adjustNegativeResistance(betaXYZ_);
adjustNegativeResistance(alpha);
adjustNegativeResistance(beta);
calcTranformModelData();
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::porosityModels::fixedCoeff::~fixedCoeff()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::porosityModels::fixedCoeff::calcTranformModelData()
{
if (coordSys_.R().uniform())
{
forAll (cellZoneIDs_, zoneI)
@ -127,14 +140,14 @@ Foam::porosityModels::fixedCoeff::fixedCoeff
alpha_[zoneI].setSize(1, tensor::zero);
beta_[zoneI].setSize(1, tensor::zero);
alpha_[zoneI][0].xx() = alpha.value().x();
alpha_[zoneI][0].yy() = alpha.value().y();
alpha_[zoneI][0].zz() = alpha.value().z();
alpha_[zoneI][0].xx() = alphaXYZ_.value().x();
alpha_[zoneI][0].yy() = alphaXYZ_.value().y();
alpha_[zoneI][0].zz() = alphaXYZ_.value().z();
alpha_[zoneI][0] = coordSys_.R().transformTensor(alpha_[zoneI][0]);
beta_[zoneI][0].xx() = beta.value().x();
beta_[zoneI][0].yy() = beta.value().y();
beta_[zoneI][0].zz() = beta.value().z();
beta_[zoneI][0].xx() = betaXYZ_.value().x();
beta_[zoneI][0].yy() = betaXYZ_.value().y();
beta_[zoneI][0].zz() = betaXYZ_.value().z();
beta_[zoneI][0] = coordSys_.R().transformTensor(beta_[zoneI][0]);
}
}
@ -149,13 +162,13 @@ Foam::porosityModels::fixedCoeff::fixedCoeff
forAll(cells, i)
{
alpha_[zoneI][i].xx() = alpha.value().x();
alpha_[zoneI][i].yy() = alpha.value().y();
alpha_[zoneI][i].zz() = alpha.value().z();
alpha_[zoneI][i].xx() = alphaXYZ_.value().x();
alpha_[zoneI][i].yy() = alphaXYZ_.value().y();
alpha_[zoneI][i].zz() = alphaXYZ_.value().z();
beta_[zoneI][i].xx() = beta.value().x();
beta_[zoneI][i].yy() = beta.value().y();
beta_[zoneI][i].zz() = beta.value().z();
beta_[zoneI][i].xx() = betaXYZ_.value().x();
beta_[zoneI][i].yy() = betaXYZ_.value().y();
beta_[zoneI][i].zz() = betaXYZ_.value().z();
}
alpha_[zoneI] =
@ -167,14 +180,6 @@ Foam::porosityModels::fixedCoeff::fixedCoeff
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::porosityModels::fixedCoeff::~fixedCoeff()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::porosityModels::fixedCoeff::calcForce
(
const volVectorField& U,

View file

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -64,10 +64,16 @@ private:
// Private data
//- Model alpha coefficient [1/s]
//- alpha coefficient XYZ components (user-supplied) [1/s]
dimensionedVector alphaXYZ_;
//- beta coefficient XYZ components (user-supplied) [1/m]
dimensionedVector betaXYZ_;
//- Model alpha coefficient - converted from alphaXYZ [1/s]
List<tensorField> alpha_;
//- Model beta coefficient [1/m]
//- Model beta coefficient - converted from betaXYZ [1/m]
List<tensorField> beta_;
@ -119,6 +125,9 @@ public:
// Member Functions
//- Transform the model data wrt mesh changes
virtual void calcTranformModelData();
//- Calculate the porosity force
virtual void calcForce
(

View file

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -147,13 +147,27 @@ Foam::porosityModel::~porosityModel()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::porosityModel::transformModelData()
{
if (!mesh_.upToDatePoints(*this))
{
calcTranformModelData();
// set model up-to-date wrt points
mesh_.setUpToDatePoints(*this);
}
}
Foam::tmp<Foam::vectorField> Foam::porosityModel::porosityModel::force
(
const volVectorField& U,
const volScalarField& rho,
const volScalarField& mu
) const
)
{
transformModelData();
tmp<vectorField> tforce(new vectorField(U.size(), vector::zero));
if (!cellZoneIDs_.empty())
@ -165,16 +179,14 @@ Foam::tmp<Foam::vectorField> Foam::porosityModel::porosityModel::force
}
void Foam::porosityModel::addResistance
(
fvVectorMatrix& UEqn
) const
void Foam::porosityModel::addResistance(fvVectorMatrix& UEqn)
{
if (cellZoneIDs_.empty())
{
return;
}
transformModelData();
this->correct(UEqn);
}
@ -184,13 +196,14 @@ void Foam::porosityModel::addResistance
fvVectorMatrix& UEqn,
const volScalarField& rho,
const volScalarField& mu
) const
)
{
if (cellZoneIDs_.empty())
{
return;
}
transformModelData();
this->correct(UEqn, rho, mu);
}
@ -200,13 +213,14 @@ void Foam::porosityModel::addResistance
const fvVectorMatrix& UEqn,
volTensorField& AU,
bool correctAUprocBC
) const
)
{
if (cellZoneIDs_.empty())
{
return;
}
transformModelData();
this->correct(UEqn, AU);
if (correctAUprocBC)
@ -219,24 +233,12 @@ void Foam::porosityModel::addResistance
}
bool Foam::porosityModel::movePoints()
{
// no updates necessary; all member data independent of mesh
return true;
}
void Foam::porosityModel::updateMesh(const mapPolyMesh& mpm)
{
// no updates necessary; all member data independent of mesh
}
bool Foam::porosityModel::writeData(Ostream& os) const
{
return true;
}
bool Foam::porosityModel::read(const dictionary& dict)
{
active_ = readBool(dict.lookup("active"));

View file

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -99,6 +99,10 @@ protected:
// Protected Member Functions
//- Transform the model data wrt mesh changes
virtual void calcTranformModelData() = 0;
//- Adjust negative resistance values to be multiplier of max value
void adjustNegativeResistance(dimensionedVector& resist);
@ -221,16 +225,19 @@ public:
//- Return const access to the cell zone IDs
inline const labelList& cellZoneIDs() const;
//- Transform the model data wrt mesh changes
virtual void transformModelData();
//- Return the force over the cell zone(s)
virtual tmp<vectorField> force
(
const volVectorField& U,
const volScalarField& rho,
const volScalarField& mu
) const;
);
//- Add resistance
virtual void addResistance(fvVectorMatrix& UEqn) const;
virtual void addResistance(fvVectorMatrix& UEqn);
//- Add resistance
virtual void addResistance
@ -238,7 +245,7 @@ public:
fvVectorMatrix& UEqn,
const volScalarField& rho,
const volScalarField& mu
) const;
);
//- Add resistance
virtual void addResistance
@ -246,16 +253,7 @@ public:
const fvVectorMatrix& UEqn,
volTensorField& AU,
bool correctAUprocBC
) const;
// Topology change
//- Move points
virtual bool movePoints();
//- Update on meshUpdate
virtual void updateMesh(const mapPolyMesh& mpm);
);
// I-O

View file

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -126,7 +126,7 @@ bool Foam::porosityModelList::writeData(Ostream& os) const
void Foam::porosityModelList::addResistance
(
fvVectorMatrix& UEqn
) const
)
{
forAll(*this, i)
{
@ -140,7 +140,7 @@ void Foam::porosityModelList::addResistance
fvVectorMatrix& UEqn,
const volScalarField& rho,
const volScalarField& mu
) const
)
{
forAll(*this, i)
{
@ -154,7 +154,7 @@ void Foam::porosityModelList::addResistance
const fvVectorMatrix& UEqn,
volTensorField& AU,
bool correctAUprocBC
) const
)
{
forAll(*this, i)
{

View file

@ -94,7 +94,7 @@ public:
void reset(const dictionary& dict);
//- Add resistance
void addResistance(fvVectorMatrix& UEqn) const;
void addResistance(fvVectorMatrix& UEqn);
//- Add resistance
void addResistance
@ -102,7 +102,7 @@ public:
fvVectorMatrix& UEqn,
const volScalarField& rho,
const volScalarField& mu
) const;
);
//- Add resistance
void addResistance
@ -110,7 +110,7 @@ public:
const fvVectorMatrix& UEqn,
volTensorField& AU,
bool correctAUprocBC = true
) const;
);
// I-O

View file

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -66,6 +66,12 @@ Foam::porosityModels::powerLaw::~powerLaw()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::porosityModels::powerLaw::calcTranformModelData()
{
// nothing to be transformed
}
void Foam::porosityModels::powerLaw::calcForce
(
const volVectorField& U,

View file

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -127,6 +127,9 @@ public:
// Member Functions
//- Transform the model data wrt mesh changes
virtual void calcTranformModelData();
//- Calculate the porosity force
virtual void calcForce
(

View file

@ -151,13 +151,14 @@ void Foam::cyclicAMIPolyPatch::calcTransforms
-rotationAxis_.y(), rotationAxis_.x(), 0
);
tensor RPos
tensor revTPos
(
T
+ cos(rotationAngle_)*(tensor::I - T)
+ sin(rotationAngle_)*S
);
tensor RNeg
tensor revTNeg
(
T
+ cos(-rotationAngle_)*(tensor::I - T)
@ -166,28 +167,27 @@ void Foam::cyclicAMIPolyPatch::calcTransforms
// check - assume correct angle when difference in face areas
// is the smallest
vector transformedAreaPos = sum(half0Areas & RPos);
vector transformedAreaNeg = sum(half0Areas & RNeg);
vector area1 = sum(half1Areas);
reduce(transformedAreaPos, sumOp<vector>());
reduce(transformedAreaNeg, sumOp<vector>());
reduce(area1, sumOp<vector>());
vector transformedAreaPos = gSum(half1Areas & revTPos);
vector transformedAreaNeg = gSum(half1Areas & revTNeg);
vector area0 = gSum(half0Areas);
scalar errorPos = mag(transformedAreaPos - area1);
scalar errorNeg = mag(transformedAreaNeg - area1);
// areas have opposite sign, so sum should be zero when
// correct rotation applied
scalar errorPos = mag(transformedAreaPos + area0);
scalar errorNeg = mag(transformedAreaNeg + area0);
if (errorPos < errorNeg)
{
revT = RPos;
revT = revTPos;
}
else
{
revT = RNeg;
revT = revTNeg;
rotationAngle_ *= -1;
}
scalar areaError =
min(errorPos, errorNeg)/(mag(area1) + ROOTVSMALL);
min(errorPos, errorNeg)/(mag(area0) + ROOTVSMALL);
if (areaError > matchTolerance())
{

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
@ -203,20 +203,6 @@ Foam::label Foam::metisDecomp::decompose
// output: number of cut edges
int edgeCut = 0;
// Vertex weight info
int* vwgtPtr = NULL;
int* adjwgtPtr = NULL;
if (cellWeights.size())
{
vwgtPtr = cellWeights.begin();
}
if (faceWeights.size())
{
adjwgtPtr = faceWeights.begin();
}
if (method == "recursive")
{
METIS_PartGraphRecursive

View file

@ -922,7 +922,8 @@ void Foam::forces::calcForcesMoment()
forAllConstIter(HashTable<const porosityModel*>, models, iter)
{
const porosityModel& pm = *iter();
// non-const access required if mesh is changing
porosityModel& pm = const_cast<porosityModel&>(*iter());
vectorField fPTot(pm.force(U, rho, mu));