skeletal molecule property input processing

This commit is contained in:
ignis 2018-04-26 16:59:21 +09:00
parent 36c781e99d
commit dfc868000c
7 changed files with 425 additions and 7 deletions

View file

@ -1,3 +1,4 @@
diffusivityModel/Particle/Particle.C
diffusivityModel/diffusivityModel/diffusivityModel.C
eReactingFoam.C

View file

@ -1,4 +1,5 @@
EXE_INC = \
-IdiffusivityModel/Particle \
-IdiffusivityModel/diffusivityModel \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \

View file

@ -125,3 +125,5 @@ volScalarField dQ
);
#include "createMRF.H"
diff.correct();

View file

@ -0,0 +1,121 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM 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.
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "Particle.H"
#include "dictionary.H"
#include "scalarList.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
// const dataType Foam::Particle::staticData();
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::Particle::Particle(const dictionary& dict)
:
name_(dict["name"]),
W_(readScalar(dict["W"])),
z_(readScalar(dict["z"]))
{
label geometry (dict.lookupOrDefault("geometry", 0));
const entry* entryPtr = dict.lookupEntryPtr("tranlib", false, true);
if (entryPtr)
{
scalarList tranlib(entryPtr->stream());
geometry = tranlib[0];
}
switch(geometry)
{
case 0:
geometry_ = Geometry::ATOM;
break;
case 1:
geometry_ = Geometry::LINEAR;
break;
case 2:
geometry_ = Geometry::NONLINEAR;
break;
default:
FatalErrorInFunction
<< "Illegal molecule geometry type. 0, 1 and 2 are allowed."
<< abort(FatalError);
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::Particle::~Particle()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * //
void Foam::Particle::operator=(const Particle& rhs)
{
// Check for assignment to self
if (this == &rhs)
{
FatalErrorInFunction
<< "Attempted assignment to self"
<< abort(FatalError);
}
}
// * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<(Ostream& os, const Particle& st)
{
os << st.name_ << tab
<< st.W_ << tab
<< st.z_ << tab
<< st.geometry_;
os.check("Ostream& operator<<(Ostream& os, const specie& st)");
return os;
}
// ************************************************************************* //

View file

@ -0,0 +1,167 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM 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.
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::Particle
Description
SourceFiles
ParticleI.H
Particle.C
ParticleIO.C
\*---------------------------------------------------------------------------*/
#ifndef Particle_H
#define Particle_H
#include "word.H"
#include "scalar.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
class Istream;
class Ostream;
class dictionary;
// Forward declaration of friend functions and operators
class Particle;
Istream& operator>>(Istream&, Particle&);
Ostream& operator<<(Ostream&, const Particle&);
/*---------------------------------------------------------------------------*\
Class Particle Declaration
\*---------------------------------------------------------------------------*/
class Particle
{
public:
//- Enumeration defining the particle geometry
enum Geometry
{
ATOM = 0,
LINEAR = 1,
NONLINEAR = 2
};
protected:
// Private data
//- Species name
word name_;
//- Molecular weight [kg / kmol]
scalar W_;
//- Number of elementary charges
scalar z_;
//- Geometry
Geometry geometry_;
// Private Member Functions
//- Disallow default bitwise copy construct
Particle(const Particle&);
//- Disallow default bitwise assignment
void operator=(const Particle&);
public:
// Static data members
// Constructors
//- Construct from components
Particle(const dictionary& dict);
//- Construct from Istream
Particle(Istream&);
//- Construct as copy
// Particle(const Particle&);
//- Destructor
~Particle();
// Member Functions
// Access
inline const word& name();
inline scalar W();
inline scalar z();
// Check
// Edit
// Write
// Member Operators
// void operator=(const Particle&);
// Friend Functions
// Friend Operators
// IOstream Operators
friend Istream& operator>>(Istream&, Particle&);
friend Ostream& operator<<(Ostream&, const Particle&);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "ParticleI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View file

@ -0,0 +1,74 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM 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.
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline const Foam::word& Foam::Particle::name()
{
return name_;
}
inline Foam::scalar Foam::Particle::W()
{
return W_;
}
inline Foam::scalar Foam::Particle::z()
{
return z_;
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// ************************************************************************* //

View file

@ -29,6 +29,7 @@ License
#include "speciesTable.H"
#include "volFieldsFwd.H"
#include "scalarMatrices.H"
#include "Particle.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -64,15 +65,58 @@ Foam::diffusivityModel::diffusivityModel(const psiReactionThermo& thermo)
)()
);
Switch readIons = false;
Switch readNeutrals = false;
forAll(species_, i)
{
// transports[species_[i]];
Info << species_[i] << endl;
Info << thermo_.composition().W(i) << endl;
Info << thermo_.composition().Qc(i) << endl;
Info << thermo_.composition().z(i) << endl;
Info << readScalar(transports.subDict(species_[i]).subDict("transport")["As"]) << endl;
const word namei(species_[i]);
const label Wi = thermo_.composition().W(i);
const label zi = thermo_.composition().z(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 << tranDict << endl;
Info << p << endl;
Info << scalarList(tranDict["tranlib"]) << endl;
// Electron
if (species_[i] == "E-")
{
if (readIons || readNeutrals)
{
FatalErrorInFunction
<< "Electron should be the first species in the list"
<< abort(FatalError);
}
// new Electron (tranDict);
}
// Ions
else if (zi != 0)
{
if (readNeutrals)
{
FatalErrorInFunction
<< "Ions should be listed before any neutrals"
<< abort(FatalError);
}
readIons = true;
// new Ion (tranDict);
}
// Neutrals
else
{
readNeutrals = true;
// new Neutral (tranDict);
}
}
/*
*/
@ -132,10 +176,16 @@ void Foam::diffusivityModel::correct()
scalarSymmetricSquareMatrix Dij(species_.size());
forAll (species_, celli)
forAll (p, celli)
{
const scalar pi = p[celli];
const scalar Ti = T[celli];
scalarField Yi(species_.size());
forAll (species_, i)
{
Yi[i] = thermo_.composition().Y(i)[celli];
}
label idx = 0;
@ -153,6 +203,8 @@ void Foam::diffusivityModel::correct()
// DMat = 0;
}
Info << Yi << endl;
}
return;