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 include $(CFDEM_ADD_LIBS_DIR)/additionalLibs
EXE_INC = \ EXE_INC = \
$(PFLAGS) \
-I$(CFDEM_OFVERSION_DIR) \ -I$(CFDEM_OFVERSION_DIR) \
-ImultiphaseMixture/lnInclude \ -ImultiphaseMixture/lnInclude \
-I$(LIB_SRC)/transportModels \ -I$(LIB_SRC)/transportModels \

View File

@ -46,6 +46,11 @@ Description
int main(int argc, char *argv[]) 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 "postProcess.H"
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.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 = \ EXE_INC = \
$(PFLAGS) \
-IalphaContactAngle \ -IalphaContactAngle \
-I$(LIB_SRC)/transportModels \ -I$(LIB_SRC)/transportModels \
-I$(LIB_SRC)/transportModels/incompressible/lnInclude \ -I$(LIB_SRC)/transportModels/incompressible/lnInclude \

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -23,4 +23,4 @@ EXE_LIBS = \
-lmeshTools \ -lmeshTools \
-l$(CFDEM_LIB_NAME) \ -l$(CFDEM_LIB_NAME) \
$(CFDEM_ADD_LIB_PATHS) \ $(CFDEM_ADD_LIB_PATHS) \
$(CFDEM_ADD_LIBS) $(CFDEM_ADD_LIBS)

View File

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

View File

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

View File

@ -69,15 +69,15 @@ int main(int argc, char *argv[])
#include "createFvOptions.H" #include "createFvOptions.H"
// create cfdemCloud // create cfdemCloud
// #include "readGravitationalAcceleration.H" //#include "readGravitationalAcceleration.H"
cfdemCloudRec<cfdemCloudEnergy> particleCloud(mesh); cfdemCloudRec<cfdemCloudEnergy> particleCloud(mesh);
#include "checkModelType.H" #include "checkModelType.H"
recBase recurrenceBase(mesh); recBase recurrenceBase(mesh);
#include "updateFields.H" #include "updateFields.H"
turbulence->validate(); turbulence->validate();
// #include "compressibleCourantNo.H" //#include "compressibleCourantNo.H"
// #include "setInitialDeltaT.H" //#include "setInitialDeltaT.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -108,8 +108,8 @@ int main(int argc, char *argv[])
particleCloud.clockM().start(2,"Coupling"); particleCloud.clockM().start(2,"Coupling");
bool hasEvolved = particleCloud.evolve(voidfraction,Us,U); bool hasEvolved = particleCloud.evolve(voidfraction,Us,U);
//voidfraction = voidfractionRec; //voidfraction = voidfractionRec;
//Us = UsRec; //Us = UsRec;
if(hasEvolved) if(hasEvolved)
{ {
@ -137,7 +137,11 @@ int main(int argc, char *argv[])
while (pimple.loop()) while (pimple.loop())
{ {
// if needed, perform drag update here // if needed, perform drag update here
#if OPENFOAM_VERSION_MAJOR < 6
if (pimple.nCorrPIMPLE() <= 1) if (pimple.nCorrPIMPLE() <= 1)
#else
if (pimple.nCorrPimple() <= 1)
#endif
{ {
#include "rhoEqn.H" #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. # Please set to the appropriate path if the default is not correct.
# #
# activate compatible OpenFOAM version # activate compatible OpenFOAM version
. $HOME/OpenFOAM/OpenFOAM-4.x/etc/bashrc . $HOME/OpenFOAM/OpenFOAM-6/etc/bashrc
# #
# CFDEMcoupling # CFDEMcoupling
export CFDEM_INST_DIR=$HOME/$CFDEM_PROJECT 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. # Please set to the appropriate path if the default is not correct.
# #
# activate compatible OpenFOAM version # activate compatible OpenFOAM version
. $HOME/OpenFOAM/OpenFOAM-4.x/etc/cshrc . $HOME/OpenFOAM/OpenFOAM-6/etc/cshrc
# #
# CFDEMcoupling # CFDEMcoupling
setenv CFDEM_INST_DIR $HOME/$CFDEM_PROJECT 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) GIT_VERSION := $(shell git describe --dirty --always --tags)
PFLAGS+= -DGITVERSION=\"$(GIT_VERSION)\" 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 include $(CFDEM_ADD_LIBS_DIR)/additionalLibs

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
CFDEMcoupling academic - Open Source CFD-DEM coupling CFDEMcoupling academic - Open Source CFD-DEM coupling
Contributing authors: Contributing authors:
Thomas Lichtenegger Thomas Lichtenegger
Copyright (C) 2015- Johannes Kepler University, Linz Copyright (C) 2015- Johannes Kepler University, Linz
@ -83,7 +83,7 @@ isotropicFluctuations::isotropicFluctuations
dimensionedScalar("D0", dimensionSet(0,0,0,0,0,0,0), D0_) dimensionedScalar("D0", dimensionSet(0,0,0,0,0,0,0), D0_)
), ),
dtDEM_(particleCloud_.dataExchangeM().DEMts()), dtDEM_(particleCloud_.dataExchangeM().DEMts()),
ranGen_(osRandomInteger()) ranGen_(clock::getTime()+pid())
{ {
if(ignoreCellsName_ != "none") if(ignoreCellsName_ != "none")
{ {
@ -122,10 +122,10 @@ void isotropicFluctuations::setForce() const
vector flucU(0,0,0); vector flucU(0,0,0);
label cellI=0; label cellI=0;
scalar relVolfractionExcess(0.0); scalar relVolfractionExcess(0.0);
interpolationCellPoint<scalar> voidfractionInterpolator_(voidfraction_); interpolationCellPoint<scalar> voidfractionInterpolator_(voidfraction_);
interpolationCellPoint<scalar> voidfractionRecInterpolator_(voidfractionRec_); interpolationCellPoint<scalar> voidfractionRecInterpolator_(voidfractionRec_);
for(int index = 0;index < particleCloud_.numberOfParticles(); ++index) for(int index = 0;index < particleCloud_.numberOfParticles(); ++index)
{ {
cellI = particleCloud_.cellIDs()[index][0]; cellI = particleCloud_.cellIDs()[index][0];
@ -151,14 +151,14 @@ void isotropicFluctuations::setForce() const
voidfractionRec = voidfractionRec_[cellI]; voidfractionRec = voidfractionRec_[cellI];
} }
// write particle based data to global array // write particle based data to global array
deltaVoidfrac=voidfractionRec-voidfraction; deltaVoidfrac=voidfractionRec-voidfraction;
relVolfractionExcess=deltaVoidfrac/(1-voidfraction+SMALL); relVolfractionExcess=deltaVoidfrac/(1-voidfraction+SMALL);
if(deltaVoidfrac>0) if(deltaVoidfrac>0)
{ {
D = D0Field_[cellI]; D = D0Field_[cellI];
flucU=unitFlucDir()*fluctuationMag(relVolfractionExcess,D); flucU=unitFlucDir()*fluctuationMag(relVolfractionExcess,D);
} }
// write particle based data to global array // write particle based data to global array
for(int j=0;j<3;j++) for(int j=0;j<3;j++)
@ -168,11 +168,11 @@ void isotropicFluctuations::setForce() const
} }
} }
} }
if (measureDiff_) if (measureDiff_)
{ {
dimensionedScalar diff( fvc::domainIntegrate( sqr( voidfraction_ - voidfractionRec_ ) ) ); dimensionedScalar diff( fvc::domainIntegrate( sqr( voidfraction_ - voidfractionRec_ ) ) );
scalar t = particleCloud_.mesh().time().timeOutputValue(); scalar t = particleCloud_.mesh().time().timeOutputValue();
recErrorFile_ << t << "\t" << diff.value() << endl; recErrorFile_ << t << "\t" << diff.value() << endl;
} }
} }

View File

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

View File

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

View File

@ -1,6 +1,9 @@
GIT_VERSION := $(shell git describe --abbrev=4 --dirty --always --tags) GIT_VERSION := $(shell git describe --abbrev=4 --dirty --always --tags)
PFLAGS+= -DGITVERSION=\"$(GIT_VERSION)\" 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 include $(CFDEM_ADD_LIBS_DIR)/additionalLibs
EXE_INC = \ EXE_INC = \

View File

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

View File

@ -226,7 +226,11 @@ scalar gerhardsRecModel::checkTimeStep()
} }
// set deltaT // set deltaT
#if OPENFOAM_VERSION_MAJOR < 6
recTime.setDeltaT(dtCur, false); recTime.setDeltaT(dtCur, false);
#else
recTime.setDeltaT(dtCur);
#endif
if (verbose_) if (verbose_)
{ {
@ -296,7 +300,11 @@ void gerhardsRecModel::readFieldSeries()
for OpenFOAM versions prior to OpenFOAM-5.0 for OpenFOAM versions prior to OpenFOAM-5.0
Do this the other way around for OpenFOAM-5.0 and potentially later versions Do this the other way around for OpenFOAM-5.0 and potentially later versions
*/ */
#if OPENFOAM_VERSION_MAJOR < 5
if (! header.headerOk()) if (! header.headerOk())
#else
if (! header.typeHeaderOk<volScalarField>(true))
#endif
{ {
FatalError FatalError
<< "Field " << volScalarFieldNames_[i] << " not found" << "Field " << volScalarFieldNames_[i] << " not found"
@ -320,7 +328,11 @@ void gerhardsRecModel::readFieldSeries()
for OpenFOAM versions prior to OpenFOAM-5.0 for OpenFOAM versions prior to OpenFOAM-5.0
Do this the other way around for OpenFOAM-5.0 and potentially later versions Do this the other way around for OpenFOAM-5.0 and potentially later versions
*/ */
#if OPENFOAM_VERSION_MAJOR < 5
if (! header.headerOk()) if (! header.headerOk())
#else
if (! header.typeHeaderOk<volVectorField>(true))
#endif
{ {
FatalError FatalError
<< "Field " << volVectorFieldNames_[i] << " not found" << "Field " << volVectorFieldNames_[i] << " not found"
@ -344,7 +356,11 @@ void gerhardsRecModel::readFieldSeries()
for OpenFOAM versions prior to OpenFOAM-5.0 for OpenFOAM versions prior to OpenFOAM-5.0
Do this the other way around for OpenFOAM-5.0 and potentially later versions Do this the other way around for OpenFOAM-5.0 and potentially later versions
*/ */
#if OPENFOAM_VERSION_MAJOR < 5
if (! header.headerOk()) if (! header.headerOk())
#else
if (! header.typeHeaderOk<surfaceScalarField>(true))
#endif
{ {
FatalError FatalError
<< "Field " << surfaceScalarFieldNames_[i] << " not found" << "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() SymmetricSquareMatrix<scalar>& gerhardsRecModel::recurrenceMatrix()

View File

@ -100,9 +100,9 @@ protected:
scalar checkTimeStep(); scalar checkTimeStep();
inline label getVolScalarFieldIndex(word, label) const; inline label getVolScalarFieldIndex(word, label=0) const;
inline label getVolVectorFieldIndex(word, label) const; inline label getVolVectorFieldIndex(word, label=0) const;
inline label getSurfaceScalarFieldIndex(word, label) const; inline label getSurfaceScalarFieldIndex(word, label=0) const;
void readFieldSeries(); void readFieldSeries();
@ -143,7 +143,11 @@ public:
const volVectorField& exportVolVectorField(word, label); const volVectorField& exportVolVectorField(word, label);
const surfaceScalarField& exportSurfaceScalarField(word, label); const surfaceScalarField& exportSurfaceScalarField(word, label);
// tmp<surfaceScalarField> exportAveragedSurfaceScalarField(word, scalar, label index = -1); 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; void exportAveragedVolVectorField(volVectorField&, word, scalar, label index = -1) const;
SymmetricSquareMatrix<scalar>& recurrenceMatrix(); SymmetricSquareMatrix<scalar>& recurrenceMatrix();

View File

@ -92,7 +92,7 @@ MarkovPath::MarkovPath
} }
intervalSizesCumulative_[i] = sum1; intervalSizesCumulative_[i] = sum1;
} }
// check if meanIntervalSteps and correlationSteps are reasonable // check if meanIntervalSteps and correlationSteps are reasonable
label critLength = meanIntervalSteps_ + 2 * correlationSteps_; label critLength = meanIntervalSteps_ + 2 * correlationSteps_;
for(int i=0;i<numIntervals_;i++) for(int i=0;i<numIntervals_;i++)
@ -150,7 +150,7 @@ void MarkovPath::computeRecPath()
void MarkovPath::extendPath() void MarkovPath::extendPath()
{ {
Random ranGen(osRandomInteger()); Random ranGen(clock::getTime()+pid());
SymmetricSquareMatrix<scalar>& recurrenceMatrix( base_.recM().recurrenceMatrix() ); 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; Info << "\nComputing recurrence path\n" << endl;
Random ranGen(clock::getTime()+pid());
Random ranGen(osRandomInteger());
label virtualTimeIndex = 0; label virtualTimeIndex = 0;
label recSteps = 0; label recSteps = 0;
label seqStart = 0; label seqStart = 0;
label lowerSeqLim( base_.recM().lowerSeqLim() ); label lowerSeqLim( base_.recM().lowerSeqLim() );
label upperSeqLim( base_.recM().upperSeqLim() ); label upperSeqLim( base_.recM().upperSeqLim() );
#if OPENFOAM_VERSION_MAJOR < 6
label seqLength = ranGen.integer(lowerSeqLim, upperSeqLim); label seqLength = ranGen.integer(lowerSeqLim, upperSeqLim);
#else
label seqLength = ranGen.sampleAB(lowerSeqLim, upperSeqLim);
#endif
virtualTimeIndex = seqEnd(seqStart,seqLength); virtualTimeIndex = seqEnd(seqStart,seqLength);
labelPair seqStartEnd(seqStart,virtualTimeIndex); labelPair seqStartEnd(seqStart,virtualTimeIndex);
@ -123,7 +126,11 @@ void simpleRandomPath::computeRecPath()
} }
} }
#if OPENFOAM_VERSION_MAJOR < 6
seqLength = ranGen.integer(lowerSeqLim, upperSeqLim); seqLength = ranGen.integer(lowerSeqLim, upperSeqLim);
#else
seqLength = ranGen.sampleAB(lowerSeqLim, upperSeqLim);
#endif
virtualTimeIndex = seqEnd(seqStart,seqLength); virtualTimeIndex = seqEnd(seqStart,seqLength);
labelPair seqStartEnd(seqStart,virtualTimeIndex); labelPair seqStartEnd(seqStart,virtualTimeIndex);
virtualTimeIndexList_.append(seqStartEnd); virtualTimeIndexList_.append(seqStartEnd);

View File

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

View File

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

View File

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

View File

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

View File

@ -14,6 +14,9 @@ name outlet;
fields (alpha.air alpha.water alpha.oil); fields (alpha.air alpha.water alpha.oil);
operation average; 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

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

View File

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

View File

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

View File

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

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; stopAt endTime;
endTime 0.5; endTime 2.0;
deltaT 0.00025; deltaT 0.00025;

View File

@ -1,6 +1,91 @@
#!/bin/bash #!/bin/bash
cd CFD #===================================================================#
blockMesh # allrun script for testcase as part of test routine
decomposePar -force # run Ergun test CFD part
mpirun -np 4 cfdemSolverRhoPimple -parallel #===================================================================#
#- 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; active false; //true;
noCombustionCoeffs //noCombustionCoeffs
noneCoeffs
{ {
} }

View File

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

View File

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

View File

@ -22,7 +22,10 @@ limitedTemperature
{ {
active yes; active yes;
selectionMode all; selectionMode all;
Tmin 1020; Tmin 1020; // OF4
Tmax 1500; 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; active false; //true;
noCombustionCoeffs //noCombustionCoeffs
noneCoeffs
{ {
} }

View File

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

View File

@ -22,8 +22,10 @@ limitedTemperature
{ {
active yes; active yes;
selectionMode all; selectionMode all;
Tmin 1200; Tmin 1200; // OF4
Tmax 2500; 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; active false; //true;
noCombustionCoeffs //noCombustionCoeffs
noneCoeffs
{ {
} }

View File

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

View File

@ -22,8 +22,10 @@ limitedTemperature
{ {
active yes; active yes;
selectionMode all; selectionMode all;
Tmin 1200; Tmin 1200; // OF4
Tmax 2500; 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; active false; //true;
noCombustionCoeffs //noCombustionCoeffs
noneCoeffs
{ {
} }

View File

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

View File

@ -22,9 +22,10 @@ limitedTemperature
{ {
active yes; active yes;
selectionMode all; selectionMode all;
Tmin 1200; Tmin 1200; // OF4
Tmax 2500; 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; active false; //true;
noCombustionCoeffs //noCombustionCoeffs
noneCoeffs
{ {
} }

View File

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

View File

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