Merge branch 'master' of /home/dm4/OpenFOAM/OpenFOAM-dev

This commit is contained in:
Sergio Ferraris
2013-08-16 10:18:50 +01:00
781 changed files with 14974 additions and 30199 deletions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -296,7 +296,7 @@ Foam::Istream& Foam::ISstream::read(token& t)
buf[nChar++] = c;
// get everything that could resemble a number and let
// strtod() determine the validity
// readScalar determine the validity
while
(
is_.get(c)
@ -348,24 +348,25 @@ Foam::Istream& Foam::ISstream::read(token& t)
}
else
{
char *endptr = NULL;
if (asLabel)
{
long longVal(strtol(buf, &endptr, 10));
t = label(longVal);
// return as a scalar if doesn't fit in a label
if (*endptr || t.labelToken() != longVal)
label labelVal;
if (readLabel(buf, labelVal))
{
t = scalar(strtod(buf, &endptr));
t = labelVal;
}
}
else
{
scalar scalarVal(strtod(buf, &endptr));
t = scalarVal;
else
{
// Maybe too big? Try as scalar
scalar scalarVal;
if (readScalar(buf, scalarVal))
{
t = scalarVal;
}
else
{
t.setBad();
}
// ---------------------------------------
// this would also be possible if desired:
// ---------------------------------------
@ -380,12 +381,20 @@ Foam::Istream& Foam::ISstream::read(token& t)
// t = labelVal;
// }
// }
}
// not everything converted: bad format or trailing junk
if (*endptr)
}
}
else
{
t.setBad();
scalar scalarVal;
if (readScalar(buf, scalarVal))
{
t = scalarVal;
}
else
{
t.setBad();
}
}
}
}

View File

@ -206,14 +206,26 @@ Foam::functionEntries::codeStream::getFunction
off_t masterSize = mySize;
Pstream::scatter(masterSize);
if (debug)
{
Pout<< endl<< "on processor " << Pstream::myProcNo()
<< " have masterSize:" << masterSize
<< " and localSize:" << mySize
<< endl;
}
if (mySize < masterSize)
{
Pout<< "Local file " << libPath
<< " not of same size (" << mySize
<< ") as master ("
<< masterSize << "). Waiting for "
<< regIOobject::fileModificationSkew
<< " seconds." << endl;
if (debug)
{
Pout<< "Local file " << libPath
<< " not of same size (" << mySize
<< ") as master ("
<< masterSize << "). Waiting for "
<< regIOobject::fileModificationSkew
<< " seconds." << endl;
}
Foam::sleep(regIOobject::fileModificationSkew);
// Recheck local size
@ -237,6 +249,14 @@ Foam::functionEntries::codeStream::getFunction
<< exit(FatalIOError);
}
}
if (debug)
{
Pout<< endl<< "on processor " << Pstream::myProcNo()
<< " after waiting: have masterSize:" << masterSize
<< " and localSize:" << mySize
<< endl;
}
}
if (isA<IOdictionary>(topDict(parentDict)))
@ -244,6 +264,12 @@ Foam::functionEntries::codeStream::getFunction
// Cached access to dl libs. Guarantees clean up upon destruction
// of Time.
dlLibraryTable& dlLibs = libs(parentDict);
if (debug)
{
Pout<< "Opening cached dictionary:" << libPath << endl;
}
if (!dlLibs.open(libPath, false))
{
FatalIOErrorIn
@ -261,10 +287,28 @@ Foam::functionEntries::codeStream::getFunction
else
{
// Uncached opening of libPath
if (debug)
{
Pout<< "Opening uncached dictionary:" << libPath << endl;
}
lib = dlOpen(libPath, true);
}
}
bool haveLib = lib;
reduce(haveLib, andOp<bool>());
if (!haveLib)
{
FatalIOErrorIn
(
"functionEntries::codeStream::execute(..)",
parentDict
) << "Failed loading library " << libPath
<< " on some processors."
<< exit(FatalIOError);
}
// Find the function handle in the library
streamingFunctionType function =

View File

@ -267,7 +267,13 @@ Foam::Tuple2<Foam::label, Foam::scalar> Foam::lduAddressing::band() const
}
label bandwidth = max(cellBandwidth);
scalar profile = sum(1.0*cellBandwidth);
// Do not use field algebra because of conversion label to scalar
scalar profile = 0.0;
forAll(cellBandwidth, cellI)
{
profile += 1.0*cellBandwidth[cellI];
}
return Tuple2<label, scalar>(bandwidth, profile);
}

View File

@ -41,19 +41,6 @@ defineTypeNameAndDebug(polyBoundaryMesh, 0);
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
Foam::labelList Foam::polyBoundaryMesh::ident(const label len)
{
labelList elems(len);
forAll(elems, elemI)
{
elems[elemI] = elemI;
}
return elems;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::polyBoundaryMesh::polyBoundaryMesh

View File

@ -78,9 +78,6 @@ class polyBoundaryMesh
// Private Member Functions
//- Create identity map
static labelList ident(const label len);
//- Calculate the geometry for the patches (transformation tensors etc.)
void calcGeometry();

View File

@ -170,7 +170,7 @@ Foam::polyMesh::polyMesh(const IOobject& io)
IOobject
(
"owner",
time().findInstance(meshDir(), "faces"),
faces_.instance(),
meshSubDir,
*this,
IOobject::READ_IF_PRESENT,
@ -182,7 +182,7 @@ Foam::polyMesh::polyMesh(const IOobject& io)
IOobject
(
"neighbour",
time().findInstance(meshDir(), "faces"),
faces_.instance(),
meshSubDir,
*this,
IOobject::READ_IF_PRESENT,

View File

@ -105,7 +105,8 @@ bool Foam::polyMesh::checkFaceOrthogonality
<< faceI
<< " between cells " << own[faceI]
<< " and " << nei[faceI]
<< ": Angle = " << radToDeg(::acos(ortho[faceI]))
<< ": Angle = "
<< radToDeg(::acos(min(1.0, max(-1.0, ortho[faceI]))))
<< " deg." << endl;
}
@ -134,8 +135,9 @@ bool Foam::polyMesh::checkFaceOrthogonality
if (debug || report)
{
Info<< " Mesh non-orthogonality Max: "
<< radToDeg(::acos(minDDotS))
<< " average: " << radToDeg(::acos(sumDDotS/nSummed))
<< radToDeg(::acos(min(1.0, max(-1.0, minDDotS))))
<< " average: "
<< radToDeg(::acos(min(1.0, max(-1.0, sumDDotS/nSummed))))
<< endl;
}
}

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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -58,6 +58,14 @@ static const doubleScalar doubleScalarSMALL = 1.0e-15;
static const doubleScalar doubleScalarVSMALL = 1.0e-300;
static const doubleScalar doubleScalarROOTVSMALL = 1.0e-150;
//- Read whole of buf as a scalar. Return true if succesful.
inline bool readScalar(const char* buf, doubleScalar& s)
{
char* endPtr;
s = strtod(buf, &endPtr);
return (*endPtr == '\0');
}
#define Scalar doubleScalar
#define ScalarVGREAT doubleScalarVGREAT

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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -58,6 +58,14 @@ static const floatScalar floatScalarSMALL = 1.0e-6;
static const floatScalar floatScalarVSMALL = 1.0e-37;
static const floatScalar floatScalarROOTVSMALL = 1.0e-18;
//- Read whole of buf as a scalar. Return true if succesful.
inline bool readScalar(const char* buf, floatScalar& s)
{
char* endPtr;
s = strtof(buf, &endPtr);
return (*endPtr == '\0');
}
#define Scalar floatScalar
#define ScalarVGREAT floatScalarVGREAT

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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -54,6 +54,7 @@ word name(const int);
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
int readInt(Istream&);
bool readInt(const char*, int&);
Istream& operator>>(Istream&, int&);
Ostream& operator<<(Ostream&, const int);

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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -88,6 +88,15 @@ int Foam::readInt(Istream& is)
}
bool Foam::readInt(const char* buf, int& s)
{
char *endptr = NULL;
long l = strtol(buf, &endptr, 10);
s = int(l);
return (*endptr == 0);
}
Foam::Ostream& Foam::operator<<(Ostream& os, const int i)
{
os.write(label(i));

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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -72,6 +72,11 @@ namespace Foam
return readInt(is);
}
inline bool readLabel(const char* buf, label& s)
{
return readInt(buf, s);
}
} // End namespace Foam
@ -96,6 +101,11 @@ namespace Foam
return readLong(is);
}
inline bool readLabel(const char* buf, label& s)
{
return readLong(buf, s);
}
} // End namespace Foam
@ -122,6 +132,11 @@ namespace Foam
return readLongLong(is);
}
inline bool readLabel(const char* buf, label& s)
{
return readLongLong(buf, s);
}
} // End namespace Foam
#endif

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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -53,6 +53,7 @@ word name(const long);
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
long readLong(Istream&);
bool readLong(const char*, long&);
Istream& operator>>(Istream&, long&);
Ostream& operator<<(Ostream&, const long);

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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -85,6 +85,13 @@ long Foam::readLong(Istream& is)
return val;
}
bool Foam::readLong(const char* buf, long& s)
{
char *endptr = NULL;
s = strtol(buf, &endptr, 10);
return (*endptr == 0);
}
Foam::Ostream& Foam::operator<<(Ostream& os, const long l)
{

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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -53,6 +53,7 @@ word name(long long);
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
long long readLongLong(Istream&);
bool readLongLong(const char*, long long&);
Istream& operator>>(Istream&, long long&);
Ostream& operator<<(Ostream&, const long long);

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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -87,6 +87,14 @@ long long Foam::readLongLong(Istream& is)
}
bool Foam::readLongLong(const char* buf, long long& s)
{
char *endptr = NULL;
s = strtoll(buf, &endptr, 10);
return (*endptr == 0);
}
Foam::Ostream& Foam::operator<<(Ostream& os, const long long l)
{
long long val = l;

View File

@ -66,6 +66,13 @@ const triad triad::min
vector(-VGREAT, -VGREAT, -VGREAT)
);
const triad triad::I
(
vector(1, 0, 0),
vector(0, 1, 0),
vector(0, 0, 1)
);
const triad triad::unset
(
vector(VGREAT, VGREAT, VGREAT),

View File

@ -100,6 +100,7 @@ public:
static const triad one;
static const triad max;
static const triad min;
static const triad I;
static const triad unset;

View File

@ -28,7 +28,23 @@ Group
grpRASTurbulence
Description
Standard k-epsilon turbulence model
Mixture k-epsilon turbulence model for two-phase gas-liquid systems
The basic structure of the model is based on:
\verbatim
"Modelling of dispersed bubble and droplet ow at high phase fractions"
A. Behzadi, R.I. Issa , H. Rusche,
Chemical Engineering Science (59) 2004 pp.759-770.
\endverbatim
but an effective density for the gas is used in the averaging and an
alternative model for bubble-generated turbulence from:
\verbatim
"The simulation of multidimensional multiphase flows",
Lahey R.T.,
Nucl. Eng. & Design
(235) 2005 pp.1043-1060.
\endverbatim
The default model coefficients correspond to the following:
\verbatim
@ -37,7 +53,7 @@ Description
Cmu 0.09;
C1 1.44;
C2 1.92;
C3 -0.33;
C3 C2;
sigmak 1.0;
sigmaEps 1.3;
}

View File

@ -36,7 +36,6 @@ polyTopoChange/polyTopoChange/refinementDistanceData.C
polyTopoChange/polyTopoChange/refinementHistory.C
polyTopoChange/polyTopoChange/removePoints.C
polyTopoChange/polyTopoChange/combineFaces.C
polyTopoChange/polyTopoChange/localPointRegion.C
polyTopoChange/polyTopoChange/duplicatePoints.C
polyTopoChange/polyTopoChange/tetDecomposer.C

View File

@ -39,7 +39,8 @@ Foam::variableHeightFlowRateInletVelocityFvPatchVectorField
)
:
fixedValueFvPatchField<vector>(p, iF),
flowRate_(0)
flowRate_(0),
alphaName_("none")
{}
@ -53,7 +54,8 @@ Foam::variableHeightFlowRateInletVelocityFvPatchVectorField
)
:
fixedValueFvPatchField<vector>(ptf, p, iF, mapper),
flowRate_(ptf.flowRate_)
flowRate_(ptf.flowRate_),
alphaName_(ptf.alphaName_)
{}
@ -66,7 +68,8 @@ Foam::variableHeightFlowRateInletVelocityFvPatchVectorField
)
:
fixedValueFvPatchField<vector>(p, iF, dict),
flowRate_(readScalar(dict.lookup("flowRate")))
flowRate_(readScalar(dict.lookup("flowRate"))),
alphaName_(dict.lookup("alpha"))
{}
@ -77,7 +80,8 @@ Foam::variableHeightFlowRateInletVelocityFvPatchVectorField
)
:
fixedValueFvPatchField<vector>(ptf),
flowRate_(ptf.flowRate_)
flowRate_(ptf.flowRate_),
alphaName_(ptf.alphaName_)
{}
@ -89,7 +93,8 @@ Foam::variableHeightFlowRateInletVelocityFvPatchVectorField
)
:
fixedValueFvPatchField<vector>(ptf, iF),
flowRate_(ptf.flowRate_)
flowRate_(ptf.flowRate_),
alphaName_(ptf.alphaName_)
{}
@ -104,7 +109,7 @@ void Foam::variableHeightFlowRateInletVelocityFvPatchVectorField
}
scalarField alphap =
patch().lookupPatchField<volScalarField, scalar>("alpha1");
patch().lookupPatchField<volScalarField, scalar>(alphaName_);
alphap = max(alphap, scalar(0));
alphap = min(alphap, scalar(1));
@ -129,6 +134,8 @@ void Foam::variableHeightFlowRateInletVelocityFvPatchVectorField::write
os.writeKeyword("flowRate") << flowRate_
<< token::END_STATEMENT << nl;
os.writeKeyword("alpha") << alphaName_
<< token::END_STATEMENT << nl;
writeEntry("value", os);
}

View File

@ -39,6 +39,7 @@ Description
\table
Property | Description | Required | Default value
flowRate | volumetric flow rate [m3/s] | yes |
alpha | phase-fraction field | yes |
\endtable
Example of the boundary condition specification:
@ -47,6 +48,7 @@ Description
{
type variableHeightFlowRateInletVelocity;
flowRate 0.2;
alpha alpha.water;
value uniform (0 0 0); // placeholder
}
\endverbatim
@ -87,6 +89,9 @@ class variableHeightFlowRateInletVelocityFvPatchVectorField
//- Inlet integral flow rate
scalar flowRate_;
//- Name of the phase-fraction field
word alphaName_;
public:

View File

@ -485,11 +485,12 @@ void Foam::MULES::limiter
const labelList& pFaceCells =
mesh.boundary()[patchi].faceCells();
const scalarField& phiBDPf = phiBDBf[patchi];
const scalarField& phiCorrPf = phiCorrBf[patchi];
forAll(lambdaPf, pFacei)
{
// Limit outlet faces only
if (phiBDPf[pFacei] > 0)
if ((phiBDPf[pFacei] + phiCorrPf[pFacei]) > SMALL*SMALL)
{
label pfCelli = pFaceCells[pFacei];
@ -862,7 +863,7 @@ void Foam::MULES::limiterCorr
forAll(lambdaPf, pFacei)
{
// Limit outlet faces only
if (phiCorrPf[pFacei] > 0)
if (phiCorrPf[pFacei] > SMALL*SMALL)
{
label pfCelli = pFaceCells[pFacei];

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -1371,6 +1371,12 @@ void Foam::fvMeshSubset::setLargeCellSubset
}
bool Foam::fvMeshSubset::hasSubMesh() const
{
return fvMeshSubsetPtr_.valid();
}
const fvMesh& Foam::fvMeshSubset::subMesh() const
{
checkCellSubset();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -268,6 +268,9 @@ public:
return baseMesh_;
}
//- Have subMesh?
bool hasSubMesh() const;
//- Return reference to subset mesh
const fvMesh& subMesh() const;

View File

@ -255,6 +255,7 @@ Foam::fv::option::option
)
:
name_(name),
modelType_(modelType),
mesh_(mesh),
dict_(dict),
coeffs_(dict.subDict(modelType + "Coeffs")),

View File

@ -94,7 +94,10 @@ protected:
// Protected data
//- Source name
word name_;
const word name_;
//- Model type
const word modelType_;
//- Reference to the mesh database
const fvMesh& mesh_;

View File

@ -96,7 +96,7 @@ bool Foam::fv::option::read(const dictionary& dict)
dict.lookup("duration") >> duration_;
}
coeffs_ = dict.subDict(type() + "Coeffs");
coeffs_ = dict.subDict(modelType_ + "Coeffs");
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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -234,4 +234,16 @@ void Foam::CollidingCloud<CloudType>::motion(TrackData& td)
}
template<class CloudType>
void Foam::CollidingCloud<CloudType>::info()
{
CloudType::info();
scalar rotationalKineticEnergy = rotationalKineticEnergyOfSystem();
reduce(rotationalKineticEnergy, sumOp<scalar>());
Info<< " Rotational kinetic energy = "
<< rotationalKineticEnergy << nl;
}
// ************************************************************************* //

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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -197,8 +197,13 @@ public:
inline CollisionModel<CollidingCloud<CloudType> >&
collision();
// Check
// Evolution
//- Total rotational kinetic energy in the system
inline scalar rotationalKineticEnergyOfSystem() const;
// Cloud evolution functions
//- Store the current cloud state
void storeState();
@ -212,6 +217,12 @@ public:
//- Particle motion
template<class TrackData>
void motion(TrackData& td);
// I-O
//- Print cloud information
void info();
};

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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -49,4 +49,22 @@ Foam::CollidingCloud<CloudType>::collision()
}
template<class CloudType>
inline Foam::scalar
Foam::CollidingCloud<CloudType>::rotationalKineticEnergyOfSystem() const
{
scalar rotationalKineticEnergy = 0.0;
forAllConstIter(typename CollidingCloud<CloudType>, *this, iter)
{
const parcelType& p = iter();
rotationalKineticEnergy +=
p.nParticle()*0.5*p.momentOfInertia()*(p.omega() & p.omega());
}
return rotationalKineticEnergy;
}
// ************************************************************************* //

View File

@ -864,9 +864,6 @@ void Foam::KinematicCloud<CloudType>::info()
scalar linearKineticEnergy = linearKineticEnergyOfSystem();
reduce(linearKineticEnergy, sumOp<scalar>());
scalar rotationalKineticEnergy = rotationalKineticEnergyOfSystem();
reduce(rotationalKineticEnergy, sumOp<scalar>());
Info<< "Cloud: " << this->name() << nl
<< " Current number of parcels = "
<< returnReduce(this->size(), sumOp<label>()) << nl
@ -877,9 +874,7 @@ void Foam::KinematicCloud<CloudType>::info()
<< " |Linear momentum| = "
<< mag(linearMomentum) << nl
<< " Linear kinetic energy = "
<< linearKineticEnergy << nl
<< " Rotational kinetic energy = "
<< rotationalKineticEnergy << nl;
<< linearKineticEnergy << nl;
injectors_.info(Info);
this->surfaceFilm().info(Info);

View File

@ -487,9 +487,6 @@ public:
//- Total linear kinetic energy in the system
inline scalar linearKineticEnergyOfSystem() const;
//- Total rotational kinetic energy in the system
inline scalar rotationalKineticEnergyOfSystem() const;
//- Penetration for fraction [0-1] of the current total mass
inline scalar penetration(const scalar fraction) const;

View File

@ -307,24 +307,6 @@ Foam::KinematicCloud<CloudType>::linearKineticEnergyOfSystem() const
}
template<class CloudType>
inline Foam::scalar
Foam::KinematicCloud<CloudType>::rotationalKineticEnergyOfSystem() const
{
scalar rotationalKineticEnergy = 0.0;
forAllConstIter(typename KinematicCloud<CloudType>, *this, iter)
{
const parcelType& p = iter();
rotationalKineticEnergy +=
p.nParticle()*0.5*p.momentOfInertia()*(p.omega() & p.omega());
}
return rotationalKineticEnergy;
}
template<class CloudType>
inline Foam::scalar Foam::KinematicCloud<CloudType>::Dij
(

View File

@ -86,7 +86,7 @@ public:
virtual scalar linearKineticEnergyOfSystem() const = 0;
//- Total rotational kinetic energy in the system
virtual scalar rotationalKineticEnergyOfSystem() const = 0;
// virtual scalar rotationalKineticEnergyOfSystem() const = 0;
//- Penetration for percentage of the current total mass
// virtual scalar penetration(const scalar& fraction) const = 0;

View File

@ -34,6 +34,9 @@ Foam::CollidingParcel<ParcelType>::CollidingParcel
)
:
ParcelType(p),
f_(p.f_),
angularMomentum_(p.angularMomentum_),
torque_(p.torque_),
collisionRecords_(p.collisionRecords_)
{}
@ -46,6 +49,9 @@ Foam::CollidingParcel<ParcelType>::CollidingParcel
)
:
ParcelType(p, mesh),
f_(p.f_),
angularMomentum_(p.angularMomentum_),
torque_(p.torque_),
collisionRecords_(p.collisionRecords_)
{}
@ -166,6 +172,29 @@ bool Foam::CollidingParcel<ParcelType>::move
}
template<class ParcelType>
void Foam::CollidingParcel<ParcelType>::transformProperties(const tensor& T)
{
ParcelType::transformProperties(T);
f_ = transform(T, f_);
angularMomentum_ = transform(T, angularMomentum_);
torque_ = transform(T, torque_);
}
template<class ParcelType>
void Foam::CollidingParcel<ParcelType>::transformProperties
(
const vector& separation
)
{
ParcelType::transformProperties(separation);
}
// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * //
#include "CollidingParcelIO.C"

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -66,7 +66,7 @@ Ostream& operator<<
);
/*---------------------------------------------------------------------------*\
Class CollidingParcel Declaration
Class CollidingParcel Declaration
\*---------------------------------------------------------------------------*/
template<class ParcelType>
@ -78,6 +78,16 @@ protected:
// Protected data
//- Force on particle due to collisions [N]
vector f_;
//- Angular momentum of Parcel in global reference frame [kg m2/s]
vector angularMomentum_;
//- Torque on particle due to collisions in global
// reference frame [Nm]
vector torque_;
//- Particle collision records
collisionRecordList collisionRecords_;
@ -93,7 +103,10 @@ public:
AddToPropertyList
(
ParcelType,
" collisionRecordsPairAccessed"
" (fx fy fz)"
+ " (angularMomentumx angularMomentumy angularMomentumz)"
+ " (torquex torquey torquez)"
+ " collisionRecordsPairAccessed"
+ " collisionRecordsPairOrigProcOfOther"
+ " collisionRecordsPairOrigIdOfOther"
+ " (collisionRecordsPairData)"
@ -188,12 +201,33 @@ public:
// Access
//- Return const access to force
inline const vector& f() const;
//- Return const access to angular momentum
inline const vector& angularMomentum() const;
//- Return const access to torque
inline const vector& torque() const;
//- Return const access to the collision records
inline const collisionRecordList& collisionRecords() const;
//- Return access to force
inline vector& f();
//- Return access to angular momentum
inline vector& angularMomentum();
//- Return access to torque
inline vector& torque();
//- Return access to collision records
inline collisionRecordList& collisionRecords();
//- Particle angular velocity
inline vector omega() const;
// Tracking
@ -201,6 +235,14 @@ public:
template<class TrackData>
bool move(TrackData& td, const scalar trackTime);
//- Transform the physical properties of the particle
// according to the given transformation tensor
virtual void transformProperties(const tensor& T);
//- Transform the physical properties of the particle
// according to the given separation vector
virtual void transformProperties(const vector& separation);
// 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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -36,6 +36,9 @@ inline Foam::CollidingParcel<ParcelType>::CollidingParcel
)
:
ParcelType(owner, position, cellI, tetFaceI, tetPtI),
f_(vector::zero),
angularMomentum_(vector::zero),
torque_(vector::zero),
collisionRecords_()
{}
@ -70,18 +73,39 @@ inline Foam::CollidingParcel<ParcelType>::CollidingParcel
nParticle0,
d0,
dTarget0,
U0,
f0,
angularMomentum0,
torque0,
constProps
),
f_(f0),
angularMomentum_(angularMomentum0),
torque_(torque0),
collisionRecords_()
{}
// * * * * * * * CollidingParcel Member Functions * * * * * * * //
template<class ParcelType>
inline const Foam::vector& Foam::CollidingParcel<ParcelType>::f() const
{
return f_;
}
template<class ParcelType>
inline const Foam::vector&
Foam::CollidingParcel<ParcelType>::angularMomentum() const
{
return angularMomentum_;
}
template<class ParcelType>
inline const Foam::vector& Foam::CollidingParcel<ParcelType>::torque() const
{
return torque_;
}
template<class ParcelType>
inline const Foam::collisionRecordList&
@ -91,6 +115,27 @@ Foam::CollidingParcel<ParcelType>::collisionRecords() const
}
template<class ParcelType>
inline Foam::vector& Foam::CollidingParcel<ParcelType>::f()
{
return f_;
}
template<class ParcelType>
inline Foam::vector& Foam::CollidingParcel<ParcelType>::angularMomentum()
{
return angularMomentum_;
}
template<class ParcelType>
inline Foam::vector& Foam::CollidingParcel<ParcelType>::torque()
{
return torque_;
}
template<class ParcelType>
inline Foam::collisionRecordList&
Foam::CollidingParcel<ParcelType>::collisionRecords()
@ -99,4 +144,11 @@ Foam::CollidingParcel<ParcelType>::collisionRecords()
}
template<class ParcelType>
inline Foam::vector Foam::CollidingParcel<ParcelType>::omega() const
{
return angularMomentum_/this->momentOfInertia();
}
// ************************************************************************* //

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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -45,10 +45,30 @@ Foam::CollidingParcel<ParcelType>::CollidingParcel
)
:
ParcelType(mesh, is, readFields),
f_(vector::zero),
angularMomentum_(vector::zero),
torque_(vector::zero),
collisionRecords_()
{
if (readFields)
{
if (is.format() == IOstream::ASCII)
{
is >> f_;
is >> angularMomentum_;
is >> torque_;
}
else
{
is.read
(
reinterpret_cast<char*>(&f_),
+ sizeof(f_)
+ sizeof(angularMomentum_)
+ sizeof(torque_)
);
}
is >> collisionRecords_;
}
@ -72,6 +92,18 @@ void Foam::CollidingParcel<ParcelType>::readFields(CloudType& c)
ParcelType::readFields(c);
IOField<vector> f(c.fieldIOobject("f", IOobject::MUST_READ));
c.checkFieldIOobject(c, f);
IOField<vector> angularMomentum
(
c.fieldIOobject("angularMomentum", IOobject::MUST_READ)
);
c.checkFieldIOobject(c, angularMomentum);
IOField<vector> torque(c.fieldIOobject("torque", IOobject::MUST_READ));
c.checkFieldIOobject(c, torque);
labelFieldCompactIOField collisionRecordsPairAccessed
(
c.fieldIOobject("collisionRecordsPairAccessed", IOobject::MUST_READ)
@ -128,6 +160,10 @@ void Foam::CollidingParcel<ParcelType>::readFields(CloudType& c)
{
CollidingParcel<ParcelType>& p = iter();
p.f_ = f[i];
p.angularMomentum_ = angularMomentum[i];
p.torque_ = torque[i];
p.collisionRecords_ = collisionRecordList
(
collisionRecordsPairAccessed[i],
@ -152,6 +188,14 @@ void Foam::CollidingParcel<ParcelType>::writeFields(const CloudType& c)
label np = c.size();
IOField<vector> f(c.fieldIOobject("f", IOobject::NO_READ), np);
IOField<vector> angularMomentum
(
c.fieldIOobject("angularMomentum", IOobject::NO_READ),
np
);
IOField<vector> torque(c.fieldIOobject("torque", IOobject::NO_READ), np);
labelFieldCompactIOField collisionRecordsPairAccessed
(
c.fieldIOobject("collisionRecordsPairAccessed", IOobject::NO_READ),
@ -198,6 +242,10 @@ void Foam::CollidingParcel<ParcelType>::writeFields(const CloudType& c)
{
const CollidingParcel<ParcelType>& p = iter();
f[i] = p.f();
angularMomentum[i] = p.angularMomentum();
torque[i] = p.torque();
collisionRecordsPairAccessed[i] = p.collisionRecords().pairAccessed();
collisionRecordsPairOrigProcOfOther[i] =
p.collisionRecords().pairOrigProcOfOther();
@ -211,6 +259,10 @@ void Foam::CollidingParcel<ParcelType>::writeFields(const CloudType& c)
i++;
}
f.write();
angularMomentum.write();
torque.write();
collisionRecordsPairAccessed.write();
collisionRecordsPairOrigProcOfOther.write();
collisionRecordsPairOrigIdOfOther.write();
@ -233,12 +285,22 @@ Foam::Ostream& Foam::operator<<
if (os.format() == IOstream::ASCII)
{
os << static_cast<const ParcelType&>(p)
<< token::SPACE << p.f()
<< token::SPACE << p.angularMomentum()
<< token::SPACE << p.torque()
<< token::SPACE << p.collisionRecords();
}
else
{
os << static_cast<const ParcelType&>(p)
<< p.collisionRecords();
os << static_cast<const ParcelType&>(p);
os.write
(
reinterpret_cast<const char*>(&p.f_),
+ sizeof(p.f())
+ sizeof(p.angularMomentum())
+ sizeof(p.torque())
);
os << p.collisionRecords();
}
// Check state of Ostream

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -213,9 +213,6 @@ Foam::KinematicParcel<ParcelType>::KinematicParcel
d_(p.d_),
dTarget_(p.dTarget_),
U_(p.U_),
f_(p.f_),
angularMomentum_(p.angularMomentum_),
torque_(p.torque_),
rho_(p.rho_),
age_(p.age_),
tTurb_(p.tTurb_),
@ -240,9 +237,6 @@ Foam::KinematicParcel<ParcelType>::KinematicParcel
d_(p.d_),
dTarget_(p.dTarget_),
U_(p.U_),
f_(p.f_),
angularMomentum_(p.angularMomentum_),
torque_(p.torque_),
rho_(p.rho_),
age_(p.age_),
tTurb_(p.tTurb_),
@ -437,12 +431,6 @@ void Foam::KinematicParcel<ParcelType>::transformProperties(const tensor& T)
ParcelType::transformProperties(T);
U_ = transform(T, U_);
f_ = transform(T, f_);
angularMomentum_ = transform(T, angularMomentum_);
torque_ = transform(T, torque_);
}

View File

@ -261,17 +261,6 @@ protected:
//- Velocity of Parcel [m/s]
vector U_;
//- Force on particle due to collisions [N]
vector f_;
//- Angular momentum of Parcel in global reference frame
// [kg m2/s]
vector angularMomentum_;
//- Torque on particle due to collisions in global
// reference frame [Nm]
vector torque_;
//- Density [kg/m3]
scalar rho_;
@ -332,9 +321,6 @@ public:
+ " d"
+ " dTarget "
+ " (Ux Uy Uz)"
+ " (fx fy fz)"
+ " (angularMomentumx angularMomentumy angularMomentumz)"
+ " (torquex torquey torquez)"
+ " rho"
+ " age"
+ " tTurb"
@ -367,9 +353,6 @@ public:
const scalar nParticle0,
const scalar d0,
const scalar dTarget0,
const vector& U0,
const vector& f0,
const vector& angularMomentum0,
const vector& torque0,
const constantProperties& constProps
);
@ -445,15 +428,6 @@ public:
//- Return const access to velocity
inline const vector& U() const;
//- Return const access to force
inline const vector& f() const;
//- Return const access to angular momentum
inline const vector& angularMomentum() const;
//- Return const access to torque
inline const vector& torque() const;
//- Return const access to density
inline scalar rho() const;
@ -496,15 +470,6 @@ public:
//- Return access to velocity
inline vector& U();
//- Return access to force
inline vector& f();
//- Return access to angular momentum
inline vector& angularMomentum();
//- Return access to torque
inline vector& torque();
//- Return access to density
inline scalar& rho();
@ -532,9 +497,6 @@ public:
//- Particle moment of inertia around diameter axis
inline scalar momentOfInertia() const;
//- Particle angular velocity
inline vector omega() const;
//- Particle volume
inline scalar volume() const;

View File

@ -135,9 +135,6 @@ inline Foam::KinematicParcel<ParcelType>::KinematicParcel
d_(0.0),
dTarget_(0.0),
U_(vector::zero),
f_(vector::zero),
angularMomentum_(vector::zero),
torque_(vector::zero),
rho_(0.0),
age_(0.0),
tTurb_(0.0),
@ -161,9 +158,6 @@ inline Foam::KinematicParcel<ParcelType>::KinematicParcel
const scalar d0,
const scalar dTarget0,
const vector& U0,
const vector& f0,
const vector& angularMomentum0,
const vector& torque0,
const constantProperties& constProps
)
:
@ -174,9 +168,6 @@ inline Foam::KinematicParcel<ParcelType>::KinematicParcel
d_(d0),
dTarget_(dTarget0),
U_(U0),
f_(f0),
angularMomentum_(angularMomentum0),
torque_(torque0),
rho_(constProps.rho0()),
age_(0.0),
tTurb_(0.0),
@ -289,30 +280,6 @@ inline const Foam::vector& Foam::KinematicParcel<ParcelType>::U() const
}
template<class ParcelType>
inline const Foam::vector&
Foam::KinematicParcel<ParcelType>::f() const
{
return f_;
}
template<class ParcelType>
inline const Foam::vector&
Foam::KinematicParcel<ParcelType>::angularMomentum() const
{
return angularMomentum_;
}
template<class ParcelType>
inline const Foam::vector&
Foam::KinematicParcel<ParcelType>::torque() const
{
return torque_;
}
template<class ParcelType>
inline Foam::scalar Foam::KinematicParcel<ParcelType>::rho() const
{
@ -404,27 +371,6 @@ inline Foam::vector& Foam::KinematicParcel<ParcelType>::U()
}
template<class ParcelType>
inline Foam::vector& Foam::KinematicParcel<ParcelType>::f()
{
return f_;
}
template<class ParcelType>
inline Foam::vector& Foam::KinematicParcel<ParcelType>::angularMomentum()
{
return angularMomentum_;
}
template<class ParcelType>
inline Foam::vector& Foam::KinematicParcel<ParcelType>::torque()
{
return torque_;
}
template<class ParcelType>
inline Foam::scalar& Foam::KinematicParcel<ParcelType>::rho()
{
@ -492,13 +438,6 @@ inline Foam::scalar Foam::KinematicParcel<ParcelType>::momentOfInertia() const
}
template<class ParcelType>
inline Foam::vector Foam::KinematicParcel<ParcelType>::omega() const
{
return angularMomentum_/momentOfInertia();
}
template<class ParcelType>
inline Foam::scalar Foam::KinematicParcel<ParcelType>::volume() const
{

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -51,9 +51,6 @@ Foam::KinematicParcel<ParcelType>::KinematicParcel
d_(0.0),
dTarget_(0.0),
U_(vector::zero),
f_(vector::zero),
angularMomentum_(vector::zero),
torque_(vector::zero),
rho_(0.0),
age_(0.0),
tTurb_(0.0),
@ -72,9 +69,6 @@ Foam::KinematicParcel<ParcelType>::KinematicParcel
d_ = readScalar(is);
dTarget_ = readScalar(is);
is >> U_;
is >> f_;
is >> angularMomentum_;
is >> torque_;
rho_ = readScalar(is);
age_ = readScalar(is);
tTurb_ = readScalar(is);
@ -91,9 +85,6 @@ Foam::KinematicParcel<ParcelType>::KinematicParcel
+ sizeof(d_)
+ sizeof(dTarget_)
+ sizeof(U_)
+ sizeof(f_)
+ sizeof(angularMomentum_)
+ sizeof(torque_)
+ sizeof(rho_)
+ sizeof(age_)
+ sizeof(tTurb_)
@ -141,18 +132,6 @@ void Foam::KinematicParcel<ParcelType>::readFields(CloudType& c)
IOField<vector> U(c.fieldIOobject("U", IOobject::MUST_READ));
c.checkFieldIOobject(c, U);
IOField<vector> f(c.fieldIOobject("f", IOobject::MUST_READ));
c.checkFieldIOobject(c, f);
IOField<vector> angularMomentum
(
c.fieldIOobject("angularMomentum", IOobject::MUST_READ)
);
c.checkFieldIOobject(c, angularMomentum);
IOField<vector> torque(c.fieldIOobject("torque", IOobject::MUST_READ));
c.checkFieldIOobject(c, torque);
IOField<scalar> rho(c.fieldIOobject("rho", IOobject::MUST_READ));
c.checkFieldIOobject(c, rho);
@ -177,8 +156,6 @@ void Foam::KinematicParcel<ParcelType>::readFields(CloudType& c)
p.d_ = d[i];
p.dTarget_ = dTarget[i];
p.U_ = U[i];
p.f_ = f[i];
p.angularMomentum_ = angularMomentum[i];
p.rho_ = rho[i];
p.age_ = age[i];
p.tTurb_ = tTurb[i];
@ -207,13 +184,6 @@ void Foam::KinematicParcel<ParcelType>::writeFields(const CloudType& c)
IOField<scalar> d(c.fieldIOobject("d", IOobject::NO_READ), np);
IOField<scalar> dTarget(c.fieldIOobject("dTarget", IOobject::NO_READ), np);
IOField<vector> U(c.fieldIOobject("U", IOobject::NO_READ), np);
IOField<vector> f(c.fieldIOobject("f", IOobject::NO_READ), np);
IOField<vector> angularMomentum
(
c.fieldIOobject("angularMomentum", IOobject::NO_READ),
np
);
IOField<vector> torque(c.fieldIOobject("torque", IOobject::NO_READ), np);
IOField<scalar> rho(c.fieldIOobject("rho", IOobject::NO_READ), np);
IOField<scalar> age(c.fieldIOobject("age", IOobject::NO_READ), np);
IOField<scalar> tTurb(c.fieldIOobject("tTurb", IOobject::NO_READ), np);
@ -231,9 +201,6 @@ void Foam::KinematicParcel<ParcelType>::writeFields(const CloudType& c)
d[i] = p.d();
dTarget[i] = p.dTarget();
U[i] = p.U();
f[i] = p.f();
angularMomentum[i] = p.angularMomentum();
torque[i] = p.torque();
rho[i] = p.rho();
age[i] = p.age();
tTurb[i] = p.tTurb();
@ -248,9 +215,6 @@ void Foam::KinematicParcel<ParcelType>::writeFields(const CloudType& c)
d.write();
dTarget.write();
U.write();
f.write();
angularMomentum.write();
torque.write();
rho.write();
age.write();
tTurb.write();
@ -276,9 +240,6 @@ Foam::Ostream& Foam::operator<<
<< token::SPACE << p.d()
<< token::SPACE << p.dTarget()
<< token::SPACE << p.U()
<< token::SPACE << p.f()
<< token::SPACE << p.angularMomentum()
<< token::SPACE << p.torque()
<< token::SPACE << p.rho()
<< token::SPACE << p.age()
<< token::SPACE << p.tTurb()
@ -296,9 +257,6 @@ Foam::Ostream& Foam::operator<<
+ sizeof(p.d())
+ sizeof(p.dTarget())
+ sizeof(p.U())
+ sizeof(p.f())
+ sizeof(p.angularMomentum())
+ sizeof(p.torque())
+ sizeof(p.rho())
+ sizeof(p.age())
+ sizeof(p.tTurb())

View File

@ -347,7 +347,7 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc
if (td.cloud().solution().coupled())
{
scalar dm = np0*mass1;
scalar dm = np0*mass0;
// Absorb parcel into carrier phase
forAll(YGas_, i)
@ -511,7 +511,7 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calcDevolatilisation
if
(
!td.cloud().devolatilisation().active()
|| T < td.cloud().constProps().Tvap()
|| T < td.cloud().constProps().TDevol()
|| canCombust == -1
)
{

View File

@ -81,6 +81,9 @@ public:
{
// Private data
//- Devolatilisation activation temperature [K]
scalar TDevol_;
//- Latent heat of devolatilisation [J/kg]
scalar LDevol_;
@ -106,9 +109,31 @@ public:
const bool readFields = true
);
//- Construct from components
constantProperties
(
const label parcelTypeId,
const scalar rhoMin,
const scalar rho0,
const scalar minParticleMass,
const scalar youngsModulus,
const scalar poissonsRatio,
const scalar T0,
const scalar TMin,
const scalar TMax,
const scalar Cp0,
const scalar epsilon0,
const scalar f0,
const scalar pMin,
const Switch& constantVolume,
const scalar TDevol
);
// Access
//- Return const access to the devolatilisation temperature
inline scalar TDevol() const;
//- Return const access to the latent heat of devolatilisation
inline scalar LDevol() const;

View File

@ -30,6 +30,7 @@ inline Foam::ReactingMultiphaseParcel<ParcelType>::constantProperties::
constantProperties()
:
ParcelType::constantProperties(),
TDevol_(0.0),
LDevol_(0.0),
hRetentionCoeff_(0.0)
{}
@ -43,6 +44,7 @@ constantProperties
)
:
ParcelType::constantProperties(cp),
TDevol_(cp.TDevol_),
LDevol_(cp.LDevol_),
hRetentionCoeff_(cp.hRetentionCoeff_)
{}
@ -57,11 +59,13 @@ constantProperties
)
:
ParcelType::constantProperties(parentDict, readFields),
TDevol_(0.0),
LDevol_(0.0),
hRetentionCoeff_(0.0)
{
if (readFields)
{
this->dict().lookup("TDevol") >> TDevol_;
this->dict().lookup("LDevol") >> LDevol_;
this->dict().lookup("hRetentionCoeff") >> hRetentionCoeff_;
@ -80,6 +84,48 @@ constantProperties
}
template<class ParcelType>
inline Foam::ReactingMultiphaseParcel<ParcelType>::constantProperties::
constantProperties
(
const label parcelTypeId,
const scalar rhoMin,
const scalar rho0,
const scalar minParticleMass,
const scalar youngsModulus,
const scalar poissonsRatio,
const scalar T0,
const scalar TMin,
const scalar TMax,
const scalar Cp0,
const scalar epsilon0,
const scalar f0,
const scalar pMin,
const Switch& constantVolume,
const scalar TDevol
)
:
ParcelType::constantProperties
(
parcelTypeId,
rhoMin,
rho0,
minParticleMass,
youngsModulus,
poissonsRatio,
T0,
TMin,
TMax,
Cp0,
epsilon0,
f0,
pMin,
constantVolume
),
TDevol_(TDevol)
{}
template<class ParcelType>
inline Foam::ReactingMultiphaseParcel<ParcelType>::ReactingMultiphaseParcel
(
@ -148,6 +194,14 @@ inline Foam::ReactingMultiphaseParcel<ParcelType>::ReactingMultiphaseParcel
// * * * * * * * * * constantProperties Member Functions * * * * * * * * * * //
template<class ParcelType>
inline Foam::scalar
Foam::ReactingMultiphaseParcel<ParcelType>::constantProperties::TDevol() const
{
return TDevol_;
}
template<class ParcelType>
inline Foam::scalar
Foam::ReactingMultiphaseParcel<ParcelType>::constantProperties::LDevol() const

View File

@ -26,6 +26,7 @@ License
#include "ReactingParcel.H"
#include "specie.H"
#include "CompositionModel.H"
#include "PhaseChangeModel.H"
#include "mathematicalConstants.H"
using namespace Foam::constant::mathematical;
@ -56,26 +57,22 @@ void Foam::ReactingParcel<ParcelType>::calcPhaseChange
scalarField& Cs
)
{
if
(
!td.cloud().phaseChange().active()
|| T < td.cloud().constProps().Tvap()
|| YPhase < SMALL
)
typedef typename TrackData::cloudType::reactingCloudType reactingCloudType;
PhaseChangeModel<reactingCloudType>& phaseChange = td.cloud().phaseChange();
scalar Tvap = phaseChange.Tvap(YComponents);
if (!phaseChange.active() || T < Tvap || YPhase < SMALL)
{
return;
}
typedef typename TrackData::cloudType::reactingCloudType reactingCloudType;
const CompositionModel<reactingCloudType>& composition =
td.cloud().composition();
const scalar TMax = td.cloud().phaseChange().TMax(pc_);
const scalar TMax = phaseChange.TMax(pc_, YComponents);
const scalar Tdash = min(T, TMax);
const scalar Tsdash = min(Ts, TMax);
// Calculate mass transfer due to phase change
td.cloud().phaseChange().calculate
phaseChange.calculate
(
dt,
cellI,
@ -97,14 +94,17 @@ void Foam::ReactingParcel<ParcelType>::calcPhaseChange
const scalar dMassTot = sum(dMassPC);
// Add to cumulative phase change mass
td.cloud().phaseChange().addToPhaseChangeMass(this->nParticle_*dMassTot);
phaseChange.addToPhaseChangeMass(this->nParticle_*dMassTot);
const CompositionModel<reactingCloudType>& composition =
td.cloud().composition();
forAll(dMassPC, i)
{
const label idc = composition.localToGlobalCarrierId(idPhase, i);
const label idl = composition.globalIds(idPhase)[i];
const scalar dh = td.cloud().phaseChange().dh(idc, idl, pc_, Tdash);
const scalar dh = phaseChange.dh(idc, idl, pc_, Tdash);
Sh -= dMassPC[i]*dh/dt;
}
@ -516,7 +516,7 @@ void Foam::ReactingParcel<ParcelType>::calc
if (td.cloud().solution().coupled())
{
scalar dm = np0*mass1;
scalar dm = np0*mass0;
// Absorb parcel into carrier phase
forAll(Y_, i)

View File

@ -80,9 +80,6 @@ public:
//- Constant volume flag - e.g. during mass transfer
Switch constantVolume_;
//- Vaporisation temperature [K]
scalar Tvap_;
public:
@ -116,10 +113,8 @@ public:
const scalar Cp0,
const scalar epsilon0,
const scalar f0,
const scalar Pr,
const scalar pMin,
const Switch& constantVolume,
const scalar Tvap
const Switch& constantVolume
);
@ -130,9 +125,6 @@ public:
//- Return const access to the constant volume flag
inline Switch constantVolume() const;
//- Return const access to the vaporisation temperature
inline scalar Tvap() const;
};

View File

@ -31,8 +31,7 @@ Foam::ReactingParcel<ParcelType>::constantProperties::constantProperties()
:
ParcelType::constantProperties(),
pMin_(0.0),
constantVolume_(false),
Tvap_(0.0)
constantVolume_(false)
{}
@ -44,8 +43,7 @@ inline Foam::ReactingParcel<ParcelType>::constantProperties::constantProperties
:
ParcelType::constantProperties(cp),
pMin_(cp.pMin_),
constantVolume_(cp.constantVolume_),
Tvap_(cp.Tvap_)
constantVolume_(cp.constantVolume_)
{}
@ -58,8 +56,7 @@ inline Foam::ReactingParcel<ParcelType>::constantProperties::constantProperties
:
ParcelType::constantProperties(parentDict, readFields),
pMin_(1000.0),
constantVolume_(false),
Tvap_(0.0)
constantVolume_(false)
{
if (readFields)
{
@ -69,7 +66,6 @@ inline Foam::ReactingParcel<ParcelType>::constantProperties::constantProperties
}
this->dict().lookup("constantVolume") >> constantVolume_;
this->dict().lookup("Tvap") >> Tvap_;
}
}
@ -89,10 +85,8 @@ inline Foam::ReactingParcel<ParcelType>::constantProperties::constantProperties
const scalar Cp0,
const scalar epsilon0,
const scalar f0,
const scalar Pr,
const scalar pMin,
const Switch& constantVolume,
const scalar Tvap
const Switch& constantVolume
)
:
ParcelType::constantProperties
@ -108,12 +102,10 @@ inline Foam::ReactingParcel<ParcelType>::constantProperties::constantProperties
TMax,
Cp0,
epsilon0,
f0,
Pr
f0
),
pMin_(pMin),
constantVolume_(constantVolume),
Tvap_(Tvap)
constantVolume_(constantVolume)
{}
@ -198,14 +190,6 @@ Foam::ReactingParcel<ParcelType>::constantProperties::constantVolume() const
}
template<class ParcelType>
inline Foam::scalar
Foam::ReactingParcel<ParcelType>::constantProperties::Tvap() const
{
return Tvap_;
}
// * * * * * * * * * * ThermoParcel Member Functions * * * * * * * * * * * * //
template<class ParcelType>

View File

@ -151,12 +151,10 @@ void Foam::ThermoParcel<ParcelType>::calcSurfaceValues
tetIndices tetIs = this->currentTetIndices();
mus = td.muInterp().interpolate(this->position(), tetIs)/TRatio;
kappas = td.kappaInterp().interpolate(this->position(), tetIs)/TRatio;
Pr = td.cloud().constProps().Pr();
Pr = Cpc_*mus/kappas;
Pr = max(ROOTVSMALL, Pr);
kappas = Cpc_*mus/Pr;
kappas = max(ROOTVSMALL, kappas);
}

View File

@ -94,9 +94,6 @@ public:
//- Particle scattering factor [] (radiation)
scalar f0_;
//- Default carrier Prandtl number []
scalar Pr_;
public:
@ -129,8 +126,7 @@ public:
const scalar TMax,
const scalar Cp0,
const scalar epsilon0,
const scalar f0,
const scalar Pr
const scalar f0
);
@ -161,9 +157,6 @@ public:
//- Return const access to the particle scattering factor []
// Active for radiation only
inline scalar f0() const;
//- Return const access to the default carrier Prandtl number []
inline scalar Pr() const;
};
@ -180,6 +173,10 @@ public:
// Cp not stored on carrier thermo, but returned as tmp<...>
const volScalarField Cp_;
//- Local copy of carrier thermal conductivity field
// kappa not stored on carrier thermo, but returned as tmp<...>
const volScalarField kappa_;
// Interpolators for continuous phase fields
@ -189,11 +186,13 @@ public:
//- Specific heat capacity field interpolator
autoPtr<interpolation<scalar> > CpInterp_;
//- Thermal conductivity field interpolator
autoPtr<interpolation<scalar> > kappaInterp_;
//- Radiation field interpolator
autoPtr<interpolation<scalar> > GInterp_;
public:
typedef typename ParcelType::template TrackingData<CloudType>::trackPart
@ -215,6 +214,9 @@ public:
//- Return access to the locally stored carrier Cp field
inline const volScalarField& Cp() const;
//- Return access to the locally stored carrier kappa field
inline const volScalarField& kappa() const;
//- Return const access to the interpolator for continuous
// phase temperature field
inline const interpolation<scalar>& TInterp() const;
@ -223,6 +225,10 @@ public:
// phase specific heat capacity field
inline const interpolation<scalar>& CpInterp() const;
//- Return const access to the interpolator for continuous
// phase thermal conductivity field
inline const interpolation<scalar>& kappaInterp() const;
//- Return const access to the interpolator for continuous
// radiation field
inline const interpolation<scalar>& GInterp() const;

View File

@ -34,8 +34,7 @@ inline Foam::ThermoParcel<ParcelType>::constantProperties::constantProperties()
TMax_(VGREAT),
Cp0_(0.0),
epsilon0_(0.0),
f0_(0.0),
Pr_(0.0)
f0_(0.0)
{}
@ -51,8 +50,7 @@ inline Foam::ThermoParcel<ParcelType>::constantProperties::constantProperties
TMax_(cp.TMax_),
Cp0_(cp.Cp0_),
epsilon0_(cp.epsilon0_),
f0_(cp.f0_),
Pr_(cp.Pr_)
f0_(cp.f0_)
{}
@ -69,8 +67,7 @@ inline Foam::ThermoParcel<ParcelType>::constantProperties::constantProperties
TMax_(5000),
Cp0_(0.0),
epsilon0_(0.0),
f0_(0.0),
Pr_(0.0)
f0_(0.0)
{
if (readFields)
{
@ -87,7 +84,6 @@ inline Foam::ThermoParcel<ParcelType>::constantProperties::constantProperties
this->dict().lookup("Cp0") >> Cp0_;
this->dict().lookup("epsilon0") >> epsilon0_;
this->dict().lookup("f0") >> f0_;
this->dict().lookup("Pr") >> Pr_;
}
}
@ -106,8 +102,7 @@ inline Foam::ThermoParcel<ParcelType>::constantProperties::constantProperties
const scalar TMax,
const scalar Cp0,
const scalar epsilon0,
const scalar f0,
const scalar Pr
const scalar f0
)
:
ParcelType::constantProperties
@ -124,8 +119,7 @@ inline Foam::ThermoParcel<ParcelType>::constantProperties::constantProperties
TMax_(TMax),
Cp0_(Cp0),
epsilon0_(epsilon0),
f0_(f0),
Pr_(Pr)
f0_(f0)
{}
@ -248,14 +242,6 @@ Foam::ThermoParcel<ParcelType>::constantProperties::f0() const
}
template<class ParcelType>
inline Foam::scalar
Foam::ThermoParcel<ParcelType>::constantProperties::Pr() const
{
return Pr_;
}
// * * * * * * * * * * ThermoParcel Member Functions * * * * * * * * * * * * //
template<class ParcelType>

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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -33,6 +33,7 @@ inline Foam::ThermoParcel<ParcelType>::TrackingData<CloudType>::TrackingData
:
ParcelType::template TrackingData<CloudType>(cloud, part),
Cp_(cloud.thermo().thermo().Cp()),
kappa_(cloud.thermo().thermo().kappa()),
TInterp_
(
interpolation<scalar>::New
@ -49,6 +50,14 @@ inline Foam::ThermoParcel<ParcelType>::TrackingData<CloudType>::TrackingData
Cp_
)
),
kappaInterp_
(
interpolation<scalar>::New
(
cloud.solution().interpolationSchemes(),
kappa_
)
),
GInterp_(NULL)
{
if (cloud.radiation())
@ -75,6 +84,15 @@ Foam::ThermoParcel<ParcelType>::TrackingData<CloudType>::Cp() const
}
template<class ParcelType>
template<class CloudType>
inline const Foam::volScalarField&
Foam::ThermoParcel<ParcelType>::TrackingData<CloudType>::kappa() const
{
return kappa_;
}
template<class ParcelType>
template<class CloudType>
inline const Foam::interpolation<Foam::scalar>&
@ -93,6 +111,15 @@ Foam::ThermoParcel<ParcelType>::TrackingData<CloudType>::CpInterp() const
}
template<class ParcelType>
template<class CloudType>
inline const Foam::interpolation<Foam::scalar>&
Foam::ThermoParcel<ParcelType>::TrackingData<CloudType>::kappaInterp() const
{
return kappaInterp_();
}
template<class ParcelType>
template<class CloudType>
inline const Foam::interpolation<Foam::scalar>&

View File

@ -151,6 +151,44 @@ void Foam::LiquidEvaporation<CloudType>::calculate
scalarField& dMassPC
) const
{
// liquid volume fraction
const scalarField X(liquids_.X(Yl));
// immediately evaporate mass that has reached critical condition
if (mag(T - liquids_.Tc(X)) < SMALL)
{
if (debug)
{
WarningIn
(
"void Foam::LiquidEvaporation<CloudType>::calculate"
"("
"const scalar, "
"const label, "
"const scalar, "
"const scalar, "
"const scalar, "
"const scalar, "
"const scalar, "
"const scalar, "
"const scalar, "
"const scalar, "
"const scalarField&, "
"scalarField&"
") const"
) << "Parcel reached critical conditions: "
<< "evaporating all avaliable mass" << endl;
}
forAll(activeLiquids_, i)
{
const label lid = liqToLiqMap_[i];
dMassPC[lid] = GREAT;
}
return;
}
// construct carrier phase species volume fractions for cell, cellI
const scalarField Xc(calcXc(cellI));
@ -242,9 +280,27 @@ Foam::scalar Foam::LiquidEvaporation<CloudType>::dh
template<class CloudType>
Foam::scalar Foam::LiquidEvaporation<CloudType>::TMax(const scalar pIn) const
Foam::scalar Foam::LiquidEvaporation<CloudType>::Tvap
(
const scalarField& Y
) const
{
return liquids_.TMax(pIn);
const scalarField X(liquids_.X(Y));
return liquids_.Tpt(X);
}
template<class CloudType>
Foam::scalar Foam::LiquidEvaporation<CloudType>::TMax
(
const scalar p,
const scalarField& Y
) const
{
const scalarField X(liquids_.X(Y));
return liquids_.pvInvert(p, X);
}

View File

@ -131,8 +131,11 @@ public:
const scalar T
) const;
//- Return vapourisation temperature
virtual scalar Tvap(const scalarField& Y) const;
//- Return maximum/limiting temperature
virtual scalar TMax(const scalar pIn) const;
virtual scalar TMax(const scalar p, const scalarField& Y) const;
};

View File

@ -151,18 +151,53 @@ void Foam::LiquidEvaporationBoil<CloudType>::calculate
scalarField& dMassPC
) const
{
// construct carrier phase species volume fractions for cell, cellI
const scalarField XcMix(calcXc(cellI));
// liquid volume fraction
const scalarField X(liquids_.X(Yl));
// immediately evaporate mass that has reached critical condition
if (mag(T - liquids_.Tc(X)) < SMALL)
{
if (debug)
{
WarningIn
(
"void Foam::LiquidEvaporationBoil<CloudType>::calculate"
"("
"const scalar, "
"const label, "
"const scalar, "
"const scalar, "
"const scalar, "
"const scalar, "
"const scalar, "
"const scalar, "
"const scalar, "
"const scalar, "
"const scalarField&, "
"scalarField&"
") const"
) << "Parcel reached critical conditions: "
<< "evaporating all avaliable mass" << endl;
}
forAll(activeLiquids_, i)
{
const label lid = liqToLiqMap_[i];
dMassPC[lid] = GREAT;
}
return;
}
// droplet surface pressure assumed to surface vapour pressure
scalar ps = liquids_.pv(pc, Ts, X);
// vapour density at droplet surface [kg/m3]
scalar rhos = ps*liquids_.W(X)/(specie::RR*Ts);
// construct carrier phase species volume fractions for cell, cellI
const scalarField XcMix(calcXc(cellI));
// carrier thermo properties
scalar Hsc = 0.0;
scalar Hc = 0.0;
@ -341,12 +376,27 @@ Foam::scalar Foam::LiquidEvaporationBoil<CloudType>::dh
template<class CloudType>
Foam::scalar Foam::LiquidEvaporationBoil<CloudType>::TMax
Foam::scalar Foam::LiquidEvaporationBoil<CloudType>::Tvap
(
const scalar pIn
const scalarField& Y
) const
{
return liquids_.TMax(pIn);
const scalarField X(liquids_.X(Y));
return liquids_.Tpt(X);
}
template<class CloudType>
Foam::scalar Foam::LiquidEvaporationBoil<CloudType>::TMax
(
const scalar p,
const scalarField& Y
) const
{
const scalarField X(liquids_.X(Y));
return liquids_.pvInvert(p, X);
}

View File

@ -141,8 +141,11 @@ public:
const scalar T
) const;
//- Return vapourisation temperature
virtual scalar Tvap(const scalarField& Y) const;
//- Return maximum/limiting temperature
virtual scalar TMax(const scalar pIn) const;
virtual scalar TMax(const scalar p, const scalarField& Y) const;
};

View File

@ -179,12 +179,23 @@ Foam::scalar Foam::PhaseChangeModel<CloudType>::dh
template<class CloudType>
Foam::scalar Foam::PhaseChangeModel<CloudType>::TMax(const scalar) const
Foam::scalar Foam::PhaseChangeModel<CloudType>::TMax
(
const scalar,
const scalarField&
) const
{
return GREAT;
}
template<class CloudType>
Foam::scalar Foam::PhaseChangeModel<CloudType>::Tvap(const scalarField& Y) const
{
return -GREAT;
}
template<class CloudType>
void Foam::PhaseChangeModel<CloudType>::addToPhaseChangeMass(const scalar dMass)
{

View File

@ -184,8 +184,11 @@ public:
const scalar T
) const;
//- Return vapourisation temperature
virtual scalar Tvap(const scalarField& Y) const;
//- Return maximum/limiting temperature
virtual scalar TMax(const scalar pIn) const;
virtual scalar TMax(const scalar p, const scalarField& Y) const;
//- Add to phase change mass
void addToPhaseChangeMass(const scalar dMass);

View File

@ -64,47 +64,62 @@ void Foam::SprayParcel<ParcelType>::calc
const label cellI
)
{
typedef typename TrackData::cloudType::reactingCloudType reactingCloudType;
const CompositionModel<reactingCloudType>& composition =
td.cloud().composition();
bool coupled = td.cloud().solution().coupled();
// check if parcel belongs to liquid core
if (liquidCore() > 0.5)
{
// liquid core parcels should not interact with the gas
if (td.cloud().solution().coupled())
{
td.cloud().solution().coupled() = false;
}
td.cloud().solution().coupled() = false;
}
// get old mixture composition
const scalarField& Y0(this->Y());
scalarField X0(composition.liquids().X(Y0));
// check if we have critical or boiling conditions
scalar TMax = composition.liquids().Tc(X0);
const scalar T0 = this->T();
const scalar pc0 = this->pc_;
if (composition.liquids().pv(pc0, T0, X0) >= pc0*0.999)
{
// set TMax to boiling temperature
TMax = composition.liquids().pvInvert(pc0, X0);
}
// set the maximum temperature limit
const scalar TMax = td.cloud().composition().liquids().TMax(this->pc_);
td.cloud().constProps().TMax() = TMax;
// store the parcel properties
const scalarField& Y(this->Y());
scalarField X(td.cloud().composition().liquids().X(Y));
scalarField X(composition.liquids().X(Y));
scalar T0 = this->T();
this->Cp() = td.cloud().composition().liquids().Cp(this->pc_, T0, X);
sigma_ = td.cloud().composition().liquids().sigma(this->pc_, T0, X);
scalar rho0 = td.cloud().composition().liquids().rho(this->pc_, T0, X);
this->Cp() = composition.liquids().Cp(this->pc_, T0, X);
sigma_ = composition.liquids().sigma(this->pc_, T0, X);
scalar rho0 = composition.liquids().rho(this->pc_, T0, X);
this->rho() = rho0;
ParcelType::calc(td, dt, cellI);
if (td.keepParticle)
{
// update Cp, sigma, diameter and density due to change in temperature
// update Cp, sigma, density and diameter due to change in temperature
// and/or composition
scalar T1 = this->T();
const scalarField& Y1(this->Y());
scalarField X1(td.cloud().composition().liquids().X(Y1));
scalarField X1(composition.liquids().X(Y1));
this->Cp() = td.cloud().composition().liquids().Cp(this->pc_, T1, X1);
sigma_ = td.cloud().composition().liquids().sigma(this->pc_, T1, X);
this->Cp() = composition.liquids().Cp(this->pc_, T1, X1);
scalar rho1 = td.cloud().composition().liquids().rho(this->pc_, T1, X1);
sigma_ = composition.liquids().sigma(this->pc_, T1, X);
scalar rho1 = composition.liquids().rho(this->pc_, T1, X1);
this->rho() = rho1;
scalar d1 = this->d()*cbrt(rho0/rho1);
this->d() = d1;

View File

@ -110,8 +110,6 @@ public:
const scalar Pr,
const scalar pMin,
const Switch& constantVolume,
const scalar Tvap,
const scalar Tbp,
const scalar sigma0,
const scalar mu0
);

View File

@ -82,8 +82,6 @@ inline Foam::SprayParcel<ParcelType>::constantProperties::constantProperties
const scalar Pr,
const scalar pMin,
const Switch& constantVolume,
const scalar Tvap,
const scalar Tbp,
const scalar sigma0,
const scalar mu0
)
@ -104,9 +102,7 @@ inline Foam::SprayParcel<ParcelType>::constantProperties::constantProperties
f0,
Pr,
pMin,
constantVolume,
Tvap,
Tbp
constantVolume
),
sigma0_(sigma0),
mu0_(mu0)

View File

@ -53,6 +53,7 @@ $(meshWave)/FaceCellWaveName.C
regionSplit/regionSplit.C
regionSplit/localPointRegion.C
indexedOctree/treeDataEdge.C
indexedOctree/treeDataFace.C

View File

@ -1152,7 +1152,12 @@ Foam::mappedPatchBase::mappedPatchBase
samplePatch_(mpb.samplePatch_),
offsetMode_(mpb.offsetMode_),
offset_(mpb.offset_),
offsets_(mpb.offsets_, mapAddressing),
offsets_
(
offsetMode_ == NONUNIFORM
? vectorField(mpb.offsets_, mapAddressing)
: vectorField(0)
),
distance_(mpb.distance_),
sameRegion_(mpb.sameRegion_),
mapPtr_(NULL),

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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -376,7 +376,7 @@ void Foam::searchableSurfaceCollection::boundingSpheres
forAll(subCentres, i)
{
centres[coordI++] = transform_[surfI].globalPosition
centres[coordI] = transform_[surfI].globalPosition
(
cmptMultiply
(
@ -384,7 +384,8 @@ void Foam::searchableSurfaceCollection::boundingSpheres
scale_[surfI]
)
);
radiusSqr[coordI++] = maxScale*subRadiusSqr[i];
radiusSqr[coordI] = maxScale*subRadiusSqr[i];
coordI++;
}
}
}

View File

@ -261,16 +261,16 @@ public:
// bounding boxes. The bounds are hints to the surface as for
// the range of queries it can expect. faceMap/pointMap can be
// set if the surface has done any redistribution.
virtual void distribute
(
const List<treeBoundBox>& bbs,
const bool keepNonLocal,
autoPtr<mapDistribute>& faceMap,
autoPtr<mapDistribute>& pointMap
)
{
subGeom_[0].distribute(bbs, keepNonLocal, faceMap, pointMap);
}
//virtual void distribute
//(
// const List<treeBoundBox>& bbs,
// const bool keepNonLocal,
// autoPtr<mapDistribute>& faceMap,
// autoPtr<mapDistribute>& pointMap
//)
//{
// subGeom_[0].distribute(bbs, keepNonLocal, faceMap, pointMap);
//}
//- WIP. Store element-wise field.
virtual void setField(const labelList& values)

View File

@ -1,9 +1,7 @@
EXE_INC = \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude
LIB_LIBS = \
-lmeshTools \
-ldynamicMesh \
-lfiniteVolume

View File

@ -512,7 +512,6 @@ Foam::forces::forces
binDx_(0.0),
binMin_(GREAT),
binPoints_(),
binFormat_("undefined"),
binCumulative_(true),
initialised_(false)
{
@ -573,7 +572,6 @@ Foam::forces::forces
binDx_(0.0),
binMin_(GREAT),
binPoints_(),
binFormat_("undefined"),
binCumulative_(true),
initialised_(false)
{
@ -702,8 +700,6 @@ void Foam::forces::read(const dictionary& dict)
binPoints_[i] = (i + 0.5)*binDir_*binDx_;
}
binDict.lookup("format") >> binFormat_;
binDict.lookup("cumulative") >> binCumulative_;
// allocate storage for forces and moments

View File

@ -208,9 +208,6 @@ protected:
//- Bin positions along binDir
List<point> binPoints_;
//- Write format for bin data
word binFormat_;
//- Should bin data be cumulative?
bool binCumulative_;

View File

@ -43,6 +43,7 @@ surfWriters = sampledSurface/writers
$(surfWriters)/surfaceWriter.C
$(surfWriters)/dx/dxSurfaceWriter.C
$(surfWriters)/ensight/ensightSurfaceWriter.C
$(surfWriters)/ensight/ensightPTraits.C
$(surfWriters)/foamFile/foamFileSurfaceWriter.C
$(surfWriters)/nastran/nastranSurfaceWriter.C
$(surfWriters)/proxy/proxySurfaceWriter.C

View File

@ -0,0 +1,46 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 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 "ensightPTraits.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
const char* const Foam::ensightPTraits<Foam::scalar>::typeName =
Foam::pTraits<Foam::scalar>::typeName;
const char* const Foam::ensightPTraits<Foam::vector>::typeName =
Foam::pTraits<Foam::vector>::typeName;
const char* const Foam::ensightPTraits<Foam::sphericalTensor>::typeName =
Foam::pTraits<Foam::scalar>::typeName;
const char* const Foam::ensightPTraits<Foam::symmTensor>::typeName =
"tensor symm";
const char* const Foam::ensightPTraits<Foam::tensor>::typeName =
Foam::pTraits<Foam::tensor>::typeName;
// ************************************************************************* //

View File

@ -0,0 +1,108 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 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::ensightPTraits
Description
Conversion of OpenFOAM pTraits into the Ensight equivalent
\*---------------------------------------------------------------------------*/
#ifndef ensightPTraits_H
#define ensightPTraits_H
#include "pTraits.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class ensightPTraits Declaration
\*---------------------------------------------------------------------------*/
template<class PrimitiveType>
class ensightPTraits
{
public:
// Static data members
static const char* const typeName;
};
template<>
class ensightPTraits<scalar>
{
public:
static const char* const typeName;
};
template<>
class ensightPTraits<vector>
{
public:
static const char* const typeName;
};
template<>
class ensightPTraits<sphericalTensor>
{
public:
static const char* const typeName;
};
template<>
class ensightPTraits<symmTensor>
{
public:
static const char* const typeName;
};
template<>
class ensightPTraits<tensor>
{
public:
static const char* const typeName;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -29,6 +29,7 @@ License
#include "OSspecific.H"
#include "IOmanip.H"
#include "ensightPartFaces.H"
#include "ensightPTraits.H"
#include "makeSurfaceWriterMethods.H"
@ -89,7 +90,7 @@ void Foam::ensightSurfaceWriter::writeTemplate
<< "model: 1 " << osGeom.name().name() << nl
<< nl
<< "VARIABLE" << nl
<< pTraits<Type>::typeName << " per "
<< ensightPTraits<Type>::typeName << " per "
<< word(isNodeValues ? "node:" : "element:") << setw(10) << 1
<< " " << fieldName
<< " " << surfaceName.c_str() << ".***." << fieldName << nl
@ -107,7 +108,7 @@ void Foam::ensightSurfaceWriter::writeTemplate
osGeom << ensPart;
// Write field
osField.writeKeyword(pTraits<Type>::typeName);
osField.writeKeyword(ensightPTraits<Type>::typeName);
ensPart.writeField(osField, values, isNodeValues);
}

View File

@ -103,12 +103,62 @@ Foam::scalar Foam::liquidMixtureProperties::Tc(const scalarField& x) const
}
Foam::scalar Foam::liquidMixtureProperties::TMax(const scalar p) const
Foam::scalar Foam::liquidMixtureProperties::Tpt(const scalarField& x) const
{
scalar T = -GREAT;
scalar Tpt = 0.0;
forAll(properties_, i)
{
T = max(T, properties_[i].pvInvert(p));
Tpt += x[i]*properties_[i].Tt();
}
return Tpt;
}
Foam::scalar Foam::liquidMixtureProperties::pvInvert
(
const scalar p,
const scalarField& x
) const
{
// Set upper and lower bounds
scalar Thi = Tc(x);
scalar Tlo = Tpt(x);
// Check for critical and solid phase conditions
if (p >= pv(p, Thi, x))
{
return Thi;
}
else if (p < pv(p, Tlo, x))
{
WarningIn
(
"Foam::scalar Foam::liquidMixtureProperties::pvInvert"
"("
" const scalar,"
" const scalarField&"
") const"
) << "Pressure below triple point pressure: "
<< "p = " << p << " < Pt = " << pv(p, Tlo, x) << nl << endl;
return -1;
}
// Set initial guess
scalar T = (Thi + Tlo)*0.5;
while ((Thi - Tlo) > 1.0e-4)
{
if ((pv(p, T, x) - p) <= 0.0)
{
Tlo = T;
}
else
{
Thi = T;
}
T = (Thi + Tlo)*0.5;
}
return T;

View File

@ -141,8 +141,9 @@ public:
//- Calculate the critical temperature of mixture
scalar Tc(const scalarField& x) const;
//- Calculate the maximum temperature of mixture at given pressure
scalar TMax(const scalar p) const;
//- Invert the vapour pressure relationship to retrieve the boiling
// temperature of the mixture as a function of pressure
scalar pvInvert(const scalar p, const scalarField& x) const;
//- Return pseudocritical temperature according to Kay's rule
scalar Tpc(const scalarField& x) const;
@ -150,6 +151,9 @@ public:
//- Return pseudocritical pressure (modified Prausnitz and Gunn)
scalar Ppc(const scalarField& x) const;
//- Return pseudo triple point temperature (mole averaged formulation)
scalar Tpt(const scalarField& x) const;
//- Return mixture accentric factor
scalar omega(const scalarField& x) const;

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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -252,7 +252,7 @@ public:
virtual scalar D(scalar p, scalar T, scalar Wb) const;
//- Invert the vapour pressure relationship to retrieve the
// boiling temperuture as a function of temperature
// boiling temperuture as a function of pressure
virtual scalar pvInvert(scalar p) const;

View File

@ -173,9 +173,6 @@ public:
//- Heat of formation [J/kg]
inline scalar Hf() const;
//- Total enthalpy - reference to Tstd [J/kg]
inline scalar H(const scalar T) const;
//- Sensible enthalpy - reference to Tstd [J/kg]
inline scalar Hs(const scalar T) const;

View File

@ -51,12 +51,6 @@ inline Foam::scalar Foam::solidProperties::Hf() const
}
inline Foam::scalar Foam::solidProperties::H(const scalar T) const
{
return Hs(T) + Hf_;
}
inline Foam::scalar Foam::solidProperties::Hs(const scalar T) const
{
return Cp_*(T - specie::Tstd);

View File

@ -217,9 +217,6 @@ public:
//- Enthalpy/Internal energy [J/kg]
inline scalar HE(const scalar p, const scalar T) const;
//- Enthalpy [J/kg]
inline scalar H(const scalar p, const scalar T) const;
//- Sensible enthalpy [J/kg]
inline scalar Hs(const scalar p, const scalar T) const;

View File

@ -215,14 +215,6 @@ Foam::species::thermo<Thermo, Type>::HE(const scalar p, const scalar T) const
}
template<class Thermo, template<class> class Type>
inline Foam::scalar
Foam::species::thermo<Thermo, Type>::H(const scalar p, const scalar T) const
{
return this->h(p, T)/this->W();
}
template<class Thermo, template<class> class Type>
inline Foam::scalar
Foam::species::thermo<Thermo, Type>::Hs(const scalar p, const scalar T) const

View File

@ -53,9 +53,7 @@ void Foam::incompressibleTwoPhaseMixture::calcNu()
Foam::incompressibleTwoPhaseMixture::incompressibleTwoPhaseMixture
(
const volVectorField& U,
const surfaceScalarField& phi,
const word& alpha1Name,
const word& alpha2Name
const surfaceScalarField& phi
)
:
IOdictionary
@ -69,14 +67,14 @@ Foam::incompressibleTwoPhaseMixture::incompressibleTwoPhaseMixture
IOobject::NO_WRITE
)
),
twoPhaseMixture(U.mesh(), *this, alpha1Name, alpha2Name),
twoPhaseMixture(U.mesh(), *this),
nuModel1_
(
viscosityModel::New
(
"nu1",
subDict(phase1Name_ == "1" ? "phase1": phase1Name_),
subDict(phase1Name_),
U,
phi
)
@ -86,7 +84,7 @@ Foam::incompressibleTwoPhaseMixture::incompressibleTwoPhaseMixture
viscosityModel::New
(
"nu2",
subDict(phase2Name_ == "2" ? "phase2": phase2Name_),
subDict(phase2Name_),
U,
phi
)

View File

@ -86,9 +86,7 @@ public:
incompressibleTwoPhaseMixture
(
const volVectorField& U,
const surfaceScalarField& phi,
const word& alpha1Name = "alpha1",
const word& alpha2Name = "alpha2"
const surfaceScalarField& phi
);

View File

@ -31,29 +31,17 @@ License
Foam::twoPhaseMixture::twoPhaseMixture
(
const fvMesh& mesh,
const dictionary& dict,
const word& alpha1Name,
const word& alpha2Name
const dictionary& dict
)
:
phase1Name_
(
dict.found("phases")
? wordList(dict.lookup("phases"))[0]
: "1"
),
phase2Name_
(
dict.found("phases")
? wordList(dict.lookup("phases"))[1]
: "2"
),
phase1Name_(wordList(dict.lookup("phases"))[0]),
phase2Name_(wordList(dict.lookup("phases"))[1]),
alpha1_
(
IOobject
(
dict.found("phases") ? word("alpha" + phase1Name_) : alpha1Name,
IOobject::groupName("alpha", phase1Name_),
mesh.time().timeName(),
mesh,
IOobject::MUST_READ,
@ -66,7 +54,7 @@ Foam::twoPhaseMixture::twoPhaseMixture
(
IOobject
(
dict.found("phases") ? word("alpha" + phase2Name_) : alpha2Name,
IOobject::groupName("alpha", phase2Name_),
mesh.time().timeName(),
mesh
),

View File

@ -67,9 +67,7 @@ public:
twoPhaseMixture
(
const fvMesh& mesh,
const dictionary& dict,
const word& alpha1Name = "alpha1",
const word& alpha2Name = "alpha2"
const dictionary& dict
);

View File

@ -52,12 +52,8 @@ void triSurface::writeOBJ(const bool writeSorted, Ostream& os) const
// Print patch names as comment
forAll(myPatches, patchI)
{
const surfacePatch& patch = myPatches[patchI];
if (patch.size() > 0)
{
os << "# " << patchI << " " << patch.name() << nl;
}
os << "# " << patchI << " "
<< myPatches[patchI].name() << nl;
}
os << "#" << nl;
@ -81,29 +77,25 @@ void triSurface::writeOBJ(const bool writeSorted, Ostream& os) const
forAll(myPatches, patchI)
{
const surfacePatch& patch = myPatches[patchI];
// Print all faces belonging to this patch
if (patch.size() > 0)
os << "g " << myPatches[patchI].name() << nl;
for
(
label patchFaceI = 0;
patchFaceI < myPatches[patchI].size();
patchFaceI++
)
{
os << "g " << patch.name() << nl;
const label faceI = faceMap[faceIndex++];
for
(
label patchFaceI = 0;
patchFaceI < patch.size();
patchFaceI++
)
{
const label faceI = faceMap[faceIndex++];
os << "f "
<< operator[](faceI)[0] + 1 << ' '
<< operator[](faceI)[1] + 1 << ' '
<< operator[](faceI)[2] + 1
//<< " # " << operator[](faceI).region()
<< nl;
}
os << "f "
<< operator[](faceI)[0] + 1 << ' '
<< operator[](faceI)[1] + 1 << ' '
<< operator[](faceI)[2] + 1
//<< " # " << operator[](faceI).region()
<< nl;
}
}
}

View File

@ -31,20 +31,20 @@ License
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::triSurface::writeSTLASCII(Ostream& os) const
void Foam::triSurface::writeSTLASCII(const bool writeSorted, Ostream& os) const
{
labelList faceMap;
surfacePatchList myPatches(calcPatches(faceMap));
label faceIndex = 0;
forAll(myPatches, patchI)
if (writeSorted)
{
// Print all faces belonging to this region
const surfacePatch& patch = myPatches[patchI];
if (patch.size() > 0)
label faceIndex = 0;
forAll(myPatches, patchI)
{
// Print all faces belonging to this region
const surfacePatch& patch = myPatches[patchI];
os << "solid " << patch.name() << endl;
for
@ -80,6 +80,63 @@ void Foam::triSurface::writeSTLASCII(Ostream& os) const
os << "endsolid " << patch.name() << endl;
}
}
else
{
// Get patch (=compact region) per face
labelList patchIDs(size());
forAll(myPatches, patchI)
{
label faceI = myPatches[patchI].start();
forAll(myPatches[patchI], i)
{
patchIDs[faceMap[faceI++]] = patchI;
}
}
label currentPatchI = -1;
forAll(*this, faceI)
{
if (currentPatchI != patchIDs[faceI])
{
if (currentPatchI != -1)
{
// Have already valid patch. Close it.
os << "endsolid " << myPatches[currentPatchI].name()
<< nl;
}
currentPatchI = patchIDs[faceI];
os << "solid " << myPatches[currentPatchI].name() << nl;
}
const vector& n = faceNormals()[faceI];
os << " facet normal "
<< n.x() << ' ' << n.y() << ' ' << n.z() << nl
<< " outer loop" << endl;
const labelledTri& f = (*this)[faceI];
const point& pa = points()[f[0]];
const point& pb = points()[f[1]];
const point& pc = points()[f[2]];
os << " vertex "
<< pa.x() << ' ' << pa.y() << ' ' << pa.z() << nl
<< " vertex "
<< pb.x() << ' ' << pb.y() << ' ' << pb.z() << nl
<< " vertex "
<< pc.x() << ' ' << pc.y() << ' ' << pc.z() << nl
<< " endloop" << nl
<< " endfacet" << endl;
}
if (currentPatchI != -1)
{
os << "endsolid " << myPatches[currentPatchI].name()
<< nl;
}
}
}

View File

@ -448,7 +448,7 @@ void Foam::triSurface::write
}
else if (ext == "stl")
{
return writeSTLASCII(OFstream(name)());
return writeSTLASCII(sort, OFstream(name)());
}
else if (ext == "stlb")
{

View File

@ -138,7 +138,7 @@ class triSurface
//- Write to Ostream in ASCII STL format.
// Each region becomes 'solid' 'endsolid' block.
void writeSTLASCII(Ostream&) const;
void writeSTLASCII(const bool writeSorted, Ostream&) const;
//- Write to std::ostream in BINARY STL format
void writeSTLBINARY(std::ostream&) const;