From e3a521ced44c583e07512e5ec3528ea9da460bcf Mon Sep 17 00:00:00 2001 From: Thomas Lichtenegger Date: Tue, 13 Mar 2018 11:12:22 +0100 Subject: [PATCH] New path model MarkovPath is going to replace multiIntervalPath. Allows for multiple databases, extension of path and adaption of weights during runtime. --- src/recurrence/Make/files | 1 + src/recurrence/recBase/recBase.C | 6 + src/recurrence/recBase/recBase.H | 2 + .../recPath/MarkovPath/MarkovPath.C | 274 ++++++++++++++++++ .../recPath/MarkovPath/MarkovPath.H | 114 ++++++++ src/recurrence/recPath/recPath/recPath.H | 4 +- 6 files changed, 400 insertions(+), 1 deletion(-) create mode 100644 src/recurrence/recPath/MarkovPath/MarkovPath.C create mode 100644 src/recurrence/recPath/MarkovPath/MarkovPath.H diff --git a/src/recurrence/Make/files b/src/recurrence/Make/files index cacbc10d..7ad4a818 100644 --- a/src/recurrence/Make/files +++ b/src/recurrence/Make/files @@ -10,6 +10,7 @@ recPath/recPath/recPath.C recPath/recPath/newRecPath.C recPath/simpleRandomPath/simpleRandomPath.C recPath/noPath/noPath.C +recPath/MarkovPath/MarkovPath.C recPath/multiIntervalPath/multiIntervalPath.C recStatAnalysis/recStatAnalysis/recStatAnalysis.C recStatAnalysis/recStatAnalysis/newRecStatAnalysis.C diff --git a/src/recurrence/recBase/recBase.C b/src/recurrence/recBase/recBase.C index ad9c593d..91b48f4b 100644 --- a/src/recurrence/recBase/recBase.C +++ b/src/recurrence/recBase/recBase.C @@ -114,6 +114,12 @@ recStatAnalysis& recBase::recStatA() return recStatAnalysis_(); } +void recBase::extendPath() +{ + recPath_ -> getRecPath(); + recModel_ -> writeRecPath(); +} + void recBase::updateRecFields() { recModel_->updateRecFields(); diff --git a/src/recurrence/recBase/recBase.H b/src/recurrence/recBase/recBase.H index 3a1d2061..4c45b087 100644 --- a/src/recurrence/recBase/recBase.H +++ b/src/recurrence/recBase/recBase.H @@ -85,6 +85,8 @@ public: recModel& recM(); recStatAnalysis& recStatA(); + + void extendPath(); void updateRecFields(); diff --git a/src/recurrence/recPath/MarkovPath/MarkovPath.C b/src/recurrence/recPath/MarkovPath/MarkovPath.C new file mode 100644 index 00000000..1c8e773f --- /dev/null +++ b/src/recurrence/recPath/MarkovPath/MarkovPath.C @@ -0,0 +1,274 @@ +/*---------------------------------------------------------------------------*\ + CFDEMcoupling academic - Open Source CFD-DEM coupling + + Contributing authors: + Thomas Lichtenegger + Copyright (C) 2015- Johannes Kepler University, Linz +------------------------------------------------------------------------------- +License + This file is part of CFDEMcoupling academic. + + CFDEMcoupling academic 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. + + CFDEMcoupling academic 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 CFDEMcoupling academic. If not, see . +\*---------------------------------------------------------------------------*/ + +#include "error.H" +#include "MarkovPath.H" +#include "Random.H" +#include "recModel.H" +#include "addToRunTimeSelectionTable.H" + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(MarkovPath, 0); + +addToRunTimeSelectionTable +( + recPath, + MarkovPath, + dictionary +); + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +// Construct from components +MarkovPath::MarkovPath +( + const dictionary& dict, + recBase& base +) +: + recPath(dict, base), + propsDict_(dict.subDict(typeName + "Props")), + meanIntervalSteps_(propsDict_.lookupOrDefault