Commit 4731fa5c authored by Henry Weller's avatar Henry Weller
Browse files

sutherlandTransport: Add support for reading thermo and transport from separate dictionaries

Based on patch provided by Daniel Jasinski
See http://www.openfoam.org/mantisbt/view.php?id=1888
parent 5459e8cd
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -26,6 +26,19 @@ License
#include "sutherlandTransport.H"
#include "IOstreams.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class Thermo>
Foam::scalar Foam::sutherlandTransport<Thermo>::readCoeff
(
const word& coeffName,
const dictionary& dict
)
{
return readScalar(dict.subDict("transport").lookup(coeffName));
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Thermo>
......@@ -43,8 +56,21 @@ template<class Thermo>
Foam::sutherlandTransport<Thermo>::sutherlandTransport(const dictionary& dict)
:
Thermo(dict),
As_(readScalar(dict.subDict("transport").lookup("As"))),
Ts_(readScalar(dict.subDict("transport").lookup("Ts")))
As_(readCoeff("As", dict)),
Ts_(readCoeff("Ts", dict))
{}
template<class Thermo>
Foam::sutherlandTransport<Thermo>::sutherlandTransport
(
const Thermo& t,
const dictionary& dict
)
:
Thermo(t),
As_(readCoeff("As", dict)),
Ts_(readCoeff("Ts", dict))
{}
......@@ -53,19 +79,20 @@ Foam::sutherlandTransport<Thermo>::sutherlandTransport(const dictionary& dict)
template<class Thermo>
void Foam::sutherlandTransport<Thermo>::write(Ostream& os) const
{
os << this->specie::name() << endl;
os << token::BEGIN_BLOCK << incrIndent << nl;
os << this->specie::name() << endl
<< token::BEGIN_BLOCK << incrIndent << nl;
Thermo::write(os);
dictionary dict("transport");
dict.add("As", As_);
dict.add("Ts", Ts_);
os << indent << dict.dictName() << dict;
os << decrIndent << token::END_BLOCK << nl;
os << indent << dict.dictName() << dict
<< decrIndent << token::END_BLOCK << nl;
}
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
template<class Thermo>
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -114,6 +114,9 @@ class sutherlandTransport
const scalar mu2, const scalar T2
);
//- Read coefficient from dictionary
scalar readCoeff(const word& coeffName, const dictionary& dict);
public:
......@@ -144,6 +147,9 @@ public:
//- Construct from dictionary
sutherlandTransport(const dictionary& dict);
//- Construct from base thermo and dictionary
sutherlandTransport(const Thermo& t,const dictionary& dict);
//- Construct and return a clone
inline autoPtr<sutherlandTransport> clone() const;
......
Supports Markdown
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