Merge branch 'master' of /home/dm4/OpenFOAM/OpenFOAM-dev

This commit is contained in:
mattijs
2012-08-17 09:16:19 +01:00
43 changed files with 475 additions and 322 deletions

View File

@ -178,7 +178,7 @@
rho2 = rho20 + psi2*p; rho2 = rho20 + psi2*p;
K1 = 0.5*magSqr(U1); K1 = 0.5*magSqr(U1);
K2 = 0.5*magSqr(U1); K2 = 0.5*magSqr(U2);
dpdt = fvc::ddt(p); dpdt = fvc::ddt(p);
} }

View File

@ -20,4 +20,5 @@ EXE_LIBS = \
-lincompressibleTransportModels \ -lincompressibleTransportModels \
-lcompressibleMultiphaseEulerianInterfacialModels \ -lcompressibleMultiphaseEulerianInterfacialModels \
-lincompressibleLESModels \ -lincompressibleLESModels \
-lincompressibleRASModels \
-lfiniteVolume -lfiniteVolume

View File

@ -85,6 +85,7 @@ do
;; ;;
-builtin) -builtin)
extension=foam extension=foam
requirePV=0
shift shift
;; ;;
-case) -case)

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -74,13 +74,15 @@ Foam::fileName Foam::functionEntries::includeEntry::includeFileName
fileName fName(is); fileName fName(is);
fName.expand(); fName.expand();
// relative name if (fName.empty() || fName.isAbsolute())
if (!fName.isAbsolute())
{ {
fName = fileName(is.name()).path()/fName; return fName;
}
else
{
// relative name
return fileName(is.name()).path()/fName;
} }
return fName;
} }

View File

@ -44,7 +44,7 @@ namespace Foam
{ {
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class objectRegistry Declaration Class objectRegistry Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class objectRegistry class objectRegistry
@ -157,7 +157,7 @@ public:
//- Lookup and return all objects of the given Type //- Lookup and return all objects of the given Type
template<class Type> template<class Type>
HashTable<const Type*> lookupClass() const; HashTable<const Type*> lookupClass(const bool strict = false) const;
//- Is the named Type found? //- Is the named Type found?
template<class Type> template<class Type>

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -29,13 +29,12 @@ License
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type> template<class Type>
Foam::wordList Foam::wordList Foam::objectRegistry::names() const
Foam::objectRegistry::names() const
{ {
wordList objectNames(size()); wordList objectNames(size());
label count=0; label count=0;
for (const_iterator iter = begin(); iter != end(); ++iter) forAllConstIter(HashTable<regIOobject*>, *this, iter)
{ {
if (isA<Type>(*iter())) if (isA<Type>(*iter()))
{ {
@ -50,14 +49,20 @@ Foam::objectRegistry::names() const
template<class Type> template<class Type>
Foam::HashTable<const Type*> Foam::HashTable<const Type*> Foam::objectRegistry::lookupClass
Foam::objectRegistry::lookupClass() const (
const bool strict
) const
{ {
HashTable<const Type*> objectsOfClass(size()); HashTable<const Type*> objectsOfClass(size());
for (const_iterator iter = begin(); iter != end(); ++iter) forAllConstIter(HashTable<regIOobject*>, *this, iter)
{ {
if (isA<Type>(*iter())) if
(
(strict && isType<Type>(*iter()))
|| (!strict && isA<Type>(*iter()))
)
{ {
objectsOfClass.insert objectsOfClass.insert
( (

View File

@ -0,0 +1,84 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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/>.
Description
Generic internal field mapper for dimensioned fields. For "real" mapping,
add template specialisations for mapping of internal fields depending on
mesh type.
\*---------------------------------------------------------------------------*/
#ifndef MapDimensionedFields_H
#define MapDimensionedFields_H
#include "polyMesh.H"
#include "MapFvVolField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
template<class Type, class MeshMapper, class GeoMesh>
void MapDimensionedFields(const MeshMapper& mapper)
{
typedef DimensionedField<Type, GeoMesh> FieldType;
typedef HashTable<const FieldType*> TableType;
TableType fields(mapper.thisDb().template lookupClass<FieldType>(true));
forAllConstIter(typename TableType, fields, fieldIter)
{
FieldType& field = const_cast<FieldType&>(*fieldIter());
if (&field.mesh() == &mapper.mesh())
{
if (polyMesh::debug)
{
Info<< "Mapping " << field.typeName << ' ' << field.name()
<< endl;
}
MapInternalField<Type, MeshMapper, GeoMesh>()(field, mapper);
field.instance() = field.time().timeName();
}
else if (polyMesh::debug)
{
Info<< "Not mapping " << field.typeName << ' ' << field.name()
<< " since originating mesh differs from that of mapper."
<< endl;
}
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -25,50 +25,53 @@ Class
Foam::globalMeshData Foam::globalMeshData
Description Description
Various mesh related information for a parallel run. Upon construction Various mesh related information for a parallel run. Upon construction,
constructs all info by using parallel communication. constructs all info using parallel communication.
Requires: Requires:
- all processor patches to have correct ordering. - all processor patches to have correct ordering.
- all processorPatches to have their transforms set. - all processorPatches to have their transforms set.
The shared point and edge addressing is quite interesting. The shared point and edge addressing calculates addressing for points
It calculates addressing for points and edges on coupled patches. In and edges on coupled patches. In the 'old' way a distinction was made
the 'old' way a distincation was made between points/edges that are between points/edges that are only on two processors and those that are
only on two processors and those that are on multiple processors. The on multiple processors. The problem is that those on multiple processors
problem is that those on multiple processors do not allow any do not allow any transformations and require a global reduction on the
transformations and require a global reduction on the master processor. master processor.
The alternative is to have an exchange schedule (through a 'mapDistribute') The alternative is to have an exchange schedule (through a 'mapDistribute')
which sends all point/edge data (no distinction is made between which sends all point/edge data (no distinction is made between
those on two and those on more than two coupled patches) to the local those on two and those on more than two coupled patches) to the local
'master'. This master then does any calculation and sends 'master'. This master then does any calculation and sends
the result back to the 'slave' points/edges. This only needs to be done the result back to the 'slave' points/edges. This only needs to be done
on points on coupled faces. Any transformation is done using a predetermined on points on coupled faces. Any transformation is done using a
set of transformations - since transformations have to be space filling predetermined set of transformations - since transformations have to be
only a certain number of transformation is supported. space filling only a certain number of transformation is supported.
The exchange needs The exchange needs
- a field of data - a field of data
- a mapDistribute which does all parallel exchange and transformations - a mapDistribute which does all parallel exchange and transformations
This appens remote data to the end of the field. This appens remote data to the end of the field
- a set of indices which indicate where to get untransformed data in the - a set of indices which indicate where to get untransformed data in the
field field
- a set of indices which indicate where to get transformed data in the - a set of indices which indicate where to get transformed data in the
field field
See also mapDistribute, globalIndexAndTransform Note
Notes:
- compared to 17x nTotalFaces, nTotalPoints do not compensate for - compared to 17x nTotalFaces, nTotalPoints do not compensate for
shared points since this would trigger full connectivity analysis shared points since this would trigger full connectivity analysis
- most calculation is demand driven and uses parallel communication - most calculation is demand driven and uses parallel communication
so make sure to invoke on all processors at the same time. so make sure to invoke on all processors at the same time
- old sharedEdge calculation: currently an edge is considered shared - old sharedEdge calculation: currently an edge is considered shared
if it uses two shared points and is used more than once. This is not if it uses two shared points and is used more than once. This is not
correct on processor patches but it only slightly overestimates the number correct on processor patches but it only slightly overestimates the number
of shared edges. Doing full analysis of how many patches use the edge of shared edges. Doing full analysis of how many patches use the edge
would be too complicated. would be too complicated
SeeAlso
mapDistribute
globalIndexAndTransform
SourceFiles SourceFiles
globalMeshData.C globalMeshData.C
@ -98,7 +101,7 @@ class globalIndexAndTransform;
class PackedBoolList; class PackedBoolList;
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class globalMeshData Declaration Class globalMeshData Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class globalMeshData class globalMeshData

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -31,6 +31,8 @@ Description
#include "Time.H" #include "Time.H"
#include "globalMeshData.H" #include "globalMeshData.H"
#include "pointMesh.H" #include "pointMesh.H"
#include "indexedOctree.H"
#include "treeDataCell.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
@ -44,6 +46,11 @@ void Foam::polyMesh::updateMesh(const mapPolyMesh& mpm)
faceZones_.clearAddressing(); faceZones_.clearAddressing();
cellZones_.clearAddressing(); cellZones_.clearAddressing();
// Remove the stored tet base points
tetBasePtIsPtr_.clear();
// Remove the cell tree
cellTreePtr_.clear();
// Update parallel data // Update parallel data
if (globalMeshDataPtr_.valid()) if (globalMeshDataPtr_.valid())
{ {

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -49,6 +49,7 @@ volumeIntegrate
return vf.mesh().V()*vf.internalField(); return vf.mesh().V()*vf.internalField();
} }
template<class Type> template<class Type>
tmp<Field<Type> > tmp<Field<Type> >
volumeIntegrate volumeIntegrate
@ -62,6 +63,23 @@ volumeIntegrate
} }
template<class Type>
tmp<Field<Type> > volumeIntegrate(const DimensionedField<Type, volMesh>& df)
{
return df.mesh().V()*df.field();
}
template<class Type>
tmp<Field<Type> >
volumeIntegrate(const tmp<DimensionedField<Type, volMesh> >& tdf)
{
tmp<Field<Type> > tdidf = tdf().mesh().V()*tdf().field();
tdf.clear();
return tdidf;
}
template<class Type> template<class Type>
dimensioned<Type> dimensioned<Type>
domainIntegrate domainIntegrate
@ -77,9 +95,9 @@ domainIntegrate
); );
} }
template<class Type> template<class Type>
dimensioned<Type> dimensioned<Type> domainIntegrate
domainIntegrate
( (
const tmp<GeometricField<Type, fvPatchField, volMesh> >& tvf const tmp<GeometricField<Type, fvPatchField, volMesh> >& tvf
) )
@ -90,6 +108,33 @@ domainIntegrate
} }
template<class Type>
dimensioned<Type> domainIntegrate
(
const DimensionedField<Type, volMesh>& df
)
{
return dimensioned<Type>
(
"domainIntegrate(" + df.name() + ')',
dimVol*df.dimensions(),
gSum(fvc::volumeIntegrate(df))
);
}
template<class Type>
dimensioned<Type> domainIntegrate
(
const tmp<DimensionedField<Type, volMesh> >& tdf
)
{
dimensioned<Type> integral = domainIntegrate(tdf());
tdf.clear();
return integral;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace fvc } // End namespace fvc

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -67,6 +67,19 @@ namespace fvc
); );
template<class Type>
tmp<Field<Type> > volumeIntegrate
(
const DimensionedField<Type, volMesh>&
);
template<class Type>
tmp<Field<Type> > volumeIntegrate
(
const tmp<DimensionedField<Type, volMesh> >&
);
template<class Type> template<class Type>
dimensioned<Type> domainIntegrate dimensioned<Type> domainIntegrate
( (
@ -78,6 +91,19 @@ namespace fvc
( (
const tmp<GeometricField<Type, fvPatchField, volMesh> >& const tmp<GeometricField<Type, fvPatchField, volMesh> >&
); );
template<class Type>
dimensioned<Type> domainIntegrate
(
const DimensionedField<Type, volMesh>&
);
template<class Type>
dimensioned<Type> domainIntegrate
(
const tmp<DimensionedField<Type, volMesh> >&
);
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -494,6 +494,13 @@ void Foam::fvMesh::mapFields(const mapPolyMesh& meshMap)
MapGeometricFields<tensor, fvsPatchField, fvMeshMapper, surfaceMesh> MapGeometricFields<tensor, fvsPatchField, fvMeshMapper, surfaceMesh>
(mapper); (mapper);
// Map all the dimensionedFields in the objectRegistry
MapDimensionedFields<scalar, fvMeshMapper, volMesh>(mapper);
MapDimensionedFields<vector, fvMeshMapper, volMesh>(mapper);
MapDimensionedFields<sphericalTensor, fvMeshMapper, volMesh>(mapper);
MapDimensionedFields<symmTensor, fvMeshMapper, volMesh>(mapper);
MapDimensionedFields<tensor, fvMeshMapper, volMesh>(mapper);
// Map all the clouds in the objectRegistry // Map all the clouds in the objectRegistry
mapClouds(*this, meshMap); mapClouds(*this, meshMap);

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -31,6 +31,7 @@ Description
#include "MapGeometricFields.H" #include "MapGeometricFields.H"
#include "MapFvSurfaceField.H" #include "MapFvSurfaceField.H"
#include "MapFvVolField.H" #include "MapFvVolField.H"
#include "MapDimensionedFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -423,6 +423,10 @@ void Foam::Cloud<ParticleType>::autoMap
trackStartCell = 0; trackStartCell = 0;
p.cell() = 0; p.cell() = 0;
} }
else
{
p.cell() = trackStartCell;
}
vector pos = p.position(); vector pos = p.position();

View File

@ -155,7 +155,7 @@ Foam::scalar Foam::COxidationHurtMitchell<CloudType>::calculate
} }
// Char percentage // Char percentage
const scalar charPrc = Ychar/Ydaf*100.0; const scalar charPrc = max(0, min(Ychar/(Ydaf + ROOTVSMALL)*100.0, 100));
// Particle surface area // Particle surface area
const scalar Ap = constant::mathematical::pi*sqr(d); const scalar Ap = constant::mathematical::pi*sqr(d);

View File

@ -346,7 +346,7 @@ Foam::KinematicCloud<CloudType>::KinematicCloud
( (
IOobject IOobject
( (
this->name() + "UTrans", this->name() + "::UTrans",
this->db().time().timeName(), this->db().time().timeName(),
this->db(), this->db(),
IOobject::READ_IF_PRESENT, IOobject::READ_IF_PRESENT,
@ -362,7 +362,7 @@ Foam::KinematicCloud<CloudType>::KinematicCloud
( (
IOobject IOobject
( (
this->name() + "UCoeff", this->name() + "::UCoeff",
this->db().time().timeName(), this->db().time().timeName(),
this->db(), this->db(),
IOobject::READ_IF_PRESENT, IOobject::READ_IF_PRESENT,
@ -426,7 +426,7 @@ Foam::KinematicCloud<CloudType>::KinematicCloud
( (
IOobject IOobject
( (
this->name() + "UTrans", this->name() + "::UTrans",
this->db().time().timeName(), this->db().time().timeName(),
this->db(), this->db(),
IOobject::NO_READ, IOobject::NO_READ,
@ -442,7 +442,7 @@ Foam::KinematicCloud<CloudType>::KinematicCloud
( (
IOobject IOobject
( (
name + "UCoeff", name + "::UCoeff",
this->db().time().timeName(), this->db().time().timeName(),
this->db(), this->db(),
IOobject::NO_READ, IOobject::NO_READ,

View File

@ -539,7 +539,7 @@ Foam::KinematicCloud<CloudType>::theta() const
( (
IOobject IOobject
( (
this->name() + "Theta", this->name() + "::theta",
this->db().time().timeName(), this->db().time().timeName(),
this->db(), this->db(),
IOobject::NO_READ, IOobject::NO_READ,
@ -578,7 +578,7 @@ Foam::KinematicCloud<CloudType>::alpha() const
( (
IOobject IOobject
( (
this->name() + "Alpha", this->name() + "::alpha",
this->db().time().timeName(), this->db().time().timeName(),
this->db(), this->db(),
IOobject::NO_READ, IOobject::NO_READ,
@ -615,7 +615,7 @@ Foam::KinematicCloud<CloudType>::rhoEff() const
( (
IOobject IOobject
( (
this->name() + "RhoEff", this->name() + "::rhoEff",
this->db().time().timeName(), this->db().time().timeName(),
this->db(), this->db(),
IOobject::NO_READ, IOobject::NO_READ,

View File

@ -132,7 +132,7 @@ Foam::ReactingCloud<CloudType>::ReactingCloud
( (
IOobject IOobject
( (
this->name() + "rhoTrans_" + specieName, this->name() + "::rhoTrans_" + specieName,
this->db().time().timeName(), this->db().time().timeName(),
this->db(), this->db(),
IOobject::READ_IF_PRESENT, IOobject::READ_IF_PRESENT,
@ -176,7 +176,7 @@ Foam::ReactingCloud<CloudType>::ReactingCloud
( (
IOobject IOobject
( (
this->name() + "rhoTrans_" + specieName, this->name() + "::rhoTrans_" + specieName,
this->db().time().timeName(), this->db().time().timeName(),
this->db(), this->db(),
IOobject::NO_READ, IOobject::NO_READ,

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -107,7 +107,7 @@ inline Foam::tmp<Foam::fvScalarMatrix> Foam::ReactingCloud<CloudType>::SYi
( (
IOobject IOobject
( (
this->name() + "rhoTrans", this->name() + "::rhoTrans",
this->db().time().timeName(), this->db().time().timeName(),
this->db(), this->db(),
IOobject::NO_READ, IOobject::NO_READ,
@ -155,7 +155,7 @@ Foam::ReactingCloud<CloudType>::Srho(const label i) const
( (
IOobject IOobject
( (
this->name() + "rhoTrans", this->name() + "::rhoTrans",
this->db().time().timeName(), this->db().time().timeName(),
this->db(), this->db(),
IOobject::NO_READ, IOobject::NO_READ,
@ -192,7 +192,7 @@ Foam::ReactingCloud<CloudType>::Srho() const
( (
IOobject IOobject
( (
this->name() + "rhoTrans", this->name() + "::rhoTrans",
this->db().time().timeName(), this->db().time().timeName(),
this->db(), this->db(),
IOobject::NO_READ, IOobject::NO_READ,
@ -236,7 +236,7 @@ Foam::ReactingCloud<CloudType>::Srho(volScalarField& rho) const
( (
IOobject IOobject
( (
this->name() + "rhoTrans", this->name() + "::rhoTrans",
this->db().time().timeName(), this->db().time().timeName(),
this->db(), this->db(),
IOobject::NO_READ, IOobject::NO_READ,

View File

@ -278,7 +278,7 @@ inline Foam::tmp<Foam::volScalarField> Foam::ThermoCloud<CloudType>::Ep() const
( (
IOobject IOobject
( (
this->name() + "radiation::Ep", this->name() + "::radiation::Ep",
this->db().time().timeName(), this->db().time().timeName(),
this->db(), this->db(),
IOobject::NO_READ, IOobject::NO_READ,
@ -314,7 +314,7 @@ inline Foam::tmp<Foam::volScalarField> Foam::ThermoCloud<CloudType>::ap() const
( (
IOobject IOobject
( (
this->name() + "radiation::ap", this->name() + "::radiation::ap",
this->db().time().timeName(), this->db().time().timeName(),
this->db(), this->db(),
IOobject::NO_READ, IOobject::NO_READ,
@ -351,7 +351,7 @@ Foam::ThermoCloud<CloudType>::sigmap() const
( (
IOobject IOobject
( (
this->name() + "radiation::sigmap", this->name() + "::radiation::sigmap",
this->db().time().timeName(), this->db().time().timeName(),
this->db(), this->db(),
IOobject::NO_READ, IOobject::NO_READ,

View File

@ -110,6 +110,7 @@ void reactingOneDim::updateQr()
const volScalarField kappaRad_(kappaRad()); const volScalarField kappaRad_(kappaRad());
// Propagate Qr through 1-D regions // Propagate Qr through 1-D regions
label totalFaceId = 0;
forAll(intCoupledPatchIDs_, i) forAll(intCoupledPatchIDs_, i)
{ {
const label patchI = intCoupledPatchIDs_[i]; const label patchI = intCoupledPatchIDs_[i];
@ -121,7 +122,7 @@ void reactingOneDim::updateQr()
{ {
const scalar Qr0 = Qrp[faceI]; const scalar Qr0 = Qrp[faceI];
point Cf0 = Cf[faceI]; point Cf0 = Cf[faceI];
const labelList& cells = boundaryFaceCells_[faceI]; const labelList& cells = boundaryFaceCells_[totalFaceId];
scalar kappaInt = 0.0; scalar kappaInt = 0.0;
forAll(cells, k) forAll(cells, k)
{ {
@ -132,6 +133,7 @@ void reactingOneDim::updateQr()
Qr_[cellI] = Qr0*exp(-kappaInt); Qr_[cellI] = Qr0*exp(-kappaInt);
Cf0 = Cf1; Cf0 = Cf1;
} }
totalFaceId ++;
} }
} }
@ -151,11 +153,12 @@ void reactingOneDim::updatePhiGas()
tmp<volScalarField> tHsiGas = tmp<volScalarField> tHsiGas =
solidChemistry_->gasHs(solidThermo_.p(), solidThermo_.T(), gasI); solidChemistry_->gasHs(solidThermo_.p(), solidThermo_.T(), gasI);
tmp<volScalarField> tRRiGas = solidChemistry_->RRg(gasI);
const volScalarField& HsiGas = tHsiGas(); const volScalarField& HsiGas = tHsiGas();
const volScalarField& RRiGas = tRRiGas();
const DimensionedField<scalar, volMesh>& RRiGas =
solidChemistry_->RRg(gasI);
label totalFaceId = 0;
forAll(intCoupledPatchIDs_, i) forAll(intCoupledPatchIDs_, i)
{ {
const label patchI = intCoupledPatchIDs_[i]; const label patchI = intCoupledPatchIDs_[i];
@ -164,7 +167,7 @@ void reactingOneDim::updatePhiGas()
forAll(phiGasp, faceI) forAll(phiGasp, faceI)
{ {
const labelList& cells = boundaryFaceCells_[faceI]; const labelList& cells = boundaryFaceCells_[totalFaceId];
scalar massInt = 0.0; scalar massInt = 0.0;
forAllReverse(cells, k) forAllReverse(cells, k)
{ {
@ -184,6 +187,7 @@ void reactingOneDim::updatePhiGas()
<< " is : " << massInt << " is : " << massInt
<< " [kg/s] " << endl; << " [kg/s] " << endl;
} }
totalFaceId ++;
} }
} }
tHsiGas().clear(); tHsiGas().clear();

View File

@ -188,7 +188,6 @@ void Foam::sampledSurfaces::read(const dictionary& dict)
if (surfacesFound) if (surfacesFound)
{ {
dict.lookup("fields") >> fieldSelection_; dict.lookup("fields") >> fieldSelection_;
clearFieldGroups();
dict.lookup("interpolationScheme") >> interpolationScheme_; dict.lookup("interpolationScheme") >> interpolationScheme_;
const word writeType(dict.lookup("surfaceFormat")); const word writeType(dict.lookup("surfaceFormat"));

View File

@ -127,13 +127,8 @@ class sampledSurfaces
// Private Member Functions // Private Member Functions
//- Clear old field groups
void clearFieldGroups();
//- Append fieldName to the appropriate group //- Return number of fields
label appendFieldGroup(const word& fieldName, const word& fieldType);
//- Classify field types, returns the number of fields
label classifyFields(); label classifyFields();
//- Write geometry only //- Write geometry only

View File

@ -159,7 +159,7 @@ void Foam::sampledSurfaces::sampleAndWrite
forAll(*this, surfI) forAll(*this, surfI)
{ {
const sampledSurface& s = operator[](surfI); const sampledSurface& s = operator[](surfI);
Field<Type> values = s.sample(sField); Field<Type> values(s.sample(sField));
writeSurface<Type>(values, surfI, fieldName, outputDir); writeSurface<Type>(values, surfI, fieldName, outputDir);
} }
} }

View File

@ -64,7 +64,19 @@ Foam::ODEChemistryModel<CompType, ThermoType>::ODEChemistryModel
RR_.set RR_.set
( (
fieldI, fieldI,
new scalarField(mesh.nCells(), 0.0) new DimensionedField<scalar, volMesh>
(
IOobject
(
"RR::" + Y_[fieldI].name(),
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionedScalar("zero", dimMass/dimVolume/dimTime, 0.0)
)
); );
} }
@ -687,6 +699,11 @@ Foam::label Foam::ODEChemistryModel<CompType, ThermoType>::nEqns() const
template<class CompType, class ThermoType> template<class CompType, class ThermoType>
void Foam::ODEChemistryModel<CompType, ThermoType>::calculate() void Foam::ODEChemistryModel<CompType, ThermoType>::calculate()
{ {
if (!this->chemistry_)
{
return;
}
const volScalarField rho const volScalarField rho
( (
IOobject IOobject
@ -701,36 +718,24 @@ void Foam::ODEChemistryModel<CompType, ThermoType>::calculate()
this->thermo().rho() this->thermo().rho()
); );
if (this->mesh().changing()) forAll(rho, celli)
{ {
const scalar rhoi = rho[celli];
const scalar Ti = this->thermo().T()[celli];
const scalar pi = this->thermo().p()[celli];
scalarField c(nSpecie_, 0.0);
for (label i=0; i<nSpecie_; i++) for (label i=0; i<nSpecie_; i++)
{ {
RR_[i].setSize(rho.size()); const scalar Yi = Y_[i][celli];
RR_[i] = 0.0; c[i] = rhoi*Yi/specieThermo_[i].W();
} }
}
if (this->chemistry_) const scalarField dcdt(omega(c, Ti, pi));
{
forAll(rho, celli) for (label i=0; i<nSpecie_; i++)
{ {
const scalar rhoi = rho[celli]; RR_[i][celli] = dcdt[i]*specieThermo_[i].W();
const scalar Ti = this->thermo().T()[celli];
const scalar pi = this->thermo().p()[celli];
scalarField c(nSpecie_, 0.0);
for (label i=0; i<nSpecie_; i++)
{
const scalar Yi = Y_[i][celli];
c[i] = rhoi*Yi/specieThermo_[i].W();
}
const scalarField dcdt(omega(c, Ti, pi));
for (label i=0; i<nSpecie_; i++)
{
RR_[i][celli] = dcdt[i]*specieThermo_[i].W();
}
} }
} }
} }
@ -747,6 +752,11 @@ Foam::scalar Foam::ODEChemistryModel<CompType, ThermoType>::solve
scalar deltaTMin = GREAT; scalar deltaTMin = GREAT;
if (!this->chemistry_)
{
return deltaTMin;
}
const volScalarField rho const volScalarField rho
( (
IOobject IOobject
@ -761,21 +771,6 @@ Foam::scalar Foam::ODEChemistryModel<CompType, ThermoType>::solve
this->thermo().rho() this->thermo().rho()
); );
if (this->mesh().changing())
{
for (label i = 0; i < nSpecie_; i++)
{
RR_[i].setSize(this->mesh().nCells());
RR_[i] = 0.0;
}
}
if (!this->chemistry_)
{
return deltaTMin;
}
tmp<volScalarField> thc = this->thermo().hc(); tmp<volScalarField> thc = this->thermo().hc();
const scalarField& hc = thc(); const scalarField& hc = thc();
@ -856,7 +851,7 @@ Foam::scalar Foam::ODEChemistryModel<CompType, ThermoType>::solve
"const scalar, " "const scalar, "
"const scalar, " "const scalar, "
"const scalar" "const scalar"
")" ") const"
); );
return (0); return (0);

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -42,6 +42,7 @@ SourceFiles
#include "ODE.H" #include "ODE.H"
#include "volFieldsFwd.H" #include "volFieldsFwd.H"
#include "simpleMatrix.H" #include "simpleMatrix.H"
#include "DimensionedField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -90,14 +91,14 @@ protected:
label nReaction_; label nReaction_;
//- List of reaction rate per specie [kg/m3/s] //- List of reaction rate per specie [kg/m3/s]
PtrList<scalarField> RR_; PtrList<DimensionedField<scalar, volMesh> > RR_;
// Protected Member Functions // Protected Member Functions
//- Write access to chemical source terms //- Write access to chemical source terms
// (e.g. for multi-chemistry model) // (e.g. for multi-chemistry model)
inline PtrList<scalarField>& RR(); inline PtrList<DimensionedField<scalar, volMesh> >& RR();
public: public:
@ -205,8 +206,11 @@ public:
// Chemistry model functions (overriding abstract functions in // Chemistry model functions (overriding abstract functions in
// basicChemistryModel.H) // basicChemistryModel.H)
//- Return const access to the chemical source terms //- Return const access to the chemical source terms for specie, i
inline tmp<volScalarField> RR(const label i) const; inline const DimensionedField<scalar, volMesh>& RR
(
const label i
) const;
//- Solve the reaction system for the given start time and time //- Solve the reaction system for the given start time and time
// step and return the characteristic time // step and return the characteristic time

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -29,7 +29,7 @@ License
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CompType, class ThermoType> template<class CompType, class ThermoType>
inline Foam::PtrList<Foam::scalarField>& inline Foam::PtrList<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >&
Foam::ODEChemistryModel<CompType, ThermoType>::RR() Foam::ODEChemistryModel<CompType, ThermoType>::RR()
{ {
return RR_; return RR_;
@ -69,36 +69,13 @@ Foam::ODEChemistryModel<CompType, ThermoType>::nReaction() const
template<class CompType, class ThermoType> template<class CompType, class ThermoType>
inline Foam::tmp<Foam::volScalarField> inline const Foam::DimensionedField<Foam::scalar, Foam::volMesh>&
Foam::ODEChemistryModel<CompType, ThermoType>::RR Foam::ODEChemistryModel<CompType, ThermoType>::RR
( (
const label i const label i
) const ) const
{ {
tmp<volScalarField> tRR return RR_[i];
(
new volScalarField
(
IOobject
(
"RR(" + this->Y_[i].name() + ')',
this->time().timeName(),
this->mesh(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
this->mesh(),
dimensionedScalar("zero", dimMass/dimVolume/dimTime, 0.0),
zeroGradientFvPatchScalarField::typeName
)
);
if (this->chemistry_)
{
tRR().internalField() = RR_[i];
tRR().correctBoundaryConditions();
}
return tRR;
} }

View File

@ -38,11 +38,7 @@ namespace Foam
void Foam::basicChemistryModel::correct() void Foam::basicChemistryModel::correct()
{ {
if (mesh_.changing()) // do nothing
{
deltaTChem_.setSize(mesh_.nCells());
deltaTChem_ = deltaTChemIni_;
}
} }
@ -64,7 +60,19 @@ Foam::basicChemistryModel::basicChemistryModel(const fvMesh& mesh)
mesh_(mesh), mesh_(mesh),
chemistry_(lookup("chemistry")), chemistry_(lookup("chemistry")),
deltaTChemIni_(readScalar(lookup("initialChemicalTimeStep"))), deltaTChemIni_(readScalar(lookup("initialChemicalTimeStep"))),
deltaTChem_(mesh.nCells(), deltaTChemIni_) deltaTChem_
(
IOobject
(
"deltaTChem",
mesh.time().constant(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionedScalar("deltaTChem0", dimTime, deltaTChemIni_)
)
{} {}

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -40,6 +40,8 @@ SourceFiles
#include "Switch.H" #include "Switch.H"
#include "scalarField.H" #include "scalarField.H"
#include "volFieldsFwd.H" #include "volFieldsFwd.H"
#include "volMesh.H"
#include "DimensionedField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -80,14 +82,14 @@ protected:
const scalar deltaTChemIni_; const scalar deltaTChemIni_;
//- Latest estimation of integration step //- Latest estimation of integration step
scalarField deltaTChem_; DimensionedField<scalar, volMesh> deltaTChem_;
// Protected Member Functions // Protected Member Functions
//- Return non-const access to the latest estimation of integration //- Return non-const access to the latest estimation of integration
// step, e.g. for multi-chemistry model // step, e.g. for multi-chemistry model
scalarField& deltaTChem(); inline DimensionedField<scalar, volMesh>& deltaTChem();
//- Correct function - updates due to mesh changes //- Correct function - updates due to mesh changes
void correct(); void correct();
@ -118,7 +120,7 @@ public:
inline Switch chemistry() const; inline Switch chemistry() const;
//- Return the latest estimation of integration step //- Return the latest estimation of integration step
inline const scalarField& deltaTChem() const; inline const DimensionedField<scalar, volMesh>& deltaTChem() const;
// Functions to be derived in derived classes // Functions to be derived in derived classes
@ -126,7 +128,10 @@ public:
// Fields // Fields
//- Return const access to chemical source terms [kg/m3/s] //- Return const access to chemical source terms [kg/m3/s]
virtual tmp<volScalarField> RR(const label i) const = 0; virtual const DimensionedField<scalar, volMesh>& RR
(
const label i
) const = 0;
// Chemistry solution // Chemistry solution

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -37,13 +37,15 @@ inline Foam::Switch Foam::basicChemistryModel::chemistry() const
} }
inline const Foam::scalarField& Foam::basicChemistryModel::deltaTChem() const inline const Foam::DimensionedField<Foam::scalar, Foam::volMesh>&
Foam::basicChemistryModel::deltaTChem() const
{ {
return deltaTChem_; return deltaTChem_;
} }
inline Foam::scalarField& Foam::basicChemistryModel::deltaTChem() inline Foam::DimensionedField<Foam::scalar, Foam::volMesh>&
Foam::basicChemistryModel::deltaTChem()
{ {
return deltaTChem_; return deltaTChem_;
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License

View File

@ -71,7 +71,19 @@ ODESolidChemistryModel
RRs_.set RRs_.set
( (
fieldI, fieldI,
new scalarField(mesh.nCells(), 0.0) new DimensionedField<scalar, volMesh>
(
IOobject
(
"RRs::" + Ys_[fieldI].name(),
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionedScalar("zero", dimMass/dimVolume/dimTime, 0.0)
)
); );
@ -134,7 +146,8 @@ ODESolidChemistryModel
Y0Default Y0Default
) )
); );
// Calculate inital values of Ysi0 = rho*delta*Yi
// Calculate inital values of Ysi0 = rho*delta*Yi
Ys0_[fieldI].internalField() = Ys0_[fieldI].internalField() =
this->solid().rho() this->solid().rho()
*max(Ys_[fieldI], scalar(0.001))*mesh.V(); *max(Ys_[fieldI], scalar(0.001))*mesh.V();
@ -143,7 +156,23 @@ ODESolidChemistryModel
forAll(RRg_, fieldI) forAll(RRg_, fieldI)
{ {
RRg_.set(fieldI, new scalarField(mesh.nCells(), 0.0)); RRg_.set
(
fieldI,
new DimensionedField<scalar, volMesh>
(
IOobject
(
"RRg::" + pyrolisisGases_[fieldI],
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionedScalar("zero", dimMass/dimVolume/dimTime, 0.0)
)
);
} }
forAll(gasThermo_, gasI) forAll(gasThermo_, gasI)
@ -519,9 +548,12 @@ ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::nEqns() const
template<class CompType, class SolidThermo, class GasThermo> template<class CompType, class SolidThermo, class GasThermo>
void Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>:: void Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::calculate()
calculate()
{ {
if (!this->chemistry_)
{
return;
}
const volScalarField rho const volScalarField rho
( (
@ -537,58 +569,43 @@ calculate()
this->solid().rho() this->solid().rho()
); );
if (this->mesh().changing())
{
forAll(RRs_, i)
{
RRs_[i].setSize(rho.size());
}
forAll(RRg_, i)
{
RRg_[i].setSize(rho.size());
}
}
forAll(RRs_, i) forAll(RRs_, i)
{ {
RRs_[i] = 0.0; RRs_[i].field() = 0.0;
} }
forAll(RRg_, i) forAll(RRg_, i)
{ {
RRg_[i] = 0.0; RRg_[i].field() = 0.0;
} }
if (this->chemistry_) forAll(rho, celli)
{ {
forAll(rho, celli) cellCounter_ = celli;
const scalar delta = this->mesh().V()[celli];
if (reactingCells_[celli])
{ {
cellCounter_ = celli; scalar rhoi = rho[celli];
scalar Ti = this->solid().T()[celli];
scalar pi = this->solid().p()[celli];
const scalar delta = this->mesh().V()[celli]; scalarField c(nSpecie_, 0.0);
for (label i=0; i<nSolids_; i++)
if (reactingCells_[celli])
{ {
scalar rhoi = rho[celli]; c[i] = rhoi*Ys_[i][celli]*delta;
scalar Ti = this->solid().T()[celli]; }
scalar pi = this->solid().p()[celli];
scalarField c(nSpecie_, 0.0); const scalarField dcdt = omega(c, Ti, pi, true);
for (label i=0; i<nSolids_; i++)
{
c[i] = rhoi*Ys_[i][celli]*delta;
}
const scalarField dcdt = omega(c, Ti, pi, true); forAll(RRs_, i)
{
RRs_[i][celli] = dcdt[i]/delta;
}
forAll(RRs_, i) forAll(RRg_, i)
{ {
RRs_[i][celli] = dcdt[i]/delta; RRg_[i][celli] = dcdt[nSolids_ + i]/delta;
}
forAll(RRg_, i)
{
RRg_[i][celli] = dcdt[nSolids_ + i]/delta;
}
} }
} }
} }
@ -603,6 +620,13 @@ Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::solve
const scalar deltaT const scalar deltaT
) )
{ {
scalar deltaTMin = GREAT;
if (!this->chemistry_)
{
return deltaTMin;
}
const volScalarField rho const volScalarField rho
( (
IOobject IOobject
@ -617,33 +641,15 @@ Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::solve
this->solid().rho() this->solid().rho()
); );
if (this->mesh().changing())
{
forAll(RRs_, i)
{
RRs_[i].setSize(rho.size());
}
forAll(RRg_, i)
{
RRg_[i].setSize(rho.size());
}
}
forAll(RRs_, i) forAll(RRs_, i)
{ {
RRs_[i] = 0.0; RRs_[i].field() = 0.0;
} }
forAll(RRg_, i) forAll(RRg_, i)
{ {
RRg_[i] = 0.0; RRg_[i].field() = 0.0;
} }
if (!this->chemistry_)
{
return GREAT;
}
scalar deltaTMin = GREAT;
forAll(rho, celli) forAll(rho, celli)
{ {
@ -798,7 +804,7 @@ Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::solve
"const scalar, " "const scalar, "
"const scalar, " "const scalar, "
"const scalar" "const scalar"
")" ") const"
); );
return (0); return (0);
} }

View File

@ -41,6 +41,7 @@ SourceFiles
#include "solidReaction.H" #include "solidReaction.H"
#include "ODE.H" #include "ODE.H"
#include "volFieldsFwd.H" #include "volFieldsFwd.H"
#include "DimensionedField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -96,19 +97,19 @@ protected:
label nReaction_; label nReaction_;
//- List of reaction rate per solid [kg/m3/s] //- List of reaction rate per solid [kg/m3/s]
PtrList<scalarField> RRs_; PtrList<DimensionedField<scalar, volMesh> > RRs_;
//- List of reaction rate per gas [kg/m3/s] //- List of reaction rate per gas [kg/m3/s]
PtrList<scalarField> RRg_; PtrList<DimensionedField<scalar, volMesh> > RRg_;
// Protected Member Functions // Protected Member Functions
//- Write access to source terms for solids //- Write access to source terms for solids
inline PtrList<scalarField>& RRs(); inline PtrList<DimensionedField<scalar, volMesh> >& RRs();
//- Write access to source terms for gases //- Write access to source terms for gases
inline PtrList<scalarField>& RRg(); inline PtrList<DimensionedField<scalar, volMesh> >& RRg();
private: private:
@ -203,19 +204,28 @@ public:
// Chemistry model functions // Chemistry model functions
//- Return const access to the chemical source terms for solids //- Return const access to the chemical source terms for solids
inline tmp<volScalarField> RRs(const label i) const; inline const DimensionedField<scalar, volMesh>& RRs
(
const label i
) const;
//- Return const access to the chemical source terms for gases //- Return const access to the chemical source terms for gases
inline tmp<volScalarField> RRg(const label i) const; inline const DimensionedField<scalar, volMesh>& RRg
(
const label i
) const;
//- Return total gas source term //- Return total gas source term
inline tmp<volScalarField> RRg() const; inline tmp<DimensionedField<scalar, volMesh> > RRg() const;
//- Return total solid source term //- Return total solid source term
inline tmp<volScalarField> RRs() const; inline tmp<DimensionedField<scalar, volMesh> > RRs() const;
//- Return const access to the total source terms //- Return const access to the total source terms
inline tmp<volScalarField> RR(const label i) const; inline const DimensionedField<scalar, volMesh>& RR
(
const label i
) const;
//- Return sensible enthalpy for gas i [J/Kg] //- Return sensible enthalpy for gas i [J/Kg]
virtual tmp<volScalarField> gasHs virtual tmp<volScalarField> gasHs

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -29,7 +29,7 @@ License
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CompType, class SolidThermo, class GasThermo> template<class CompType, class SolidThermo, class GasThermo>
inline Foam::PtrList<Foam::scalarField>& inline Foam::PtrList<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >&
Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::RRs() Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::RRs()
{ {
return RRs_; return RRs_;
@ -37,7 +37,7 @@ Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::RRs()
template<class CompType, class SolidThermo, class GasThermo> template<class CompType, class SolidThermo, class GasThermo>
inline Foam::PtrList<Foam::scalarField>& inline Foam::PtrList<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >&
Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::RRg() Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::RRg()
{ {
return RRg_; return RRg_;
@ -87,80 +87,34 @@ nReaction() const
template<class CompType, class SolidThermo, class GasThermo> template<class CompType, class SolidThermo, class GasThermo>
inline Foam::tmp<Foam::volScalarField> inline const Foam::DimensionedField<Foam::scalar, Foam::volMesh>&
Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::RRs Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::RRs
( (
const label i const label i
) const ) const
{ {
tmp<volScalarField> tRRs return RRs_[i];
(
new volScalarField
(
IOobject
(
"RRs(" + Ys_[i].name() + ')',
this->time().timeName(),
this->mesh(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
this->mesh(),
dimensionedScalar("zero", dimMass/dimVolume/dimTime, 0.0),
zeroGradientFvPatchScalarField::typeName
)
);
if (this->chemistry_)
{
tRRs().internalField() = RRs_[i];
tRRs().correctBoundaryConditions();
}
return tRRs;
} }
template<class CompType, class SolidThermo, class GasThermo> template<class CompType, class SolidThermo, class GasThermo>
inline Foam::tmp<Foam::volScalarField> inline const Foam::DimensionedField<Foam::scalar, Foam::volMesh>&
Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::RRg Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::RRg
( (
const label i const label i
) const ) const
{ {
tmp<volScalarField> tRRg return RRg_[i];
(
new volScalarField
(
IOobject
(
"RRg(" + this->pyrolisisGases_[i] + ')',
this->time().timeName(),
this->mesh(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
this->mesh(),
dimensionedScalar("zero", dimMass/dimVolume/dimTime, 0.0),
zeroGradientFvPatchScalarField::typeName
)
);
if (this->chemistry_)
{
tRRg().internalField() = RRg_[i];
tRRg().correctBoundaryConditions();
}
return tRRg;
} }
template<class CompType, class SolidThermo, class GasThermo> template<class CompType, class SolidThermo, class GasThermo>
inline Foam::tmp<Foam::volScalarField> inline Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >
Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::RRg() const Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::RRg() const
{ {
tmp<volScalarField> tRRg tmp<DimensionedField<scalar, volMesh> > tRRg
( (
new volScalarField new DimensionedField<scalar, volMesh>
( (
IOobject IOobject
( (
@ -171,30 +125,29 @@ Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::RRg() const
IOobject::NO_WRITE IOobject::NO_WRITE
), ),
this->mesh(), this->mesh(),
dimensionedScalar("zero", dimMass/dimVolume/dimTime, 0.0), dimensionedScalar("zero", dimMass/dimVolume/dimTime, 0.0)
zeroGradientFvPatchScalarField::typeName
) )
); );
if (this->chemistry_) if (this->chemistry_)
{ {
DimensionedField<scalar, volMesh>& RRg = tRRg();
for (label i=0; i < nGases_; i++) for (label i=0; i < nGases_; i++)
{ {
tRRg().internalField() += RRg_[i]; RRg += RRg_[i];
} }
tRRg().correctBoundaryConditions();
} }
return tRRg; return tRRg;
} }
template<class CompType, class SolidThermo, class GasThermo> template<class CompType, class SolidThermo, class GasThermo>
inline Foam::tmp<Foam::volScalarField> inline Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >
Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::RRs() const Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::RRs() const
{ {
tmp<volScalarField> tRRs tmp<DimensionedField<scalar, volMesh> > tRRs
( (
new volScalarField new DimensionedField<scalar, volMesh>
( (
IOobject IOobject
( (
@ -205,32 +158,31 @@ Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::RRs() const
IOobject::NO_WRITE IOobject::NO_WRITE
), ),
this->mesh(), this->mesh(),
dimensionedScalar("zero", dimMass/dimVolume/dimTime, 0.0), dimensionedScalar("zero", dimMass/dimVolume/dimTime, 0.0)
zeroGradientFvPatchScalarField::typeName
) )
); );
if (this->chemistry_) if (this->chemistry_)
{ {
DimensionedField<scalar, volMesh>& RRs = tRRs();
for (label i=0; i < nSolids_; i++) for (label i=0; i < nSolids_; i++)
{ {
tRRs().internalField() += RRs_[i]; RRs += RRs_[i];
} }
tRRs().correctBoundaryConditions();
} }
return tRRs; return tRRs;
} }
template<class CompType, class SolidThermo, class GasThermo> template<class CompType, class SolidThermo, class GasThermo>
inline Foam::tmp<Foam::volScalarField> inline const Foam::DimensionedField<Foam::scalar, Foam::volMesh>&
Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::RR Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::RR
( (
const label i const label i
) const ) const
{ {
notImplemented("ODESolidChemistryModel::RR(const label)"); notImplemented("ODESolidChemistryModel::RR(const label)");
return (Foam::volScalarField::null()); return (DimensionedField<scalar, volMesh>::null());
} }

View File

@ -124,16 +124,22 @@ public:
inline const solidReactionThermo& solid() const; inline const solidReactionThermo& solid() const;
//- Return total gases mass source term [kg/m3/s] //- Return total gases mass source term [kg/m3/s]
virtual tmp<volScalarField> RRg() const = 0; virtual tmp<DimensionedField<scalar, volMesh> > RRg() const = 0;
//- Return total solids mass source term [kg/m3/s] //- Return total solids mass source term [kg/m3/s]
virtual tmp<volScalarField> RRs() const = 0; virtual tmp<DimensionedField<scalar, volMesh> > RRs() const = 0;
//- Return chemical source terms for solids [kg/m3/s] //- Return chemical source terms for solids [kg/m3/s]
virtual tmp<volScalarField> RRs(const label i) const = 0; virtual const DimensionedField<scalar, volMesh>& RRs
(
const label i
) const = 0;
//- Return chemical source terms for gases [kg/m3/s] //- Return chemical source terms for gases [kg/m3/s]
virtual tmp<volScalarField> RRg(const label i) const = 0; virtual const DimensionedField<scalar, volMesh>& RRg
(
const label i
) const = 0;
//- Return sensible enthalpy for gas i [J/Kg] //- Return sensible enthalpy for gas i [J/Kg]
virtual tmp<volScalarField> gasHs virtual tmp<volScalarField> gasHs

View File

@ -22,6 +22,7 @@ active true;
infinitelyFastChemistryCoeffs infinitelyFastChemistryCoeffs
{ {
C 10; C 10;
semiImplicit false;
} }
// ************************************************************************* // // ************************************************************************* //

View File

@ -31,9 +31,9 @@ FoamFile
radFluxName Qr; radFluxName Qr;
minimumDelta 1e-8; minimumDelta 1e-12;
reactionDeltaMin 1e-8; reactionDeltaMin 1e-12;
moveMesh false; moveMesh false;
} }

View File

@ -33,7 +33,7 @@ fvDOMCoeffs
nPhi 3; // azimuthal angles in PI/2 on X-Y.(from Y to X) nPhi 3; // azimuthal angles in PI/2 on X-Y.(from Y to X)
nTheta 6; // polar angles in PI (from Z to X-Y plane) nTheta 6; // polar angles in PI (from Z to X-Y plane)
convergence 1e-4; // convergence criteria for radiation iteration convergence 1e-4; // convergence criteria for radiation iteration
maxIter 4; // maximum number of iterations maxIter 2; // maximum number of iterations
} }
// Number of flow iterations per radiation iteration // Number of flow iterations per radiation iteration

View File

@ -16,25 +16,25 @@ FoamFile
application fireFoam; application fireFoam;
startFrom startTime; startFrom latestTime;
startTime 0; startTime 0;
stopAt endTime; stopAt endTime;
endTime 15.0; endTime 15;
deltaT 0.03; deltaT 0.03;
writeControl adjustableRunTime; writeControl adjustableRunTime;
writeInterval 0.5; writeInterval 1
purgeWrite 0; purgeWrite 0;
writeFormat ascii; writeFormat ascii;
writePrecision 6; writePrecision 12;
writeCompression off; writeCompression off;

View File

@ -70,6 +70,7 @@ fluxRequired
{ {
default no; default no;
p_rgh; p_rgh;
phiMesh;
} }

View File

@ -32,7 +32,7 @@ solvers
relTol 0; relTol 0;
} }
rhoThermo rho
{ {
solver PCG; solver PCG;
preconditioner DIC; preconditioner DIC;

View File

@ -23,7 +23,8 @@ active true;
infinitelyFastChemistryCoeffs infinitelyFastChemistryCoeffs
{ {
C 5.0; semiImplicit no;
C 5.0;
} }
FSDCoeffs FSDCoeffs

View File

@ -22,6 +22,7 @@ active on;
infinitelyFastChemistryCoeffs infinitelyFastChemistryCoeffs
{ {
semiImplicit no;
C 5.0; C 5.0;
} }