Particles now have their own gasHThermoPhysics object and diffusivityModel are fixed with gasHThermoPhysics Mixture

This commit is contained in:
Yeongdo Park 2018-10-30 12:37:37 -04:00
parent c6dcfeb5d7
commit ddc0b20e9d
9 changed files with 72 additions and 51 deletions

View file

@ -44,10 +44,10 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::Electron::Electron(const dictionary& dict)
Foam::Electron::Electron(const dictionary& thermoDict, const dictionary& tranDict)
:
Particle(dict),
fitDict_(dict.subDict("fitCoefs")),
Particle(thermoDict, tranDict),
fitDict_(tranDict.subDict("fitCoefs")),
collisionTargets_(fitDict_.lookup("species")),
DejFitCoefs_(collisionTargets_.size())
{

View file

@ -95,7 +95,7 @@ public:
// Constructors
//- Construct from components
Electron(const dictionary& dict);
Electron(const dictionary& thermoDict, const dictionary& tranDict);
//- Construct from Istream
Electron(Istream&);

View file

@ -44,16 +44,16 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::Ion::Ion(const dictionary& dict)
Foam::Ion::Ion(const dictionary& thermoDict, const dictionary& tranDict)
:
Particle(dict),
alpha_(dict.lookupOrDefault("dipolePolarizability", 0.0)),
Particle(thermoDict, tranDict),
alpha_(tranDict.lookupOrDefault("dipolePolarizability", 0.0)),
C6_(0.0),
Zrot_(dict.lookupOrDefault("rotationalRelaxation", 0.0)),
n_(dict.lookupOrDefault("nStockmayer", 12)),
rctTarget_(dict.lookupOrDefault("rctTargets", hashedWordList())),
Arct_(dict.lookupOrDefault("Arct", scalarList())),
Brct_(dict.lookupOrDefault("Brct", scalarList()))
Zrot_(tranDict.lookupOrDefault("rotationalRelaxation", 0.0)),
n_(tranDict.lookupOrDefault("nStockmayer", 12)),
rctTarget_(tranDict.lookupOrDefault("rctTargets", hashedWordList())),
Arct_(tranDict.lookupOrDefault("Arct", scalarList())),
Brct_(tranDict.lookupOrDefault("Brct", scalarList()))
{
if (z() > 0)
{

View file

@ -107,7 +107,7 @@ public:
// Constructors
//- Construct from components
Ion(const dictionary& dict);
Ion(const dictionary& thermoDict, const dictionary& tranDict);
//- Construct from Istream
Ion(Istream&);

View file

@ -1,4 +1,5 @@
/*---------------------------------------------------------------------------*\
Particle(tranDict),
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
@ -44,19 +45,19 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::Neutral::Neutral(const dictionary& dict)
Foam::Neutral::Neutral(const dictionary& thermoDict, const dictionary& tranDict)
:
Particle(dict),
wellDepth_(dict.lookupOrDefault("wellDepth", 0.0)),
diameter_(dict.lookupOrDefault("diameter", 0.0)),
dipoleMoment_(dict.lookupOrDefault("dipoleMoment", 0.0)),
alpha_(dict.lookupOrDefault("dipolePolarizability", 0.0)),
Particle(thermoDict, tranDict),
wellDepth_(tranDict.lookupOrDefault("wellDepth", 0.0)),
diameter_(tranDict.lookupOrDefault("diameter", 0.0)),
dipoleMoment_(tranDict.lookupOrDefault("dipoleMoment", 0.0)),
alpha_(tranDict.lookupOrDefault("dipolePolarizability", 0.0)),
alphaQ_(0.0),
C6_(dict.lookupOrDefault("dispersionCoef", 0.0)),
Zrot_(dict.lookupOrDefault("rotationalRelaxation", 0.0))
C6_(tranDict.lookupOrDefault("dispersionCoef", 0.0)),
Zrot_(tranDict.lookupOrDefault("rotationalRelaxation", 0.0))
{
const entry* entryPtr = dict.lookupEntryPtr("tranlib", false, true);
const entry* entryPtr = tranDict.lookupEntryPtr("tranlib", false, true);
if (entryPtr)
{
@ -68,21 +69,21 @@ Foam::Neutral::Neutral(const dictionary& dict)
alpha_ = tranlib[4];
Zrot_ = tranlib[5];
dict.readIfPresent("wellDepth", wellDepth_);
dict.readIfPresent("diameter", diameter_);
dict.readIfPresent("dipoleMoment", dipoleMoment_);
dict.readIfPresent("dipolePolarizability", alpha_);
dict.readIfPresent("dispersionCoef", C6_);
dict.readIfPresent("rotationalRelaxation", Zrot_);
tranDict.readIfPresent("wellDepth", wellDepth_);
tranDict.readIfPresent("diameter", diameter_);
tranDict.readIfPresent("dipoleMoment", dipoleMoment_);
tranDict.readIfPresent("dipolePolarizability", alpha_);
tranDict.readIfPresent("dispersionCoef", C6_);
tranDict.readIfPresent("rotationalRelaxation", Zrot_);
}
else
{
wellDepth_ = readScalar(dict.lookup("wellDepth"));
diameter_ = readScalar(dict.lookup("diameter"));
dipoleMoment_ = readScalar(dict.lookup("dipoleMoment"));
alpha_ = readScalar(dict.lookup("dipolePolarizability"));
C6_ = readScalar(dict.lookup("dispersionCoef"));
Zrot_ = readScalar(dict.lookup("rotationalRelaxation"));
wellDepth_ = readScalar(tranDict.lookup("wellDepth"));
diameter_ = readScalar(tranDict.lookup("diameter"));
dipoleMoment_ = readScalar(tranDict.lookup("dipoleMoment"));
alpha_ = readScalar(tranDict.lookup("dipolePolarizability"));
C6_ = readScalar(tranDict.lookup("dispersionCoef"));
Zrot_ = readScalar(tranDict.lookup("rotationalRelaxation"));
}
if (alpha_ > 0.0)

View file

@ -106,7 +106,7 @@ public:
// Constructors
//- Construct from components
Neutral(const dictionary& dict);
Neutral(const dictionary& thermoDict, const dictionary& tranDict);
//- Construct from Istream
Neutral(Istream&);

View file

@ -70,15 +70,16 @@ const Foam::scalar Foam::Particle::eps0 = constant::electromagnetic::epsilon0.va
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::Particle::Particle(const dictionary& dict)
Foam::Particle::Particle(const dictionary& thermoDict, const dictionary& tranDict)
:
name_(dict["name"]),
W_(readScalar(dict["W"])),
z_(readScalar(dict["z"]))
name_(tranDict["name"]),
W_(readScalar(tranDict["W"])),
z_(readScalar(tranDict["z"])),
thermo_(thermoDict)
{
label geometry = 0;
const entry* entryPtr = dict.lookupEntryPtr("tranlib", false, true);
const entry* entryPtr = tranDict.lookupEntryPtr("tranlib", false, true);
if (entryPtr)
{
@ -87,7 +88,7 @@ Foam::Particle::Particle(const dictionary& dict)
}
else
{
geometry = readLabel(dict.lookup("geometry"));
geometry = readLabel(tranDict.lookup("geometry"));
}
switch(geometry)

View file

@ -38,6 +38,7 @@ SourceFiles
#include "word.H"
#include "scalar.H"
#include "thermoPhysicsTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -72,6 +73,8 @@ public:
NONLINEAR = 3
};
//- The type of thermodynamics this mixture is instantiated for
typedef gasHThermoPhysics thermoType;
protected:
@ -89,6 +92,9 @@ protected:
//- Geometry
Geometry geometry_;
//- Thermophysics Object
thermoType thermo_;
// Private Member Functions
@ -131,7 +137,7 @@ public:
// Constructors
//- Construct from components
Particle(const dictionary& dict);
Particle(const dictionary& thermoDict, const dictionary& tranDict);
//- Construct from Istream
Particle(Istream&);

View file

@ -29,6 +29,9 @@ License
#include "speciesTable.H"
#include "volFieldsFwd.H"
#include "scalarMatrices.H"
#include "multiComponentMixture.H"
#include "thermoPhysicsTypes.H"
#include "Particle.H"
#include "Electron.H"
#include "Neutral.H"
@ -323,8 +326,8 @@ Foam::diffusivityModel::diffusivityModel(const psiReactionThermo& thermo)
thermo_.composition().Y(0).mesh(),
dimensionedScalar("zero", dimForce/dimTime/dimTemperature, 0.0)
),
neutrals_(thermo_.composition().species().size()),
ions_(thermo_.composition().species().size()),
neutrals_(thermo_.composition().species().size()),
ecs_(thermo_.composition().species().size()),
ens_(thermo_.composition().species().size()),
nns_(thermo_.composition().species().size()*thermo_.composition().species().size()),
@ -332,6 +335,10 @@ Foam::diffusivityModel::diffusivityModel(const psiReactionThermo& thermo)
cns_(thermo_.composition().species().size()*thermo_.composition().species().size())
{
typedef multiComponentMixture<gasHThermoPhysics> gasMix;
const gasMix &mcm (dynamicCast<const gasMix>(thermo_));
const speciesTable &species_(thermo_.composition().species());
const volScalarField::Mesh &mesh = thermo_.composition().Y(0).mesh();
@ -344,6 +351,14 @@ Foam::diffusivityModel::diffusivityModel(const psiReactionThermo& thermo)
)()
);
dictionary thermos
(
IFstream
(
fileName(thermo_.lookup("foamChemistryThermoFile")).expand()
)()
);
Switch readIons = false;
Switch readNeutrals = false;
@ -356,16 +371,14 @@ Foam::diffusivityModel::diffusivityModel(const psiReactionThermo& thermo)
const scalar Wi = thermo_.composition().W(i);
const label zi = thermo_.composition().z(i);
dictionary thermoDict(thermos.subDict(species_[i]));
dictionary tranDict(transports.subDict(species_[i]).subDict("transport"));
tranDict.add("name", namei);
tranDict.add("W", Wi);
tranDict.add("z", zi);
Particle p(tranDict);
// Info << namei << endl << tranDict << endl;
// Info << p << endl;
// Info << scalarList(tranDict["tranlib"]) << endl;
const Particle::thermoType &thermoData(mcm.speciesData()[i]);
// Electron
if (species_[i] == "E-")
@ -377,7 +390,7 @@ Foam::diffusivityModel::diffusivityModel(const psiReactionThermo& thermo)
<< abort(FatalError);
}
electron_.set(new Electron (tranDict));
electron_.set(new Electron (thermoDict, tranDict));
}
// Ions
else if (zi != 0)
@ -391,7 +404,7 @@ Foam::diffusivityModel::diffusivityModel(const psiReactionThermo& thermo)
readIons = true;
ions_.set(nIon, new Ion(tranDict));
ions_.set(nIon, new Ion(thermoDict, tranDict));
nIon++;
@ -402,7 +415,7 @@ Foam::diffusivityModel::diffusivityModel(const psiReactionThermo& thermo)
{
readNeutrals = true;
neutrals_.set(nNeutral, new Neutral(tranDict));
neutrals_.set(nNeutral, new Neutral(thermoDict, tranDict));
nNeutral++;
}