본문 바로가기

OpenFOAM/소스코드 파해치기

[OpenFOAM 소스코드 파해치기] 열물성 다루기

일본어 원문링크


작성일 : 2013년  3월  17일
번역일 : 2016년  3월 28일


크롬 브라우저로 보시는 것을 권장해 드립니다.


 ------ OpenFOAM 소스코드 파해치기 시리즈 ------

OpenFOAM 소스코드 파해치기 목차로 이동

 ------------------------------------------------------------

 ----- OpenFOAM 소스코드를 다루는 문법 기본 -----

OpenFOAM 소스코드를 다루는 문법 기본으로 이동

 ------------------------------------------------------------



 

  들어가기 


OpenFOAM 에서의 열물성을 다루는 법에 대해 살펴본다.



  사용 버전 


OpenFOAM 1.7.1

 


  OpemFOAM의 열물리모델


OpenFOAM에서는 열물성을 다루기 위해 열물리 모델을 제공하고 있다 ( 소스의 $FOAM_SRC/thermophysicalModels). 예를들어 reactingFoam의 케이스 폴더의 constant/thermophysicalProperties에는 아래와 같이 내용이 수록되어 있다.

thermoType hsPhiMixtureThermo<reactingMixture<gasThermoPhysics>>;


위의 "gasThermoPhysics"는 아래와 같이 정의된다.

($FOAM_SRC/thermophysicalModels/specie/include/thermoPhysicsTypes.H)

typedef sutherlandTransport<specieThermo<janafThermo<perfectGas> > >

gasThermoPhysics;


이상 아래와 같이 구성되어있다.

thermoModel<mixture<transport<specieThermo<thermo<equationOfState>>>>>



 thermoModel

열물리모델

mixture

 혼합특성(혼합률이나 반응 등)

transport

 수송특성(점성계수, 열전달률)

specieThermo

 -

thermo

 열특성(비열,엔탈피)

equationOfState

 상태방정식(분자량,밀도)


이것은 클래스를 계상하는 구조를 반영하고 있다. 예를들어 위에서 "gasThermoPhysics"는 아래와 같은 계승구조를 따른다.

perfectGas <- janafThermo <- specieThermo <- sutherlandTransport


이외의 구조는 다음과 같다.

reactingMixture <- hsPsiMixtureThermo


열물리모델의 클래스가 열물성전체를 다룬다. 그 오브젝트가 초기화 될때, 열물리타입(”gasThermoPhysics" 등)도 초기화 되며 이때 물성치를 읽어들인다. 이 단계는 클래스 계승의 첫머리에 수행된다. 즉, 상태방정식 (분자량, 밀도), 열특성 (비열, 엔탈피), 수송특성(점성계수, 열전달률)의 순서로 읽어들인다.



상태방정식
상태방정식을 초기화할때 화학적 종류의 초기화가 수행된다. 이때 화확적 종류의 이름, 몰수, 분자량을 읽어들인다.
($FOAM_SRC/thermophysicalModels/specie/specie/spcie.C)
Foam::specie::specie(Istream& is)
:
    name_(is),
    nMoles_(readScalar(is)),
    molWeight_(readScalar(is))
"perfectGas"의 경우, 밀도는 이상기체의 상태방정식으로 계산되므로 그 이상의 입력은 불필요하다. 상태방정식은 "icoPolynomial"이라는 것도 있다. 이때에는 밀도를 다항식으로 표현하므로 계수를 입력할 필요가 있다.
($FOAM_SRC/thermophysicalModels/specie/equationOfState/icoPolinomial/icoPolynomial.C)

template<int PolySize> icoPolynomial<PolySize>::icoPolynomial(Istream& is) : specie(is), rhoPolynomial_("rhoPolynomial", is)

rhoPolynomial_은 Polynomial. Polynomial의 생성자는 아래와 같다.
($FOAM_SRC/OpenFOAM?primitives/functions/Polynomial/Polynomial.C)

template<int PolySize> Foam::Polynomial<PolySize>::Polynomial(const word& name, Istream& is) : VectorSpace<Polynomial<PolySize>, scalar, PolySize>(), logActive_(false), logCoeff_(0.0) { word isName(is); ... VectorSpace<Polynomial<PolySize>, scalar, PolySize>:: operator=(VectorSpace<Polynomial<PolySize>, scalar, PolySize>(is));

처음부분에서 이름을 읽어들이고 다음으로 VectorSpace를 다음과 같이 만들어낸다.
($FOAM_SRC/OpenFOAM/primitives/VectorSpace/VectorSpace.C)

template<class Foam, class Cmpt, int nCmpt> Foam::VectorSpace<Foam, Cmpt, nCmpt>::VectorSpace ( Istream& is ) { // Read beginning of VectorSpace is.readBegin("VectorSpace<Foam, Cmpt, nCmpt>"); for (int i=0; i> v_[i]; } // Read end of VectorSpace<Cmpt> is.readEnd("VectorSpace<Foam, Cmpt, nCmpt>"); }

is.readBegin(), is.readEnd()로 각각 "(", ")" 을 불러들인다. 즉, 이름, "(" PolySize문의 숫자값, ")" 을 읽어들인다.



열특성
"janafThermo"의 경우, 다음과 같이 되어 있다.
($FOAM_SRC/thermophysicalModels/specie/thermo/janaf/janafThermo.C)

template<class equationOfState> Foam::janafThermo,equationOfState>::janafThermo(Istream& is) : equationOfState(is), Tlow_(readScalar(is)), Thigh_(readScalar(is)), Tcommon_(readScalar(is)) { ... for ( register label coefLabel=0; coefLabel<janafThermo<equationOfState>::nCoeffs_; coefLabel++ ) { is >> highCpCoeffs_[coefLabel]; } for ( register label coefLabel=0; coefLabel<janafThermo<equationOfState>::nCoeffs_; coefLabel++ ) { is >> lowCpCoeffs_[coefLabel]; }

상태방정식을 읽어들인 후, JANAF 표의 파라메터를 읽어들인다.
"hConstThermo"의 경우는 더 단순하다.
($FOAM_SRC/thermophysicalModels/specie/thermo/hConst/hConstThermo.C)

template<class equationOfState> Foam::hConstThermo<equationOfState>::hConstThermo(Istream& is) : equationOfState(is), Cp_(readScalar(is)), Hf_(readScalar(is))

비열과 엔탈피를 읽어들인다.
"hPolynomial" ($FOAM_SRC/thermophysicalModels/specie/thermo/hPolynomial/hPolynomial.C)

template<class EquationOfState, int PolySize> Foam::hPolynomialThermo<EquationOfState, PolySize>::hPolynomialThermo ( Istream& is ) : EquationOfState(is), Hf_(readScalar(is)), Sf_(readScalar(is)), cpPolynomial_("cpPolynomial", is),

비열을 다항식으로 입력한다.



수송특성
"sutherlandTransport"의 경우, Sutherland 식의 파라메터를 요구한다.
($FOAM_SRC/thermophysicalModels/specie/transport/sutherland/sutherlandTransport.C)

template<class thermo> sutherlandTransport::sutherlandTransport(Istream& is) : thermo(is), As(readScalar(is)), Ts(readScalar(is))

점성계수, 열전달률을 Sutherland의 식으로 계산한다.
"constTransport" ($FOAM_SRC/thermophysicalModels/specie/transport/constTrnasport.C)

template<class thermo> constTransport::constTransport(Istream& is) : thermo(is), Mu(readScalar(is)), rPr(1.0/readScalar(is))

점성계수와 Prandtl수를 입력.
"polynomialTransport" ($FOAM_SRC/thermophysicalModels/specie/transport/polynomial/polynomialTransport.C)

template<class thermo, int PolySize> Foam::polynomialTransport<Thermo, PolySize>::polynomialTransport(Istream& is) : thermo(is), muPolynomial_("muPolynomial",is), kappaPolynomial_("kappaPolynomial",is)

점성계수, 열전달률을 다항식으로 준다.



혼합특성
혼합특성클래스는 화학적 종류의 관리를 수행한다. 다성분의 경우 basicMultiComponentMixture가 기본클래스이며 그것을 계승하는 multiComponentMixture가 반응을 고려하지 않은 다성분, reactingMixture가 반응패스까지 다룰 수 있는 것에 해당한다.



열물리모델
열물리모델은 위에서 다룬 것들을 통합형에 해당한다. 크게 나누어 밀도베이스 (Rho)의 것과 압축률베이스 (Psi)가 있다. 압축률베이스의 경우, 밀도는 압축률 (psi)에서 계산한다

 



  열물리모델타입의 작성


위에서 설명한대로라면 다양한 조합이 가능하도록 보이나, 실제로는 자유롭게 조합할 수는 없다.

열물리타입은 다음과 같은 것이 정의되어 있다. ($FOAM_SRC/thermophysicalModels/specie/include/thermoPhysicsType.H)

typedef sutherlandTransport<specieThermo<janafThermo<perfectGas> > > gasThermoPhysics; typedef constTransport<specieThermo<hConstThermo<perfactGas> > > constGasThermoPhysics; typedef polynomialTransport < specieThermo < hPolynomialThermo < icoPolynomial<8>, 8 > >, 8 > icoPoly8ThermoPhysics;


지정가능한 열물리모델은 다음과 같이 만들어져 있다.

($FOAM_SRC/thermophysicalModels/reactionThermo/combustionThermo/hsCombustionThermo/hsCOmbustionThermo.C)

makeHsCombustionMixtureThermo

(

hsCombustionThermo,

hsPsiMixtureThermo,

reactingMixture,

gasThermoPhysics

);

따라서

hPsiMixtureThermo<reactingMixture<gasThermoPhysics>>;

의 조합이 만들어진다.