Merge remote-tracking branch 'refs/remotes/origin/feature/cfdemSolverRhoPimple' into feature/cfdemSolverRhoPimple

This commit is contained in:
ekinaci
2017-11-08 16:28:34 +01:00
9 changed files with 307 additions and 5 deletions

View File

@ -42,7 +42,7 @@ tmp<fv::convectionScheme<scalar> > mvConvection
fvOptions.correct(Yi);
// #include "debugYEqn.H"
#include "debugYEqn.H"
Yi.max(0.0);
Yt += Yi;

View File

@ -18,10 +18,10 @@
artMass[cellI] *=0.0;
}
}
Info << "\nartificial mass of " << Y[i].name() << " per time step: "<< fvc::domainIntegrate(artMass) << endl;
Info << "\nartificial mass of species " << Y[i].name() << " per time step: "<< fvc::domainIntegrate(artMass) << endl;
if(lVCell > -1)
{
Info << "lowest value of " << lowestValue << " at cell " << lVCell << "with coordinates" << endl;
Info << "\t" << mesh.C()[lVCell].component(0) << "\t" << mesh.C()[lVCell].component(1) << "\t" << mesh.C()[lVCell].component(2) << endl;
Pout << "lowest value of " << lowestValue << " at cell " << lVCell << " with coordinates" << endl;
Pout << "\t" << mesh.C()[lVCell].component(0) << "\t" << mesh.C()[lVCell].component(1) << "\t" << mesh.C()[lVCell].component(2) << endl;
}
}

View File

@ -35,6 +35,7 @@ $(chemistryModels)/species/species.C
$(chemistryModels)/noChemistry/noChemistry.C
$(chemistryModels)/diffusionCoefficients/diffusionCoefficients.C
$(chemistryModels)/massTransferCoeff/massTransferCoeff.C
$(chemistryModels)/reactantPerParticle/reactantPerParticle.C
$(energyModels)/energyModel/energyModel.C
$(energyModels)/energyModel/newEnergyModel.C

View File

@ -229,6 +229,31 @@ void averagingModel::setScalarSum
field.correctBoundaryConditions();
}
void averagingModel::setScalarSumCentre
(
volScalarField& field,
double**& value,
double**const& weight,
double**const& mask
) const
{
label cellI;
scalar valueScal;
for(int index=0; index< particleCloud_.numberOfParticles(); index++)
{
cellI = particleCloud_.cellIDs()[index][0];
if (cellI >= 0)
{
valueScal = value[index][0];
field[cellI] += valueScal;
}
}
// correct cell values to patches
field.correctBoundaryConditions();
}
void averagingModel::setDSauter
(
volScalarField& dSauter,

View File

@ -175,6 +175,14 @@ public:
double**const& weight,
double**const& mask
) const;
void setScalarSumCentre
(
volScalarField& field,
double**& value,
double**const& weight,
double**const& mask
) const;
void setDSauter
(

View File

@ -0,0 +1,162 @@
/*---------------------------------------------------------------------------*\
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
M.Efe Kinaci, JKU Linz, Austria
\*---------------------------------------------------------------------------*/
#include "error.H"
#include "reactantPerParticle.H"
#include "addToRunTimeSelectionTable.H"
#include "dataExchangeModel.H"
#include "IFstream.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(reactantPerParticle, 0);
addToRunTimeSelectionTable
(
chemistryModel,
reactantPerParticle,
dictionary
);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
reactantPerParticle::reactantPerParticle
(
const dictionary& dict,
cfdemCloudEnergy& sm
)
:
chemistryModel(dict,sm),
propsDict_(dict.subDict(typeName + "Props")),
mesh_(sm.mesh()),
reactantPerParticle_(NULL),
voidfractionFieldName_(propsDict_.lookupOrDefault<word>("voidfractionFieldName","voidfraction")),
voidfraction_(sm.mesh().lookupObject<volScalarField>(voidfractionFieldName_)),
particlesPerCell_
( IOobject
(
"particlesPerCell",
sm.mesh().time().timeName(),
sm.mesh(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
sm.mesh(),
dimensionedScalar("zero", dimensionSet(0,0,0,0,0), 0)
),
loopCounter_(-1),
Nevery_(propsDict_.lookupOrDefault<label>("Nevery",1))
{
particleCloud_.checkCG(false);
allocateMyArrays();
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
reactantPerParticle::~reactantPerParticle()
{
particleCloud_.dataExchangeM().destroy(reactantPerParticle_,1);
}
// * * * * * * * * * * * * * * * private Member Functions * * * * * * * * * * * * * //
void reactantPerParticle::allocateMyArrays() const
{
double initVal=0.0;
if (particleCloud_.dataExchangeM().maxNumberOfParticles() > 0)
{
// get memory for 2d arrays
particleCloud_.dataExchangeM().allocateArray(reactantPerParticle_,initVal,1,"nparticles");
}
}
void reactantPerParticle::reAllocMyArrays() const
{
if (particleCloud_.numberOfParticlesChanged())
{
double initVal=0.0;
particleCloud_.dataExchangeM().allocateArray(reactantPerParticle_,initVal,1);
}
}
// * * * * * * * * * * * * * * * * Member Fct * * * * * * * * * * * * * * * //
void reactantPerParticle::execute()
{
loopCounter_++;
if (loopCounter_ % Nevery_ != 0)
{
return;
}
// realloc the arrays
reAllocMyArrays();
particlesPerCell_ *= 0.0;
label cellI=0;
scalar voidfraction(1);
scalar cellvolume(0.0);
scalar particlesPerCell(1.0);
// first create particles per cell field
for (int index=0; index<particleCloud_.numberOfParticles(); ++index)
{
cellI=particleCloud_.cellIDs()[index][0];
if (cellI >= 0)
{
particlesPerCell_[cellI] += 1.0;
}
}
// no fill array and communicate it
for (int index=0; index<particleCloud_.numberOfParticles(); ++index)
{
cellI=particleCloud_.cellIDs()[index][0];
if (cellI >= 0)
{
voidfraction = voidfraction_[cellI];
cellvolume = mesh_.V()[cellI];
particlesPerCell= particlesPerCell_[cellI];
reactantPerParticle_[index][0] = voidfraction * cellvolume / particlesPerCell;
}
}
// give DEM data
particleCloud_.dataExchangeM().giveData("reactantPerParticle", "scalar-atom", reactantPerParticle_);
Info << "give data done" << endl;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,105 @@
/*---------------------------------------------------------------------------*\
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
Model to communicate available reactant per particle
\*---------------------------------------------------------------------------*/
#ifndef reactantPerParticle_H
#define reactantPerParticle_H
#include "fvCFD.H"
#include "cfdemCloudEnergy.H"
#include "chemistryModel.H"
#include "diffusionCoefficients.H"
#include "HashPtrTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class reactantPerParticle Declaration
\*---------------------------------------------------------------------------*/
// for future use:
// + communicate every N steps
class reactantPerParticle
:
public chemistryModel
{
private:
dictionary propsDict_;
const fvMesh& mesh_;
mutable double **reactantPerParticle_;
word voidfractionFieldName_;
const volScalarField& voidfraction_;
mutable volScalarField particlesPerCell_;
void allocateMyArrays() const;
label loopCounter_;
label Nevery_;
public:
//- Runtime type information
TypeName("reactantPerParticle");
// Constructors
//- Construct from components
reactantPerParticle
(
const dictionary& dict,
cfdemCloudEnergy& sm
);
// Destructor
virtual ~reactantPerParticle();
// Member Functions
void execute();
void reAllocMyArrays() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -317,7 +317,7 @@ void species::execute()
particleCloud_.dataExchangeM().getData(mod_spec_names_[i],"scalar-atom",changeOfSpeciesMass_[i]);
changeOfSpeciesMassFields_[i].primitiveFieldRef() = 0.0;
changeOfSpeciesMassFields_[i].boundaryFieldRef() = 0.0;
particleCloud_.averagingM().setScalarSum
particleCloud_.averagingM().setScalarSumCentre
(
changeOfSpeciesMassFields_[i],
changeOfSpeciesMass_[i],

View File

@ -34,6 +34,7 @@ $(chemistryModels)/species/species.C
$(chemistryModels)/noChemistry/noChemistry.C
$(chemistryModels)/diffusionCoefficients/diffusionCoefficients.C
$(chemistryModels)/massTransferCoeff/massTransferCoeff.C
$(chemistryModels)/reactantPerParticle/reactantPerParticle.C
$(energyModels)/energyModel/energyModel.C
$(energyModels)/energyModel/newEnergyModel.C