Commit a6fd99b8 authored by Henry Weller's avatar Henry Weller
Browse files

liquidProperties: simplified and generalized the IO

When liquids are constructed from dictionary the coefficients are now first
initialized to their standard values and overridden by the now optional entries
provided in the dictionary.  For example to specify water with all the standard
temperature varying properties but override only the density with a constant
value of 1000 specify in thermophysicalProperties

liquids
{
    H2O
    {
        defaultCoeffs   no;

        H2OCoeffs
        {
            rho
            {
                a 1000;
                b 0;
                c 0;
                d 0;
            }
        }
    }
}
parent ba9d58a2
......@@ -121,21 +121,27 @@ Foam::Ar::Ar
Foam::Ar::Ar(const dictionary& dict)
:
liquidProperties(dict),
rho_(dict.subDict("rho")),
pv_(dict.subDict("pv")),
hl_(dict.subDict("hl")),
Cp_(dict.subDict("Cp")),
h_(dict.subDict("h")),
Cpg_(dict.subDict("Cpg")),
B_(dict.subDict("B")),
mu_(dict.subDict("mu")),
mug_(dict.subDict("mug")),
kappa_(dict.subDict("K")),
kappag_(dict.subDict("kappag")),
sigma_(dict.subDict("sigma")),
D_(dict.subDict("D"))
{}
Ar()
{
readIfPresent(*this, dict);
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::Ar::writeData(Ostream& os) const
{
liquidProperties::writeData(*this, os);
}
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<(Ostream& os, const Ar& l)
{
l.writeData(os);
return os;
}
// ************************************************************************* //
......@@ -79,6 +79,8 @@ class Ar
public:
friend class liquidProperties;
//- Runtime type information
TypeName("Ar");
......@@ -165,33 +167,16 @@ public:
// I-O
//- Write the function coefficients
void writeData(Ostream& os) const
{
liquidProperties::writeData(os); os << nl;
rho_.writeData(os); os << nl;
pv_.writeData(os); os << nl;
hl_.writeData(os); os << nl;
Cp_.writeData(os); os << nl;
h_.writeData(os); os << nl;
Cpg_.writeData(os); os << nl;
B_.writeData(os); os << nl;
mu_.writeData(os); os << nl;
mug_.writeData(os); os << nl;
kappa_.writeData(os); os << nl;
kappag_.writeData(os); os << nl;
sigma_.writeData(os); os << nl;
D_.writeData(os); os << endl;
}
void writeData(Ostream& os) const;
//- Ostream Operator
friend Ostream& operator<<(Ostream& os, const Ar& l)
{
l.writeData(os);
return os;
}
friend Ostream& operator<<(Ostream& os, const Ar& l);
};
Ostream& operator<<(Ostream& os, const Ar& l);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
......
......@@ -129,21 +129,27 @@ Foam::C10H22::C10H22
Foam::C10H22::C10H22(const dictionary& dict)
:
liquidProperties(dict),
rho_(dict.subDict("rho")),
pv_(dict.subDict("pv")),
hl_(dict.subDict("hl")),
Cp_(dict.subDict("Cp")),
h_(dict.subDict("h")),
Cpg_(dict.subDict("Cpg")),
B_(dict.subDict("B")),
mu_(dict.subDict("mu")),
mug_(dict.subDict("mug")),
kappa_(dict.subDict("K")),
kappag_(dict.subDict("kappag")),
sigma_(dict.subDict("sigma")),
D_(dict.subDict("D"))
{}
C10H22()
{
readIfPresent(*this, dict);
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::C10H22::writeData(Ostream& os) const
{
liquidProperties::writeData(*this, os);
}
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<(Ostream& os, const C10H22& l)
{
l.writeData(os);
return os;
}
// ************************************************************************* //
......@@ -79,6 +79,8 @@ class C10H22
public:
friend class liquidProperties;
//- Runtime type information
TypeName("C10H22");
......@@ -165,34 +167,16 @@ public:
// I-O
//- Write the function coefficients
void writeData(Ostream& os) const
{
liquidProperties::writeData(os); os << nl;
rho_.writeData(os); os << nl;
pv_.writeData(os); os << nl;
hl_.writeData(os); os << nl;
Cp_.writeData(os); os << nl;
h_.writeData(os); os << nl;
Cpg_.writeData(os); os << nl;
B_.writeData(os); os << nl;
mu_.writeData(os); os << nl;
mug_.writeData(os); os << nl;
kappa_.writeData(os); os << nl;
kappag_.writeData(os); os << nl;
sigma_.writeData(os); os << nl;
D_.writeData(os); os << endl;
}
void writeData(Ostream& os) const;
//- Ostream Operator
friend Ostream& operator<<(Ostream& os, const C10H22& l)
{
l.writeData(os);
return os;
}
friend Ostream& operator<<(Ostream& os, const C10H22& l);
};
Ostream& operator<<(Ostream& os, const C10H22& l);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
......
......@@ -121,21 +121,27 @@ Foam::C12H26::C12H26
Foam::C12H26::C12H26(const dictionary& dict)
:
liquidProperties(dict),
rho_(dict.subDict("rho")),
pv_(dict.subDict("pv")),
hl_(dict.subDict("hl")),
Cp_(dict.subDict("Cp")),
h_(dict.subDict("h")),
Cpg_(dict.subDict("Cpg")),
B_(dict.subDict("B")),
mu_(dict.subDict("mu")),
mug_(dict.subDict("mug")),
kappa_(dict.subDict("K")),
kappag_(dict.subDict("kappag")),
sigma_(dict.subDict("sigma")),
D_(dict.subDict("D"))
{}
C12H26()
{
readIfPresent(*this, dict);
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::C12H26::writeData(Ostream& os) const
{
liquidProperties::writeData(*this, os);
}
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<(Ostream& os, const C12H26& l)
{
l.writeData(os);
return os;
}
// ************************************************************************* //
......@@ -79,6 +79,8 @@ class C12H26
public:
friend class liquidProperties;
//- Runtime type information
TypeName("C12H26");
......@@ -165,33 +167,16 @@ public:
// I-O
//- Write the function coefficients
void writeData(Ostream& os) const
{
liquidProperties::writeData(os); os << nl;
rho_.writeData(os); os << nl;
pv_.writeData(os); os << nl;
hl_.writeData(os); os << nl;
Cp_.writeData(os); os << nl;
h_.writeData(os); os << nl;
Cpg_.writeData(os); os << nl;
B_.writeData(os); os << nl;
mu_.writeData(os); os << nl;
mug_.writeData(os); os << nl;
kappa_.writeData(os); os << nl;
kappag_.writeData(os); os << nl;
sigma_.writeData(os); os << nl;
D_.writeData(os); os << endl;
}
void writeData(Ostream& os) const;
//- Ostream Operator
friend Ostream& operator<<(Ostream& os, const C12H26& l)
{
l.writeData(os);
return os;
}
friend Ostream& operator<<(Ostream& os, const C12H26& l);
};
Ostream& operator<<(Ostream& os, const C12H26& l);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
......
......@@ -129,21 +129,27 @@ Foam::C13H28::C13H28
Foam::C13H28::C13H28(const dictionary& dict)
:
liquidProperties(dict),
rho_(dict.subDict("rho")),
pv_(dict.subDict("pv")),
hl_(dict.subDict("hl")),
Cp_(dict.subDict("Cp")),
h_(dict.subDict("h")),
Cpg_(dict.subDict("Cpg")),
B_(dict.subDict("B")),
mu_(dict.subDict("mu")),
mug_(dict.subDict("mug")),
kappa_(dict.subDict("K")),
kappag_(dict.subDict("kappag")),
sigma_(dict.subDict("sigma")),
D_(dict.subDict("D"))
{}
C13H28()
{
readIfPresent(*this, dict);
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::C13H28::writeData(Ostream& os) const
{
liquidProperties::writeData(*this, os);
}
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<(Ostream& os, const C13H28& l)
{
l.writeData(os);
return os;
}
// ************************************************************************* //
......@@ -79,6 +79,8 @@ class C13H28
public:
friend class liquidProperties;
//- Runtime type information
TypeName("C13H28");
......@@ -165,33 +167,16 @@ public:
// I-O
//- Write the function coefficients
void writeData(Ostream& os) const
{
liquidProperties::writeData(os); os << nl;
rho_.writeData(os); os << nl;
pv_.writeData(os); os << nl;
hl_.writeData(os); os << nl;
Cp_.writeData(os); os << nl;
h_.writeData(os); os << nl;
Cpg_.writeData(os); os << nl;
B_.writeData(os); os << nl;
mu_.writeData(os); os << nl;
mug_.writeData(os); os << nl;
kappa_.writeData(os); os << nl;
kappag_.writeData(os); os << nl;
sigma_.writeData(os); os << nl;
D_.writeData(os); os << endl;
}
void writeData(Ostream& os) const;
//- Ostream Operator
friend Ostream& operator<<(Ostream& os, const C13H28& l)
{
l.writeData(os);
return os;
}
friend Ostream& operator<<(Ostream& os, const C13H28& l);
};
Ostream& operator<<(Ostream& os, const C13H28& l);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
......
......@@ -129,21 +129,27 @@ Foam::C14H30::C14H30
Foam::C14H30::C14H30(const dictionary& dict)
:
liquidProperties(dict),
rho_(dict.subDict("rho")),
pv_(dict.subDict("pv")),
hl_(dict.subDict("hl")),
Cp_(dict.subDict("Cp")),
h_(dict.subDict("h")),
Cpg_(dict.subDict("Cpg")),
B_(dict.subDict("B")),
mu_(dict.subDict("mu")),
mug_(dict.subDict("mug")),
kappa_(dict.subDict("K")),
kappag_(dict.subDict("kappag")),
sigma_(dict.subDict("sigma")),
D_(dict.subDict("D"))
{}
C14H30()
{
readIfPresent(*this, dict);
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::C14H30::writeData(Ostream& os) const
{
liquidProperties::writeData(*this, os);
}
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<(Ostream& os, const C14H30& l)
{
l.writeData(os);
return os;
}
// ************************************************************************* //
......@@ -79,6 +79,8 @@ class C14H30
public:
friend class liquidProperties;
//- Runtime type information
TypeName("C14H30");
......@@ -165,33 +167,16 @@ public:
// I-O
//- Write the function coefficients
void writeData(Ostream& os) const
{
liquidProperties::writeData(os); os << nl;
rho_.writeData(os); os << nl;
pv_.writeData(os); os << nl;
hl_.writeData(os); os << nl;
Cp_.writeData(os); os << nl;
h_.writeData(os); os << nl;
Cpg_.writeData(os); os << nl;
B_.writeData(os); os << nl;
mu_.writeData(os); os << nl;
mug_.writeData(os); os << nl;
kappa_.writeData(os); os << nl;
kappag_.writeData(os); os << nl;
sigma_.writeData(os); os << nl;
D_.writeData(os); os << endl;
}
void writeData(Ostream& os) const;
//- Ostream Operator
friend Ostream& operator<<(Ostream& os, const C14H30& l)
{
l.writeData(os);
return os;
}
friend Ostream& operator<<(Ostream& os, const C14H30& l);
};
Ostream& operator<<(Ostream& os, const C14H30& l);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
......
......@@ -129,21 +129,27 @@ Foam::C16H34::C16H34
Foam::C16H34::C16H34(const dictionary& dict)
:
liquidProperties(dict),
rho_(dict.subDict("rho")),
pv_(dict.subDict("pv")),
hl_(dict.subDict("hl")),
Cp_(dict.subDict("Cp")),
h_(dict.subDict("h")),
Cpg_(dict.subDict("Cpg")),
B_(dict.subDict("B")),
mu_(dict.subDict("mu")),
mug_(dict.subDict("mug")),
kappa_(dict.subDict("K")),
kappag_(dict.subDict("kappag")),
sigma_(dict.subDict("sigma")),
D_(dict.subDict("D"))
{}
C16H34()
{
readIfPresent(*this, dict);
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::C16H34::writeData(Ostream& os) const
{
liquidProperties::writeData(*this, os);
}
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<(Ostream& os, const C16H34& l)
{
l.writeData(os);
return os;
}
// ************************************************************************* //
......@@ -79,6 +79,8 @@ class C16H34
public:
friend class liquidProperties;
//- Runtime type information
TypeName("C16H34");
......@@ -165,33 +167,16 @@ public:
// I-O
//- Write the function coefficients
void writeData(Ostream& os) const
{
liquidProperties::writeData(os); os << nl;
rho_.writeData(os); os << nl;
pv_.writeData(os); os << nl;
hl_.writeData(os); os << nl;
Cp_.writeData(os); os << nl;
h_.writeData(os); os << nl;
Cpg_.writeData(os); os << nl;
B_.writeData(os); os << nl;
mu_.writeData(os); os << nl;
mug_.writeData(os); os << nl;
kappa_.writeData(os); os << nl;
kappag_.writeData(os); os << nl;
sigma_.writeData(os); os << nl;
D_.writeData(os); os << endl;
}
void writeData(Ostream& os) const;
//- Ostream Operator
friend Ostream& operator<<(Ostream& os, const C16H34& l)
{
l.writeData(os);
return os;
}
friend Ostream& operator<<(Ostream& os, const C16H34& l);
};
Ostream& operator<<(Ostream& os, const C16H34& l);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
......
......@@ -129,21 +129,27 @@ Foam::C2H5OH::C2H5OH
Foam::C2H5OH::C2H5OH(const dictionary& dict)
:
liquidProperties(dict),
rho_(dict.subDict("rho")),
pv_(dict.subDict("pv")),
hl_(dict.subDict("hl")),
Cp_(dict.subDict("Cp")),
h_(dict.subDict("h")),
Cpg_(dict.subDict("Cpg")),
B_(dict.subDict("B")),
mu_(dict.subDict("mu")),
mug_(dict.subDict("mug")),
kappa_(dict.subDict("K")),
kappag_(dict.subDict("kappag")),
sigma_(dict.subDict("sigma")),
D_(dict.subDict("D"))
{}
C2H5OH()
{
readIfPresent(*this, dict);
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //