Merge pull request #98 from ParticulateFlow/feature/openfoam6

Update to OpenFOAM 6
This commit is contained in:
Daniel
2019-11-14 14:15:43 +01:00
committed by GitHub
65 changed files with 463 additions and 47845 deletions

View File

@ -1,6 +1,10 @@
FOAM_VERSION_MAJOR := $(word 1,$(subst ., ,$(WM_PROJECT_VERSION)))
PFLAGS+= -DOPENFOAM_VERSION_MAJOR=$(FOAM_VERSION_MAJOR)
include $(CFDEM_ADD_LIBS_DIR)/additionalLibs
EXE_INC = \
$(PFLAGS) \
-I$(CFDEM_OFVERSION_DIR) \
-ImultiphaseMixture/lnInclude \
-I$(LIB_SRC)/transportModels \

View File

@ -46,6 +46,11 @@ Description
int main(int argc, char *argv[])
{
#if OPENFOAM_VERSION_MAJOR >= 6
FatalError << "cfdemSolverMultiphase requires OpenFOAM 4.x or 5.x to work properly" << exit(FatalError);
#endif
#include "postProcess.H"
#include "setRootCase.H"
#include "createTime.H"

View File

@ -1,4 +1,8 @@
FOAM_VERSION_MAJOR := $(word 1,$(subst ., ,$(WM_PROJECT_VERSION)))
PFLAGS+= -DOPENFOAM_VERSION_MAJOR=$(FOAM_VERSION_MAJOR)
EXE_INC = \
$(PFLAGS) \
-IalphaContactAngle \
-I$(LIB_SRC)/transportModels \
-I$(LIB_SRC)/transportModels/incompressible/lnInclude \

View File

@ -679,8 +679,13 @@ void Foam::multiphaseMixture::solveAlphas
alphaPhiCorr,
zeroField(),
zeroField(),
#if OPENFOAM_VERSION_MAJOR < 6
1,
0,
#else
oneField(),
zeroField(),
#endif
true
);

View File

@ -1,5 +1,7 @@
include $(CFDEM_ADD_LIBS_DIR)/additionalLibs
FOAM_VERSION_MAJOR := $(word 1,$(subst ., ,$(WM_PROJECT_VERSION)))
PFLAGS+= -DOPENFOAM_VERSION_MAJOR=$(FOAM_VERSION_MAJOR)
PFLAGS+= -Dcompre
EXE_INC = \

View File

@ -113,7 +113,11 @@ int main(int argc, char *argv[])
particleCloud.clockM().start(26,"Flow");
#if OPENFOAM_VERSION_MAJOR < 6
if (pimple.nCorrPIMPLE() <= 1)
#else
if (pimple.nCorrPimple() <= 1)
#endif
{
#include "rhoEqn.H"
}

View File

@ -1,5 +1,7 @@
include $(CFDEM_ADD_LIBS_DIR)/additionalLibs
FOAM_VERSION_MAJOR := $(word 1,$(subst ., ,$(WM_PROJECT_VERSION)))
PFLAGS+= -DOPENFOAM_VERSION_MAJOR=$(FOAM_VERSION_MAJOR)
PFLAGS+= -Dcompre
EXE_INC = \
@ -19,12 +21,8 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/transportModels/compressible/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/properties/liquidProperties/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/properties/liquidMixtureProperties/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/radiationModels/lnInclude \
-I$(LIB_SRC)/regionModels/regionModel/lnInclude \
-I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \
-I$(LIB_SRC)/ODE/lnInclude \
@ -48,9 +46,6 @@ EXE_LIBS = \
-l$(CFDEM_LIB_COMP_NAME) \
$(CFDEM_ADD_LIB_PATHS) \
$(CFDEM_ADD_LIBS) \
-lliquidProperties \
-lliquidMixtureProperties \
-lthermophysicalFunctions \
-lreactionThermophysicalModels \
-lchemistryModel \
-lradiationModels \

View File

@ -13,7 +13,11 @@ tmp<fv::convectionScheme<scalar> > mvConvection
{
combustion->correct();
#if OPENFOAM_VERSION_MAJOR < 5
dQ = combustion->dQ();
#else
Qdot = combustion->Qdot();
#endif
label inertIndex = -1;
volScalarField Yt(0.0*Y[0]);
@ -72,4 +76,5 @@ tmp<fv::convectionScheme<scalar> > mvConvection
Y[inertIndex].max(0.0);
}
}
particleCloud.clockM().stop("Y");

View File

@ -30,7 +30,12 @@ Description
#include "fvCFD.H"
#include "turbulentFluidThermoModel.H"
#if OPENFOAM_VERSION_MAJOR < 6
#include "rhoCombustionModel.H"
#else
#include "rhoReactionThermo.H"
#include "CombustionModel.H"
#endif
#include "bound.H"
#include "pimpleControl.H"
#include "fvOptions.H"
@ -115,7 +120,11 @@ int main(int argc, char *argv[])
particleCloud.clockM().start(26,"Flow");
#if OPENFOAM_VERSION_MAJOR < 6
if (pimple.nCorrPIMPLE() <= 1)
#else
if (pimple.nCorrPimple() <= 1)
#endif
{
#include "rhoEqn.H"
}

View File

@ -1,20 +1,28 @@
// thermodynamics, chemistry
#if OPENFOAM_VERSION_MAJOR < 6
Info<< "Creating combustion model\n" << endl;
autoPtr<combustionModels::rhoCombustionModel> combustion
(
combustionModels::rhoCombustionModel::New(mesh)
);
rhoReactionThermo& thermo = combustion->thermo();
#else
Info<< "Reading thermophysical properties\n" << endl;
autoPtr<rhoReactionThermo> pThermo(rhoReactionThermo::New(mesh));
rhoReactionThermo& thermo = pThermo();
#endif
thermo.validate(args.executable(), "h", "e");
basicSpecieMixture& composition = thermo.composition();
PtrList<volScalarField>& Y = composition.Y();
// read molecular weight
#if OPENFOAM_VERSION_MAJOR < 6
volScalarField W(composition.W());
#else
volScalarField W(thermo.W());
#endif
bool propagateInertSpecie = true;
@ -198,6 +206,14 @@
)
);
#if OPENFOAM_VERSION_MAJOR >= 6
Info<< "Creating combustion model\n" << endl;
autoPtr<CombustionModel<rhoReactionThermo>> combustion
(
CombustionModel<rhoReactionThermo>::New(thermo, turbulence())
);
#endif
Info<< "Creating field dpdt\n" << endl;
volScalarField dpdt
(
@ -214,6 +230,7 @@
Info<< "Creating field kinetic energy K\n" << endl;
volScalarField K("K", 0.5*magSqr(U));
#if OPENFOAM_VERSION_MAJOR < 5
volScalarField dQ
(
IOobject
@ -227,6 +244,21 @@
mesh,
dimensionedScalar("dQ", dimEnergy/dimTime, 0.0)
);
#else
volScalarField Qdot
(
IOobject
(
"Qdot",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar("Qdot", dimEnergy/dimVolume/dimTime, 0.0)
);
#endif
Info<< "\nReading momentum exchange field Ksl\n" << endl;
volScalarField Ksl

View File

@ -29,11 +29,6 @@ Description
\*---------------------------------------------------------------------------*/
// #include "fvCFD.H"
// #include "singlePhaseTransportModel.H"
// #include "turbulentTransportModel.H"
// #include "fvOptions.H"
#include "recBase.H"
#include "recStatAnalysis.H"

View File

@ -1,5 +1,7 @@
include $(CFDEM_ADD_LIBS_DIR)/additionalLibs
FOAM_VERSION_MAJOR := $(word 1,$(subst ., ,$(WM_PROJECT_VERSION)))
PFLAGS+= -DOPENFOAM_VERSION_MAJOR=$(FOAM_VERSION_MAJOR)
PFLAGS+= -Dcompre
EXE_INC = \

View File

@ -137,7 +137,11 @@ int main(int argc, char *argv[])
while (pimple.loop())
{
// if needed, perform drag update here
#if OPENFOAM_VERSION_MAJOR < 6
if (pimple.nCorrPIMPLE() <= 1)
#else
if (pimple.nCorrPimple() <= 1)
#endif
{
#include "rhoEqn.H"
}

View File

@ -25,7 +25,7 @@ export CFDEM_VERSION=19.09
# Please set to the appropriate path if the default is not correct.
#
# activate compatible OpenFOAM version
. $HOME/OpenFOAM/OpenFOAM-4.x/etc/bashrc
. $HOME/OpenFOAM/OpenFOAM-6/etc/bashrc
#
# CFDEMcoupling
export CFDEM_INST_DIR=$HOME/$CFDEM_PROJECT

View File

@ -23,7 +23,7 @@ setenv CFDEM_VERSION 19.09
# Please set to the appropriate path if the default is not correct.
#
# activate compatible OpenFOAM version
. $HOME/OpenFOAM/OpenFOAM-4.x/etc/cshrc
. $HOME/OpenFOAM/OpenFOAM-6/etc/cshrc
#
# CFDEMcoupling
setenv CFDEM_INST_DIR $HOME/$CFDEM_PROJECT

View File

@ -3,6 +3,8 @@ sinclude $(RULES)/mplib$(WM_MPLIB)
GIT_VERSION := $(shell git describe --dirty --always --tags)
PFLAGS+= -DGITVERSION=\"$(GIT_VERSION)\"
FOAM_VERSION_MAJOR := $(word 1,$(subst ., ,$(WM_PROJECT_VERSION)))
PFLAGS+= -DOPENFOAM_VERSION_MAJOR=$(FOAM_VERSION_MAJOR)
include $(CFDEM_ADD_LIBS_DIR)/additionalLibs

View File

@ -36,7 +36,7 @@ Description
word CFDEMversion="PFM 19.09";
word compatibleLIGGGHTSversion="PFM 19.09";
word OFversion="4.x";
word OFversion="6";
Info << "\nCFDEMcoupling version: " << CFDEMversion << endl;
Info << "compatible to LIGGGHTS version: " << compatibleLIGGGHTSversion << endl;

View File

@ -30,6 +30,7 @@ Description
\*---------------------------------------------------------------------------*/
#include "error.H"
#include "particle.H"
#include "IOModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -99,13 +100,22 @@ void IOModel::streamDataToPath(const fileName& path, const double* const* array,
OFstream fileStream(path/name);
fileStream
<< "FoamFile\n{\n"
<< " version " << fileStream.version() << ";\n"
<< " format " << fileStream.format() << ";\n"
<< " class " << className << ";\n"
<< " location " << 0 << ";\n"
<< " object " << name << ";\n"
<< "}" << nl;
<< "/*--------------------------------*- C++ -*----------------------------------*\\" << nl
<< " ========= |" << nl
<< " \\\\ / F ield | OpenFOAM: The Open Source CFD Toolbox" << nl
<< " \\\\ / O peration | Website: https://openfoam.org" << nl
<< " \\\\ / A nd | Version: " << FOAMversion << nl
<< " \\\\/ M anipulation |" << nl
<< "\\*---------------------------------------------------------------------------*/" << nl
<< "FoamFile" << nl
<< "{" << nl
<< " version " << fileStream.version() << ";" << nl
<< " format " << fileStream.format() << ";" << nl
<< " class " << className << ";" << nl
<< " location " << 0 << ";" << nl
<< " object " << name << ";" << nl
<< "}" << nl
<< "// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //" << nl << nl;
fileStream << nPProc << "\n";
@ -129,7 +139,19 @@ void IOModel::streamDataToPath(const fileName& path, const double* const* array,
}
else if (type == "position")
{
fileStream << "( "<< array[index][0] << " " << array[index][1] << " " << array[index][2] << " ) " << cellIDs[index][0] << " \n";
#if OPENFOAM_VERSION_MAJOR < 5
fileStream << "( " << array[index][0] << " " << array[index][1] << " " << array[index][2] << " ) " << cellIDs[index][0] << nl;
#else
particle part
(
particleCloud_.mesh(),
vector(array[index][0],array[index][1],array[index][2]),
cellIDs[index][0]
);
part.writePosition(fileStream);
fileStream << nl;
#endif
}
else if (type == "vector")
{

View File

@ -291,7 +291,11 @@ void KochHillRWDrag::setForce() const
// modify current fluid velocity
for (int dim=0; dim<3; dim++)
{
#if OPENFOAM_VERSION_MAJOR < 6
partUfluct_[index][dim] = RanGen_.GaussNormal()*sqrt(2.*k/3.);
#else
partUfluct_[index][dim] = RanGen_.scalarNormal()*sqrt(2.*k/3.);
#endif
//Pout << "RW-TEST: Ufluid[" << dim << "] = " << Ufluid[dim] << " Ufluct = " << partUfluct_[index][dim] << " k = " << k << endl; // TEST-Output
Ufluid[dim] = Ufluid[dim] + partUfluct_[index][dim];
}

View File

@ -83,7 +83,7 @@ isotropicFluctuations::isotropicFluctuations
dimensionedScalar("D0", dimensionSet(0,0,0,0,0,0,0), D0_)
),
dtDEM_(particleCloud_.dataExchangeM().DEMts()),
ranGen_(osRandomInteger())
ranGen_(clock::getTime()+pid())
{
if(ignoreCellsName_ != "none")
{

View File

@ -6,6 +6,8 @@ sinclude $(RULES)/mplib$(WM_MPLIB)
GIT_VERSION := $(shell git describe --dirty --always --tags)
PFLAGS+= -DGITVERSION=\"$(GIT_VERSION)\"
FOAM_VERSION_MAJOR := $(word 1,$(subst ., ,$(WM_PROJECT_VERSION)))
PFLAGS+= -DOPENFOAM_VERSION_MAJOR=$(FOAM_VERSION_MAJOR)
PFLAGS+= -Dcompre

View File

@ -12,11 +12,10 @@ recNorm/readNorm/readNorm.C
recNorm/sqrDiffNorm/sqrDiffNorm.C
recNorm/noRecNorm/noRecNorm.C
recPath/recPath/recPath.C
recPath/recPath/newRecPath.C
recPath/simpleRandomPath/simpleRandomPath.C
recPath/recPath/newRecPath.C
recPath/noPath/noPath.C
recPath/MarkovPath/MarkovPath.C
recPath/multiIntervalPath/multiIntervalPath.C
recPath/predefinedPath/predefinedPath.C
recStatAnalysis/recStatAnalysis/recStatAnalysis.C
recStatAnalysis/recStatAnalysis/newRecStatAnalysis.C

View File

@ -1,6 +1,9 @@
GIT_VERSION := $(shell git describe --abbrev=4 --dirty --always --tags)
PFLAGS+= -DGITVERSION=\"$(GIT_VERSION)\"
FOAM_VERSION_MAJOR := $(word 1,$(subst ., ,$(WM_PROJECT_VERSION)))
PFLAGS+= -DOPENFOAM_VERSION_MAJOR=$(FOAM_VERSION_MAJOR)
include $(CFDEM_ADD_LIBS_DIR)/additionalLibs
EXE_INC = \

View File

@ -84,14 +84,20 @@ recBase::recBase
couplingSubStep_(recProperties_.lookupOrDefault<label>("couplingSubStep",0))
{
recModel_ -> readFieldSeries();
if (!recStatAnalysis_->suppressMatrixAndPath())
{
recNorm_ -> computeRecMatrix();
recPath_ -> getRecPath();
}
recModel_ -> init();
if (!recStatAnalysis_->suppressMatrixAndPath())
{
recModel_ -> writeRecMatrix();
recModel_ -> writeRecPath();
}
}
// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * //
recBase::~recBase()

View File

@ -226,7 +226,11 @@ scalar gerhardsRecModel::checkTimeStep()
}
// set deltaT
#if OPENFOAM_VERSION_MAJOR < 6
recTime.setDeltaT(dtCur, false);
#else
recTime.setDeltaT(dtCur);
#endif
if (verbose_)
{
@ -296,7 +300,11 @@ void gerhardsRecModel::readFieldSeries()
for OpenFOAM versions prior to OpenFOAM-5.0
Do this the other way around for OpenFOAM-5.0 and potentially later versions
*/
#if OPENFOAM_VERSION_MAJOR < 5
if (! header.headerOk())
#else
if (! header.typeHeaderOk<volScalarField>(true))
#endif
{
FatalError
<< "Field " << volScalarFieldNames_[i] << " not found"
@ -320,7 +328,11 @@ void gerhardsRecModel::readFieldSeries()
for OpenFOAM versions prior to OpenFOAM-5.0
Do this the other way around for OpenFOAM-5.0 and potentially later versions
*/
#if OPENFOAM_VERSION_MAJOR < 5
if (! header.headerOk())
#else
if (! header.typeHeaderOk<volVectorField>(true))
#endif
{
FatalError
<< "Field " << volVectorFieldNames_[i] << " not found"
@ -344,7 +356,11 @@ void gerhardsRecModel::readFieldSeries()
for OpenFOAM versions prior to OpenFOAM-5.0
Do this the other way around for OpenFOAM-5.0 and potentially later versions
*/
#if OPENFOAM_VERSION_MAJOR < 5
if (! header.headerOk())
#else
if (! header.typeHeaderOk<surfaceScalarField>(true))
#endif
{
FatalError
<< "Field " << surfaceScalarFieldNames_[i] << " not found"
@ -851,6 +867,27 @@ const surfaceScalarField& gerhardsRecModel::exportSurfaceScalarField(word fieldn
}
PtrList<volScalarField>& gerhardsRecModel::exportVolScalarFieldList(word fieldname)
{
const label fieldI = getVolScalarFieldIndex(fieldname);
return volScalarFieldList_[fieldI];
}
PtrList<volVectorField>& gerhardsRecModel::exportVolVectorFieldList(word fieldname)
{
const label fieldI = getVolVectorFieldIndex(fieldname);
return volVectorFieldList_[fieldI];
}
PtrList<surfaceScalarField>& gerhardsRecModel::exportSurfaceScalarFieldList(word fieldname)
{
const label fieldI = getSurfaceScalarFieldIndex(fieldname);
return surfaceScalarFieldList_[fieldI];
}
SymmetricSquareMatrix<scalar>& gerhardsRecModel::recurrenceMatrix()

View File

@ -100,9 +100,9 @@ protected:
scalar checkTimeStep();
inline label getVolScalarFieldIndex(word, label) const;
inline label getVolVectorFieldIndex(word, label) const;
inline label getSurfaceScalarFieldIndex(word, label) const;
inline label getVolScalarFieldIndex(word, label=0) const;
inline label getVolVectorFieldIndex(word, label=0) const;
inline label getSurfaceScalarFieldIndex(word, label=0) const;
void readFieldSeries();
@ -143,6 +143,10 @@ public:
const volVectorField& exportVolVectorField(word, label);
const surfaceScalarField& exportSurfaceScalarField(word, label);
PtrList<volScalarField>& exportVolScalarFieldList(word);
PtrList<volVectorField>& exportVolVectorFieldList(word);
PtrList<surfaceScalarField>& exportSurfaceScalarFieldList(word);
// tmp<surfaceScalarField> exportAveragedSurfaceScalarField(word, scalar, label index = -1);
void exportAveragedVolVectorField(volVectorField&, word, scalar, label index = -1) const;

View File

@ -150,7 +150,7 @@ void MarkovPath::computeRecPath()
void MarkovPath::extendPath()
{
Random ranGen(osRandomInteger());
Random ranGen(clock::getTime()+pid());
SymmetricSquareMatrix<scalar>& recurrenceMatrix( base_.recM().recurrenceMatrix() );

View File

@ -1,194 +0,0 @@
/*---------------------------------------------------------------------------*\
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 <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "error.H"
#include "multiIntervalPath.H"
#include "Random.H"
#include "recModel.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(multiIntervalPath, 0);
addToRunTimeSelectionTable
(
recPath,
multiIntervalPath,
dictionary
);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
multiIntervalPath::multiIntervalPath
(
const dictionary& dict,
recBase& base
)
:
recPath(dict, base),
propsDict_(dict.subDict(typeName + "Props")),
meanIntervalSteps_(propsDict_.lookupOrDefault<label>("meanIntervalSteps",-1)),
numIntervals_(base.recM().numIntervals()),
intervalSizes_(numIntervals_),
intervalSizesCumulative_(numIntervals_),
Pjump_(0.0),
intervalWeights_(propsDict_.lookupOrDefault<scalarList>("intervalWeights",scalarList(numIntervals_,1.0))),
intervalWeightsCumulative_(intervalWeights_)
{
if(meanIntervalSteps_<0)
{
// if no mean interval length for consecutive steps is specified, use 1/5 from first interval
meanIntervalSteps_ = static_cast<label>(0.2 * intervalSizes_[0]);
}
// normalize weights
scalar wsum = 0.0;
for(int i=0;i<numIntervals_;i++)
{
intervalSizes_[i] = base.recM().numRecFields(i);
wsum += intervalWeights_[i];
}
for(int i=0;i<numIntervals_;i++)
{
intervalWeights_[i] /= wsum;
}
for(int i=0;i<numIntervals_;i++)
{
scalar sum1 = 0.0;
scalar sum2 = 0.0;
for(int j=0;j<=i;j++)
{
sum1 += intervalWeights_[j];
sum2 += intervalSizes_[j];
}
intervalWeightsCumulative_[i] = sum1;
intervalSizesCumulative_[i] = sum2;
}
// 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
Pjump_ = 1.0 / (1 + meanIntervalSteps_);
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
multiIntervalPath::~multiIntervalPath()
{}
// * * * * * * * * * * * * * protected Member Functions * * * * * * * * * * * * //
void multiIntervalPath::computeRecPath()
{
Info << "\nComputing recurrence path\n" << endl;
Random ranGen(osRandomInteger());
label virtualTimeIndex=0;
label recSteps=0;
label seqStart=0;
bool prevStepWasJump = true;
SymmetricSquareMatrix<scalar>& recurrenceMatrix( base_.recM().recurrenceMatrix() );
if(base_.recM().totRecSteps() == 1)
{
Info << "\nPrimitive recurrence path with one element.\n" << endl;
return;
}
while(recSteps <= base_.recM().totRecSteps() )
{
scalar randJump = ranGen.scalar01();
// check if current virtualTimeIndex is close to separation time
bool intervalBorder = false;
label sep = 0;
for(int i = 0;i < numIntervals_; i++)
{
sep += intervalSizes_[i];
if (sep - 1 == virtualTimeIndex) intervalBorder=true;
}
if ((randJump > Pjump_ && !intervalBorder) || prevStepWasJump)
{
virtualTimeIndex++;
prevStepWasJump = false;
}
else
{
// before jump, complete former consecutive interval
labelPair seqStartEnd(seqStart,virtualTimeIndex);
virtualTimeIndexList_.append(seqStartEnd);
recSteps += virtualTimeIndex - seqStart + 1;
// now jump
// identify interval to jump to
scalar randInterval = ranGen.scalar01();
label interval = numIntervals_-1;
for(int i = numIntervals_-2 ;i >= 0; i--)
{
if (randInterval < intervalWeightsCumulative_[i]) interval=i;
}
label startLoop = 0;
if (interval > 0) startLoop = intervalSizesCumulative_[interval-1];
label endLoop = intervalSizesCumulative_[interval] - meanIntervalSteps_;
scalar nextMinimum(GREAT);
for (label j = startLoop; j <= endLoop; j++)
{
if(abs(j - virtualTimeIndex) < meanIntervalSteps_) continue;
if (recurrenceMatrix[j][virtualTimeIndex] < nextMinimum)
{
nextMinimum = recurrenceMatrix[j][virtualTimeIndex];
seqStart = j+1;
}
}
virtualTimeIndex = seqStart;
prevStepWasJump = true;
}
}
Info << "\nComputing recurrence path done\n" << endl;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -1,103 +0,0 @@
/*---------------------------------------------------------------------------*\
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 <http://www.gnu.org/licenses/>.
Description
A recurrence database consisting of N separate intervals is assumed with separation
times t0 (start time), t1, ... tN (end time) and weights w0, ... wN-1.
\*---------------------------------------------------------------------------*/
#ifndef multiIntervalPath_H
#define multiIntervalPath_H
#include "recPath.H"
#include "scalarList.H"
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class multiIntervalPath Declaration
\*---------------------------------------------------------------------------*/
class multiIntervalPath
:
public recPath
{
protected:
// Protected data
dictionary propsDict_;
void computeRecPath();
label meanIntervalSteps_;
label numIntervals_;
labelList intervalSizes_;
labelList intervalSizesCumulative_;
scalar Pjump_;
scalarList intervalWeights_;
scalarList intervalWeightsCumulative_;
public:
//- Runtime type information
TypeName("multiIntervalPath");
// Constructors
//- Construct from components
multiIntervalPath
(
const dictionary& dict,
recBase& base
);
// Destructor
virtual ~multiIntervalPath();
// Member Functions
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -69,15 +69,18 @@ void simpleRandomPath::computeRecPath()
{
Info << "\nComputing recurrence path\n" << endl;
Random ranGen(osRandomInteger());
Random ranGen(clock::getTime()+pid());
label virtualTimeIndex = 0;
label recSteps = 0;
label seqStart = 0;
label lowerSeqLim( base_.recM().lowerSeqLim() );
label upperSeqLim( base_.recM().upperSeqLim() );
#if OPENFOAM_VERSION_MAJOR < 6
label seqLength = ranGen.integer(lowerSeqLim, upperSeqLim);
#else
label seqLength = ranGen.sampleAB(lowerSeqLim, upperSeqLim);
#endif
virtualTimeIndex = seqEnd(seqStart,seqLength);
labelPair seqStartEnd(seqStart,virtualTimeIndex);
@ -123,7 +126,11 @@ void simpleRandomPath::computeRecPath()
}
}
#if OPENFOAM_VERSION_MAJOR < 6
seqLength = ranGen.integer(lowerSeqLim, upperSeqLim);
#else
seqLength = ranGen.sampleAB(lowerSeqLim, upperSeqLim);
#endif
virtualTimeIndex = seqEnd(seqStart,seqLength);
labelPair seqStartEnd(seqStart,virtualTimeIndex);
virtualTimeIndexList_.append(seqStartEnd);

View File

@ -73,7 +73,8 @@ autocorrelation::autocorrelation
),
base.mesh(),
dimensionedScalar("zero", dimensionSet(0,0,0,0,0), 0.0)
)
),
suppressMatrixAndPath_(propsDict_.lookupOrDefault<bool>("suppressMatrixAndPath",false))
{
if (fieldtype_ != "scalar" && fieldtype_ != "vector")
{
@ -108,31 +109,23 @@ void autocorrelation::statistics()
void autocorrelation::autocorr()
{
scalar res = 0.0;
PtrList<volScalarField> scalarFieldList;
PtrList<volVectorField> vectorFieldList;
if (fieldtype_ == "scalar") scalarFieldList.transfer(base_.recM().exportVolScalarFieldList(fieldname_));
else vectorFieldList.transfer(base_.recM().exportVolVectorFieldList(fieldname_));
if (fieldtype_ == "scalar") scalarFieldList_.transfer(base_.recM().exportVolScalarFieldList(fieldname_));
else vectorFieldList_.transfer(base_.recM().exportVolVectorFieldList(fieldname_));
label tmax = base_.recM().totRecSteps();
for (label ti = delaySteps_; ti < tmax; ti++)
{
forAll(autoCorrField_, cellI)
{
if (fieldtype_ == "scalar")
{
res = scalarFieldList[ti-delaySteps_][refCell_] * scalarFieldList[ti][cellI];
}
else
{
res = vectorFieldList[ti-delaySteps_][refCell_] & vectorFieldList[ti][cellI];
}
autoCorrField_[cellI] += res;
autoCorrField_[cellI] += autocorrSummand(ti-delaySteps_,ti,refCell_,cellI);
}
}
autoCorrField_ /= (tmax - delaySteps_);
autoCorrField_ -= meanProd();
if (normalize_)
{
volScalarField meanProd(autoCorrField_);
@ -159,17 +152,55 @@ void autocorrelation::autocorr()
dimensionSet fieldDim(0,0,0,0,0);
if (fieldtype_ == "scalar")
{
fieldDim.reset(scalarFieldList[0].dimensions());
fieldDim.reset(scalarFieldList_[0].dimensions());
}
else
{
fieldDim.reset(vectorFieldList[0].dimensions());
fieldDim.reset(vectorFieldList_[0].dimensions());
}
fieldDim = fieldDim * fieldDim;
fieldDim.reset(fieldDim * fieldDim);
autoCorrField_.dimensions().reset(fieldDim);
}
autoCorrField_.write();
}
scalar autocorrelation::autocorrSummand(label t1, label t2, label c1, label c2)
{
scalar res;
if (fieldtype_ == "scalar")
{
res = scalarFieldList_[t1][c1] * scalarFieldList_[t2][c2];
}
else
{
res = vectorFieldList_[t1][c1] & vectorFieldList_[t2][c2];
}
return res;
}
volScalarField autocorrelation::meanProd()
{
volScalarField meanProd(autoCorrField_);
if (fieldtype_ == "scalar")
{
volScalarField aveField = base_.recM().exportVolScalarFieldAve(fieldname_);
forAll(meanProd, cellI)
{
meanProd[cellI] = aveField()[cellI] * aveField()[refCell_];
}
}
else
{
volVectorField aveField = base_.recM().exportVolVectorFieldAve(fieldname_);
forAll(meanProd, cellI)
{
meanProd[cellI] = aveField()[cellI] & aveField()[refCell_];
}
}
return meanProd;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -85,9 +85,21 @@ private:
bool normalize_;
PtrList<volScalarField> scalarFieldList_;
PtrList<volVectorField> vectorFieldList_;
volScalarField autoCorrField_;
bool suppressMatrixAndPath_;
void autocorr();
scalar autocorrSummand(label, label, label, label);
volScalarField meanProd();
bool suppressMatrixAndPath() {return suppressMatrixAndPath_;}
};

View File

@ -102,6 +102,8 @@ public:
virtual void statistics() = 0;
virtual bool suppressMatrixAndPath() {return false;}
};

View File

@ -23,7 +23,7 @@ solvers
cAlpha 1;
}
pcorr
"pcorr.*"
{
solver PCG;
preconditioner

View File

@ -23,7 +23,7 @@ solvers
cAlpha 1;
}
pcorr
"pcorr.*"
{
solver PCG;
preconditioner

View File

@ -23,7 +23,7 @@ solvers
cAlpha 1;
}
pcorr
"pcorr.*"
{
solver PCG;
preconditioner

View File

@ -14,6 +14,9 @@ name outlet;
fields (alpha.air alpha.water alpha.oil);
operation average;
#includeEtc "caseDicts/postProcessing/surfaceRegion/patch.cfg"
// OF4
//#includeEtc "caseDicts/postProcessing/surfaceRegion/patch.cfg"
// OF5,OF6
#includeEtc "caseDicts/postProcessing/surfaceFieldValue/patch.cfg"
// ************************************************************************* //

View File

@ -30,10 +30,12 @@ boundaryField
inlet
{
type interstitialInletVelocity;
inletVelocity uniform (0 0 0.1);
alpha voidfraction;
value $internalField;
type uniformFixedValue;
uniformValue table
(
(0.000 (0 0 0.002))
(2.000 (0 0 1.5))
);
}
outlet

View File

@ -29,8 +29,6 @@ boundaryField
inlet
{
// type zeroGradient;
// type fixedFluxPressure;
// value $internalField;
type fixedFluxExtrapolatedPressure;
}
outlet

View File

@ -16,7 +16,7 @@ FoamFile
dimensions [1 -3 0 0 0 0 0];
internalField uniform 1;
internalField uniform 1.18;
boundaryField
{

View File

@ -32,9 +32,8 @@ boundaryField
}
inlet
{
//type fixedValue;
//value uniform 1;
type zeroGradient;
type fixedValue;
value uniform 1;
}
}

View File

@ -1,41 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 4.x |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class polyBoundaryMesh;
location "constant/polyMesh";
object boundary;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
3
(
inlet
{
type patch;
nFaces 192;
startFace 13248;
}
outlet
{
type patch;
nFaces 192;
startFace 13440;
}
wall
{
type wall;
inGroups 1(wall);
nFaces 768;
startFace 13632;
}
)
// ************************************************************************* //

View File

@ -23,7 +23,7 @@ startTime 0;
stopAt endTime;
endTime 0.5;
endTime 2.0;
deltaT 0.00025;

View File

@ -1,6 +1,91 @@
#!/bin/bash
cd CFD
blockMesh
decomposePar -force
mpirun -np 4 cfdemSolverRhoPimple -parallel
#===================================================================#
# allrun script for testcase as part of test routine
# run Ergun test CFD part
#===================================================================#
#- source CFDEM env vars
. ~/.bashrc
#- include functions
source $CFDEM_PROJECT_DIR/etc/functions.sh
#--------------------------------------------------------------------------------#
#- define variables
casePath="$(dirname "$(readlink -f ${BASH_SOURCE[0]})")"
logpath=$casePath
headerText="run_parallel_cfdemSolverRhoPimple_ErgunTestMPI_CFDDEM"
logfileName="log_$headerText"
solverName="cfdemSolverRhoPimple"
nrProcs="4"
machineFileName="none" # yourMachinefileName | none
debugMode="off" # on | off| strict
testHarnessPath="$CFDEM_TEST_HARNESS_PATH"
runOctave="true"
postproc="false"
#--------------------------------------------------------------------------------#
#- call function to run a parallel CFD-DEM case
parCFDDEMrun $logpath $logfileName $casePath $headerText $solverName $nrProcs $machineFileName $debugMode
if [ $runOctave == "true" ]
then
#------------------------------#
# octave
#- change path
cd octave
#- rmove old graph
rm cfdemSolverRhoPimple_ErgunTestMPI.eps
#- run octave
octave totalPressureDrop.m
#- show plot
evince cfdemSolverRhoPimple_ErgunTestMPI.eps
#- copy log file to test harness
cp ../../$logfileName $testHarnessPath
cp cfdemSolverRhoPimple_ErgunTestMPI.eps $testHarnessPath
fi
if [ $postproc == "true" ]
then
#- keep terminal open (if started in new terminal)
echo "simulation finisehd? ...press enter to proceed"
read
#- get VTK data from liggghts dump file
cd $casePath/DEM/post
python -i $CFDEM_LPP_DIR/lpp.py dump*.liggghts_run
#- get VTK data from CFD sim
cd $casePath/CFD
foamToVTK #- serial run of foamToVTK
#- start paraview
paraview
#- keep terminal open (if started in new terminal)
echo "...press enter to clean up case"
echo "press Ctr+C to keep data"
read
fi
#- clean up case
echo "deleting data at: $casePath :\n"
source $WM_PROJECT_DIR/bin/tools/CleanFunctions
cd $casePath/CFD
#cleanCase
rm -r $casePath/CFD/clockData
rm $casePath/DEM/post/*.*
touch $casePath/DEM/post/.gitignore
rm $casePath/DEM/post/restart/*.*
rm $casePath/DEM/post/restart/liggghts.restartCFDEM*
touch $casePath/DEM/post/restart/.gitignore
echo "done"

View File

@ -15,11 +15,14 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
combustionModel noCombustion<rhoThermoCombustion>; //PaSR<rhoChemistryCombustion>; //PaSR<psiChemistryCombustion>;
// OF5 -> OF6: noCombustion<> -> none (template parameters are no longer required)
//combustionModel noCombustion<rhoThermoCombustion>; //PaSR<rhoChemistryCombustion>; //PaSR<psiChemistryCombustion>;
combustionModel none; // OF6
active false; //true;
noCombustionCoeffs
//noCombustionCoeffs
noneCoeffs
{
}

View File

@ -145,7 +145,8 @@ functions
globalMassFrac
{
type volRegion;
//type volRegion; // OF4
type volFieldValue; // OF5,OF6
libs ("libfieldFunctionObjects.so");
writeControl timeStep;//outputTime;
writeInterval 1;
@ -167,7 +168,8 @@ functions
globalMass
{
type volRegion;
//type volRegion; // OF4
type volFieldValue; // OF5,OF6
libs ("libfieldFunctionObjects.so");
writeControl timeStep;//outputTime;
writeInterval 1;
@ -185,7 +187,8 @@ functions
inflow_GasSpecies
{
type surfaceRegion;
//type surfaceRegion; // OF4
type surfaceFieldValue; // OF5,OF6
libs ("libfieldFunctionObjects.so");
writeControl timeStep;
writeInterval 100;
@ -208,7 +211,8 @@ functions
inflow_phi
{
type surfaceRegion;
//type surfaceRegion; // OF4
type surfaceFieldValue; // OF5,OF6
libs ("libfieldFunctionObjects.so");
writeControl timeStep;
writeInterval 100;
@ -227,7 +231,8 @@ functions
inflow_U
{
type surfaceRegion;
//type surfaceRegion; // OF4
type surfaceFieldValue; // OF5,OF6
libs ("libfieldFunctionObjects.so");
writeControl timeStep;
writeInterval 100;

View File

@ -145,7 +145,8 @@ functions
globalMassFrac
{
type volRegion;
//type volRegion; // OF4
type volFieldValue; // OF5,OF6
libs ("libfieldFunctionObjects.so");
writeControl timeStep;//outputTime;
writeInterval 1;
@ -167,7 +168,8 @@ functions
globalMass
{
type volRegion;
//type volRegion; // OF4
type volFieldValue; // OF5,OF6
libs ("libfieldFunctionObjects.so");
writeControl timeStep;//outputTime;
writeInterval 1;
@ -185,7 +187,8 @@ functions
inflow_GasSpecies
{
type surfaceRegion;
//type surfaceRegion; // OF4
type surfaceFieldValue; // OF5,OF6
libs ("libfieldFunctionObjects.so");
writeControl timeStep;
writeInterval 100;
@ -208,7 +211,8 @@ functions
inflow_phi
{
type surfaceRegion;
//type surfaceRegion; // OF4
type surfaceFieldValue; // OF5,OF6
libs ("libfieldFunctionObjects.so");
writeControl timeStep;
writeInterval 100;
@ -227,7 +231,8 @@ functions
inflow_U
{
type surfaceRegion;
//type surfaceRegion; // OF4
type surfaceFieldValue; // OF5,OF6
libs ("libfieldFunctionObjects.so");
writeControl timeStep;
writeInterval 100;

View File

@ -22,7 +22,10 @@ limitedTemperature
{
active yes;
selectionMode all;
Tmin 1020;
Tmax 1500;
Tmin 1020; // OF4
Tmax 1500; // OF4
min $Tmin; // OF5,OF6
max $Tmax; // OF5,OF6
}
}

View File

@ -15,11 +15,14 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
combustionModel noCombustion<rhoThermoCombustion>;
// OF5 -> OF6: noCombustion<> -> none (template parameters are no longer required)
//combustionModel noCombustion<rhoThermoCombustion>; // OF4,OF5
combustionModel none; // OF6
active false; //true;
noCombustionCoeffs
//noCombustionCoeffs
noneCoeffs
{
}

View File

@ -143,7 +143,8 @@ functions
globalMassFrac
{
type volRegion;
//type volRegion; // OF4
type volFieldValue; // OF5,OF6
libs ("libfieldFunctionObjects.so");
writeControl timeStep;//outputTime;
writeInterval 1;
@ -165,7 +166,8 @@ functions
globalMass
{
type volRegion;
//type volRegion; // OF4
type volFieldValue; // OF5,OF6
libs ("libfieldFunctionObjects.so");
writeControl timeStep;//outputTime;
writeInterval 1;

View File

@ -22,8 +22,10 @@ limitedTemperature
{
active yes;
selectionMode all;
Tmin 1200;
Tmax 2500;
Tmin 1200; // OF4
Tmax 2500; // OF4
min $Tmin; // OF5,OF6
max $Tmax; // OF5,OF6
}
}

View File

@ -15,11 +15,14 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
combustionModel noCombustion<rhoThermoCombustion>; //PaSR<rhoChemistryCombustion>; //PaSR<psiChemistryCombustion>;
// OF5 -> OF6: noCombustion<> -> none (template parameters are no longer required)
//combustionModel noCombustion<rhoThermoCombustion>; //PaSR<rhoChemistryCombustion>; //PaSR<psiChemistryCombustion>;
combustionModel none; // OF6
active false; //true;
noCombustionCoeffs
//noCombustionCoeffs
noneCoeffs
{
}

View File

@ -142,7 +142,8 @@ functions
globalMassFrac
{
type volRegion;
//type volRegion; // OF4
type volFieldValue; // OF5,OF6
libs ("libfieldFunctionObjects.so");
writeControl timeStep;//outputTime;
writeInterval 1;
@ -164,7 +165,8 @@ functions
globalMass
{
type volRegion;
//type volRegion; // OF4
type volFieldValue; // OF5,OF6
libs ("libfieldFunctionObjects.so");
writeControl timeStep;//outputTime;
writeInterval 1;

View File

@ -22,8 +22,10 @@ limitedTemperature
{
active yes;
selectionMode all;
Tmin 1200;
Tmax 2500;
Tmin 1200; // OF4
Tmax 2500; // OF4
min $Tmin; // OF5,OF6
max $Tmax; // OF5,OF6
}
}

View File

@ -15,11 +15,14 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
combustionModel noCombustion<rhoThermoCombustion>; //PaSR<rhoChemistryCombustion>; //PaSR<psiChemistryCombustion>;
// OF5 -> OF6: noCombustion<> -> none (template parameters are no longer required)
//combustionModel noCombustion<rhoThermoCombustion>; //PaSR<rhoChemistryCombustion>; //PaSR<psiChemistryCombustion>;
combustionModel none; // OF6
active false; //true;
noCombustionCoeffs
//noCombustionCoeffs
noneCoeffs
{
}

View File

@ -136,7 +136,8 @@ functions
globalMassFrac
{
type volRegion;
//type volRegion; // OF4
type volFieldValue; // OF5,OF6
libs ("libfieldFunctionObjects.so");
writeControl timeStep;//outputTime;
writeInterval 1;
@ -156,7 +157,8 @@ functions
globalMass
{
type volRegion;
//type volRegion; // OF4
type volFieldValue; // OF5,OF6
libs ("libfieldFunctionObjects.so");
writeControl timeStep;//outputTime;
writeInterval 1;

View File

@ -22,9 +22,10 @@ limitedTemperature
{
active yes;
selectionMode all;
Tmin 1200;
Tmax 2500;
Tmin 1200; // OF4
Tmax 2500; // OF4
min $Tmin; // OF5,OF6
max $Tmax; // OF5,OF6
}
}

View File

@ -15,11 +15,14 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
combustionModel noCombustion<rhoThermoCombustion>; //PaSR<rhoChemistryCombustion>; //PaSR<psiChemistryCombustion>;
// OF5 -> OF6: noCombustion<> -> none (template parameters are no longer required)
//combustionModel noCombustion<rhoThermoCombustion>; //PaSR<rhoChemistryCombustion>; //PaSR<psiChemistryCombustion>;
combustionModel none; // OF6
active false; //true;
noCombustionCoeffs
//noCombustionCoeffs
noneCoeffs
{
}

View File

@ -136,7 +136,8 @@ functions
globalMassFrac
{
type volRegion;
//type volRegion; // OF4
type volFieldValue; // OF5,OF6
libs ("libfieldFunctionObjects.so");
writeControl timeStep;//outputTime;
writeInterval 1;
@ -156,7 +157,8 @@ functions
globalMass
{
type volRegion;
//type volRegion; // OF4
type volFieldValue; // OF5,OF6
libs ("libfieldFunctionObjects.so");
writeControl timeStep;//outputTime;
writeInterval 1;

View File

@ -22,8 +22,10 @@ limitedTemperature
{
active yes;
selectionMode all;
Tmin 1200;
Tmax 2500;
Tmin 1200; // OF4
Tmax 2500; // OF4
min $Tmin; // OF5,OF6
max $Tmax; // OF5,OF6
}
}