diff --git a/etc/templates/singleFluidCHT/templates/0/solid/p b/etc/templates/singleFluidCHT/templates/0/solid/p deleted file mode 100644 index f7698db520..0000000000 --- a/etc/templates/singleFluidCHT/templates/0/solid/p +++ /dev/null @@ -1,34 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Version: dev - \\/ M anipulation | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class volScalarField; - object p; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#include "$FOAM_CASE/constant/initialConditions" - -dimensions [1 -1 -2 0 0 0 0]; - -internalField uniform $pInitial; - -boundaryField -{ - ".*" - { - type calculated; - value uniform $pInitial; - } - - #includeEtc "caseDicts/setConstraintTypes" -} - -// ************************************************************************* // diff --git a/src/OpenFOAM/Make/files b/src/OpenFOAM/Make/files index 955dae636e..e52877be3e 100644 --- a/src/OpenFOAM/Make/files +++ b/src/OpenFOAM/Make/files @@ -616,6 +616,9 @@ meshTools = meshes/meshTools $(meshTools)/matchPoints.C fields/UniformDimensionedFields/uniformDimensionedFields.C + +fields/UniformGeometricFields/uniformGeometricFields.C + fields/cloud/cloud.C Fields = fields/Fields diff --git a/src/thermophysicalModels/solidThermo/solidPressureThermo/solidPressureThermo.H b/src/OpenFOAM/fields/FieldFields/UniformFieldField/UniformFieldField.H similarity index 58% rename from src/thermophysicalModels/solidThermo/solidPressureThermo/solidPressureThermo.H rename to src/OpenFOAM/fields/FieldFields/UniformFieldField/UniformFieldField.H index f984e88415..4d6ee02481 100644 --- a/src/thermophysicalModels/solidThermo/solidPressureThermo/solidPressureThermo.H +++ b/src/OpenFOAM/fields/FieldFields/UniformFieldField/UniformFieldField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -22,20 +22,21 @@ License along with OpenFOAM. If not, see . Class - Foam::solidPressureThermo + Foam::UniformFieldField Description - Fundamental solid thermodynamic properties including pressure. + A class representing the concept of a field of uniform fields which stores + only the single value and providing the operator[] to return it. SourceFiles - solidPressureThermo.C + UniformFieldFieldI.H \*---------------------------------------------------------------------------*/ -#ifndef solidPressureThermo_H -#define solidPressureThermo_H +#ifndef UniformFieldField_H +#define UniformFieldField_H -#include "solidThermo.H" +#include "UniformField.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -43,59 +44,34 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class solidPressureThermo Declaration + Class UniformFieldField Declaration \*---------------------------------------------------------------------------*/ -class solidPressureThermo -: - public solidThermo +template +class UniformFieldField { + // Private Data -protected: - - // Fields - - //- Pressure [Pa] - volScalarField& p_; + Type value_; public: - //- Runtime type information - TypeName("solidPressureThermo"); + // Public typedefs + + //- Component type + typedef typename pTraits::cmptType cmptType; + // Constructors - //- Construct from mesh and phase name - solidPressureThermo - ( - const fvMesh&, - const word& phaseName - ); - - //- Construct from mesh, dictionary and phase name - solidPressureThermo - ( - const fvMesh&, - const dictionary& dict, - const word& phaseName - ); + //- Construct given value + UniformFieldField(const Type& value); - //- Destructor - virtual ~solidPressureThermo(); + // Member Operators - - // Member Functions - - // Access to thermodynamic state variables - - //- Pressure [Pa] - // Non-const access allowed for transport equations - virtual volScalarField& p(); - - //- Pressure [Pa] - virtual const volScalarField& p() const; + inline UniformField operator[](const label) const; }; @@ -105,6 +81,10 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +#include "UniformFieldFieldI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + #endif // ************************************************************************* // diff --git a/src/OpenFOAM/fields/FieldFields/UniformFieldField/UniformFieldFieldI.H b/src/OpenFOAM/fields/FieldFields/UniformFieldField/UniformFieldFieldI.H new file mode 100644 index 0000000000..80fb163faf --- /dev/null +++ b/src/OpenFOAM/fields/FieldFields/UniformFieldField/UniformFieldFieldI.H @@ -0,0 +1,47 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2020 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 . + +\*---------------------------------------------------------------------------*/ + +#include "UniformFieldField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +template +inline Foam::UniformFieldField::UniformFieldField(const Type& value) +: + value_(value) +{} + + +template +inline Foam::UniformField Foam::UniformFieldField::operator[] +( + const label +) const +{ + return UniformField(value_); +} + + +// ************************************************************************* // diff --git a/src/OpenFOAM/fields/Fields/uniformField/UniformField.H b/src/OpenFOAM/fields/Fields/UniformField/UniformField.H similarity index 93% rename from src/OpenFOAM/fields/Fields/uniformField/UniformField.H rename to src/OpenFOAM/fields/Fields/UniformField/UniformField.H index c302d7c266..c1467762bf 100644 --- a/src/OpenFOAM/fields/Fields/uniformField/UniformField.H +++ b/src/OpenFOAM/fields/Fields/UniformField/UniformField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2013-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -51,8 +51,15 @@ class UniformField Type value_; + public: + // Public typedefs + + //- Component type + typedef typename pTraits::cmptType cmptType; + + // Constructors //- Construct given value diff --git a/src/OpenFOAM/fields/Fields/uniformField/UniformFieldI.H b/src/OpenFOAM/fields/Fields/UniformField/UniformFieldI.H similarity index 97% rename from src/OpenFOAM/fields/Fields/uniformField/UniformFieldI.H rename to src/OpenFOAM/fields/Fields/UniformField/UniformFieldI.H index f10a70b53e..e34e83e7d9 100644 --- a/src/OpenFOAM/fields/Fields/uniformField/UniformFieldI.H +++ b/src/OpenFOAM/fields/Fields/UniformField/UniformFieldI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2013-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/OpenFOAM/fields/UniformDimensionedFields/UniformDimensionedField.H b/src/OpenFOAM/fields/UniformDimensionedFields/UniformDimensionedField.H index cc2f24ca7d..f1b5498772 100644 --- a/src/OpenFOAM/fields/UniformDimensionedFields/UniformDimensionedField.H +++ b/src/OpenFOAM/fields/UniformDimensionedFields/UniformDimensionedField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -39,6 +39,7 @@ SourceFiles #include "regIOobject.H" #include "dimensionedType.H" +#include "UniformField.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -58,6 +59,15 @@ class UniformDimensionedField public: + // Public Typedefs + + //- Type of the non-dimensioned field + typedef UniformField FieldType; + + //- Component type of the elements of the field + typedef typename UniformField::cmptType cmptType; + + //- Runtime type information TypeName("UniformDimensionedField"); @@ -87,8 +97,6 @@ public: return dimensioned::name(); } - bool writeData(Ostream&) const; - //- Is object global virtual bool global() const { @@ -102,6 +110,15 @@ public: return globalFilePath(type()); } + //- Return the non-dimensioned field + FieldType field() const + { + return FieldType(this->value()); + } + + //- WriteData function required for regIOobject write operation + bool writeData(Ostream&) const; + // Member Operators diff --git a/src/thermophysicalModels/solidThermo/solidPressureThermo/solidPressureThermo.C b/src/OpenFOAM/fields/UniformGeometricFields/UniformGeometricField.C similarity index 59% rename from src/thermophysicalModels/solidThermo/solidPressureThermo/solidPressureThermo.C rename to src/OpenFOAM/fields/UniformGeometricFields/UniformGeometricField.C index 6dee6ab983..e597615cef 100644 --- a/src/thermophysicalModels/solidThermo/solidPressureThermo/solidPressureThermo.C +++ b/src/OpenFOAM/fields/UniformGeometricFields/UniformGeometricField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,60 +23,46 @@ License \*---------------------------------------------------------------------------*/ -#include "solidPressureThermo.H" -#include "fvMesh.H" - -/* * * * * * * * * * * * * * * private static data * * * * * * * * * * * * * */ - -namespace Foam -{ - defineTypeNameAndDebug(solidPressureThermo, 0); -} - +#include "UniformGeometricField.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::solidPressureThermo::solidPressureThermo +template +Foam::UniformGeometricField::UniformGeometricField ( - const fvMesh& mesh, - const word& phaseName + const IOobject& io, + const dimensioned& dt ) : - solidThermo(mesh, phaseName), - p_(lookupOrConstruct(mesh, "p")) + UniformDimensionedField(io, dt) {} -Foam::solidPressureThermo::solidPressureThermo +template +Foam::UniformGeometricField::UniformGeometricField ( - const fvMesh& mesh, - const dictionary& dict, - const word& phaseName + const UniformGeometricField& rdt ) : - solidThermo(mesh, dict, phaseName), - p_(lookupOrConstruct(mesh, "p")) + UniformDimensionedField(rdt) +{} + + +template +Foam::UniformGeometricField::UniformGeometricField +( + const IOobject& io +) +: + UniformDimensionedField(io) {} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // -Foam::solidPressureThermo::~solidPressureThermo() +template +Foam::UniformGeometricField::~UniformGeometricField() {} -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -const Foam::volScalarField& Foam::solidPressureThermo::p() const -{ - return p_; -} - - -Foam::volScalarField& Foam::solidPressureThermo::p() -{ - return p_; -} - - // ************************************************************************* // diff --git a/src/OpenFOAM/fields/UniformGeometricFields/UniformGeometricField.H b/src/OpenFOAM/fields/UniformGeometricFields/UniformGeometricField.H new file mode 100644 index 0000000000..275777a6f1 --- /dev/null +++ b/src/OpenFOAM/fields/UniformGeometricFields/UniformGeometricField.H @@ -0,0 +1,116 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2020 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 . + +Class + Foam::UniformGeometricField + +Description + Dimensioned registered with the database as a registered IOobject + which has the functionality of a uniform field and allows values from the + top-level code to be passed to boundary conditions etc. + +SourceFiles + UniformGeometricField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef UniformGeometricField_H +#define UniformGeometricField_H + +#include "UniformDimensionedField.H" +#include "UniformFieldField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class UniformGeometricField Declaration +\*---------------------------------------------------------------------------*/ + +template +class UniformGeometricField +: + public UniformDimensionedField +{ +public: + + // Public Typedefs + + typedef UniformDimensionedField Internal; + typedef UniformField Patch; + typedef UniformFieldField Boundary; + typedef Type cmptType; + + + //- Runtime type information + TypeName("UniformGeometricField"); + + + // Constructors + + //- Construct from components. Either reads or uses supplied value. + UniformGeometricField(const IOobject&, const dimensioned&); + + //- Copy constructor + UniformGeometricField(const UniformGeometricField&); + + //- Construct from Istream + UniformGeometricField(const IOobject&); + + + //- Destructor + virtual ~UniformGeometricField(); + + + // Member Operators + + inline const UniformGeometricField& oldTime() const; + + inline const Internal& operator()() const; + + inline const Internal& v() const; + + inline typename Internal::FieldType primitiveField() const; + + inline Boundary boundaryField() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository + #include "UniformGeometricField.C" + #include "UniformGeometricFieldI.H" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/OpenFOAM/fields/UniformGeometricFields/UniformGeometricFieldI.H b/src/OpenFOAM/fields/UniformGeometricFields/UniformGeometricFieldI.H new file mode 100644 index 0000000000..bea453a976 --- /dev/null +++ b/src/OpenFOAM/fields/UniformGeometricFields/UniformGeometricFieldI.H @@ -0,0 +1,70 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2020 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 . + +\*---------------------------------------------------------------------------*/ + +#include "UniformGeometricField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +template +inline const Foam::UniformGeometricField& +Foam::UniformGeometricField::oldTime() const +{ + return *this; +} + + +template +inline const typename Foam::UniformGeometricField::Internal& +Foam::UniformGeometricField::operator()() const +{ + return *this; +} + + +template +inline const typename Foam::UniformGeometricField::Internal& +Foam::UniformGeometricField::v() const +{ + return *this; +} + + +template +inline typename Foam::UniformGeometricField::Internal::FieldType +Foam::UniformGeometricField::primitiveField() const +{ + return typename Internal::FieldType(this->value()); +} + + +template +inline typename Foam::UniformGeometricField::Boundary +Foam::UniformGeometricField::boundaryField() const +{ + return Boundary(this->value()); +} + + +// ************************************************************************* // diff --git a/src/OpenFOAM/fields/UniformGeometricFields/uniformGeometricFields.C b/src/OpenFOAM/fields/UniformGeometricFields/uniformGeometricFields.C new file mode 100644 index 0000000000..3af9a11c25 --- /dev/null +++ b/src/OpenFOAM/fields/UniformGeometricFields/uniformGeometricFields.C @@ -0,0 +1,45 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2020 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 . + +\*---------------------------------------------------------------------------*/ + +#include "uniformGeometricFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTemplateTypeNameAndDebug(uniformGeometricScalarField, 0); +defineTemplateTypeNameAndDebug(uniformGeometricVectorField, 0); +defineTemplateTypeNameAndDebug(uniformGeometricSphericalTensorField, 0); +defineTemplateTypeNameAndDebug(uniformGeometricSymmTensorField, 0); +defineTemplateTypeNameAndDebug(uniformGeometricTensorField, 0); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/fields/UniformGeometricFields/uniformGeometricFields.H b/src/OpenFOAM/fields/UniformGeometricFields/uniformGeometricFields.H new file mode 100644 index 0000000000..ba2d76fd23 --- /dev/null +++ b/src/OpenFOAM/fields/UniformGeometricFields/uniformGeometricFields.H @@ -0,0 +1,62 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2020 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 . + +InClass + Foam::UniformGeometricField + +Description + +SourceFiles + uniformGeometricFields.C + +\*---------------------------------------------------------------------------*/ + +#ifndef uniformGeometricFields_H +#define uniformGeometricFields_H + +#include "UniformGeometricField.H" +#include "fieldTypes.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +typedef UniformGeometricField uniformGeometricScalarField; +typedef UniformGeometricField uniformGeometricVectorField; +typedef UniformGeometricField + uniformGeometricSphericalTensorField; +typedef UniformGeometricField uniformGeometricSymmTensorField; +typedef UniformGeometricField uniformGeometricTensorField; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/radiationModels/Make/files b/src/radiationModels/Make/files index 9a7158e08d..9eaebfa1c8 100644 --- a/src/radiationModels/Make/files +++ b/src/radiationModels/Make/files @@ -24,7 +24,6 @@ absorptionEmissionModels/constantAbsorptionEmission/constantAbsorptionEmission.C absorptionEmissionModels/binary/binary.C absorptionEmissionModels/greyMean/greyMean.C absorptionEmissionModels/wideBand/wideBand.C -absorptionEmissionModels/greyMeanSolid/greyMeanSolid.C /* Soot model */ sootModels/sootModel/sootModel.C diff --git a/src/radiationModels/absorptionEmissionModels/greyMeanSolid/greyMeanSolid.C b/src/radiationModels/absorptionEmissionModels/greyMeanSolid/greyMeanSolid.C deleted file mode 100644 index f9adb08829..0000000000 --- a/src/radiationModels/absorptionEmissionModels/greyMeanSolid/greyMeanSolid.C +++ /dev/null @@ -1,205 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 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 . - -\*---------------------------------------------------------------------------*/ - -#include "greyMeanSolid.H" -#include "addToRunTimeSelectionTable.H" -#include "unitConversion.H" -#include "extrapolatedCalculatedFvPatchFields.H" - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -namespace Foam -{ -namespace radiationModels -{ -namespace absorptionEmissionModels -{ - defineTypeNameAndDebug(greyMeanSolid, 0); - - addToRunTimeSelectionTable - ( - absorptionEmissionModel, - greyMeanSolid, - dictionary - ); -} -} -} - - -// * * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * // - -Foam::tmp -Foam::radiationModels::absorptionEmissionModels::greyMeanSolid::X -( - const word specie -) const -{ - const volScalarField& T = thermo_.T(); - const volScalarField& p = thermo_.p(); - - tmp tXj(new scalarField(T.primitiveField().size(), 0.0)); - scalarField& Xj = tXj.ref(); - - tmp tRhoInv(new scalarField(T.primitiveField().size(), 0.0)); - scalarField& rhoInv = tRhoInv.ref(); - - forAll(mixture_.Y(), specieI) - { - const scalarField& Yi = mixture_.Y()[specieI]; - - forAll(rhoInv, iCell) - { - rhoInv[iCell] += - Yi[iCell]/mixture_.rho(specieI, p[iCell], T[iCell]); - } - } - const scalarField& Yj = mixture_.Y(specie); - const label mySpecieI = mixture_.species()[specie]; - forAll(Xj, iCell) - { - Xj[iCell] = Yj[iCell]/mixture_.rho(mySpecieI, p[iCell], T[iCell]); - } - - return (Xj/rhoInv); -} - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::radiationModels::absorptionEmissionModels::greyMeanSolid::greyMeanSolid -( - const dictionary& dict, - const fvMesh& mesh -) -: - absorptionEmissionModel(dict, mesh), - coeffsDict_((dict.optionalSubDict(typeName + "Coeffs"))), - thermo_(mesh.lookupObject(basicThermo::dictName)), - speciesNames_(0), - mixture_(dynamic_cast(thermo_)), - solidData_(mixture_.Y().size()) -{ - if (!isA(thermo_)) - { - FatalErrorInFunction - << "Model requires a multi-component thermo package" - << abort(FatalError); - } - - label nFunc = 0; - const dictionary& functionDicts = dict.optionalSubDict(typeName + "Coeffs"); - - forAllConstIter(dictionary, functionDicts, iter) - { - // safety: - if (!iter().isDict()) - { - continue; - } - const word& key = iter().keyword(); - if (!mixture_.contains(key)) - { - WarningInFunction - << " specie: " << key << " is not found in the solid mixture" - << nl - << " specie is the mixture are:" << mixture_.species() << nl - << nl << endl; - } - speciesNames_.insert(key, nFunc); - const dictionary& dict = iter().dict(); - dict.lookup("absorptivity") >> solidData_[nFunc][absorptivity]; - dict.lookup("emissivity") >> solidData_[nFunc][emissivity]; - - nFunc++; - } -} - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::radiationModels::absorptionEmissionModels::greyMeanSolid::~greyMeanSolid() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -Foam::tmp -Foam::radiationModels::absorptionEmissionModels::greyMeanSolid::calc -( - const label propertyId -) const -{ - tmp ta - ( - new volScalarField - ( - IOobject - ( - "a", - mesh().time().timeName(), - mesh(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - mesh(), - dimensionedScalar(dimless/dimLength, 0), - extrapolatedCalculatedFvPatchVectorField::typeName - ) - ); - - scalarField& a = ta.ref().primitiveFieldRef(); - - forAllConstIter(HashTable