From 3ff2ae9daa4fd9eeeb40e8eb192cb3a93d1c6f62 Mon Sep 17 00:00:00 2001 From: Thomas Lichtenegger Date: Mon, 1 Aug 2016 07:14:45 +0200 Subject: [PATCH] Some renaming and restructuring. --- src/recurrence/Make/files | 6 +- .../recModel/{ => recModel}/newRecModel.C | 0 .../recModel/{ => recModel}/recModel.C | 3 + .../recModel/{ => recModel}/recModel.H | 24 +- .../standardRecModel/standardRecModel.C | 434 +++++++++++------- .../standardRecModel/standardRecModel.H | 55 ++- src/recurrence/recNorm/recNorm/newRecNorm.C | 76 +++ src/recurrence/recNorm/recNorm/recNorm.C | 86 ++++ src/recurrence/recNorm/recNorm/recNorm.H | 116 +++++ 9 files changed, 589 insertions(+), 211 deletions(-) rename src/recurrence/recModel/{ => recModel}/newRecModel.C (100%) rename src/recurrence/recModel/{ => recModel}/recModel.C (93%) rename src/recurrence/recModel/{ => recModel}/recModel.H (83%) rename src/recurrence/{ => recModel}/standardRecModel/standardRecModel.C (52%) rename src/recurrence/{ => recModel}/standardRecModel/standardRecModel.H (67%) create mode 100644 src/recurrence/recNorm/recNorm/newRecNorm.C create mode 100644 src/recurrence/recNorm/recNorm/recNorm.C create mode 100644 src/recurrence/recNorm/recNorm/recNorm.H diff --git a/src/recurrence/Make/files b/src/recurrence/Make/files index a97c0354..b51ab3a1 100644 --- a/src/recurrence/Make/files +++ b/src/recurrence/Make/files @@ -1,6 +1,6 @@ recBase/recBase.C -recModel/recModel.C -recModel/newRecModel.C -standardRecModel/standardRecModel.C +recModel/recModel/recModel.C +recModel/recModel/newRecModel.C +recModel/standardRecModel/standardRecModel.C LIB = $(FOAM_USER_LIBBIN)/librecurrence diff --git a/src/recurrence/recModel/newRecModel.C b/src/recurrence/recModel/recModel/newRecModel.C similarity index 100% rename from src/recurrence/recModel/newRecModel.C rename to src/recurrence/recModel/recModel/newRecModel.C diff --git a/src/recurrence/recModel/recModel.C b/src/recurrence/recModel/recModel/recModel.C similarity index 93% rename from src/recurrence/recModel/recModel.C rename to src/recurrence/recModel/recModel/recModel.C index 94a4ad9d..eeef7a8d 100644 --- a/src/recurrence/recModel/recModel.C +++ b/src/recurrence/recModel/recModel/recModel.C @@ -64,6 +64,9 @@ recModel::recModel ) ), verbose_(false), + volScalarFieldNames_(recProperties_.lookup("volScalarFields")), + volVectorFieldNames_(recProperties_.lookup("volVectorFields")), + surfaceScalarFieldNames_(recProperties_.lookup("surfaceScalarFields")), recTime("dataBase", "", "../system", "../constant", false), timeDirs(recTime.times()), numRecFields(label(timeDirs.size())), diff --git a/src/recurrence/recModel/recModel.H b/src/recurrence/recModel/recModel/recModel.H similarity index 83% rename from src/recurrence/recModel/recModel.H rename to src/recurrence/recModel/recModel/recModel.H index 18f5ef44..1e64c870 100644 --- a/src/recurrence/recModel/recModel.H +++ b/src/recurrence/recModel/recModel/recModel.H @@ -51,6 +51,10 @@ protected: bool verbose_; + const wordList volScalarFieldNames_; + const wordList volVectorFieldNames_; + const wordList surfaceScalarFieldNames_; + Foam::Time recTime; instantList timeDirs; label numRecFields; @@ -93,8 +97,6 @@ protected: virtual scalar norm(label,label) = 0; -private: - void readTimeSeries(); scalar checkTimeStep(); @@ -147,15 +149,17 @@ public: virtual void updateRecFields() = 0; virtual void setRecFields() = 0; - virtual const volScalarField* voidfraction() const = 0; - virtual const volVectorField* U() const = 0; - virtual const volVectorField* Us() const = 0; - virtual const surfaceScalarField* phi() const = 0; - virtual const surfaceScalarField* phiS() const = 0; + virtual void exportVolScalarField(word, volScalarField&) const = 0; + virtual void exportVolVectorField(word, volVectorField&) const = 0; + virtual void exportSurfaceScalarField(word, surfaceScalarField&) const = 0; - virtual tmp tvoidfraction() const = 0; - virtual tmp tU() const = 0; - virtual tmp tUs() const = 0; +// virtual const volScalarField* voidfraction() const = 0; +// virtual const volVectorField* U() const = 0; +// virtual const volVectorField* Us() const = 0; +// virtual const surfaceScalarField* phi() const = 0; +// virtual const surfaceScalarField* phiS() const = 0; + + scalar recTimeStep() const { return recTimeStep_; diff --git a/src/recurrence/standardRecModel/standardRecModel.C b/src/recurrence/recModel/standardRecModel/standardRecModel.C similarity index 52% rename from src/recurrence/standardRecModel/standardRecModel.C rename to src/recurrence/recModel/standardRecModel/standardRecModel.C index 307096b4..13277430 100644 --- a/src/recurrence/standardRecModel/standardRecModel.C +++ b/src/recurrence/recModel/standardRecModel/standardRecModel.C @@ -56,23 +56,26 @@ standardRecModel::standardRecModel : recModel(dict,base), propsDict_(dict.subDict(typeName + "Props")), - voidfractionFieldName_(propsDict_.lookup("voidfractionRecFieldName")), - UFieldName_(propsDict_.lookup("velRecFieldName")), - UsFieldName_(propsDict_.lookup("granVelRecFieldName")), - phiFieldName_(propsDict_.lookup("phiRecFieldName")), - phiSFieldName_(propsDict_.lookup("granPhiRecFieldName")), - readPhi_(propsDict_.lookupOrDefault("readPhi",false)), - readPhiS_(propsDict_.lookupOrDefault("readPhiS",false)), - voidfractionRecpl(numRecFields), - URecpl(numRecFields), - UsRecpl(numRecFields), - phiRecpl(numRecFields), - phiSRecpl(numRecFields), - voidfractionRec_(NULL), - URec_(NULL), - UsRec_(NULL), - phiRec_(NULL), - phiSRec_(NULL), +// voidfractionFieldName_(propsDict_.lookup("voidfractionRecFieldName")), +// UFieldName_(propsDict_.lookup("velRecFieldName")), +// UsFieldName_(propsDict_.lookup("granVelRecFieldName")), +// phiFieldName_(propsDict_.lookup("phiRecFieldName")), +// phiSFieldName_(propsDict_.lookup("granPhiRecFieldName")), +// readPhi_(propsDict_.lookupOrDefault("readPhi",false)), +// readPhiS_(propsDict_.lookupOrDefault("readPhiS",false)), +// voidfractionRecpl(numRecFields), +// URecpl(numRecFields), +// UsRecpl(numRecFields), +// phiRecpl(numRecFields), +// phiSRecpl(numRecFields), + volScalarFieldList_(volScalarFieldNames_.size()), + volVectorFieldList_(volVectorFieldNames_.size()), + surfaceScalarFieldList_(surfaceScalarFieldNames_.size()), + // voidfractionRec_(NULL), + // URec_(NULL), + // UsRec_(NULL), + // phiRec_(NULL), + // phiSRec_(NULL), normType_(propsDict_.lookup("normType")), refVol_(readScalar(propsDict_.lookup("refVol"))), refVel_(1.0) @@ -80,6 +83,15 @@ standardRecModel::standardRecModel if (normType_=="solidPhaseMomentum") refVel_=readScalar(propsDict_.lookup("refVel")); + for(int i=0; i standardRecModel::tvoidfraction() const -{ - return voidfractionRecpl[virtualTimeIndex]; -} - -tmp standardRecModel::tU() const -{ - return URecpl[virtualTimeIndex]; -} - -tmp standardRecModel::tUs() const -{ - return UsRecpl[virtualTimeIndex]; + for(int i=0; i recNorm::New +( + const dictionary& dict, + recBase& base +) +{ + word recNormType + ( + dict.lookup("recNorm") + ); + + Info<< "Selecting recNorm " + << recNormType << endl; + + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(recNormType); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalError + << "recNorm::New(const dictionary&, const spray&) : " + << endl + << " unknown recNormType type " + << recNormType + << ", constructor not in hash table" << endl << endl + << " Valid recNorm types are :" + << endl; + Info<< dictionaryConstructorTablePtr_->toc() + << abort(FatalError); + } + + return autoPtr(cstrIter()(dict,base)); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/recurrence/recNorm/recNorm/recNorm.C b/src/recurrence/recNorm/recNorm/recNorm.C new file mode 100644 index 00000000..c5a9041c --- /dev/null +++ b/src/recurrence/recNorm/recNorm/recNorm.C @@ -0,0 +1,86 @@ +/*---------------------------------------------------------------------------*\ + 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 "recNorm.H" +#include + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(recNorm, 0); + +defineRunTimeSelectionTable(recNorm, dictionary); + + +// * * * * * * * * * * * * * private Member Functions * * * * * * * * * * * * // + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +// Construct from components +recNorm::recNorm +( + const dictionary& dict, + recBase& base +) +: + base_(base), + recProperties_(dict), + controlDict_ + ( + IOobject + ( + "controlDict", + base.mesh().time().system(), + base.mesh(), + IOobject::MUST_READ, + IOobject::NO_WRITE + ) + ), + verbose_(false) +{ + +} + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +recNorm::~recNorm() +{} + +// * * * * * * * * * * * * * public Member Functions * * * * * * * * * * * * // + + +// * * * * * * * * * * * * * private Member Functions * * * * * * * * * * * * // + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/recurrence/recNorm/recNorm/recNorm.H b/src/recurrence/recNorm/recNorm/recNorm.H new file mode 100644 index 00000000..170d849b --- /dev/null +++ b/src/recurrence/recNorm/recNorm/recNorm.H @@ -0,0 +1,116 @@ +/*---------------------------------------------------------------------------*\ + 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 . +\*---------------------------------------------------------------------------*/ + +#ifndef recNorm_H +#define recNorm_H + +#include "recBase.H" +#include "fvCFD.H" +#include "HashTable.H" +#include "labelPair.H" +#include "OFstream.H" + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class recNorm Declaration +\*---------------------------------------------------------------------------*/ + +class recNorm +{ +protected: + + // Protected data + recBase& base_; + + const dictionary& recProperties_; + + IOdictionary controlDict_; + + bool verbose_; + + + + + +public: + + //- Runtime type information + TypeName("recNorm"); + + // Declare runtime constructor selection table + + declareRunTimeSelectionTable + ( + autoPtr, + recNorm, + dictionary, + ( + const dictionary& dict, + recBase& base + ), + (dict,base) + ); + + + // Constructors + + //- Construct from components + recNorm + ( + const dictionary& dict, + recBase& base + ); + + + // Destructor + + virtual ~recNorm(); + + + // Selector + + static autoPtr New + ( + const dictionary& dict, + recBase& base + ); + + + // Member Functions + + +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* //