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

This commit is contained in:
mattijs
2013-08-06 17:19:59 +01:00
57 changed files with 959 additions and 151052 deletions

View File

@ -29,7 +29,7 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::kineticTheoryModel::kineticTheoryModel Foam::RASModels::kineticTheoryModel::kineticTheoryModel
( (
const volScalarField& alpha, const volScalarField& alpha,
const geometricOneField& rho, const geometricOneField& rho,
@ -139,13 +139,13 @@ Foam::kineticTheoryModel::kineticTheoryModel
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::kineticTheoryModel::~kineticTheoryModel() Foam::RASModels::kineticTheoryModel::~kineticTheoryModel()
{} {}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::kineticTheoryModel::read() bool Foam::RASModels::kineticTheoryModel::read()
{ {
if if
( (
@ -175,21 +175,24 @@ bool Foam::kineticTheoryModel::read()
} }
Foam::tmp<Foam::volScalarField> Foam::kineticTheoryModel::k() const Foam::tmp<Foam::volScalarField>
Foam::RASModels::kineticTheoryModel::k() const
{ {
notImplemented("kineticTheoryModel::k()"); notImplemented("kineticTheoryModel::k()");
return nut_; return nut_;
} }
Foam::tmp<Foam::volScalarField> Foam::kineticTheoryModel::epsilon() const Foam::tmp<Foam::volScalarField>
Foam::RASModels::kineticTheoryModel::epsilon() const
{ {
notImplemented("kineticTheoryModel::epsilon()"); notImplemented("kineticTheoryModel::epsilon()");
return nut_; return nut_;
} }
Foam::tmp<Foam::volSymmTensorField> Foam::kineticTheoryModel::R() const Foam::tmp<Foam::volSymmTensorField>
Foam::RASModels::kineticTheoryModel::R() const
{ {
return tmp<volSymmTensorField> return tmp<volSymmTensorField>
( (
@ -211,7 +214,8 @@ Foam::tmp<Foam::volSymmTensorField> Foam::kineticTheoryModel::R() const
/* /*
Foam::tmp<Foam::volScalarField> Foam::kineticTheoryModel::pp() const Foam::tmp<Foam::volScalarField>
Foam::RASModels::kineticTheoryModel::pp() const
{ {
// Particle pressure coefficient // Particle pressure coefficient
@ -244,7 +248,8 @@ Foam::tmp<Foam::volScalarField> Foam::kineticTheoryModel::pp() const
*/ */
Foam::tmp<Foam::volScalarField> Foam::kineticTheoryModel::pPrime() const Foam::tmp<Foam::volScalarField>
Foam::RASModels::kineticTheoryModel::pPrime() const
{ {
// Local references // Local references
const volScalarField& alpha = this->alpha_; const volScalarField& alpha = this->alpha_;
@ -271,7 +276,8 @@ Foam::tmp<Foam::volScalarField> Foam::kineticTheoryModel::pPrime() const
} }
Foam::tmp<Foam::surfaceScalarField> Foam::kineticTheoryModel::pPrimef() const Foam::tmp<Foam::surfaceScalarField>
Foam::RASModels::kineticTheoryModel::pPrimef() const
{ {
// Local references // Local references
const volScalarField& alpha = this->alpha_; const volScalarField& alpha = this->alpha_;
@ -298,7 +304,8 @@ Foam::tmp<Foam::surfaceScalarField> Foam::kineticTheoryModel::pPrimef() const
} }
Foam::tmp<Foam::volSymmTensorField> Foam::kineticTheoryModel::devRhoReff() const Foam::tmp<Foam::volSymmTensorField>
Foam::RASModels::kineticTheoryModel::devRhoReff() const
{ {
return tmp<volSymmTensorField> return tmp<volSymmTensorField>
( (
@ -320,7 +327,8 @@ Foam::tmp<Foam::volSymmTensorField> Foam::kineticTheoryModel::devRhoReff() const
} }
Foam::tmp<Foam::fvVectorMatrix> Foam::kineticTheoryModel::divDevRhoReff Foam::tmp<Foam::fvVectorMatrix>
Foam::RASModels::kineticTheoryModel::divDevRhoReff
( (
volVectorField& U volVectorField& U
) const ) const
@ -338,7 +346,7 @@ Foam::tmp<Foam::fvVectorMatrix> Foam::kineticTheoryModel::divDevRhoReff
} }
void Foam::kineticTheoryModel::correct() void Foam::RASModels::kineticTheoryModel::correct()
{ {
// Local references // Local references
volScalarField alpha(max(this->alpha_, 0.0)); volScalarField alpha(max(this->alpha_, 0.0));

View File

@ -61,6 +61,8 @@ SourceFiles
namespace Foam namespace Foam
{ {
namespace RASModels
{
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class kineticTheoryModel Declaration Class kineticTheoryModel Declaration
@ -212,6 +214,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace Foam } // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -26,258 +26,62 @@ License
#include "PhaseIncompressibleTurbulenceModel.H" #include "PhaseIncompressibleTurbulenceModel.H"
#include "phaseModel.H" #include "phaseModel.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
#include "makeTurbulenceModel.H"
namespace Foam
{
typedef TurbulenceModel
<
volScalarField,
geometricOneField,
incompressibleTurbulenceModel,
phaseModel
> basePhaseIncompressibleTransportTurbulenceModel;
defineTemplateRunTimeSelectionTable
(
basePhaseIncompressibleTransportTurbulenceModel,
dictionary
);
typedef PhaseIncompressibleTurbulenceModel<phaseModel>
incompressibleTransportTurbulenceModel;
}
#include "laminar.H" #include "laminar.H"
namespace Foam
{
typedef laminar<incompressibleTransportTurbulenceModel>
incompressibleLaminar;
defineNamedTemplateTypeNameAndDebug(incompressibleLaminar, 0);
addToRunTimeSelectionTable
(
basePhaseIncompressibleTransportTurbulenceModel,
incompressibleLaminar,
dictionary
);
}
#include "RASModel.H" #include "RASModel.H"
#include "LESModel.H"
makeBaseTurbulenceModel
(
volScalarField,
geometricOneField,
incompressibleTurbulenceModel,
PhaseIncompressibleTurbulenceModel,
phaseModel
);
#define makeRASModel(Type) \
makeTemplatedTurbulenceModel \
(phaseModelPhaseIncompressibleTurbulenceModel, RAS, Type)
#define makeLESModel(Type) \
makeTemplatedTurbulenceModel \
(phaseModelPhaseIncompressibleTurbulenceModel, LES, Type)
#include "kEpsilon.H" #include "kEpsilon.H"
makeRASModel(kEpsilon);
#include "LaheyKEpsilon.H" #include "LaheyKEpsilon.H"
makeRASModel(LaheyKEpsilon);
#include "continuousGasKEpsilon.H" #include "continuousGasKEpsilon.H"
makeRASModel(continuousGasKEpsilon);
namespace Foam #include "Smagorinsky.H"
{ makeLESModel(Smagorinsky);
typedef RASModel<incompressibleTransportTurbulenceModel>
incompressibleRASModel;
defineNamedTemplateTypeNameAndDebug(incompressibleRASModel, 0); #include "kEqn.H"
makeLESModel(kEqn);
defineTemplateRunTimeSelectionTable(incompressibleRASModel, dictionary); #include "SmagorinskyZhang.H"
makeLESModel(SmagorinskyZhang);
addToRunTimeSelectionTable #include "NicenoKEqn.H"
( makeLESModel(NicenoKEqn);
basePhaseIncompressibleTransportTurbulenceModel,
incompressibleRASModel,
dictionary
);
namespace RASModels #include "continuousGasKEqn.H"
{ makeLESModel(continuousGasKEqn);
typedef kEpsilon<incompressibleTransportTurbulenceModel>
incompressiblekEpsilon;
defineNamedTemplateTypeNameAndDebug(incompressiblekEpsilon, 0);
addToRunTimeSelectionTable
(
incompressibleRASModel,
incompressiblekEpsilon,
dictionary
);
}
namespace RASModels
{
typedef LaheyKEpsilon<incompressibleTransportTurbulenceModel>
incompressibleLaheyKEpsilon;
defineNamedTemplateTypeNameAndDebug(incompressibleLaheyKEpsilon, 0);
addToRunTimeSelectionTable
(
incompressibleRASModel,
incompressibleLaheyKEpsilon,
dictionary
);
}
namespace RASModels
{
typedef continuousGasKEpsilon<incompressibleTransportTurbulenceModel>
incompressiblecontinuousGasKEpsilon;
defineNamedTemplateTypeNameAndDebug
(
incompressiblecontinuousGasKEpsilon,
0
);
addToRunTimeSelectionTable
(
incompressibleRASModel,
incompressiblecontinuousGasKEpsilon,
dictionary
);
}
}
#include "kineticTheoryModel.H" #include "kineticTheoryModel.H"
makeTurbulenceModel
namespace Foam (phaseModelPhaseIncompressibleTurbulenceModel, RAS, kineticTheoryModel);
{
typedef PhaseIncompressibleTurbulenceModel<phaseModel>
incompressibleTransportTurbulenceModel;
typedef RASModel<incompressibleTransportTurbulenceModel>
incompressibleRASModel;
defineTypeNameAndDebug(kineticTheoryModel, 0);
addToRunTimeSelectionTable
(
incompressibleRASModel,
kineticTheoryModel,
dictionary
);
}
#include "phasePressureModel.H" #include "phasePressureModel.H"
makeTurbulenceModel
namespace Foam (phaseModelPhaseIncompressibleTurbulenceModel, RAS, phasePressureModel);
{
typedef PhaseIncompressibleTurbulenceModel<phaseModel>
incompressibleTransportTurbulenceModel;
typedef RASModel<incompressibleTransportTurbulenceModel>
incompressibleRASModel;
defineTypeNameAndDebug(phasePressureModel, 0);
addToRunTimeSelectionTable
(
incompressibleRASModel,
phasePressureModel,
dictionary
);
}
#include "LESModel.H"
#include "Smagorinsky.H"
#include "SmagorinskyZhang.H"
#include "kEqn.H"
#include "NicenoKEqn.H"
#include "continuousGasKEqn.H"
namespace Foam
{
typedef LESModel<incompressibleTransportTurbulenceModel>
incompressibleLESModel;
defineNamedTemplateTypeNameAndDebug(incompressibleLESModel, 0);
defineTemplateRunTimeSelectionTable(incompressibleLESModel, dictionary);
addToRunTimeSelectionTable
(
basePhaseIncompressibleTransportTurbulenceModel,
incompressibleLESModel,
dictionary
);
namespace LESModels
{
typedef Smagorinsky<incompressibleTransportTurbulenceModel>
incompressibleSmagorinsky;
defineNamedTemplateTypeNameAndDebug(incompressibleSmagorinsky, 0);
addToRunTimeSelectionTable
(
incompressibleLESModel,
incompressibleSmagorinsky,
dictionary
);
}
namespace LESModels
{
typedef SmagorinskyZhang<incompressibleTransportTurbulenceModel>
incompressibleSmagorinskyZhang;
defineNamedTemplateTypeNameAndDebug(incompressibleSmagorinskyZhang, 0);
addToRunTimeSelectionTable
(
incompressibleLESModel,
incompressibleSmagorinskyZhang,
dictionary
);
}
namespace LESModels
{
typedef kEqn<incompressibleTransportTurbulenceModel>
incompressiblekEqn;
defineNamedTemplateTypeNameAndDebug(incompressiblekEqn, 0);
addToRunTimeSelectionTable
(
incompressibleLESModel,
incompressiblekEqn,
dictionary
);
}
namespace LESModels
{
typedef NicenoKEqn<incompressibleTransportTurbulenceModel>
incompressibleNicenoKEqn;
defineNamedTemplateTypeNameAndDebug(incompressibleNicenoKEqn, 0);
addToRunTimeSelectionTable
(
incompressibleLESModel,
incompressibleNicenoKEqn,
dictionary
);
}
namespace LESModels
{
typedef continuousGasKEqn<incompressibleTransportTurbulenceModel>
incompressiblecontinuousGasKEqn;
defineNamedTemplateTypeNameAndDebug(incompressiblecontinuousGasKEqn, 0);
addToRunTimeSelectionTable
(
incompressibleLESModel,
incompressiblecontinuousGasKEqn,
dictionary
);
}
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -28,7 +28,7 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::phasePressureModel::phasePressureModel Foam::RASModels::phasePressureModel::phasePressureModel
( (
const volScalarField& alpha, const volScalarField& alpha,
const geometricOneField& rho, const geometricOneField& rho,
@ -75,13 +75,13 @@ Foam::phasePressureModel::phasePressureModel
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::phasePressureModel::~phasePressureModel() Foam::RASModels::phasePressureModel::~phasePressureModel()
{} {}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::phasePressureModel::read() bool Foam::RASModels::phasePressureModel::read()
{ {
if if
( (
@ -105,21 +105,24 @@ bool Foam::phasePressureModel::read()
} }
Foam::tmp<Foam::volScalarField> Foam::phasePressureModel::k() const Foam::tmp<Foam::volScalarField>
Foam::RASModels::phasePressureModel::k() const
{ {
notImplemented("phasePressureModel::k()"); notImplemented("phasePressureModel::k()");
return nut_; return nut_;
} }
Foam::tmp<Foam::volScalarField> Foam::phasePressureModel::epsilon() const Foam::tmp<Foam::volScalarField>
Foam::RASModels::phasePressureModel::epsilon() const
{ {
notImplemented("phasePressureModel::epsilon()"); notImplemented("phasePressureModel::epsilon()");
return nut_; return nut_;
} }
Foam::tmp<Foam::volSymmTensorField> Foam::phasePressureModel::R() const Foam::tmp<Foam::volSymmTensorField>
Foam::RASModels::phasePressureModel::R() const
{ {
return tmp<volSymmTensorField> return tmp<volSymmTensorField>
( (
@ -145,7 +148,8 @@ Foam::tmp<Foam::volSymmTensorField> Foam::phasePressureModel::R() const
} }
Foam::tmp<Foam::volScalarField> Foam::phasePressureModel::pPrime() const Foam::tmp<Foam::volScalarField>
Foam::RASModels::phasePressureModel::pPrime() const
{ {
return return
g0_ g0_
@ -157,7 +161,8 @@ Foam::tmp<Foam::volScalarField> Foam::phasePressureModel::pPrime() const
} }
Foam::tmp<Foam::surfaceScalarField> Foam::phasePressureModel::pPrimef() const Foam::tmp<Foam::surfaceScalarField>
Foam::RASModels::phasePressureModel::pPrimef() const
{ {
return return
g0_ g0_
@ -169,7 +174,8 @@ Foam::tmp<Foam::surfaceScalarField> Foam::phasePressureModel::pPrimef() const
} }
Foam::tmp<Foam::volSymmTensorField> Foam::phasePressureModel::devRhoReff() const Foam::tmp<Foam::volSymmTensorField>
Foam::RASModels::phasePressureModel::devRhoReff() const
{ {
return tmp<volSymmTensorField> return tmp<volSymmTensorField>
( (
@ -195,7 +201,8 @@ Foam::tmp<Foam::volSymmTensorField> Foam::phasePressureModel::devRhoReff() const
} }
Foam::tmp<Foam::fvVectorMatrix> Foam::phasePressureModel::divDevRhoReff Foam::tmp<Foam::fvVectorMatrix>
Foam::RASModels::phasePressureModel::divDevRhoReff
( (
volVectorField& U volVectorField& U
) const ) const
@ -211,7 +218,7 @@ Foam::tmp<Foam::fvVectorMatrix> Foam::phasePressureModel::divDevRhoReff
} }
void Foam::phasePressureModel::correct() void Foam::RASModels::phasePressureModel::correct()
{} {}

View File

@ -60,6 +60,8 @@ SourceFiles
namespace Foam namespace Foam
{ {
namespace RASModels
{
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class phasePressureModel Declaration Class phasePressureModel Declaration
@ -179,6 +181,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace Foam } // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -96,7 +96,8 @@ Foam::cachedRandom::cachedRandom(const cachedRandom& cr, const bool reset)
osRandomSeed(seed_); osRandomSeed(seed_);
} }
else if (reset)
if (reset && samples_.size())
{ {
sampleI_ = 0; sampleI_ = 0;
} }

View File

@ -26,116 +26,37 @@ License
#include "CompressibleTurbulenceModel.H" #include "CompressibleTurbulenceModel.H"
#include "fluidThermo.H" #include "fluidThermo.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
#include "makeTurbulenceModel.H"
namespace Foam
{
typedef TurbulenceModel
<
geometricOneField,
volScalarField,
compressibleTurbulenceModel,
fluidThermo
> baseCompressibleFluidThermoTurbulenceModel;
defineTemplateRunTimeSelectionTable
(
baseCompressibleFluidThermoTurbulenceModel,
dictionary
);
typedef CompressibleTurbulenceModel<fluidThermo>
compressibleFluidThermoTurbulenceModel;
}
#include "laminar.H" #include "laminar.H"
namespace Foam
{
typedef laminar<compressibleFluidThermoTurbulenceModel> compressibleLaminar;
defineNamedTemplateTypeNameAndDebug(compressibleLaminar, 0);
addToRunTimeSelectionTable
(
baseCompressibleFluidThermoTurbulenceModel,
compressibleLaminar,
dictionary
);
}
#include "RASModel.H" #include "RASModel.H"
#include "kEpsilon.H"
namespace Foam
{
typedef RASModel<compressibleFluidThermoTurbulenceModel>
compressibleRASModel;
defineNamedTemplateTypeNameAndDebug(compressibleRASModel, 0);
defineTemplateRunTimeSelectionTable(compressibleRASModel, dictionary);
addToRunTimeSelectionTable
(
baseCompressibleFluidThermoTurbulenceModel,
compressibleRASModel,
dictionary
);
namespace RASModels
{
typedef kEpsilon<compressibleFluidThermoTurbulenceModel>
compressibleKEpsilon;
defineNamedTemplateTypeNameAndDebug(compressibleKEpsilon, 0);
addToRunTimeSelectionTable
(
compressibleRASModel,
compressibleKEpsilon,
dictionary
);
}
}
#include "LESModel.H" #include "LESModel.H"
makeBaseTurbulenceModel
(
geometricOneField,
volScalarField,
compressibleTurbulenceModel,
CompressibleTurbulenceModel,
fluidThermo
);
#define makeRASModel(Type) \
makeTemplatedTurbulenceModel \
(fluidThermoCompressibleTurbulenceModel, RAS, Type)
#define makeLESModel(Type) \
makeTemplatedTurbulenceModel \
(fluidThermoCompressibleTurbulenceModel, LES, Type)
#include "kEpsilon.H"
makeRASModel(kEpsilon);
#include "Smagorinsky.H" #include "Smagorinsky.H"
makeLESModel(Smagorinsky);
namespace Foam #include "kEqn.H"
{ makeLESModel(kEqn);
typedef LESModel<compressibleFluidThermoTurbulenceModel>
compressibleLESModel;
defineNamedTemplateTypeNameAndDebug(compressibleLESModel, 0);
defineTemplateRunTimeSelectionTable(compressibleLESModel, dictionary);
addToRunTimeSelectionTable
(
baseCompressibleFluidThermoTurbulenceModel,
compressibleLESModel,
dictionary
);
namespace LESModels
{
typedef Smagorinsky<compressibleFluidThermoTurbulenceModel>
compressibleSmagorinsky;
defineNamedTemplateTypeNameAndDebug(compressibleSmagorinsky, 0);
addToRunTimeSelectionTable
(
compressibleLESModel,
compressibleSmagorinsky,
dictionary
);
}
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -26,136 +26,37 @@ License
#include "IncompressibleTurbulenceModel.H" #include "IncompressibleTurbulenceModel.H"
#include "transportModel.H" #include "transportModel.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
#include "makeTurbulenceModel.H"
namespace Foam
{
typedef TurbulenceModel
<
geometricOneField,
geometricOneField,
incompressibleTurbulenceModel,
transportModel
> baseIncompressibleTransportTurbulenceModel;
defineTemplateRunTimeSelectionTable
(
baseIncompressibleTransportTurbulenceModel,
dictionary
);
typedef IncompressibleTurbulenceModel
<
transportModel
> incompressibleTransportTurbulenceModel;
}
#include "laminar.H" #include "laminar.H"
namespace Foam
{
typedef laminar<incompressibleTransportTurbulenceModel>
incompressibleLaminar;
defineNamedTemplateTypeNameAndDebug(incompressibleLaminar, 0);
addToRunTimeSelectionTable
(
baseIncompressibleTransportTurbulenceModel,
incompressibleLaminar,
dictionary
);
}
#include "RASModel.H" #include "RASModel.H"
#include "kEpsilon.H"
namespace Foam
{
typedef RASModel<incompressibleTransportTurbulenceModel>
incompressibleRASModel;
defineNamedTemplateTypeNameAndDebug(incompressibleRASModel, 0);
defineTemplateRunTimeSelectionTable(incompressibleRASModel, dictionary);
addToRunTimeSelectionTable
(
baseIncompressibleTransportTurbulenceModel,
incompressibleRASModel,
dictionary
);
namespace RASModels
{
typedef kEpsilon<incompressibleTransportTurbulenceModel>
incompressibleKEpsilon;
defineNamedTemplateTypeNameAndDebug(incompressibleKEpsilon, 0);
addToRunTimeSelectionTable
(
incompressibleRASModel,
incompressibleKEpsilon,
dictionary
);
}
}
#include "LESModel.H" #include "LESModel.H"
makeBaseTurbulenceModel
(
geometricOneField,
geometricOneField,
incompressibleTurbulenceModel,
IncompressibleTurbulenceModel,
transportModel
);
#define makeRASModel(Type) \
makeTemplatedTurbulenceModel \
(transportModelIncompressibleTurbulenceModel, RAS, Type)
#define makeLESModel(Type) \
makeTemplatedTurbulenceModel \
(transportModelIncompressibleTurbulenceModel, LES, Type)
#include "kEpsilon.H"
makeRASModel(kEpsilon);
#include "Smagorinsky.H" #include "Smagorinsky.H"
makeLESModel(Smagorinsky);
#include "kEqn.H" #include "kEqn.H"
makeLESModel(kEqn);
namespace Foam
{
typedef LESModel<incompressibleTransportTurbulenceModel>
incompressibleLESModel;
defineNamedTemplateTypeNameAndDebug(incompressibleLESModel, 0);
defineTemplateRunTimeSelectionTable(incompressibleLESModel, dictionary);
addToRunTimeSelectionTable
(
baseIncompressibleTransportTurbulenceModel,
incompressibleLESModel,
dictionary
);
namespace LESModels
{
typedef Smagorinsky<incompressibleTransportTurbulenceModel>
incompressibleSmagorinsky;
defineNamedTemplateTypeNameAndDebug(incompressibleSmagorinsky, 0);
addToRunTimeSelectionTable
(
incompressibleLESModel,
incompressibleSmagorinsky,
dictionary
);
}
namespace LESModels
{
typedef kEqn<incompressibleTransportTurbulenceModel>
incompressiblekEqn;
defineNamedTemplateTypeNameAndDebug(incompressiblekEqn, 0);
addToRunTimeSelectionTable
(
incompressibleLESModel,
incompressiblekEqn,
dictionary
);
}
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -0,0 +1,126 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 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/>.
\*---------------------------------------------------------------------------*/
#define makeBaseTurbulenceModel(Alpha, Rho, baseModel, BaseModel, Transport) \
\
namespace Foam \
{ \
typedef TurbulenceModel \
< \
Alpha, \
Rho, \
baseModel, \
Transport \
> Transport##baseModel; \
\
defineTemplateRunTimeSelectionTable \
( \
Transport##baseModel, \
dictionary \
); \
\
typedef BaseModel<Transport> Transport##BaseModel; \
\
\
typedef laminar<Transport##BaseModel> Laminar##Transport##BaseModel; \
\
defineNamedTemplateTypeNameAndDebug(Laminar##Transport##BaseModel, 0); \
\
addToRunTimeSelectionTable \
( \
Transport##baseModel, \
Laminar##Transport##BaseModel, \
dictionary \
); \
\
\
typedef RASModel<Transport##BaseModel> RAS##Transport##BaseModel; \
\
defineNamedTemplateTypeNameAndDebug(RAS##Transport##BaseModel, 0); \
\
defineTemplateRunTimeSelectionTable \
(RAS##Transport##BaseModel, dictionary); \
\
addToRunTimeSelectionTable \
( \
Transport##baseModel, \
RAS##Transport##BaseModel, \
dictionary \
); \
\
\
typedef LESModel<Transport##BaseModel> LES##Transport##BaseModel; \
\
defineNamedTemplateTypeNameAndDebug(LES##Transport##BaseModel, 0); \
\
defineTemplateRunTimeSelectionTable \
(LES##Transport##BaseModel, dictionary); \
\
addToRunTimeSelectionTable \
( \
Transport##baseModel, \
LES##Transport##BaseModel, \
dictionary \
); \
}
#define makeTemplatedTurbulenceModel(BaseModel, SType, Type) \
namespace Foam \
{ \
namespace SType##Models \
{ \
typedef Type<BaseModel> Type##SType##BaseModel; \
\
defineNamedTemplateTypeNameAndDebug(Type##SType##BaseModel, 0); \
\
addToRunTimeSelectionTable \
( \
SType##BaseModel, \
Type##SType##BaseModel, \
dictionary \
); \
} \
}
#define makeTurbulenceModel(BaseModel, SType, Type) \
namespace Foam \
{ \
namespace SType##Models \
{ \
defineTypeNameAndDebug(Type, 0); \
\
addToRunTimeSelectionTable \
( \
SType##BaseModel, \
Type, \
dictionary \
); \
} \
}
// ************************************************************************* //

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-2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -33,7 +33,7 @@ Description
mean velocity: mean velocity:
\f[ \f[
k_p = 1.5 I |U|^2 k_p = 1.5 (I |U|)^2
\f] \f]
where where

View File

@ -350,6 +350,9 @@ public:
inline const typename parcelType::constantProperties& inline const typename parcelType::constantProperties&
constProps() const; constProps() const;
//- Return access to the constant properties
inline typename parcelType::constantProperties& constProps();
//- Return reference to the sub-models dictionary //- Return reference to the sub-models dictionary
inline const dictionary& subModelProperties() const; inline const dictionary& subModelProperties() const;

View File

@ -89,6 +89,14 @@ Foam::KinematicCloud<CloudType>::constProps() const
} }
template<class CloudType>
inline typename CloudType::particleType::constantProperties&
Foam::KinematicCloud<CloudType>::constProps()
{
return constProps_;
}
template<class CloudType> template<class CloudType>
inline const Foam::dictionary& inline const Foam::dictionary&
Foam::KinematicCloud<CloudType>::subModelProperties() const Foam::KinematicCloud<CloudType>::subModelProperties() const

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-2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -206,6 +206,9 @@ public:
inline const typename parcelType::constantProperties& inline const typename parcelType::constantProperties&
constProps() const; constProps() const;
//- Return access to the constant properties
inline typename parcelType::constantProperties& constProps();
// Sub-models // Sub-models

View File

@ -41,6 +41,14 @@ Foam::ReactingCloud<CloudType>::constProps() const
} }
template<class CloudType>
inline typename CloudType::particleType::constantProperties&
Foam::ReactingCloud<CloudType>::constProps()
{
return constProps_;
}
template<class CloudType> template<class CloudType>
inline const Foam::CompositionModel<Foam::ReactingCloud<CloudType> >& inline const Foam::CompositionModel<Foam::ReactingCloud<CloudType> >&
Foam::ReactingCloud<CloudType>::composition() const Foam::ReactingCloud<CloudType>::composition() const

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-2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -211,6 +211,9 @@ public:
inline const typename parcelType::constantProperties& inline const typename parcelType::constantProperties&
constProps() const; constProps() const;
//- Return access to the constant properties
inline typename parcelType::constantProperties& constProps();
// Sub-models // Sub-models

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-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -41,6 +41,14 @@ Foam::ReactingMultiphaseCloud<CloudType>::constProps() const
} }
template<class CloudType>
inline typename CloudType::particleType::constantProperties&
Foam::ReactingMultiphaseCloud<CloudType>::constProps()
{
return constProps_;
}
template<class CloudType> template<class CloudType>
inline const Foam::DevolatilisationModel inline const Foam::DevolatilisationModel
< <

View File

@ -225,6 +225,9 @@ public:
inline const typename parcelType::constantProperties& inline const typename parcelType::constantProperties&
constProps() const; constProps() const;
//- Return access to the constant properties
inline typename parcelType::constantProperties& constProps();
//- Return const access to thermo package //- Return const access to thermo package
inline const SLGThermo& thermo() const; inline const SLGThermo& thermo() const;

View File

@ -45,6 +45,14 @@ Foam::ThermoCloud<CloudType>::constProps() const
} }
template<class CloudType>
inline typename CloudType::particleType::constantProperties&
Foam::ThermoCloud<CloudType>::constProps()
{
return constProps_;
}
template<class CloudType> template<class CloudType>
inline const Foam::SLGThermo& Foam::ThermoCloud<CloudType>::thermo() const inline const Foam::SLGThermo& Foam::ThermoCloud<CloudType>::thermo() const
{ {

View File

@ -70,7 +70,7 @@ void Foam::ReactingParcel<ParcelType>::calcPhaseChange
const CompositionModel<reactingCloudType>& composition = const CompositionModel<reactingCloudType>& composition =
td.cloud().composition(); td.cloud().composition();
const scalar TMax = td.cloud().phaseChange().TMax(pc_, this->Tc_); const scalar TMax = td.cloud().phaseChange().TMax(pc_);
const scalar Tdash = min(T, TMax); const scalar Tdash = min(T, TMax);
const scalar Tsdash = min(Ts, TMax); const scalar Tsdash = min(Ts, TMax);

View File

@ -83,9 +83,6 @@ public:
//- Vaporisation temperature [K] //- Vaporisation temperature [K]
scalar Tvap_; scalar Tvap_;
//- Boiling point [K]
scalar Tbp_;
public: public:
@ -122,8 +119,7 @@ public:
const scalar Pr, const scalar Pr,
const scalar pMin, const scalar pMin,
const Switch& constantVolume, const Switch& constantVolume,
const scalar Tvap, const scalar Tvap
const scalar Tbp
); );
@ -137,9 +133,6 @@ public:
//- Return const access to the vaporisation temperature //- Return const access to the vaporisation temperature
inline scalar Tvap() const; inline scalar Tvap() const;
//- Return const access to the boiling point
inline scalar Tbp() const;
}; };

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-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -32,8 +32,7 @@ Foam::ReactingParcel<ParcelType>::constantProperties::constantProperties()
ParcelType::constantProperties(), ParcelType::constantProperties(),
pMin_(0.0), pMin_(0.0),
constantVolume_(false), constantVolume_(false),
Tvap_(0.0), Tvap_(0.0)
Tbp_(0.0)
{} {}
@ -46,8 +45,7 @@ inline Foam::ReactingParcel<ParcelType>::constantProperties::constantProperties
ParcelType::constantProperties(cp), ParcelType::constantProperties(cp),
pMin_(cp.pMin_), pMin_(cp.pMin_),
constantVolume_(cp.constantVolume_), constantVolume_(cp.constantVolume_),
Tvap_(cp.Tvap_), Tvap_(cp.Tvap_)
Tbp_(cp.Tbp_)
{} {}
@ -61,8 +59,7 @@ inline Foam::ReactingParcel<ParcelType>::constantProperties::constantProperties
ParcelType::constantProperties(parentDict, readFields), ParcelType::constantProperties(parentDict, readFields),
pMin_(1000.0), pMin_(1000.0),
constantVolume_(false), constantVolume_(false),
Tvap_(0.0), Tvap_(0.0)
Tbp_(0.0)
{ {
if (readFields) if (readFields)
{ {
@ -73,7 +70,6 @@ inline Foam::ReactingParcel<ParcelType>::constantProperties::constantProperties
this->dict().lookup("constantVolume") >> constantVolume_; this->dict().lookup("constantVolume") >> constantVolume_;
this->dict().lookup("Tvap") >> Tvap_; this->dict().lookup("Tvap") >> Tvap_;
this->dict().lookup("Tbp") >> Tbp_;
} }
} }
@ -96,8 +92,7 @@ inline Foam::ReactingParcel<ParcelType>::constantProperties::constantProperties
const scalar Pr, const scalar Pr,
const scalar pMin, const scalar pMin,
const Switch& constantVolume, const Switch& constantVolume,
const scalar Tvap, const scalar Tvap
const scalar Tbp
) )
: :
ParcelType::constantProperties ParcelType::constantProperties
@ -118,8 +113,7 @@ inline Foam::ReactingParcel<ParcelType>::constantProperties::constantProperties
), ),
pMin_(pMin), pMin_(pMin),
constantVolume_(constantVolume), constantVolume_(constantVolume),
Tvap_(Tvap), Tvap_(Tvap)
Tbp_(Tbp)
{} {}
@ -212,14 +206,6 @@ Foam::ReactingParcel<ParcelType>::constantProperties::Tvap() const
} }
template<class ParcelType>
inline Foam::scalar
Foam::ReactingParcel<ParcelType>::constantProperties::Tbp() const
{
return Tbp_;
}
// * * * * * * * * * * ThermoParcel Member Functions * * * * * * * * * * * * // // * * * * * * * * * * ThermoParcel Member Functions * * * * * * * * * * * * //
template<class ParcelType> template<class ParcelType>

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-2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -147,6 +147,9 @@ public:
//- Return const access to maximum temperature [K] //- Return const access to maximum temperature [K]
inline scalar TMax() const; inline scalar TMax() const;
//- Return non-const access to maximum temperature [K]
inline scalar& TMax();
//- Return const access to the particle specific heat capacity //- Return const access to the particle specific heat capacity
// [J/(kg.K)] // [J/(kg.K)]
inline scalar Cp0() const; inline scalar Cp0() const;

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-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -216,6 +216,14 @@ Foam::ThermoParcel<ParcelType>::constantProperties::TMax() const
} }
template<class ParcelType>
inline Foam::scalar&
Foam::ThermoParcel<ParcelType>::constantProperties::TMax()
{
return TMax_;
}
template<class ParcelType> template<class ParcelType>
inline Foam::scalar inline Foam::scalar
Foam::ThermoParcel<ParcelType>::constantProperties::Cp0() const Foam::ThermoParcel<ParcelType>::constantProperties::Cp0() const

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) 2012-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -114,7 +114,6 @@ public:
void injectSteadyState(TrackData& td, const scalar trackTime); void injectSteadyState(TrackData& td, const scalar trackTime);
// I-O // I-O
//- Write injection info to stream //- Write injection info to stream

View File

@ -242,19 +242,9 @@ Foam::scalar Foam::LiquidEvaporation<CloudType>::dh
template<class CloudType> template<class CloudType>
Foam::scalar Foam::LiquidEvaporation<CloudType>::TMax Foam::scalar Foam::LiquidEvaporation<CloudType>::TMax(const scalar pIn) const
(
const scalar pIn,
const scalar TIn
) const
{ {
scalar T = -GREAT; return liquids_.TMax(pIn);
forAll(liquids_, i)
{
T = max(T, liquids_.properties()[i].pv(pIn, TIn));
}
return T;
} }

View File

@ -132,7 +132,7 @@ public:
) const; ) const;
//- Return maximum/limiting temperature //- Return maximum/limiting temperature
virtual scalar TMax(const scalar pIn, const scalar TIn) const; virtual scalar TMax(const scalar pIn) const;
}; };

View File

@ -343,17 +343,10 @@ Foam::scalar Foam::LiquidEvaporationBoil<CloudType>::dh
template<class CloudType> template<class CloudType>
Foam::scalar Foam::LiquidEvaporationBoil<CloudType>::TMax Foam::scalar Foam::LiquidEvaporationBoil<CloudType>::TMax
( (
const scalar pIn, const scalar pIn
const scalar TIn
) const ) const
{ {
scalar T = -GREAT; return liquids_.TMax(pIn);
forAll(liquids_, i)
{
T = max(T, liquids_.properties()[i].pv(pIn, TIn));
}
return T;
} }

View File

@ -142,7 +142,7 @@ public:
) const; ) const;
//- Return maximum/limiting temperature //- Return maximum/limiting temperature
virtual scalar TMax(const scalar pIn, const scalar TIn) const; virtual scalar TMax(const scalar pIn) const;
}; };

View File

@ -179,11 +179,7 @@ Foam::scalar Foam::PhaseChangeModel<CloudType>::dh
template<class CloudType> template<class CloudType>
Foam::scalar Foam::PhaseChangeModel<CloudType>::TMax Foam::scalar Foam::PhaseChangeModel<CloudType>::TMax(const scalar) const
(
const scalar,
const scalar
) const
{ {
return GREAT; return GREAT;
} }

View File

@ -185,7 +185,7 @@ public:
) const; ) const;
//- Return maximum/limiting temperature //- Return maximum/limiting temperature
virtual scalar TMax(const scalar pIn, const scalar TIn) const; virtual scalar TMax(const scalar pIn) const;
//- Add to phase change mass //- Add to phase change mass
void addToPhaseChangeMass(const scalar dMass); void addToPhaseChangeMass(const scalar dMass);

View File

@ -76,6 +76,10 @@ void Foam::SprayParcel<ParcelType>::calc
} }
} }
// set the maximum temperature limit
const scalar TMax = td.cloud().composition().liquids().TMax(this->pc_);
td.cloud().constProps().TMax() = TMax;
// store the parcel properties // store the parcel properties
const scalarField& Y(this->Y()); const scalarField& Y(this->Y());
scalarField X(td.cloud().composition().liquids().X(Y)); scalarField X(td.cloud().composition().liquids().X(Y));
@ -301,15 +305,12 @@ Foam::scalar Foam::SprayParcel<ParcelType>::chi
{ {
// modifications to take account of the flash boiling on primary break-up // modifications to take account of the flash boiling on primary break-up
static label nIter = 200;
typedef typename TrackData::cloudType::reactingCloudType reactingCloudType; typedef typename TrackData::cloudType::reactingCloudType reactingCloudType;
const CompositionModel<reactingCloudType>& composition = const CompositionModel<reactingCloudType>& composition =
td.cloud().composition(); td.cloud().composition();
scalar chi = 0.0; scalar chi = 0.0;
scalar T0 = this->T(); scalar T0 = this->T();
scalar Tc0 = this->Tc();
scalar p0 = this->pc(); scalar p0 = this->pc();
scalar pAmb = td.cloud().pAmbient(); scalar pAmb = td.cloud().pAmbient();
@ -322,21 +323,7 @@ Foam::scalar Foam::SprayParcel<ParcelType>::chi
// liquid is boiling - calc boiling temperature // liquid is boiling - calc boiling temperature
const liquidProperties& liq = composition.liquids().properties()[i]; const liquidProperties& liq = composition.liquids().properties()[i];
scalar TBoil = T0; scalar TBoil = liq.pvInvert(p0);
for (label k=0; k<nIter; k++)
{
scalar pBoil = liq.pv(p0, TBoil);
if (pBoil > p0)
{
TBoil = TBoil - (T0 - Tc0)/nIter;
}
else
{
break;
}
}
scalar hl = liq.hl(pAmb, TBoil); scalar hl = liq.hl(pAmb, TBoil);
scalar iTp = liq.h(pAmb, T0) - liq.rho(pAmb, T0); scalar iTp = liq.h(pAmb, T0) - liq.rho(pAmb, T0);

View File

@ -2470,12 +2470,15 @@ void Foam::autoLayerDriver::mergePatchFacesUndo
<< " (0=straight, 180=fully concave)" << nl << " (0=straight, 180=fully concave)" << nl
<< endl; << endl;
const fvMesh& mesh = meshRefiner_.mesh();
label nChanged = meshRefiner_.mergePatchFacesUndo label nChanged = meshRefiner_.mergePatchFacesUndo
( (
minCos, minCos,
concaveCos, concaveCos,
meshRefiner_.meshedPatches(), meshRefiner_.meshedPatches(),
motionDict motionDict,
labelList(mesh.nFaces() -1)
); );
nChanged += meshRefiner_.mergeEdgesUndo(minCos, motionDict); nChanged += meshRefiner_.mergeEdgesUndo(minCos, motionDict);

View File

@ -1084,12 +1084,15 @@ void Foam::autoRefineDriver::mergePatchFaces
<< "----------------------------" << nl << "----------------------------" << nl
<< endl; << endl;
const fvMesh& mesh = meshRefiner_.mesh();
meshRefiner_.mergePatchFacesUndo meshRefiner_.mergePatchFacesUndo
( (
Foam::cos(degToRad(45.0)), Foam::cos(degToRad(45.0)),
Foam::cos(degToRad(45.0)), Foam::cos(degToRad(45.0)),
meshRefiner_.meshedPatches(), meshRefiner_.meshedPatches(),
motionDict motionDict,
labelList(mesh.nFaces(), -1)
); );
if (debug) if (debug)

View File

@ -1348,7 +1348,8 @@ bool Foam::autoSnapDriver::scaleMesh
Foam::autoPtr<Foam::mapPolyMesh> Foam::autoSnapDriver::repatchToSurface Foam::autoPtr<Foam::mapPolyMesh> Foam::autoSnapDriver::repatchToSurface
( (
const snapParameters& snapParams, const snapParameters& snapParams,
const labelList& adaptPatchIDs const labelList& adaptPatchIDs,
const labelList& preserveFaces
) )
{ {
const fvMesh& mesh = meshRefiner_.mesh(); const fvMesh& mesh = meshRefiner_.mesh();
@ -1375,7 +1376,16 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::autoSnapDriver::repatchToSurface
// Faces that do not move // Faces that do not move
PackedBoolList isZonedFace(mesh.nFaces()); PackedBoolList isZonedFace(mesh.nFaces());
{ {
// 1. All faces on zoned surfaces // 1. Preserve faces in preserveFaces list
forAll(preserveFaces, faceI)
{
if (preserveFaces[faceI] != -1)
{
isZonedFace.set(faceI, 1);
}
}
// 2. All faces on zoned surfaces
const wordList& faceZoneNames = surfaces.faceZoneNames(); const wordList& faceZoneNames = surfaces.faceZoneNames();
const faceZoneMesh& fZones = mesh.faceZones(); const faceZoneMesh& fZones = mesh.faceZones();
@ -1531,6 +1541,15 @@ void Foam::autoSnapDriver::doSnap
baffles baffles
); );
// Keep copy of baffles
labelList origBaffles(mesh.nFaces(), -1);
forAll(baffles, i)
{
const labelPair& baffle = baffles[i];
origBaffles[baffle.first()] = baffle.second();
origBaffles[baffle.second()] = baffle.first();
}
// Selectively 'forget' about the baffles, i.e. not check across them // Selectively 'forget' about the baffles, i.e. not check across them
// or merge across them. // or merge across them.
@ -1618,6 +1637,19 @@ void Foam::autoSnapDriver::doSnap
); );
meshRefinement::updateList(mapPtr().faceMap(), -1, filterFace); meshRefinement::updateList(mapPtr().faceMap(), -1, filterFace);
const labelList& reverseFaceMap = mapPtr().reverseFaceMap();
origBaffles.setSize(mesh.nFaces());
origBaffles = -1;
forAll(baffles, i)
{
labelPair& baffle = baffles[i];
baffle.first() = reverseFaceMap[baffle.first()];
baffle.second() = reverseFaceMap[baffle.second()];
origBaffles[baffle.first()] = baffle.second();
origBaffles[baffle.second()] = baffle.first();
}
if (debug&meshRefinement::MESH) if (debug&meshRefinement::MESH)
{ {
const_cast<Time&>(mesh.time())++; const_cast<Time&>(mesh.time())++;
@ -1834,10 +1866,23 @@ void Foam::autoSnapDriver::doSnap
} }
// Merge any introduced baffles. // Merge any introduced baffles.
mergeZoneBaffles(baffles); {
autoPtr<mapPolyMesh> mapPtr = mergeZoneBaffles(baffles);
if (mapPtr.valid())
{
forAll(origBaffles, faceI)
{
if (origBaffles[faceI] != -1)
{
origBaffles[faceI] = mapPtr->reverseFaceMap()[faceI];
}
}
}
}
// Repatch faces according to nearest. // Repatch faces according to nearest.
repatchToSurface(snapParams, adaptPatchIDs); repatchToSurface(snapParams, adaptPatchIDs, origBaffles);
// Repatching might have caused faces to be on same patch and hence // Repatching might have caused faces to be on same patch and hence
// mergeable so try again to merge coplanar faces // mergeable so try again to merge coplanar faces
@ -1846,7 +1891,8 @@ void Foam::autoSnapDriver::doSnap
featureCos, // minCos featureCos, // minCos
featureCos, // concaveCos featureCos, // concaveCos
meshRefiner_.meshedPatches(), meshRefiner_.meshedPatches(),
motionDict motionDict,
origBaffles
); );
nChanged += meshRefiner_.mergeEdgesUndo nChanged += meshRefiner_.mergeEdgesUndo
@ -1855,7 +1901,7 @@ void Foam::autoSnapDriver::doSnap
motionDict motionDict
); );
if (nChanged > 0 && debug&meshRefinement::MESH) if (nChanged > 0 && debug & meshRefinement::MESH)
{ {
const_cast<Time&>(mesh.time())++; const_cast<Time&>(mesh.time())++;
Info<< "Writing patchFace merged mesh to time " Info<< "Writing patchFace merged mesh to time "

View File

@ -474,7 +474,8 @@ public:
autoPtr<mapPolyMesh> repatchToSurface autoPtr<mapPolyMesh> repatchToSurface
( (
const snapParameters& snapParams, const snapParameters& snapParams,
const labelList& adaptPatchIDs const labelList& adaptPatchIDs,
const labelList& preserveFaces
); );
void doSnap void doSnap

View File

@ -864,7 +864,8 @@ public:
const scalar minCos, const scalar minCos,
const scalar concaveCos, const scalar concaveCos,
const labelList& patchIDs, const labelList& patchIDs,
const dictionary& motionDict const dictionary& motionDict,
const labelList& preserveFaces
); );
autoPtr<mapPolyMesh> doRemovePoints autoPtr<mapPolyMesh> doRemovePoints

View File

@ -249,7 +249,8 @@ Foam::label Foam::meshRefinement::mergePatchFacesUndo
const scalar minCos, const scalar minCos,
const scalar concaveCos, const scalar concaveCos,
const labelList& patchIDs, const labelList& patchIDs,
const dictionary& motionDict const dictionary& motionDict,
const labelList& preserveFaces
) )
{ {
// Patch face merging engine // Patch face merging engine
@ -280,7 +281,7 @@ Foam::label Foam::meshRefinement::mergePatchFacesUndo
// Get all sets of faces that can be merged. Since only faces on the same // Get all sets of faces that can be merged. Since only faces on the same
// patch get merged there is no risk of e.g. patchID faces getting merged // patch get merged there is no risk of e.g. patchID faces getting merged
// with original patches (or even processor patches). There is a risk // with original patches (or even processor patches). There is a risk
// though of original patchfaces getting merged if they make a small // though of original patch faces getting merged if they make a small
// angle. Would be pretty weird starting mesh though. // angle. Would be pretty weird starting mesh though.
labelListList allFaceSets labelListList allFaceSets
( (
@ -292,6 +293,27 @@ Foam::label Foam::meshRefinement::mergePatchFacesUndo
) )
); );
label compactI = 0;
forAll(allFaceSets, i)
{
bool keep = true;
const labelList& set = allFaceSets[i];
forAll(set, j)
{
if (preserveFaces[set[j]] != -1)
{
keep = false;
break;
}
}
if (keep && (compactI != i))
{
allFaceSets[compactI++] = set;
}
}
allFaceSets.setSize(compactI);
label nFaceSets = returnReduce(allFaceSets.size(), sumOp<label>()); label nFaceSets = returnReduce(allFaceSets.size(), sumOp<label>());
Info<< "Merging " << nFaceSets << " sets of faces." << nl << endl; Info<< "Merging " << nFaceSets << " sets of faces." << nl << endl;

View File

@ -34,114 +34,62 @@ License
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(fieldAverage, 0); defineTypeNameAndDebug(fieldAverage, 0);
const word fieldAverage::EXT_MEAN = "Mean";
const word fieldAverage::EXT_PRIME2MEAN = "Prime2Mean";
} }
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::fieldAverage::resetFields(wordList& names) void Foam::fieldAverage::resetFields()
{ {
forAll(names, fieldI) forAll(faItems_, i)
{ {
if (names[fieldI].size()) if (faItems_[i].mean())
{ {
obr_.checkOut(*obr_[names[fieldI]]); if (obr_.found(faItems_[i].meanFieldName()))
{
obr_.checkOut(*obr_[faItems_[i].meanFieldName()]);
}
}
if (faItems_[i].prime2Mean())
{
if (obr_.found(faItems_[i].prime2MeanFieldName()))
{
obr_.checkOut(*obr_[faItems_[i].prime2MeanFieldName()]);
}
} }
} }
names.clear();
names.setSize(faItems_.size());
} }
void Foam::fieldAverage::initialize() void Foam::fieldAverage::initialize()
{ {
resetFields(meanScalarFields_); resetFields();
resetFields(meanVectorFields_);
resetFields(meanSphericalTensorFields_);
resetFields(meanSymmTensorFields_);
resetFields(meanTensorFields_);
resetFields(prime2MeanScalarFields_);
resetFields(prime2MeanSymmTensorFields_);
// Add mean fields to the field lists // Add mean fields to the field lists
forAll(faItems_, fieldI) forAll(faItems_, fieldI)
{ {
const word& fieldName = faItems_[fieldI].fieldName(); addMeanField<scalar>(fieldI);
if (obr_.foundObject<volScalarField>(fieldName)) addMeanField<vector>(fieldI);
{ addMeanField<sphericalTensor>(fieldI);
addMeanField<scalar>(fieldI, meanScalarFields_); addMeanField<symmTensor>(fieldI);
} addMeanField<tensor>(fieldI);
else if (obr_.foundObject<volVectorField>(fieldName))
{
addMeanField<vector>(fieldI, meanVectorFields_);
}
else if (obr_.foundObject<volSphericalTensorField>(fieldName))
{
addMeanField<sphericalTensor>(fieldI, meanSphericalTensorFields_);
}
else if (obr_.foundObject<volSymmTensorField>(fieldName))
{
addMeanField<symmTensor>(fieldI, meanSymmTensorFields_);
}
else if (obr_.foundObject<volTensorField>(fieldName))
{
addMeanField<tensor>(fieldI, meanTensorFields_);
}
else
{
FatalErrorIn("Foam::fieldAverage::initialize()")
<< "Requested field " << faItems_[fieldI].fieldName()
<< " does not exist in the database" << nl
<< exit(FatalError);
}
} }
// Add prime-squared mean fields to the field lists // Add prime-squared mean fields to the field lists
forAll(faItems_, fieldI) forAll(faItems_, fieldI)
{ {
if (faItems_[fieldI].prime2Mean()) addPrime2MeanField<scalar, scalar>(fieldI);
{ addPrime2MeanField<vector, symmTensor>(fieldI);
const word& fieldName = faItems_[fieldI].fieldName(); }
if (!faItems_[fieldI].mean())
{
FatalErrorIn("Foam::fieldAverage::initialize()")
<< "To calculate the prime-squared average, the "
<< "mean average must also be selected for field "
<< fieldName << nl << exit(FatalError);
}
if (obr_.foundObject<volScalarField>(fieldName)) forAll(faItems_, fieldI)
{ {
addPrime2MeanField<scalar, scalar> if (!faItems_[fieldI].active())
( {
fieldI, WarningIn("void Foam::fieldAverage::initialize()")
meanScalarFields_, << "Field " << faItems_[fieldI].fieldName()
prime2MeanScalarFields_ << " not found in database for averaging";
);
}
else if (obr_.foundObject<volVectorField>(fieldName))
{
addPrime2MeanField<vector, symmTensor>
(
fieldI,
meanVectorFields_,
prime2MeanSymmTensorFields_
);
}
else
{
FatalErrorIn("Foam::fieldAverage::initialize()")
<< "prime2Mean average can only be applied to "
<< "volScalarFields and volVectorFields"
<< nl << " Field: " << fieldName << nl
<< exit(FatalError);
}
} }
} }
@ -173,33 +121,17 @@ void Foam::fieldAverage::calcAverages()
Info<< "Calculating averages" << nl << endl; Info<< "Calculating averages" << nl << endl;
addMeanSqrToPrime2Mean<scalar, scalar> addMeanSqrToPrime2Mean<scalar, scalar>();
( addMeanSqrToPrime2Mean<vector, symmTensor>();
meanScalarFields_,
prime2MeanScalarFields_
);
addMeanSqrToPrime2Mean<vector, symmTensor>
(
meanVectorFields_,
prime2MeanSymmTensorFields_
);
calculateMeanFields<scalar>(meanScalarFields_); calculateMeanFields<scalar>();
calculateMeanFields<vector>(meanVectorFields_); calculateMeanFields<vector>();
calculateMeanFields<sphericalTensor>(meanSphericalTensorFields_); calculateMeanFields<sphericalTensor>();
calculateMeanFields<symmTensor>(meanSymmTensorFields_); calculateMeanFields<symmTensor>();
calculateMeanFields<tensor>(meanTensorFields_); calculateMeanFields<tensor>();
calculatePrime2MeanFields<scalar, scalar> calculatePrime2MeanFields<scalar, scalar>();
( calculatePrime2MeanFields<vector, symmTensor>();
meanScalarFields_,
prime2MeanScalarFields_
);
calculatePrime2MeanFields<vector, symmTensor>
(
meanVectorFields_,
prime2MeanSymmTensorFields_
);
forAll(faItems_, fieldI) forAll(faItems_, fieldI)
{ {
@ -211,14 +143,11 @@ void Foam::fieldAverage::calcAverages()
void Foam::fieldAverage::writeAverages() const void Foam::fieldAverage::writeAverages() const
{ {
writeFieldList<scalar>(meanScalarFields_); writeFields<scalar>();
writeFieldList<vector>(meanVectorFields_); writeFields<vector>();
writeFieldList<sphericalTensor>(meanSphericalTensorFields_); writeFields<sphericalTensor>();
writeFieldList<symmTensor>(meanSymmTensorFields_); writeFields<symmTensor>();
writeFieldList<tensor>(meanTensorFields_); writeFields<tensor>();
writeFieldList<scalar>(prime2MeanScalarFields_);
writeFieldList<symmTensor>(prime2MeanSymmTensorFields_);
} }
@ -324,13 +253,6 @@ Foam::fieldAverage::fieldAverage
resetOnOutput_(false), resetOnOutput_(false),
initialised_(false), initialised_(false),
faItems_(), faItems_(),
meanScalarFields_(),
meanVectorFields_(),
meanSphericalTensorFields_(),
meanSymmTensorFields_(),
meanTensorFields_(),
prime2MeanScalarFields_(),
prime2MeanSymmTensorFields_(),
totalIter_(), totalIter_(),
totalTime_() totalTime_()
{ {

View File

@ -29,9 +29,9 @@ Group
Description Description
This function object calculates average quantities for a user-specified This function object calculates average quantities for a user-specified
selection of fields. Fields are entered as a list of sub-dictionaries, selection of volumetric and surface fields. Fields are entered as a list
which indicate the type of averages to perform, and can be updated during of sub-dictionaries, which indicate the type of averages to perform, and
the calculation. The current options include: can be updated during the calculation. The current options include:
- \c mean: arithmetic mean: - \c mean: arithmetic mean:
\f[ \f[
\overline{x} = \frac{1}{N}\displaystyle\sum\limits_{i=0}^N x_i \overline{x} = \frac{1}{N}\displaystyle\sum\limits_{i=0}^N x_i
@ -142,16 +142,7 @@ class fieldAverage
{ {
protected: protected:
// File and field name extensions // Protected data
//- Mean average
static const word EXT_MEAN;
//- Prime-squared average
static const word EXT_PRIME2MEAN;
// Private data
//- Name of this set of field averages. //- Name of this set of field averages.
word name_; word name_;
@ -178,22 +169,6 @@ protected:
// calculated and output // calculated and output
List<fieldAverageItem> faItems_; List<fieldAverageItem> faItems_;
// Lists of averages
// Arithmetic mean fields
wordList meanScalarFields_;
wordList meanVectorFields_;
wordList meanSphericalTensorFields_;
wordList meanSymmTensorFields_;
wordList meanTensorFields_;
// Prime-squared fields
// Only applicable to volScalarFields / volVectorFields
wordList prime2MeanScalarFields_;
wordList prime2MeanSymmTensorFields_;
// Counters // Counters
//- Iteration steps counter //- Iteration steps counter
@ -209,24 +184,27 @@ protected:
//- Checkout fields (causes deletion) from the database //- Checkout fields (causes deletion) from the database
// and reset lists // and reset lists
void resetFields(wordList&); void resetFields();
//- Reset lists (clear existing values) and initialize averaging. //- Reset lists (clear existing values) and initialize averaging.
// Check requested field averages are valid, populate field lists // Check requested field averages are valid, populate field lists
void initialize(); void initialize();
//- Add mean average field to list //- Add mean average field to database
template<class Type> template<class Type>
void addMeanField(const label, wordList&) const; void addMeanFieldType(const label fieldI);
//- Add prime-squared average field to list //- Add mean average field to database
template<class Type>
void addMeanField(const label fieldI);
//- Add prime-squared average field to database
template<class Type1, class Type2> template<class Type1, class Type2>
void addPrime2MeanField void addPrime2MeanFieldType(const label fieldI);
(
const label, //- Add prime-squared average field to database
const wordList&, template<class Type1, class Type2>
wordList& void addPrime2MeanField(const label fieldI);
) const;
// Calculation functions // Calculation functions
@ -236,23 +214,27 @@ protected:
//- Calculate mean average fields //- Calculate mean average fields
template<class Type> template<class Type>
void calculateMeanFields(const wordList&) const; void calculateMeanFieldType(const label fieldI) const;
//- Add mean-squared field value to prime-squared mean field //- Calculate mean average fields
template<class Type1, class Type2> template<class Type>
void addMeanSqrToPrime2Mean void calculateMeanFields() const;
(
const wordList&,
const wordList&
) const;
//- Calculate prime-squared average fields //- Calculate prime-squared average fields
template<class Type1, class Type2> template<class Type1, class Type2>
void calculatePrime2MeanFields void calculatePrime2MeanFieldType(const label fieldI) const;
(
const wordList&, //- Calculate prime-squared average fields
const wordList& template<class Type1, class Type2>
) const; void calculatePrime2MeanFields() const;
//- Add mean-squared field value to prime-squared mean field
template<class Type1, class Type2>
void addMeanSqrToPrime2MeanType(const label fieldI) const;
//- Add mean-squared field value to prime-squared mean field
template<class Type1, class Type2>
void addMeanSqrToPrime2Mean() const;
// I-O // I-O
@ -262,7 +244,11 @@ protected:
//- Write fields //- Write fields
template<class Type> template<class Type>
void writeFieldList(const wordList&) const; void writeFieldType(const word& fieldName) const;
//- Write fields
template<class Type>
void writeFields() const;
//- Write averaging properties - steps and time //- Write averaging properties - steps and time
void writeAveragingProperties() const; void writeAveragingProperties() const;

View File

@ -25,290 +25,356 @@ License
#include "fieldAverageItem.H" #include "fieldAverageItem.H"
#include "volFields.H" #include "volFields.H"
#include "surfaceFields.H"
#include "OFstream.H" #include "OFstream.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class Type> template<class Type>
void Foam::fieldAverage::addMeanField void Foam::fieldAverage::addMeanFieldType(const label fieldI)
( {
const label fieldI, faItems_[fieldI].active() = true;
wordList& meanFieldList
) const const word& fieldName = faItems_[fieldI].fieldName();
const word& meanFieldName = faItems_[fieldI].meanFieldName();
Info<< "Reading/calculating field " << meanFieldName << nl << endl;
if (obr_.foundObject<Type>(meanFieldName))
{
// do nothing
}
else if (obr_.found(meanFieldName))
{
Info<< "Cannot allocate average field " << meanFieldName
<< " since an object with that name already exists."
<< " Disabling averaging." << nl << endl;
faItems_[fieldI].mean() = false;
}
else
{
const Type& baseField = obr_.lookupObject<Type>(fieldName);
// Store on registry
obr_.store
(
new Type
(
IOobject
(
meanFieldName,
obr_.time().timeName(obr_.time().startTime().value()),
obr_,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE
),
1*baseField
)
);
}
}
template<class Type>
void Foam::fieldAverage::addMeanField(const label fieldI)
{ {
if (faItems_[fieldI].mean()) if (faItems_[fieldI].mean())
{ {
typedef GeometricField<Type, fvPatchField, volMesh> fieldType; typedef GeometricField<Type, fvPatchField, volMesh> volFieldType;
typedef GeometricField<Type, fvsPatchField, surfaceMesh> surfFieldType;
const word& fieldName = faItems_[fieldI].fieldName(); const word& fieldName = faItems_[fieldI].fieldName();
word meanFieldName = fieldName + EXT_MEAN; if (obr_.foundObject<volFieldType>(fieldName))
if
(
(faItems_[fieldI].window() > 0)
&& (faItems_[fieldI].windowName() != "")
)
{ {
meanFieldName = meanFieldName + "_" + faItems_[fieldI].windowName(); addMeanFieldType<volFieldType>(fieldI);
} }
else if (obr_.foundObject<surfFieldType>(fieldName))
Info<< "Reading/calculating field " << meanFieldName << nl << endl;
if (obr_.foundObject<fieldType>(meanFieldName))
{ {
meanFieldList[fieldI] = meanFieldName; addMeanFieldType<surfFieldType>(fieldI);
}
else if (obr_.found(meanFieldName))
{
Info<< "Cannot allocate average field " << meanFieldName
<< " since an object with that name already exists."
<< " Disabling averaging." << nl << endl;
meanFieldList[fieldI] = word::null;
}
else
{
const fieldType& baseField =
obr_.lookupObject<fieldType>(fieldName);
// Store on registry
obr_.store
(
new fieldType
(
IOobject
(
meanFieldName,
obr_.time().timeName(obr_.time().startTime().value()),
obr_,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE
),
1*baseField
)
);
meanFieldList[fieldI] = meanFieldName;
} }
} }
} }
template<class Type1, class Type2> template<class Type1, class Type2>
void Foam::fieldAverage::addPrime2MeanField void Foam::fieldAverage::addPrime2MeanFieldType(const label fieldI)
(
const label fieldI,
const wordList& meanFieldList,
wordList& prime2MeanFieldList
) const
{ {
if (faItems_[fieldI].mean() && meanFieldList[fieldI].size()) const word& fieldName = faItems_[fieldI].fieldName();
{ const word& meanFieldName = faItems_[fieldI].meanFieldName();
typedef GeometricField<Type1, fvPatchField, volMesh> fieldType1; const word& prime2MeanFieldName = faItems_[fieldI].prime2MeanFieldName();
typedef GeometricField<Type2, fvPatchField, volMesh> fieldType2;
Info<< "Reading/calculating field " << prime2MeanFieldName << nl << endl;
if (obr_.foundObject<Type2>(prime2MeanFieldName))
{
// do nothing
}
else if (obr_.found(prime2MeanFieldName))
{
Info<< "Cannot allocate average field " << prime2MeanFieldName
<< " since an object with that name already exists."
<< " Disabling averaging." << nl << endl;
faItems_[fieldI].prime2Mean() = false;
}
else
{
const Type1& baseField = obr_.lookupObject<Type1>(fieldName);
const Type1& meanField = obr_.lookupObject<Type1>(meanFieldName);
obr_.store
(
new Type2
(
IOobject
(
prime2MeanFieldName,
obr_.time().timeName(obr_.time().startTime().value()),
obr_,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE
),
sqr(baseField) - sqr(meanField)
)
);
}
}
template<class Type1, class Type2>
void Foam::fieldAverage::addPrime2MeanField(const label fieldI)
{
typedef GeometricField<Type1, fvPatchField, volMesh> volFieldType1;
typedef GeometricField<Type1, fvsPatchField, surfaceMesh> surfFieldType1;
typedef GeometricField<Type2, fvPatchField, volMesh> volFieldType2;
typedef GeometricField<Type2, fvsPatchField, surfaceMesh> surfFieldType2;
if (faItems_[fieldI].prime2Mean())
{
const word& fieldName = faItems_[fieldI].fieldName(); const word& fieldName = faItems_[fieldI].fieldName();
word meanFieldName = fieldName + EXT_PRIME2MEAN; if (!faItems_[fieldI].mean())
if
(
(faItems_[fieldI].window() > 0)
&& (faItems_[fieldI].windowName() != "")
)
{ {
meanFieldName = meanFieldName + "_" + faItems_[fieldI].windowName(); FatalErrorIn
}
Info<< "Reading/calculating field " << meanFieldName << nl << endl;
if (obr_.foundObject<fieldType2>(meanFieldName))
{
prime2MeanFieldList[fieldI] = meanFieldName;
}
else if (obr_.found(meanFieldName))
{
Info<< "Cannot allocate average field " << meanFieldName
<< " since an object with that name already exists."
<< " Disabling averaging." << nl << endl;
prime2MeanFieldList[fieldI] = word::null;
}
else
{
const fieldType1& baseField =
obr_.lookupObject<fieldType1>(fieldName);
const fieldType1& meanField =
obr_.lookupObject<fieldType1>(meanFieldList[fieldI]);
obr_.store
( (
new fieldType2 "void Foam::fieldAverage::addPrime2MeanField(const label) const"
( )
IOobject << "To calculate the prime-squared average, the "
( << "mean average must also be selected for field "
meanFieldName, << fieldName << nl << exit(FatalError);
obr_.time().timeName(obr_.time().startTime().value()), }
obr_,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE
),
sqr(baseField) - sqr(meanField)
)
);
prime2MeanFieldList[fieldI] = meanFieldName; if (obr_.foundObject<volFieldType1>(fieldName))
{
addPrime2MeanFieldType<volFieldType1, volFieldType2>(fieldI);
}
else if (obr_.foundObject<surfFieldType1>(fieldName))
{
addPrime2MeanFieldType<surfFieldType1, surfFieldType2>(fieldI);
} }
} }
} }
template<class Type> template<class Type>
void Foam::fieldAverage::calculateMeanFields(const wordList& meanFieldList) void Foam::fieldAverage::calculateMeanFieldType(const label fieldI) const
const
{ {
typedef GeometricField<Type, fvPatchField, volMesh> fieldType; const word& fieldName = faItems_[fieldI].fieldName();
scalar dt = obr_.time().deltaTValue(); if (obr_.foundObject<Type>(fieldName))
{
const Type& baseField = obr_.lookupObject<Type>(fieldName);
Type& meanField = const_cast<Type&>
(
obr_.lookupObject<Type>(faItems_[fieldI].meanFieldName())
);
scalar dt = obr_.time().deltaTValue();
scalar Dt = totalTime_[fieldI];
if (faItems_[fieldI].iterBase())
{
dt = 1.0;
Dt = scalar(totalIter_[fieldI]);
}
scalar alpha = (Dt - dt)/Dt;
scalar beta = dt/Dt;
if (faItems_[fieldI].window() > 0)
{
const scalar w = faItems_[fieldI].window();
if (Dt - dt >= w)
{
alpha = (w - dt)/w;
beta = dt/w;
}
}
meanField = alpha*meanField + beta*baseField;
}
}
template<class Type>
void Foam::fieldAverage::calculateMeanFields() const
{
typedef GeometricField<Type, fvPatchField, volMesh> volFieldType;
typedef GeometricField<Type, fvsPatchField, surfaceMesh> surfFieldType;
forAll(faItems_, i) forAll(faItems_, i)
{ {
if (faItems_[i].mean() && meanFieldList[i].size()) if (faItems_[i].mean())
{ {
const word& fieldName = faItems_[i].fieldName(); calculateMeanFieldType<volFieldType>(i);
const fieldType& baseField = calculateMeanFieldType<surfFieldType>(i);
obr_.lookupObject<fieldType>(fieldName);
fieldType& meanField = const_cast<fieldType&>
(
obr_.lookupObject<fieldType>(meanFieldList[i])
);
scalar Dt = totalTime_[i];
if (faItems_[i].iterBase())
{
dt = 1.0;
Dt = scalar(totalIter_[i]);
}
scalar alpha = (Dt - dt)/Dt;
scalar beta = dt/Dt;
if (faItems_[i].window() > 0)
{
const scalar w = faItems_[i].window();
if (Dt - dt >= w)
{
alpha = (w - dt)/w;
beta = dt/w;
}
}
meanField = alpha*meanField + beta*baseField;
} }
} }
} }
template<class Type1, class Type2> template<class Type1, class Type2>
void Foam::fieldAverage::calculatePrime2MeanFields void Foam::fieldAverage::calculatePrime2MeanFieldType(const label fieldI) const
(
const wordList& meanFieldList,
const wordList& prime2MeanFieldList
) const
{ {
typedef GeometricField<Type1, fvPatchField, volMesh> fieldType1; const word& fieldName = faItems_[fieldI].fieldName();
typedef GeometricField<Type2, fvPatchField, volMesh> fieldType2;
scalar dt = obr_.time().deltaTValue(); if (obr_.foundObject<Type1>(fieldName))
{
const Type1& baseField = obr_.lookupObject<Type1>(fieldName);
const Type1& meanField =
obr_.lookupObject<Type1>(faItems_[fieldI].meanFieldName());
Type2& prime2MeanField = const_cast<Type2&>
(
obr_.lookupObject<Type2>(faItems_[fieldI].prime2MeanFieldName())
);
scalar dt = obr_.time().deltaTValue();
scalar Dt = totalTime_[fieldI];
if (faItems_[fieldI].iterBase())
{
dt = 1.0;
Dt = scalar(totalIter_[fieldI]);
}
scalar alpha = (Dt - dt)/Dt;
scalar beta = dt/Dt;
if (faItems_[fieldI].window() > 0)
{
const scalar w = faItems_[fieldI].window();
if (Dt - dt >= w)
{
alpha = (w - dt)/w;
beta = dt/w;
}
}
prime2MeanField =
alpha*prime2MeanField
+ beta*sqr(baseField)
- sqr(meanField);
}
}
template<class Type1, class Type2>
void Foam::fieldAverage::calculatePrime2MeanFields() const
{
typedef GeometricField<Type1, fvPatchField, volMesh> volFieldType1;
typedef GeometricField<Type1, fvsPatchField, surfaceMesh> surfFieldType1;
typedef GeometricField<Type2, fvPatchField, volMesh> volFieldType2;
typedef GeometricField<Type2, fvsPatchField, surfaceMesh> surfFieldType2;
forAll(faItems_, i) forAll(faItems_, i)
{ {
if if (faItems_[i].prime2Mean())
(
faItems_[i].prime2Mean()
&& meanFieldList[i].size()
&& prime2MeanFieldList[i].size()
)
{ {
const word& fieldName = faItems_[i].fieldName(); calculatePrime2MeanFieldType<volFieldType1, volFieldType2>(i);
const fieldType1& baseField = calculatePrime2MeanFieldType<surfFieldType1, surfFieldType2>(i);
obr_.lookupObject<fieldType1>(fieldName);
const fieldType1& meanField =
obr_.lookupObject<fieldType1>(meanFieldList[i]);
fieldType2& prime2MeanField = const_cast<fieldType2&>
(
obr_.lookupObject<fieldType2>(prime2MeanFieldList[i])
);
scalar Dt = totalTime_[i];
if (faItems_[i].iterBase())
{
dt = 1.0;
Dt = scalar(totalIter_[i]);
}
scalar alpha = (Dt - dt)/Dt;
scalar beta = dt/Dt;
if (faItems_[i].window() > 0)
{
const scalar w = faItems_[i].window();
if (Dt - dt >= w)
{
alpha = (w - dt)/w;
beta = dt/w;
}
}
prime2MeanField =
alpha*prime2MeanField
+ beta*sqr(baseField)
- sqr(meanField);
} }
} }
} }
template<class Type1, class Type2> template<class Type1, class Type2>
void Foam::fieldAverage::addMeanSqrToPrime2Mean void Foam::fieldAverage::addMeanSqrToPrime2MeanType(const label fieldI) const
(
const wordList& meanFieldList,
const wordList& prime2MeanFieldList
) const
{ {
typedef GeometricField<Type1, fvPatchField, volMesh> fieldType1; const word& fieldName = faItems_[fieldI].fieldName();
typedef GeometricField<Type2, fvPatchField, volMesh> fieldType2;
if (obr_.foundObject<Type1>(fieldName))
{
const Type1& meanField =
obr_.lookupObject<Type1>(faItems_[fieldI].meanFieldName());
Type2& prime2MeanField = const_cast<Type2&>
(
obr_.lookupObject<Type2>(faItems_[fieldI].prime2MeanFieldName())
);
prime2MeanField += sqr(meanField);
}
}
template<class Type1, class Type2>
void Foam::fieldAverage::addMeanSqrToPrime2Mean() const
{
typedef GeometricField<Type1, fvPatchField, volMesh> volFieldType1;
typedef GeometricField<Type1, fvsPatchField, surfaceMesh> surfFieldType1;
typedef GeometricField<Type2, fvPatchField, volMesh> volFieldType2;
typedef GeometricField<Type2, fvsPatchField, surfaceMesh> surfFieldType2;
forAll(faItems_, i) forAll(faItems_, i)
{ {
if if (faItems_[i].prime2Mean())
(
faItems_[i].prime2Mean()
&& meanFieldList[i].size()
&& prime2MeanFieldList[i].size()
)
{ {
const fieldType1& meanField = addMeanSqrToPrime2MeanType<volFieldType1, volFieldType2>(i);
obr_.lookupObject<fieldType1>(meanFieldList[i]); addMeanSqrToPrime2MeanType<surfFieldType1, surfFieldType2>(i);
fieldType2& prime2MeanField = const_cast<fieldType2&>
(
obr_.lookupObject<fieldType2>(prime2MeanFieldList[i])
);
prime2MeanField += sqr(meanField);
} }
} }
} }
template<class Type> template<class Type>
void Foam::fieldAverage::writeFieldList(const wordList& fieldList) const void Foam::fieldAverage::writeFieldType(const word& fieldName) const
{ {
typedef GeometricField<Type, fvPatchField, volMesh> fieldType; if (obr_.foundObject<Type>(fieldName))
forAll(fieldList, i)
{ {
if (fieldList[i].size()) const Type& f = obr_.lookupObject<Type>(fieldName);
f.write();
}
}
template<class Type>
void Foam::fieldAverage::writeFields() const
{
typedef GeometricField<Type, fvPatchField, volMesh> volFieldType;
typedef GeometricField<Type, fvsPatchField, surfaceMesh> surfFieldType;
forAll(faItems_, i)
{
if (faItems_[i].mean())
{ {
const fieldType& f = obr_.lookupObject<fieldType>(fieldList[i]); const word& fieldName = faItems_[i].meanFieldName();
f.write(); writeFieldType<volFieldType>(fieldName);
writeFieldType<surfFieldType>(fieldName);
}
if (faItems_[i].prime2Mean())
{
const word& fieldName = faItems_[i].prime2MeanFieldName();
writeFieldType<volFieldType>(fieldName);
writeFieldType<surfFieldType>(fieldName);
} }
} }
} }

View File

@ -29,6 +29,9 @@ License
namespace Foam namespace Foam
{ {
const word fieldAverageItem::EXT_MEAN = "Mean";
const word fieldAverageItem::EXT_PRIME2MEAN = "Prime2Mean";
template<> template<>
const char* Foam::NamedEnum const char* Foam::NamedEnum
< <
@ -50,9 +53,12 @@ const Foam::NamedEnum<Foam::fieldAverageItem::baseType, 2>
Foam::fieldAverageItem::fieldAverageItem() Foam::fieldAverageItem::fieldAverageItem()
: :
active_(false),
fieldName_("unknown"), fieldName_("unknown"),
mean_(0), mean_(0),
meanFieldName_("unknown"),
prime2Mean_(0), prime2Mean_(0),
prime2MeanFieldName_("unknown"),
base_(ITER), base_(ITER),
window_(-1.0), window_(-1.0),
windowName_("") windowName_("")
@ -61,9 +67,12 @@ Foam::fieldAverageItem::fieldAverageItem()
Foam::fieldAverageItem::fieldAverageItem(const fieldAverageItem& faItem) Foam::fieldAverageItem::fieldAverageItem(const fieldAverageItem& faItem)
: :
active_(faItem.active_),
fieldName_(faItem.fieldName_), fieldName_(faItem.fieldName_),
mean_(faItem.mean_), mean_(faItem.mean_),
meanFieldName_(faItem.meanFieldName_),
prime2Mean_(faItem.prime2Mean_), prime2Mean_(faItem.prime2Mean_),
prime2MeanFieldName_(faItem.prime2MeanFieldName_),
base_(faItem.base_), base_(faItem.base_),
window_(faItem.window_), window_(faItem.window_),
windowName_(faItem.windowName_) windowName_(faItem.windowName_)
@ -91,9 +100,12 @@ void Foam::fieldAverageItem::operator=(const fieldAverageItem& rhs)
} }
// Set updated values // Set updated values
active_ = rhs.active_;
fieldName_ = rhs.fieldName_; fieldName_ = rhs.fieldName_;
mean_ = rhs.mean_; mean_ = rhs.mean_;
meanFieldName_ = rhs.meanFieldName_;
prime2Mean_ = rhs.prime2Mean_; prime2Mean_ = rhs.prime2Mean_;
prime2MeanFieldName_ = rhs.prime2MeanFieldName_;
base_ = rhs.base_; base_ = rhs.base_;
window_ = rhs.window_; window_ = rhs.window_;
windowName_ = rhs.windowName_; windowName_ = rhs.windowName_;

View File

@ -78,6 +78,14 @@ public:
// Public data // Public data
// File and field name extensions
//- Mean average
static const word EXT_MEAN;
//- Prime-squared average
static const word EXT_PRIME2MEAN;
//- Enumeration defining the averaging base type //- Enumeration defining the averaging base type
enum baseType enum baseType
{ {
@ -90,15 +98,24 @@ private:
// Private data // Private data
//- Active flag
Switch active_;
//- Field name //- Field name
word fieldName_; word fieldName_;
//- Compute mean flag //- Compute mean flag
Switch mean_; Switch mean_;
//- Name of mean field
word meanFieldName_;
//- Compute prime-squared mean flag //- Compute prime-squared mean flag
Switch prime2Mean_; Switch prime2Mean_;
//- Name of prime-squared mean field
word prime2MeanFieldName_;
//- Averaging base type names //- Averaging base type names
static const NamedEnum<baseType, 2> baseTypeNames_; static const NamedEnum<baseType, 2> baseTypeNames_;
@ -134,6 +151,18 @@ public:
// Access // Access
//- Return const access to the active flag
const Switch& active() const
{
return active_;
}
//- Return non-const access to the active flag
Switch& active()
{
return active_;
}
//- Return const access to the field name //- Return const access to the field name
const word& fieldName() const const word& fieldName() const
{ {
@ -146,12 +175,36 @@ public:
return mean_; return mean_;
} }
//- Return non-const access to the mean flag
Switch& mean()
{
return mean_;
}
//- Return const access to the mean field name
const word& meanFieldName() const
{
return meanFieldName_;
}
//- Return const access to the prime-squared mean flag //- Return const access to the prime-squared mean flag
const Switch& prime2Mean() const const Switch& prime2Mean() const
{ {
return prime2Mean_; return prime2Mean_;
} }
//- Return non-const access to the prime-squared mean flag
Switch& prime2Mean()
{
return prime2Mean_;
}
//- Return const access to the prime-squared mean field name
const word& prime2MeanFieldName() const
{
return prime2MeanFieldName_;
}
//- Return averaging base type name //- Return averaging base type name
const word base() const const word base() const
{ {
@ -197,7 +250,9 @@ public:
return return
a.fieldName_ == b.fieldName_ a.fieldName_ == b.fieldName_
&& a.mean_ == b.mean_ && a.mean_ == b.mean_
&& a.meanFieldName_ == b.meanFieldName_
&& a.prime2Mean_ == b.prime2Mean_ && a.prime2Mean_ == b.prime2Mean_
&& a.prime2MeanFieldName_ == b.prime2MeanFieldName_
&& a.base_ == b.base_ && a.base_ == b.base_
&& a.window_ == b.window_ && a.window_ == b.window_
&& a.windowName_ == b.windowName_; && a.windowName_ == b.windowName_;

View File

@ -31,9 +31,12 @@ License
Foam::fieldAverageItem::fieldAverageItem(Istream& is) Foam::fieldAverageItem::fieldAverageItem(Istream& is)
: :
active_(false),
fieldName_("unknown"), fieldName_("unknown"),
mean_(0), mean_(0),
meanFieldName_("unknown"),
prime2Mean_(0), prime2Mean_(0),
prime2MeanFieldName_("unknown"),
base_(ITER), base_(ITER),
window_(-1.0) window_(-1.0)
{ {
@ -47,6 +50,14 @@ Foam::fieldAverageItem::fieldAverageItem(Istream& is)
base_ = baseTypeNames_[entry.lookup("base")]; base_ = baseTypeNames_[entry.lookup("base")];
window_ = entry.lookupOrDefault<scalar>("window", -1.0); window_ = entry.lookupOrDefault<scalar>("window", -1.0);
windowName_ = entry.lookupOrDefault<word>("windowName", ""); windowName_ = entry.lookupOrDefault<word>("windowName", "");
meanFieldName_ = fieldName_ + EXT_MEAN;
prime2MeanFieldName_ = fieldName_ + EXT_PRIME2MEAN;
if ((window_ > 0) && (windowName_ != ""))
{
meanFieldName_ = meanFieldName_ + "_" + windowName_;
prime2MeanFieldName_ = prime2MeanFieldName_ + "_" + windowName_;
}
} }
@ -62,6 +73,7 @@ Foam::Istream& Foam::operator>>(Istream& is, fieldAverageItem& faItem)
const dictionaryEntry entry(dictionary::null, is); const dictionaryEntry entry(dictionary::null, is);
faItem.active_ = false;
faItem.fieldName_ = entry.keyword(); faItem.fieldName_ = entry.keyword();
entry.lookup("mean") >> faItem.mean_; entry.lookup("mean") >> faItem.mean_;
entry.lookup("prime2Mean") >> faItem.prime2Mean_; entry.lookup("prime2Mean") >> faItem.prime2Mean_;
@ -69,6 +81,18 @@ Foam::Istream& Foam::operator>>(Istream& is, fieldAverageItem& faItem)
faItem.window_ = entry.lookupOrDefault<scalar>("window", -1.0); faItem.window_ = entry.lookupOrDefault<scalar>("window", -1.0);
faItem.windowName_ = entry.lookupOrDefault<word>("windowName", ""); faItem.windowName_ = entry.lookupOrDefault<word>("windowName", "");
faItem.meanFieldName_ = faItem.fieldName_ + fieldAverageItem::EXT_MEAN;
faItem.prime2MeanFieldName_ =
faItem.fieldName_ + fieldAverageItem::EXT_PRIME2MEAN;
if ((faItem.window_ > 0) && (faItem.windowName_ != ""))
{
faItem.meanFieldName_ =
faItem.meanFieldName_ + "_" + faItem.windowName_;
faItem.prime2MeanFieldName_ =
faItem.prime2MeanFieldName_ + "_" + faItem.windowName_;
}
return is; return is;
} }

View File

@ -34,10 +34,6 @@ License
#include "mappedWallPolyPatch.H" #include "mappedWallPolyPatch.H"
#include "mapDistribute.H" #include "mapDistribute.H"
#include "cachedRandom.H"
#include "normal.H"
#include "mathematicalConstants.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam

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-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -103,6 +103,18 @@ Foam::scalar Foam::liquidMixtureProperties::Tc(const scalarField& x) const
} }
Foam::scalar Foam::liquidMixtureProperties::TMax(const scalar p) const
{
scalar T = -GREAT;
forAll(properties_, i)
{
T = max(T, properties_[i].pvInvert(p));
}
return T;
}
Foam::scalar Foam::liquidMixtureProperties::Tpc(const scalarField& x) const Foam::scalar Foam::liquidMixtureProperties::Tpc(const scalarField& x) const
{ {
scalar Tpc = 0.0; scalar Tpc = 0.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-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -138,10 +138,12 @@ public:
return components_.size(); return components_.size();
} }
//- Calculate the critical temperature of mixture //- Calculate the critical temperature of mixture
scalar Tc(const scalarField& x) const; scalar Tc(const scalarField& x) const;
//- Calculate the maximum temperature of mixture at given pressure
scalar TMax(const scalar p) const;
//- Return pseudocritical temperature according to Kay's rule //- Return pseudocritical temperature according to Kay's rule
scalar Tpc(const scalarField& x) const; scalar Tpc(const scalarField& x) const;

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-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -344,44 +344,43 @@ Foam::scalar Foam::liquidProperties::D(scalar p, scalar T, scalar Wb) const
Foam::scalar Foam::liquidProperties::pvInvert(scalar p) const Foam::scalar Foam::liquidProperties::pvInvert(scalar p) const
{ {
scalar T = Tc_; // Check for critical and solid phase conditions
scalar deltaT = 10.0; if (p >= Pc_)
scalar dp0 = pv(p, T) - p;
label n = 0;
while ((n < 200) && (mag(deltaT) > 1.0e-3))
{ {
n++; return Tc_;
scalar pBoil = pv(p, T); }
scalar dp = pBoil - p; else if (p < Pt_)
{
if ((dp > 0.0) && (dp0 > 0.0)) if (debug)
{ {
T -= deltaT; WarningIn
(
"Foam::scalar Foam::liquidProperties::pvInvert(scalar) const"
) << "Pressure below triple point pressure: "
<< "p = " << p << " < Pt = " << Pt_ << nl << endl;
}
return -1;
}
// Set initial upper and lower bounds
scalar Thi = Tc_;
scalar Tlo = Tt_;
// Initialise T as boiling temperature under normal conditions
scalar T = Tb_;
while ((Thi - Tlo) > 1.0e-4)
{
if ((pv(p, T) - p) <= 0.0)
{
Tlo = T;
} }
else else
{ {
if ((dp < 0.0) && (dp0 < 0.0)) Thi = T;
{
T += deltaT;
}
else
{
deltaT *= 0.5;
if ((dp > 0.0) && (dp0 < 0.0))
{
T -= deltaT;
}
else
{
T += deltaT;
}
}
} }
dp0 = dp; T = (Thi + Tlo)*0.5;
} }
return T; return T;

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-2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -42,7 +42,8 @@ totalFlowRateAdvectiveDiffusiveFvPatchScalarField
: :
mixedFvPatchField<scalar>(p, iF), mixedFvPatchField<scalar>(p, iF),
phiName_("phi"), phiName_("phi"),
rhoName_("none") rhoName_("none"),
massFluxFraction_(1.0)
{ {
refValue() = 0.0; refValue() = 0.0;
refGrad() = 0.0; refGrad() = 0.0;
@ -60,7 +61,8 @@ totalFlowRateAdvectiveDiffusiveFvPatchScalarField
: :
mixedFvPatchField<scalar>(p, iF), mixedFvPatchField<scalar>(p, iF),
phiName_(dict.lookupOrDefault<word>("phi", "phi")), phiName_(dict.lookupOrDefault<word>("phi", "phi")),
rhoName_(dict.lookupOrDefault<word>("rho", "none")) rhoName_(dict.lookupOrDefault<word>("rho", "none")),
massFluxFraction_(dict.lookupOrDefault<scalar>("massFluxFraction", 1.0))
{ {
refValue() = 1.0; refValue() = 1.0;
@ -91,7 +93,8 @@ totalFlowRateAdvectiveDiffusiveFvPatchScalarField
: :
mixedFvPatchField<scalar>(ptf, p, iF, mapper), mixedFvPatchField<scalar>(ptf, p, iF, mapper),
phiName_(ptf.phiName_), phiName_(ptf.phiName_),
rhoName_(ptf.rhoName_) rhoName_(ptf.rhoName_),
massFluxFraction_(ptf.massFluxFraction_)
{} {}
@ -103,7 +106,8 @@ totalFlowRateAdvectiveDiffusiveFvPatchScalarField
: :
mixedFvPatchField<scalar>(tppsf), mixedFvPatchField<scalar>(tppsf),
phiName_(tppsf.phiName_), phiName_(tppsf.phiName_),
rhoName_(tppsf.rhoName_) rhoName_(tppsf.rhoName_),
massFluxFraction_(tppsf.massFluxFraction_)
{} {}
Foam::totalFlowRateAdvectiveDiffusiveFvPatchScalarField:: Foam::totalFlowRateAdvectiveDiffusiveFvPatchScalarField::
@ -115,7 +119,8 @@ totalFlowRateAdvectiveDiffusiveFvPatchScalarField
: :
mixedFvPatchField<scalar>(tppsf, iF), mixedFvPatchField<scalar>(tppsf, iF),
phiName_(tppsf.phiName_), phiName_(tppsf.phiName_),
rhoName_(tppsf.rhoName_) rhoName_(tppsf.rhoName_),
massFluxFraction_(tppsf.massFluxFraction_)
{} {}
@ -160,7 +165,7 @@ void Foam::totalFlowRateAdvectiveDiffusiveFvPatchScalarField::updateCoeffs()
const scalarField alphap(turbulence.alphaEff(patchI)); const scalarField alphap(turbulence.alphaEff(patchI));
refValue() = 1.0; refValue() = massFluxFraction_;
refGrad() = 0.0; refGrad() = 0.0;
valueFraction() = valueFraction() =
@ -192,6 +197,8 @@ write(Ostream& os) const
fvPatchField<scalar>::write(os); fvPatchField<scalar>::write(os);
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl; os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl; os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl;
os.writeKeyword("massFluxFraction") << massFluxFraction_
<< token::END_STATEMENT << nl;
this->writeEntry("value", os); this->writeEntry("value", os);
} }

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-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -25,7 +25,10 @@ Class
Foam::totalFlowRateAdvectiveDiffusiveFvPatchScalarField Foam::totalFlowRateAdvectiveDiffusiveFvPatchScalarField
Description Description
Foam::totalFlowRateAdvectiveDiffusiveFvPatchScalarField This BC is used for species inlets. The diffusion and advection fluxes are
considered to calculate the inlet value for the species
The massFluxFraction sets the fraction of the flux of each particular
species.
SourceFiles SourceFiles
totalFlowRateAdvectiveDiffusiveFvPatchScalarField.C totalFlowRateAdvectiveDiffusiveFvPatchScalarField.C
@ -59,6 +62,8 @@ class totalFlowRateAdvectiveDiffusiveFvPatchScalarField
// if neccessary // if neccessary
word rhoName_; word rhoName_;
//- Mass flux fraction
scalar massFluxFraction_;
public: public:
@ -137,13 +142,6 @@ public:
// Member functions // Member functions
// Access
//- Return reference to the name of the flux field
word& phiName()
{
return phiName_;
}
// Mapping functions // Mapping functions

View File

@ -7,5 +7,7 @@ cd ${0%/*} || exit 1 # run from this directory
cleanCase cleanCase
rm -rf constant/panelRegion/polyMesh rm -rf constant/panelRegion/polyMesh
rm -f 0/polyMesh/cellMap
rm -f constant/polyMesh/boundary
# ----------------------------------------------------------------- end-of-file # ----------------------------------------------------------------- end-of-file

View File

@ -1,22 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object energySourcesProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
(
// none
);
// ************************************************************************* //

View File

@ -1,23 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object massSourcesProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
(
// none
);
// ************************************************************************* //

View File

@ -1,23 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object momentumSourcesProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
(
// none
);
// ************************************************************************* //

View File

@ -37,6 +37,7 @@ boundaryField
walls walls
{ {
type kqRWallFunction; type kqRWallFunction;
value $internalField;
} }
frontAndBackPlanes frontAndBackPlanes

View File

@ -37,6 +37,7 @@ boundaryField
walls walls
{ {
type kqRWallFunction; type kqRWallFunction;
value $internalField;
} }
frontAndBackPlanes frontAndBackPlanes