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

This commit is contained in:
mattijs
2010-11-21 18:40:51 +00:00
92 changed files with 1506 additions and 408 deletions

View File

@ -8,6 +8,7 @@ fileStat.C
POSIX.C
cpuTime/cpuTime.C
clockTime/clockTime.C
memInfo/memInfo.C
/*
* Note: fileMonitor assumes inotify by default. Compile with -DFOAM_USE_STAT

View File

@ -36,6 +36,7 @@ Description
#include "fileName.H"
#include "fileStat.H"
#include "timer.H"
#include "IFstream.H"
#include <fstream>
#include <cstdlib>

View File

@ -24,38 +24,25 @@ License
\*---------------------------------------------------------------------------*/
#include "clockTime.H"
#include "scalar.H"
#include <sys/time.h>
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * Static Members * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void clockTime::getTime(struct timeval& t)
void Foam::clockTime::getTime(timeType& t)
{
gettimeofday(&t, NULL);
gettimeofday(&t, 0);
}
double clockTime::timeDifference
(
const struct timeval& start,
const struct timeval& end
)
double Foam::clockTime::timeDifference(const timeType& beg, const timeType& end)
{
return end.tv_sec - start.tv_sec + 1E-6*(end.tv_usec - start.tv_usec);
return end.tv_sec - beg.tv_sec + 1E-6*(end.tv_usec - beg.tv_usec);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
clockTime::clockTime()
Foam::clockTime::clockTime()
{
getTime(startTime_);
lastTime_ = startTime_;
@ -65,14 +52,14 @@ clockTime::clockTime()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
double clockTime::elapsedTime() const
double Foam::clockTime::elapsedTime() const
{
getTime(newTime_);
return timeDifference(startTime_, newTime_);
}
double clockTime::timeIncrement() const
double Foam::clockTime::timeIncrement() const
{
lastTime_ = newTime_;
getTime(newTime_);
@ -80,8 +67,4 @@ double clockTime::timeIncrement() const
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -44,43 +44,45 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
Class clockTime Declaration
Class clockTime Declaration
\*---------------------------------------------------------------------------*/
class clockTime
{
// Private data
struct timeval startTime_;
mutable struct timeval lastTime_;
mutable struct timeval newTime_;
//- Time structure used
typedef struct timeval timeType;
static void getTime(struct timeval& t);
timeType startTime_;
static double timeDifference
(
const struct timeval& start,
const struct timeval& end
);
mutable timeType lastTime_;
mutable timeType newTime_;
// Private Member Functions
//- Retrieve the current time values from the system
static void getTime(timeType&);
//- Difference between two times
static double timeDifference(const timeType& beg, const timeType& end);
public:
// Constructors
//- Construct from components
//- Construct with the current clock time
clockTime();
// Member Functions
// Access
//- Return time (in seconds) from the start
double elapsedTime() const;
//- Returns CPU time from start of run
double elapsedTime() const;
//- Returns CPU time from last call of clockTimeIncrement()
double timeIncrement() const;
//- Return time (in seconds) since last call to timeIncrement()
double timeIncrement() const;
};

View File

@ -21,45 +21,32 @@ License
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Description
Starts timing CPU usage and return elapsed time from start.
\*---------------------------------------------------------------------------*/
#include "cpuTime.H"
#include <unistd.h>
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * Static Members * * * * * * * * * * * * * * //
long cpuTime::Hz_(sysconf(_SC_CLK_TCK));
const long Foam::cpuTime::Hz_(sysconf(_SC_CLK_TCK));
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void cpuTime::getTime(struct tms& t)
void Foam::cpuTime::getTime(timeType& t)
{
times(&t);
}
double cpuTime::timeDifference
(
const struct tms& start,
const struct tms& end
)
double Foam::cpuTime::timeDifference(const timeType& beg, const timeType& end)
{
return
(
double
(
(end.tms_utime + end.tms_stime)
- (start.tms_utime + start.tms_stime)
- (beg.tms_utime + beg.tms_stime)
)/Hz_
);
}
@ -67,7 +54,7 @@ double cpuTime::timeDifference
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
cpuTime::cpuTime()
Foam::cpuTime::cpuTime()
{
getTime(startTime_);
lastTime_ = startTime_;
@ -77,14 +64,14 @@ cpuTime::cpuTime()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
double cpuTime::elapsedCpuTime() const
double Foam::cpuTime::elapsedCpuTime() const
{
getTime(newTime_);
return timeDifference(startTime_, newTime_);
}
double cpuTime::cpuTimeIncrement() const
double Foam::cpuTime::cpuTimeIncrement() const
{
lastTime_ = newTime_;
getTime(newTime_);
@ -92,8 +79,4 @@ double cpuTime::cpuTimeIncrement() const
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -54,38 +54,41 @@ class cpuTime
{
// Private data
static long Hz_;
//- Time structure used
typedef struct tms timeType;
struct tms startTime_;
mutable struct tms lastTime_;
mutable struct tms newTime_;
//- Clock-ticks per second
static const long Hz_;
static void getTime(struct tms& t);
//- The start time
timeType startTime_;
mutable timeType lastTime_;
mutable timeType newTime_;
static double timeDifference
(
const struct tms& start,
const struct tms& end
);
// Private Member Functions
//- Retrieve the current time values from the system
static void getTime(timeType&);
//- Difference between two times
static double timeDifference(const timeType& beg, const timeType& end);
public:
// Constructors
//- Construct from components
//- Construct with the current clock time
cpuTime();
// Member Functions
// Access
//- Return CPU time (in seconds) from the start
double elapsedCpuTime() const;
//- Returns CPU time from start of run
double elapsedCpuTime() const;
//- Returns CPU time from last call of cpuTimeIncrement()
double cpuTimeIncrement() const;
//- Return CPU time (in seconds) since last call to cpuTimeIncrement()
double cpuTimeIncrement() const;
};

View File

@ -0,0 +1,117 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "memInfo.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::memInfo::memInfo()
:
peak_(-1),
size_(-1),
rss_(-1)
{
update();
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::memInfo::~memInfo()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
const Foam::memInfo& Foam::memInfo::update()
{
IFstream is("/proc/" + name(pid()) + "/status");
while (is.good())
{
string line;
is.getLine(line);
char tag[32];
int value;
if (sscanf(line.c_str(), "%30s %d", tag, &value) == 2)
{
if (!strcmp(tag, "VmPeak:"))
{
peak_ = value;
}
else if (!strcmp(tag, "VmSize:"))
{
size_ = value;
}
else if (!strcmp(tag, "VmRSS:"))
{
rss_ = value;
}
}
}
return *this;
}
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
Foam::Istream& Foam::operator>>(Istream& is, memInfo& m)
{
is.readBegin("memInfo");
is >> m.peak_ >> m.size_ >> m.rss_;
is.readEnd("memInfo");
// Check state of Istream
is.check
(
"Foam::Istream& Foam::operator>>(Foam::Istream&, Foam::memInfo&)"
);
return is;
}
Foam::Ostream& Foam::operator<<(Ostream& os, const memInfo& m)
{
os << token::BEGIN_LIST
<< m.peak_ << token::SPACE << m.size_ << token::SPACE << m.rss_
<< token::END_LIST;
// Check state of Ostream
os.check
(
"Foam::Ostream& Foam::operator<<(Foam::Ostream&, "
"const Foam::memInfo&)"
);
return os;
}
// ************************************************************************* //

View File

@ -0,0 +1,118 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::memInfo
Description
Memory usage information for the process running this object.
SourceFiles
memInfo.C
\*---------------------------------------------------------------------------*/
#ifndef memInfo_H
#define memInfo_H
#include "OSspecific.H"
#include "POSIX.H"
#include "IFstream.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class memInfo Declaration
\*---------------------------------------------------------------------------*/
class memInfo
{
// Private data
//- Peak memory used by the process (VmPeak in /proc/<pid>/status)
int peak_;
//- Memory used by the process (VmSize in /proc/<pid>/status)
int size_;
//- Resident set size of the process (VmRSS in /proc/<pid>/status)
int rss_;
public:
// Constructors
//- Construct null
memInfo();
//- Destructor
~memInfo();
// Member Functions
//- Parse /proc/<pid>/status
const memInfo& update();
// Access
//- Access the stored peak memory
int peak() const
{
return peak_;
}
//- Access the stored memory size
int size() const
{
return size_;
}
//- Access the stored rss value
int rss() const
{
return rss_;
}
// IOstream Operators
friend Istream& operator>>(Istream&, memInfo&);
friend Ostream& operator<<(Ostream&, const memInfo&);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -24,7 +24,6 @@ License
\*---------------------------------------------------------------------------*/
#include "NamedEnum.H"
#include "stringList.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -85,4 +84,42 @@ void Foam::NamedEnum<Enum, nEnum>::write(const Enum e, Ostream& os) const
}
template<class Enum, int nEnum>
Foam::stringList Foam::NamedEnum<Enum, nEnum>::strings()
{
stringList lst(nEnum);
label nElem = 0;
for (int enumI = 0; enumI < nEnum; ++enumI)
{
if (names[enumI] && names[enumI][0])
{
lst[nElem++] = names[enumI];
}
}
lst.setSize(nElem);
return lst;
}
template<class Enum, int nEnum>
Foam::wordList Foam::NamedEnum<Enum, nEnum>::words()
{
wordList lst(nEnum);
label nElem = 0;
for (int enumI = 0; enumI < nEnum; ++enumI)
{
if (names[enumI] && names[enumI][0])
{
lst[nElem++] = names[enumI];
}
}
lst.setSize(nElem);
return lst;
}
// ************************************************************************* //

View File

@ -37,6 +37,8 @@ SourceFiles
#include "HashTable.H"
#include "StaticAssert.H"
#include "stringList.H"
#include "wordList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -87,6 +89,12 @@ public:
//- Write the name representation of the enumeration to an Ostream
void write(const Enum e, Ostream&) const;
//- The set of names as a list of strings
static stringList strings();
//- The set of names as a list of words
static wordList words();
// Member Operators

View File

@ -517,12 +517,18 @@ public:
//- Return the fraction of time-step completed
inline scalar stepFraction() const;
//- Return the originating processor id
//- Return const access to the originating processor id
inline label origProc() const;
//- Return the particle id on originating processor
//- Return the originating processor id for manipulation
inline label& origProc();
//- Return const access to the particle id on originating processor
inline label origId() const;
//- Return the particle id on originating processor for manipulation
inline label& origId();
// Track

View File

@ -1117,6 +1117,13 @@ inline Foam::label Foam::Particle<ParticleType>::origProc() const
}
template<class ParticleType>
inline Foam::label& Foam::Particle<ParticleType>::origProc()
{
return origProc_;
}
template<class ParticleType>
inline Foam::label Foam::Particle<ParticleType>::origId() const
{
@ -1124,6 +1131,13 @@ inline Foam::label Foam::Particle<ParticleType>::origId() const
}
template<class ParticleType>
inline Foam::label& Foam::Particle<ParticleType>::origId()
{
return origId_;
}
template<class ParticleType>
inline bool Foam::Particle<ParticleType>::softImpact() const
{

View File

@ -426,11 +426,8 @@ bool Foam::KinematicParcel<ParcelType>::hitPatch
td.cloud().postProcessing().postPatch(p, patchI);
// Invoke surface film model
if (td.cloud().surfaceFilm().transferParcel(p, patchI))
if (td.cloud().surfaceFilm().transferParcel(p, pp, td.keepParticle))
{
// Parcel transferred to the surface film
td.keepParticle = false;
// All interactions done
return true;
}

View File

@ -37,10 +37,12 @@ Foam::SurfaceFilmModel<CloudType>::SurfaceFilmModel(CloudType& owner)
:
SubModelBase<CloudType>(owner),
g_(dimensionedVector("zero", dimAcceleration, vector::zero)),
ejectedParcelType_(0),
massParcelPatch_(0),
diameterParcelPatch_(0),
UFilmPatch_(0),
rhoFilmPatch_(0),
deltaFilmPatch_(0),
nParcelsTransferred_(0),
nParcelsInjected_(0)
{}
@ -57,10 +59,15 @@ Foam::SurfaceFilmModel<CloudType>::SurfaceFilmModel
:
SubModelBase<CloudType>(owner, dict, type),
g_(g),
ejectedParcelType_
(
this->coeffDict().lookupOrDefault("ejectedParcelType", -1)
),
massParcelPatch_(0),
diameterParcelPatch_(0),
UFilmPatch_(0),
rhoFilmPatch_(0),
deltaFilmPatch_(owner.mesh().boundary().size()),
nParcelsTransferred_(0),
nParcelsInjected_(0)
{}
@ -74,10 +81,12 @@ Foam::SurfaceFilmModel<CloudType>::SurfaceFilmModel
:
SubModelBase<CloudType>(sfm),
g_(sfm.g_),
ejectedParcelType_(sfm.ejectedParcelType_),
massParcelPatch_(sfm.massParcelPatch_),
diameterParcelPatch_(sfm.diameterParcelPatch_),
UFilmPatch_(sfm.UFilmPatch_),
rhoFilmPatch_(sfm.rhoFilmPatch_),
deltaFilmPatch_(sfm.deltaFilmPatch_),
nParcelsTransferred_(sfm.nParcelsTransferred_),
nParcelsInjected_(sfm.nParcelsInjected_)
{}
@ -95,16 +104,18 @@ Foam::SurfaceFilmModel<CloudType>::~SurfaceFilmModel()
template<class CloudType>
bool Foam::SurfaceFilmModel<CloudType>::transferParcel
(
const parcelType& p,
const label patchI
parcelType& p,
const polyPatch& pp,
bool& keepParticle
)
{
notImplemented
(
"bool Foam::SurfaceFilmModel<CloudType>::transferParcel"
"("
"const parcelType&, "
"const label"
"parcelType&, "
"const label, "
"const bool&"
")"
);
@ -145,7 +156,7 @@ void Foam::SurfaceFilmModel<CloudType>::inject(TrackData& td)
const label filmPatchI = filmPatches[i];
const mapDistribute& distMap = wpp.map();
cacheFilmFields(filmPatchI, distMap, filmModel);
cacheFilmFields(filmPatchI, primaryPatchI, distMap, filmModel);
forAll(injectorCellsPatch, j)
{
@ -196,6 +207,7 @@ template<class CloudType>
void Foam::SurfaceFilmModel<CloudType>::cacheFilmFields
(
const label filmPatchI,
const label primaryPatchI,
const mapDistribute& distMap,
const surfaceFilmModels::surfaceFilmModel& filmModel
)
@ -212,6 +224,10 @@ void Foam::SurfaceFilmModel<CloudType>::cacheFilmFields
rhoFilmPatch_ = filmModel.rho().boundaryField()[filmPatchI];
distMap.distribute(rhoFilmPatch_);
deltaFilmPatch_[primaryPatchI] =
filmModel.delta().boundaryField()[filmPatchI];
distMap.distribute(deltaFilmPatch_[primaryPatchI]);
}
@ -229,6 +245,11 @@ void Foam::SurfaceFilmModel<CloudType>::setParcelProperties
p.rho() = rhoFilmPatch_[filmFaceI];
p.nParticle() = massParcelPatch_[filmFaceI]/p.rho()/vol;
if (ejectedParcelType_ >= 0)
{
p.typeId() = ejectedParcelType_;
}
}

View File

@ -73,6 +73,11 @@ protected:
//- Gravitational acceleration constant
const dimensionedVector& g_;
//- Ejected parcel type label - id assigned to identify parcel for
// post-processing. If not specified, defaults to originating cloud
// type
label ejectedParcelType_;
// Cached injector fields per film patch
@ -88,6 +93,9 @@ protected:
//- Film density / patch face
scalarList rhoFilmPatch_;
//- Film height of all film patches / patch face
scalarListList deltaFilmPatch_;
// Counters
@ -104,6 +112,7 @@ protected:
virtual void cacheFilmFields
(
const label filmPatchI,
const label primaryPatchI,
const mapDistribute& distMap,
const surfaceFilmModels::surfaceFilmModel& filmModel
);
@ -206,8 +215,9 @@ public:
// Returns true if parcel is to be transferred
virtual bool transferParcel
(
const parcelType& p,
const label patchI
parcelType& p,
const polyPatch& pp,
bool& keepParticle
);
//- Inject parcels into the cloud

View File

@ -25,6 +25,460 @@ License
#include "ThermoSurfaceFilm.H"
#include "addToRunTimeSelectionTable.H"
#include "mathematicalConstants.H"
#include "Pstream.H"
using namespace Foam::constant::mathematical;
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
template<class CloudType>
Foam::wordList Foam::ThermoSurfaceFilm<CloudType>::interactionTypeNames_
(
IStringStream
(
"(absorb bounce splashBai)"
)()
);
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
template<class CloudType>
typename Foam::ThermoSurfaceFilm<CloudType>::interactionType
Foam::ThermoSurfaceFilm<CloudType>::interactionTypeEnum(const word& it) const
{
forAll(interactionTypeNames_, i)
{
if (interactionTypeNames_[i] == it)
{
return interactionType(i);
}
}
FatalErrorIn
(
"ThermoSurfaceFilm<CloudType>::interactionType "
"ThermoSurfaceFilm<CloudType>::interactionTypeEnum"
"("
"const word& it"
") const"
) << "Unknown interaction type " << it
<< ". Valid interaction types include: " << interactionTypeNames_
<< abort(FatalError);
return interactionType(0);
}
template<class CloudType>
Foam::word Foam::ThermoSurfaceFilm<CloudType>::interactionTypeStr
(
const interactionType& it
) const
{
if (it >= interactionTypeNames_.size())
{
FatalErrorIn
(
"ThermoSurfaceFilm<CloudType>::interactionType "
"ThermoSurfaceFilm<CloudType>::interactionTypeStr"
"("
"const interactionType& it"
") const"
) << "Unknown interaction type enumeration" << abort(FatalError);
}
return interactionTypeNames_[it];
}
template<class CloudType>
Foam::vector Foam::ThermoSurfaceFilm<CloudType>::tangentVector
(
const vector& v
) const
{
vector tangent = vector::zero;
scalar magTangent = 0.0;
while (magTangent < SMALL)
{
vector vTest = rndGen_.sample01<vector>();
tangent = vTest - (vTest & v)*v;
magTangent = mag(tangent);
}
return tangent/magTangent;
}
template<class CloudType>
Foam::vector Foam::ThermoSurfaceFilm<CloudType>::splashDirection
(
const vector& tanVec1,
const vector& tanVec2,
const vector& nf
) const
{
// azimuthal angle [rad]
const scalar phiSi = twoPi*rndGen_.sample01<scalar>();
// ejection angle [rad]
const scalar thetaSi = pi/180.0*(rndGen_.sample01<scalar>()*(50 - 5) + 5);
// direction vector of new parcel
const scalar alpha = sin(thetaSi);
const scalar dcorr = cos(thetaSi);
const vector normal = alpha*(tanVec1*cos(phiSi) + tanVec2*sin(phiSi));
vector dirVec = dcorr*nf;
dirVec += normal;
return dirVec/mag(dirVec);
}
template<class CloudType>
void Foam::ThermoSurfaceFilm<CloudType>::absorbInteraction
(
surfaceFilmModels::surfaceFilmModel& filmModel,
const parcelType& p,
const polyPatch& pp,
const label faceI,
const scalar mass,
bool& keepParticle
)
{
if (debug)
{
Info<< "Parcel " << p.origId() << " absorbInteraction" << endl;
}
// Patch face normal
const vector& nf = pp.faceNormals()[faceI];
// Patch velocity
const vector& Up = this->owner().U().boundaryField()[pp.index()][faceI];
// Relative parcel velocity
const vector Urel = p.U() - Up;
// Parcel normal velocity
const vector Un = nf*(Urel & nf);
// Parcel tangential velocity
const vector Ut = Urel - Un;
filmModel.addSources
(
pp.index(),
faceI,
mass, // mass
mass*Ut, // tangential momentum
mass*mag(Un), // impingement pressure
mass*p.hs() // energy
);
this->nParcelsTransferred()++;
keepParticle = false;
}
template<class CloudType>
void Foam::ThermoSurfaceFilm<CloudType>::bounceInteraction
(
parcelType& p,
const polyPatch& pp,
const label faceI,
bool& keepParticle
) const
{
if (debug)
{
Info<< "Parcel " << p.origId() << " bounceInteraction" << endl;
}
// Patch face normal
const vector& nf = pp.faceNormals()[faceI];
// Patch velocity
const vector& Up = this->owner().U().boundaryField()[pp.index()][faceI];
// Relative parcel velocity
const vector Urel = p.U() - Up;
// Flip parcel normal velocity component
p.U() -= 2.0*nf*(Urel & nf);
keepParticle = true;
}
template<class CloudType>
void Foam::ThermoSurfaceFilm<CloudType>::drySplashInteraction
(
surfaceFilmModels::surfaceFilmModel& filmModel,
const parcelType& p,
const polyPatch& pp,
const label faceI,
bool& keepParticle
)
{
if (debug)
{
Info<< "Parcel " << p.origId() << " drySplashInteraction" << endl;
}
const liquid& liq = thermo_.liquids().properties()[0];
// Patch face velocity and normal
const vector& Up = this->owner().U().boundaryField()[pp.index()][faceI];
const vector& nf = pp.faceNormals()[faceI];
// local pressure
const scalar pc = thermo_.thermo().p()[p.cell()];
// Retrieve parcel properties
const scalar m = p.mass()*p.nParticle();
const scalar rho = p.rho();
const scalar d = p.d();
const scalar sigma = liq.sigma(pc, p.T());
const scalar mu = liq.mu(pc, p.T());
const vector Urel = p.U() - Up;
const vector Un = nf*(Urel & nf);
// Laplace number
const scalar La = rho*sigma*d/sqr(mu);
// Weber number
const scalar We = rho*magSqr(Un)*d/sigma;
// Critical Weber number
const scalar Wec = Adry_*pow(La, -0.183);
if (We < Wec) // adhesion - assume absorb
{
absorbInteraction(filmModel, p, pp, faceI, m, keepParticle);
}
else // splash
{
// ratio of incident mass to splashing mass
const scalar mRatio = 0.2 + 0.6*rndGen_.sample01<scalar>();
splashInteraction
(filmModel, p, pp, faceI, mRatio, We, Wec, sigma, keepParticle);
}
}
template<class CloudType>
void Foam::ThermoSurfaceFilm<CloudType>::wetSplashInteraction
(
surfaceFilmModels::surfaceFilmModel& filmModel,
parcelType& p,
const polyPatch& pp,
const label faceI,
bool& keepParticle
)
{
if (debug)
{
Info<< "Parcel " << p.origId() << " wetSplashInteraction" << endl;
}
const liquid& liq = thermo_.liquids().properties()[0];
// Patch face velocity and normal
const vector& Up = this->owner().U().boundaryField()[pp.index()][faceI];
const vector& nf = pp.faceNormals()[faceI];
// local pressure
const scalar pc = thermo_.thermo().p()[p.cell()];
// Retrieve parcel properties
const scalar m = p.mass()*p.nParticle();
const scalar rho = p.rho();
const scalar d = p.d();
vector& U = p.U();
const scalar sigma = liq.sigma(pc, p.T());
const scalar mu = liq.mu(pc, p.T());
const vector Urel = p.U() - Up;
const vector Un = nf*(Urel & nf);
const vector Ut = Urel - Un;
// Laplace number
const scalar La = rho*sigma*d/sqr(mu);
// Weber number
const scalar We = rho*magSqr(Un)*d/sigma;
// Critical Weber number
const scalar Wec = Awet_*pow(La, -0.183);
if (We < 1) // adhesion - assume absorb
{
absorbInteraction(filmModel, p, pp, faceI, m, keepParticle);
}
else if ((We >= 1) && (We < 20)) // bounce
{
// incident angle of impingement
const scalar theta = pi/2 - acos(U/mag(U) & nf);
// restitution coefficient
const scalar epsilon = 0.993 - theta*(1.76 - theta*(1.56 - theta*0.49));
// update parcel velocity
U = -epsilon*(Un) + 5/7*(Ut);
keepParticle = true;
}
else if ((We >= 20) && (We < Wec)) // spread - assume absorb
{
absorbInteraction(filmModel, p, pp, faceI, m, keepParticle);
}
else // splash
{
// ratio of incident mass to splashing mass
// splash mass can be > incident mass due to film entrainment
const scalar mRatio = 0.2 + 0.9*rndGen_.sample01<scalar>();
splashInteraction
(filmModel, p, pp, faceI, mRatio, We, Wec, sigma, keepParticle);
}
}
template<class CloudType>
void Foam::ThermoSurfaceFilm<CloudType>::splashInteraction
(
surfaceFilmModels::surfaceFilmModel& filmModel,
const parcelType& p,
const polyPatch& pp,
const label faceI,
const scalar mRatio,
const scalar We,
const scalar Wec,
const scalar sigma,
bool& keepParticle
)
{
// Patch face velocity and normal
const fvMesh& mesh = this->owner().mesh();
const vector& Up = this->owner().U().boundaryField()[pp.index()][faceI];
const vector& nf = pp.faceNormals()[faceI];
// Determine direction vectors tangential to patch normal
const vector tanVec1 = tangentVector(nf);
const vector tanVec2 = nf^tanVec1;
// Retrieve parcel properties
const scalar np = p.nParticle();
const scalar m = p.mass()*np;
const scalar d = p.d();
const vector Urel = p.U() - Up;
const vector Un = nf*(Urel & nf);
const vector Ut = Urel - Un;
const vector& posC = mesh.C()[p.cell()];
const vector& posCf = mesh.Cf().boundaryField()[pp.index()][faceI];
// total mass of (all) splashed parcels
const scalar mSplash = m*mRatio;
// number of splashed particles per incoming particle
const scalar Ns = 5.0*(We/Wec - 1.0);
// average diameter of splashed particles
const scalar dBarSplash = 1/cbrt(6.0)*cbrt(mRatio/Ns)*d + ROOTVSMALL;
// cumulative diameter splash distribution
const scalar dMin = 0.01*d;
const scalar dMax = d;
const scalar K = exp(-dMin/dBarSplash) - exp(-dMax/dBarSplash);
// surface energy of secondary parcels [J]
scalar ESigmaSec = 0;
// sample splash distribution to detrmine secondary parcel diameters
scalarList dNew(parcelsPerSplash_);
forAll(dNew, i)
{
const scalar y = rndGen_.sample01<scalar>();
dNew[i] = -dBarSplash*log(exp(-dMin/dBarSplash) - y*K);
ESigmaSec += sigma*p.areaS(dNew[i]);
}
// incident kinetic energy [J]
const scalar EKIn = 0.5*m*magSqr(Urel);
// incident surface energy [J]
const scalar ESigmaIn = sigma*p.areaS(d);
// dissipative energy
const scalar Ed = max(0.8*EKIn, Wec/12*pi*sigma*sqr(d));
// total energy [J]
const scalar EKs = EKIn + ESigmaIn - ESigmaSec - Ed;
// switch to absorb if insufficient energy for splash
if (EKs <= 0)
{
absorbInteraction(filmModel, p, pp, faceI, m, keepParticle);
return;
}
// helper variables to calculate magUns0
const scalar logD = log(d);
const scalar coeff2 = log(dNew[0]) - logD + ROOTVSMALL;
scalar coeff1 = 0.0;
forAll(dNew, i)
{
coeff1 += sqr(log(dNew[i]) - logD);
}
// magnitude of the normal velocity of the first splashed parcel
const scalar magUns0 =
sqrt(2.0*parcelsPerSplash_*EKs/mSplash/(1 + coeff1/sqr(coeff2)));
// Set splashed parcel properties
forAll(dNew, i)
{
const vector dirVec = splashDirection(tanVec1, tanVec2, -nf);
// Create a new parcel by copying source parcel
parcelType* pPtr = new parcelType(p);
pPtr->origId() = this->owner().getNewParticleID();
pPtr->origProc() = Pstream::myProcNo();
if (splashParcelType_ >= 0)
{
pPtr->typeId() = splashParcelType_;
}
// perturb new parcels towards the owner cell centre
pPtr->position() += 0.5*rndGen_.sample01<scalar>()*(posC - posCf);
pPtr->nParticle() = mRatio*np*pow3(d)/pow3(dNew[i])/parcelsPerSplash_;
pPtr->d() = dNew[i];
pPtr->U() = dirVec*(mag(Cf_*Ut) + magUns0*(log(dNew[i]) - logD)/coeff2);
// Apply correction to velocity for 2-D cases
meshTools::constrainDirection(mesh, mesh.solutionD(), pPtr->U());
// Add the new parcel
this->owner().addParticle(pPtr);
nParcelsSplashed_++;
}
// transfer remaining part of parcel to film 0 - splashMass can be -ve
// if entraining from the film
const scalar mDash = m - mSplash;
absorbInteraction(filmModel, p, pp, faceI, mDash, keepParticle);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -37,9 +491,37 @@ Foam::ThermoSurfaceFilm<CloudType>::ThermoSurfaceFilm
)
:
SurfaceFilmModel<CloudType>(dict, owner, g, typeName),
rndGen_(owner.rndGen()),
thermo_(owner.db().objectRegistry::lookupObject<SLGThermo>("SLGThermo")),
TFilmPatch_(0),
CpFilmPatch_(0)
{}
CpFilmPatch_(0),
interactionType_
(
interactionTypeEnum(this->coeffDict().lookup("interactionType"))
),
deltaWet_(0.0),
splashParcelType_(0),
parcelsPerSplash_(0),
Adry_(0.0),
Awet_(0.0),
Cf_(0.0),
nParcelsSplashed_(0)
{
Info<< " Applying " << interactionTypeStr(interactionType_)
<< " interaction model" << endl;
if (interactionType_ == itSplashBai)
{
this->coeffDict().lookup("deltaWet") >> deltaWet_;
splashParcelType_ =
this->coeffDict().lookupOrDefault("splashParcelType", -1);
parcelsPerSplash_ =
this->coeffDict().lookupOrDefault("parcelsPerSplash", 2);
this->coeffDict().lookup("Adry") >> Adry_;
this->coeffDict().lookup("Awet") >> Awet_;
this->coeffDict().lookup("Cf") >> Cf_;
}
}
template<class CloudType>
@ -49,8 +531,18 @@ Foam::ThermoSurfaceFilm<CloudType>::ThermoSurfaceFilm
)
:
SurfaceFilmModel<CloudType>(sfm),
rndGen_(sfm.rndGen_),
thermo_(sfm.thermo_),
TFilmPatch_(sfm.TFilmPatch_),
CpFilmPatch_(sfm.CpFilmPatch_)
CpFilmPatch_(sfm.CpFilmPatch_),
interactionType_(sfm.interactionType_),
deltaWet_(sfm.deltaWet_),
splashParcelType_(sfm.splashParcelType_),
parcelsPerSplash_(sfm.parcelsPerSplash_),
Adry_(sfm.Adry_),
Awet_(sfm.Awet_),
Cf_(sfm.Cf_),
nParcelsSplashed_(sfm.nParcelsSplashed_)
{}
@ -66,8 +558,9 @@ Foam::ThermoSurfaceFilm<CloudType>::~ThermoSurfaceFilm()
template<class CloudType>
bool Foam::ThermoSurfaceFilm<CloudType>::transferParcel
(
const parcelType& p,
const label patchI
parcelType& p,
const polyPatch& pp,
bool& keepParticle
)
{
// Retrieve the film model from the owner database
@ -81,49 +574,61 @@ bool Foam::ThermoSurfaceFilm<CloudType>::transferParcel
)
);
const label patchI = pp.index();
if (filmModel.isFilmPatch(patchI))
{
const polyPatch& pp = this->owner().mesh().boundaryMesh()[patchI];
const label faceI = pp.whichFace(p.face());
// Patch face normal
const vector& nf = pp.faceNormals()[faceI];
// Relative parcel velocity
const vector Urel =
p.U() - this->owner().U().boundaryField()[patchI][faceI];
// Parcel mass
const scalar m = p.nParticle()*p.mass();
// Add the particle properties as sources to the film model
filmModel.addSources
(
patchI,
faceI,
m, // mass
m*(Urel - nf*(Urel & nf)), // tangential momentum
m*mag(Urel & nf), // impingement pressure
m*p.hs() // energy
);
if (debug)
switch (interactionType_)
{
Info<< "ThermoSurfaceFilm<CloudType>::transferParcel:" << nl
<< " Effective increase in film height = "
<< p.nParticle()*p.volume()/mag(pp.faceAreas()[faceI]) << endl;
case itBounce:
{
bounceInteraction(p, pp, faceI, keepParticle);
break;
}
case itAbsorb:
{
const scalar m = p.nParticle()*p.mass();
absorbInteraction(filmModel, p, pp, faceI, m, keepParticle);
break;
}
case itSplashBai:
{
bool dry = this->deltaFilmPatch_[patchI][faceI] < deltaWet_;
if (dry)
{
drySplashInteraction(filmModel, p, pp, faceI, keepParticle);
}
else
{
wetSplashInteraction(filmModel, p, pp, faceI, keepParticle);
}
break;
}
default:
{
FatalErrorIn
(
"bool ThermoSurfaceFilm<CloudType>::transferParcel"
"("
"const parcelType&, "
"const label"
")"
) << "Unknown interaction type enumeration"
<< abort(FatalError);
}
}
this->nParcelsTransferred()++;
// Flag to remove parcel p from owner cloud
return true;
}
else
{
return false;
}
// do not transfer parcel
return false;
}
@ -131,6 +636,7 @@ template<class CloudType>
void Foam::ThermoSurfaceFilm<CloudType>::cacheFilmFields
(
const label filmPatchI,
const label primaryPatchI,
const mapDistribute& distMap,
const surfaceFilmModels::surfaceFilmModel& filmModel
)
@ -138,6 +644,7 @@ void Foam::ThermoSurfaceFilm<CloudType>::cacheFilmFields
SurfaceFilmModel<CloudType>::cacheFilmFields
(
filmPatchI,
primaryPatchI,
distMap,
filmModel
);
@ -168,10 +675,12 @@ void Foam::ThermoSurfaceFilm<CloudType>::setParcelProperties
template<class CloudType>
void Foam::ThermoSurfaceFilm<CloudType>::info(Ostream& os) const
{
os << " Parcels transferred to film = "
os << " Parcels absorbed into film = "
<< returnReduce(this->nParcelsTransferred(), sumOp<label>()) << nl
<< " Number of film parcels added = "
<< returnReduce(this->nParcelsInjected(), sumOp<label>()) << nl;
<< " New film detached parcels = "
<< returnReduce(this->nParcelsInjected(), sumOp<label>()) << nl
<< " New film splash parcels = "
<< returnReduce(nParcelsSplashed_, sumOp<label>()) << nl;
}

View File

@ -27,6 +27,19 @@ Class
Description
Thermo parcel surface film model.
Responsible for:
- injecting parcelss from the film model into the cloud, e.g. for dripping
- parcel interaction with the film, e.g absorb, bounce, splash
Splash model references:
Bai and Gosman, `Mathematical modelling of wall films formed by
impinging sprays', SAE 960626, 1996
Bai et al, `Modelling off gasoline spray impingement', Atom. Sprays,
vol 12, pp 1-27, 2002
SourceFiles
ThermoSurfaceFilm.C
ThermoSurfaceFilmI.H
@ -52,6 +65,31 @@ class ThermoSurfaceFilm
:
public SurfaceFilmModel<CloudType>
{
public:
// Public data
// Interaction type enumerations
enum interactionType
{
itAbsorb,
itBounce,
itSplashBai
};
//- Word descriptions of interaction type names
static wordList interactionTypeNames_;
// Public Member Functions
// Return interaction type enum from word
interactionType interactionTypeEnum(const word& it) const;
// Return word from interaction type enum
word interactionTypeStr(const interactionType& it) const;
protected:
// Protected data
@ -59,6 +97,12 @@ protected:
//- Convenience typedef to the cloud's parcel type
typedef typename CloudType::parcelType parcelType;
//- Reference to the cloud random number generator
cachedRandom& rndGen_;
//- Reference to the cloud thermo package
const SLGThermo& thermo_;
// Cached injector fields per film patch
@ -69,24 +113,132 @@ protected:
scalarList CpFilmPatch_;
// Protected functions
// Interaction model data
//- Cache the film fields in preparation for injection
virtual void cacheFilmFields
(
const label filmPatchI,
const mapDistribute& distMap,
const surfaceFilmModels::surfaceFilmModel& filmModel
);
//- Interaction type enumeration
interactionType interactionType_;
//- Set the individual parcel properties
virtual void setParcelProperties
//- Film thickness beyond which patch is assumed to be wet
scalar deltaWet_;
//- Splash parcel type label - id assigned to identify parcel for
// post-processing. If not specified, defaults to originating cloud
// type
label splashParcelType_;
//- Number of new parcels resulting from splash event
label parcelsPerSplash_;
// Surface roughness coefficient typically in the range 1300 - 5200
// and decreases with increasing surface roughness
//- Dry surface roughness coefficient
// = 2630 for dry interaction (ref. Bai)
scalar Adry_;
//- Wet surface roughness coefficient
// = 1320 for wet interaction (ref. Bai)
scalar Awet_;
//- Skin friction typically in the range 0.6 < Cf < 0.8
scalar Cf_;
//- Counter for number of new splash parcels
label nParcelsSplashed_;
// Protected Member Functions
//- Return a vector tangential to input vector, v
vector tangentVector(const vector& v) const;
//- Return splashed parcel direction
vector splashDirection
(
parcelType& p,
const label filmFaceI
const vector& tanVec1,
const vector& tanVec2,
const vector& nf
) const;
// Interaction models
//- Absorb parcel into film
void absorbInteraction
(
surfaceFilmModels::surfaceFilmModel& filmModel,
const parcelType& p,
const polyPatch& pp,
const label faceI,
const scalar mass,
bool& keepParticle
);
//- Bounce parcel (flip parcel normal velocity)
void bounceInteraction
(
parcelType& p,
const polyPatch& pp,
const label faceI,
bool& keepParticle
) const;
//- Parcel interaction with dry surface
void drySplashInteraction
(
surfaceFilmModels::surfaceFilmModel& filmModel,
const parcelType& p,
const polyPatch& pp,
const label faceI,
bool& keepParticle
);
//- Parcel interaction with wetted surface
void wetSplashInteraction
(
surfaceFilmModels::surfaceFilmModel& filmModel,
parcelType& p,
const polyPatch& pp,
const label faceI,
bool& keepParticle
);
//- Bai parcel splash interaction model
void splashInteraction
(
surfaceFilmModels::surfaceFilmModel& filmModel,
const parcelType& p,
const polyPatch& pp,
const label faceI,
const scalar mRatio,
const scalar We,
const scalar Wec,
const scalar sigma,
bool& keepParticle
);
// Injection from sheet (ejection) helper functions
//- Cache the film fields in preparation for injection
virtual void cacheFilmFields
(
const label filmPatchI,
const label primaryPatchI,
const mapDistribute& distMap,
const surfaceFilmModels::surfaceFilmModel& filmModel
);
//- Set the individual parcel properties
virtual void setParcelProperties
(
parcelType& p,
const label filmFaceI
) const;
public:
//- Runtime type information
@ -128,8 +280,9 @@ public:
// Returns true if parcel is to be transferred
virtual bool transferParcel
(
const parcelType& p,
const label patchI
parcelType& p,
const polyPatch& pp,
bool& keepParticle
);

View File

@ -539,7 +539,7 @@ void Foam::fvFieldReconstructor::reconstructFvVolumeInternalFields
{
if
(
!selectedFields.size()
selectedFields.empty()
|| selectedFields.found(fieldIter()->name())
)
{
@ -575,7 +575,7 @@ void Foam::fvFieldReconstructor::reconstructFvVolumeFields
{
if
(
!selectedFields.size()
selectedFields.empty()
|| selectedFields.found(fieldIter()->name())
)
{
@ -611,7 +611,7 @@ void Foam::fvFieldReconstructor::reconstructFvSurfaceFields
{
if
(
!selectedFields.size()
selectedFields.empty()
|| selectedFields.found(fieldIter()->name())
)
{

View File

@ -84,7 +84,8 @@ void reconstructLagrangianFields
const word& cloudName,
const polyMesh& mesh,
const PtrList<fvMesh>& meshes,
const IOobjectList& objects
const IOobjectList& objects,
const HashSet<word>& selectedFields
);
@ -94,7 +95,8 @@ void reconstructLagrangianFieldFields
const word& cloudName,
const polyMesh& mesh,
const PtrList<fvMesh>& meshes,
const IOobjectList& objects
const IOobjectList& objects,
const HashSet<word>& selectedFields
);

View File

@ -155,28 +155,36 @@ void Foam::reconstructLagrangianFields
const word& cloudName,
const polyMesh& mesh,
const PtrList<fvMesh>& meshes,
const IOobjectList& objects
const IOobjectList& objects,
const HashSet<word>& selectedFields
)
{
const word fieldClassName(IOField<Type>::typeName);
IOobjectList fields = objects.lookupClass(fieldClassName);
if (fields.size())
if(fields.size())
{
Info<< " Reconstructing lagrangian "
<< fieldClassName << "s\n" << endl;
forAllConstIter(IOobjectList, fields, fieldIter)
{
Info<< " " << fieldIter()->name() << endl;
reconstructLagrangianField<Type>
if
(
cloudName,
mesh,
meshes,
fieldIter()->name()
)().write();
selectedFields.empty()
|| selectedFields.found(fieldIter()->name())
)
{
Info<< " " << fieldIter()->name() << endl;
reconstructLagrangianField<Type>
(
cloudName,
mesh,
meshes,
fieldIter()->name()
)().write();
}
}
Info<< endl;
@ -190,7 +198,8 @@ void Foam::reconstructLagrangianFieldFields
const word& cloudName,
const polyMesh& mesh,
const PtrList<fvMesh>& meshes,
const IOobjectList& objects
const IOobjectList& objects,
const HashSet<word>& selectedFields
)
{
{
@ -205,14 +214,21 @@ void Foam::reconstructLagrangianFieldFields
forAllConstIter(IOobjectList, fields, fieldIter)
{
Info<< " " << fieldIter()->name() << endl;
reconstructLagrangianFieldField<Type>
if
(
cloudName,
mesh,
meshes,
fieldIter()->name()
)().write();
selectedFields.empty()
|| selectedFields.found(fieldIter()->name())
)
{
Info<< " " << fieldIter()->name() << endl;
reconstructLagrangianFieldField<Type>
(
cloudName,
mesh,
meshes,
fieldIter()->name()
)().write();
}
}
Info<< endl;
@ -231,14 +247,21 @@ void Foam::reconstructLagrangianFieldFields
forAllConstIter(IOobjectList, fields, fieldIter)
{
Info<< " " << fieldIter()->name() << endl;
reconstructLagrangianFieldField<Type>
if
(
cloudName,
mesh,
meshes,
fieldIter()->name()
)().write();
selectedFields.empty()
|| selectedFields.found(fieldIter()->name())
)
{
Info<< " " << fieldIter()->name() << endl;
reconstructLagrangianFieldField<Type>
(
cloudName,
mesh,
meshes,
fieldIter()->name()
)().write();
}
}
Info<< endl;

View File

@ -393,8 +393,7 @@ bool Foam::distanceSurface::update()
}
Foam::tmp<Foam::scalarField>
Foam::distanceSurface::sample
Foam::tmp<Foam::scalarField> Foam::distanceSurface::sample
(
const volScalarField& vField
) const
@ -403,8 +402,7 @@ Foam::distanceSurface::sample
}
Foam::tmp<Foam::vectorField>
Foam::distanceSurface::sample
Foam::tmp<Foam::vectorField> Foam::distanceSurface::sample
(
const volVectorField& vField
) const
@ -413,8 +411,7 @@ Foam::distanceSurface::sample
}
Foam::tmp<Foam::sphericalTensorField>
Foam::distanceSurface::sample
Foam::tmp<Foam::sphericalTensorField> Foam::distanceSurface::sample
(
const volSphericalTensorField& vField
) const
@ -423,8 +420,7 @@ Foam::distanceSurface::sample
}
Foam::tmp<Foam::symmTensorField>
Foam::distanceSurface::sample
Foam::tmp<Foam::symmTensorField> Foam::distanceSurface::sample
(
const volSymmTensorField& vField
) const
@ -433,8 +429,7 @@ Foam::distanceSurface::sample
}
Foam::tmp<Foam::tensorField>
Foam::distanceSurface::sample
Foam::tmp<Foam::tensorField> Foam::distanceSurface::sample
(
const volTensorField& vField
) const
@ -443,8 +438,7 @@ Foam::distanceSurface::sample
}
Foam::tmp<Foam::scalarField>
Foam::distanceSurface::interpolate
Foam::tmp<Foam::scalarField> Foam::distanceSurface::interpolate
(
const interpolation<scalar>& interpolator
) const
@ -453,8 +447,7 @@ Foam::distanceSurface::interpolate
}
Foam::tmp<Foam::vectorField>
Foam::distanceSurface::interpolate
Foam::tmp<Foam::vectorField> Foam::distanceSurface::interpolate
(
const interpolation<vector>& interpolator
) const
@ -462,8 +455,7 @@ Foam::distanceSurface::interpolate
return interpolateField(interpolator);
}
Foam::tmp<Foam::sphericalTensorField>
Foam::distanceSurface::interpolate
Foam::tmp<Foam::sphericalTensorField> Foam::distanceSurface::interpolate
(
const interpolation<sphericalTensor>& interpolator
) const
@ -472,8 +464,7 @@ Foam::distanceSurface::interpolate
}
Foam::tmp<Foam::symmTensorField>
Foam::distanceSurface::interpolate
Foam::tmp<Foam::symmTensorField> Foam::distanceSurface::interpolate
(
const interpolation<symmTensor>& interpolator
) const
@ -482,8 +473,7 @@ Foam::distanceSurface::interpolate
}
Foam::tmp<Foam::tensorField>
Foam::distanceSurface::interpolate
Foam::tmp<Foam::tensorField> Foam::distanceSurface::interpolate
(
const interpolation<tensor>& interpolator
) const

View File

@ -162,8 +162,7 @@ void Foam::sampledPatch::remapFaces
Foam::tmp<Foam::scalarField>
Foam::sampledPatch::sample
Foam::tmp<Foam::scalarField> Foam::sampledPatch::sample
(
const volScalarField& vField
) const
@ -172,8 +171,7 @@ Foam::sampledPatch::sample
}
Foam::tmp<Foam::vectorField>
Foam::sampledPatch::sample
Foam::tmp<Foam::vectorField> Foam::sampledPatch::sample
(
const volVectorField& vField
) const
@ -181,8 +179,7 @@ Foam::sampledPatch::sample
return sampleField(vField);
}
Foam::tmp<Foam::sphericalTensorField>
Foam::sampledPatch::sample
Foam::tmp<Foam::sphericalTensorField> Foam::sampledPatch::sample
(
const volSphericalTensorField& vField
) const
@ -191,8 +188,7 @@ Foam::sampledPatch::sample
}
Foam::tmp<Foam::symmTensorField>
Foam::sampledPatch::sample
Foam::tmp<Foam::symmTensorField> Foam::sampledPatch::sample
(
const volSymmTensorField& vField
) const
@ -201,8 +197,7 @@ Foam::sampledPatch::sample
}
Foam::tmp<Foam::tensorField>
Foam::sampledPatch::sample
Foam::tmp<Foam::tensorField> Foam::sampledPatch::sample
(
const volTensorField& vField
) const
@ -211,8 +206,7 @@ Foam::sampledPatch::sample
}
Foam::tmp<Foam::scalarField>
Foam::sampledPatch::interpolate
Foam::tmp<Foam::scalarField> Foam::sampledPatch::interpolate
(
const interpolation<scalar>& interpolator
) const
@ -221,8 +215,7 @@ Foam::sampledPatch::interpolate
}
Foam::tmp<Foam::vectorField>
Foam::sampledPatch::interpolate
Foam::tmp<Foam::vectorField> Foam::sampledPatch::interpolate
(
const interpolation<vector>& interpolator
) const
@ -230,8 +223,7 @@ Foam::sampledPatch::interpolate
return interpolateField(interpolator);
}
Foam::tmp<Foam::sphericalTensorField>
Foam::sampledPatch::interpolate
Foam::tmp<Foam::sphericalTensorField> Foam::sampledPatch::interpolate
(
const interpolation<sphericalTensor>& interpolator
) const
@ -240,8 +232,7 @@ Foam::sampledPatch::interpolate
}
Foam::tmp<Foam::symmTensorField>
Foam::sampledPatch::interpolate
Foam::tmp<Foam::symmTensorField> Foam::sampledPatch::interpolate
(
const interpolation<symmTensor>& interpolator
) const
@ -250,8 +241,7 @@ Foam::sampledPatch::interpolate
}
Foam::tmp<Foam::tensorField>
Foam::sampledPatch::interpolate
Foam::tmp<Foam::tensorField> Foam::sampledPatch::interpolate
(
const interpolation<tensor>& interpolator
) const

View File

@ -156,8 +156,7 @@ bool Foam::sampledPlane::update()
}
Foam::tmp<Foam::scalarField>
Foam::sampledPlane::sample
Foam::tmp<Foam::scalarField> Foam::sampledPlane::sample
(
const volScalarField& vField
) const
@ -166,8 +165,7 @@ Foam::sampledPlane::sample
}
Foam::tmp<Foam::vectorField>
Foam::sampledPlane::sample
Foam::tmp<Foam::vectorField> Foam::sampledPlane::sample
(
const volVectorField& vField
) const
@ -176,8 +174,7 @@ Foam::sampledPlane::sample
}
Foam::tmp<Foam::sphericalTensorField>
Foam::sampledPlane::sample
Foam::tmp<Foam::sphericalTensorField> Foam::sampledPlane::sample
(
const volSphericalTensorField& vField
) const
@ -186,8 +183,7 @@ Foam::sampledPlane::sample
}
Foam::tmp<Foam::symmTensorField>
Foam::sampledPlane::sample
Foam::tmp<Foam::symmTensorField> Foam::sampledPlane::sample
(
const volSymmTensorField& vField
) const
@ -196,8 +192,7 @@ Foam::sampledPlane::sample
}
Foam::tmp<Foam::tensorField>
Foam::sampledPlane::sample
Foam::tmp<Foam::tensorField> Foam::sampledPlane::sample
(
const volTensorField& vField
) const
@ -206,8 +201,7 @@ Foam::sampledPlane::sample
}
Foam::tmp<Foam::scalarField>
Foam::sampledPlane::interpolate
Foam::tmp<Foam::scalarField> Foam::sampledPlane::interpolate
(
const interpolation<scalar>& interpolator
) const
@ -216,8 +210,7 @@ Foam::sampledPlane::interpolate
}
Foam::tmp<Foam::vectorField>
Foam::sampledPlane::interpolate
Foam::tmp<Foam::vectorField> Foam::sampledPlane::interpolate
(
const interpolation<vector>& interpolator
) const
@ -225,8 +218,7 @@ Foam::sampledPlane::interpolate
return interpolateField(interpolator);
}
Foam::tmp<Foam::sphericalTensorField>
Foam::sampledPlane::interpolate
Foam::tmp<Foam::sphericalTensorField> Foam::sampledPlane::interpolate
(
const interpolation<sphericalTensor>& interpolator
) const
@ -235,8 +227,7 @@ Foam::sampledPlane::interpolate
}
Foam::tmp<Foam::symmTensorField>
Foam::sampledPlane::interpolate
Foam::tmp<Foam::symmTensorField> Foam::sampledPlane::interpolate
(
const interpolation<symmTensor>& interpolator
) const
@ -245,8 +236,7 @@ Foam::sampledPlane::interpolate
}
Foam::tmp<Foam::tensorField>
Foam::sampledPlane::interpolate
Foam::tmp<Foam::tensorField> Foam::sampledPlane::interpolate
(
const interpolation<tensor>& interpolator
) const

View File

@ -191,6 +191,7 @@ Foam::sampledSurface::~sampledSurface()
clearGeom();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const Foam::vectorField& Foam::sampledSurface::Sf() const
@ -238,7 +239,6 @@ Foam::scalar Foam::sampledSurface::area() const
}
// do not project scalar - just copy values
Foam::tmp<Foam::Field<Foam::scalar> >
Foam::sampledSurface::project(const Field<scalar>& field) const
{
@ -295,6 +295,7 @@ void Foam::sampledSurface::print(Ostream& os) const
os << type();
}
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<(Ostream &os, const sampledSurface& s)
@ -304,4 +305,5 @@ Foam::Ostream& Foam::operator<<(Ostream &os, const sampledSurface& s)
return os;
}
// ************************************************************************* //

View File

@ -98,6 +98,7 @@ class sampledSurface
//- Total surface area
mutable scalar area_;
// Make geometric data
//- Make Sf
@ -109,6 +110,7 @@ class sampledSurface
//- Make Cf
void makeCf() const;
// Service methods
//- Check field size matches surface size
@ -135,34 +137,37 @@ class sampledSurface
template<class ReturnType, class Type>
tmp<Field<ReturnType> > project(const tmp<Field<Type> >&) const;
protected:
// Protected Member functions
virtual void clearGeom() const;
public:
//- Runtime type information
TypeName("sampledSurface");
TypeName("sampledSurface");
// Declare run-time constructor selection table
declareRunTimeSelectionTable
//- Declare run-time constructor selection table
declareRunTimeSelectionTable
(
autoPtr,
sampledSurface,
word,
(
autoPtr,
sampledSurface,
word,
(
const word& name,
const polyMesh& mesh,
const dictionary& dict
),
(name, mesh, dict)
);
const word& name,
const polyMesh& mesh,
const dictionary& dict
),
(name, mesh, dict)
);
// iNew helper class
//- Class used for the PtrLists read-construction
class iNew
{
@ -260,7 +265,6 @@ public:
// Do nothing (and return false) if no update was required
virtual bool update() = 0;
//- Points of surface
virtual const pointField& points() const = 0;
@ -394,9 +398,7 @@ public:
//- Write
virtual void print(Ostream&) const;
// IOstream operators
//- Ostream operator
friend Ostream& operator<<(Ostream&, const sampledSurface&);
};

View File

@ -56,7 +56,7 @@ Type Foam::sampledSurface::integrate(const Field<Type>& field) const
if (checkFieldSize(field))
{
value = sum(field * magSf());
value = sum(field*magSf());
}
reduce(value, sumOp<Type>());
@ -80,7 +80,7 @@ Type Foam::sampledSurface::average(const Field<Type>& field) const
if (checkFieldSize(field))
{
value = sum(field * magSf());
value = sum(field*magSf());
}
reduce(value, sumOp<Type>());
@ -88,7 +88,7 @@ Type Foam::sampledSurface::average(const Field<Type>& field) const
// avoid divide-by-zero
if (area())
{
return value / area();
return value/area();
}
else
{
@ -119,7 +119,7 @@ void Foam::sampledSurface::project
forAll(norm, faceI)
{
res[faceI] = field[faceI] & (norm[faceI] / mag(norm[faceI]));
res[faceI] = field[faceI] & (norm[faceI]/mag(norm[faceI]));
}
}
else
@ -208,5 +208,4 @@ Foam::sampledSurface::pointAverage
}
// ************************************************************************* //

View File

@ -301,8 +301,7 @@ bool Foam::sampledTriSurfaceMesh::update()
}
Foam::tmp<Foam::scalarField>
Foam::sampledTriSurfaceMesh::sample
Foam::tmp<Foam::scalarField> Foam::sampledTriSurfaceMesh::sample
(
const volScalarField& vField
) const
@ -311,8 +310,7 @@ Foam::sampledTriSurfaceMesh::sample
}
Foam::tmp<Foam::vectorField>
Foam::sampledTriSurfaceMesh::sample
Foam::tmp<Foam::vectorField> Foam::sampledTriSurfaceMesh::sample
(
const volVectorField& vField
) const
@ -320,8 +318,7 @@ Foam::sampledTriSurfaceMesh::sample
return sampleField(vField);
}
Foam::tmp<Foam::sphericalTensorField>
Foam::sampledTriSurfaceMesh::sample
Foam::tmp<Foam::sphericalTensorField> Foam::sampledTriSurfaceMesh::sample
(
const volSphericalTensorField& vField
) const
@ -330,8 +327,7 @@ Foam::sampledTriSurfaceMesh::sample
}
Foam::tmp<Foam::symmTensorField>
Foam::sampledTriSurfaceMesh::sample
Foam::tmp<Foam::symmTensorField> Foam::sampledTriSurfaceMesh::sample
(
const volSymmTensorField& vField
) const
@ -340,8 +336,7 @@ Foam::sampledTriSurfaceMesh::sample
}
Foam::tmp<Foam::tensorField>
Foam::sampledTriSurfaceMesh::sample
Foam::tmp<Foam::tensorField> Foam::sampledTriSurfaceMesh::sample
(
const volTensorField& vField
) const
@ -350,8 +345,7 @@ Foam::sampledTriSurfaceMesh::sample
}
Foam::tmp<Foam::scalarField>
Foam::sampledTriSurfaceMesh::interpolate
Foam::tmp<Foam::scalarField> Foam::sampledTriSurfaceMesh::interpolate
(
const interpolation<scalar>& interpolator
) const
@ -360,8 +354,7 @@ Foam::sampledTriSurfaceMesh::interpolate
}
Foam::tmp<Foam::vectorField>
Foam::sampledTriSurfaceMesh::interpolate
Foam::tmp<Foam::vectorField> Foam::sampledTriSurfaceMesh::interpolate
(
const interpolation<vector>& interpolator
) const
@ -369,8 +362,7 @@ Foam::sampledTriSurfaceMesh::interpolate
return interpolateField(interpolator);
}
Foam::tmp<Foam::sphericalTensorField>
Foam::sampledTriSurfaceMesh::interpolate
Foam::tmp<Foam::sphericalTensorField> Foam::sampledTriSurfaceMesh::interpolate
(
const interpolation<sphericalTensor>& interpolator
) const
@ -379,8 +371,7 @@ Foam::sampledTriSurfaceMesh::interpolate
}
Foam::tmp<Foam::symmTensorField>
Foam::sampledTriSurfaceMesh::interpolate
Foam::tmp<Foam::symmTensorField> Foam::sampledTriSurfaceMesh::interpolate
(
const interpolation<symmTensor>& interpolator
) const
@ -389,8 +380,7 @@ Foam::sampledTriSurfaceMesh::interpolate
}
Foam::tmp<Foam::tensorField>
Foam::sampledTriSurfaceMesh::interpolate
Foam::tmp<Foam::tensorField> Foam::sampledTriSurfaceMesh::interpolate
(
const interpolation<tensor>& interpolator
) const

View File

@ -215,8 +215,7 @@ bool Foam::sampledThresholdCellFaces::update()
}
Foam::tmp<Foam::scalarField>
Foam::sampledThresholdCellFaces::sample
Foam::tmp<Foam::scalarField> Foam::sampledThresholdCellFaces::sample
(
const volScalarField& vField
) const
@ -225,8 +224,7 @@ Foam::sampledThresholdCellFaces::sample
}
Foam::tmp<Foam::vectorField>
Foam::sampledThresholdCellFaces::sample
Foam::tmp<Foam::vectorField> Foam::sampledThresholdCellFaces::sample
(
const volVectorField& vField
) const
@ -235,8 +233,7 @@ Foam::sampledThresholdCellFaces::sample
}
Foam::tmp<Foam::sphericalTensorField>
Foam::sampledThresholdCellFaces::sample
Foam::tmp<Foam::sphericalTensorField> Foam::sampledThresholdCellFaces::sample
(
const volSphericalTensorField& vField
) const
@ -245,8 +242,7 @@ Foam::sampledThresholdCellFaces::sample
}
Foam::tmp<Foam::symmTensorField>
Foam::sampledThresholdCellFaces::sample
Foam::tmp<Foam::symmTensorField> Foam::sampledThresholdCellFaces::sample
(
const volSymmTensorField& vField
) const
@ -255,8 +251,7 @@ Foam::sampledThresholdCellFaces::sample
}
Foam::tmp<Foam::tensorField>
Foam::sampledThresholdCellFaces::sample
Foam::tmp<Foam::tensorField> Foam::sampledThresholdCellFaces::sample
(
const volTensorField& vField
) const
@ -265,8 +260,7 @@ Foam::sampledThresholdCellFaces::sample
}
Foam::tmp<Foam::scalarField>
Foam::sampledThresholdCellFaces::interpolate
Foam::tmp<Foam::scalarField> Foam::sampledThresholdCellFaces::interpolate
(
const interpolation<scalar>& interpolator
) const
@ -275,8 +269,7 @@ Foam::sampledThresholdCellFaces::interpolate
}
Foam::tmp<Foam::vectorField>
Foam::sampledThresholdCellFaces::interpolate
Foam::tmp<Foam::vectorField> Foam::sampledThresholdCellFaces::interpolate
(
const interpolation<vector>& interpolator
) const
@ -294,8 +287,7 @@ Foam::sampledThresholdCellFaces::interpolate
}
Foam::tmp<Foam::symmTensorField>
Foam::sampledThresholdCellFaces::interpolate
Foam::tmp<Foam::symmTensorField> Foam::sampledThresholdCellFaces::interpolate
(
const interpolation<symmTensor>& interpolator
) const
@ -304,8 +296,7 @@ Foam::sampledThresholdCellFaces::interpolate
}
Foam::tmp<Foam::tensorField>
Foam::sampledThresholdCellFaces::interpolate
Foam::tmp<Foam::tensorField> Foam::sampledThresholdCellFaces::interpolate
(
const interpolation<tensor>& interpolator
) const

View File

@ -136,7 +136,6 @@ public:
// Do nothing (and return false) if no update was needed
virtual bool update();
//- Points of surface
virtual const pointField& points() const
{
@ -150,16 +149,10 @@ public:
}
//- sample field on surface
virtual tmp<scalarField> sample
(
const volScalarField&
) const;
virtual tmp<scalarField> sample(const volScalarField&) const;
//- sample field on surface
virtual tmp<vectorField> sample
(
const volVectorField&
) const;
virtual tmp<vectorField> sample( const volVectorField&) const;
//- sample field on surface
virtual tmp<sphericalTensorField> sample
@ -168,10 +161,7 @@ public:
) const;
//- sample field on surface
virtual tmp<symmTensorField> sample
(
const volSymmTensorField&
) const;
virtual tmp<symmTensorField> sample(const volSymmTensorField&) const;
//- sample field on surface
virtual tmp<tensorField> sample
@ -179,7 +169,6 @@ public:
const volTensorField&
) const;
//- interpolate field on surface
virtual tmp<scalarField> interpolate
(

View File

@ -136,9 +136,17 @@ void Foam::surfaceFilmModels::noFilm::addSources
}
const Foam::volScalarField& Foam::surfaceFilmModels::noFilm::delta() const
{
FatalErrorIn("const volScalarField& noFilm::delta() const")
<< "delta field not available for " << type() << abort(FatalError);
return volScalarField::null();
}
const Foam::volVectorField& Foam::surfaceFilmModels::noFilm::U() const
{
FatalErrorIn("const volScalarField& noFilm::U() const")
FatalErrorIn("const volVectorField& noFilm::U() const")
<< "U field not available for " << type() << abort(FatalError);
return volVectorField::null();
@ -147,7 +155,7 @@ const Foam::volVectorField& Foam::surfaceFilmModels::noFilm::U() const
const Foam::volVectorField& Foam::surfaceFilmModels::noFilm::Us() const
{
FatalErrorIn("const volScalarField& noFilm::Us() const")
FatalErrorIn("const volVectorField& noFilm::Us() const")
<< "Us field not available for " << type() << abort(FatalError);
return volVectorField::null();
@ -156,7 +164,7 @@ const Foam::volVectorField& Foam::surfaceFilmModels::noFilm::Us() const
const Foam::volVectorField& Foam::surfaceFilmModels::noFilm::Uw() const
{
FatalErrorIn("const volScalarField& noFilm::Uw() const")
FatalErrorIn("const volVectorField& noFilm::Uw() const")
<< "Uw field not available for " << type() << abort(FatalError);
return volVectorField::null();

View File

@ -126,6 +126,9 @@ public:
// Fields
//- Return the film thickness [m]
virtual const volScalarField& delta() const;
//- Return the film velocity [m/s]
virtual const volVectorField& U() const;

View File

@ -220,6 +220,9 @@ public:
// Fields
//- Return the film thickness [m]
virtual const volScalarField& delta() const = 0;
//- Return the film velocity [m/s]
virtual const volVectorField& U() const = 0;