작성일 : 2013년 3월 17일
번역일 : 2016년 3월 28일
크롬 브라우저로 보시는 것을 권장해 드립니다.
------------------------------------------------------------
----- 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::specie::specie(Istream& is) : name_(is), nMoles_(readScalar(is)), molWeight_(readScalar(is))
template<int PolySize> icoPolynomial<PolySize>::icoPolynomial(Istream& is) : specie(is), rhoPolynomial_("rhoPolynomial", is)
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));
template<class Foam, class Cmpt, int nCmpt>
Foam::VectorSpace<Foam, Cmpt, nCmpt>
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]; }
template<class equationOfState>
Foam::hConstThermo<equationOfState> ::hConstThermo(Istream& is) : equationOfState(is), Cp_(readScalar(is)), Hf_(readScalar(is))
template<class EquationOfState, int PolySize>
Foam::hPolynomialThermo<EquationOfState, PolySize> ::hPolynomialThermo ( Istream& is ) : EquationOfState(is), Hf_(readScalar(is)), Sf_(readScalar(is)), cpPolynomial_("cpPolynomial", is),
template<class thermo>
sutherlandTransport::sutherlandTransport(Istream& is) : thermo(is), As(readScalar(is)), Ts(readScalar(is))
template<class thermo>
constTransport::constTransport(Istream& is) : thermo(is), Mu(readScalar(is)), rPr(1.0/readScalar(is))
template<class thermo, int PolySize>
Foam::polynomialTransport<Thermo, PolySize>::polynomialTransport(Istream& is) : thermo(is), muPolynomial_("muPolynomial",is), kappaPolynomial_("kappaPolynomial",is)
열물리모델타입의 작성 |
위에서 설명한대로라면 다양한 조합이 가능하도록 보이나, 실제로는 자유롭게 조합할 수는 없다.
열물리타입은 다음과 같은 것이 정의되어 있다. ($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>>;
'OpenFOAM > 소스코드 파해치기' 카테고리의 다른 글
[OpenFOAM 소스코드 파해치기]수송특성 추가 (0) | 2016.03.29 |
---|---|
[OpenFOAM 소스코드 파해치기]입출력오브젝트 (0) | 2016.03.29 |
[OpenFOAM 소스코드 파해치기] simpleFoam (2) | 2016.03.28 |
[OpenFOAM 소스코드 파해치기]대수방정식솔버2 (0) | 2016.03.28 |
[OpenFOAM 소스코드 파해치기] 데이터읽기 (4) | 2016.02.22 |