thermophysicalModels::liquidProperties: Added initial write-to-dict functionality

Needs further work to make read and write of dictionary consistent.
This commit is contained in:
Henry Weller
2018-04-14 11:04:12 +01:00
parent 00645cdc1a
commit 06adb18299
11 changed files with 68 additions and 17 deletions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2017 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -64,7 +64,7 @@ public:
// Fundamental properties
static word name()
static word energyName()
{
return "ha";
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2017 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -65,7 +65,7 @@ public:
// Fundamental properties
static word name()
static word energyName()
{
return "ea";
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2017 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -64,7 +64,7 @@ public:
// Fundamental properties
static word name()
static word energyName()
{
return "h";
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2017 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -65,7 +65,7 @@ public:
// Fundamental properties
static word name()
static word energyName()
{
return "e";
}

View File

@ -100,7 +100,7 @@ template<class Thermo, template<class> class Type>
inline Foam::word
Foam::species::thermo<Thermo, Type>::heName()
{
return Type<thermo<Thermo, Type>>::name();
return Type<thermo<Thermo, Type>>::energyName();
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -260,6 +260,25 @@ void Foam::liquidProperties::writeData(Ostream& os) const
}
void Foam::liquidProperties::write(Ostream& os) const
{
thermophysicalProperties::write(os);
dictionary dict("liquidProperties");
dict.add("Tc", Tc_);
dict.add("Pc", Pc_);
dict.add("Vc", Vc_);
dict.add("Zc", Zc_);
dict.add("Tt", Tt_);
dict.add("Pt", Pt_);
dict.add("Tb", Tb_);
dict.add("dipm", dipm_);
dict.add("omega", omega_);
dict.add("delta", delta_);
os << indent << dict.dictName() << dict;
}
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<(Ostream& os, const liquidProperties& l)

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -291,7 +291,10 @@ public:
inline void readIfPresent(Liquid& l, const dictionary& dict);
//- Write the function coefficients
virtual void writeData(Ostream& os) const = 0;;
virtual void writeData(Ostream& os) const = 0;
//- Write dictionary to Ostream
void write(Ostream& os) const;
//- Write the data for each of the property functions
template<class Liquid>

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2017 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2017-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -121,6 +121,14 @@ void Foam::thermophysicalProperties::writeData(Ostream& os) const
}
void Foam::thermophysicalProperties::write(Ostream& os) const
{
dictionary dict("thermophysicalProperties");
dict.add("W", W_);
os << indent << dict.dictName() << dict;
}
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<(Ostream& os, const thermophysicalProperties& l)

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2017 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2017-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -172,6 +172,9 @@ public:
//- Write the function coefficients
virtual void writeData(Ostream& os) const = 0;
//- Write dictionary to Ostream
void write(Ostream& os) const;
//- Ostream Operator
friend Ostream& operator<<
(

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2017 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2017-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -58,4 +58,16 @@ thermophysicalPropertiesSelector
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class ThermophysicalProperties>
void Foam::thermophysicalPropertiesSelector<ThermophysicalProperties>::write
(
Ostream& os
) const
{
propertiesPtr_->write(os);
}
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2017 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2017-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -45,7 +45,7 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
Class thermophysicalPropertiesSelector Declaration
Class thermophysicalPropertiesSelector Declaration
\*---------------------------------------------------------------------------*/
template<class ThermophysicalProperties>
@ -135,6 +135,12 @@ public:
inline scalar S(const scalar p, const scalar T) const;
// I-O
//- Write to Ostream
void write(Ostream& os) const;
// Physical properties
//- Liquid viscosity [Pa s]