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;
K1 = 0.5*magSqr(U1);
K2 = 0.5*magSqr(U1);
K2 = 0.5*magSqr(U2);
dpdt = fvc::ddt(p);
}

View File

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

View File

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

View File

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

View File

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

View File

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

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
Description
Various mesh related information for a parallel run. Upon construction
constructs all info by using parallel communication.
Various mesh related information for a parallel run. Upon construction,
constructs all info using parallel communication.
Requires:
- all processor patches to have correct ordering.
- all processorPatches to have their transforms set.
The shared point and edge addressing is quite interesting.
It calculates addressing for points and edges on coupled patches. In
the 'old' way a distincation was made between points/edges that are
only on two processors and those that are on multiple processors. The
problem is that those on multiple processors do not allow any
transformations and require a global reduction on the master processor.
The shared point and edge addressing calculates addressing for points
and edges on coupled patches. In the 'old' way a distinction was made
between points/edges that are only on two processors and those that are
on multiple processors. The problem is that those on multiple processors
do not allow any transformations and require a global reduction on the
master processor.
The alternative is to have an exchange schedule (through a 'mapDistribute')
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
'master'. This master then does any calculation and sends
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
set of transformations - since transformations have to be space filling
only a certain number of transformation is supported.
on points on coupled faces. Any transformation is done using a
predetermined set of transformations - since transformations have to be
space filling only a certain number of transformation is supported.
The exchange needs
- a field of data
- 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
field
- a set of indices which indicate where to get transformed data in the
field
See also mapDistribute, globalIndexAndTransform
Notes:
Note
- compared to 17x nTotalFaces, nTotalPoints do not compensate for
shared points since this would trigger full connectivity analysis
- 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
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
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
globalMeshData.C

View File

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

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -49,6 +49,7 @@ volumeIntegrate
return vf.mesh().V()*vf.internalField();
}
template<class Type>
tmp<Field<Type> >
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>
dimensioned<Type>
domainIntegrate
@ -77,9 +95,9 @@ domainIntegrate
);
}
template<class Type>
dimensioned<Type>
domainIntegrate
dimensioned<Type> domainIntegrate
(
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

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
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>
dimensioned<Type> domainIntegrate
(
@ -78,6 +91,19 @@ namespace fvc
(
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
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -494,6 +494,13 @@ void Foam::fvMesh::mapFields(const mapPolyMesh& meshMap)
MapGeometricFields<tensor, fvsPatchField, fvMeshMapper, surfaceMesh>
(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
mapClouds(*this, meshMap);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -64,7 +64,19 @@ Foam::ODEChemistryModel<CompType, ThermoType>::ODEChemistryModel
RR_.set
(
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>
void Foam::ODEChemistryModel<CompType, ThermoType>::calculate()
{
if (!this->chemistry_)
{
return;
}
const volScalarField rho
(
IOobject
@ -701,17 +718,6 @@ void Foam::ODEChemistryModel<CompType, ThermoType>::calculate()
this->thermo().rho()
);
if (this->mesh().changing())
{
for (label i=0; i<nSpecie_; i++)
{
RR_[i].setSize(rho.size());
RR_[i] = 0.0;
}
}
if (this->chemistry_)
{
forAll(rho, celli)
{
const scalar rhoi = rho[celli];
@ -733,7 +739,6 @@ void Foam::ODEChemistryModel<CompType, ThermoType>::calculate()
}
}
}
}
template<class CompType, class ThermoType>
@ -747,6 +752,11 @@ Foam::scalar Foam::ODEChemistryModel<CompType, ThermoType>::solve
scalar deltaTMin = GREAT;
if (!this->chemistry_)
{
return deltaTMin;
}
const volScalarField rho
(
IOobject
@ -761,21 +771,6 @@ Foam::scalar Foam::ODEChemistryModel<CompType, ThermoType>::solve
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();
const scalarField& hc = thc();
@ -856,7 +851,7 @@ Foam::scalar Foam::ODEChemistryModel<CompType, ThermoType>::solve
"const scalar, "
"const scalar, "
"const scalar"
")"
") const"
);
return (0);

View File

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

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -29,7 +29,7 @@ License
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CompType, class ThermoType>
inline Foam::PtrList<Foam::scalarField>&
inline Foam::PtrList<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >&
Foam::ODEChemistryModel<CompType, ThermoType>::RR()
{
return RR_;
@ -69,36 +69,13 @@ Foam::ODEChemistryModel<CompType, ThermoType>::nReaction() const
template<class CompType, class ThermoType>
inline Foam::tmp<Foam::volScalarField>
inline const Foam::DimensionedField<Foam::scalar, Foam::volMesh>&
Foam::ODEChemistryModel<CompType, ThermoType>::RR
(
const label i
) const
{
tmp<volScalarField> tRR
(
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;
return RR_[i];
}

View File

@ -38,11 +38,7 @@ namespace Foam
void Foam::basicChemistryModel::correct()
{
if (mesh_.changing())
{
deltaTChem_.setSize(mesh_.nCells());
deltaTChem_ = deltaTChemIni_;
}
// do nothing
}
@ -64,7 +60,19 @@ Foam::basicChemistryModel::basicChemistryModel(const fvMesh& mesh)
mesh_(mesh),
chemistry_(lookup("chemistry")),
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
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -40,6 +40,8 @@ SourceFiles
#include "Switch.H"
#include "scalarField.H"
#include "volFieldsFwd.H"
#include "volMesh.H"
#include "DimensionedField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -80,14 +82,14 @@ protected:
const scalar deltaTChemIni_;
//- Latest estimation of integration step
scalarField deltaTChem_;
DimensionedField<scalar, volMesh> deltaTChem_;
// Protected Member Functions
//- Return non-const access to the latest estimation of integration
// step, e.g. for multi-chemistry model
scalarField& deltaTChem();
inline DimensionedField<scalar, volMesh>& deltaTChem();
//- Correct function - updates due to mesh changes
void correct();
@ -118,7 +120,7 @@ public:
inline Switch chemistry() const;
//- 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
@ -126,7 +128,10 @@ public:
// Fields
//- 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

View File

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

View File

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

View File

@ -71,7 +71,19 @@ ODESolidChemistryModel
RRs_.set
(
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,6 +146,7 @@ ODESolidChemistryModel
Y0Default
)
);
// Calculate inital values of Ysi0 = rho*delta*Yi
Ys0_[fieldI].internalField() =
this->solid().rho()
@ -143,7 +156,23 @@ ODESolidChemistryModel
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)
@ -519,9 +548,12 @@ ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::nEqns() const
template<class CompType, class SolidThermo, class GasThermo>
void Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::
calculate()
void Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::calculate()
{
if (!this->chemistry_)
{
return;
}
const volScalarField rho
(
@ -537,29 +569,15 @@ calculate()
this->solid().rho()
);
if (this->mesh().changing())
{
forAll(RRs_, i)
{
RRs_[i].setSize(rho.size());
RRs_[i].field() = 0.0;
}
forAll(RRg_, i)
{
RRg_[i].setSize(rho.size());
}
RRg_[i].field() = 0.0;
}
forAll(RRs_, i)
{
RRs_[i] = 0.0;
}
forAll(RRg_, i)
{
RRg_[i] = 0.0;
}
if (this->chemistry_)
{
forAll(rho, celli)
{
cellCounter_ = celli;
@ -592,7 +610,6 @@ calculate()
}
}
}
}
template<class CompType, class SolidThermo, class GasThermo>
@ -603,6 +620,13 @@ Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::solve
const scalar deltaT
)
{
scalar deltaTMin = GREAT;
if (!this->chemistry_)
{
return deltaTMin;
}
const volScalarField rho
(
IOobject
@ -617,33 +641,15 @@ Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::solve
this->solid().rho()
);
if (this->mesh().changing())
{
forAll(RRs_, i)
{
RRs_[i].setSize(rho.size());
RRs_[i].field() = 0.0;
}
forAll(RRg_, i)
{
RRg_[i].setSize(rho.size());
}
RRg_[i].field() = 0.0;
}
forAll(RRs_, i)
{
RRs_[i] = 0.0;
}
forAll(RRg_, i)
{
RRg_[i] = 0.0;
}
if (!this->chemistry_)
{
return GREAT;
}
scalar deltaTMin = GREAT;
forAll(rho, celli)
{
@ -798,7 +804,7 @@ Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::solve
"const scalar, "
"const scalar, "
"const scalar"
")"
") const"
);
return (0);
}

View File

@ -41,6 +41,7 @@ SourceFiles
#include "solidReaction.H"
#include "ODE.H"
#include "volFieldsFwd.H"
#include "DimensionedField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -96,19 +97,19 @@ protected:
label nReaction_;
//- 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]
PtrList<scalarField> RRg_;
PtrList<DimensionedField<scalar, volMesh> > RRg_;
// Protected Member Functions
//- Write access to source terms for solids
inline PtrList<scalarField>& RRs();
inline PtrList<DimensionedField<scalar, volMesh> >& RRs();
//- Write access to source terms for gases
inline PtrList<scalarField>& RRg();
inline PtrList<DimensionedField<scalar, volMesh> >& RRg();
private:
@ -203,19 +204,28 @@ public:
// Chemistry model functions
//- 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
inline tmp<volScalarField> RRg(const label i) const;
inline const DimensionedField<scalar, volMesh>& RRg
(
const label i
) const;
//- Return total gas source term
inline tmp<volScalarField> RRg() const;
inline tmp<DimensionedField<scalar, volMesh> > RRg() const;
//- 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
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]
virtual tmp<volScalarField> gasHs

View File

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

View File

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

View File

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

View File

@ -33,7 +33,7 @@ fvDOMCoeffs
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)
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

View File

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

View File

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

View File

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

View File

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

View File

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