Merge branch 'feature/fines' of https://github.com/ParticulateFlow/CFDEMcoupling into feature/fines

This commit is contained in:
Thomas Lichtenegger
2017-01-17 11:25:38 +01:00
9 changed files with 282 additions and 22 deletions

View File

@ -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");
}

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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;
}

View File

@ -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();
}

View File

@ -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 <http://www.gnu.org/licenses/>.
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<volVectorField> (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
// ************************************************************************* //

View File

@ -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 <http://www.gnu.org/licenses/>.
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
// ************************************************************************* //

View File

@ -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