diff --git a/applications/solvers/cfdemSolverRhoPimple/EEqn.H b/applications/solvers/cfdemSolverRhoPimple/EEqn.H index fb22d769..606d9fe2 100644 --- a/applications/solvers/cfdemSolverRhoPimple/EEqn.H +++ b/applications/solvers/cfdemSolverRhoPimple/EEqn.H @@ -4,11 +4,10 @@ // dim he = J / kg volScalarField& he = thermo.he(); particleCloud.energyContributions(Qsource); + particleCloud.energyCoefficients(QCoeff); - thDiff=particleCloud.thermCondM().thermDiff(); - // BC for thDiff are calculated from its mathematical expression - // to enforce user-defined values, change thDiff to MUST_READ and do - // thDiff.correctBoundaryConditions(); + //thDiff=particleCloud.thermCondM().thermDiff(); + thCond=particleCloud.thermCondM().thermCond(); addSource = fvc::ddt(rhoeps, K) + fvc::div(phi, K) + ( @@ -22,6 +21,8 @@ : -dpdt ); + Cpv = he.name() == "e" ? thermo.Cv() : thermo.Cp(); + fvScalarMatrix EEqn ( @@ -29,21 +30,16 @@ + addSource // net heat transfer from particles to fluid - Qsource + - fvm::Sp(QCoeff/Cpv, he) // thermal conduction of the fluid with effective conductivity - - fvm::laplacian(rhoeps*thDiff,he) - + // - fvm::laplacian(rhoeps*thDiff,he) + - fvm::laplacian(voidfraction*thCond/Cpv,he) // + particle-fluid energy transfer due to work // + fluid energy dissipation due to shearing == fvOptions(rho, he) ); - - // work in progress: - // if (particleCloud.implicitEnergyModel) - // volScalarField& tpart (lookup ...) - // particleCloud.energyCoefficients(Qcoeff); - // EEqn += ... EEqn.relax(); @@ -56,4 +52,8 @@ thermo.correct(); Info<< "T max/min : " << max(T).value() << " " << min(T).value() << endl; + + particleCloud.clockM().start(31,"postFlow"); + particleCloud.postFlow(); + particleCloud.clockM().stop("postFlow"); } diff --git a/applications/solvers/cfdemSolverRhoPimple/createFields.H b/applications/solvers/cfdemSolverRhoPimple/createFields.H index ab5b1d13..eac9a5a7 100644 --- a/applications/solvers/cfdemSolverRhoPimple/createFields.H +++ b/applications/solvers/cfdemSolverRhoPimple/createFields.H @@ -83,11 +83,11 @@ Info<< "Reading thermophysical properties\n" << endl; ); Info<< "\nCreating fluid-particle heat flux coefficient field\n" << endl; - volScalarField Qcoeff + volScalarField QCoeff ( IOobject ( - "Qcoeff", + "QCoeff", runTime.timeName(), mesh, IOobject::NO_READ, @@ -97,7 +97,7 @@ Info<< "Reading thermophysical properties\n" << endl; dimensionedScalar("zero", dimensionSet(1,-1,-3,-1,0,0,0), 0.0) ); - Info<< "\nCreating thermal diffusivity field\n" << endl; + /* Info<< "\nCreating thermal diffusivity field\n" << endl; volScalarField thDiff ( IOobject @@ -111,6 +111,36 @@ Info<< "Reading thermophysical properties\n" << endl; mesh, dimensionedScalar("zero", dimensionSet(0,2,-1,0,0,0,0), 0.0) ); + */ + Info<< "\nCreating thermal conductivity field\n" << endl; + volScalarField thCond + ( + IOobject + ( + "thCond", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + mesh, + dimensionedScalar("zero", dimensionSet(1,1,-3,-1,0,0,0), 0.0) + ); + + Info<< "\nCreating heat capacity field\n" << endl; + volScalarField Cpv + ( + IOobject + ( + "Cpv", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + mesh, + dimensionedScalar("zero", dimensionSet(0,2,-2,-1,0,0,0), 0.0) + ); Info<< "\nCreating body force field\n" << endl; volVectorField fOther diff --git a/src/lagrangian/cfdemParticle/Make/files b/src/lagrangian/cfdemParticle/Make/files index 20f292bb..6ddd9cc6 100644 --- a/src/lagrangian/cfdemParticle/Make/files +++ b/src/lagrangian/cfdemParticle/Make/files @@ -68,6 +68,7 @@ $(forceModels)/Fines/Fines.C $(forceModels)/Fines/FinesFields.C $(forceModels)/Fines/FanningDynFines.C $(forceModels)/Fines/ErgunStatFines.C +$(forceModels)/granKineticEnergy/granKineticEnergy.C $(forceModelsMS)/forceModelMS/forceModelMS.C $(forceModelsMS)/forceModelMS/newForceModelMS.C diff --git a/src/lagrangian/cfdemParticle/subModels/averagingModel/dense/dense.C b/src/lagrangian/cfdemParticle/subModels/averagingModel/dense/dense.C index 5e567886..d1d8d345 100644 --- a/src/lagrangian/cfdemParticle/subModels/averagingModel/dense/dense.C +++ b/src/lagrangian/cfdemParticle/subModels/averagingModel/dense/dense.C @@ -101,7 +101,7 @@ void dense::setScalarAverage if (cellI >= 0) { valueScal = value[index][0]; - weightP = weight[index][0]; + weightP = weight[index][subCell]; // first entry in this cell if(weightField[cellI] == 0) diff --git a/src/lagrangian/cfdemParticle/subModels/energyModel/heatTransferGunn/heatTransferGunn.C b/src/lagrangian/cfdemParticle/subModels/energyModel/heatTransferGunn/heatTransferGunn.C index 336648b9..4959ca76 100644 --- a/src/lagrangian/cfdemParticle/subModels/energyModel/heatTransferGunn/heatTransferGunn.C +++ b/src/lagrangian/cfdemParticle/subModels/energyModel/heatTransferGunn/heatTransferGunn.C @@ -201,10 +201,9 @@ void heatTransferGunn::calcEnergyContribution() particleCloud_.averagingM().UsWeightField(), NULL ); - volScalarField volP (1 - voidfraction_); - volScalarField weigthedTp (volP * partTempField_); - // average per cell-value, not per volume * cell-value - dimensionedScalar aveTemp = weigthedTp.average() / volP.average(); + + volScalarField sumTp (particleCloud_.averagingM().UsWeightField() * partTempField_); + dimensionedScalar aveTemp("aveTemp",dimensionSet(0,0,0,1,0,0,0), gSum(sumTp) / particleCloud_.numberOfParticles()); partRelTempField_ = (partTempField_ - aveTemp) / (aveTemp - partRefTemp_); Info << "heatTransferGunn: average part. temp = " << aveTemp.value() << endl; } diff --git a/src/lagrangian/cfdemParticle/subModels/energyModel/heatTransferGunnImplicit/heatTransferGunnImplicit.C b/src/lagrangian/cfdemParticle/subModels/energyModel/heatTransferGunnImplicit/heatTransferGunnImplicit.C index 3886a934..a204f6ca 100644 --- a/src/lagrangian/cfdemParticle/subModels/energyModel/heatTransferGunnImplicit/heatTransferGunnImplicit.C +++ b/src/lagrangian/cfdemParticle/subModels/energyModel/heatTransferGunnImplicit/heatTransferGunnImplicit.C @@ -74,7 +74,7 @@ heatTransferGunnImplicit::~heatTransferGunnImplicit() // * * * * * * * * * * * * * * * private Member Functions * * * * * * * * * * * * * // void heatTransferGunnImplicit::allocateMyArrays() const { - heatTransferGunn::allocateMyArrays(); +// heatTransferGunn::allocateMyArrays(); double initVal=0.0; particleCloud_.dataExchangeM().allocateArray(partHeatFluxCoeff_,initVal,1); } @@ -82,7 +82,11 @@ void heatTransferGunnImplicit::allocateMyArrays() const void heatTransferGunnImplicit::calcEnergyContribution() { + allocateMyArrays(); + heatTransferGunn::calcEnergyContribution(); + + QPartFluidCoeff_.primitiveFieldRef() = 0.0; particleCloud_.averagingM().setScalarSum ( @@ -94,7 +98,7 @@ void heatTransferGunnImplicit::calcEnergyContribution() QPartFluidCoeff_.primitiveFieldRef() /= -QPartFluidCoeff_.mesh().V(); - QPartFluidCoeff_.correctBoundaryConditions(); +// QPartFluidCoeff_.correctBoundaryConditions(); } diff --git a/src/lagrangian/cfdemParticle/subModels/forceModel/granKineticEnergy/granKineticEnergy.C b/src/lagrangian/cfdemParticle/subModels/forceModel/granKineticEnergy/granKineticEnergy.C new file mode 100644 index 00000000..350b20cb --- /dev/null +++ b/src/lagrangian/cfdemParticle/subModels/forceModel/granKineticEnergy/granKineticEnergy.C @@ -0,0 +1,136 @@ +/*---------------------------------------------------------------------------*\ +License + This 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. + This code 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 this code. If not, see . + + Copyright (C) 2015- Thomas Lichtenegger, JKU Linz, Austria + +Description + calculates the Sauter mean diameter \sum d_i^3 / \sum d_i^2 + +SourceFiles + granKineticEnergy.C +\*---------------------------------------------------------------------------*/ + +#include "error.H" + +#include "granKineticEnergy.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(granKineticEnergy, 0); + +addToRunTimeSelectionTable +( + forceModel, + granKineticEnergy, + dictionary +); + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +// Construct from components +granKineticEnergy::granKineticEnergy +( + const dictionary& dict, + cfdemCloud& sm +) +: + forceModel(dict,sm), + propsDict_(dict.subDict(typeName + "Props")), + vfluc_(NULL), + UsFieldName_(propsDict_.lookup("granVelFieldName")), + UsField_(sm.mesh().lookupObject (UsFieldName_)), + granKineticEnergy_ + ( IOobject + ( + "granKineticEnergy", + sm.mesh().time().timeName(), + sm.mesh(), + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + sm.mesh(), + dimensionedScalar("zero", dimensionSet(0,2,-2,0,0), 0), + "zeroGradient" + ) +{ + allocateMyArrays(); + granKineticEnergy_.write(); + + + // init force sub model + setForceSubModels(propsDict_); +} + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +granKineticEnergy::~granKineticEnergy() +{ + delete vfluc_; +} + +// * * * * * * * * * * * * * * * private Member Functions * * * * * * * * * * * * * // +void granKineticEnergy::allocateMyArrays() const +{ + // get memory for 2d arrays + double initVal=0.0; + particleCloud_.dataExchangeM().allocateArray(vfluc_,initVal,1); +} +// * * * * * * * * * * * * * * * public Member Functions * * * * * * * * * * * * * // + +void granKineticEnergy::setForce() const +{ + allocateMyArrays(); + + label cellI=0; + vector velfluc(0,0,0); + + + for(int index = 0;index < particleCloud_.numberOfParticles(); ++index) + { + cellI = particleCloud_.cellIDs()[index][0]; + if(cellI >= 0) + { + velfluc = particleCloud_.velocity(index) - UsField_[cellI]; + vfluc_[index][0] = magSqr(velfluc); + } + } + + granKineticEnergy_.primitiveFieldRef() = 0.0; + + particleCloud_.averagingM().resetWeightFields(); + particleCloud_.averagingM().setScalarAverage + ( + granKineticEnergy_, + vfluc_, + particleCloud_.particleWeights(), + particleCloud_.averagingM().UsWeightField(), + NULL + ); + + granKineticEnergy_ *= 0.5; + +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/lagrangian/cfdemParticle/subModels/forceModel/granKineticEnergy/granKineticEnergy.H b/src/lagrangian/cfdemParticle/subModels/forceModel/granKineticEnergy/granKineticEnergy.H new file mode 100644 index 00000000..8cc189b6 --- /dev/null +++ b/src/lagrangian/cfdemParticle/subModels/forceModel/granKineticEnergy/granKineticEnergy.H @@ -0,0 +1,89 @@ +/*---------------------------------------------------------------------------*\ +License + This 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. + This code 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 this code. If not, see . + + Copyright (C) 2015- Thomas Lichtenegger, JKU Linz, Austria + +Description + calculates the granular kinetic energy + +SourceFiles + granKineticEnergy.C +\*---------------------------------------------------------------------------*/ + +#ifndef granKineticEnergy_H +#define granKineticEnergy_H + +#include "forceModel.H" +#include "averagingModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class granKineticEnergy Declaration +\*---------------------------------------------------------------------------*/ + +class granKineticEnergy +: + public forceModel +{ +private: + + dictionary propsDict_; + + mutable double **vfluc_; + + mutable volScalarField granKineticEnergy_; + + word UsFieldName_; + + const volVectorField& UsField_; + + void allocateMyArrays() const; + +public: + + //- Runtime type information + TypeName("granKineticEnergy"); + + // Constructors + + //- Construct from components + granKineticEnergy + ( + const dictionary& dict, + cfdemCloud& sm + ); + + // Destructor + + ~granKineticEnergy(); + + + // Member Functions + void setForce() const; + +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/cfdemParticleComp/Make/files b/src/lagrangian/cfdemParticleComp/Make/files index f1fca6d9..b119a3b3 100644 --- a/src/lagrangian/cfdemParticleComp/Make/files +++ b/src/lagrangian/cfdemParticleComp/Make/files @@ -64,6 +64,7 @@ $(forceModels)/Fines/Fines.C $(forceModels)/Fines/FinesFields.C $(forceModels)/Fines/FanningDynFines.C $(forceModels)/Fines/ErgunStatFines.C +$(forceModels)/granKineticEnergy/granKineticEnergy.C $(forceSubModels)/forceSubModel/newForceSubModel.C $(forceSubModels)/forceSubModel/forceSubModel.C