mirror of
https://github.com/ParticulateFlow/CFDEMcoupling-PFM.git
synced 2025-12-08 06:37:44 +00:00
Fixed possible problem for MarkovPath by introducing correlation steps.
This commit is contained in:
@ -56,7 +56,9 @@ MarkovPath::MarkovPath
|
||||
:
|
||||
recPath(dict, base),
|
||||
propsDict_(dict.subDict(typeName + "Props")),
|
||||
correlationSteps_(readLabel(propsDict_.lookup("correlationSteps"))),
|
||||
meanIntervalSteps_(propsDict_.lookupOrDefault<label>("meanIntervalSteps",-1)),
|
||||
minIntervalSteps_(propsDict_.lookupOrDefault<label>("minIntervalSteps",0)),
|
||||
numIntervals_(base.recM().numIntervals()),
|
||||
recSteps_(0),
|
||||
intervalSizes_(numIntervals_),
|
||||
@ -89,6 +91,16 @@ MarkovPath::MarkovPath
|
||||
}
|
||||
intervalSizesCumulative_[i] = sum1;
|
||||
}
|
||||
|
||||
// check if meanIntervalSteps and correlationSteps are reasonable
|
||||
label critLength = meanIntervalSteps_ + 2 * correlationSteps_;
|
||||
for(int i=0;i<numIntervals_;i++)
|
||||
{
|
||||
if (critLength >= intervalSizes_[i])
|
||||
{
|
||||
FatalError <<"too big mean interval size and correlation time for database " << i << "\n" << abort(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
// given a jump probability of P, the probability of finding a chain of length N is
|
||||
// P(N) = (1 - P)^N * P, and the mean length E(N) = (1 - P) / P
|
||||
@ -166,7 +178,7 @@ void MarkovPath::extendPath()
|
||||
scalar nextMinimum(GREAT);
|
||||
for (label j = startLoop; j <= endLoop; j++)
|
||||
{
|
||||
if(abs(j - virtualTimeIndex) < meanIntervalSteps_) continue;
|
||||
if(abs(j - virtualTimeIndex) < correlationSteps_) continue;
|
||||
if (recurrenceMatrix[j][virtualTimeIndex] < nextMinimum)
|
||||
{
|
||||
nextMinimum = recurrenceMatrix[j][virtualTimeIndex];
|
||||
@ -183,15 +195,15 @@ void MarkovPath::extendPath()
|
||||
{
|
||||
virtualTimeIndex++;
|
||||
|
||||
// interval border?
|
||||
// take another step according to jump probability? only if minIntervalSteps taken
|
||||
scalar randJump = ranGen.scalar01();
|
||||
if (randJump < Pjump_ && virtualTimeIndex - seqStart >= minIntervalSteps_) takeAnotherStep=false;
|
||||
|
||||
// interval border? must jump
|
||||
for(int i = 0;i < numIntervals_; i++)
|
||||
{
|
||||
if (intervalSizesCumulative_[i] - 1 == virtualTimeIndex) takeAnotherStep=false;
|
||||
}
|
||||
|
||||
// take another step according to jump probability?
|
||||
scalar randJump = ranGen.scalar01();
|
||||
if (randJump < Pjump_) takeAnotherStep=false;
|
||||
}
|
||||
|
||||
seqEnd = virtualTimeIndex;
|
||||
|
||||
@ -58,8 +58,13 @@ protected:
|
||||
void weightsCumulation();
|
||||
|
||||
void weightsNormalization();
|
||||
|
||||
// correlation steps determine which temporal neighborhood is excluded from nearest-neighbor search
|
||||
label correlationSteps_;
|
||||
|
||||
label meanIntervalSteps_;
|
||||
|
||||
label minIntervalSteps_;
|
||||
|
||||
label numIntervals_;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user