ENH: Added new coalCloudList class

This commit is contained in:
andy
2012-08-02 14:39:12 +01:00
parent 8cc23d54bd
commit 7afffce8a5
4 changed files with 481 additions and 0 deletions

View File

@ -1,4 +1,5 @@
/* Coal parcel and sub-models */
coalParcel/makeCoalParcelSubmodels.C
coalCloudList/coalCloudList.C
LIB = $(FOAM_LIBBIN)/libcoalCombustion

View File

@ -0,0 +1,92 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 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 "coalCloudList.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::coalCloudList::coalCloudList
(
const volScalarField& rho,
const volVectorField& U,
const dimensionedVector& g,
const SLGThermo& slgThermo
)
:
PtrList<coalCloud>(),
mesh_(rho.mesh())
{
IOdictionary props
(
IOobject
(
"coalCloudList",
mesh_.time().constant(),
mesh_,
IOobject::MUST_READ
)
);
const wordHashSet cloudNames(wordList(props.lookup("clouds")));
setSize(cloudNames.size());
label i = 0;
forAllConstIter(wordHashSet, cloudNames, iter)
{
const word& name = iter.key();
Info<< "creating cloud: " << name << endl;
set
(
i++,
new coalCloud
(
name,
rho,
U,
g,
slgThermo
)
);
Info<< endl;
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::coalCloudList::evolve()
{
forAll(*this, i)
{
operator[](i).evolve();
}
}
// ************************************************************************* //

View File

@ -0,0 +1,126 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 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/>.
\*---------------------------------------------------------------------------*/
#ifndef coalCloudList_H
#define coalCloudList_H
#include "coalCloud.H"
#include "volFieldsFwd.H"
#include "fvMatricesFwd.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class coalCloudList Declaration
\*---------------------------------------------------------------------------*/
class coalCloudList
:
public PtrList<coalCloud>
{
private:
//- Reference to the mesh
const fvMesh& mesh_;
public:
// Constructor
coalCloudList
(
const volScalarField& rho,
const volVectorField& U,
const dimensionedVector& g,
const SLGThermo& slgThermo
);
// Member Functions
// Evolution
//- Evolve the cloud collection
void evolve();
// Source terms
//- Return const reference to momentum source
inline tmp<DimensionedField<vector, volMesh> > UTrans() const;
//- Return tmp momentum source term
inline tmp<fvVectorMatrix> SU(volVectorField& U) const;
//- Sensible enthalpy transfer [J/kg]
inline tmp<DimensionedField<scalar, volMesh> > hsTrans() const;
//- Return sensible enthalpy source term [J/kg/m3/s]
inline tmp<fvScalarMatrix> Sh(volScalarField& hs) const;
//- Return mass source term for specie i - specie eqn
inline tmp<fvScalarMatrix> SYi
(
const label i,
volScalarField& Yi
) const;
//- Return total mass transfer [kg/m3]
inline tmp<DimensionedField<scalar, volMesh> > rhoTrans() const;
//- Return tmp total mass source for carrier phase
// - fully explicit
inline tmp<DimensionedField<scalar, volMesh> > Srho() const;
//- Return tmp total mass source for carrier phase specie i
// - fully explicit
inline tmp<DimensionedField<scalar, volMesh> > Srho
(
const label i
) const;
//- Return total mass source term [kg/m3/s]
inline tmp<fvScalarMatrix> Srho(volScalarField& rho) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "coalCloudListI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,262 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 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 "fvMatrices.H"
#include "volFields.H"
#include "DimensionedField.H"
Foam::tmp<Foam::DimensionedField<Foam::vector, Foam::volMesh> >
Foam::coalCloudList::UTrans() const
{
tmp<DimensionedField<vector, volMesh> > tfld
(
new DimensionedField<vector, volMesh>
(
IOobject
(
"UTransEff",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimensionedVector("zero", dimMass*dimVelocity, vector::zero)
)
);
DimensionedField<vector, volMesh>& fld = tfld();
forAll(*this, i)
{
fld += operator[](i).UTrans();
}
return tfld;
}
Foam::tmp<Foam::fvVectorMatrix> Foam::coalCloudList::SU
(
volVectorField& U
) const
{
tmp<fvVectorMatrix> tfvm(new fvVectorMatrix(U, dimForce));
fvVectorMatrix& fvm = tfvm();
forAll(*this, i)
{
fvm += operator[](i).SU(U);
}
return tfvm;
}
Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >
Foam::coalCloudList::hsTrans() const
{
tmp<DimensionedField<scalar, volMesh> > tfld
(
new DimensionedField<scalar, volMesh>
(
IOobject
(
"hsTransEff",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimensionedScalar("zero", dimEnergy, 0.0)
)
);
DimensionedField<scalar, volMesh>& fld = tfld();
forAll(*this, i)
{
fld += operator[](i).hsTrans();
}
return tfld;
}
Foam::tmp<Foam::fvScalarMatrix> Foam::coalCloudList::Sh
(
volScalarField& hs
) const
{
tmp<fvScalarMatrix> tfvm(new fvScalarMatrix(hs, dimEnergy/dimTime));
fvScalarMatrix& fvm = tfvm();
forAll(*this, i)
{
fvm += operator[](i).Sh(hs);
}
return tfvm;
}
Foam::tmp<Foam::fvScalarMatrix> Foam::coalCloudList::SYi
(
const label ii,
volScalarField& Yi
) const
{
tmp<fvScalarMatrix> tfvm(new fvScalarMatrix(Yi, dimMass/dimTime));
fvScalarMatrix& fvm = tfvm();
forAll(*this, i)
{
fvm += operator[](i).SYi(ii, Yi);
}
return tfvm;
}
Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >
Foam::coalCloudList::rhoTrans() const
{
tmp<DimensionedField<scalar, volMesh> > tfld
(
new DimensionedField<scalar, volMesh>
(
IOobject
(
"rhoTransEff",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimensionedScalar("zero", dimMass, 0.0)
)
);
DimensionedField<scalar, volMesh>& fld = tfld();
forAll(*this, i)
{
forAll(operator[](i).rhoTrans(), j)
{
fld += operator[](i).rhoTrans()[j];
}
}
return tfld;
}
Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >
Foam::coalCloudList::Srho() const
{
tmp<DimensionedField<scalar, volMesh> > tfld
(
new DimensionedField<scalar, volMesh>
(
IOobject
(
"rhoTransEff",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimensionedScalar("zero", dimDensity/dimTime, 0.0)
)
);
DimensionedField<scalar, volMesh>& fld = tfld();
forAll(*this, i)
{
fld += operator[](i).Srho();
}
return tfld;
}
Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >
Foam::coalCloudList::Srho
(
const label i
) const
{
tmp<DimensionedField<scalar, volMesh> > tfld
(
new DimensionedField<scalar, volMesh>
(
IOobject
(
"rhoTransEff",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimensionedScalar("zero", dimDensity/dimTime, 0.0)
)
);
DimensionedField<scalar, volMesh>& fld = tfld();
forAll(*this, j)
{
fld += operator[](j).Srho(i);
}
return tfld;
}
Foam::tmp<Foam::fvScalarMatrix> Foam::coalCloudList::Srho
(
volScalarField& rho
) const
{
tmp<fvScalarMatrix> tfvm(new fvScalarMatrix(rho, dimMass/dimTime));
fvScalarMatrix& fvm = tfvm();
forAll(*this, i)
{
fvm += operator[](i).Srho(rho);
}
return tfvm;
}
// ************************************************************************* //