eReactingFoam-4.x/diffusivityModel/diffusivityModel.C

181 lines
4.8 KiB
C

/*---------------------------------------------------------------------------*\
========= |
\\ / 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 "diffusivityModel.H"
#include "IFstream.H"
#include "speciesTable.H"
#include "volFieldsFwd.H"
#include "scalarMatrices.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
// const dataType Foam::diffusivityModel::staticData();
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::diffusivityModel::diffusivityModel(const psiReactionThermo& thermo)
:
thermo_(thermo),
D_(thermo_.composition().species().size())
{
const speciesTable &species_(thermo_.composition().species());
const volScalarField::Mesh &mesh = thermo_.composition().Y(0).mesh();
dictionary transports
(
IFstream
(
fileName(thermo_.lookup("foamTransportFile")).expand()
)()
);
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;
}
/*
*/
forAll(species_, i)
{
D_.set
(
i,
new volScalarField
(
IOobject
(
"D." + species_[i],
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar("zero", dimArea/dimTime, 0.0)
)
);
}
}
Foam::diffusivityModel::diffusivityModel(const diffusivityModel& dm)
:
thermo_(dm.thermo_)
{}
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
// Foam::autoPtr<Foam::diffusivityModel>
// Foam::diffusivityModel::New()
// {
// return autoPtr<diffusivityModel>(new diffusivityModel);
// }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::diffusivityModel::~diffusivityModel()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
void Foam::diffusivityModel::correct()
{
const volScalarField &T = thermo_.T();
const volScalarField &p = thermo_.p();
const speciesTable &species_(thermo_.composition().species());
scalarSymmetricSquareMatrix Dij(species_.size());
forAll (species_, celli)
{
const scalar pi = p[celli];
const scalar Ti = T[celli];
label idx = 0;
forAll (species_, i)
{
for (label j = i; j < species_.size(); j++)
{
// Calculate Dij
// Dij[idx] = interactions[idx].D(pi,Ti);
Dij(i,j) = idx;
Dij(j,i) = Dij(i,j);
idx++;
}
// DMat = 0;
}
}
return;
}
// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * //
void Foam::diffusivityModel::operator=(const diffusivityModel& rhs)
{
// Check for assignment to self
if (this == &rhs)
{
FatalErrorInFunction
<< "Attempted assignment to self"
<< abort(FatalError);
}
}
// * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * * //
// ************************************************************************* //