ENH: Adding WallSiteData collection and passing it to the wall model.

Adding tangential forces (with no memory) to wall model.
This commit is contained in:
graham
2010-05-14 15:58:05 +01:00
parent 5924a74108
commit 1789098e5a
10 changed files with 214 additions and 161 deletions

View File

@ -180,12 +180,15 @@ void Foam::PairCollision<CloudType>::wallInteraction()
const volVectorField& U = mesh.lookupObject<volVectorField>(il_.UName());
// Storage for the wall interaction sites
DynamicList<point> flatSites;
DynamicList<point> flatSitePoints;
DynamicList<scalar> flatSiteExclusionDistancesSqr;
DynamicList<point> otherSites;
DynamicList<WallSiteData<vector> > flatSiteData;
DynamicList<point> otherSitePoints;
DynamicList<scalar> otherSiteDistances;
DynamicList<point> sharpSites;
DynamicList<WallSiteData<vector> > otherSiteData;
DynamicList<point> sharpSitePoints;
DynamicList<scalar> sharpSiteExclusionDistancesSqr;
DynamicList<WallSiteData<vector> > sharpSiteData;
forAll(dil, realCellI)
{
@ -195,12 +198,15 @@ void Foam::PairCollision<CloudType>::wallInteraction()
// Loop over all Parcels in cell
forAll(cellOccupancy_[realCellI], cellParticleI)
{
flatSites.clear();
flatSitePoints.clear();
flatSiteExclusionDistancesSqr.clear();
otherSites.clear();
flatSiteData.clear();
otherSitePoints.clear();
otherSiteDistances.clear();
sharpSites.clear();
otherSiteData.clear();
sharpSitePoints.clear();
sharpSiteExclusionDistancesSqr.clear();
sharpSiteData.clear();
typename CloudType::parcelType& p =
*cellOccupancy_[realCellI][cellParticleI];
@ -233,6 +239,18 @@ void Foam::PairCollision<CloudType>::wallInteraction()
scalar normalAlignment = normal & pW/mag(pW);
// Find the patchIndex and wallData for WallSiteData object
label patchI = patchID[realFaceI - mesh.nInternalFaces()];
label patchFaceI =
realFaceI - mesh.boundaryMesh()[patchI].start();
WallSiteData<vector> wSD
(
patchI,
U.boundaryField()[patchI][patchFaceI]
);
if (normalAlignment > cosPhiMinFlatWall)
{
// Guard against a flat interaction being
@ -243,25 +261,29 @@ void Foam::PairCollision<CloudType>::wallInteraction()
(
!duplicatePointInList
(
flatSites,
flatSitePoints,
nearPt,
sqr(r*flatWallDuplicateExclusion)
)
)
{
flatSites.append(nearPt);
flatSitePoints.append(nearPt);
flatSiteExclusionDistancesSqr.append
(
sqr(r) - sqr(nearest.distance())
);
flatSiteData.append(wSD);
}
}
else
{
otherSites.append(nearPt);
otherSitePoints.append(nearPt);
otherSiteDistances.append(nearest.distance());
otherSiteData.append(wSD);
}
}
}
@ -294,6 +316,14 @@ void Foam::PairCollision<CloudType>::wallInteraction()
scalar normalAlignment = normal & pW/mag(pW);
// Find the patchIndex and wallData for WallSiteData object
WallSiteData<vector> wSD
(
rwf.patchIndex(),
il_.referredWallData()[refWallFaceI]
);
if (normalAlignment > cosPhiMinFlatWall)
{
// Guard against a flat interaction being
@ -304,25 +334,29 @@ void Foam::PairCollision<CloudType>::wallInteraction()
(
!duplicatePointInList
(
flatSites,
flatSitePoints,
nearPt,
sqr(r*flatWallDuplicateExclusion)
)
)
{
flatSites.append(nearPt);
flatSitePoints.append(nearPt);
flatSiteExclusionDistancesSqr.append
(
sqr(r) - sqr(nearest.distance())
);
flatSiteData.append(wSD);
}
}
else
{
otherSites.append(nearPt);
otherSitePoints.append(nearPt);
otherSiteDistances.append(nearest.distance());
otherSiteData.append(wSD);
}
}
}
@ -344,13 +378,13 @@ void Foam::PairCollision<CloudType>::wallInteraction()
{
label orderedIndex = sortedOtherSiteIndices[siteI];
const point& otherPt = otherSites[orderedIndex];
const point& otherPt = otherSitePoints[orderedIndex];
if
(
!duplicatePointInList
(
flatSites,
flatSitePoints,
otherPt,
flatSiteExclusionDistancesSqr
)
@ -363,23 +397,32 @@ void Foam::PairCollision<CloudType>::wallInteraction()
(
!duplicatePointInList
(
sharpSites,
sharpSitePoints,
otherPt,
sharpSiteExclusionDistancesSqr
)
)
{
sharpSites.append(otherPt);
sharpSitePoints.append(otherPt);
sharpSiteExclusionDistancesSqr.append
(
sqr(r) - sqr(otherSiteDistances[orderedIndex])
);
sharpSiteData.append(otherSiteData[orderedIndex]);
}
}
}
evaluateWall(p, flatSites, sharpSites);
evaluateWall
(
p,
flatSitePoints,
flatSiteData,
sharpSitePoints,
sharpSiteData
);
}
}
}
@ -469,11 +512,20 @@ template<class CloudType>
void Foam::PairCollision<CloudType>::evaluateWall
(
typename CloudType::parcelType& p,
const List<point>& flatSites,
const List<point>& sharpSites
const List<point>& flatSitePoints,
const List<WallSiteData<vector> >& flatSiteData,
const List<point>& sharpSitePoints,
const List<WallSiteData<vector> >& sharpSiteData
) const
{
wallModel_->evaluateWall(p, flatSites, sharpSites);
wallModel_->evaluateWall
(
p,
flatSitePoints,
flatSiteData,
sharpSitePoints,
sharpSiteData
);
}

View File

@ -36,7 +36,7 @@ SourceFiles
#include "CollisionModel.H"
#include "InteractionLists.H"
#include "WallInteractionSite.H"
#include "WallSiteData.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -138,8 +138,10 @@ class PairCollision
void evaluateWall
(
typename CloudType::parcelType& p,
const List<point>& flatSites,
const List<point>& sharpSites
const List<point>& flatSitePoints,
const List<WallSiteData<vector> >& flatSiteData,
const List<point>& sharpSitePoints,
const List<WallSiteData<vector> >& sharpSiteData
) const;

View File

@ -215,7 +215,7 @@ void Foam::PairSpringSliderDashpot<CloudType>::evaluatePair
{
scalar kT = 8.0*sqrt(R*normalOverlapMag)*Gstar_;
scalar& etaT = etaN;
scalar etaT = etaN;
// Tangential force
vector fT_AB;

View File

@ -1,82 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 "WallInteractionSite.H"
#include "IOstreams.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
Foam::WallInteractionSite<Type>::WallInteractionSite(Istream& is)
:
base1(is),
base2(is),
member1(is),
member2(is)
{
// Check state of Istream
is.check("Foam::WallInteractionSite<Type>::WallInteractionSite(Foam::Istream&)");
}
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
template<class Type>
Foam::Istream& Foam::operator>>
(
Istream& is,
WallInteractionSite<Type>&
)
{
// Check state of Istream
is.check
(
"Foam::Istream& Foam::operator>>"
"(Foam::Istream&, Foam::WallInteractionSite<Type>&)"
);
return is;
}
template<class Type>
Foam::Ostream& Foam::operator<<
(
Ostream& os,
const WallInteractionSite<Type>&
)
{
// Check state of Ostream
os.check
(
"Foam::Ostream& Foam::operator<<"
"(Ostream&, const WallInteractionSite<Type>&)"
);
return os;
}
// ************************************************************************* //

View File

@ -133,8 +133,10 @@ public:
virtual void evaluateWall
(
typename CloudType::parcelType& p,
const List<point>& flatSites,
const List<point>& sharpSites
const List<point>& flatSitePoints,
const List<WallSiteData<vector> >& flatSiteData,
const List<point>& sharpSitePoints,
const List<WallSiteData<vector> >& sharpSiteData
) const = 0;
};

View File

@ -66,15 +66,21 @@ void Foam::WallSpringSliderDashpot<CloudType>::evaluateWall
(
typename CloudType::parcelType& p,
const point& site,
const WallSiteData<vector>& data,
scalar pNu,
scalar pE,
scalar Estar,
scalar kN
scalar kN,
scalar Gstar
) const
{
scalar pR = p.d()/2;
vector r_PW = p.position() - site;
scalar normalOverlapMag = p.d()/2 - mag(r_PW);
vector U_PW = p.U() - data.wallData();
scalar normalOverlapMag = pR - mag(r_PW);
vector rHat_PW = r_PW/(mag(r_PW) + VSMALL);
@ -82,9 +88,54 @@ void Foam::WallSpringSliderDashpot<CloudType>::evaluateWall
vector fN_PW =
rHat_PW
*(kN*pow(normalOverlapMag, b_) - etaN*(p.U() & rHat_PW));
*(kN*pow(normalOverlapMag, b_) - etaN*(U_PW & rHat_PW));
p.f() += fN_PW;
vector USlip_PW =
U_PW - (U_PW & rHat_PW)*rHat_PW
+ (p.omega() ^ (pR*-rHat_PW));
scalar deltaT = this->owner().mesh().time().deltaTValue();
// For remembering previous overlap
// vector deltaTangentialOverlap_PW = USlip_PW * deltaT;
// tangentialOverlap_PW += deltaTangentialOverlap_PW;
vector tangentialOverlap_PW = USlip_PW * deltaT;
scalar tangentialOverlapMag = mag(tangentialOverlap_PW);
if (tangentialOverlapMag > VSMALL)
{
scalar kT = 8.0*sqrt(pR*normalOverlapMag)*Gstar;
scalar etaT = etaN;
// Tangential force
vector fT_PW;
if (kT*tangentialOverlapMag > mu_*mag(fN_PW))
{
// Tangential force greater than sliding friction,
// particle slips
fT_PW = -mu_*mag(fN_PW)*USlip_PW/mag(USlip_PW);
// tangentialOverlap_PW = vector::zero;
}
else
{
fT_PW =
-kT*tangentialOverlapMag
*tangentialOverlap_PW/tangentialOverlapMag
- etaT*USlip_PW;
}
p.f() += fT_PW;
p.torque() += (pR*-rHat_PW) ^ fT_PW;
}
}
@ -164,8 +215,10 @@ template<class CloudType>
void Foam::WallSpringSliderDashpot<CloudType>::evaluateWall
(
typename CloudType::parcelType& p,
const List<point>& flatSites,
const List<point>& sharpSites
const List<point>& flatSitePoints,
const List<WallSiteData<vector> >& flatSiteData,
const List<point>& sharpSitePoints,
const List<WallSiteData<vector> >& sharpSiteData
) const
{
scalar pNu = this->owner().constProps().poissonsRatio();
@ -176,16 +229,38 @@ void Foam::WallSpringSliderDashpot<CloudType>::evaluateWall
scalar kN = (4.0/3.0)*sqrt(p.d()/2)*Estar;
forAll(flatSites, siteI)
scalar GStar = 1/(2*((2 + pNu - sqr(pNu))/pE + (2 + nu_ - sqr(nu_))/E_));
forAll(flatSitePoints, siteI)
{
evaluateWall(p, flatSites[siteI], pNu, pE, Estar, kN);
evaluateWall
(
p,
flatSitePoints[siteI],
flatSiteData[siteI],
pNu,
pE,
Estar,
kN,
GStar
);
}
forAll(sharpSites, siteI)
forAll(sharpSitePoints, siteI)
{
// Treating sharp sites like flat sites
evaluateWall(p, sharpSites[siteI], pNu, pE, Estar, kN);
evaluateWall
(
p,
sharpSitePoints[siteI],
sharpSiteData[siteI],
pNu,
pE,
Estar,
kN,
GStar
);
}
}

View File

@ -86,10 +86,12 @@ class WallSpringSliderDashpot
(
typename CloudType::parcelType& p,
const point& site,
const WallSiteData<vector>& data,
scalar pNu,
scalar pE,
scalar Estar,
scalar kN
scalar kN,
scalar Gstar
) const;
@ -124,8 +126,10 @@ public:
virtual void evaluateWall
(
typename CloudType::parcelType& p,
const List<point>& flatSites,
const List<point>& sharpSites
const List<point>& flatSitePoints,
const List<WallSiteData<vector> >& flatSiteData,
const List<point>& sharpSitePoints,
const List<WallSiteData<vector> >& sharpSiteData
) const;
};

View File

@ -23,12 +23,12 @@ License
\*---------------------------------------------------------------------------*/
#include "WallInteractionSite.H"
#include "WallSiteData.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
Foam::WallInteractionSite<Type>::WallInteractionSite()
Foam::WallSiteData<Type>::WallSiteData()
:
patchI_(),
wallData_()
@ -36,7 +36,7 @@ Foam::WallInteractionSite<Type>::WallInteractionSite()
template<class Type>
Foam::WallInteractionSite<Type>::WallInteractionSite
Foam::WallSiteData<Type>::WallSiteData
(
label patchI,
const Type& wallData
@ -50,26 +50,26 @@ Foam::WallInteractionSite<Type>::WallInteractionSite
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class Type>
Foam::WallInteractionSite<Type>::~WallInteractionSite()
Foam::WallSiteData<Type>::~WallSiteData()
{}
// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * //
template<class Type>
bool Foam::WallInteractionSite<Type>::operator==
bool Foam::WallSiteData<Type>::operator==
(
const WallInteractionSite<Type>& rhs
const WallSiteData<Type>& rhs
) const
{
return patchI_ == rhs.patch_ && wallData_ == rhs.wallData_;
return patchI_ == rhs.patchI_ && wallData_ == rhs.wallData_;
}
template<class Type>
bool Foam::WallInteractionSite<Type>::operator!=
bool Foam::WallSiteData<Type>::operator!=
(
const WallInteractionSite<Type>& rhs
const WallSiteData<Type>& rhs
) const
{
return !(*this == rhs);
@ -82,7 +82,7 @@ template<class Type>
Foam::Istream& Foam::operator>>
(
Istream& is,
WallInteractionSite<Type>& wIS
WallSiteData<Type>& wIS
)
{
is >> wIS.patchI_ >> wIS.wallData_;
@ -91,7 +91,7 @@ Foam::Istream& Foam::operator>>
is.check
(
"Foam::Istream& Foam::operator>>"
"(Foam::Istream&, Foam::WallInteractionSite<Type>&)"
"(Foam::Istream&, Foam::WallSiteData<Type>&)"
);
return is;
@ -102,7 +102,7 @@ template<class Type>
Foam::Ostream& Foam::operator<<
(
Ostream& os,
const WallInteractionSite<Type>& wIS
const WallSiteData<Type>& wIS
)
{
os << wIS.patchI_ << token::SPACE << wIS.wallData_;
@ -111,7 +111,7 @@ Foam::Ostream& Foam::operator<<
os.check
(
"Foam::Ostream& Foam::operator<<"
"(Ostream&, const WallInteractionSite<Type>&)"
"(Ostream&, const WallSiteData<Type>&)"
);
return os;

View File

@ -22,21 +22,21 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::WallInteractionSite
Foam::WallSiteData
Description
Stores the patch ID and templated data to represent a collision
with a wall to be passed to the wall model.
SourceFiles
WallInteractionSiteI.H
WallInteractionSite.C
WallInteractionSiteIO.C
WallSiteDataI.H
WallSiteData.C
WallSiteDataIO.C
\*---------------------------------------------------------------------------*/
#ifndef WallInteractionSite_H
#define WallInteractionSite_H
#ifndef WallSiteData_H
#define WallSiteData_H
#include "label.H"
@ -48,21 +48,21 @@ namespace Foam
// Forward declaration of friend functions and operators
template<class Type>
class WallInteractionSite;
class WallSiteData;
template<class Type>
Istream& operator>>(Istream&, WallInteractionSite<Type>&);
Istream& operator>>(Istream&, WallSiteData<Type>&);
template<class Type>
Ostream& operator<<(Ostream&, const WallInteractionSite<Type>&);
Ostream& operator<<(Ostream&, const WallSiteData<Type>&);
/*---------------------------------------------------------------------------*\
Class WallInteractionSite Declaration
Class WallSiteData Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class WallInteractionSite
class WallSiteData
{
// Private data
@ -78,10 +78,10 @@ public:
// Constructors
//- Construct null
WallInteractionSite();
WallSiteData();
//- Construct from components
WallInteractionSite
WallSiteData
(
label patchI,
const Type& wallData
@ -89,7 +89,7 @@ public:
//- Destructor
~WallInteractionSite();
~WallSiteData();
// Member Functions
@ -109,17 +109,17 @@ public:
// Member Operators
bool operator==(const WallInteractionSite<Type>&) const;
bool operator!=(const WallInteractionSite<Type>&) const;
bool operator==(const WallSiteData<Type>&) const;
bool operator!=(const WallSiteData<Type>&) const;
// IOstream Operators
friend Istream& operator>> <Type>
(Istream&, WallInteractionSite<Type>&);
(Istream&, WallSiteData<Type>&);
friend Ostream& operator<< <Type>
(Ostream&, const WallInteractionSite<Type>&);
(Ostream&, const WallSiteData<Type>&);
};
@ -129,12 +129,12 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "WallInteractionSiteI.H"
#include "WallSiteDataI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "WallInteractionSite.C"
# include "WallSiteData.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -28,28 +28,28 @@ License
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
Foam::label Foam::WallInteractionSite<Type>::patchIndex() const
Foam::label Foam::WallSiteData<Type>::patchIndex() const
{
return patchI_;
}
template<class Type>
Foam::label& Foam::WallInteractionSite<Type>::patchIndex()
Foam::label& Foam::WallSiteData<Type>::patchIndex()
{
return patchI_;
}
template<class Type>
const Type& Foam::WallInteractionSite<Type>::wallData() const
const Type& Foam::WallSiteData<Type>::wallData() const
{
return wallData_;
}
template<class Type>
Type& Foam::WallInteractionSite<Type>::wallData()
Type& Foam::WallSiteData<Type>::wallData()
{
return wallData_;
}