tidy-up and added CaCO3 - put solids in their own namespace?

This commit is contained in:
andy
2009-03-06 15:53:58 +00:00
parent 0e2b526cfd
commit 0505dbee3e
15 changed files with 541 additions and 182 deletions

View File

@ -268,7 +268,7 @@ void Foam::KinematicParcel<ParcelType>::transformProperties
} }
// * * * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * // // * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * //
#include "KinematicParcelIO.C" #include "KinematicParcelIO.C"

View File

@ -385,7 +385,7 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calcSurfaceReactions
} }
// * * * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * // // * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * //
#include "ReactingMultiphaseParcelIO.C" #include "ReactingMultiphaseParcelIO.C"

View File

@ -236,7 +236,7 @@ Foam::scalar Foam::ReactingParcel<ParcelType>::calcPhaseChange
} }
// * * * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * // // * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * //
#include "ReactingParcelIO.C" #include "ReactingParcelIO.C"

View File

@ -174,7 +174,7 @@ Foam::scalar Foam::ThermoParcel<ParcelType>::calcHeatTransfer
} }
// * * * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * // // * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * //
#include "ThermoParcelIO.C" #include "ThermoParcelIO.C"

View File

@ -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
// ************************************************************************* //

View File

@ -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
// ************************************************************************* //

View File

@ -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
// ************************************************************************* //

View File

@ -23,18 +23,18 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class Class
Foam::Cs Foam::CaCO3
Description Description
Graphite Calcium carbonate (limestone)
SourceFiles SourceFiles
Cs.C CaCO3.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef solid_Cs_H #ifndef solid_CaCO3_H
#define solid_Cs_H #define solid_CaCO3_H
#include "solid.H" #include "solid.H"
@ -43,11 +43,20 @@ SourceFiles
namespace Foam namespace Foam
{ {
class CaCO3;
Ostream& operator<<
(
Ostream&,
const CaCO3&
);
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class Cs Declaration Class CaCO3 Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class Cs class CaCO3
: :
public solid public solid
{ {
@ -55,50 +64,30 @@ class Cs
public: public:
//- Runtime type information //- Runtime type information
TypeName("Cs"); TypeName("CaCO3");
// Constructors // Constructors
//- Construct null //- Construct null
Cs() CaCO3();
:
solid(2010, 710, 0.04, 0.0, 1.0)
{
WarningIn("Cs::Cs()")
<< "Properties of graphite need to be checked!!!"
<< endl;
}
//- Construct from solid //- Construct from solid
Cs CaCO3(const solid& s);
(
const solid& s
)
:
solid(s)
{}
//- Construct from Istream //- Construct from Istream
Cs(Istream& is) CaCO3(Istream& is);
:
solid(is)
{} // I-O
//- Write the function coefficients //- Write the function coefficients
void writeData(Ostream& os) const void writeData(Ostream& os) const;
{
solid::writeData(os);
}
// Ostream Operator // Ostream Operator
friend Ostream& operator<<(Ostream& os, const Cs& s) friend Ostream& operator<<(Ostream& os, const CaCO3& s);
{
s.writeData(os);
return os;
}
}; };

View File

@ -1,5 +1,8 @@
solid/solid.C solid/solid.C
solid/newSolid.C
ash/ash.C ash/ash.C
Cs/Cs.C C/C.C
CaCO3/CaCO3.C
LIB = $(FOAM_LIBBIN)/libsolids LIB = $(FOAM_LIBBIN)/libsolids

View File

@ -38,6 +38,47 @@ defineTypeNameAndDebug(ash, 0);
addToRunTimeSelectionTable(solid, ash,); addToRunTimeSelectionTable(solid, ash,);
addToRunTimeSelectionTable(solid, ash, Istream); 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 } // End namespace Foam

View File

@ -43,6 +43,15 @@ SourceFiles
namespace Foam namespace Foam
{ {
class ash;
Ostream& operator<<
(
Ostream&,
const ash&
);
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class ash Declaration Class ash Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -61,45 +70,24 @@ public:
// Constructors // Constructors
//- Construct null //- Construct null
ash() 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 //- Construct from solid
( ash(const solid& s);
const solid& s
)
:
solid(s)
{}
//- Construct from Istream //- Construct from Istream
ash(Istream& is) ash(Istream& is);
:
solid(is)
{} // I-O
//- Write the function coefficients //- Write the function coefficients
void writeData(Ostream& os) const void writeData(Ostream& os) const;
{
solid::writeData(os);
}
// Ostream Operator // Ostream Operator
friend Ostream& operator<<(Ostream& os, const ash& s) friend Ostream& operator<<(Ostream& os, const ash& s);
{
s.writeData(os);
return os;
}
}; };

View File

@ -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);
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -39,61 +39,51 @@ defineRunTimeSelectionTable(solid, Istream);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * 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) os << rho_ << token::SPACE
{ << cp_ << token::SPACE
Info<< "solid::New(Istream&): " << K_ << token::SPACE
<< "constructing solid" << Hf_ << token::SPACE
<< endl; << emissivity_;
} }
word solidType(is);
word coeffs(is); // * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * //
if (coeffs == "defaultCoeffs") Foam::Ostream& operator<<(Ostream& os, const solid& s)
{ {
ConstructorTable::iterator cstrIter = s.writeData(os);
ConstructorTablePtr_->find(solidType); return os;
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);
}
} }

View File

@ -45,6 +45,15 @@ SourceFiles
namespace Foam namespace Foam
{ {
class solid;
Ostream& operator<<
(
Ostream&,
const solid&
);
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class solid Declaration Class solid Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -107,24 +116,10 @@ public:
scalar K, scalar K,
scalar Hf, scalar Hf,
scalar emissivity scalar emissivity
) );
:
rho_(rho),
cp_(cp),
K_(K),
Hf_(Hf),
emissivity_(emissivity)
{}
//- Construct from Istream //- Construct from Istream
solid(Istream& is) solid(Istream& is);
:
rho_(readScalar(is)),
cp_(readScalar(is)),
K_(readScalar(is)),
Hf_(readScalar(is)),
emissivity_(readScalar(is))
{}
//- Return a pointer to a new solid created from input //- Return a pointer to a new solid created from input
static autoPtr<solid> New(Istream& is); static autoPtr<solid> New(Istream& is);
@ -141,59 +136,37 @@ public:
// Phisical constants which define the solid // Phisical constants which define the solid
//- Density [kg/m3] //- Density [kg/m3]
scalar rho() const inline scalar rho() const;
{
return rho_;
}
//- Specific heat capacity [J/(kg.K)] //- Specific heat capacity [J/(kg.K)]
scalar cp() const inline scalar cp() const;
{
return cp_;
}
//- Thermal conductivity [W/(m.K)] //- Thermal conductivity [W/(m.K)]
scalar K() const inline scalar K() const;
{
return K_;
}
//- Heat of formation [J/kg] //- Heat of formation [J/kg]
scalar Hf() const inline scalar Hf() const;
{
return Hf_;
}
//- emissivity //- Emissivity []
scalar emissivity() const inline scalar emissivity() const;
{
return emissivity_;
}
// I-O // I-O
//- Write the solid properties //- Write the solid properties
virtual void writeData(Ostream& os) const virtual void writeData(Ostream& os) const;
{
os<< rho_ << token::SPACE
<< cp_ << token::SPACE
<< K_ << token::SPACE
<< Hf_ << token::SPACE
<< emissivity_;
}
// Ostream Operator // Ostream Operator
friend Ostream& operator<<(Ostream& os, const solid& s) friend Ostream& operator<<(Ostream& os, const solid& s);
{
s.writeData(os);
return os;
}
}; };
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "solidI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam } // End namespace Foam

View File

@ -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); inline Foam::scalar Foam::solid::cp() const
addToRunTimeSelectionTable(solid, Cs,); {
addToRunTimeSelectionTable(solid, Cs, Istream); 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_;
}
// ************************************************************************* // // ************************************************************************* //