liquidProperties: Simplified dictionary format

The defaultCoeffs entry is now redundant and supported only for backward
compatibility.  To specify a liquid with default coefficients simply leave the
coefficients dictionary empty:

    liquids
    {
        H2O {}
    }

Any or all of the coefficients may be overridden by specifying the properties in
the coefficients dictionary, e.g.

    liquids
    {
        H2O
        {
            rho
            {
                a 1000;
                b 0;
                c 0;
                d 0;
            }
        }
    }
This commit is contained in:
Henry Weller 2017-02-17 22:08:42 +00:00
parent a6fd99b874
commit 9b4f327e2b
14 changed files with 82 additions and 117 deletions

View File

@ -97,24 +97,49 @@ Foam::autoPtr<Foam::liquidProperties> Foam::liquidProperties::New
const word& liquidPropertiesTypeName = dict.dictName();
const Switch defaultCoeffs(dict.lookup("defaultCoeffs"));
if (defaultCoeffs)
if (dict.found("defaultCoeffs"))
{
ConstructorTable::iterator cstrIter =
ConstructorTablePtr_->find(liquidPropertiesTypeName);
// Backward-compatibility
if (cstrIter == ConstructorTablePtr_->end())
const Switch defaultCoeffs(dict.lookup("defaultCoeffs"));
if (defaultCoeffs)
{
FatalErrorInFunction
<< "Unknown liquidProperties type "
<< liquidPropertiesTypeName << nl << nl
<< "Valid liquidProperties types are:" << nl
<< ConstructorTablePtr_->sortedToc()
<< abort(FatalError);
}
ConstructorTable::iterator cstrIter =
ConstructorTablePtr_->find(liquidPropertiesTypeName);
return autoPtr<liquidProperties>(cstrIter()());
if (cstrIter == ConstructorTablePtr_->end())
{
FatalErrorInFunction
<< "Unknown liquidProperties type "
<< liquidPropertiesTypeName << nl << nl
<< "Valid liquidProperties types are:" << nl
<< ConstructorTablePtr_->sortedToc()
<< abort(FatalError);
}
return autoPtr<liquidProperties>(cstrIter()());
}
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()
<< abort(FatalError);
}
return autoPtr<liquidProperties>
(
cstrIter()(dict.subDict(liquidPropertiesTypeName + "Coeffs"))
);
}
}
else
{
@ -131,10 +156,7 @@ Foam::autoPtr<Foam::liquidProperties> Foam::liquidProperties::New
<< abort(FatalError);
}
return autoPtr<liquidProperties>
(
cstrIter()(dict.subDict(liquidPropertiesTypeName + "Coeffs"))
);
return autoPtr<liquidProperties>(cstrIter()(dict));
}
}
@ -144,91 +166,91 @@ Foam::autoPtr<Foam::liquidProperties> Foam::liquidProperties::New
Foam::scalar Foam::liquidProperties::rho(scalar p, scalar T) const
{
NotImplemented;
return 0.0;
return 0;
}
Foam::scalar Foam::liquidProperties::pv(scalar p, scalar T) const
{
NotImplemented;
return 0.0;
return 0;
}
Foam::scalar Foam::liquidProperties::hl(scalar p, scalar T) const
{
NotImplemented;
return 0.0;
return 0;
}
Foam::scalar Foam::liquidProperties::Cp(scalar p, scalar T) const
{
NotImplemented;
return 0.0;
return 0;
}
Foam::scalar Foam::liquidProperties::h(scalar p, scalar T) const
{
NotImplemented;
return 0.0;
return 0;
}
Foam::scalar Foam::liquidProperties::Cpg(scalar p, scalar T) const
{
NotImplemented;
return 0.0;
return 0;
}
Foam::scalar Foam::liquidProperties::mu(scalar p, scalar T) const
{
NotImplemented;
return 0.0;
return 0;
}
Foam::scalar Foam::liquidProperties::mug(scalar p, scalar T) const
{
NotImplemented;
return 0.0;
return 0;
}
Foam::scalar Foam::liquidProperties::kappa(scalar p, scalar T) const
{
NotImplemented;
return 0.0;
return 0;
}
Foam::scalar Foam::liquidProperties::kappag(scalar p, scalar T) const
{
NotImplemented;
return 0.0;
return 0;
}
Foam::scalar Foam::liquidProperties::sigma(scalar p, scalar T) const
{
NotImplemented;
return 0.0;
return 0;
}
Foam::scalar Foam::liquidProperties::D(scalar p, scalar T) const
{
NotImplemented;
return 0.0;
return 0;
}
Foam::scalar Foam::liquidProperties::D(scalar p, scalar T, scalar Wb) const
{
NotImplemented;
return 0.0;
return 0;
}
@ -259,7 +281,7 @@ Foam::scalar Foam::liquidProperties::pvInvert(scalar p) const
while ((Thi - Tlo) > 1.0e-4)
{
if ((pv(p, T) - p) <= 0.0)
if ((pv(p, T) - p) <= 0)
{
Tlo = T;
}

View File

@ -39,9 +39,8 @@ Foam::autoPtr<Foam::solidProperties> Foam::solidProperties::New
}
const word solidType(dict.dictName());
const Switch defaultCoeffs(dict.lookup("defaultCoeffs"));
if (defaultCoeffs)
if (!dict.found("defaultCoeffs") || Switch(dict.lookup("defaultCoeffs")))
{
ConstructorTable::iterator cstrIter =
ConstructorTablePtr_->find(solidType);

View File

@ -36,13 +36,10 @@ foamChemistryFile "$FOAM_CASE/constant/reactions";
foamChemistryThermoFile "$FOAM_CASE/constant/thermo.compressibleGas";
liquids
{
H2O
{
defaultCoeffs yes;
}
{}
}
solids

View File

@ -36,10 +36,7 @@ inertSpecie N2;
liquids
{
H2O
{
defaultCoeffs yes;
}
H2O {}
}
solids
@ -47,7 +44,7 @@ solids
C
{
defaultCoeffs no;
// if defaultCoeffs no properties should be :
CCoeffs
{
rho 2010;
@ -57,10 +54,8 @@ solids
emissivity 1.0;
}
}
ash
{
defaultCoeffs yes;
}
ash {}
}

View File

@ -36,16 +36,11 @@ inertSpecie N2;
liquids
{
H2O
{
defaultCoeffs yes;
}
H2O {}
}
solids
{
// none
}
{}
// ************************************************************************* //

View File

@ -36,16 +36,11 @@ inertSpecie N2;
liquids
{
H2O
{
defaultCoeffs yes;
}
H2O {}
}
solids
{
// none
}
{}
// ************************************************************************* //

View File

@ -36,16 +36,11 @@ inertSpecie N2;
liquids
{
H2O
{
defaultCoeffs yes;
}
H2O {}
}
solids
{
// none
}
{}
// ************************************************************************* //

View File

@ -36,16 +36,11 @@ inertSpecie N2;
liquids
{
H2O
{
defaultCoeffs yes;
}
H2O {}
}
solids
{
// none
}
{}
// ************************************************************************* //

View File

@ -36,16 +36,11 @@ foamChemistryThermoFile "$FOAM_CASE/constant/thermo.incompressiblePoly";
liquids
{
H2O
{
defaultCoeffs yes;
}
H2O {}
}
solids
{
// none
}
{}
inertSpecie N2;

View File

@ -38,16 +38,11 @@ inertSpecie air;
liquids
{
H2O
{
defaultCoeffs yes;
}
H2O {}
}
solids
{
// none
}
{}
// ************************************************************************* //

View File

@ -38,16 +38,11 @@ inertSpecie air;
liquids
{
H2O
{
defaultCoeffs yes;
}
H2O {}
}
solids
{
// none
}
{}
// ************************************************************************* //

View File

@ -36,18 +36,14 @@ inertSpecie air;
liquids
{
H2O
{
defaultCoeffs yes;
}
H2O {}
}
solids
{
// none
}
{}
// de-activate the pressure-work term when running local time-stepping
dpdt no;
// ************************************************************************* //

View File

@ -36,16 +36,11 @@ inertSpecie air;
liquids
{
H2O
{
defaultCoeffs yes;
}
H2O {}
}
solids
{
// none
}
{}
// ************************************************************************* //

View File

@ -36,15 +36,11 @@ inertSpecie N2;
liquids
{
C7H16
{
defaultCoeffs yes;
}
C7H16 {}
}
solids
{
// none
}
{}
// ************************************************************************* //