Changes to species
This commit is contained in:
@ -21,6 +21,8 @@ License
|
||||
#include "error.H"
|
||||
#include "species.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
#include "dataExchangeModel.H"
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
@ -30,7 +32,12 @@ namespace Foam
|
||||
|
||||
defineTypeNameAndDebug(species, 0);
|
||||
|
||||
addToRunTimeSelectionTable(chemistryModel, species, dictionary);
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
chemistryModel,
|
||||
species,
|
||||
dictionary
|
||||
);
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
@ -43,11 +50,36 @@ species::species
|
||||
:
|
||||
chemistryModel(dict,sm),
|
||||
propsDict_(dict.subDict(typeName + "Props")),
|
||||
interpolation_(propsDict_.lookupOrDefault<bool>("interpolation",false))
|
||||
interpolation_(propsDict_.lookupOrDefault<bool>("interpolation",false)),
|
||||
//speciesNames_(propsDict_.lookup("speciesNames"));
|
||||
//Y_(sm.mesh().lookup<volScalarField> (speciesNames_)),
|
||||
|
||||
|
||||
//concentrations_(),
|
||||
//changeOfSpeciesMass_(),
|
||||
|
||||
//changeOfSpeciesMassFields_(sm.mesh().lookup<volScalarField> (changeOfSpeciesMassFields)),
|
||||
//changeOfGasMassFields_(sm.mesh().lookup<volScalarField> (changeOfGasMassField_)),
|
||||
|
||||
tempFieldName_(propsDict_.lookupOrDefault<word>("tempFieldName","T")),
|
||||
tempField_(sm.mesh().lookupObject<volScalarField> (tempFieldName_)),
|
||||
partTempName_(propsDict_.lookup("partTempName")),
|
||||
partTemp_(NULL),
|
||||
|
||||
densityFieldName_(propsDict_.lookupOrDefault<word>("densityFieldName","rho")),
|
||||
rho_(sm.mesh().lookupObject<volScalarField> (densityFieldName_)),
|
||||
partRhoName_(propsDict_.lookup("partRhoName")),
|
||||
partRho_(NULL),
|
||||
|
||||
|
||||
/* voidfractionFieldName_(propsDict_.lookup("voidfractionFieldName")),
|
||||
voidfraction_(sm.mesh().lookupObject<volScalarField> (voidfractionFieldName_)),
|
||||
velFieldName_(propsDict_.lookup("velFieldName")),
|
||||
U_(sm.mesh().lookup<volVectorField> (velFieldName_)),*/
|
||||
|
||||
{
|
||||
allocateMyArrays();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -55,22 +87,78 @@ species::species
|
||||
|
||||
species::~species()
|
||||
{
|
||||
|
||||
delete partTemp_;
|
||||
delete partRho_;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * private Member Functions * * * * * * * * * * * * * //
|
||||
void species::allocateMyArrays() const
|
||||
{
|
||||
// could be implemented similarly as forcemodel LaEuScalarTemp
|
||||
|
||||
// get memory for 2d arrays
|
||||
double initVal=0.0;
|
||||
particleCloud_.dataExchangeM().allocateArray(partRho_,initVal,1);
|
||||
particleCloud_.dataExchangeM().allocateArray(partTemp_,initVal,1);
|
||||
//particleCloud_.dataExchangeM().allocateArray(Y_,initVal,1);
|
||||
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * Member Fct * * * * * * * * * * * * * * * //
|
||||
|
||||
void species::execute()
|
||||
{
|
||||
|
||||
// realloc the arrays
|
||||
allocateMyArrays();
|
||||
|
||||
// get DEM data
|
||||
particleCloud_.dataExchangeM().getData(partTempName_,'scalar-atom',partTemp_);
|
||||
//particleCloud_.dataExchangeM().getData(partRhoName_,'scalar-atom',partRho_);
|
||||
|
||||
// get Y_i, T, rho at particle positions, fill arrays with them and push to LIGGGHTS
|
||||
|
||||
|
||||
scalar Tfluid(0);
|
||||
label cellI=0;
|
||||
scalar rho(0);
|
||||
scalar Yfluid(0);
|
||||
|
||||
interpolationCellPoint<scalar> TInterpolator_(tempField_);
|
||||
interpolationCellPoint<scalar> rhoInterpolator_(rho_);
|
||||
itnerpolationCellPoint<scalar> YInterpolator_(Y_);
|
||||
|
||||
for (int index=0; index<particleCloud_.numberOfParticles(); index++)
|
||||
{
|
||||
cellI=particleCloud_.cellIDs()[index][0];
|
||||
if (cellI >=0)
|
||||
{
|
||||
if(interpolation_)
|
||||
//if(chemistryM(0).interpolation())
|
||||
{
|
||||
vector position = particleCloud_.position(index);
|
||||
Tfluid = TInterpolator_.interpolate(poistion,cellI);
|
||||
rho=rhoInterpolator_.interpolate(position,cellI);
|
||||
Yfluid=YInterpolator_.interpolate(position,cellI);
|
||||
}
|
||||
else
|
||||
{
|
||||
Tfluid = tempField_[cellI];
|
||||
rho=rho_[cellI];
|
||||
Yfluid=Y_[cellI];
|
||||
}
|
||||
|
||||
// calculate T, rho, Y_i
|
||||
|
||||
//fill arrays
|
||||
partTemp_[index][0]=;
|
||||
partRho_[index][0]=;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// pull changeOfSpeciesMass_, transform onto fields changeOfSpeciesMassFields_, add them up on changeOfGasMassField_
|
||||
|
||||
}
|
||||
|
||||
@ -63,11 +63,15 @@ private:
|
||||
|
||||
// const volScalarField& tempField_; // ref to gas temperature field
|
||||
|
||||
// word partTempName_;
|
||||
|
||||
// mutable double **partTemp_; // gas temperature at particle positions
|
||||
|
||||
// word densityFieldName_;
|
||||
|
||||
// const volScalarField& rho_;
|
||||
|
||||
// word partRhoName_;
|
||||
|
||||
// mutable double **partRho_; // gas density at particle positions
|
||||
|
||||
|
||||
Reference in New Issue
Block a user