From 0505dbee3eb98a7b51bc4da44117d6811319101e Mon Sep 17 00:00:00 2001 From: andy <a.heather@opencfd.co.uk> Date: Fri, 6 Mar 2009 15:53:58 +0000 Subject: [PATCH] tidy-up and added CaCO3 - put solids in their own namespace? --- .../KinematicParcel/KinematicParcel.C | 2 +- .../ReactingMultiphaseParcel.C | 2 +- .../Templates/ReactingParcel/ReactingParcel.C | 2 +- .../Templates/ThermoParcel/ThermoParcel.C | 2 +- src/thermophysicalModels/solids/C/C.C | 86 +++++++++++++++ src/thermophysicalModels/solids/C/C.H | 100 ++++++++++++++++++ src/thermophysicalModels/solids/CaCO3/CaCO3.C | 86 +++++++++++++++ .../solids/{Cs/Cs.H => CaCO3/CaCO3.H} | 61 +++++------ src/thermophysicalModels/solids/Make/files | 5 +- src/thermophysicalModels/solids/ash/ash.C | 41 +++++++ src/thermophysicalModels/solids/ash/ash.H | 50 ++++----- .../solids/solid/newSolid.C | 89 ++++++++++++++++ src/thermophysicalModels/solids/solid/solid.C | 98 ++++++++--------- src/thermophysicalModels/solids/solid/solid.H | 73 ++++--------- .../solids/{Cs/Cs.C => solid/solidI.H} | 34 ++++-- 15 files changed, 545 insertions(+), 186 deletions(-) create mode 100644 src/thermophysicalModels/solids/C/C.C create mode 100644 src/thermophysicalModels/solids/C/C.H create mode 100644 src/thermophysicalModels/solids/CaCO3/CaCO3.C rename src/thermophysicalModels/solids/{Cs/Cs.H => CaCO3/CaCO3.H} (73%) create mode 100644 src/thermophysicalModels/solids/solid/newSolid.C rename src/thermophysicalModels/solids/{Cs/Cs.C => solid/solidI.H} (78%) diff --git a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C index 96a777b1936..7fc3a62b792 100644 --- a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C +++ b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C @@ -268,7 +268,7 @@ void Foam::KinematicParcel<ParcelType>::transformProperties } -// * * * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * // +// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * // #include "KinematicParcelIO.C" diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.C b/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.C index 6bb568409cc..2b67498fd23 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.C +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.C @@ -385,7 +385,7 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calcSurfaceReactions } -// * * * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * // +// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * // #include "ReactingMultiphaseParcelIO.C" diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C index d605841d406..8e8b9f9d68a 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C @@ -236,7 +236,7 @@ Foam::scalar Foam::ReactingParcel<ParcelType>::calcPhaseChange } -// * * * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * // +// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * // #include "ReactingParcelIO.C" diff --git a/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcel.C b/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcel.C index a158fc8e52b..61cbdf9535d 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcel.C +++ b/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcel.C @@ -174,7 +174,7 @@ Foam::scalar Foam::ThermoParcel<ParcelType>::calcHeatTransfer } -// * * * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * // +// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * // #include "ThermoParcelIO.C" diff --git a/src/thermophysicalModels/solids/C/C.C b/src/thermophysicalModels/solids/C/C.C new file mode 100644 index 00000000000..bc701872b76 --- /dev/null +++ b/src/thermophysicalModels/solids/C/C.C @@ -0,0 +1,86 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "C.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(C, 0); +addToRunTimeSelectionTable(solid, C,); +addToRunTimeSelectionTable(solid, C, Istream); + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::C::C() +: + solid(2010, 710, 0.04, 0.0, 1.0) +{ + WarningIn("C::C()") + << "Properties of graphite need to be checked!!!" + << endl; +} + + +Foam::C::C(const solid& s) +: + solid(s) +{} + + +Foam::C::C(Istream& is) +: + solid(is) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::C::writeData(Ostream& os) const +{ + solid::writeData(os); +} + + +// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * // + +Foam::Ostream& operator<<(Ostream& os, const C& s) +{ + s.writeData(os); + return os; +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/thermophysicalModels/solids/C/C.H b/src/thermophysicalModels/solids/C/C.H new file mode 100644 index 00000000000..0a3110b55d6 --- /dev/null +++ b/src/thermophysicalModels/solids/C/C.H @@ -0,0 +1,100 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::C + +Description + Graphite + +SourceFiles + C.C + +\*---------------------------------------------------------------------------*/ + +#ifndef solid_C_H +#define solid_C_H + +#include "solid.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +class C; + +Ostream& operator<< +( + Ostream&, + const C& +); + + +/*---------------------------------------------------------------------------*\ + Class C Declaration +\*---------------------------------------------------------------------------*/ + +class C +: + public solid +{ +public: + + //- Runtime type information + TypeName("C"); + + + // Constructors + + //- Construct null + C(); + + //- Construct from solid + C(const solid& s); + + //- Construct from Istream + C(Istream& is); + + + // I-O + + //- Write the function coefficients + void writeData(Ostream& os) const; + + + //- Ostream Operator + friend Ostream& operator<<(Ostream& os, const C& s); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/solids/CaCO3/CaCO3.C b/src/thermophysicalModels/solids/CaCO3/CaCO3.C new file mode 100644 index 00000000000..36dcdd3d5c9 --- /dev/null +++ b/src/thermophysicalModels/solids/CaCO3/CaCO3.C @@ -0,0 +1,86 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "CaCO3.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(CaCO3, 0); +addToRunTimeSelectionTable(solid, CaCO3,); +addToRunTimeSelectionTable(solid, CaCO3, Istream); + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::CaCO3::CaCO3() +: + solid(2710, 850, 1.3, 0.0, 1.0) +{ + WarningIn("CaCO3::CaCO3()") + << "Properties of CaCO3 need to be checked!!!" + << endl; +} + + +Foam::CaCO3::CaCO3(const solid& s) +: + solid(s) +{} + + +Foam::CaCO3::CaCO3(Istream& is) +: + solid(is) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::CaCO3::writeData(Ostream& os) const +{ + solid::writeData(os); +} + + +// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * // + +Foam::Ostream& operator<<(Ostream& os, const CaCO3& s) +{ + s.writeData(os); + return os; +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/thermophysicalModels/solids/Cs/Cs.H b/src/thermophysicalModels/solids/CaCO3/CaCO3.H similarity index 73% rename from src/thermophysicalModels/solids/Cs/Cs.H rename to src/thermophysicalModels/solids/CaCO3/CaCO3.H index 648c5bf9106..a3336f2f771 100644 --- a/src/thermophysicalModels/solids/Cs/Cs.H +++ b/src/thermophysicalModels/solids/CaCO3/CaCO3.H @@ -23,18 +23,18 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Class - Foam::Cs + Foam::CaCO3 Description - Graphite + Calcium carbonate (limestone) SourceFiles - Cs.C + CaCO3.C \*---------------------------------------------------------------------------*/ -#ifndef solid_Cs_H -#define solid_Cs_H +#ifndef solid_CaCO3_H +#define solid_CaCO3_H #include "solid.H" @@ -43,11 +43,20 @@ SourceFiles namespace Foam { +class CaCO3; + +Ostream& operator<< +( + Ostream&, + const CaCO3& +); + + /*---------------------------------------------------------------------------*\ - Class Cs Declaration + Class CaCO3 Declaration \*---------------------------------------------------------------------------*/ -class Cs +class CaCO3 : public solid { @@ -55,50 +64,30 @@ class Cs public: //- Runtime type information - TypeName("Cs"); + TypeName("CaCO3"); // Constructors //- Construct null - Cs() - : - solid(2010, 710, 0.04, 0.0, 1.0) - { - WarningIn("Cs::Cs()") - << "Properties of graphite need to be checked!!!" - << endl; - } + CaCO3(); //- Construct from solid - Cs - ( - const solid& s - ) - : - solid(s) - {} + CaCO3(const solid& s); //- Construct from Istream - Cs(Istream& is) - : - solid(is) - {} + CaCO3(Istream& is); + + + // I-O //- Write the function coefficients - void writeData(Ostream& os) const - { - solid::writeData(os); - } + void writeData(Ostream& os) const; // Ostream Operator - friend Ostream& operator<<(Ostream& os, const Cs& s) - { - s.writeData(os); - return os; - } + friend Ostream& operator<<(Ostream& os, const CaCO3& s); }; diff --git a/src/thermophysicalModels/solids/Make/files b/src/thermophysicalModels/solids/Make/files index 407737ead16..5da964b97f8 100644 --- a/src/thermophysicalModels/solids/Make/files +++ b/src/thermophysicalModels/solids/Make/files @@ -1,5 +1,8 @@ solid/solid.C +solid/newSolid.C + ash/ash.C -Cs/Cs.C +C/C.C +CaCO3/CaCO3.C LIB = $(FOAM_LIBBIN)/libsolids diff --git a/src/thermophysicalModels/solids/ash/ash.C b/src/thermophysicalModels/solids/ash/ash.C index c63318e3999..42da228d2c1 100644 --- a/src/thermophysicalModels/solids/ash/ash.C +++ b/src/thermophysicalModels/solids/ash/ash.C @@ -38,6 +38,47 @@ defineTypeNameAndDebug(ash, 0); addToRunTimeSelectionTable(solid, ash,); addToRunTimeSelectionTable(solid, ash, Istream); +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::ash::ash() +: + solid(2010, 710, 0.04, 0.0, 1.0) +{ + WarningIn("ash::ash()") + << "Properties of ash need to be checked!!!" + << endl; +} + + +Foam::ash::ash(const solid& s) +: + solid(s) +{} + + +Foam::ash::ash(Istream& is) +: + solid(is) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::ash::writeData(Ostream& os) const +{ + solid::writeData(os); +} + + +// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * // + +Foam::Ostream& operator<<(Ostream& os, const ash& s) +{ + s.writeData(os); + return os; +} + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/thermophysicalModels/solids/ash/ash.H b/src/thermophysicalModels/solids/ash/ash.H index e9de1e74db5..f4bab78fdcc 100644 --- a/src/thermophysicalModels/solids/ash/ash.H +++ b/src/thermophysicalModels/solids/ash/ash.H @@ -43,6 +43,15 @@ SourceFiles namespace Foam { +class ash; + +Ostream& operator<< +( + Ostream&, + const ash& +); + + /*---------------------------------------------------------------------------*\ Class ash Declaration \*---------------------------------------------------------------------------*/ @@ -61,45 +70,24 @@ public: // Constructors //- Construct null - ash() - : -// rho Cp K Hf e -// [kg/m3] [J/(kg.K)] [W/(m.K)] [J/kg] [-] - solid(2010, 710, 0.04, 0.0, 1.0) // TODO - { - WarningIn("ash::ash()") - << "Properties of ash need to be checked!!!" - << endl; - } - - ash - ( - const solid& s - ) - : - solid(s) - {} + ash(); + + //- Construct from solid + ash(const solid& s); //- Construct from Istream - ash(Istream& is) - : - solid(is) - {} + ash(Istream& is); + + + // I-O //- Write the function coefficients - void writeData(Ostream& os) const - { - solid::writeData(os); - } + void writeData(Ostream& os) const; // Ostream Operator - friend Ostream& operator<<(Ostream& os, const ash& s) - { - s.writeData(os); - return os; - } + friend Ostream& operator<<(Ostream& os, const ash& s); }; diff --git a/src/thermophysicalModels/solids/solid/newSolid.C b/src/thermophysicalModels/solids/solid/newSolid.C new file mode 100644 index 00000000000..445a98a00d3 --- /dev/null +++ b/src/thermophysicalModels/solids/solid/newSolid.C @@ -0,0 +1,89 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "solid.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +Foam::autoPtr<Foam::solid> Foam::solid::New(Istream& is) +{ + if (debug) + { + Info<< "solid::New(Istream&): " + << "constructing solid" + << endl; + } + + word solidType(is); + + word coeffs(is); + + if (coeffs == "defaultCoeffs") + { + ConstructorTable::iterator cstrIter = + ConstructorTablePtr_->find(solidType); + + if (cstrIter == ConstructorTablePtr_->end()) + { + FatalErrorIn("solid::New(Istream&)") + << "Unknown solid type " << solidType << nl << nl + << "Valid solid types are:" << endl + << ConstructorTablePtr_->toc() + << exit(FatalError); + } + + return autoPtr<solid>(cstrIter()()); + } + else if (coeffs == "coeffs") + { + IstreamConstructorTable::iterator cstrIter = + IstreamConstructorTablePtr_->find(solidType); + + if (cstrIter == IstreamConstructorTablePtr_->end()) + { + FatalErrorIn("solid::New(Istream&)") + << "Unknown solid type " << solidType << nl << nl + << "Valid solid types are:" << endl + << IstreamConstructorTablePtr_->toc() + << exit(FatalError); + } + + return autoPtr<solid>(cstrIter()(is)); + } + else + { + FatalErrorIn("solid::New(Istream&)") + << "solid type " << solidType + << ", option " << coeffs << " given" + << ", should be coeffs or defaultCoeffs" + << exit(FatalError); + + return autoPtr<solid>(NULL); + } +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/thermophysicalModels/solids/solid/solid.C b/src/thermophysicalModels/solids/solid/solid.C index 02a0fdde466..8d617154651 100644 --- a/src/thermophysicalModels/solids/solid/solid.C +++ b/src/thermophysicalModels/solids/solid/solid.C @@ -39,61 +39,51 @@ defineRunTimeSelectionTable(solid, Istream); // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -autoPtr<solid> solid::New(Istream& is) +Foam::solid::solid +( + scalar rho, + scalar cp, + scalar K, + scalar Hf, + scalar emissivity +) +: + rho_(rho), + cp_(cp), + K_(K), + Hf_(Hf), + emissivity_(emissivity) +{} + + +Foam::solid::solid(Istream& is) +: + rho_(readScalar(is)), + cp_(readScalar(is)), + K_(readScalar(is)), + Hf_(readScalar(is)), + emissivity_(readScalar(is)) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::solid::writeData(Ostream& os) const { - if (debug) - { - Info<< "solid::New(Istream&): " - << "constructing solid" - << endl; - } - - word solidType(is); - - word coeffs(is); - - if (coeffs == "defaultCoeffs") - { - ConstructorTable::iterator cstrIter = - ConstructorTablePtr_->find(solidType); - - if (cstrIter == ConstructorTablePtr_->end()) - { - FatalErrorIn("solid::New(Istream&)") - << "Unknown solid type " << solidType << nl << nl - << "Valid solid types are :" << endl - << ConstructorTablePtr_->toc() - << exit(FatalError); - } - - return autoPtr<solid>(cstrIter()()); - } - else if (coeffs == "coeffs") - { - IstreamConstructorTable::iterator cstrIter = - IstreamConstructorTablePtr_->find(solidType); - - if (cstrIter == IstreamConstructorTablePtr_->end()) - { - FatalErrorIn("solid::New(Istream&)") - << "Unknown solid type " << solidType << nl << nl - << "Valid solid types are :" << endl - << IstreamConstructorTablePtr_->toc() - << exit(FatalError); - } - - return autoPtr<solid>(cstrIter()(is)); - } - else - { - FatalErrorIn("solid::New(Istream&)") - << "solid type " << solidType - << ", option " << coeffs << " given" - << ", should be coeffs or defaultCoeffs" - << exit(FatalError); - - return autoPtr<solid>(NULL); - } + os << rho_ << token::SPACE + << cp_ << token::SPACE + << K_ << token::SPACE + << Hf_ << token::SPACE + << emissivity_; +} + + +// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * // + +Foam::Ostream& operator<<(Ostream& os, const solid& s) +{ + s.writeData(os); + return os; } diff --git a/src/thermophysicalModels/solids/solid/solid.H b/src/thermophysicalModels/solids/solid/solid.H index 7ad30e79a28..3a7c8e27101 100644 --- a/src/thermophysicalModels/solids/solid/solid.H +++ b/src/thermophysicalModels/solids/solid/solid.H @@ -45,6 +45,15 @@ SourceFiles namespace Foam { +class solid; + +Ostream& operator<< +( + Ostream&, + const solid& +); + + /*---------------------------------------------------------------------------*\ Class solid Declaration \*---------------------------------------------------------------------------*/ @@ -107,24 +116,10 @@ public: scalar K, scalar Hf, scalar emissivity - ) - : - rho_(rho), - cp_(cp), - K_(K), - Hf_(Hf), - emissivity_(emissivity) - {} + ); //- Construct from Istream - solid(Istream& is) - : - rho_(readScalar(is)), - cp_(readScalar(is)), - K_(readScalar(is)), - Hf_(readScalar(is)), - emissivity_(readScalar(is)) - {} + solid(Istream& is); //- Return a pointer to a new solid created from input static autoPtr<solid> New(Istream& is); @@ -141,59 +136,37 @@ public: // Phisical constants which define the solid //- Density [kg/m3] - scalar rho() const - { - return rho_; - } + inline scalar rho() const; //- Specific heat capacity [J/(kg.K)] - scalar cp() const - { - return cp_; - } + inline scalar cp() const; //- Thermal conductivity [W/(m.K)] - scalar K() const - { - return K_; - } + inline scalar K() const; //- Heat of formation [J/kg] - scalar Hf() const - { - return Hf_; - } + inline scalar Hf() const; - //- emissivity - scalar emissivity() const - { - return emissivity_; - } + //- Emissivity [] + inline scalar emissivity() const; // I-O //- Write the solid properties - virtual void writeData(Ostream& os) const - { - os<< rho_ << token::SPACE - << cp_ << token::SPACE - << K_ << token::SPACE - << Hf_ << token::SPACE - << emissivity_; - } + virtual void writeData(Ostream& os) const; // Ostream Operator - friend Ostream& operator<<(Ostream& os, const solid& s) - { - s.writeData(os); - return os; - } + friend Ostream& operator<<(Ostream& os, const solid& s); }; +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "solidI.H" + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/thermophysicalModels/solids/Cs/Cs.C b/src/thermophysicalModels/solids/solid/solidI.H similarity index 78% rename from src/thermophysicalModels/solids/Cs/Cs.C rename to src/thermophysicalModels/solids/solid/solidI.H index 5b15f122744..1921b1da3c2 100644 --- a/src/thermophysicalModels/solids/Cs/Cs.C +++ b/src/thermophysicalModels/solids/solid/solidI.H @@ -24,22 +24,36 @@ License \*---------------------------------------------------------------------------*/ -#include "Cs.H" -#include "addToRunTimeSelectionTable.H" - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -namespace Foam +inline Foam::scalar Foam::solid::rho() const { + return rho_; +} -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Cs, 0); -addToRunTimeSelectionTable(solid, Cs,); -addToRunTimeSelectionTable(solid, Cs, Istream); +inline Foam::scalar Foam::solid::cp() const +{ + return cp_; +} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace Foam +inline Foam::scalar Foam::solid::K() const +{ + return K_; +} + + +inline Foam::scalar Foam::solid::Hf() const +{ + return Hf_; +} + + +inline Foam::scalar Foam::solid::emissivity() const +{ + return emissivity_; +} + // ************************************************************************* // -- GitLab