mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' into cvm
This commit is contained in:
@ -57,6 +57,10 @@ Description
|
||||
|
||||
#include <netinet/in.h>
|
||||
|
||||
#ifdef USE_RANDOM
|
||||
# include <climits>
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(Foam::POSIX, 0);
|
||||
@ -68,16 +72,19 @@ pid_t Foam::pid()
|
||||
return ::getpid();
|
||||
}
|
||||
|
||||
|
||||
pid_t Foam::ppid()
|
||||
{
|
||||
return ::getppid();
|
||||
}
|
||||
|
||||
|
||||
pid_t Foam::pgid()
|
||||
{
|
||||
return ::getpgrp();
|
||||
}
|
||||
|
||||
|
||||
bool Foam::env(const word& envName)
|
||||
{
|
||||
return ::getenv(envName.c_str()) != NULL;
|
||||
@ -890,7 +897,6 @@ bool Foam::mvBak(const fileName& src, const std::string& ext)
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Remove a file, returning true if successful otherwise false
|
||||
bool Foam::rm(const fileName& file)
|
||||
{
|
||||
@ -1221,4 +1227,34 @@ Foam::fileNameList Foam::dlLoaded()
|
||||
}
|
||||
|
||||
|
||||
void Foam::osRandomSeed(const label seed)
|
||||
{
|
||||
#ifdef USE_RANDOM
|
||||
srandom((unsigned int)seed);
|
||||
#else
|
||||
srand48(seed);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
Foam::label Foam::osRandomInteger()
|
||||
{
|
||||
#ifdef USE_RANDOM
|
||||
return random();
|
||||
#else
|
||||
return lrand48();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
Foam::scalar Foam::osRandomDouble()
|
||||
{
|
||||
#ifdef USE_RANDOM
|
||||
return (scalar)random();
|
||||
#else
|
||||
return drand48();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -200,6 +200,18 @@ bool dlSymFound(void* handle, const std::string& symbol);
|
||||
fileNameList dlLoaded();
|
||||
|
||||
|
||||
// Low level random numbers. Use Random class instead.
|
||||
|
||||
//- Seed random number generator.
|
||||
void osRandomSeed(const label seed);
|
||||
|
||||
//- Return random integer (uniform distribution between 0 and 2^31)
|
||||
label osRandomInteger();
|
||||
|
||||
//- Return random double precision (uniform distribution between 0 and 1)
|
||||
scalar osRandomDouble();
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -24,6 +24,7 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "Random.H"
|
||||
#include "OSspecific.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -37,11 +38,6 @@ namespace Foam
|
||||
# error "The random number generator may not work!"
|
||||
#endif
|
||||
|
||||
#ifdef USE_RANDOM
|
||||
# include <climits>
|
||||
#else
|
||||
# include <cstdlib>
|
||||
#endif
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
@ -57,22 +53,13 @@ Random::Random(const label seed)
|
||||
Seed = 1;
|
||||
}
|
||||
|
||||
# ifdef USE_RANDOM
|
||||
srandom((unsigned int)Seed);
|
||||
# else
|
||||
srand48(Seed);
|
||||
# endif
|
||||
|
||||
osRandomSeed(Seed);
|
||||
}
|
||||
|
||||
|
||||
int Random::bit()
|
||||
{
|
||||
# ifdef USE_RANDOM
|
||||
if (random() > INT_MAX/2)
|
||||
# else
|
||||
if (lrand48() > INT_MAX/2)
|
||||
# endif
|
||||
if (osRandomInteger() > INT_MAX/2)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
@ -85,11 +72,7 @@ int Random::bit()
|
||||
|
||||
scalar Random::scalar01()
|
||||
{
|
||||
# ifdef USE_RANDOM
|
||||
return (scalar)random()/INT_MAX;
|
||||
# else
|
||||
return drand48();
|
||||
# endif
|
||||
return osRandomDouble();
|
||||
}
|
||||
|
||||
|
||||
@ -140,11 +123,7 @@ tensor Random::tensor01()
|
||||
|
||||
label Random::integer(const label lower, const label upper)
|
||||
{
|
||||
# ifdef USE_RANDOM
|
||||
return lower + (random() % (upper+1-lower));
|
||||
# else
|
||||
return lower + (lrand48() % (upper+1-lower));
|
||||
# endif
|
||||
return lower + (osRandomInteger() % (upper+1-lower));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -24,7 +24,7 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "cachedRandom.H"
|
||||
#include <cstdlib>
|
||||
#include "OSspecific.H"
|
||||
|
||||
#if INT_MAX != 2147483647
|
||||
# error "INT_MAX != 2147483647"
|
||||
@ -37,7 +37,7 @@ Foam::scalar Foam::cachedRandom::scalar01()
|
||||
{
|
||||
if (sampleI_ < 0)
|
||||
{
|
||||
return drand48();
|
||||
return osRandomDouble();
|
||||
}
|
||||
|
||||
if (sampleI_ == samples_.size() - 1)
|
||||
@ -76,7 +76,7 @@ Foam::cachedRandom::cachedRandom(const label seed, const label count)
|
||||
}
|
||||
|
||||
// Initialise samples
|
||||
srand48(seed_);
|
||||
osRandomSeed(seed_);
|
||||
forAll(samples_, i)
|
||||
{
|
||||
samples_[i] = drand48();
|
||||
@ -98,7 +98,7 @@ Foam::cachedRandom::cachedRandom(const cachedRandom& cr, const bool reset)
|
||||
) << "Copy constructor called, but samples not being cached. "
|
||||
<< "This may lead to non-repeatable behaviour" << endl;
|
||||
|
||||
srand48(seed_);
|
||||
osRandomSeed(seed_);
|
||||
}
|
||||
else if (reset)
|
||||
{
|
||||
|
||||
@ -59,10 +59,7 @@ Foam::fanPressureFvPatchScalarField::fanPressureFvPatchScalarField
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(p, iF),
|
||||
phiName_("phi"),
|
||||
rhoName_("rho"),
|
||||
p0_(p.size(), 0.0),
|
||||
totalPressureFvPatchScalarField(p, iF),
|
||||
fanCurve_(),
|
||||
direction_(ffdOut)
|
||||
{}
|
||||
@ -76,10 +73,7 @@ Foam::fanPressureFvPatchScalarField::fanPressureFvPatchScalarField
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(ptf, p, iF, mapper),
|
||||
phiName_(ptf.phiName_),
|
||||
rhoName_(ptf.rhoName_),
|
||||
p0_(ptf.p0_, mapper),
|
||||
totalPressureFvPatchScalarField(ptf, p, iF, mapper),
|
||||
fanCurve_(ptf.fanCurve_),
|
||||
direction_(ptf.direction_)
|
||||
{}
|
||||
@ -92,10 +86,7 @@ Foam::fanPressureFvPatchScalarField::fanPressureFvPatchScalarField
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(p, iF),
|
||||
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
|
||||
rhoName_(dict.lookupOrDefault<word>("rho", "rho")),
|
||||
p0_("p0", dict, p.size()),
|
||||
totalPressureFvPatchScalarField(p, iF),
|
||||
fanCurve_(dict),
|
||||
direction_(fanFlowDirectionNames_.read(dict.lookup("direction")))
|
||||
{
|
||||
@ -109,10 +100,7 @@ Foam::fanPressureFvPatchScalarField::fanPressureFvPatchScalarField
|
||||
const fanPressureFvPatchScalarField& pfopsf
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(pfopsf),
|
||||
phiName_(pfopsf.phiName_),
|
||||
rhoName_(pfopsf.rhoName_),
|
||||
p0_(pfopsf.p0_),
|
||||
totalPressureFvPatchScalarField(pfopsf),
|
||||
fanCurve_(pfopsf.fanCurve_),
|
||||
direction_(pfopsf.direction_)
|
||||
{}
|
||||
@ -124,10 +112,7 @@ Foam::fanPressureFvPatchScalarField::fanPressureFvPatchScalarField
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(pfopsf, iF),
|
||||
phiName_(pfopsf.phiName_),
|
||||
rhoName_(pfopsf.rhoName_),
|
||||
p0_(pfopsf.p0_),
|
||||
totalPressureFvPatchScalarField(pfopsf, iF),
|
||||
fanCurve_(pfopsf.fanCurve_),
|
||||
direction_(pfopsf.direction_)
|
||||
{}
|
||||
@ -144,7 +129,7 @@ void Foam::fanPressureFvPatchScalarField::updateCoeffs()
|
||||
|
||||
// Retrieve flux field
|
||||
const surfaceScalarField& phi =
|
||||
db().lookupObject<surfaceScalarField>(phiName_);
|
||||
db().lookupObject<surfaceScalarField>(phiName());
|
||||
|
||||
const fvsPatchField<scalar>& phip =
|
||||
patch().patchField<surfaceScalarField, scalar>(phi);
|
||||
@ -161,7 +146,7 @@ void Foam::fanPressureFvPatchScalarField::updateCoeffs()
|
||||
else if (phi.dimensions() == dimVelocity*dimArea*dimDensity)
|
||||
{
|
||||
const scalarField& rhop =
|
||||
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
|
||||
patch().lookupPatchField<volScalarField, scalar>(rhoName());
|
||||
aveFlowRate = dir*gSum(phip/rhop)/gSum(patch().magSf());
|
||||
}
|
||||
else
|
||||
@ -174,51 +159,23 @@ void Foam::fanPressureFvPatchScalarField::updateCoeffs()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
// Normal flow through fan
|
||||
if (aveFlowRate >= 0.0)
|
||||
{
|
||||
// Pressure drop for this flow rate
|
||||
const scalar pdFan = fanCurve_(aveFlowRate);
|
||||
// Pressure drop for this flow rate
|
||||
const scalar pdFan = fanCurve_(max(aveFlowRate, 0.0));
|
||||
|
||||
operator==(p0_ - dir*pdFan);
|
||||
}
|
||||
// Reverse flow
|
||||
else
|
||||
{
|
||||
// Assume that fan has stalled if flow reversed
|
||||
// i.e. apply dp for zero flow rate
|
||||
const scalar pdFan = fanCurve_(0);
|
||||
|
||||
// Flow speed across patch
|
||||
scalarField Up = phip/(patch().magSf());
|
||||
|
||||
// Pressure drop associated withback flow = dynamic pressure
|
||||
scalarField pdBackFlow = 0.5*magSqr(Up);
|
||||
|
||||
if (phi.dimensions() == dimVelocity*dimArea*dimDensity)
|
||||
{
|
||||
const scalarField& rhop =
|
||||
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
|
||||
pdBackFlow /= rhop;
|
||||
}
|
||||
|
||||
operator==(p0_ - dir*(pdBackFlow + pdFan));
|
||||
}
|
||||
|
||||
fixedValueFvPatchScalarField::updateCoeffs();
|
||||
totalPressureFvPatchScalarField::updateCoeffs
|
||||
(
|
||||
p0() - dir*pdFan,
|
||||
patch().lookupPatchField<volVectorField, vector>(UName())
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
void Foam::fanPressureFvPatchScalarField::write(Ostream& os) const
|
||||
{
|
||||
fvPatchScalarField::write(os);
|
||||
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl;
|
||||
totalPressureFvPatchScalarField::write(os);
|
||||
fanCurve_.write(os);
|
||||
os.writeKeyword("direction")
|
||||
<< fanFlowDirectionNames_[direction_] << token::END_STATEMENT << nl;
|
||||
p0_.writeEntry("p0", os);
|
||||
writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -25,7 +25,7 @@ Class
|
||||
Foam::fanPressureFvPatchScalarField
|
||||
|
||||
Description
|
||||
Assigns pressure inlet or outlet condition for a fan.
|
||||
Assigns pressure inlet or outlet total pressure condition for a fan.
|
||||
|
||||
User specifies:
|
||||
- pressure drop vs volumetric flow rate table (fan curve) file name;
|
||||
@ -56,8 +56,8 @@ Description
|
||||
\endverbatim
|
||||
|
||||
See Also
|
||||
Foam::interpolationTable and
|
||||
Foam::timeVaryingFlowRateInletVelocityFvPatchVectorField
|
||||
Foam::totalPressureFvPatchScalarField and
|
||||
Foam::interpolationTable
|
||||
|
||||
SourceFiles
|
||||
fanPressureFvPatchScalarField.C
|
||||
@ -67,8 +67,7 @@ SourceFiles
|
||||
#ifndef fanPressureFvPatchScalarField_H
|
||||
#define fanPressureFvPatchScalarField_H
|
||||
|
||||
#include "fvPatchFields.H"
|
||||
#include "fixedValueFvPatchFields.H"
|
||||
#include "totalPressureFvPatchScalarField.H"
|
||||
#include "interpolationTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -82,19 +81,10 @@ namespace Foam
|
||||
|
||||
class fanPressureFvPatchScalarField
|
||||
:
|
||||
public fixedValueFvPatchScalarField
|
||||
public totalPressureFvPatchScalarField
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Name of the flux transporting the field
|
||||
word phiName_;
|
||||
|
||||
//- Name of the density field
|
||||
word rhoName_;
|
||||
|
||||
//- Total pressure
|
||||
scalarField p0_;
|
||||
|
||||
//- Tabulated fan curve
|
||||
interpolationTable<scalar> fanCurve_;
|
||||
|
||||
|
||||
@ -112,7 +112,7 @@ void Foam::rotatingTotalPressureFvPatchScalarField::updateCoeffs()
|
||||
+ rotationVelocity
|
||||
);
|
||||
|
||||
totalPressureFvPatchScalarField::updateCoeffs(Up);
|
||||
totalPressureFvPatchScalarField::updateCoeffs(p0(), Up);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
||||
@ -153,7 +153,11 @@ void Foam::totalPressureFvPatchScalarField::rmap
|
||||
}
|
||||
|
||||
|
||||
void Foam::totalPressureFvPatchScalarField::updateCoeffs(const vectorField& Up)
|
||||
void Foam::totalPressureFvPatchScalarField::updateCoeffs
|
||||
(
|
||||
const scalarField& p0p,
|
||||
const vectorField& Up
|
||||
)
|
||||
{
|
||||
if (updated())
|
||||
{
|
||||
@ -165,7 +169,7 @@ void Foam::totalPressureFvPatchScalarField::updateCoeffs(const vectorField& Up)
|
||||
|
||||
if (psiName_ == "none" && rhoName_ == "none")
|
||||
{
|
||||
operator==(p0_ - 0.5*(1.0 - pos(phip))*magSqr(Up));
|
||||
operator==(p0p - 0.5*(1.0 - pos(phip))*magSqr(Up));
|
||||
}
|
||||
else if (rhoName_ == "none")
|
||||
{
|
||||
@ -178,7 +182,7 @@ void Foam::totalPressureFvPatchScalarField::updateCoeffs(const vectorField& Up)
|
||||
|
||||
operator==
|
||||
(
|
||||
p0_
|
||||
p0p
|
||||
/pow
|
||||
(
|
||||
(1.0 + 0.5*psip*gM1ByG*(1.0 - pos(phip))*magSqr(Up)),
|
||||
@ -188,7 +192,7 @@ void Foam::totalPressureFvPatchScalarField::updateCoeffs(const vectorField& Up)
|
||||
}
|
||||
else
|
||||
{
|
||||
operator==(p0_/(1.0 + 0.5*psip*(1.0 - pos(phip))*magSqr(Up)));
|
||||
operator==(p0p/(1.0 + 0.5*psip*(1.0 - pos(phip))*magSqr(Up)));
|
||||
}
|
||||
}
|
||||
else if (psiName_ == "none")
|
||||
@ -196,7 +200,7 @@ void Foam::totalPressureFvPatchScalarField::updateCoeffs(const vectorField& Up)
|
||||
const fvPatchField<scalar>& rho =
|
||||
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
|
||||
|
||||
operator==(p0_ - 0.5*rho*(1.0 - pos(phip))*magSqr(Up));
|
||||
operator==(p0p - 0.5*rho*(1.0 - pos(phip))*magSqr(Up));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -220,7 +224,11 @@ void Foam::totalPressureFvPatchScalarField::updateCoeffs(const vectorField& Up)
|
||||
|
||||
void Foam::totalPressureFvPatchScalarField::updateCoeffs()
|
||||
{
|
||||
updateCoeffs(patch().lookupPatchField<volVectorField, vector>(UName_));
|
||||
updateCoeffs
|
||||
(
|
||||
p0(),
|
||||
patch().lookupPatchField<volVectorField, vector>(UName())
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -157,6 +157,45 @@ public:
|
||||
return UName_;
|
||||
}
|
||||
|
||||
//- Return the name of the flux field
|
||||
const word& phiName() const
|
||||
{
|
||||
return phiName_;
|
||||
}
|
||||
|
||||
//- Return reference to the name of the flux field
|
||||
// to allow adjustment
|
||||
word& phiName()
|
||||
{
|
||||
return phiName_;
|
||||
}
|
||||
|
||||
//- Return the name of the density field
|
||||
const word& rhoName() const
|
||||
{
|
||||
return rhoName_;
|
||||
}
|
||||
|
||||
//- Return reference to the name of the density field
|
||||
// to allow adjustment
|
||||
word& rhoName()
|
||||
{
|
||||
return rhoName_;
|
||||
}
|
||||
|
||||
//- Return the name of the compressibility field
|
||||
const word& psiName() const
|
||||
{
|
||||
return psiName_;
|
||||
}
|
||||
|
||||
//- Return reference to the name of the compressibility field
|
||||
// to allow adjustment
|
||||
word& psiName()
|
||||
{
|
||||
return psiName_;
|
||||
}
|
||||
|
||||
//- Return the heat capacity ratio
|
||||
scalar gamma() const
|
||||
{
|
||||
@ -201,8 +240,12 @@ public:
|
||||
// Evaluation functions
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
// using the given patch velocity field
|
||||
virtual void updateCoeffs(const vectorField& Up);
|
||||
// using the given patch total pressure and velocity fields
|
||||
virtual void updateCoeffs
|
||||
(
|
||||
const scalarField& p0p,
|
||||
const vectorField& Up
|
||||
);
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
virtual void updateCoeffs();
|
||||
|
||||
@ -214,7 +214,8 @@ void Foam::PairSpringSliderDashpot<CloudType>::evaluatePair
|
||||
rHat_AB
|
||||
*(kN*pow(normalOverlapMag, b_) - etaN*(U_AB & rHat_AB));
|
||||
|
||||
// Cohesion force
|
||||
// Cohesion force, energy density multiplied by the area of
|
||||
// particle-particle overlap
|
||||
if (cohesion_)
|
||||
{
|
||||
fN_AB +=
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -76,7 +76,8 @@ void Foam::WallLocalSpringSliderDashpot<CloudType>::evaluateWall
|
||||
typename CloudType::parcelType& p,
|
||||
const point& site,
|
||||
const WallSiteData<vector>& data,
|
||||
scalar pREff
|
||||
scalar pREff,
|
||||
bool cohesion
|
||||
) const
|
||||
{
|
||||
// wall patch index
|
||||
@ -88,14 +89,18 @@ void Foam::WallLocalSpringSliderDashpot<CloudType>::evaluateWall
|
||||
scalar alpha = alpha_[wPI];
|
||||
scalar b = b_[wPI];
|
||||
scalar mu = mu_[wPI];
|
||||
scalar cohesionEnergyDensity = cohesionEnergyDensity_[wPI];
|
||||
cohesion = cohesion && cohesion_[wPI];
|
||||
|
||||
vector r_PW = p.position() - site;
|
||||
|
||||
vector U_PW = p.U() - data.wallData();
|
||||
|
||||
scalar normalOverlapMag = max(pREff - mag(r_PW), 0.0);
|
||||
scalar r_PW_mag = mag(r_PW);
|
||||
|
||||
vector rHat_PW = r_PW/(mag(r_PW) + VSMALL);
|
||||
scalar normalOverlapMag = max(pREff - r_PW_mag, 0.0);
|
||||
|
||||
vector rHat_PW = r_PW/(r_PW_mag + VSMALL);
|
||||
|
||||
scalar kN = (4.0/3.0)*sqrt(pREff)*Estar;
|
||||
|
||||
@ -105,6 +110,16 @@ void Foam::WallLocalSpringSliderDashpot<CloudType>::evaluateWall
|
||||
rHat_PW
|
||||
*(kN*pow(normalOverlapMag, b) - etaN*(U_PW & rHat_PW));
|
||||
|
||||
// Cohesion force, energy density multiplied by the area of wall/particle
|
||||
// overlap
|
||||
if (cohesion)
|
||||
{
|
||||
fN_PW +=
|
||||
-cohesionEnergyDensity
|
||||
*mathematical::pi*(sqr(pREff) - sqr(r_PW_mag))
|
||||
*rHat_PW;
|
||||
}
|
||||
|
||||
p.f() += fN_PW;
|
||||
|
||||
vector USlip_PW =
|
||||
@ -168,6 +183,8 @@ Foam::WallLocalSpringSliderDashpot<CloudType>::WallLocalSpringSliderDashpot
|
||||
alpha_(),
|
||||
b_(),
|
||||
mu_(),
|
||||
cohesionEnergyDensity_(),
|
||||
cohesion_(),
|
||||
patchMap_(),
|
||||
maxEstarIndex_(-1),
|
||||
collisionResolutionSteps_
|
||||
@ -212,6 +229,8 @@ Foam::WallLocalSpringSliderDashpot<CloudType>::WallLocalSpringSliderDashpot
|
||||
alpha_.setSize(nWallPatches);
|
||||
b_.setSize(nWallPatches);
|
||||
mu_.setSize(nWallPatches);
|
||||
cohesionEnergyDensity_.setSize(nWallPatches);
|
||||
cohesion_.setSize(nWallPatches);
|
||||
|
||||
scalar maxEstar = -GREAT;
|
||||
|
||||
@ -238,6 +257,13 @@ Foam::WallLocalSpringSliderDashpot<CloudType>::WallLocalSpringSliderDashpot
|
||||
|
||||
mu_[wPI] = readScalar(patchCoeffDict.lookup("mu"));
|
||||
|
||||
cohesionEnergyDensity_[wPI] = readScalar
|
||||
(
|
||||
patchCoeffDict.lookup("cohesionEnergyDensity")
|
||||
);
|
||||
|
||||
cohesion_[wPI] = (mag(cohesionEnergyDensity_[wPI]) > VSMALL);
|
||||
|
||||
if (Estar_[wPI] > maxEstar)
|
||||
{
|
||||
maxEstarIndex_ = wPI;
|
||||
@ -325,20 +351,22 @@ void Foam::WallLocalSpringSliderDashpot<CloudType>::evaluateWall
|
||||
p,
|
||||
flatSitePoints[siteI],
|
||||
flatSiteData[siteI],
|
||||
pREff
|
||||
pREff,
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
forAll(sharpSitePoints, siteI)
|
||||
{
|
||||
// Treating sharp sites like flat sites
|
||||
// Treating sharp sites like flat sites, except suppress cohesion
|
||||
|
||||
evaluateWall
|
||||
(
|
||||
p,
|
||||
sharpSitePoints[siteI],
|
||||
sharpSiteData[siteI],
|
||||
pREff
|
||||
pREff,
|
||||
false
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -65,6 +65,12 @@ class WallLocalSpringSliderDashpot
|
||||
//- Coefficient of friction in for tangential sliding
|
||||
scalarList mu_;
|
||||
|
||||
//- Cohesion energy density [J/m^3]
|
||||
scalarList cohesionEnergyDensity_;
|
||||
|
||||
// Switch cohesion on and off
|
||||
boolList cohesion_;
|
||||
|
||||
//- Mapping the patch index to the model data
|
||||
labelList patchMap_;
|
||||
|
||||
@ -115,7 +121,8 @@ class WallLocalSpringSliderDashpot
|
||||
typename CloudType::parcelType& p,
|
||||
const point& site,
|
||||
const WallSiteData<vector>& data,
|
||||
scalar pREff
|
||||
scalar pREff,
|
||||
bool cohesion
|
||||
) const;
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -77,16 +77,19 @@ void Foam::WallSpringSliderDashpot<CloudType>::evaluateWall
|
||||
const point& site,
|
||||
const WallSiteData<vector>& data,
|
||||
scalar pREff,
|
||||
scalar kN
|
||||
scalar kN,
|
||||
bool cohesion
|
||||
) const
|
||||
{
|
||||
vector r_PW = p.position() - site;
|
||||
|
||||
vector U_PW = p.U() - data.wallData();
|
||||
|
||||
scalar normalOverlapMag = max(pREff - mag(r_PW), 0.0);
|
||||
scalar r_PW_mag = mag(r_PW);
|
||||
|
||||
vector rHat_PW = r_PW/(mag(r_PW) + VSMALL);
|
||||
scalar normalOverlapMag = max(pREff - r_PW_mag, 0.0);
|
||||
|
||||
vector rHat_PW = r_PW/(r_PW_mag + VSMALL);
|
||||
|
||||
scalar etaN = alpha_*sqrt(p.mass()*kN)*pow025(normalOverlapMag);
|
||||
|
||||
@ -94,6 +97,16 @@ void Foam::WallSpringSliderDashpot<CloudType>::evaluateWall
|
||||
rHat_PW
|
||||
*(kN*pow(normalOverlapMag, b_) - etaN*(U_PW & rHat_PW));
|
||||
|
||||
// Cohesion force, energy density multiplied by the area of wall/particle
|
||||
// overlap
|
||||
if (cohesion)
|
||||
{
|
||||
fN_PW +=
|
||||
-cohesionEnergyDensity_
|
||||
*mathematical::pi*(sqr(pREff) - sqr(r_PW_mag))
|
||||
*rHat_PW;
|
||||
}
|
||||
|
||||
p.f() += fN_PW;
|
||||
|
||||
vector USlip_PW =
|
||||
@ -157,6 +170,11 @@ Foam::WallSpringSliderDashpot<CloudType>::WallSpringSliderDashpot
|
||||
alpha_(readScalar(this->coeffDict().lookup("alpha"))),
|
||||
b_(readScalar(this->coeffDict().lookup("b"))),
|
||||
mu_(readScalar(this->coeffDict().lookup("mu"))),
|
||||
cohesionEnergyDensity_
|
||||
(
|
||||
readScalar(this->coeffDict().lookup("cohesionEnergyDensity"))
|
||||
),
|
||||
cohesion_(false),
|
||||
collisionResolutionSteps_
|
||||
(
|
||||
readScalar
|
||||
@ -183,6 +201,8 @@ Foam::WallSpringSliderDashpot<CloudType>::WallSpringSliderDashpot
|
||||
Estar_ = 1/((1 - sqr(pNu))/pE + (1 - sqr(nu))/E);
|
||||
|
||||
Gstar_ = 1/(2*((2 + pNu - sqr(pNu))/pE + (2 + nu - sqr(nu))/E));
|
||||
|
||||
cohesion_ = (mag(cohesionEnergyDensity_) > VSMALL);
|
||||
}
|
||||
|
||||
|
||||
@ -266,13 +286,14 @@ void Foam::WallSpringSliderDashpot<CloudType>::evaluateWall
|
||||
flatSitePoints[siteI],
|
||||
flatSiteData[siteI],
|
||||
pREff,
|
||||
kN
|
||||
kN,
|
||||
cohesion_
|
||||
);
|
||||
}
|
||||
|
||||
forAll(sharpSitePoints, siteI)
|
||||
{
|
||||
// Treating sharp sites like flat sites
|
||||
// Treating sharp sites like flat sites, except suppress cohesion
|
||||
|
||||
evaluateWall
|
||||
(
|
||||
@ -280,7 +301,8 @@ void Foam::WallSpringSliderDashpot<CloudType>::evaluateWall
|
||||
sharpSitePoints[siteI],
|
||||
sharpSiteData[siteI],
|
||||
pREff,
|
||||
kN
|
||||
kN,
|
||||
false
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -65,6 +65,12 @@ class WallSpringSliderDashpot
|
||||
//- Coefficient of friction in for tangential sliding
|
||||
scalar mu_;
|
||||
|
||||
//- Cohesion energy density [J/m^3]
|
||||
scalar cohesionEnergyDensity_;
|
||||
|
||||
// Switch cohesion on and off
|
||||
bool cohesion_;
|
||||
|
||||
//- The number of steps over which to resolve the minimum
|
||||
// harmonic approximation of the collision period
|
||||
scalar collisionResolutionSteps_;
|
||||
@ -110,7 +116,8 @@ class WallSpringSliderDashpot
|
||||
const point& site,
|
||||
const WallSiteData<vector>& data,
|
||||
scalar pREff,
|
||||
scalar kN
|
||||
scalar kN,
|
||||
bool cohesion
|
||||
) const;
|
||||
|
||||
|
||||
|
||||
@ -27,6 +27,7 @@ License
|
||||
#include "dictionary.H"
|
||||
#include "Time.H"
|
||||
#include "IOobjectList.H"
|
||||
#include "polyMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -123,14 +124,26 @@ void Foam::partialWrite::write()
|
||||
else
|
||||
{
|
||||
// Delete all but marked objects
|
||||
fileName dbDir;
|
||||
if (isA<polyMesh>(obr_))
|
||||
{
|
||||
dbDir = dynamic_cast<const polyMesh&>(obr_).dbDir();
|
||||
}
|
||||
|
||||
IOobjectList objects(obr_, obr_.time().timeName());
|
||||
|
||||
forAllConstIter(HashPtrTable<IOobject>, objects, iter)
|
||||
{
|
||||
if (!objectNames_.found(iter()->name()))
|
||||
{
|
||||
const fileName f = obr_.time().timePath()/iter()->name();
|
||||
//Pout<< " rm " << f << endl;
|
||||
const fileName f =
|
||||
obr_.time().timePath()
|
||||
/dbDir
|
||||
/iter()->name();
|
||||
if (debug)
|
||||
{
|
||||
Pout<< " rm " << f << endl;
|
||||
}
|
||||
rm(f);
|
||||
}
|
||||
}
|
||||
|
||||
@ -32,4 +32,8 @@ decomposePar -region panelRegion > log.decomposParPanelRegion.log 2>&1
|
||||
|
||||
runParallel `getApplication` 6
|
||||
|
||||
paraFoam -touch
|
||||
paraFoam -touch -region panelRegion
|
||||
|
||||
|
||||
# ----------------------------------------------------------------- end-of-file
|
||||
|
||||
@ -112,6 +112,7 @@ subModels
|
||||
alpha 0.12;
|
||||
b 1.5;
|
||||
mu 0.43;
|
||||
cohesionEnergyDensity 0;
|
||||
}
|
||||
frontAndBack
|
||||
{
|
||||
@ -120,6 +121,7 @@ subModels
|
||||
alpha 0.12;
|
||||
b 1.5;
|
||||
mu 0.1;
|
||||
cohesionEnergyDensity 0;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@ -121,6 +121,7 @@ subModels
|
||||
alpha 0.12;
|
||||
b 1.5;
|
||||
mu 0.43;
|
||||
cohesionEnergyDensity 0;
|
||||
}
|
||||
frontAndBack
|
||||
{
|
||||
@ -129,6 +130,7 @@ subModels
|
||||
alpha 0.12;
|
||||
b 1.5;
|
||||
mu 0.1;
|
||||
cohesionEnergyDensity 0;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@ -8,3 +8,6 @@ runApplication setSet -batch wallFilmRegion.setSet
|
||||
mv log.setSet log.wallFilmRegion.setSet
|
||||
|
||||
runApplication extrudeToRegionMesh -overwrite
|
||||
|
||||
paraFoam -touch
|
||||
paraFoam -touch -region wallFilmRegion
|
||||
|
||||
@ -32,3 +32,6 @@ cp -r system/wallFilmRegion.org system/wallFilmRegion
|
||||
|
||||
find ./0 -maxdepth 1 -type f -exec \
|
||||
sed -i "s/wallFilm/\"(region0_to.*)\"/g" {} \;
|
||||
|
||||
paraFoam -touch
|
||||
paraFoam -touch -region wallFilmRegion
|
||||
|
||||
@ -10,3 +10,5 @@ mv log.setSet log.wallFilmRegion.setSet
|
||||
|
||||
runApplication extrudeToRegionMesh -overwrite
|
||||
|
||||
paraFoam -touch
|
||||
paraFoam -touch -region wallFilmRegion
|
||||
|
||||
@ -14,3 +14,6 @@ runApplication setSet -region wallFilmRegion -batch createWallFilmRegionPatches.
|
||||
mv log.setSet log.createWallFilmRegionPatches.setSet
|
||||
|
||||
runApplication createPatch -region wallFilmRegion -overwrite
|
||||
|
||||
paraFoam -touch
|
||||
paraFoam -touch -region wallFilmRegion
|
||||
|
||||
Reference in New Issue
Block a user