liquidProperties: Added support for multiple entries is mixture each of specified type

If the optional "type" entry is provided for the liquid specie that type is
looked-up rather than the entry name, e.g.

mixture
{
    H2O
    {
        type    liquid;

        W       18.015;
        Tc      647.13;
        Pc      2.2055e+7;
        Vc      0.05595;
        Zc      0.229;
        Tt      273.16;
        Pt      6.113e+2;
        Tb      373.15;
        dipm    6.1709e-30;
        omega   0.3449;
        delta   4.7813e+4;

        rho
        {
            type    NSRDSfunc5;
            a       98.343885;
            b       0.30542;
            c       647.13;
            d       0.081;
        }
        .
        .
        .
    }

    ethanol
    {
        type    liquid;

        W       46.07;
        .
        .
        .
    }
}
This commit is contained in:
Henry Weller
2019-11-25 14:43:22 +00:00
parent 375e1f7c63
commit e1daa5391f

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -24,8 +24,6 @@ License
\*---------------------------------------------------------------------------*/
#include "liquidProperties.H"
#include "HashTable.H"
#include "Switch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -121,57 +119,24 @@ Foam::autoPtr<Foam::liquidProperties> Foam::liquidProperties::New
InfoInFunction << "Constructing liquidProperties" << endl;
}
const word& liquidPropertiesTypeName = dict.dictName();
// If the type is not specified use the entry name as the liquid type name
const word& liquidPropertiesTypeName =
dict.found("type") ? dict.lookup("type") : dict.dictName();
if (dict.found("defaultCoeffs"))
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(liquidPropertiesTypeName);
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
// Backward-compatibility
if (Switch(dict.lookup("defaultCoeffs")))
{
return New(liquidPropertiesTypeName);
}
else
{
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(liquidPropertiesTypeName);
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
FatalErrorInFunction
<< "Unknown liquidProperties type "
<< liquidPropertiesTypeName << nl << nl
<< "Valid liquidProperties types are:" << nl
<< dictionaryConstructorTablePtr_->sortedToc()
<< exit(FatalError);
}
return autoPtr<liquidProperties>
(
cstrIter()
(
dict.optionalSubDict(liquidPropertiesTypeName + "Coeffs")
)
);
}
FatalErrorInFunction
<< "Unknown liquidProperties type "
<< liquidPropertiesTypeName << nl << nl
<< "Valid liquidProperties types are:" << nl
<< dictionaryConstructorTablePtr_->sortedToc()
<< exit(FatalError);
}
else
{
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(liquidPropertiesTypeName);
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
FatalErrorInFunction
<< "Unknown liquidProperties type "
<< liquidPropertiesTypeName << nl << nl
<< "Valid liquidProperties types are:" << nl
<< dictionaryConstructorTablePtr_->sortedToc()
<< exit(FatalError);
}
return autoPtr<liquidProperties>(cstrIter()(dict));
}
return autoPtr<liquidProperties>(cstrIter()(dict));
}