Merge remote branch 'OpenCFD/master' into olesenm

This commit is contained in:
Mark Olesen
2010-04-22 15:53:54 +02:00
36 changed files with 1002 additions and 27 deletions

View File

@ -577,21 +577,56 @@ Foam::polyMesh::polyMesh
<< "Found " << nFaces - defaultPatchStart
<< " undefined faces in mesh; adding to default patch." << endl;
boundary_.set
(
nAllPatches,
polyPatch::New
(
defaultBoundaryPatchType,
defaultBoundaryPatchName,
nFaces - defaultPatchStart,
defaultPatchStart,
boundary_.size() - 1,
boundary_
)
);
// Check if there already exists a defaultFaces patch as last patch
// and reuse it.
label patchI = findIndex(boundaryPatchNames, defaultBoundaryPatchName);
nAllPatches++;
if (patchI != -1)
{
if (patchI != boundaryFaces.size()-1 || boundary_[patchI].size())
{
FatalErrorIn("polyMesh::polyMesh(... construct from shapes...)")
<< "Default patch " << boundary_[patchI].name()
<< " already has faces in it or is not"
<< " last in list of patches." << exit(FatalError);
}
WarningIn("polyMesh::polyMesh(... construct from shapes...)")
<< "Reusing existing patch " << patchI
<< " for undefined faces." << endl;
boundary_.set
(
patchI,
polyPatch::New
(
boundaryPatchTypes[patchI],
boundaryPatchNames[patchI],
nFaces - defaultPatchStart,
defaultPatchStart,
patchI,
boundary_
)
);
}
else
{
boundary_.set
(
nAllPatches,
polyPatch::New
(
defaultBoundaryPatchType,
defaultBoundaryPatchName,
nFaces - defaultPatchStart,
defaultPatchStart,
boundary_.size() - 1,
boundary_
)
);
nAllPatches++;
}
}
// Reset the size of the boundary

View File

@ -258,7 +258,10 @@ bool Foam::KinematicParcel<ParcelType>::move(TrackData& td)
// face is hit
label cellI = p.cell();
dt *= p.trackToFace(p.position() + dt*U_, td);
if (p.active())
{
dt *= p.trackToFace(p.position() + dt*U_, td);
}
tEnd -= dt;
p.stepFraction() = 1.0 - tEnd/deltaT;
@ -322,6 +325,7 @@ bool Foam::KinematicParcel<ParcelType>::hitPatch
pp,
this->face(),
td.keepParticle,
active_,
U_
);
}

View File

@ -194,6 +194,9 @@ protected:
// Parcel properties
//- Active flag - tracking inactive when active = false
bool active_;
//- Parcel type id
label typeId_;
@ -308,6 +311,9 @@ public:
// Access
//- Return const access to active flag
inline bool active() const;
//- Return const access to type id
inline label typeId() const;
@ -332,8 +338,11 @@ public:
// Edit
//- Return const access to active flag
inline bool& active();
//- Return access to type id
inline label typeId();
inline label& typeId();
//- Return access to number of particles
inline scalar& nParticle();

View File

@ -75,6 +75,7 @@ inline Foam::KinematicParcel<ParcelType>::KinematicParcel
)
:
Particle<ParcelType>(owner, position, cellI),
active_(false),
typeId_(owner.parcelTypeId()),
nParticle_(0),
d_(0.0),
@ -102,6 +103,7 @@ inline Foam::KinematicParcel<ParcelType>::KinematicParcel
)
:
Particle<ParcelType>(owner, position, cellI),
active_(true),
typeId_(typeId),
nParticle_(nParticle0),
d_(d0),
@ -201,6 +203,13 @@ Foam::KinematicParcel<ParcelType>::trackData::g() const
// * * * * * * * * * * KinematicParcel Member Functions * * * * * * * * * * //
template <class ParcelType>
inline bool Foam::KinematicParcel<ParcelType>::active() const
{
return active_;
}
template <class ParcelType>
inline Foam::label Foam::KinematicParcel<ParcelType>::typeId() const
{
@ -251,7 +260,14 @@ inline const Foam::vector& Foam::KinematicParcel<ParcelType>::UTurb() const
template <class ParcelType>
inline Foam::label Foam::KinematicParcel<ParcelType>::typeId()
inline bool& Foam::KinematicParcel<ParcelType>::active()
{
return active_;
}
template <class ParcelType>
inline Foam::label& Foam::KinematicParcel<ParcelType>::typeId()
{
return typeId_;
}

View File

@ -33,6 +33,7 @@ License
template <class ParcelType>
Foam::string Foam::KinematicParcel<ParcelType>::propHeader =
Particle<ParcelType>::propHeader
+ " active"
+ " typeId"
+ " nParticle"
+ " d"
@ -53,6 +54,7 @@ Foam::KinematicParcel<ParcelType>::KinematicParcel
)
:
Particle<ParcelType>(cloud, is, readFields),
active_(false),
typeId_(0),
nParticle_(0.0),
d_(0.0),
@ -68,6 +70,7 @@ Foam::KinematicParcel<ParcelType>::KinematicParcel
{
if (is.format() == IOstream::ASCII)
{
active_ = readBool(is);
typeId_ = readLabel(is);
nParticle_ = readScalar(is);
d_ = readScalar(is);
@ -81,7 +84,8 @@ Foam::KinematicParcel<ParcelType>::KinematicParcel
is.read
(
reinterpret_cast<char*>(&typeId_),
sizeof(typeId_)
sizeof(active_)
+ sizeof(typeId_)
+ sizeof(nParticle_)
+ sizeof(d_)
+ sizeof(U_)
@ -111,6 +115,9 @@ void Foam::KinematicParcel<ParcelType>::readFields(Cloud<ParcelType>& c)
Particle<ParcelType>::readFields(c);
IOField<label> active(c.fieldIOobject("active", IOobject::MUST_READ));
c.checkFieldIOobject(c, active);
IOField<label> typeId(c.fieldIOobject("typeId", IOobject::MUST_READ));
c.checkFieldIOobject(c, typeId);
@ -138,6 +145,7 @@ void Foam::KinematicParcel<ParcelType>::readFields(Cloud<ParcelType>& c)
{
ParcelType& p = iter();
p.active_ = active[i];
p.typeId_ = typeId[i];
p.nParticle_ = nParticle[i];
p.d_ = d[i];
@ -157,6 +165,7 @@ void Foam::KinematicParcel<ParcelType>::writeFields(const Cloud<ParcelType>& c)
label np = c.size();
IOField<label> active(c.fieldIOobject("active", IOobject::NO_READ), np);
IOField<label> typeId(c.fieldIOobject("typeId", IOobject::NO_READ), np);
IOField<scalar> nParticle
(
@ -174,6 +183,7 @@ void Foam::KinematicParcel<ParcelType>::writeFields(const Cloud<ParcelType>& c)
{
const KinematicParcel<ParcelType>& p = iter();
active[i] = p.active();
typeId[i] = p.typeId();
nParticle[i] = p.nParticle();
d[i] = p.d();
@ -184,6 +194,7 @@ void Foam::KinematicParcel<ParcelType>::writeFields(const Cloud<ParcelType>& c)
i++;
}
active.write();
typeId.write();
nParticle.write();
d.write();
@ -206,6 +217,7 @@ Foam::Ostream& Foam::operator<<
if (os.format() == IOstream::ASCII)
{
os << static_cast<const Particle<ParcelType>&>(p)
<< token::SPACE << p.active()
<< token::SPACE << p.typeId()
<< token::SPACE << p.nParticle()
<< token::SPACE << p.d()
@ -219,8 +231,9 @@ Foam::Ostream& Foam::operator<<
os << static_cast<const Particle<ParcelType>&>(p);
os.write
(
reinterpret_cast<const char*>(&p.typeId_),
sizeof(p.typeId())
reinterpret_cast<const char*>(&p.active_),
sizeof(p.active())
+ sizeof(p.typeId())
+ sizeof(p.nParticle())
+ sizeof(p.d())
+ sizeof(p.U())

View File

@ -140,6 +140,7 @@ bool Foam::LocalInteraction<CloudType>::correct
const polyPatch& pp,
const label faceId,
bool& keepParticle,
bool& active,
vector& U
) const
{
@ -158,18 +159,21 @@ bool Foam::LocalInteraction<CloudType>::correct
case PatchInteractionModel<CloudType>::itEscape:
{
keepParticle = false;
active = false;
U = vector::zero;
break;
}
case PatchInteractionModel<CloudType>::itStick:
{
keepParticle = true;
active = false;
U = vector::zero;
break;
}
case PatchInteractionModel<CloudType>::itRebound:
{
keepParticle = true;
active = true;
vector nw = pp.faceAreas()[pp.whichFace(faceId)];
nw /= mag(nw);

View File

@ -92,6 +92,7 @@ public:
const polyPatch& pp,
const label faceId,
bool& keepParticle,
bool& active,
vector& U
) const;
};

View File

@ -155,6 +155,7 @@ public:
const polyPatch& pp,
const label faceId,
bool& keepParticle,
bool& active,
vector& U
) const = 0;
};

View File

@ -61,10 +61,12 @@ bool Foam::Rebound<CloudType>::correct
const polyPatch& pp,
const label faceId,
bool& keepParticle,
bool& active,
vector& U
) const
{
keepParticle = true;
active = true;
vector nw = pp.faceAreas()[pp.whichFace(faceId)];
nw /= mag(nw);

View File

@ -82,6 +82,7 @@ public:
const polyPatch& pp,
const label faceId,
bool& keepParticle,
bool& active,
vector& U
) const;
};

View File

@ -98,6 +98,7 @@ bool Foam::StandardWallInteraction<CloudType>::correct
const polyPatch& pp,
const label faceId,
bool& keepParticle,
bool& active,
vector& U
) const
{
@ -108,18 +109,21 @@ bool Foam::StandardWallInteraction<CloudType>::correct
case PatchInteractionModel<CloudType>::itEscape:
{
keepParticle = false;
active = false;
U = vector::zero;
break;
}
case PatchInteractionModel<CloudType>::itStick:
{
keepParticle = true;
active = false;
U = vector::zero;
break;
}
case PatchInteractionModel<CloudType>::itRebound:
{
keepParticle = true;
active = true;
vector nw = pp.faceAreas()[pp.whichFace(faceId)];
nw /= mag(nw);

View File

@ -102,6 +102,7 @@ public:
const polyPatch& pp,
const label faceId,
bool& keepParticle,
bool& active,
vector& U
) const;
};