ENH: change deltaTChem to DimensionedField to enable auto mapping

This commit is contained in:
andy
2012-08-14 14:25:34 +01:00
parent affe532cd8
commit 69cc8d8ae7
3 changed files with 28 additions and 9 deletions

View File

@ -64,7 +64,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_;
} }