mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Updates to distribution models
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -94,4 +94,10 @@ Foam::scalar Foam::distributionModels::RosinRammler::maxValue() const
|
||||
}
|
||||
|
||||
|
||||
Foam::scalar Foam::distributionModels::RosinRammler::meanValue() const
|
||||
{
|
||||
return d_;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -108,6 +108,9 @@ public:
|
||||
|
||||
//- Return the maximum value
|
||||
virtual scalar maxValue() const;
|
||||
|
||||
//- Return the mean value
|
||||
virtual scalar meanValue() const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -91,4 +91,10 @@ Foam::scalar Foam::distributionModels::exponential::maxValue() const
|
||||
}
|
||||
|
||||
|
||||
Foam::scalar Foam::distributionModels::exponential::meanValue() const
|
||||
{
|
||||
return 1.0/lambda_;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -101,6 +101,9 @@ public:
|
||||
|
||||
//- Return the maximum value
|
||||
virtual scalar maxValue() const;
|
||||
|
||||
//- Return the mean value
|
||||
virtual scalar meanValue() const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -83,4 +83,10 @@ Foam::scalar Foam::distributionModels::fixedValue::fixedValue::maxValue() const
|
||||
}
|
||||
|
||||
|
||||
Foam::scalar Foam::distributionModels::fixedValue::fixedValue::meanValue() const
|
||||
{
|
||||
return value_;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -92,6 +92,9 @@ public:
|
||||
|
||||
//- Return the maximum value
|
||||
virtual scalar maxValue() const;
|
||||
|
||||
//- Return the mean value
|
||||
virtual scalar meanValue() const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -50,6 +50,7 @@ Foam::distributionModels::general::general
|
||||
nEntries_(xy_.size()),
|
||||
minValue_(xy_[0][0]),
|
||||
maxValue_(xy_[nEntries_-1][0]),
|
||||
meanValue_(0.0),
|
||||
integral_(nEntries_)
|
||||
{
|
||||
check();
|
||||
@ -69,10 +70,14 @@ Foam::distributionModels::general::general
|
||||
integral_[i] = area + integral_[i-1];
|
||||
}
|
||||
|
||||
scalar sumArea = integral_.last();
|
||||
|
||||
meanValue_ = sumArea/(maxValue_ - minValue_);
|
||||
|
||||
for (label i=0; i<nEntries_; i++)
|
||||
{
|
||||
xy_[i][1] /= integral_[nEntries_-1];
|
||||
integral_[i] /= integral_[nEntries_-1];
|
||||
xy_[i][1] /= sumArea;
|
||||
integral_[i] /= sumArea;
|
||||
}
|
||||
|
||||
}
|
||||
@ -153,4 +158,10 @@ Foam::scalar Foam::distributionModels::general::maxValue() const
|
||||
}
|
||||
|
||||
|
||||
Foam::scalar Foam::distributionModels::general::meanValue() const
|
||||
{
|
||||
return meanValue_;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -66,6 +66,8 @@ class general
|
||||
scalar minValue_;
|
||||
scalar maxValue_;
|
||||
|
||||
scalar meanValue_;
|
||||
|
||||
List<scalar> integral_;
|
||||
|
||||
|
||||
@ -104,6 +106,9 @@ public:
|
||||
|
||||
//- Return the maximum value
|
||||
virtual scalar maxValue() const;
|
||||
|
||||
//- Return the mean value
|
||||
virtual scalar meanValue() const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -145,4 +145,16 @@ Foam::scalar Foam::distributionModels::multiNormal::maxValue() const
|
||||
}
|
||||
|
||||
|
||||
Foam::scalar Foam::distributionModels::multiNormal::meanValue() const
|
||||
{
|
||||
scalar mean = 0.0;
|
||||
forAll(strength_, i)
|
||||
{
|
||||
mean += strength_[i]*expectation_[i];
|
||||
}
|
||||
|
||||
return mean;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -111,6 +111,9 @@ public:
|
||||
|
||||
//- Return the maximum value
|
||||
virtual scalar maxValue() const;
|
||||
|
||||
//- Return the mean value
|
||||
virtual scalar meanValue() const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -120,6 +120,12 @@ Foam::scalar Foam::distributionModels::normal::maxValue() const
|
||||
}
|
||||
|
||||
|
||||
Foam::scalar Foam::distributionModels::normal::meanValue() const
|
||||
{
|
||||
return expectation_;
|
||||
}
|
||||
|
||||
|
||||
Foam::scalar Foam::distributionModels::normal::erfInv(const scalar y) const
|
||||
{
|
||||
scalar k = 2.0/(constant::mathematical::pi*a_) + 0.5*log(1.0 - y*y);
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -112,6 +112,9 @@ public:
|
||||
//- Return the maximum value
|
||||
virtual scalar maxValue() const;
|
||||
|
||||
//- Return the mean value
|
||||
virtual scalar meanValue() const;
|
||||
|
||||
virtual scalar erfInv(const scalar y) const;
|
||||
};
|
||||
|
||||
|
||||
@ -87,4 +87,10 @@ Foam::scalar Foam::distributionModels::uniform::maxValue() const
|
||||
}
|
||||
|
||||
|
||||
Foam::scalar Foam::distributionModels::uniform::meanValue() const
|
||||
{
|
||||
return 0.5*(minValue_ + maxValue_);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -96,6 +96,9 @@ public:
|
||||
|
||||
//- Return the maximum value
|
||||
virtual scalar maxValue() const;
|
||||
|
||||
//- Return the mean value
|
||||
virtual scalar meanValue() const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user