Skip to content
Snippets Groups Projects
Commit e251b7b6 authored by Mark Olesen's avatar Mark Olesen
Browse files

STYLE: allow "solidProperties" dict entry for consistency with liquidMixture

- add size() method to liquidMixture and solidMixture
parent 3fd25abb
Branches
Tags
No related merge requests found
......@@ -31,6 +31,7 @@ License
const Foam::scalar Foam::liquidMixture::TrMax = 0.999;
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::liquidMixture::liquidMixture
......@@ -41,32 +42,26 @@ Foam::liquidMixture::liquidMixture
components_(thermophysicalProperties.lookup("liquidComponents")),
properties_(components_.size())
{
// use sub-dictionary "liquidProperties" if possible to avoid
// can use sub-dictionary "liquidProperties" to avoid
// collisions with identically named gas-phase entries
// (eg, H2O liquid vs. gas)
const dictionary* subDictPtr = thermophysicalProperties.subDictPtr
(
"liquidProperties"
);
const dictionary& props =
(
subDictPtr ? *subDictPtr : thermophysicalProperties
);
forAll(components_, i)
{
const dictionary* subDictPtr = thermophysicalProperties.subDictPtr
properties_.set
(
"liquidProperties"
i,
liquid::New(props.lookup(components_[i]))
);
if (subDictPtr)
{
properties_.set
(
i,
liquid::New(subDictPtr->lookup(components_[i]))
);
}
else
{
properties_.set
(
i,
liquid::New(thermophysicalProperties.lookup(components_[i]))
);
}
}
}
......
......@@ -103,7 +103,7 @@ class liquidMixture
{
// Private data
// maximum reduced temperature
//- Maximum reduced temperature
static const scalar TrMax;
//- The names of the liquids
......@@ -130,6 +130,7 @@ public:
// Member Functions
//- Return the liquid names
inline const List<word>& components() const
{
return components_;
......@@ -141,6 +142,13 @@ public:
return properties_;
}
//- Return the number of liquids in the mixture
inline label size() const
{
return components_.size();
}
//- Calculate the critical temperature of mixture
scalar Tc(const scalarField& x) const;
......
......@@ -35,13 +35,24 @@ Foam::solidMixture::solidMixture
components_(thermophysicalProperties.lookup("solidComponents")),
properties_(components_.size())
{
// can use sub-dictionary "solidProperties" to avoid
// collisions with identically named gas-phase entries
const dictionary* subDictPtr = thermophysicalProperties.subDictPtr
(
"solidProperties"
);
const dictionary& props =
(
subDictPtr ? *subDictPtr : thermophysicalProperties
);
forAll(components_, i)
{
properties_.set
(
i,
solid::New(thermophysicalProperties.lookup(components_[i]))
solid::New(props.lookup(components_[i]))
);
}
}
......@@ -82,12 +93,12 @@ Foam::scalar Foam::solidMixture::rho
const scalarField& X
) const
{
scalar tmp = 0.0;
scalar val = 0.0;
forAll(properties_, i)
{
tmp += properties_[i].rho()*X[i];
val += properties_[i].rho()*X[i];
}
return tmp;
return val;
}
......@@ -96,12 +107,12 @@ Foam::scalar Foam::solidMixture::cp
const scalarField& Y
) const
{
scalar tmp = 0.0;
scalar val = 0.0;
forAll(properties_, i)
{
tmp += properties_[i].cp()*Y[i];
val += properties_[i].cp()*Y[i];
}
return tmp;
return val;
}
......
......@@ -25,7 +25,18 @@ Class
Foam::solidMixture
Description
Foam::solidMixture
A mixture of solids.
Note
The dictionary constructor searches for the entry @c solidComponents,
which is a wordList. The solid properties of each component can either
be contained within a @c solidProperties sub-dictionary or (for legacy
purposes) can be found directly in the dictionary.
The @c solidProperties sub-dictionary entry should be used when possible
to avoid conflicts with identically named gas-phase entries.
SeeAlso
Foam::liquidMixture
\*---------------------------------------------------------------------------*/
......@@ -74,7 +85,7 @@ public:
// Member Functions
//- Return the sold names
//- Return the solid names
inline const List<word>& components() const
{
return components_;
......@@ -86,6 +97,13 @@ public:
return properties_;
}
//- Return the number of solids in the mixture
inline label size() const
{
return components_.size();
}
//- Returns the mass fractions, given mole fractions
scalarField Y(const scalarField& X) const;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment