From d16b06a15ad19006782e62808ccbe1453d2cefd8 Mon Sep 17 00:00:00 2001 From: Henrik Rusche Date: Mon, 30 May 2016 12:23:04 +0200 Subject: [PATCH] Removing trailing whitespace, tabs and DOS CR --- .../basic/basicThermo/basicThermo.H | 2 +- .../psiThermo/basicPsiThermo/basicPsiThermo.H | 4 +- .../psiThermo/realGasEThermo/realGasEThermo.C | 32 +- .../psiThermo/realGasEThermo/realGasEThermo.H | 4 +- .../realGasEThermo/realGasEThermos.C | 4 +- .../psiThermo/realGasHThermo/realGasHThermo.C | 34 +- .../psiThermo/realGasHThermo/realGasHThermo.H | 4 +- .../realGasHThermo/realGasHThermos.C | 4 +- .../IAPWSThermo/IAPWS-IF97.C | 1178 ++++++++--------- .../IAPWSThermo/IAPWS-IF97.H | 462 +++---- .../IAPWSThermo/IAPWSThermo.C | 62 +- .../IAPWSThermo/IAPWSThermo.H | 10 +- .../IAPWSThermo/IAPWSThermos.C | 4 +- .../IAPWS_Waterproperties/Make/files | 2 +- .../IAPWS_Waterproperties/Make/options | 2 +- src/thermophysicalModels/externalMedia/README | 2 +- .../aungierRedlichKwong/aungierRedlichKwong.C | 8 +- .../aungierRedlichKwong/aungierRedlichKwong.H | 38 +- .../aungierRedlichKwongI.H | 48 +- .../cubicEquationOfState/mixtures/README | 2 +- .../mixtureAungierRedlichKwong.C | 2 +- .../mixtureAungierRedlichKwong.H | 14 +- .../mixtureAungierRedlichKwongI.H | 24 +- .../mixturePengRobinson/mixturePengRobinson.C | 16 +- .../mixturePengRobinson/mixturePengRobinson.H | 34 +- .../mixturePengRobinsonI.H | 68 +- .../mixtureRedlichKwong/mixtureRedlichKwong.C | 18 +- .../mixtureRedlichKwong/mixtureRedlichKwong.H | 18 +- .../mixtureRedlichKwongI.H | 32 +- .../mixtureSoaveRedlichKwong.C | 18 +- .../mixtureSoaveRedlichKwong.H | 34 +- .../mixtureSoaveRedlichKwongI.H | 64 +- .../pengRobinson/pengRobinson.C | 10 +- .../pengRobinson/pengRobinson.H | 26 +- .../pengRobinson/pengRobinsonI.H | 56 +- .../redlichKwong/redlichKwong.C | 8 +- .../redlichKwong/redlichKwong.H | 20 +- .../redlichKwong/redlichKwongI.H | 38 +- .../soaveRedlichKwong/soaveRedlichKwong.C | 6 +- .../soaveRedlichKwong/soaveRedlichKwong.H | 40 +- .../soaveRedlichKwong/soaveRedlichKwongI.H | 78 +- .../nasaHeatCapacityPolynomial.C | 4 +- .../nasaHeatCapacityPolynomial.H | 12 +- .../nasaHeatCapacityPolynomialI.H | 56 +- .../realGasSpecieThermo/realGasSpecieThermo.C | 4 +- .../realGasSpecieThermo/realGasSpecieThermo.H | 18 +- .../realGasSpecieThermoI.H | 32 +- 47 files changed, 1328 insertions(+), 1328 deletions(-) diff --git a/src/thermophysicalModels/basic/basicThermo/basicThermo.H b/src/thermophysicalModels/basic/basicThermo/basicThermo.H index 13ec9a9d3..a6d52f45c 100644 --- a/src/thermophysicalModels/basic/basicThermo/basicThermo.H +++ b/src/thermophysicalModels/basic/basicThermo/basicThermo.H @@ -247,7 +247,7 @@ public: //- Thermal diffusivity for enthalpy of mixture [kg/m/s] virtual const volScalarField& alpha() const; - + //- Read thermophysicalProperties dictionary virtual bool read(); }; diff --git a/src/thermophysicalModels/basic/psiThermo/basicPsiThermo/basicPsiThermo.H b/src/thermophysicalModels/basic/psiThermo/basicPsiThermo/basicPsiThermo.H index 99c7a2c85..591f1c98d 100644 --- a/src/thermophysicalModels/basic/psiThermo/basicPsiThermo/basicPsiThermo.H +++ b/src/thermophysicalModels/basic/psiThermo/basicPsiThermo/basicPsiThermo.H @@ -109,10 +109,10 @@ public: return p_*psi(); } - //CL: drhodh needed for pressure equation of the real gas solver + //CL: drhodh needed for pressure equation of the real gas solver virtual const volScalarField& drhodh() const; - //CL: drhode needed for pressure equation of the real gas solver + //CL: drhode needed for pressure equation of the real gas solver virtual const volScalarField& drhode() const; }; diff --git a/src/thermophysicalModels/basic/psiThermo/realGasEThermo/realGasEThermo.C b/src/thermophysicalModels/basic/psiThermo/realGasEThermo/realGasEThermo.C index 1607fee9f..fd4dfd6d3 100755 --- a/src/thermophysicalModels/basic/psiThermo/realGasEThermo/realGasEThermo.C +++ b/src/thermophysicalModels/basic/psiThermo/realGasEThermo/realGasEThermo.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | + \\ / A nd | \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,7 +25,7 @@ License Author Christian Lucas Institut für Thermodynamik -Technische Universität Braunschweig +Technische Universität Braunschweig Germany \*---------------------------------------------------------------------------*/ @@ -170,7 +170,7 @@ Foam::realGasEThermo::realGasEThermo forAll(rho_.boundaryField(), patchi) { rho_.boundaryField()[patchi] == - rho(this->T_.boundaryField()[patchi], patchi); + rho(this->T_.boundaryField()[patchi], patchi); } forAll(eCells, celli) @@ -229,7 +229,7 @@ Foam::tmp Foam::realGasEThermo::e ) const { //CL: need the pressure of the internal field to calculate the realGas internal energy - //CL: this is done this way to assure compatibility to old OF Thermo-Versions + //CL: this is done this way to assure compatibility to old OF Thermo-Versions const scalarField& pCells = this->p_.internalField(); tmp te(new scalarField(T.size())); @@ -241,7 +241,7 @@ Foam::tmp Foam::realGasEThermo::e } return te; -} +} template Foam::tmp Foam::realGasEThermo::e @@ -251,7 +251,7 @@ Foam::tmp Foam::realGasEThermo::e ) const { //CL: need the pressure at the patch to calculate the realGas internal energy - //CL: this is done this way to assure compatibility to old OF Thermo-Versions + //CL: this is done this way to assure compatibility to old OF Thermo-Versions const fvPatchScalarField& pp = this->p_.boundaryField()[patchi]; tmp te(new scalarField(T.size())); @@ -273,7 +273,7 @@ Foam::tmp Foam::realGasEThermo::rho ) const { //CL: need the pressure at the patch to calculate the realGas density - //CL: this is done this way to assure compatibility to old OF Thermo-Versions + //CL: this is done this way to assure compatibility to old OF Thermo-Versions const fvPatchScalarField& pp = this->p_.boundaryField()[patchi]; tmp trho(new scalarField(T.size())); @@ -295,7 +295,7 @@ Foam::tmp Foam::realGasEThermo::Cp ) const { //CL: need the pressure at the patch to calculate the realGas cp - //CL: this is done this way to assure compatibility to old OF Thermo-Versions + //CL: this is done this way to assure compatibility to old OF Thermo-Versions const fvPatchScalarField& pp = this->p_.boundaryField()[patchi]; tmp tCp(new scalarField(T.size())); @@ -362,7 +362,7 @@ Foam::tmp Foam::realGasEThermo::Cv ) const { //CL: need the pressure at the patch to calculate the realGas internal energy - //CL: this is done this way to assure compatibility to old OF Thermo-Versions + //CL: this is done this way to assure compatibility to old OF Thermo-Versions const fvPatchScalarField& pp = this->p_.boundaryField()[patchi]; tmp tCv(new scalarField(T.size())); @@ -384,7 +384,7 @@ Foam::tmp Foam::realGasEThermo::rho() const const fvMesh& mesh = this->T_.mesh(); //CL: create an rho Field, which will be return - //CL: the problem is that this function is "const", + //CL: the problem is that this function is "const", //CL: so a new variabel is needed tmp trho ( @@ -402,11 +402,11 @@ Foam::tmp Foam::realGasEThermo::rho() const dimDensity ) ); - - //CL: copy "old" rho value onto the new rho field as start point - //CL: for the newton solver used in this->TE( ... ) + + //CL: copy "old" rho value onto the new rho field as start point + //CL: for the newton solver used in this->TE( ... ) trho()=rho_; - + volScalarField& rho = trho(); const scalarField& eCells = e_.internalField(); @@ -426,8 +426,8 @@ Foam::tmp Foam::realGasEThermo::rho() const { fvPatchScalarField pp = this->p_.boundaryField()[patchi]; fvPatchScalarField pe = e_.boundaryField()[patchi]; - fvPatchScalarField pT = this->T_.boundaryField()[patchi]; - + fvPatchScalarField pT = this->T_.boundaryField()[patchi]; + fvPatchScalarField& prho_ = rho.boundaryField()[patchi]; forAll(pp, facei) diff --git a/src/thermophysicalModels/basic/psiThermo/realGasEThermo/realGasEThermo.H b/src/thermophysicalModels/basic/psiThermo/realGasEThermo/realGasEThermo.H index c447c05d3..a0e970a8b 100755 --- a/src/thermophysicalModels/basic/psiThermo/realGasEThermo/realGasEThermo.H +++ b/src/thermophysicalModels/basic/psiThermo/realGasEThermo/realGasEThermo.H @@ -35,7 +35,7 @@ SourceFiles Author Christian Lucas Institut für Thermodynamik -Technische Universität Braunschweig +Technische Universität Braunschweig Germany @@ -130,7 +130,7 @@ public: return e_; } - //CL: drhode needed for pressure equation of the real gas solver + //CL: drhode needed for pressure equation of the real gas solver virtual const volScalarField& drhode() const { return drhode_; diff --git a/src/thermophysicalModels/basic/psiThermo/realGasEThermo/realGasEThermos.C b/src/thermophysicalModels/basic/psiThermo/realGasEThermo/realGasEThermos.C index 96737ed1b..fefde88fa 100755 --- a/src/thermophysicalModels/basic/psiThermo/realGasEThermo/realGasEThermos.C +++ b/src/thermophysicalModels/basic/psiThermo/realGasEThermo/realGasEThermos.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | + \\ / A nd | \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,7 +25,7 @@ License Author Christian Lucas Institut für Thermodynamik -Technische Universität Braunschweig +Technische Universität Braunschweig Germany diff --git a/src/thermophysicalModels/basic/psiThermo/realGasHThermo/realGasHThermo.C b/src/thermophysicalModels/basic/psiThermo/realGasHThermo/realGasHThermo.C index 5fa656c01..bee1f796f 100755 --- a/src/thermophysicalModels/basic/psiThermo/realGasHThermo/realGasHThermo.C +++ b/src/thermophysicalModels/basic/psiThermo/realGasHThermo/realGasHThermo.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | + \\ / A nd | \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,7 +25,7 @@ License Author Christian Lucas Institut für Thermodynamik -Technische Universität Braunschweig +Technische Universität Braunschweig Germany \*---------------------------------------------------------------------------*/ @@ -169,12 +169,12 @@ Foam::realGasHThermo::realGasHThermo forAll(rho_.boundaryField(), patchi) { rho_.boundaryField()[patchi] == - rho(this->T_.boundaryField()[patchi], patchi); + rho(this->T_.boundaryField()[patchi], patchi); } forAll(hCells, celli) { - hCells[celli] = this->cellMixture(celli).H(rhoCells[celli],TCells[celli]); + hCells[celli] = this->cellMixture(celli).H(rhoCells[celli],TCells[celli]); } forAll(h_.boundaryField(), patchi) @@ -228,7 +228,7 @@ Foam::tmp Foam::realGasHThermo::h ) const { //CL: need the pressure of the internal field to calculate the realGas enthalpy - //CL: this is done this way to assure compatibility to old OF Thermo-Versions + //CL: this is done this way to assure compatibility to old OF Thermo-Versions const scalarField& pCells = this->p_.internalField(); tmp th(new scalarField(T.size())); @@ -240,7 +240,7 @@ Foam::tmp Foam::realGasHThermo::h } return th; -} +} template Foam::tmp Foam::realGasHThermo::h @@ -250,7 +250,7 @@ Foam::tmp Foam::realGasHThermo::h ) const { //CL: need the pressure at the patch to calculate the realGas enthalpy - //CL: this is done this way to assure compatibility to old OF Thermo-Versions + //CL: this is done this way to assure compatibility to old OF Thermo-Versions const fvPatchScalarField& pp = this->p_.boundaryField()[patchi]; tmp th(new scalarField(T.size())); @@ -272,7 +272,7 @@ Foam::tmp Foam::realGasHThermo::rho ) const { //CL: need the pressure at the patch to calculate the realGas enthalpy - //CL: this is done this way to assure compatibility to old OF Thermo-Versions + //CL: this is done this way to assure compatibility to old OF Thermo-Versions const fvPatchScalarField& pp = this->p_.boundaryField()[patchi]; tmp trho(new scalarField(T.size())); @@ -294,7 +294,7 @@ Foam::tmp Foam::realGasHThermo::Cp ) const { //CL: need the pressure at the patch to calculate the realGas enthalpy - //CL: this is done this way to assure compatibility to old OF Thermo-Versions + //CL: this is done this way to assure compatibility to old OF Thermo-Versions const fvPatchScalarField& pp = this->p_.boundaryField()[patchi]; tmp tCp(new scalarField(T.size())); @@ -361,7 +361,7 @@ Foam::tmp Foam::realGasHThermo::Cv ) const { //CL: need the pressure at the patch to calculate the realGas enthalpy - //CL: this is done this way to assure compatibility to old OF Thermo-Versions + //CL: this is done this way to assure compatibility to old OF Thermo-Versions const fvPatchScalarField& pp = this->p_.boundaryField()[patchi]; tmp tCv(new scalarField(T.size())); @@ -383,7 +383,7 @@ Foam::tmp Foam::realGasHThermo::rho() const const fvMesh& mesh = this->T_.mesh(); //CL: create a rho Field, which will be return - //CL: the problem is that this function is "const", + //CL: the problem is that this function is "const", //CL: so a new variabel is needed tmp trho ( @@ -401,11 +401,11 @@ Foam::tmp Foam::realGasHThermo::rho() const dimDensity ) ); - - //CL: copy "old" rho value onto the new rho field as start point - //CL: for the newton solver used in this->TH( ... ) + + //CL: copy "old" rho value onto the new rho field as start point + //CL: for the newton solver used in this->TH( ... ) trho()=rho_; - + volScalarField& rho = trho(); const scalarField& hCells = h_.internalField(); @@ -425,8 +425,8 @@ Foam::tmp Foam::realGasHThermo::rho() const { fvPatchScalarField pp = this->p_.boundaryField()[patchi]; fvPatchScalarField ph = h_.boundaryField()[patchi]; - fvPatchScalarField pT = this->T_.boundaryField()[patchi]; - + fvPatchScalarField pT = this->T_.boundaryField()[patchi]; + fvPatchScalarField& prho_ = rho.boundaryField()[patchi]; forAll(pp, facei) diff --git a/src/thermophysicalModels/basic/psiThermo/realGasHThermo/realGasHThermo.H b/src/thermophysicalModels/basic/psiThermo/realGasHThermo/realGasHThermo.H index 3ea9ff654..7f9042a2c 100755 --- a/src/thermophysicalModels/basic/psiThermo/realGasHThermo/realGasHThermo.H +++ b/src/thermophysicalModels/basic/psiThermo/realGasHThermo/realGasHThermo.H @@ -35,7 +35,7 @@ SourceFiles Author Christian Lucas Institut für Thermodynamik -Technische Universität Braunschweig +Technische Universität Braunschweig Germany @@ -130,7 +130,7 @@ public: return h_; } - //CL: drhodh needed for pressure equation of the real gas solver + //CL: drhodh needed for pressure equation of the real gas solver virtual const volScalarField& drhodh() const { return drhodh_; diff --git a/src/thermophysicalModels/basic/psiThermo/realGasHThermo/realGasHThermos.C b/src/thermophysicalModels/basic/psiThermo/realGasHThermo/realGasHThermos.C index 547fcee63..9422bf8e3 100755 --- a/src/thermophysicalModels/basic/psiThermo/realGasHThermo/realGasHThermos.C +++ b/src/thermophysicalModels/basic/psiThermo/realGasHThermo/realGasHThermos.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | + \\ / A nd | \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,7 +25,7 @@ License Author Christian Lucas Institut für Thermodynamik -Technische Universität Braunschweig +Technische Universität Braunschweig Germany diff --git a/src/thermophysicalModels/externalMedia/IAPWS_Waterproperties/IAPWSThermo/IAPWS-IF97.C b/src/thermophysicalModels/externalMedia/IAPWS_Waterproperties/IAPWSThermo/IAPWS-IF97.C index b841e9cd5..7312cda08 100644 --- a/src/thermophysicalModels/externalMedia/IAPWS_Waterproperties/IAPWSThermo/IAPWS-IF97.C +++ b/src/thermophysicalModels/externalMedia/IAPWS_Waterproperties/IAPWSThermo/IAPWS-IF97.C @@ -1,589 +1,589 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright held by original author - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 2 of the License, or (at your - option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM; if not, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -Author -Christian Lucas -Institut für Thermodynamik -Technische Universität Braunschweig -Germany -\*---------------------------------------------------------------------------*/ - - -#include "IAPWS-IF97.H" -#include -#include - - -//CL: calculated all (minimal) needed properties for a given pressure and enthalpy -void Foam::calculateProperties_ph -( - scalar &p, - scalar &h, - scalar &T, - scalar &rho, - scalar &psi, - scalar &drhodh, - scalar &mu, - scalar &alpha -) -{ - SteamState S; - - // CL: vapor mass fraction is also calculated in calculateProperties_h - // CL: in this fuction, x is a dummy variable and x is not return to IAPWSThermo.C - scalar x; - - S=freesteam_set_ph(p,h); - calculateProperties_h(S,p,h,T,rho,psi,drhodh,mu,alpha,x); -} - -//CL: calculated all (minimal) needed properties + the vapor mass fraction for a given pressure and enthalpy -void Foam::calculateProperties_ph -( - scalar &p, - scalar &h, - scalar &T, - scalar &rho, - scalar &psi, - scalar &drhodh, - scalar &mu, - scalar &alpha, - scalar &x -) -{ - SteamState S; - - S=freesteam_set_ph(p,h); - calculateProperties_h(S,p,h,T,rho,psi,drhodh,mu,alpha,x); -} - -//CL: calculated all (minimal) needed properties for a given pressure and temperature -void Foam::calculateProperties_pT -( - scalar &p, - scalar &T, - scalar &h, - scalar &rho, - scalar &psi, - scalar &drhodh, - scalar &mu, - scalar &alpha -) -{ - SteamState S; - - // CL: vapor mass fraction is also calculated in calculateProperties_h - // CL: in this fuction, x is a dummy variable and x is not return to IAPWSThermo. - scalar x; - - S=freesteam_set_pT(p,T); - calculateProperties_h(S,p,h,T,rho,psi,drhodh,mu,alpha,x); -} - -//CL: calculated all (minimal) needed properties + the vapor mass fraction for a given pressure and temperature -void Foam::calculateProperties_pT -( - scalar &p, - scalar &T, - scalar &h, - scalar &rho, - scalar &psi, - scalar &drhodh, - scalar &mu, - scalar &alpha, - scalar &x -) -{ - SteamState S; - - S=freesteam_set_pT(p,T); - calculateProperties_h(S,p,h,T,rho,psi,drhodh,mu,alpha,x); -} - - -//CL: calculated the properties --> this function is called by the functions above -//CL: does not calulated the internal energy, if this is needed e.g. for sonicFoam -//CL: the function has to be changed a little bit -void Foam::calculateProperties_h -( - SteamState S, - scalar &p, - scalar &h, - scalar &T, - scalar &rho, - scalar &psi, - scalar &drhodh, - scalar &mu, - scalar &alpha, - scalar &x -) -{ - label region; - scalar kappa,lambda,cp,beta; - - region=freesteam_region(S); - - if (region==1) - { - p=S.R1.p; - T=S.R1.T; - rho=1/freesteam_region1_v_pT(S.R1.p,S.R1.T); - h=freesteam_region1_h_pT(S.R1.p,S.R1.T); - x=0; - - //Cl: note: in FreeStream, beta=1/V*(dV/dP)_P=const is called alphaV (in this region) - //Cl: note: in FreeStream, kappa=1/V*(dV/dP)_T=const is called kappaT (in this region) - kappa=freesteam_region1_kappaT_pT(S.R1.p,S.R1.T); - beta=freesteam_region1_alphav_pT(S.R1.p,S.R1.T); - cp=freesteam_region1_cp_pT(S.R1.p,S.R1.T); - - //CL: getting derivatives using Bridgmans table - //CL: psi=(drho/dp)_h=const - //CL: drhodh=(drho/dh)_p=const - psi=-((T*beta*beta-beta)/cp-kappa*rho); - drhodh=-rho*beta/cp; - - //CL: getting transport properties - mu=freesteam_mu_rhoT(rho, T); - lambda=freesteam_k_rhoT(rho,T); - alpha=lambda/cp; //Cl: Important info -->alpha= thermal diffusivity time density - } - else if (region==2) - { - p=S.R2.p; - T=S.R2.T; - rho=1/freesteam_region2_v_pT(S.R2.p,S.R2.T); - h=freesteam_region2_h_pT(S.R2.p,S.R2.T); - x=1; - - //Cl: note: in FreeStream, beta=1/V*(dV/dP)_P=const is called alphaV (in this region) - //Cl: note: in FreeStream, kappa=1/V*(dV/dP)_T=const is called kappaT (in this region) - kappa=freesteam_region2_kappaT_pT(S.R2.p,S.R2.T); - beta=freesteam_region2_alphav_pT(S.R2.p,S.R2.T); - cp=freesteam_region2_cp_pT(S.R2.p,S.R2.T); - - //CL: getting derivatives using Bridgmans table - //CL: psi=(drho/dp)_h=const - //CL: drhodh=(drho/dh)_p=const - psi=-((T*beta*beta-beta)/cp-kappa*rho); - drhodh=-rho*beta/cp; - - //CL: getting transport properties - mu=freesteam_mu_rhoT(rho, T); - lambda=freesteam_k_rhoT(rho,T); - alpha=lambda/cp; //Cl: Important info -->alpha= thermal diffusivity time density - } - else if (region==3) - { - scalar gamma,cv; - - rho=S.R3.rho; - T=S.R3.T; - p=freesteam_region3_p_rhoT(S.R3.rho,S.R3.T); - h=freesteam_region3_h_rhoT(S.R3.rho,S.R3.T); - - //CL= when hx=0 else x=1 - if (h<2084256.263) - { - x=0; - } - else - { - x=1; - } - - //Cl: note: beta=1/V*(dV/dP)_P=const - //Cl: note: kappa=1/V*(dV/dP)_T=const - //Cl: note: in FreeStream, gamma=1/p*(dp/dT)_v=const is called alphap (in this region) - gamma=freesteam_region3_alphap_rhoT(S.R3.rho,S.R3.T); - cp=freesteam_region3_cp_rhoT(S.R3.rho,S.R3.T); - cv=freesteam_region3_cv_rhoT(S.R3.rho,S.R3.T); - beta=(cp-cv)/(S.R3.T/S.R3.rho*p*gamma); - kappa=(cp-cv)/(S.R3.T/S.R3.rho*p*p*gamma*gamma); - - //CL: getting derivatives using Bridgmans table - //CL: psi=(drho/dp)_h=const - //CL: drhodh=(drho/dh)_p=const - psi=-((T*beta*beta-beta)/cp-kappa*rho); - drhodh=-rho*beta/cp; - - - //CL: getting transport properties - mu=freesteam_mu_rhoT(rho, T); - lambda=freesteam_k_rhoT(rho,T); - alpha=lambda/cp; //Cl: Important info -->alpha= thermal diffusivity time density - - } - else if (region==4) - { - scalar rhov,rhol,betav,betal,kappav,kappal,vv,vl,cpl,cpv,hl,hv,cp; - scalar dvldp,dvvdp,dhldp,dhvdp; - scalar dpdT,dvdh,dvdp,dxdp; - - SteamState Sl,Sv; - - x=S.R4.x; - T=S.R4.T; - rho=1/freesteam_region4_v_Tx(S.R4.T,S.R4.x); - h=freesteam_region4_h_Tx(S.R4.T,S.R4.x); - p=freesteam_region4_psat_T(S.R4.T); - cp=freesteam_region4_cp_Tx(S.R4.T,S.R4.x); - - - //CL: Getting density on the vapour and liquid lines - rhov=freesteam_region4_rhog_T(S.R4.T); - rhol=freesteam_region4_rhof_T(S.R4.T); - vv=1/rhov; - vl=1/rhol; - - //CL: getting derivatives --> this is a bit tricky inside the vapor dome - - dpdT=freesteam_region4_dpsatdT_T(S.R4.T); - - // getting the states outside the vapour dome - Sl=freesteam_set_pv(p,vl-0.0000001); //inside region 1 - Sv=freesteam_set_pv(p,vv+0.0000001); //inside region 2 - - kappal=freesteam_region1_kappaT_pT(Sl.R1.p,Sl.R1.T); - kappav=freesteam_region2_kappaT_pT(Sv.R2.p,Sv.R2.T); - - betal=freesteam_region1_alphav_pT(Sl.R1.p,Sl.R1.T); - betav=freesteam_region2_alphav_pT(Sv.R2.p,Sv.R2.T); - - cpl=freesteam_region1_cp_pT(Sl.R1.p,Sl.R1.T); - cpv=freesteam_region2_cp_pT(Sv.R2.p,Sv.R2.T); - - hl=freesteam_region1_h_pT(Sl.R1.p,Sl.R1.T); - hv=freesteam_region2_h_pT(Sv.R2.p,Sv.R2.T); - - - //calculation derviatives on liquid and vapour line - dvldp=betal*vl/dpdT-kappal*vl; - dvvdp=betav*vv/dpdT-kappav*vv; - - dhldp=vl*(1-betal*Sl.R1.T)+cpl/dpdT; - dhvdp=vv*(1-betav*Sv.R2.T)+cpl/dpdT; - - dxdp=-dhldp/(hv-hl) - +(h-hl)/((hv-hl)*(hv-hl)) - *(dhvdp-dhldp); - - //CL: psi=(drho/dp)_h=const - dvdp=dvldp+(dvvdp-dvldp)*x+(vv-vl)*dxdp; - psi=-rho*rho*dvdp; - - //CL: drhodh=(drho/dh)_p=const - dvdh=(vv-vl)/(hv-hl); - drhodh=-rho*rho*dvdh; - - //CL: getting transport properties - mu=freesteam_mu_rhoT(rho, T); - lambda=freesteam_k_rhoT(rho,T); - alpha=lambda/cp; //Cl: Important info -->alpha= thermal diffusivity time density - } - else - { - std::cout<<"IAPWS-IF97 error, outside the regions 1-4"< this is a bit tricky in the vapor dome - - dpdT=freesteam_region4_dpsatdT_T(S.R4.T); - - // getting the states outside the vapour dome - Sl=freesteam_set_pv(p,vl-0.0000001); //inside region 1 - Sv=freesteam_set_pv(p,vv+0.0000001); //inside region 2 - - kappal=freesteam_region1_kappaT_pT(Sl.R1.p,Sl.R1.T); - kappav=freesteam_region2_kappaT_pT(Sv.R2.p,Sv.R2.T); - - betal=freesteam_region1_alphav_pT(Sl.R1.p,Sl.R1.T); - betav=freesteam_region2_alphav_pT(Sv.R2.p,Sv.R2.T); - - cpl=freesteam_region1_cp_pT(Sl.R1.p,Sl.R1.T); - cpv=freesteam_region2_cp_pT(Sv.R2.p,Sv.R2.T); - - hl=freesteam_region1_h_pT(Sl.R1.p,Sl.R1.T); - hv=freesteam_region2_h_pT(Sv.R2.p,Sv.R2.T); - - //calculation derviatives on liquid and vapour line - dvldp=betal*vl/dpdT-kappal*vl; - dvvdp=betav*vv/dpdT-kappav*vv; - - dhldp=vl*(1-betal*Sl.R1.T)+cpl/dpdT; - dhvdp=vv*(1-betav*Sv.R2.T)+cpl/dpdT; - - dxdp=-dhldp/(hv-hl) - +(h-hl)/((hv-hl)*(hv-hl)) - *(dhvdp-dhldp); - - //CL: psiH=(drho/dp)_h=const - dvdp=dvldp+(dvvdp-dvldp)*S.R4.x+(vv-vl)*dxdp; - psiH=-rho*rho*dvdp; - } - else - { - Info<<"IAPWS-IF97.C error, outside the regions 1-4"< +#include + + +//CL: calculated all (minimal) needed properties for a given pressure and enthalpy +void Foam::calculateProperties_ph +( + scalar &p, + scalar &h, + scalar &T, + scalar &rho, + scalar &psi, + scalar &drhodh, + scalar &mu, + scalar &alpha +) +{ + SteamState S; + + // CL: vapor mass fraction is also calculated in calculateProperties_h + // CL: in this fuction, x is a dummy variable and x is not return to IAPWSThermo.C + scalar x; + + S=freesteam_set_ph(p,h); + calculateProperties_h(S,p,h,T,rho,psi,drhodh,mu,alpha,x); +} + +//CL: calculated all (minimal) needed properties + the vapor mass fraction for a given pressure and enthalpy +void Foam::calculateProperties_ph +( + scalar &p, + scalar &h, + scalar &T, + scalar &rho, + scalar &psi, + scalar &drhodh, + scalar &mu, + scalar &alpha, + scalar &x +) +{ + SteamState S; + + S=freesteam_set_ph(p,h); + calculateProperties_h(S,p,h,T,rho,psi,drhodh,mu,alpha,x); +} + +//CL: calculated all (minimal) needed properties for a given pressure and temperature +void Foam::calculateProperties_pT +( + scalar &p, + scalar &T, + scalar &h, + scalar &rho, + scalar &psi, + scalar &drhodh, + scalar &mu, + scalar &alpha +) +{ + SteamState S; + + // CL: vapor mass fraction is also calculated in calculateProperties_h + // CL: in this fuction, x is a dummy variable and x is not return to IAPWSThermo. + scalar x; + + S=freesteam_set_pT(p,T); + calculateProperties_h(S,p,h,T,rho,psi,drhodh,mu,alpha,x); +} + +//CL: calculated all (minimal) needed properties + the vapor mass fraction for a given pressure and temperature +void Foam::calculateProperties_pT +( + scalar &p, + scalar &T, + scalar &h, + scalar &rho, + scalar &psi, + scalar &drhodh, + scalar &mu, + scalar &alpha, + scalar &x +) +{ + SteamState S; + + S=freesteam_set_pT(p,T); + calculateProperties_h(S,p,h,T,rho,psi,drhodh,mu,alpha,x); +} + + +//CL: calculated the properties --> this function is called by the functions above +//CL: does not calulated the internal energy, if this is needed e.g. for sonicFoam +//CL: the function has to be changed a little bit +void Foam::calculateProperties_h +( + SteamState S, + scalar &p, + scalar &h, + scalar &T, + scalar &rho, + scalar &psi, + scalar &drhodh, + scalar &mu, + scalar &alpha, + scalar &x +) +{ + label region; + scalar kappa,lambda,cp,beta; + + region=freesteam_region(S); + + if (region==1) + { + p=S.R1.p; + T=S.R1.T; + rho=1/freesteam_region1_v_pT(S.R1.p,S.R1.T); + h=freesteam_region1_h_pT(S.R1.p,S.R1.T); + x=0; + + //Cl: note: in FreeStream, beta=1/V*(dV/dP)_P=const is called alphaV (in this region) + //Cl: note: in FreeStream, kappa=1/V*(dV/dP)_T=const is called kappaT (in this region) + kappa=freesteam_region1_kappaT_pT(S.R1.p,S.R1.T); + beta=freesteam_region1_alphav_pT(S.R1.p,S.R1.T); + cp=freesteam_region1_cp_pT(S.R1.p,S.R1.T); + + //CL: getting derivatives using Bridgmans table + //CL: psi=(drho/dp)_h=const + //CL: drhodh=(drho/dh)_p=const + psi=-((T*beta*beta-beta)/cp-kappa*rho); + drhodh=-rho*beta/cp; + + //CL: getting transport properties + mu=freesteam_mu_rhoT(rho, T); + lambda=freesteam_k_rhoT(rho,T); + alpha=lambda/cp; //Cl: Important info -->alpha= thermal diffusivity time density + } + else if (region==2) + { + p=S.R2.p; + T=S.R2.T; + rho=1/freesteam_region2_v_pT(S.R2.p,S.R2.T); + h=freesteam_region2_h_pT(S.R2.p,S.R2.T); + x=1; + + //Cl: note: in FreeStream, beta=1/V*(dV/dP)_P=const is called alphaV (in this region) + //Cl: note: in FreeStream, kappa=1/V*(dV/dP)_T=const is called kappaT (in this region) + kappa=freesteam_region2_kappaT_pT(S.R2.p,S.R2.T); + beta=freesteam_region2_alphav_pT(S.R2.p,S.R2.T); + cp=freesteam_region2_cp_pT(S.R2.p,S.R2.T); + + //CL: getting derivatives using Bridgmans table + //CL: psi=(drho/dp)_h=const + //CL: drhodh=(drho/dh)_p=const + psi=-((T*beta*beta-beta)/cp-kappa*rho); + drhodh=-rho*beta/cp; + + //CL: getting transport properties + mu=freesteam_mu_rhoT(rho, T); + lambda=freesteam_k_rhoT(rho,T); + alpha=lambda/cp; //Cl: Important info -->alpha= thermal diffusivity time density + } + else if (region==3) + { + scalar gamma,cv; + + rho=S.R3.rho; + T=S.R3.T; + p=freesteam_region3_p_rhoT(S.R3.rho,S.R3.T); + h=freesteam_region3_h_rhoT(S.R3.rho,S.R3.T); + + //CL= when hx=0 else x=1 + if (h<2084256.263) + { + x=0; + } + else + { + x=1; + } + + //Cl: note: beta=1/V*(dV/dP)_P=const + //Cl: note: kappa=1/V*(dV/dP)_T=const + //Cl: note: in FreeStream, gamma=1/p*(dp/dT)_v=const is called alphap (in this region) + gamma=freesteam_region3_alphap_rhoT(S.R3.rho,S.R3.T); + cp=freesteam_region3_cp_rhoT(S.R3.rho,S.R3.T); + cv=freesteam_region3_cv_rhoT(S.R3.rho,S.R3.T); + beta=(cp-cv)/(S.R3.T/S.R3.rho*p*gamma); + kappa=(cp-cv)/(S.R3.T/S.R3.rho*p*p*gamma*gamma); + + //CL: getting derivatives using Bridgmans table + //CL: psi=(drho/dp)_h=const + //CL: drhodh=(drho/dh)_p=const + psi=-((T*beta*beta-beta)/cp-kappa*rho); + drhodh=-rho*beta/cp; + + + //CL: getting transport properties + mu=freesteam_mu_rhoT(rho, T); + lambda=freesteam_k_rhoT(rho,T); + alpha=lambda/cp; //Cl: Important info -->alpha= thermal diffusivity time density + + } + else if (region==4) + { + scalar rhov,rhol,betav,betal,kappav,kappal,vv,vl,cpl,cpv,hl,hv,cp; + scalar dvldp,dvvdp,dhldp,dhvdp; + scalar dpdT,dvdh,dvdp,dxdp; + + SteamState Sl,Sv; + + x=S.R4.x; + T=S.R4.T; + rho=1/freesteam_region4_v_Tx(S.R4.T,S.R4.x); + h=freesteam_region4_h_Tx(S.R4.T,S.R4.x); + p=freesteam_region4_psat_T(S.R4.T); + cp=freesteam_region4_cp_Tx(S.R4.T,S.R4.x); + + + //CL: Getting density on the vapour and liquid lines + rhov=freesteam_region4_rhog_T(S.R4.T); + rhol=freesteam_region4_rhof_T(S.R4.T); + vv=1/rhov; + vl=1/rhol; + + //CL: getting derivatives --> this is a bit tricky inside the vapor dome + + dpdT=freesteam_region4_dpsatdT_T(S.R4.T); + + // getting the states outside the vapour dome + Sl=freesteam_set_pv(p,vl-0.0000001); //inside region 1 + Sv=freesteam_set_pv(p,vv+0.0000001); //inside region 2 + + kappal=freesteam_region1_kappaT_pT(Sl.R1.p,Sl.R1.T); + kappav=freesteam_region2_kappaT_pT(Sv.R2.p,Sv.R2.T); + + betal=freesteam_region1_alphav_pT(Sl.R1.p,Sl.R1.T); + betav=freesteam_region2_alphav_pT(Sv.R2.p,Sv.R2.T); + + cpl=freesteam_region1_cp_pT(Sl.R1.p,Sl.R1.T); + cpv=freesteam_region2_cp_pT(Sv.R2.p,Sv.R2.T); + + hl=freesteam_region1_h_pT(Sl.R1.p,Sl.R1.T); + hv=freesteam_region2_h_pT(Sv.R2.p,Sv.R2.T); + + + //calculation derviatives on liquid and vapour line + dvldp=betal*vl/dpdT-kappal*vl; + dvvdp=betav*vv/dpdT-kappav*vv; + + dhldp=vl*(1-betal*Sl.R1.T)+cpl/dpdT; + dhvdp=vv*(1-betav*Sv.R2.T)+cpl/dpdT; + + dxdp=-dhldp/(hv-hl) + +(h-hl)/((hv-hl)*(hv-hl)) + *(dhvdp-dhldp); + + //CL: psi=(drho/dp)_h=const + dvdp=dvldp+(dvvdp-dvldp)*x+(vv-vl)*dxdp; + psi=-rho*rho*dvdp; + + //CL: drhodh=(drho/dh)_p=const + dvdh=(vv-vl)/(hv-hl); + drhodh=-rho*rho*dvdh; + + //CL: getting transport properties + mu=freesteam_mu_rhoT(rho, T); + lambda=freesteam_k_rhoT(rho,T); + alpha=lambda/cp; //Cl: Important info -->alpha= thermal diffusivity time density + } + else + { + std::cout<<"IAPWS-IF97 error, outside the regions 1-4"< this is a bit tricky in the vapor dome + + dpdT=freesteam_region4_dpsatdT_T(S.R4.T); + + // getting the states outside the vapour dome + Sl=freesteam_set_pv(p,vl-0.0000001); //inside region 1 + Sv=freesteam_set_pv(p,vv+0.0000001); //inside region 2 + + kappal=freesteam_region1_kappaT_pT(Sl.R1.p,Sl.R1.T); + kappav=freesteam_region2_kappaT_pT(Sv.R2.p,Sv.R2.T); + + betal=freesteam_region1_alphav_pT(Sl.R1.p,Sl.R1.T); + betav=freesteam_region2_alphav_pT(Sv.R2.p,Sv.R2.T); + + cpl=freesteam_region1_cp_pT(Sl.R1.p,Sl.R1.T); + cpv=freesteam_region2_cp_pT(Sv.R2.p,Sv.R2.T); + + hl=freesteam_region1_h_pT(Sl.R1.p,Sl.R1.T); + hv=freesteam_region2_h_pT(Sv.R2.p,Sv.R2.T); + + //calculation derviatives on liquid and vapour line + dvldp=betal*vl/dpdT-kappal*vl; + dvvdp=betav*vv/dpdT-kappav*vv; + + dhldp=vl*(1-betal*Sl.R1.T)+cpl/dpdT; + dhvdp=vv*(1-betav*Sv.R2.T)+cpl/dpdT; + + dxdp=-dhldp/(hv-hl) + +(h-hl)/((hv-hl)*(hv-hl)) + *(dhvdp-dhldp); + + //CL: psiH=(drho/dp)_h=const + dvdp=dvldp+(dvvdp-dvldp)*S.R4.x+(vv-vl)*dxdp; + psiH=-rho*rho*dvdp; + } + else + { + Info<<"IAPWS-IF97.C error, outside the regions 1-4"< see region1.h (freesteam) -EXTERN double freesteam_region1_v_pT(double,double); -EXTERN double freesteam_region1_h_pT(double,double); -EXTERN double freesteam_region1_kappaT_pT(double,double); -EXTERN double freesteam_region1_alphav_pT(double,double); -EXTERN double freesteam_region1_cp_pT(double,double); -EXTERN double freesteam_region1_u_pT(double,double); -EXTERN double freesteam_region1_s_pT(double,double); -EXTERN double freesteam_region1_cv_pT(double,double); - -//CL: Region 2 --> see region2.h (freesteam) -EXTERN double freesteam_region2_v_pT(double,double); -EXTERN double freesteam_region2_u_pT(double,double); -EXTERN double freesteam_region2_s_pT(double,double); -EXTERN double freesteam_region2_h_pT(double,double); -EXTERN double freesteam_region2_cp_pT(double,double); -EXTERN double freesteam_region2_cv_pT(double,double); -EXTERN double freesteam_region2_alphav_pT(double,double); -EXTERN double freesteam_region2_kappaT_pT(double,double); - -//CL: Region 3 --> see region3.h (freesteam) -EXTERN double freesteam_region3_p_rhoT(double,double); -EXTERN double freesteam_region3_u_rhoT(double,double); -EXTERN double freesteam_region3_s_rhoT(double,double); -EXTERN double freesteam_region3_h_rhoT(double,double); -EXTERN double freesteam_region3_cp_rhoT(double,double); -EXTERN double freesteam_region3_cv_rhoT(double,double); -EXTERN double freesteam_region3_alphap_rhoT(double,double); -EXTERN double freesteam_region3_betap_rhoT(double,double); - -//CL: Region 4 --> see region4.h (freesteam) -EXTERN double freesteam_region4_psat_T(double); -EXTERN double freesteam_region4_Tsat_p(double); -EXTERN double freesteam_region4_rhof_T(double); -EXTERN double freesteam_region4_rhog_T(double); -EXTERN double freesteam_region4_v_Tx(double,double); -EXTERN double freesteam_region4_u_Tx(double,double); -EXTERN double freesteam_region4_h_Tx(double,double); -EXTERN double freesteam_region4_s_Tx(double,double); -EXTERN double freesteam_region4_cp_Tx(double,double); -EXTERN double freesteam_region4_cv_Tx(double,double); -EXTERN double freesteam_region4_dpsatdT_T(double); - -namespace Foam -{ - //CL: Functions to caluculate all fluid properties - void calculateProperties_h - ( - SteamState S, - scalar &rho, - scalar &h, - scalar &T, - scalar &p, - scalar &psi, - scalar &drhodh, - scalar &mu, - scalar &alpha, - scalar &x - ); - - //CL: This functions returns all (minimal) needed propeties (p,T,h,rho,psi,drhodh,mu and alpha) for given p and T - void calculateProperties_pT - ( - scalar &p, - scalar &T, - scalar &h, - scalar &rho, - scalar &psi, - scalar &drhodh, - scalar &mu, - scalar &alpha - ); - - //CL: This function returns the same values as the function above for given p and T - //CL: Additionally, the vapor mass fraction x is return - //CL: NOTE: This function is only included to have the possibility to update x at the fixedValue (Temperature) BC - //CL: can only return x=0 and x=1 because it is not possible to describe the vapour dome with p and T - void calculateProperties_pT - ( - scalar &p, - scalar &T, - scalar &h, - scalar &rho, - scalar &psi, - scalar &drhodh, - scalar &mu, - scalar &alpha, - scalar &x - ); - - //CL: This functions returns all (minimal) needed properties (p,T,h,rho,psi,drhodh,mu and alpha) for given p and h - void calculateProperties_ph - ( - scalar &p, - scalar &h, - scalar &T, - scalar &rho, - scalar &psi, - scalar &drhodh, - scalar &mu, - scalar &alpha - ); - - //CL: This function returns the same values as the function above for given p and h - //CL: Additionally, the vapor mass fraction x is return - void calculateProperties_ph - ( - scalar &p, - scalar &h, - scalar &T, - scalar &rho, - scalar &psi, - scalar &drhodh, - scalar &mu, - scalar &alpha, - scalar &x - ); - - - //CL: Return density for given pT or ph; - scalar rho_pT(scalar p,scalar T); - scalar rho_ph(scalar p,scalar h); - - //CL: Return cp for given pT or ph; - scalar cp_pT(scalar p,scalar T); - scalar cp_ph(scalar p,scalar h); - - //CL: Return cv for given pT or ph; - scalar cv_pT(scalar p,scalar T); - scalar cv_ph(scalar p,scalar h); - - //CL: Return enthalpy for given pT; - scalar h_pT(scalar p,scalar T); - - //CL: Return temperature for given ph; - scalar T_ph(scalar p,scalar T); - - //CL: Return psiH=(drho/dp)_h=constant for given pT or ph; - scalar psiH_pT(scalar p,scalar T); - scalar psiH_ph(scalar p,scalar h); - scalar psiH(SteamState S); - - //CL: Return drhodh=(drho/dh)_p=constant for given pT or ph; - scalar drhodh_pT(scalar p,scalar T); - scalar drhodh_ph(scalar p,scalar h); - scalar drhodh(SteamState S); - -} - -#endif //IAPWSIF97_C_ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Description + IAPWS-IF97 (water) based thermodynamic class. Water properties calculated by freeSteam. + + This code connects OpenFoam with freeSteam and provides the basic functions needed in OpenFOAM + + For more information about freeSteam and its authors have a look @ http://freesteam.sourceforge.net/example.php + +SourceFiles + IAPWS-IF97.C + +Author +Christian Lucas +Institut für Thermodynamik +Technische Universität Braunschweig +Germany +\*---------------------------------------------------------------------------*/ +#ifndef IAPWSIF97_H +#define IAPWSIF97_H + +#include "basicPsiThermo.H" +#include "steam.H" + +#ifdef __cplusplus + #define EXTERN extern "C" +#else + #define EXTERN extern +#endif + + +//CL: +EXTERN double freesteam_p(SteamState S); +EXTERN double freesteam_T(SteamState S); +EXTERN double freesteam_rho(SteamState S); +EXTERN double freesteam_v(SteamState S); +EXTERN double freesteam_u(SteamState S); +EXTERN double freesteam_h(SteamState S); +EXTERN double freesteam_s(SteamState S); +EXTERN double freesteam_cp(SteamState S); +EXTERN double freesteam_cv(SteamState S); +EXTERN double freesteam_w(SteamState S); +EXTERN double freesteam_x(SteamState S); +EXTERN double freesteam_mu(SteamState S); +EXTERN double freesteam_k(SteamState S); + +//CL: getting SteamState for two given properties e.g. pressure and temperatur +EXTERN SteamState freesteam_set_pv(double,double); +EXTERN SteamState freesteam_set_pu(double,double); +EXTERN SteamState freesteam_set_pT(double,double); +EXTERN SteamState freesteam_set_ph(double,double); + +//CL: getting region of the SteamState +EXTERN int freesteam_region(SteamState); + +//CL: transport properties +EXTERN double freesteam_mu_rhoT(double,double); +EXTERN double freesteam_k_rhoT(double,double); + +//CL: Region 1 --> see region1.h (freesteam) +EXTERN double freesteam_region1_v_pT(double,double); +EXTERN double freesteam_region1_h_pT(double,double); +EXTERN double freesteam_region1_kappaT_pT(double,double); +EXTERN double freesteam_region1_alphav_pT(double,double); +EXTERN double freesteam_region1_cp_pT(double,double); +EXTERN double freesteam_region1_u_pT(double,double); +EXTERN double freesteam_region1_s_pT(double,double); +EXTERN double freesteam_region1_cv_pT(double,double); + +//CL: Region 2 --> see region2.h (freesteam) +EXTERN double freesteam_region2_v_pT(double,double); +EXTERN double freesteam_region2_u_pT(double,double); +EXTERN double freesteam_region2_s_pT(double,double); +EXTERN double freesteam_region2_h_pT(double,double); +EXTERN double freesteam_region2_cp_pT(double,double); +EXTERN double freesteam_region2_cv_pT(double,double); +EXTERN double freesteam_region2_alphav_pT(double,double); +EXTERN double freesteam_region2_kappaT_pT(double,double); + +//CL: Region 3 --> see region3.h (freesteam) +EXTERN double freesteam_region3_p_rhoT(double,double); +EXTERN double freesteam_region3_u_rhoT(double,double); +EXTERN double freesteam_region3_s_rhoT(double,double); +EXTERN double freesteam_region3_h_rhoT(double,double); +EXTERN double freesteam_region3_cp_rhoT(double,double); +EXTERN double freesteam_region3_cv_rhoT(double,double); +EXTERN double freesteam_region3_alphap_rhoT(double,double); +EXTERN double freesteam_region3_betap_rhoT(double,double); + +//CL: Region 4 --> see region4.h (freesteam) +EXTERN double freesteam_region4_psat_T(double); +EXTERN double freesteam_region4_Tsat_p(double); +EXTERN double freesteam_region4_rhof_T(double); +EXTERN double freesteam_region4_rhog_T(double); +EXTERN double freesteam_region4_v_Tx(double,double); +EXTERN double freesteam_region4_u_Tx(double,double); +EXTERN double freesteam_region4_h_Tx(double,double); +EXTERN double freesteam_region4_s_Tx(double,double); +EXTERN double freesteam_region4_cp_Tx(double,double); +EXTERN double freesteam_region4_cv_Tx(double,double); +EXTERN double freesteam_region4_dpsatdT_T(double); + +namespace Foam +{ + //CL: Functions to caluculate all fluid properties + void calculateProperties_h + ( + SteamState S, + scalar &rho, + scalar &h, + scalar &T, + scalar &p, + scalar &psi, + scalar &drhodh, + scalar &mu, + scalar &alpha, + scalar &x + ); + + //CL: This functions returns all (minimal) needed propeties (p,T,h,rho,psi,drhodh,mu and alpha) for given p and T + void calculateProperties_pT + ( + scalar &p, + scalar &T, + scalar &h, + scalar &rho, + scalar &psi, + scalar &drhodh, + scalar &mu, + scalar &alpha + ); + + //CL: This function returns the same values as the function above for given p and T + //CL: Additionally, the vapor mass fraction x is return + //CL: NOTE: This function is only included to have the possibility to update x at the fixedValue (Temperature) BC + //CL: can only return x=0 and x=1 because it is not possible to describe the vapour dome with p and T + void calculateProperties_pT + ( + scalar &p, + scalar &T, + scalar &h, + scalar &rho, + scalar &psi, + scalar &drhodh, + scalar &mu, + scalar &alpha, + scalar &x + ); + + //CL: This functions returns all (minimal) needed properties (p,T,h,rho,psi,drhodh,mu and alpha) for given p and h + void calculateProperties_ph + ( + scalar &p, + scalar &h, + scalar &T, + scalar &rho, + scalar &psi, + scalar &drhodh, + scalar &mu, + scalar &alpha + ); + + //CL: This function returns the same values as the function above for given p and h + //CL: Additionally, the vapor mass fraction x is return + void calculateProperties_ph + ( + scalar &p, + scalar &h, + scalar &T, + scalar &rho, + scalar &psi, + scalar &drhodh, + scalar &mu, + scalar &alpha, + scalar &x + ); + + + //CL: Return density for given pT or ph; + scalar rho_pT(scalar p,scalar T); + scalar rho_ph(scalar p,scalar h); + + //CL: Return cp for given pT or ph; + scalar cp_pT(scalar p,scalar T); + scalar cp_ph(scalar p,scalar h); + + //CL: Return cv for given pT or ph; + scalar cv_pT(scalar p,scalar T); + scalar cv_ph(scalar p,scalar h); + + //CL: Return enthalpy for given pT; + scalar h_pT(scalar p,scalar T); + + //CL: Return temperature for given ph; + scalar T_ph(scalar p,scalar T); + + //CL: Return psiH=(drho/dp)_h=constant for given pT or ph; + scalar psiH_pT(scalar p,scalar T); + scalar psiH_ph(scalar p,scalar h); + scalar psiH(SteamState S); + + //CL: Return drhodh=(drho/dh)_p=constant for given pT or ph; + scalar drhodh_pT(scalar p,scalar T); + scalar drhodh_ph(scalar p,scalar h); + scalar drhodh(SteamState S); + +} + +#endif //IAPWSIF97_C_ diff --git a/src/thermophysicalModels/externalMedia/IAPWS_Waterproperties/IAPWSThermo/IAPWSThermo.C b/src/thermophysicalModels/externalMedia/IAPWS_Waterproperties/IAPWSThermo/IAPWSThermo.C index 0ebd0a18e..c878893b7 100755 --- a/src/thermophysicalModels/externalMedia/IAPWS_Waterproperties/IAPWSThermo/IAPWSThermo.C +++ b/src/thermophysicalModels/externalMedia/IAPWS_Waterproperties/IAPWSThermo/IAPWSThermo.C @@ -25,7 +25,7 @@ License Author Christian Lucas Institut für Thermodynamik -Technische Universität Braunschweig +Technische Universität Braunschweig Germany \*---------------------------------------------------------------------------*/ @@ -45,21 +45,21 @@ void Foam::IAPWSThermo::calculate() scalarField& drhodhCells = this->drhodh_.internalField(); scalarField& muCells = this->mu_.internalField(); scalarField& alphaCells = this->alpha_.internalField(); - + //CL: Updating all cell properties //CL: loop through all cells forAll(TCells, celli) - { + { //CL: see IAPWAS-IF97.H calculateProperties_ph ( - pCells[celli], - hCells[celli], - TCells[celli], - rhoCells[celli], - psiCells[celli], - drhodhCells[celli], - muCells[celli], + pCells[celli], + hCells[celli], + TCells[celli], + rhoCells[celli], + psiCells[celli], + drhodhCells[celli], + muCells[celli], alphaCells[celli] ); } @@ -84,13 +84,13 @@ void Foam::IAPWSThermo::calculate() //CL: see IAPWAS-IF97.H calculateProperties_pT ( - pp[facei], - pT[facei], - ph[facei], - prho[facei], - ppsi[facei], - pdrhodh[facei], - pmu[facei], + pp[facei], + pT[facei], + ph[facei], + prho[facei], + ppsi[facei], + pdrhodh[facei], + pmu[facei], palpha[facei] ); } @@ -103,13 +103,13 @@ void Foam::IAPWSThermo::calculate() //CL: see IAPWAS-IF97.H calculateProperties_ph ( - pp[facei], - ph[facei], - pT[facei], - prho[facei], - ppsi[facei], - pdrhodh[facei], - pmu[facei], + pp[facei], + ph[facei], + pT[facei], + prho[facei], + ppsi[facei], + pdrhodh[facei], + pmu[facei], palpha[facei] ); } @@ -143,7 +143,7 @@ Foam::IAPWSThermo::IAPWSThermo dimensionSet(0, 2, -2, 0, 0), this->hBoundaryTypes() ), - + rho_ ( IOobject @@ -186,18 +186,18 @@ Foam::IAPWSThermo::IAPWSThermo forAll(h_.boundaryField(), patchi) { h_.boundaryField()[patchi] == - h(this->T_.boundaryField()[patchi], patchi); + h(this->T_.boundaryField()[patchi], patchi); } forAll(rhoCells, celli) { - rhoCells[celli] = rho_pT(pCells[celli],TCells[celli]); + rhoCells[celli] = rho_pT(pCells[celli],TCells[celli]); } forAll(rho_.boundaryField(), patchi) { rho_.boundaryField()[patchi] == - rho(this->p_.boundaryField()[patchi] ,this->h_.boundaryField()[patchi], patchi); + rho(this->p_.boundaryField()[patchi] ,this->h_.boundaryField()[patchi], patchi); } hBoundaryCorrection(h_); @@ -256,7 +256,7 @@ Foam::tmp Foam::IAPWSThermo::h } return th; -} +} Foam::tmp Foam::IAPWSThermo::h @@ -273,7 +273,7 @@ Foam::tmp Foam::IAPWSThermo::h forAll(T, facei) { - h[facei] = h_pT(pp[facei], T[facei]); + h[facei] = h_pT(pp[facei], T[facei]); } return th; @@ -365,7 +365,7 @@ Foam::tmp Foam::IAPWSThermo::Cp() const } -//CL: Returns an updated field for rho +//CL: Returns an updated field for rho Foam::tmp Foam::IAPWSThermo::rho() const { const fvMesh& mesh = this->p_.mesh(); diff --git a/src/thermophysicalModels/externalMedia/IAPWS_Waterproperties/IAPWSThermo/IAPWSThermo.H b/src/thermophysicalModels/externalMedia/IAPWS_Waterproperties/IAPWSThermo/IAPWSThermo.H index 70385b8e8..36d967b58 100755 --- a/src/thermophysicalModels/externalMedia/IAPWS_Waterproperties/IAPWSThermo/IAPWSThermo.H +++ b/src/thermophysicalModels/externalMedia/IAPWS_Waterproperties/IAPWSThermo/IAPWSThermo.H @@ -27,12 +27,12 @@ Class Description: - Waterproperties based on the IAPWS 97 tables - The water properties are caluclated using freeSteam (http://freesteam.sourceforge.net/example.php) - + Waterproperties based on the IAPWS 97 tables + The water properties are caluclated using freeSteam (http://freesteam.sourceforge.net/example.php) + General paper decribing the water tables: - "Revised Release on the IAPWS Industrial Formulation 1997 for the Thermodynamic Properties of Water and Steam" + "Revised Release on the IAPWS Industrial Formulation 1997 for the Thermodynamic Properties of Water and Steam" SourceFiles IAPWSThermo.C @@ -40,7 +40,7 @@ SourceFiles Author Christian Lucas Institut für Thermodynamik -Technische Universität Braunschweig +Technische Universität Braunschweig Germany diff --git a/src/thermophysicalModels/externalMedia/IAPWS_Waterproperties/IAPWSThermo/IAPWSThermos.C b/src/thermophysicalModels/externalMedia/IAPWS_Waterproperties/IAPWSThermo/IAPWSThermos.C index 14172cbf3..d2dcbcf87 100755 --- a/src/thermophysicalModels/externalMedia/IAPWS_Waterproperties/IAPWSThermo/IAPWSThermos.C +++ b/src/thermophysicalModels/externalMedia/IAPWS_Waterproperties/IAPWSThermo/IAPWSThermos.C @@ -25,7 +25,7 @@ License Author Christian Lucas Institut für Thermodynamik -Technische Universität Braunschweig +Technische Universität Braunschweig Germany \*---------------------------------------------------------------------------*/ @@ -34,7 +34,7 @@ Germany #include "makeBasicPsiThermo.H" #include "IAPWSThermo.H" -// including dummy classes --> this classes do nothing +// including dummy classes --> this classes do nothing // except satisfy the template structure //#include "dummyEqnOfState.H" //#include "dummyThermo.H" diff --git a/src/thermophysicalModels/externalMedia/IAPWS_Waterproperties/Make/files b/src/thermophysicalModels/externalMedia/IAPWS_Waterproperties/Make/files index 2de700ff5..32c11d9f0 100644 --- a/src/thermophysicalModels/externalMedia/IAPWS_Waterproperties/Make/files +++ b/src/thermophysicalModels/externalMedia/IAPWS_Waterproperties/Make/files @@ -1,4 +1,4 @@ IAPWSThermo/IAPWS-IF97.C -IAPWSThermo/IAPWSThermos.C +IAPWSThermo/IAPWSThermos.C LIB = $(FOAM_LIBBIN)/libIAPWSThermo diff --git a/src/thermophysicalModels/externalMedia/IAPWS_Waterproperties/Make/options b/src/thermophysicalModels/externalMedia/IAPWS_Waterproperties/Make/options index 267982f35..696f9ce3a 100644 --- a/src/thermophysicalModels/externalMedia/IAPWS_Waterproperties/Make/options +++ b/src/thermophysicalModels/externalMedia/IAPWS_Waterproperties/Make/options @@ -1,7 +1,7 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude + -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude LIB_LIBS = \ -lfiniteVolume\ diff --git a/src/thermophysicalModels/externalMedia/README b/src/thermophysicalModels/externalMedia/README index b22394bf9..4cb815f36 100644 --- a/src/thermophysicalModels/externalMedia/README +++ b/src/thermophysicalModels/externalMedia/README @@ -1,4 +1,4 @@ -CL: +CL: In this folder, thermodynamic classes similar to "hPsiThermo" are provided. These classes use external fluid property libraries e.g. freesteam for water.The classes are not directly linked into the basicThermophysicalModels dynamic library (see folder OpenFOAM-x.x/src/thermophysicalModels/basic). To use the code, add the dynamic library (the one you want to use from this folder + the one from the external library) in the controldict of your case diff --git a/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/aungierRedlichKwong/aungierRedlichKwong.C b/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/aungierRedlichKwong/aungierRedlichKwong.C index 9ff6c6c6e..87caa7814 100755 --- a/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/aungierRedlichKwong/aungierRedlichKwong.C +++ b/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/aungierRedlichKwong/aungierRedlichKwong.C @@ -28,7 +28,7 @@ Description Author Christian Lucas Institut für Thermodynamik -Technische Universität Braunschweig +Technische Universität Braunschweig Germany \*---------------------------------------------------------------------------*/ @@ -49,7 +49,7 @@ aungierRedlichKwong::aungierRedlichKwong(Istream& is) pcrit_(readScalar(is)), Tcrit_(readScalar(is)), azentricFactor_(readScalar(is)), - rhocrit_(readScalar(is)), + rhocrit_(readScalar(is)), a0_(0.42747*pow(this->RR(),2)*pow(Tcrit_,2)/pcrit_), b_(0.08664*this->RR()*Tcrit_/pcrit_), c_(this->RR()*Tcrit_/(pcrit_+(a0_/(this->W()/rhocrit_*(this->W()/rhocrit_+b_))))+b_-this->W()/rhocrit_), @@ -88,7 +88,7 @@ aungierRedlichKwong::aungierRedlichKwong(const dictionary& dict) b_(0.08664*this->RR()*Tcrit_/pcrit_), c_(this->RR()*Tcrit_/(pcrit_+(a0_/(this->W()/rhocrit_*(this->W()/rhocrit_+b_))))+b_-this->W()/rhocrit_), n_(0.4986+1.2735*azentricFactor_+0.4754*pow(azentricFactor_,2)), - TSave(0.0), + TSave(0.0), b2_(pow(b_,2)), b3_(pow(b_,3)), b4_(pow(b_,4)), @@ -119,7 +119,7 @@ void Foam::aungierRedlichKwong::write(Ostream& os) const Ostream& operator<<(Ostream& os, const aungierRedlichKwong& ark) { - os << static_cast(ark)<< token::SPACE + os << static_cast(ark)<< token::SPACE << ark.pcrit_ << tab<< ark.Tcrit_<< tab<W()/rho; @@ -211,7 +211,7 @@ inline scalar aungierRedlichKwong::p(const scalar rho,const scalar T) const } -//Real deviative dp/dv at constant temperature +//Real deviative dp/dv at constant temperature //(molar values) inline scalar aungierRedlichKwong::dpdv(const scalar rho, const scalar T) const { @@ -224,7 +224,7 @@ inline scalar aungierRedlichKwong::dpdv(const scalar rho, const scalar T) const } -//Real deviative dp/dT at constant molar volume +//Real deviative dp/dT at constant molar volume //(molar values) inline scalar aungierRedlichKwong::dpdT(const scalar rho, const scalar T) const { @@ -233,7 +233,7 @@ inline scalar aungierRedlichKwong::dpdT(const scalar rho, const scalar T) const } -//Real deviative dv/dT at constant pressure +//Real deviative dv/dT at constant pressure //using implicit differentiation //(molar values) inline scalar aungierRedlichKwong::dvdT(const scalar rho,const scalar T) const @@ -242,9 +242,9 @@ inline scalar aungierRedlichKwong::dvdT(const scalar rho,const scalar T) const } -//Real deviative dv/dp at constant temperature +//Real deviative dv/dp at constant temperature //(molar values) -inline scalar aungierRedlichKwong::dvdp(const scalar rho,const scalar T) const +inline scalar aungierRedlichKwong::dvdp(const scalar rho,const scalar T) const { return 1/this->dpdv(rho,T); } @@ -266,7 +266,7 @@ inline scalar aungierRedlichKwong::integral_p_dv //needed to calculate the entropy //(molar values) inline scalar aungierRedlichKwong::integral_dpdT_dv -( +( const scalar rho, const scalar T ) const @@ -300,10 +300,10 @@ inline scalar aungierRedlichKwong::d2pdv2(const scalar rho,const scalar T) const //(molar values) -//using second order implicit differentiation +//using second order implicit differentiation inline scalar aungierRedlichKwong::d2vdT2(const scalar rho, const scalar T) const { - return + return -( pow(this->dpdT(rho,T),2)*this->d2pdv2(rho,T) + pow(this->dpdv(rho,T),2)*this->d2pdT2(rho,T) @@ -325,13 +325,13 @@ inline scalar aungierRedlichKwong::d2pdvdT(const scalar rho, const scalar T) con } -// the result of this intergal is needed for the nasa based cp polynomial +// the result of this intergal is needed for the nasa based cp polynomial //(molar values) inline scalar aungierRedlichKwong::integral_d2pdT2_dv ( const scalar rho, const scalar T -) const +) const { scalar Vm = this->W()/rho; return d2adT2(T)*log(b()+Vm)/b()-d2adT2(T)*log(Vm)/b(); @@ -376,7 +376,7 @@ inline scalar aungierRedlichKwong::rho do { molarVolumePrevIteration= molarVolume; - + label i=0; do { @@ -387,7 +387,7 @@ inline scalar aungierRedlichKwong::rho )/pow(2,i); i++; - if (i>8) + if (i>8) { //CL: using bisection methode as backup, //CL: solution must be between rho=0.001 to rho=1500; @@ -402,7 +402,7 @@ inline scalar aungierRedlichKwong::rho if ((f2 < 0 && f3 > 0) || (f2 > 0 && f3 < 0)) { rho1=rho3; - } + } else if ((f1 < 0 && f3 > 0)||(f1 > 0 && f3 < 0)) { rho2=rho3; @@ -416,7 +416,7 @@ inline scalar aungierRedlichKwong::rho { molarVolume=this->W()/rho3; molarVolumePrevIteration=this->W()/rho3; - break; + break; } else { diff --git a/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/mixtures/README b/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/mixtures/README index b30bb2b76..696fea68d 100644 --- a/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/mixtures/README +++ b/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/mixtures/README @@ -1,5 +1,5 @@ CL: Real gas mixture classes using mixture models. -CL: other models are possible +CL: other models are possible CL: Mixtures based on a pseudo critical point approach diff --git a/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/mixtures/mixtureAungierRedlichKwong/mixtureAungierRedlichKwong.C b/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/mixtures/mixtureAungierRedlichKwong/mixtureAungierRedlichKwong.C index 1150ef93a..ea7e6af31 100755 --- a/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/mixtures/mixtureAungierRedlichKwong/mixtureAungierRedlichKwong.C +++ b/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/mixtures/mixtureAungierRedlichKwong/mixtureAungierRedlichKwong.C @@ -28,7 +28,7 @@ Description Author Christian Lucas Institut für Thermodynamik -Technische Universität Braunschweig +Technische Universität Braunschweig Germany \*---------------------------------------------------------------------------*/ diff --git a/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/mixtures/mixtureAungierRedlichKwong/mixtureAungierRedlichKwong.H b/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/mixtures/mixtureAungierRedlichKwong/mixtureAungierRedlichKwong.H index e0407fe5f..b422d66ad 100755 --- a/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/mixtures/mixtureAungierRedlichKwong/mixtureAungierRedlichKwong.H +++ b/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/mixtures/mixtureAungierRedlichKwong/mixtureAungierRedlichKwong.H @@ -28,8 +28,8 @@ Class Description Mixture Aungier Redlich Kwong equation of state. - Mixture based on a pseudo critical point approach. - + Mixture based on a pseudo critical point approach. + For further information, see: BOOK Title: The Properties of Gases And Liquids, Fifth Edition, McGraw-Hill, Chapter 5 Authors: B. Poling; J. Prausnitz; J. O'Connell @@ -42,7 +42,7 @@ SourceFiles Author Christian Lucas Institut für Thermodynamik -Technische Universität Braunschweig +Technische Universität Braunschweig Germany \*---------------------------------------------------------------------------*/ @@ -73,27 +73,27 @@ protected: // data at the critical point scalar Zcrit_; - + //CL. molar volume at the critical point scalar Vcrit_; //CL: save the concentrations of each component of the mixture //CL: needs to be multiplied by this->W() to get the molar fractions //mutable DynamicList weigths; - + //CL: saves a pointer to the pure component classes of the mixture // mutable DynamicList mixtureComponents; public: - + // Constructors //- Construct from components inline mixtureAungierRedlichKwong ( - const aungierRedlichKwong& sp, + const aungierRedlichKwong& sp, scalar Tcrit, scalar azentricFactor, scalar Vcrit, diff --git a/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/mixtures/mixtureAungierRedlichKwong/mixtureAungierRedlichKwongI.H b/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/mixtures/mixtureAungierRedlichKwong/mixtureAungierRedlichKwongI.H index 9e959e02e..47ec9ad39 100755 --- a/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/mixtures/mixtureAungierRedlichKwong/mixtureAungierRedlichKwongI.H +++ b/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/mixtures/mixtureAungierRedlichKwong/mixtureAungierRedlichKwongI.H @@ -25,7 +25,7 @@ License Author Christian Lucas Institut für Thermodynamik -Technische Universität Braunschweig +Technische Universität Braunschweig Germany \*---------------------------------------------------------------------------*/ @@ -51,14 +51,14 @@ inline mixtureAungierRedlichKwong::mixtureAungierRedlichKwong scalar rhoMax ) : - aungierRedlichKwong(sp), + aungierRedlichKwong(sp), Vcrit_(Vcrit), Zcrit_(Zcrit) { //CL: Saving critical data Tcrit_=Tcrit; - pcrit_=Zcrit*this->RR*Tcrit/Vcrit; - rhocrit_=this->W()/Vcrit_; + pcrit_=Zcrit*this->RR*Tcrit/Vcrit; + rhocrit_=this->W()/Vcrit_; azentricFactor_=azentricFactor; //CL: calculating the aungier redlich kwong coefficience @@ -71,7 +71,7 @@ inline mixtureAungierRedlichKwong::mixtureAungierRedlichKwong rhoMin_=rhoMin; rhoMax_=rhoMax; - //CL: + //CL: b2_=pow(b_,2); b3_=pow(b_,3); b4_=pow(b_,4); @@ -128,7 +128,7 @@ inline void mixtureAungierRedlichKwong::operator+=(const mixtureAungierRedlichKw Vcrit_=molr1*Vcrit_+molr2*pr.Vcrit_; pcrit_=Zcrit_*this->RR*Tcrit_/Vcrit_; rhocrit_=this->W()/Vcrit_; - + //CL: calculating new azentric factor azentricFactor_=molr1*azentricFactor_+molr2*pr.azentricFactor_; @@ -142,7 +142,7 @@ inline void mixtureAungierRedlichKwong::operator+=(const mixtureAungierRedlichKw c_=this->RR*Tcrit_/(pcrit_+(a0_/(this->W()/rhocrit_*(this->W()/rhocrit_+b_))))+b_-this->W()/rhocrit_; n_=0.4986+1.2735*azentricFactor_+0.4754*pow(azentricFactor_,2); - //CL: + //CL: b2_=pow(b_,2); b3_=pow(b_,3); b4_=pow(b_,4); @@ -195,11 +195,11 @@ inline mixtureAungierRedlichKwong operator* return mixtureAungierRedlichKwong ( s*static_cast(pr), - pr.Tcrit_, - pr.azentricFactor_, - pr.Vcrit_, - pr.Zcrit_, - pr.rhoMin_, + pr.Tcrit_, + pr.azentricFactor_, + pr.Vcrit_, + pr.Zcrit_, + pr.rhoMin_, pr.rhoMax_ ); } diff --git a/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/mixtures/mixturePengRobinson/mixturePengRobinson.C b/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/mixtures/mixturePengRobinson/mixturePengRobinson.C index d84fa7759..1e1c0cd9b 100644 --- a/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/mixtures/mixturePengRobinson/mixturePengRobinson.C +++ b/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/mixtures/mixturePengRobinson/mixturePengRobinson.C @@ -28,7 +28,7 @@ Description Author Christian Lucas Institut für Thermodynamik -Technische Universität Braunschweig +Technische Universität Braunschweig Germany \*---------------------------------------------------------------------------*/ @@ -50,7 +50,7 @@ mixturePengRobinson::mixturePengRobinson(Istream& is) numOfComp(1), //CL: no real gas mixture correction when stream constructor is used realMixtureCorr_(false) -{ +{ //CL: set size of weigths, mixtureComponents ... to 10, //CL: when more mixture components are used //CL: size of the DynamicLis increases automatically @@ -101,21 +101,21 @@ mixturePengRobinson::mixturePengRobinson(const dictionary& dict) label i; label j; label k=0; - + // CL: saves the number of mixtureCorrectionCoefficients needed for this mixture // CL: need to be set to 1 label sizeOfVector_=1; //CL: size of the vector depends on the number of components - //CL: determine the size of the vector + //CL: determine the size of the vector for (i=3; i<=nCom_;i++) - { + { sizeOfVector_=sizeOfVector_+(i-1); } - - //CL: setting the size + + //CL: setting the size realMixtureCorrCoef_.setSize(sizeOfVector_); - + //CL: Reading the real mixture correction coefficients //CL: Naming convention e.g for 3 component mixture: //CL: mixtureCorrectionCoefficient_12, mixtureCorrectionCoefficient_13, mixtureCorrectionCoefficient_23 diff --git a/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/mixtures/mixturePengRobinson/mixturePengRobinson.H b/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/mixtures/mixturePengRobinson/mixturePengRobinson.H index 27ced59e6..9e87d6676 100644 --- a/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/mixtures/mixturePengRobinson/mixturePengRobinson.H +++ b/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/mixtures/mixturePengRobinson/mixturePengRobinson.H @@ -41,7 +41,7 @@ SourceFiles Author Christian Lucas Institut für Thermodynamik -Technische Universität Braunschweig +Technische Universität Braunschweig Germany \*---------------------------------------------------------------------------*/ @@ -77,34 +77,34 @@ protected: //CL: bool used to make sure the model behaves like a single component model when needed //CL: this is needed during the construction of the mixture - mutable bool singleComponent; - + mutable bool singleComponent; + //CL: save the concentrations of each component of the mixture //CL: needs to be multiplied by this->W() to get the molar fractions mutable DynamicList weigths; - + //CL: saves a pointer to the pure component classes of the mixture mutable DynamicList mixtureComponents; - + //CL: counts the number of components mutable label numOfComp; //Protected functions - //CL: function updates the coefficients (aSave, daSave, d2aSave, b) of the mixture + //CL: function updates the coefficients (aSave, daSave, d2aSave, b) of the mixture //CL: this is the function with the mixing rule - inline void updateModelCoefficients(const scalar T) const; + inline void updateModelCoefficients(const scalar T) const; //CL: Variables used in real gas mixture correction //CL: If true, the real gas mixture correction is used mutable bool realMixtureCorr_; - + //CL: number of mixture components, needed to calculate the mixture correction factors needed //CL: do not mistake this variable with numOfComp, //CL: numOfComp is a counter to counts the number of components while the mixture is constructed mutable label nCom_; - + //CL: stores real mixture correction coefficients mutable DynamicList realMixtureCorrCoef_; @@ -121,7 +121,7 @@ public: label numOfComp, DynamicList weigths, DynamicList mixtureComponents, - scalar a0, + scalar a0, scalar b, scalar Tcrit, scalar n, @@ -161,29 +161,29 @@ public: //CL: mixture coefficience inline scalar amix(const scalar T, const label i, const label j) const; - + inline scalar dadTmix(const scalar T, const label i, const label j) const; inline scalar d2adT2mix(const scalar T, const label i, const label j) const; inline scalar p(const scalar rho, const scalar T) const; - //first order derivatives + //first order derivatives inline scalar dpdv(const scalar rho, const scalar T) const; inline scalar dpdT(const scalar rho, const scalar T) const; inline scalar dvdT(const scalar rho, const scalar T) const; - inline scalar dvdp(const scalar rho, const scalar T) const; + inline scalar dvdp(const scalar rho, const scalar T) const; - inline scalar isobarExpCoef(const scalar rho, const scalar T) const; + inline scalar isobarExpCoef(const scalar rho, const scalar T) const; inline scalar isothermalCompressiblity ( const scalar rho, const scalar T - ) const; + ) const; // Used for cv inline scalar integral_d2pdT2_dv @@ -193,7 +193,7 @@ public: ) const; //Used for internal Energy - inline scalar integral_p_dv(const scalar rho, const scalar T) const; + inline scalar integral_p_dv(const scalar rho, const scalar T) const; // Used for Entropy inline scalar integral_dpdT_dv(const scalar rho, const scalar T) const; @@ -218,7 +218,7 @@ public: inline scalar rho(const scalar p, const scalar T) const; - //- Return compressibility drho/dp at T=constant [s^2/m^2] + //- Return compressibility drho/dp at T=constant [s^2/m^2] inline scalar psi(const scalar rho, const scalar T) const; //- Return compression factor [] diff --git a/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/mixtures/mixturePengRobinson/mixturePengRobinsonI.H b/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/mixtures/mixturePengRobinson/mixturePengRobinsonI.H index f1aed3743..a6d814e8d 100644 --- a/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/mixtures/mixturePengRobinson/mixturePengRobinsonI.H +++ b/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/mixtures/mixturePengRobinson/mixturePengRobinsonI.H @@ -25,7 +25,7 @@ License Author Christian Lucas Institut für Thermodynamik -Technische Universität Braunschweig +Technische Universität Braunschweig Germany \*---------------------------------------------------------------------------*/ @@ -40,7 +40,7 @@ namespace Foam // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // Construct from components -// CL: needed for operator* +// CL: needed for operator* inline mixturePengRobinson::mixturePengRobinson ( const pengRobinson& pr, @@ -55,7 +55,7 @@ inline mixturePengRobinson::mixturePengRobinson scalar rhoMin, scalar rhoMax ) -: +: pengRobinson(pr), singleComponent(1), weigths(weigths), @@ -64,7 +64,7 @@ inline mixturePengRobinson::mixturePengRobinson { a0_=a0; b_=b; - Tcrit_=Tcrit; + Tcrit_=Tcrit; n_=n; rhostd_=rhostd; rhoMin_=rhoMin; @@ -82,12 +82,12 @@ inline mixturePengRobinson::mixturePengRobinson scalar rhoMin, scalar rhoMax ) -: +: pengRobinson(pr), singleComponent(0), weigths(weigths), mixtureComponents(mixtureComponents), - numOfComp(numOfComp) + numOfComp(numOfComp) { TSave=0.0; rhoMin_=rhoMin; @@ -120,23 +120,23 @@ inline autoPtr mixturePengRobinson::New(Istream& is) //CL: updates the coefficents of the model after the construction of the mixture //CL: uses the van der waals mixing rule inline void mixturePengRobinson::updateModelCoefficients(const scalar T) const -{ - // CL: to make sure that the coefficents are only updated if the mixture has more than 1 component +{ + // CL: to make sure that the coefficents are only updated if the mixture has more than 1 component if (singleComponent==0) - { + { // Checking if the mixture coefficient were already calculated for this temperature if(TSave!=T) { label i,j,k; - + aSave=0; daSave=0; d2aSave=0; b_=0; for (i=0;irealMixtureCorr_==true) { - // first and second order temperature derivative of the van der waals mixing rule for a(T) + // first and second order temperature derivative of the van der waals mixing rule for a(T) if(i==j) { aSave=aSave+amix(T,i,j); daSave=daSave+dadTmix(T,i,j); d2aSave=d2aSave+d2adT2mix(T,i,j); } - else + else { //CL: gives the position of the correction factor in the vector realMixtureCorrCoef_ k=i+j-1; aSave=aSave+amix(T,i,j)*(1-mixtureComponents[0]->realMixtureCorrCoef_[k]); daSave=daSave+dadTmix(T,i,j)*(1-mixtureComponents[0]->realMixtureCorrCoef_[k]); - d2aSave=d2aSave+d2adT2mix(T,i,j)*(1-mixtureComponents[0]->realMixtureCorrCoef_[k]); - } + d2aSave=d2aSave+d2adT2mix(T,i,j)*(1-mixtureComponents[0]->realMixtureCorrCoef_[k]); + } } else @@ -167,17 +167,17 @@ inline void mixturePengRobinson::updateModelCoefficients(const scalar T) const aSave=aSave+amix(T,i,j); daSave=daSave+dadTmix(T,i,j); d2aSave=d2aSave+d2adT2mix(T,i,j); - } + } } - //CL: getting b for the mixture + //CL: getting b for the mixture //CL: using van der waals mixing rule b_=b_+weigths[i]*mixtureComponents[i]->b()*this->W(); //CL: saving the temperature at which the mixture coefficients are valid TSave=T; } - + b2_=b_*b_; b3_=pow(b_,3); b4_=pow(b_,4); @@ -229,7 +229,7 @@ inline scalar mixturePengRobinson::d2adT2mix(const scalar T, const label i, cons -//returns the pressure for a given density and temperature +//returns the pressure for a given density and temperature inline scalar mixturePengRobinson::p(const scalar rho, const scalar T) const { updateModelCoefficients(T); @@ -237,7 +237,7 @@ inline scalar mixturePengRobinson::p(const scalar rho, const scalar T) const } -//Real deviative dp/dv at constant temperature +//Real deviative dp/dv at constant temperature //(molar values) inline scalar mixturePengRobinson::dpdv(const scalar rho, const scalar T) const { @@ -246,7 +246,7 @@ inline scalar mixturePengRobinson::dpdv(const scalar rho, const scalar T) const } -//Real deviative dp/dT at constant molar volume +//Real deviative dp/dT at constant molar volume //(molar values) inline scalar mixturePengRobinson::dpdT(const scalar rho, const scalar T) const { @@ -255,7 +255,7 @@ inline scalar mixturePengRobinson::dpdT(const scalar rho, const scalar T) const } -//Real deviative dv/dT at constant pressure +//Real deviative dv/dT at constant pressure //(molar values) inline scalar mixturePengRobinson::dvdT(const scalar rho, const scalar T) const { @@ -264,7 +264,7 @@ inline scalar mixturePengRobinson::dvdT(const scalar rho, const scalar T) const } -//Real deviative dv/dp at constant temperature +//Real deviative dv/dp at constant temperature //(molar values) inline scalar mixturePengRobinson::dvdp(const scalar rho, const scalar T) const { @@ -280,7 +280,7 @@ inline scalar mixturePengRobinson::integral_p_dv const scalar rho, const scalar T ) const -{ +{ updateModelCoefficients(T); return pengRobinson::integral_p_dv(rho,T); } @@ -304,7 +304,7 @@ inline scalar mixturePengRobinson::d2pdT2(const scalar rho, const scalar T) cons { updateModelCoefficients(T); return pengRobinson::d2pdT2(rho,T); -} +} //(molar values) @@ -331,7 +331,7 @@ inline scalar mixturePengRobinson::d2pdvdT(const scalar rho, const scalar T) con } -// the result of this intergal is needed for the nasa based cp polynomial +// the result of this intergal is needed for the nasa based cp polynomial //(molar values) inline scalar mixturePengRobinson::integral_d2pdT2_dv ( @@ -370,7 +370,7 @@ inline scalar mixturePengRobinson::isothermalCompressiblity } -//- Return density [kg/m^3]on +//- Return density [kg/m^3]on inline scalar mixturePengRobinson::rho ( const scalar p, @@ -383,7 +383,7 @@ inline scalar mixturePengRobinson::rho } -//- Return density [kg/m^3]on +//- Return density [kg/m^3]on inline scalar mixturePengRobinson::rho(const scalar p, const scalar T) const { updateModelCoefficients(T); @@ -422,9 +422,9 @@ inline void mixturePengRobinson::operator+=(const mixturePengRobinson& pr) weigths.setSize(2*numOfComp); mixtureComponents.setSize(2*numOfComp); } - - //Cl: oldClass+=pr - //CL: Saving the object pointer and weigths of pr (which is @ mixtureComponents[0] and weigths[0]) at the numOfComp's value of the oldClass + + //Cl: oldClass+=pr + //CL: Saving the object pointer and weigths of pr (which is @ mixtureComponents[0] and weigths[0]) at the numOfComp's value of the oldClass weigths[numOfComp]=pr.weigths[0]; mixtureComponents[numOfComp]=pr.mixtureComponents[0]; @@ -465,7 +465,7 @@ inline mixturePengRobinson operator+ mixtureComponents.setSize(2*pr1.numOfComp); } - //CL: Getting the new weigths and mixtureComponents lists, + //CL: Getting the new weigths and mixtureComponents lists, //CL: Saving the object pointer and weigths of pr2 (which is @ mixtureComponents[0] and weigths[0]) at the numOfComp's value of the new object weigths[pr1.numOfComp]=pr2.weigths[0]; mixtureComponents[pr1.numOfComp]=pr2.mixtureComponents[0]; @@ -484,7 +484,7 @@ inline mixturePengRobinson operator* //CL: saving the "concentraction" of the component of the mixture in the vector weights //CL: saved at the Position "numOfComp-1" DynamicList weigths=pr.weigths; - weigths[pr.numOfComp-1]=s*pr.nMoles(); + weigths[pr.numOfComp-1]=s*pr.nMoles(); return mixturePengRobinson(s*static_cast(pr), pr.numOfComp, weigths, pr.mixtureComponents,pr.a0_,pr.b_,pr.Tcrit_,pr.n_,pr.rhostd_, pr.rhoMin_, pr.rhoMax_); diff --git a/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/mixtures/mixtureRedlichKwong/mixtureRedlichKwong.C b/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/mixtures/mixtureRedlichKwong/mixtureRedlichKwong.C index b3abea406..ef19a9c55 100644 --- a/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/mixtures/mixtureRedlichKwong/mixtureRedlichKwong.C +++ b/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/mixtures/mixtureRedlichKwong/mixtureRedlichKwong.C @@ -28,7 +28,7 @@ Description Author Christian Lucas Institut für Thermodynamik -Technische Universität Braunschweig +Technische Universität Braunschweig Germany \*---------------------------------------------------------------------------*/ @@ -49,7 +49,7 @@ mixtureRedlichKwong::mixtureRedlichKwong(Istream& is) numOfComp(1), //CL: no real gas mixture correction when stream constructor is used realMixtureCorr_(false) -{ +{ //CL: set size of weigths and mixtureComponents to 10 //CL: when more mixture components are used //CL: size of the DynamicLis increases automatically @@ -98,22 +98,22 @@ mixtureRedlichKwong::mixtureRedlichKwong(const dictionary& dict) label i; label j; label k=0; - - + + // CL: saves the number of mixtureCorrectionCoefficients needed for this mixture // CL: need to be set to 1 label sizeOfVector_=1; //CL: size of the vector depends on the number of components - //CL: determine the size of the vector + //CL: determine the size of the vector for (i=3; i<=nCom_;i++) - { + { sizeOfVector_=sizeOfVector_+(i-1); } - - //CL: setting the size + + //CL: setting the size realMixtureCorrCoef_.setSize(sizeOfVector_); - + //CL: Reading the real mixture correction coefficients //CL: Naming convention e.g for 3 component mixture: //CL: mixtureCorrectionCoefficient_12, mixtureCorrectionCoefficient_13, mixtureCorrectionCoefficient_23 diff --git a/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/mixtures/mixtureRedlichKwong/mixtureRedlichKwong.H b/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/mixtures/mixtureRedlichKwong/mixtureRedlichKwong.H index 5b9839b30..6e565efc8 100644 --- a/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/mixtures/mixtureRedlichKwong/mixtureRedlichKwong.H +++ b/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/mixtures/mixtureRedlichKwong/mixtureRedlichKwong.H @@ -41,7 +41,7 @@ SourceFiles Author Christian Lucas Institut für Thermodynamik -Technische Universität Braunschweig +Technische Universität Braunschweig Germany \*---------------------------------------------------------------------------*/ @@ -72,23 +72,23 @@ class mixtureRedlichKwong : public redlichKwong { - // Private data - + // Private data + // Private functions //CL: function updates the model coefficients (a,b) of the mixture - //CL: this is the function with the mixing rule - inline void updateModelCoefficients() const; + //CL: this is the function with the mixing rule + inline void updateModelCoefficients() const; protected: - + //CL: save the concentrations of each component of the mixture //CL: needs to be multiplied by this->W() to get the molar fractions mutable DynamicList weigths; - + //CL: saves a pointer to the pure component classes of the mixture mutable DynamicList mixtureComponents; - + //CL: counts the number of components mutable label numOfComp; @@ -118,7 +118,7 @@ public: label numOfComp, DynamicList weigths, DynamicList mixtureComponents, - scalar a, + scalar a, scalar b, scalar rhostd, scalar rhoMin, diff --git a/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/mixtures/mixtureRedlichKwong/mixtureRedlichKwongI.H b/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/mixtures/mixtureRedlichKwong/mixtureRedlichKwongI.H index 44e419cc0..30fa13e3c 100644 --- a/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/mixtures/mixtureRedlichKwong/mixtureRedlichKwongI.H +++ b/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/mixtures/mixtureRedlichKwong/mixtureRedlichKwongI.H @@ -25,7 +25,7 @@ License Author Christian Lucas Institut für Thermodynamik -Technische Universität Braunschweig +Technische Universität Braunschweig Germany \*---------------------------------------------------------------------------*/ @@ -40,7 +40,7 @@ namespace Foam // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // Construct from components -// CL: needed for operator* +// CL: needed for operator* inline mixtureRedlichKwong::mixtureRedlichKwong ( const redlichKwong& rK, @@ -53,7 +53,7 @@ inline mixtureRedlichKwong::mixtureRedlichKwong scalar rhoMin, scalar rhoMax ) -: +: redlichKwong(rK), weigths(weigths), mixtureComponents(mixtureComponents), @@ -82,7 +82,7 @@ inline mixtureRedlichKwong::mixtureRedlichKwong scalar rhoMin, scalar rhoMax ) -: +: redlichKwong(rK), weigths(weigths), mixtureComponents(mixtureComponents), @@ -126,15 +126,15 @@ inline autoPtr mixtureRedlichKwong::New(Istream& is) //CL: updates the coefficents of the model after the final construction of the mixture //CL: uses the van der waals mixing rule inline void mixtureRedlichKwong::updateModelCoefficients() const -{ +{ label i,j,k; - + a_=0; b_=0; for (i=0;ia()*mixtureComponents[j]->a(),0.5)*this->W()*this->W(); - } - //CL: getting b for the mixture + a_=a_+weigths[i]*weigths[j]*pow(mixtureComponents[i]->a()*mixtureComponents[j]->a(),0.5)*this->W()*this->W(); + } + //CL: getting b for the mixture //CL: using van der waals mixing rule b_=b_+weigths[i]*mixtureComponents[i]->b()*this->W(); } } - + b2_=b_*b_; b3_=pow(b_,3); b5_=pow(b_,4); @@ -182,8 +182,8 @@ inline void mixtureRedlichKwong::operator+=(const mixtureRedlichKwong& rK) mixtureComponents.setSize(2*numOfComp); } - //Cl: oldClass+=rK - //CL: Saving the object pointer and weigths of rK (which is @ mixtureComponents[0] and weigths[0]) at the numOfComp's value of the oldClass + //Cl: oldClass+=rK + //CL: Saving the object pointer and weigths of rK (which is @ mixtureComponents[0] and weigths[0]) at the numOfComp's value of the oldClass weigths[numOfComp]=rK.weigths[0]; mixtureComponents[numOfComp]=rK.mixtureComponents[0]; @@ -223,7 +223,7 @@ inline mixtureRedlichKwong operator+ mixtureComponents.setSize(2*rK1.numOfComp); } - //CL: Getting the new weigths and mixtureComponents lists, + //CL: Getting the new weigths and mixtureComponents lists, //CL: Saving the object pointer and weigths of rK2 (which is @ mixtureComponents[0] and weigths[0]) at the numOfComp's value of the new object weigths[rK1.numOfComp]=rK2.weigths[0]; mixtureComponents[rK1.numOfComp]=rK2.mixtureComponents[0]; @@ -241,9 +241,9 @@ inline mixtureRedlichKwong operator* { //CL: saving the "concentraction" of the component of the mixture in the vector weights DynamicList weigths=rK.weigths; - weigths[rK.numOfComp-1]=s*rK.nMoles(); + weigths[rK.numOfComp-1]=s*rK.nMoles(); - return mixtureRedlichKwong(s*static_cast(rK), rK.numOfComp, weigths, + return mixtureRedlichKwong(s*static_cast(rK), rK.numOfComp, weigths, rK.mixtureComponents,rK.a_,rK.b_,rK.rhostd_, rK.rhoMin_, rK.rhoMax_); } diff --git a/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/mixtures/mixtureSoaveRedlichKwong/mixtureSoaveRedlichKwong.C b/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/mixtures/mixtureSoaveRedlichKwong/mixtureSoaveRedlichKwong.C index b11f3fed1..54f28cb92 100644 --- a/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/mixtures/mixtureSoaveRedlichKwong/mixtureSoaveRedlichKwong.C +++ b/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/mixtures/mixtureSoaveRedlichKwong/mixtureSoaveRedlichKwong.C @@ -28,7 +28,7 @@ Description Author Christian Lucas Institut für Thermodynamik -Technische Universität Braunschweig +Technische Universität Braunschweig Germany \*---------------------------------------------------------------------------*/ @@ -50,7 +50,7 @@ mixtureSoaveRedlichKwong::mixtureSoaveRedlichKwong(Istream& is) numOfComp(1), //CL: no real gas mixture correction when stream constructor is used realMixtureCorr_(false) -{ +{ //CL: set size of weigths, mixtureComponents ... to 10, //CL: when more mixture componentents are used //CL: size of the DynamicLis increases automatically @@ -72,7 +72,7 @@ mixtureSoaveRedlichKwong::mixtureSoaveRedlichKwong(const dictionary& dict) numOfComp(1), singleComponent(1), realMixtureCorr_(dict.subDict("equationOfState").lookupOrDefault("realMixtureCorrection",false)) -{ +{ //CL: set size of weigths, mixtureComponents ... to 10, //CL: when more mixture componentents are used //CL: size of the DynamicLis increases automatically @@ -101,21 +101,21 @@ mixtureSoaveRedlichKwong::mixtureSoaveRedlichKwong(const dictionary& dict) label i; label j; label k=0; - + // CL: saves the number of mixtureCorrectionCoefficients needed for this mixture // CL: need to be set to 1 label sizeOfVector_=1; //CL: size of the vector depends on the number of components - //CL: determine the size of the vector + //CL: determine the size of the vector for (i=3; i<=nCom_;i++) - { + { sizeOfVector_=sizeOfVector_+(i-1); } - - //CL: setting the size + + //CL: setting the size realMixtureCorrCoef_.setSize(sizeOfVector_); - + //CL: Reading the real mixture correction coefficients //CL: Naming convention e.g for 3 component mixture: //CL: mixtureCorrectionCoefficient_12, mixtureCorrectionCoefficient_13, mixtureCorrectionCoefficient_23 diff --git a/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/mixtures/mixtureSoaveRedlichKwong/mixtureSoaveRedlichKwong.H b/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/mixtures/mixtureSoaveRedlichKwong/mixtureSoaveRedlichKwong.H index 7dbd69c2a..829c8200d 100644 --- a/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/mixtures/mixtureSoaveRedlichKwong/mixtureSoaveRedlichKwong.H +++ b/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/mixtures/mixtureSoaveRedlichKwong/mixtureSoaveRedlichKwong.H @@ -41,7 +41,7 @@ SourceFiles Author Christian Lucas Institut für Thermodynamik -Technische Universität Braunschweig +Technische Universität Braunschweig Germany \*---------------------------------------------------------------------------*/ @@ -77,33 +77,33 @@ protected: //CL: bool used to make sure the model behaves like a single component model when needed //CL: this is needed during the construction of the mixture - mutable bool singleComponent; - + mutable bool singleComponent; + //CL: save the concentrations of each component of the mixture //CL: needs to be multiplied by this->W() to get the molar fractions mutable DynamicList weigths; - + //CL: saves a pointer to the pure component classes of the mixture mutable DynamicList mixtureComponents; - + //CL: counts the number of components mutable label numOfComp; //Protected functions - //CL: function updates the coefficients (aSave, daSave, d2aSave, b) of the mixture - inline void updateModelCoefficients(const scalar T) const; + //CL: function updates the coefficients (aSave, daSave, d2aSave, b) of the mixture + inline void updateModelCoefficients(const scalar T) const; //CL: Variables used in real gas mixture correction //CL: If true, the real gas mixture correction is used mutable bool realMixtureCorr_; - + //CL: number of mixture components, needed to calculate the mixture correction factors needed //CL: do not mistake this variable with numOfComp, //CL: numOfComp is a counter to counts the number of components while the mixture is constructed mutable label nCom_; - + //CL: stores real mixture correction coefficients mutable DynamicList realMixtureCorrCoef_; @@ -120,7 +120,7 @@ public: label numOfComp, DynamicList weigths, DynamicList mixtureComponents, - scalar a0, + scalar a0, scalar b, scalar Tcrit, scalar n, @@ -160,29 +160,29 @@ public: //CL: mixture coefficience inline scalar amix(const scalar T, const label i, const label j) const; - + inline scalar dadTmix(const scalar T, const label i, const label j) const; inline scalar d2adT2mix(const scalar T, const label i, const label j) const; inline scalar p(const scalar rho, const scalar T) const; - //first order derivatives + //first order derivatives inline scalar dpdv(const scalar rho, const scalar T) const; inline scalar dpdT(const scalar rho, const scalar T) const; inline scalar dvdT(const scalar rho, const scalar T) const; - inline scalar dvdp(const scalar rho, const scalar T) const; + inline scalar dvdp(const scalar rho, const scalar T) const; - inline scalar isobarExpCoef(const scalar rho, const scalar T) const; + inline scalar isobarExpCoef(const scalar rho, const scalar T) const; inline scalar isothermalCompressiblity ( const scalar rho, const scalar T - ) const; + ) const; // Used for cv inline scalar integral_d2pdT2_dv @@ -192,7 +192,7 @@ public: ) const; //Used for internal Energy - inline scalar integral_p_dv(const scalar rho, const scalar T) const; + inline scalar integral_p_dv(const scalar rho, const scalar T) const; // Used for Entropy inline scalar integral_dpdT_dv(const scalar rho, const scalar T) const; @@ -217,7 +217,7 @@ public: inline scalar rho(const scalar p, const scalar T) const; - //- Return compressibility drho/dp at T=constant [s^2/m^2] + //- Return compressibility drho/dp at T=constant [s^2/m^2] inline scalar psi(const scalar rho, const scalar T) const; //- Return compression factor [] diff --git a/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/mixtures/mixtureSoaveRedlichKwong/mixtureSoaveRedlichKwongI.H b/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/mixtures/mixtureSoaveRedlichKwong/mixtureSoaveRedlichKwongI.H index 9791dc217..af4aa1bd6 100644 --- a/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/mixtures/mixtureSoaveRedlichKwong/mixtureSoaveRedlichKwongI.H +++ b/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/mixtures/mixtureSoaveRedlichKwong/mixtureSoaveRedlichKwongI.H @@ -25,7 +25,7 @@ License Author Christian Lucas Institut für Thermodynamik -Technische Universität Braunschweig +Technische Universität Braunschweig Germany \*---------------------------------------------------------------------------*/ @@ -40,7 +40,7 @@ namespace Foam // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // Construct from components -// CL: needed for operator* +// CL: needed for operator* inline mixtureSoaveRedlichKwong::mixtureSoaveRedlichKwong ( const soaveRedlichKwong& srk, @@ -55,7 +55,7 @@ inline mixtureSoaveRedlichKwong::mixtureSoaveRedlichKwong scalar rhoMin, scalar rhoMax ) -: +: soaveRedlichKwong(srk), singleComponent(1), weigths(weigths), @@ -64,7 +64,7 @@ inline mixtureSoaveRedlichKwong::mixtureSoaveRedlichKwong { a0_=a0; b_=b; - Tcrit_=Tcrit; + Tcrit_=Tcrit; n_=n; rhostd_=rhostd; rhoMin_=rhoMin; @@ -83,7 +83,7 @@ inline mixtureSoaveRedlichKwong::mixtureSoaveRedlichKwong scalar rhoMin, scalar rhoMax ) -: +: soaveRedlichKwong(srk), singleComponent(0), weigths(weigths), @@ -123,23 +123,23 @@ inline autoPtr mixtureSoaveRedlichKwong::New(Istream& //CL: updates the coefficents of the model after the final construction of the mixture //CL: uses the van der waals mixing rule inline void mixtureSoaveRedlichKwong::updateModelCoefficients(const scalar T) const -{ - // CL: to make sure that the coefficents are only updated if the mixture has more than 1 component +{ + // CL: to make sure that the coefficents are only updated if the mixture has more than 1 component if (singleComponent==0) - { + { // Checking if the mixture coefficient were already calculated for this temperature if(TSave!=T) { label i,j,k; - + aSave=0; daSave=0; d2aSave=0; b_=0; for (i=0;irealMixtureCorr_==true) { - // first and second order temperature derivative of the van der waals mixing rule for a(T) + // first and second order temperature derivative of the van der waals mixing rule for a(T) if(i==j) { aSave=aSave+amix(T,i,j); daSave=daSave+dadTmix(T,i,j); d2aSave=d2aSave+d2adT2mix(T,i,j); } - else + else { //CL: gives the position of the correction factor in the vector realMixtureCorrCoef_ k=i+j-1; aSave=aSave+amix(T,i,j)*(1-mixtureComponents[0]->realMixtureCorrCoef_[k]); daSave=daSave+dadTmix(T,i,j)*(1-mixtureComponents[0]->realMixtureCorrCoef_[k]); - d2aSave=d2aSave+d2adT2mix(T,i,j)*(1-mixtureComponents[0]->realMixtureCorrCoef_[k]); - } + d2aSave=d2aSave+d2adT2mix(T,i,j)*(1-mixtureComponents[0]->realMixtureCorrCoef_[k]); + } } else @@ -170,17 +170,17 @@ inline void mixtureSoaveRedlichKwong::updateModelCoefficients(const scalar T) c aSave=aSave+amix(T,i,j); daSave=daSave+dadTmix(T,i,j); d2aSave=d2aSave+d2adT2mix(T,i,j); - } + } } - //CL: getting b for the mixture + //CL: getting b for the mixture //CL: using van der waals mixing rule b_=b_+weigths[i]*mixtureComponents[i]->b()*this->W(); //CL: saving the temperature at which the mixture coefficients are valid TSave=T; } - + b2_=b_*b_; b3_=pow(b_,3); b5_=pow(b_,5); @@ -228,7 +228,7 @@ inline scalar mixtureSoaveRedlichKwong::d2adT2mix(const scalar T, const label i, ); } -//returns the pressure for a given density and temperature +//returns the pressure for a given density and temperature inline scalar mixtureSoaveRedlichKwong::p(const scalar rho, const scalar T) const { updateModelCoefficients(T); @@ -236,7 +236,7 @@ inline scalar mixtureSoaveRedlichKwong::p(const scalar rho, const scalar T) cons } -//Real deviative dp/dv at constant temperature +//Real deviative dp/dv at constant temperature //(molar values) inline scalar mixtureSoaveRedlichKwong::dpdv(const scalar rho, const scalar T) const { @@ -245,7 +245,7 @@ inline scalar mixtureSoaveRedlichKwong::dpdv(const scalar rho, const scalar T) c } -//Real deviative dp/dT at constant molar volume +//Real deviative dp/dT at constant molar volume //(molar values) inline scalar mixtureSoaveRedlichKwong::dpdT(const scalar rho, const scalar T) const { @@ -254,7 +254,7 @@ inline scalar mixtureSoaveRedlichKwong::dpdT(const scalar rho, const scalar T) c } -//Real deviative dv/dT at constant pressure +//Real deviative dv/dT at constant pressure //(molar values) inline scalar mixtureSoaveRedlichKwong::dvdT(const scalar rho, const scalar T) const { @@ -263,7 +263,7 @@ inline scalar mixtureSoaveRedlichKwong::dvdT(const scalar rho, const scalar T) c } -//Real deviative dv/dp at constant temperature +//Real deviative dv/dp at constant temperature //(molar values) inline scalar mixtureSoaveRedlichKwong::dvdp(const scalar rho, const scalar T) const { @@ -279,7 +279,7 @@ inline scalar mixtureSoaveRedlichKwong::integral_p_dv const scalar rho, const scalar T ) const -{ +{ updateModelCoefficients(T); return soaveRedlichKwong::integral_p_dv(rho,T); } @@ -303,7 +303,7 @@ inline scalar mixtureSoaveRedlichKwong::d2pdT2(const scalar rho, const scalar T) { updateModelCoefficients(T); return soaveRedlichKwong::d2pdT2(rho,T); -} +} //(molar values) @@ -330,7 +330,7 @@ inline scalar mixtureSoaveRedlichKwong::d2pdvdT(const scalar rho, const scalar T } -// the result of this intergal is needed for the nasa based cp polynomial +// the result of this intergal is needed for the nasa based cp polynomial //(molar values) inline scalar mixtureSoaveRedlichKwong::integral_d2pdT2_dv ( @@ -369,7 +369,7 @@ inline scalar mixtureSoaveRedlichKwong::isothermalCompressiblity } -//- Return density [kg/m^3]on +//- Return density [kg/m^3]on inline scalar mixtureSoaveRedlichKwong::rho ( const scalar p, @@ -383,7 +383,7 @@ inline scalar mixtureSoaveRedlichKwong::rho } -//- Return density [kg/m^3]on +//- Return density [kg/m^3]on inline scalar mixtureSoaveRedlichKwong::rho(const scalar p, const scalar T) const { updateModelCoefficients(T); @@ -423,8 +423,8 @@ inline void mixtureSoaveRedlichKwong::operator+=(const mixtureSoaveRedlichKwong& mixtureComponents.setSize(2*numOfComp); } - //Cl: oldClass+=srk - //CL: Saving the object pointer and weigths of pr (which is @ mixtureComponents[0] and weigths[0]) at the numOfComp's value of the oldClass + //Cl: oldClass+=srk + //CL: Saving the object pointer and weigths of pr (which is @ mixtureComponents[0] and weigths[0]) at the numOfComp's value of the oldClass weigths[numOfComp]=srk.weigths[0]; mixtureComponents[numOfComp]=srk.mixtureComponents[0]; @@ -466,7 +466,7 @@ inline mixtureSoaveRedlichKwong operator+ mixtureComponents.setSize(2*srk1.numOfComp); } - //CL: Getting the new weigths and mixtureComponents lists, + //CL: Getting the new weigths and mixtureComponents lists, //CL: Saving the object pointer and weigths of srk2 (which is @ mixtureComponents[0] and weigths[0]) at the numOfComp's value of the new object weigths[srk1.numOfComp]=srk2.weigths[0]; mixtureComponents[srk1.numOfComp]=srk2.mixtureComponents[0]; @@ -485,7 +485,7 @@ inline mixtureSoaveRedlichKwong operator* //CL: saving the "concentraction" of the component of the mixture in the vector weights //CL: saved at the Position "numOfComp-1" DynamicList weigths=srk.weigths; - weigths[srk.numOfComp-1]=s*srk.nMoles(); + weigths[srk.numOfComp-1]=s*srk.nMoles(); return mixtureSoaveRedlichKwong(s*static_cast(srk), srk.numOfComp, weigths, srk.mixtureComponents,srk.a0_,srk.b_,srk.Tcrit_,srk.n_,srk.rhostd_, srk.rhoMin_, srk.rhoMax_); diff --git a/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/pengRobinson/pengRobinson.C b/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/pengRobinson/pengRobinson.C index c5e15ca52..6da4a239f 100755 --- a/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/pengRobinson/pengRobinson.C +++ b/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/pengRobinson/pengRobinson.C @@ -28,7 +28,7 @@ Description Author Christian Lucas Institut für Thermodynamik -Technische Universität Braunschweig +Technische Universität Braunschweig Germany \*---------------------------------------------------------------------------*/ @@ -81,14 +81,14 @@ pengRobinson::pengRobinson(const dictionary& dict) rhoMin_(dict.subDict("equationOfState").lookupOrDefault("rhoMin",1e-3)), rhoMax_(dict.subDict("equationOfState").lookupOrDefault("rhoMax",1500)), a0_(0.457235*pow(this->RR(),2)*pow(Tcrit_,2)/pcrit_), - b_(0.077796*this->RR()*Tcrit_/pcrit_), + b_(0.077796*this->RR()*Tcrit_/pcrit_), n_(0.37464+1.54226*azentricFactor_-0.26992*pow(azentricFactor_,2)), - TSave(0.0), + TSave(0.0), b2_(pow(b_,2)), b3_(pow(b_,3)), b4_(pow(b_,4)), b5_(pow(b_,5)), - rhostd_(this->rho(Pstd,Tstd,Pstd/(Tstd*this->R()))) + rhostd_(this->rho(Pstd,Tstd,Pstd/(Tstd*this->R()))) {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // @@ -111,7 +111,7 @@ void Foam::pengRobinson::write(Ostream& os) const Ostream& operator<<(Ostream& os, const pengRobinson& pr) { - os << static_cast(pr)<< token::SPACE + os << static_cast(pr)<< token::SPACE << pr.pcrit_ << tab<< pr.Tcrit_<< tab << pr.azentricFactor_; os.check("Ostream& operator<<(Ostream& os, const pengRobinson& st)"); diff --git a/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/pengRobinson/pengRobinson.H b/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/pengRobinson/pengRobinson.H index c44c93413..fc0d4e1ba 100755 --- a/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/pengRobinson/pengRobinson.H +++ b/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/pengRobinson/pengRobinson.H @@ -42,7 +42,7 @@ SourceFiles Author Christian Lucas Institut für Thermodynamik -Technische Universität Braunschweig +Technische Universität Braunschweig Germany \*---------------------------------------------------------------------------*/ @@ -72,11 +72,11 @@ class pengRobinson protected: // Protected data scalar pcrit_; - scalar Tcrit_; + scalar Tcrit_; scalar azentricFactor_; //-Peng Robinson factors - scalar n_; + scalar n_; scalar a0_; mutable scalar b_; @@ -104,10 +104,10 @@ protected: //Protected functions //CL: function updates the coefficients (aSave, daSave, d2aSave) - inline void updateModelCoefficients(const scalar T) const; + inline void updateModelCoefficients(const scalar T) const; public: - + // Constructors @@ -163,33 +163,33 @@ public: //CL: Equation of state inline scalar p(const scalar rho, const scalar T) const; - //CL: first order derivatives + //CL: first order derivatives inline scalar dpdv(const scalar rho,const scalar T) const; inline scalar dpdT(const scalar rho, const scalar T) const; inline scalar dvdT(const scalar rho,const scalar T) const; - inline scalar dvdp(const scalar rho, const scalar T) const; + inline scalar dvdp(const scalar rho, const scalar T) const; inline scalar isobarExpCoef ( const scalar rho, const scalar T - ) const; + ) const; inline scalar isothermalCompressiblity ( const scalar rho, const scalar T - ) const; + ) const; //CL: Used for cv inline scalar integral_d2pdT2_dv - ( + ( const scalar rho, const scalar T - ) const ; + ) const ; //CL: second order derivatives, not Used At The Moment inline scalar d2pdv2(const scalar rho,const scalar T) const; @@ -202,11 +202,11 @@ public: //CL: Used for internal Energy inline scalar integral_p_dv(const scalar rho,const scalar T) const; - + //CL: Used for Entropy inline scalar integral_dpdT_dv(const scalar rho,const scalar T) const; - //- Return density [kg/m^3] + //- Return density [kg/m^3] // rho0 is the starting point of the newton solver used to calculate rho inline scalar rho ( diff --git a/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/pengRobinson/pengRobinsonI.H b/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/pengRobinson/pengRobinsonI.H index f471b90ad..01a501d97 100755 --- a/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/pengRobinson/pengRobinsonI.H +++ b/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/pengRobinson/pengRobinsonI.H @@ -25,7 +25,7 @@ License Author Christian Lucas Institut für Thermodynamik -Technische Universität Braunschweig +Technische Universität Braunschweig Germany \*---------------------------------------------------------------------------*/ @@ -42,11 +42,11 @@ namespace Foam // Construct from components inline pengRobinson::pengRobinson ( - const specie& sp + const specie& sp ) : specie(sp), - TSave(0) + TSave(0) {} @@ -107,15 +107,15 @@ inline scalar pengRobinson::a(const scalar T)const { //CL: check if a has already been calculated for this temperature if(TSave==T) - { - return aSave; + { + return aSave; } //CL: If not, recalculate a(T), dadT(T) and d2adT2(T) else { updateModelCoefficients(T); return aSave; - } + } } @@ -125,14 +125,14 @@ inline scalar pengRobinson::dadT(const scalar T)const // check if a has already been calculated for this temperature if(TSave==T) { - return daSave; + return daSave; } //CL: If not, recalculate a(T), dadT(T) and d2adT2(T) else { updateModelCoefficients(T); return daSave; - } + } } @@ -142,14 +142,14 @@ inline scalar pengRobinson::d2adT2(const scalar T)const // check if a has already been calculated for this temperature if(TSave==T) { - return d2aSave; + return d2aSave; } //CL: If not, recalculate a(T), dadT(T) and d2adT2(T) else { updateModelCoefficients(T); return d2aSave; - } + } } @@ -191,16 +191,16 @@ inline scalar pengRobinson::b5()const return b5_; } -//returns the pressure for a given density and temperature +//returns the pressure for a given density and temperature inline scalar pengRobinson::p(const scalar rho,const scalar T) const { scalar Vm = this->W()/rho; - + return this->RR()*T/(Vm-b())-a(T)/(pow(Vm,2)+2*b()*Vm-b2()); } -//Real deviative dp/dv at constant temperature +//Real deviative dp/dv at constant temperature //(molar values) inline scalar pengRobinson::dpdv(const scalar rho, const scalar T) const { @@ -223,7 +223,7 @@ inline scalar pengRobinson::dpdv(const scalar rho, const scalar T) const } -//Real deviative dp/dT at constant molar volume +//Real deviative dp/dT at constant molar volume //(molar values) inline scalar pengRobinson::dpdT(const scalar rho, const scalar T) const { @@ -233,7 +233,7 @@ inline scalar pengRobinson::dpdT(const scalar rho, const scalar T) const } -//Real deviative dv/dT at constant pressure +//Real deviative dv/dT at constant pressure //by using implicit differentiation //(molar values) inline scalar pengRobinson::dvdT(const scalar rho,const scalar T) const @@ -243,7 +243,7 @@ inline scalar pengRobinson::dvdT(const scalar rho,const scalar T) const //(molar values) -inline scalar pengRobinson::dvdp(const scalar rho,const scalar T) const +inline scalar pengRobinson::dvdp(const scalar rho,const scalar T) const { return 1/this->dpdv(rho,T); } @@ -306,10 +306,10 @@ inline scalar pengRobinson::d2pdv2(const scalar rho,const scalar T) const //(molar values) -//using second order implicit differentiation +//using second order implicit differentiation inline scalar pengRobinson::d2vdT2(const scalar rho, const scalar T) const { - return + return -( pow(this->dpdT(rho,T),2)*this->d2pdv2(rho,T) + pow(this->dpdv(rho,T),2)*this->d2pdT2(rho,T) @@ -325,7 +325,7 @@ inline scalar pengRobinson::d2pdvdT(const scalar rho, const scalar T) const scalar Vm = this->W()/rho; scalar Vm2 = Vm*Vm; scalar Vm3 = Vm*Vm*Vm; - + return( 2*dadT(T)* ( @@ -341,9 +341,9 @@ inline scalar pengRobinson::d2pdvdT(const scalar rho, const scalar T) const } -// the result of this intergal is needed for the nasa based cp polynomial +// the result of this intergal is needed for the nasa based cp polynomial //(molar values) -inline scalar pengRobinson::integral_d2pdT2_dv(const scalar rho,const scalar T) const +inline scalar pengRobinson::integral_d2pdT2_dv(const scalar rho,const scalar T) const { scalar Vm = this->W()/rho; @@ -364,7 +364,7 @@ inline scalar pengRobinson::isobarExpCoef(const scalar rho,const scalar T) cons inline scalar pengRobinson::isothermalCompressiblity(const scalar rho,const scalar T) const { return this->isobarExpCoef(rho, T)/this->dpdT(rho, T); - //CL: also possible + //CL: also possible //CL: return -this->dvdp(rho,T)*rho/this->W(); } @@ -401,7 +401,7 @@ inline scalar pengRobinson::rho( )/pow(2,i); i++; - if (i>8) + if (i>8) { //CL: using bisection methode as backup, //CL: solution must be between rho=0.001 to rho=1500; @@ -416,7 +416,7 @@ inline scalar pengRobinson::rho( if ((f2 < 0 && f3 > 0) || (f2 > 0 && f3 < 0)) { rho1=rho3; - } + } else if ((f1 < 0 && f3 > 0)||(f1 > 0 && f3 < 0)) { rho2=rho3; @@ -430,7 +430,7 @@ inline scalar pengRobinson::rho( { molarVolume=this->W()/rho3; molarVolumePrevIteration=this->W()/rho3; - break; + break; } else { @@ -460,15 +460,15 @@ inline scalar pengRobinson::rho( } -//- Return density [kg/m^3]on +//- Return density [kg/m^3]on inline scalar pengRobinson::rho(const scalar p,const scalar T) const { // using perfect gas equation as starting point - return rho(p,T,p/(this->R()*T)); + return rho(p,T,p/(this->R()*T)); } -//- Return compressibility drho/dp at T=constant [s^2/m^2] +//- Return compressibility drho/dp at T=constant [s^2/m^2] inline scalar pengRobinson::psi(const scalar rho, const scalar T) const { return -this->dvdp(rho,T)*pow(rho,2)/this->W(); diff --git a/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/redlichKwong/redlichKwong.C b/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/redlichKwong/redlichKwong.C index d6e51bf1c..938cec729 100755 --- a/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/redlichKwong/redlichKwong.C +++ b/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/redlichKwong/redlichKwong.C @@ -28,7 +28,7 @@ Description Author Christian Lucas Institut für Thermodynamik -Technische Universität Braunschweig +Technische Universität Braunschweig Germany \*---------------------------------------------------------------------------*/ @@ -58,7 +58,7 @@ redlichKwong::redlichKwong(Istream& is) rhoMin_(1e-3), // Starting GUESS for the density by ideal gas law rhostd_(this->rho(this->Pstd(), this->Tstd(), this->Pstd()/(this->Tstd()*this->R()))) -{ +{ is.check("redlichKwong::redlichKwong(Istream& is)"); } //CL: Constructed needed in OpenFOAM 2.x.x @@ -81,7 +81,7 @@ redlichKwong::redlichKwong(const dictionary& dict) b3_(pow(b_,3)), b5_(pow(b_,5)), // Starting GUESS for the density by ideal gas law - rhostd_(this->rho(Pstd, Tstd, Pstd/(Tstd*this->R()))) + rhostd_(this->rho(Pstd, Tstd, Pstd/(Tstd*this->R()))) {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // @@ -104,7 +104,7 @@ void Foam::redlichKwong::write(Ostream& os) const Ostream& operator<<(Ostream& os, const redlichKwong& rk) { - os << static_cast(rk)<< token::SPACE + os << static_cast(rk)<< token::SPACE << rk.pcrit_ << tab<< rk.Tcrit_; os.check("Ostream& operator<<(Ostream& os, const redlichKwong& st)"); diff --git a/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/redlichKwong/redlichKwong.H b/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/redlichKwong/redlichKwong.H index 303b47c46..4c8ef580d 100755 --- a/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/redlichKwong/redlichKwong.H +++ b/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/redlichKwong/redlichKwong.H @@ -35,7 +35,7 @@ SourceFiles Author Christian Lucas Institut für Thermodynamik -Technische Universität Braunschweig +Technische Universität Braunschweig Germany \*---------------------------------------------------------------------------*/ @@ -65,7 +65,7 @@ protected: // Protected data scalar pcrit_; - scalar Tcrit_; + scalar Tcrit_; //-Redlich Kwong factors mutable scalar a_; @@ -84,7 +84,7 @@ protected: mutable scalar rhostd_; public: - + // Constructors //- Construct from components @@ -127,22 +127,22 @@ public: inline scalar b5()const; - //first order derivatives + //first order derivatives inline scalar dpdv(const scalar rho, const scalar T) const; inline scalar dpdT(const scalar rho, const scalar T) const; inline scalar dvdT(const scalar rho, const scalar T) const; - inline scalar dvdp(const scalar rho, const scalar T) const; + inline scalar dvdp(const scalar rho, const scalar T) const; - inline scalar isobarExpCoef(const scalar rho, const scalar T) const; + inline scalar isobarExpCoef(const scalar rho, const scalar T) const; inline scalar isothermalCompressiblity ( const scalar rho, const scalar T - ) const; + ) const; // Used for cv inline scalar integral_d2pdT2_dv @@ -152,7 +152,7 @@ public: ) const; //Used for internal Energy - inline scalar integral_p_dv(const scalar rho, const scalar T) const; + inline scalar integral_p_dv(const scalar rho, const scalar T) const; // Used for Entropy inline scalar integral_dpdT_dv(const scalar rho, const scalar T) const; @@ -177,7 +177,7 @@ public: inline scalar rho(const scalar p, const scalar T) const; - //- Return compressibility drho/dp at T=constant [s^2/m^2] + //- Return compressibility drho/dp at T=constant [s^2/m^2] inline scalar psi(const scalar rho, const scalar T) const; //- Return compression factor [] @@ -198,7 +198,7 @@ public: // Member operators inline void operator+=(const redlichKwong&); -/* +/* inline void operator-=(const redlichKwong&); inline void operator*=(const scalar); */ diff --git a/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/redlichKwong/redlichKwongI.H b/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/redlichKwong/redlichKwongI.H index 4cc6f16c0..d27532a00 100755 --- a/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/redlichKwong/redlichKwongI.H +++ b/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/redlichKwong/redlichKwongI.H @@ -25,7 +25,7 @@ License Author Christian Lucas Institut für Thermodynamik -Technische Universität Braunschweig +Technische Universität Braunschweig Germany \*---------------------------------------------------------------------------*/ @@ -114,15 +114,15 @@ inline scalar redlichKwong::b5()const -//returns the pressure for a given density and temperature +//returns the pressure for a given density and temperature inline scalar redlichKwong::p(const scalar rho, const scalar T) const { - scalar Vm = this->W()/rho; + scalar Vm = this->W()/rho; return this->RR()*T/(Vm - b_) - a_/(sqrt(T)*Vm*(Vm + b_)); } -//Real deviative dp/dv at constant temperature +//Real deviative dp/dv at constant temperature //(molar values) inline scalar redlichKwong::dpdv(const scalar rho, const scalar T) const { @@ -135,7 +135,7 @@ inline scalar redlichKwong::dpdv(const scalar rho, const scalar T) const } -//Real deviative dp/dT at constant molar volume +//Real deviative dp/dT at constant molar volume //(molar values) inline scalar redlichKwong::dpdT(const scalar rho, const scalar T) const { @@ -144,7 +144,7 @@ inline scalar redlichKwong::dpdT(const scalar rho, const scalar T) const } -//Real deviative dv/dT at constant pressure +//Real deviative dv/dT at constant pressure //using implicit differentiation //(molar values) inline scalar redlichKwong::dvdT(const scalar rho, const scalar T) const @@ -153,9 +153,9 @@ inline scalar redlichKwong::dvdT(const scalar rho, const scalar T) const } -//Real deviative dv/dp at constant temperature +//Real deviative dv/dp at constant temperature //(molar values) -inline scalar redlichKwong::dvdp(const scalar rho, const scalar T) const +inline scalar redlichKwong::dvdp(const scalar rho, const scalar T) const { return 1/this->dpdv(rho,T); } @@ -224,10 +224,10 @@ inline scalar redlichKwong::d2pdv2(const scalar rho, const scalar T) const //(molar values) -//using second Order implicit differentiation +//using second Order implicit differentiation inline scalar redlichKwong::d2vdT2(const scalar rho, const scalar T) const { - return + return -( pow(this->dpdT(rho,T),2)*this->d2pdv2(rho,T) + pow(this->dpdv(rho,T),2)*this->d2pdT2(rho,T) @@ -242,7 +242,7 @@ inline scalar redlichKwong::d2pdvdT(const scalar rho, const scalar T) const { scalar Vm = this->W()/rho; scalar Vm2 = Vm*Vm; - + return -(0.5*( a_*(b3() - 3*b_*Vm2 + 2*pow(Vm,3)) @@ -252,13 +252,13 @@ inline scalar redlichKwong::d2pdvdT(const scalar rho, const scalar T) const } -// the result of this intergal is needed for the nasa based cp polynomial +// the result of this intergal is needed for the nasa based cp polynomial //(molar values) inline scalar redlichKwong::integral_d2pdT2_dv ( const scalar rho, const scalar T -) const +) const { scalar Vm = this->W()/rho; return 0.75*a_*log(b_ + Vm)/(pow(T,2.5)*b_) @@ -299,7 +299,7 @@ inline scalar redlichKwong::rho const scalar rho0 ) const { - + scalar molarVolumePrevIteration; scalar molarVolume; label iter=0; @@ -313,7 +313,7 @@ inline scalar redlichKwong::rho do { molarVolumePrevIteration= molarVolume; - + label i=0; do { @@ -325,7 +325,7 @@ inline scalar redlichKwong::rho )/pow(2,i); i++; - if (i>8) + if (i>8) { //CL: using bisection methode as backup, //CL: solution must be between rhoMin_ to rhoMax @@ -339,7 +339,7 @@ inline scalar redlichKwong::rho if ((f2 < 0 && f3 > 0) || (f2 > 0 && f3 < 0)) { rho1=rho3; - } + } else if ((f1 < 0 && f3 > 0)||(f1 > 0 && f3 < 0)) { rho2=rho3; @@ -353,7 +353,7 @@ inline scalar redlichKwong::rho { molarVolume=this->W()/rho3; molarVolumePrevIteration=this->W()/rho3; - break; + break; } else { @@ -383,7 +383,7 @@ inline scalar redlichKwong::rho } -//- Return density [kg/m^3]on +//- Return density [kg/m^3]on inline scalar redlichKwong::rho(const scalar p, const scalar T) const { // using perfect gas equation as starting point diff --git a/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/soaveRedlichKwong/soaveRedlichKwong.C b/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/soaveRedlichKwong/soaveRedlichKwong.C index 2dae0bbb0..ceda21b58 100755 --- a/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/soaveRedlichKwong/soaveRedlichKwong.C +++ b/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/soaveRedlichKwong/soaveRedlichKwong.C @@ -28,7 +28,7 @@ Description Author Christian Lucas Institut für Thermodynamik -Technische Universität Braunschweig +Technische Universität Braunschweig Germany \*---------------------------------------------------------------------------*/ @@ -82,7 +82,7 @@ soaveRedlichKwong::soaveRedlichKwong(const dictionary& dict) a0_(0.42747*pow(this->RR(),2)*pow(Tcrit_,2)/(pcrit_)), b_(0.08664*this->RR()*Tcrit_/pcrit_), n_(0.48508+1.55171*azentricFactor_-0.15613*pow(azentricFactor_,2)), - TSave(0.0), + TSave(0.0), b2_(pow(b_,2)), b3_(pow(b_,3)), b5_(pow(b_,5)), @@ -110,7 +110,7 @@ void Foam::soaveRedlichKwong::write(Ostream& os) const Ostream& operator<<(Ostream& os, const soaveRedlichKwong& srk) { - os << static_cast(srk)<< token::SPACE + os << static_cast(srk)<< token::SPACE << srk.pcrit_ << tab<< srk.Tcrit_< New(Istream& is); - + // Member functions inline scalar rhostd()const; @@ -159,46 +159,46 @@ public: //CL: Equation of state inline scalar p(const scalar rho, const scalar T) const; - //CL: first order derivatives + //CL: first order derivatives inline scalar dpdv(const scalar rho,const scalar T) const; inline scalar dpdT(const scalar rho, const scalar T) const; inline scalar dvdT(const scalar rho,const scalar T) const; - inline scalar dvdp(const scalar rho, const scalar T) const; + inline scalar dvdp(const scalar rho, const scalar T) const; inline scalar isobarExpCoef ( const scalar rho, const scalar T - ) const; + ) const; inline scalar isothermalCompressiblity ( const scalar rho, const scalar T - ) const; + ) const; //CL: Used for cv - inline scalar integral_d2pdT2_dv(const scalar rho,const scalar T) const ; + inline scalar integral_d2pdT2_dv(const scalar rho,const scalar T) const ; //CL: second order derivatives, not Used At The Moment - inline scalar d2pdv2(const scalar rho,const scalar T) const; + inline scalar d2pdv2(const scalar rho,const scalar T) const; - inline scalar d2pdT2(const scalar rho,const scalar T) const; + inline scalar d2pdT2(const scalar rho,const scalar T) const; - inline scalar d2pdvdT(const scalar rho,const scalar T) const; + inline scalar d2pdvdT(const scalar rho,const scalar T) const; - inline scalar d2vdT2(const scalar rho,const scalar T) const; + inline scalar d2vdT2(const scalar rho,const scalar T) const; //CL: Used for internal Energy - inline scalar integral_p_dv(const scalar rho,const scalar T) const; + inline scalar integral_p_dv(const scalar rho,const scalar T) const; //Used for Entropy - inline scalar integral_dpdT_dv(const scalar rho,const scalar T) const; + inline scalar integral_dpdT_dv(const scalar rho,const scalar T) const; - //- Return density [kg/m^3] + //- Return density [kg/m^3] // rho0 is the starting point of the newton solver used to calculate rho inline scalar rho ( @@ -209,7 +209,7 @@ public: inline scalar rho(const scalar p,const scalar T) const; - //- Return compressibility drho/dp at T=constant [s^2/m^2] + //- Return compressibility drho/dp at T=constant [s^2/m^2] inline scalar psi(const scalar rho, const scalar T) const; //- Return compression factor [] @@ -232,7 +232,7 @@ public: inline void operator+=(const soaveRedlichKwong&); -/* +/* inline void operator-=(const soaveRedlichKwong&); inline void operator*=(const scalar); diff --git a/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/soaveRedlichKwong/soaveRedlichKwongI.H b/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/soaveRedlichKwong/soaveRedlichKwongI.H index f79948e19..e03905652 100755 --- a/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/soaveRedlichKwong/soaveRedlichKwongI.H +++ b/src/thermophysicalModels/specie/equationOfState/cubicEquationOfState/soaveRedlichKwong/soaveRedlichKwongI.H @@ -25,7 +25,7 @@ License Author Christian Lucas Institut für Thermodynamik -Technische Universität Braunschweig +Technische Universität Braunschweig Germany @@ -43,11 +43,11 @@ namespace Foam // Construct from components inline soaveRedlichKwong::soaveRedlichKwong ( - const specie& sp + const specie& sp ) : specie(sp), - TSave(0) + TSave(0) {} @@ -107,15 +107,15 @@ inline scalar soaveRedlichKwong::a(const scalar T)const { //CL: check if a has already been calculated for this temperature if(TSave==T) - { - return aSave; + { + return aSave; } //CL: If not, recalculate a(T), dadT(T) and d2adT2(T) else { updateModelCoefficients(T); return aSave; - } + } } @@ -125,14 +125,14 @@ inline scalar soaveRedlichKwong::dadT(const scalar T)const // check if a has already been calculated for this temperature if(TSave==T) { - return daSave; + return daSave; } //CL: If not, recalculate a(T), dadT(T) and d2adT2(T) else { updateModelCoefficients(T); return daSave; - } + } } @@ -142,14 +142,14 @@ inline scalar soaveRedlichKwong::d2adT2(const scalar T)const // check if a has already been calculated for this temperature if(TSave==T) { - return d2aSave; + return d2aSave; } //CL: If not, recalculate a(T), dadT(T) and d2adT2(T) else { updateModelCoefficients(T); return d2aSave; - } + } } @@ -187,12 +187,12 @@ inline scalar soaveRedlichKwong::b5()const } -//returns the pressure for a given density and temperature +//returns the pressure for a given density and temperature inline scalar soaveRedlichKwong::p(const scalar rho,const scalar T) const { scalar Vm = this->W()/rho; - return + return ( this->RR()*T/(Vm-b_) -a(T)/(Vm*(Vm+b_)) @@ -200,29 +200,29 @@ inline scalar soaveRedlichKwong::p(const scalar rho,const scalar T) const } -//Real deviative dp/dv at constant temperature +//Real deviative dp/dv at constant temperature //(molar values) inline scalar soaveRedlichKwong::dpdv(const scalar rho, const scalar T) const { scalar Vm = this->W()/rho; scalar Vm2 = Vm*Vm; - return + return ( a(T)*(b3()-3*b_*Vm2+2*pow(Vm,3)) -this->RR()*T*Vm2*(b2()+2*b_*Vm+Vm2) ) - /(Vm2*pow(b_+Vm,2)*pow(b_-Vm,2)); + /(Vm2*pow(b_+Vm,2)*pow(b_-Vm,2)); } -//Real deviative dp/dT at constant molar volume +//Real deviative dp/dT at constant molar volume //(molar values) inline scalar soaveRedlichKwong::dpdT(const scalar rho, const scalar T) const { scalar Vm = this->W()/rho; - - return + + return ( this->RR()/(Vm-b_) -dadT(T)/(Vm*(Vm+b_)) @@ -239,20 +239,20 @@ inline scalar soaveRedlichKwong::dvdT(const scalar rho,const scalar T) const } -//Real deviative dv/dp at constant temperature +//Real deviative dv/dp at constant temperature //(molar values) -inline scalar soaveRedlichKwong::dvdp(const scalar rho,const scalar T) const +inline scalar soaveRedlichKwong::dvdp(const scalar rho,const scalar T) const { return 1/this->dpdv(rho,T); } -//needed to calculate the internal energy +//needed to calculate the internal energy //(molar values) inline scalar soaveRedlichKwong::integral_p_dv(const scalar rho,const scalar T) const { scalar Vm = this->W()/rho; - + return this->RR()*T*log(Vm-b_)+a(T)*log(b_+Vm)/b_-a(T)*log(Vm)/b_; } @@ -276,14 +276,14 @@ inline scalar soaveRedlichKwong::d2pdT2(const scalar rho,const scalar T) const } -//(molar values) +//(molar values) inline scalar soaveRedlichKwong::d2pdv2(const scalar rho,const scalar T) const { scalar Vm = this->W()/rho; scalar Vm2 = Vm*Vm; scalar Vm3 = Vm*Vm*Vm; - return + return 2* ( a(T)* @@ -295,15 +295,15 @@ inline scalar soaveRedlichKwong::d2pdv2(const scalar rho,const scalar T) const b3()+3*b2()*Vm+3*b_*Vm2+Vm3 ) ) - /(Vm3*pow(b_+Vm,3)*pow(Vm-b_,3)); + /(Vm3*pow(b_+Vm,3)*pow(Vm-b_,3)); } //(molar values) -// using second Order implicit differentiation +// using second Order implicit differentiation inline scalar soaveRedlichKwong::d2vdT2(const scalar rho, const scalar T) const { - return + return -( pow(this->dpdT(rho,T),2)*this->d2pdv2(rho,T) + pow(this->dpdv(rho,T),2)*this->d2pdT2(rho,T) @@ -319,19 +319,19 @@ inline scalar soaveRedlichKwong::d2pdvdT(const scalar rho, const scalar T) const scalar Vm = this->W()/rho; scalar Vm2 = Vm*Vm; - return + return ( dadT(T)*(b3()-3*b_*Vm2+2*pow(Vm,3)) -this->RR()*Vm2*(b2()+2*b_*Vm+Vm2) ) - /(Vm2*pow(b_+Vm,2)*pow(b_-Vm,2)); + /(Vm2*pow(b_+Vm,2)*pow(b_-Vm,2)); } -// the result of this intergal is needed for the nasa based cp polynomial +// the result of this intergal is needed for the nasa based cp polynomial //(molar values) -inline scalar soaveRedlichKwong::integral_d2pdT2_dv(const scalar rho,const scalar T) const -{ +inline scalar soaveRedlichKwong::integral_d2pdT2_dv(const scalar rho,const scalar T) const +{ scalar Vm = this->W()/rho; return d2adT2(T)*log(b_+Vm)/b_-d2adT2(T)*log(Vm)/b_; @@ -361,7 +361,7 @@ inline scalar soaveRedlichKwong::rho( const scalar rho0 ) const { - + scalar molarVolumePrevIteration; scalar molarVolume; label iter=0; @@ -375,7 +375,7 @@ inline scalar soaveRedlichKwong::rho( do { molarVolumePrevIteration= molarVolume; - + label i=0; do { @@ -386,7 +386,7 @@ inline scalar soaveRedlichKwong::rho( )/pow(2,i); i++; - if (i>8) + if (i>8) { //CL: using bisection methode as backup, //CL: solution must be between rho=0.001 to rho=1500; @@ -401,11 +401,11 @@ inline scalar soaveRedlichKwong::rho( if ((f2 < 0 && f3 > 0) || (f2 > 0 && f3 < 0)) { rho1=rho3; - } + } else if ((f1 < 0 && f3 > 0)||(f1 > 0 && f3 < 0)) { rho2=rho3; - } + } else { rho2=(rho2 + rho3)/2; @@ -415,7 +415,7 @@ inline scalar soaveRedlichKwong::rho( { molarVolume=this->W()/rho3; molarVolumePrevIteration=this->W()/rho3; - break; + break; } else { @@ -444,7 +444,7 @@ inline scalar soaveRedlichKwong::rho( return this->W()/molarVolume; } -//- Return density [kg/m^3]on +//- Return density [kg/m^3]on inline scalar soaveRedlichKwong::rho(const scalar p,const scalar T) const { //CL: using perfect gas equation as starting point diff --git a/src/thermophysicalModels/specie/thermo/realGasThermo/nasaHeatCapacityPolynomial/nasaHeatCapacityPolynomial.C b/src/thermophysicalModels/specie/thermo/realGasThermo/nasaHeatCapacityPolynomial/nasaHeatCapacityPolynomial.C index 06b2b9eee..72059a67e 100755 --- a/src/thermophysicalModels/specie/thermo/realGasThermo/nasaHeatCapacityPolynomial/nasaHeatCapacityPolynomial.C +++ b/src/thermophysicalModels/specie/thermo/realGasThermo/nasaHeatCapacityPolynomial/nasaHeatCapacityPolynomial.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | + \\ / A nd | \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,7 +25,7 @@ License Author Christian Lucas Institut für Thermodynamik -Technische Universität Braunschweig +Technische Universität Braunschweig Germany \*---------------------------------------------------------------------------*/ diff --git a/src/thermophysicalModels/specie/thermo/realGasThermo/nasaHeatCapacityPolynomial/nasaHeatCapacityPolynomial.H b/src/thermophysicalModels/specie/thermo/realGasThermo/nasaHeatCapacityPolynomial/nasaHeatCapacityPolynomial.H index 93581a14b..342e1772b 100755 --- a/src/thermophysicalModels/specie/thermo/realGasThermo/nasaHeatCapacityPolynomial/nasaHeatCapacityPolynomial.H +++ b/src/thermophysicalModels/specie/thermo/realGasThermo/nasaHeatCapacityPolynomial/nasaHeatCapacityPolynomial.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | + \\ / A nd | \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -26,13 +26,13 @@ Class Foam::nasaHeatCapacityPolynomial Description - Nasa Heat Capacity Polynomial for perfect Gas (7.order polynominal) --> freely available for many fluids - --> paper title: NASA Glenn Coefficients for Calculating Thermodynamic Properties of Individual Species + Nasa Heat Capacity Polynomial for perfect Gas (7.order polynominal) --> freely available for many fluids + --> paper title: NASA Glenn Coefficients for Calculating Thermodynamic Properties of Individual Species templated into the equationOfState -> uses the equation of state to calculate all real Gas properties like Enthalpy, Entropy ... -> can not be used with the perfectGas equation of state - + Equations for the real gas correction: Have a look at thermodnamics books e.g. Thermodynamics: An Engineering Approch, 5 Edition, Chapter 12 SourceFiles @@ -42,7 +42,7 @@ SourceFiles Author Christian Lucas Institut für Thermodynamik -Technische Universität Braunschweig +Technische Universität Braunschweig Germany \*---------------------------------------------------------------------------*/ @@ -174,7 +174,7 @@ public: inline static autoPtr New(Istream& is); // Member Functions - + //- perfect Gas Enthalpy [J/kmol] inline scalar h0(const scalar T) const; diff --git a/src/thermophysicalModels/specie/thermo/realGasThermo/nasaHeatCapacityPolynomial/nasaHeatCapacityPolynomialI.H b/src/thermophysicalModels/specie/thermo/realGasThermo/nasaHeatCapacityPolynomial/nasaHeatCapacityPolynomialI.H index 602583402..e4d1187bc 100755 --- a/src/thermophysicalModels/specie/thermo/realGasThermo/nasaHeatCapacityPolynomial/nasaHeatCapacityPolynomialI.H +++ b/src/thermophysicalModels/specie/thermo/realGasThermo/nasaHeatCapacityPolynomial/nasaHeatCapacityPolynomialI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | + \\ / A nd | \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,7 +25,7 @@ License Author Christian Lucas Institut für Thermodynamik -Technische Universität Braunschweig +Technische Universität Braunschweig Germany \*---------------------------------------------------------------------------*/ @@ -62,7 +62,7 @@ inline Foam::nasaHeatCapacityPolynomial::nasaHeatCapacityPolyno s0_std(s0(this->Tstd())), integral_p_dv_std(this->integral_p_dv(this->rhostd(),this->Tstd())), integral_dpdT_dv_std(this->integral_dpdT_dv(this->rhostd(),this->Tstd())), - cp_std(this->cp_nonLimited(this->rhostd(),this->Tstd())) + cp_std(this->cp_nonLimited(this->rhostd(),this->Tstd())) {} //- Construct from components @@ -97,7 +97,7 @@ inline Foam::nasaHeatCapacityPolynomial::nasaHeatCapacityPolyno s0_std(s0_std_), integral_p_dv_std(integral_p_dv_std_), integral_dpdT_dv_std(integral_dpdT_dv_std_), - cp_std(cp_std_) + cp_std(cp_std_) {} @@ -149,14 +149,14 @@ Foam::nasaHeatCapacityPolynomial::New(Istream& is) // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // //used to calculate the internal energy -//perfect gas enthalpy +//perfect gas enthalpy template inline Foam::scalar Foam::nasaHeatCapacityPolynomial::h0 ( const scalar T ) const { - return + return this->RR()*T* ( -this->a1_*pow(T,-2) @@ -171,7 +171,7 @@ inline Foam::scalar Foam::nasaHeatCapacityPolynomial::h0 //used to calculate the internal energy -//perfect gas internal energy +//perfect gas internal energy template inline Foam::scalar Foam::nasaHeatCapacityPolynomial::e0 ( @@ -181,7 +181,7 @@ inline Foam::scalar Foam::nasaHeatCapacityPolynomial::e0 return this->h0(T) - this->RR()*T; } // used to calculate the entropy -// perfect gas entropy +// perfect gas entropy template inline Foam::scalar Foam::nasaHeatCapacityPolynomial::s0 ( @@ -189,7 +189,7 @@ inline Foam::scalar Foam::nasaHeatCapacityPolynomial::s0 ) const { return this->RR()* - ( + ( this->a1_*(-1)/(2*pow(T,2)) -this->a2_/T+this->a3_*log(T) +this->a4_*T @@ -241,14 +241,14 @@ template inline Foam::scalar Foam::nasaHeatCapacityPolynomial::cp ( const scalar rho, - const scalar T + const scalar T ) const { - // Problem --> dpdv(rho,T) is =0 at some points within the vapour dome. To increase stability, (dp/dv) has to be limited + // Problem --> dpdv(rho,T) is =0 at some points within the vapour dome. To increase stability, (dp/dv) has to be limited // cp can be negative within the vapor dome. To avoid this nonphysical result, the absolute value is used. - // within the vapourdome and at the critical point, cp increases to very high values --> infinity, - // this would decrease the stability, so cp will be limited to 20 times the cp @ STD - return + // within the vapourdome and at the critical point, cp increases to very high values --> infinity, + // this would decrease the stability, so cp will be limited to 20 times the cp @ STD + return min ( cp_std*20, @@ -258,7 +258,7 @@ inline Foam::scalar Foam::nasaHeatCapacityPolynomial::cp -T*pow((this->dpdT(rho, T)),2) /min(this->dpdv(rho, T),-1) ) - ); + ); } // this function is needed to get cp @ STD (without the limit imposed in the function above), @@ -267,10 +267,10 @@ template inline Foam::scalar Foam::nasaHeatCapacityPolynomial::cp_nonLimited ( const scalar rho, - const scalar T + const scalar T ) const { - return fabs(this->cv(rho,T)-T*pow((this->dpdT(rho, T)),2)/min(this->dpdv(rho, T),-1)); + return fabs(this->cv(rho,T)-T*pow((this->dpdT(rho, T)),2)/min(this->dpdv(rho, T),-1)); } @@ -281,7 +281,7 @@ inline Foam::scalar Foam::nasaHeatCapacityPolynomial::cv ( const scalar rho, const scalar T - + ) const { return this->cv0(T)+T*this->integral_d2pdT2_dv(rho, T); @@ -293,9 +293,9 @@ inline Foam::scalar Foam::nasaHeatCapacityPolynomial::cv //function to calculate real gas enthalpy template inline Foam::scalar Foam::nasaHeatCapacityPolynomial::h -( +( const scalar rho, - const scalar T + const scalar T ) const { return this->e(rho,T)+this->p(rho,T)/rho*this->W()-this->Pstd()/this->rhostd()*this->W(); @@ -307,12 +307,12 @@ inline Foam::scalar Foam::nasaHeatCapacityPolynomial::h // equation: du= cv0 dT +[T*dp/dT -p]dv template inline Foam::scalar Foam::nasaHeatCapacityPolynomial::e -( +( const scalar rho, - const scalar T + const scalar T ) const { - return + return ( -this->Tstd()*integral_dpdT_dv_std +integral_p_dv_std @@ -332,7 +332,7 @@ inline Foam::scalar Foam::nasaHeatCapacityPolynomial::s ( const scalar rho, const scalar T - + ) const { return -integral_dpdT_dv_std @@ -422,7 +422,7 @@ inline Foam::nasaHeatCapacityPolynomial Foam::operator+ np1.nMoles()/eofs.nMoles()*np1.a5_ + np2.nMoles()/eofs.nMoles()*np2.a5_, np1.nMoles()/eofs.nMoles()*np1.a6_ - + np2.nMoles()/eofs.nMoles()*np2.a6_, + + np2.nMoles()/eofs.nMoles()*np2.a6_, np1.nMoles()/eofs.nMoles()*np1.a7_ + np2.nMoles()/eofs.nMoles()*np2.a7_ ); @@ -456,7 +456,7 @@ inline Foam::nasaHeatCapacityPolynomial Foam::operator- np1.nMoles()/eofs.nMoles()*np1.a5_ - np2.nMoles()/eofs.nMoles()*np2.a5_, np1.nMoles()/eofs.nMoles()*np1.a6_ - - np2.nMoles()/eofs.nMoles()*np2.a6_, + - np2.nMoles()/eofs.nMoles()*np2.a6_, np1.nMoles()/eofs.nMoles()*np1.a7_ - np2.nMoles()/eofs.nMoles()*np2.a7_ ); @@ -470,8 +470,8 @@ inline Foam::nasaHeatCapacityPolynomial Foam::operator* const nasaHeatCapacityPolynomial& np ) { - //CL: values at STD don't need to be recalculated, - //CL: therefore, providing the values in the constructor + //CL: values at STD don't need to be recalculated, + //CL: therefore, providing the values in the constructor return nasaHeatCapacityPolynomial ( s*static_cast(np), diff --git a/src/thermophysicalModels/specie/thermo/realGasThermo/realGasSpecieThermo/realGasSpecieThermo.C b/src/thermophysicalModels/specie/thermo/realGasThermo/realGasSpecieThermo/realGasSpecieThermo.C index 6b9c1e255..56e1ea83d 100755 --- a/src/thermophysicalModels/specie/thermo/realGasThermo/realGasSpecieThermo/realGasSpecieThermo.C +++ b/src/thermophysicalModels/specie/thermo/realGasThermo/realGasSpecieThermo/realGasSpecieThermo.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | + \\ / A nd | \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,7 +25,7 @@ License Author Christian Lucas Institut für Thermodynamik -Technische Universität Braunschweig +Technische Universität Braunschweig Germany \*---------------------------------------------------------------------------*/ diff --git a/src/thermophysicalModels/specie/thermo/realGasThermo/realGasSpecieThermo/realGasSpecieThermo.H b/src/thermophysicalModels/specie/thermo/realGasThermo/realGasSpecieThermo/realGasSpecieThermo.H index 352a4dd4c..faee6dd19 100755 --- a/src/thermophysicalModels/specie/thermo/realGasThermo/realGasSpecieThermo/realGasSpecieThermo.H +++ b/src/thermophysicalModels/specie/thermo/realGasThermo/realGasSpecieThermo/realGasSpecieThermo.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | + \\ / A nd | \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -27,9 +27,9 @@ Class Description - This is an subversion of the specieThermo function. While the "orginal" specieThermo function + This is an subversion of the specieThermo function. While the "orginal" specieThermo function is only valid for perfect Gases, this function is valid for real gases. - + Basic thermodynamics type based on the use of fitting functions for cp, h, s obtained from the template argument type thermo. All other properties are derived from these primitive functions. @@ -43,7 +43,7 @@ SourceFiles Author Christian Lucas Institut für Thermodynamik -Technische Universität Braunschweig +Technische Universität Braunschweig Germany @@ -157,7 +157,7 @@ public: // Calculate and return derived properties // (These functions need not provided in derived types) - //CL: isentropic expansion factor "gamma" (heat capacity ratio for perfect gas) + //CL: isentropic expansion factor "gamma" (heat capacity ratio for perfect gas) inline scalar gamma(const scalar T, const scalar rho) const; //- Sensible internal energy [J/kmol] @@ -201,16 +201,16 @@ public: //CL: Other variables - //- Return compressibility drho/dp at h=constant [s^2/m^2] + //- Return compressibility drho/dp at h=constant [s^2/m^2] inline scalar psiH(const scalar rho, const scalar T) const; - //- Return compressibility drho/dp at e=constant [s^2/m^2] + //- Return compressibility drho/dp at e=constant [s^2/m^2] inline scalar psiE(const scalar rho, const scalar T) const; - //- Return compressibility drho/dH at p=constant + //- Return compressibility drho/dH at p=constant inline scalar drhodH(const scalar rho, const scalar T) const; - //- Return compressibility drho/dE at p=constant + //- Return compressibility drho/dE at p=constant inline scalar drhodE(const scalar rho, const scalar T) const; // Energy->temperature inversion functions diff --git a/src/thermophysicalModels/specie/thermo/realGasThermo/realGasSpecieThermo/realGasSpecieThermoI.H b/src/thermophysicalModels/specie/thermo/realGasThermo/realGasSpecieThermo/realGasSpecieThermoI.H index 926418e35..749f99af8 100755 --- a/src/thermophysicalModels/specie/thermo/realGasThermo/realGasSpecieThermo/realGasSpecieThermoI.H +++ b/src/thermophysicalModels/specie/thermo/realGasThermo/realGasSpecieThermo/realGasSpecieThermoI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | + \\ / A nd | \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,7 +25,7 @@ License Author Christian Lucas Institut für Thermodynamik -Technische Universität Braunschweig +Technische Universität Braunschweig Germany @@ -75,18 +75,18 @@ inline void Foam::realGasSpecieThermo::T i=0; do - { - //CL: using a stabilizing newton solver + { + //CL: using a stabilizing newton solver //CL: if the solve is diverging, the step is reduced until the solver converges - Tnew = Test - ((this->*F)(rho,Test) - f)/(this->*dFdT)(rho,Test)/(pow(2,i)); + Tnew = Test - ((this->*F)(rho,Test) - f)/(this->*dFdT)(rho,Test)/(pow(2,i)); i++; }while ( (i<20) && (( - mag((this->*F)(rho,Tnew) - f) - > + mag((this->*F)(rho,Tnew) - f) + > mag((this->*F)(rho,Test) - f) )) ); @@ -104,7 +104,7 @@ inline void Foam::realGasSpecieThermo::T } } while //CL: both fields must converge - ( + ( (mag(mag(Tnew) - mag(Test)) > Ttol) || (mag(mag(rho) - mag(rhoOld)) > rhotol) @@ -206,12 +206,12 @@ inline Foam::scalar Foam::realGasSpecieThermo::psiH ( const scalar rho, const scalar T - + ) const { scalar beta=this->isobarExpCoef(rho,T); - return + return -( (T*beta*beta-beta)/this->Cp(rho,T) -this->isothermalCompressiblity(rho,T)*rho @@ -225,14 +225,14 @@ inline Foam::scalar Foam::realGasSpecieThermo::psiE ( const scalar rho, const scalar T - + ) const { scalar V = 1/rho; scalar cp=this->Cp(rho,T); scalar beta=this->isobarExpCoef(rho,T); - return + return -( ( T*pow(beta,2)*V @@ -246,27 +246,27 @@ inline Foam::scalar Foam::realGasSpecieThermo::psiE ); } -//CL:- Returns drho/dH at p=constant +//CL:- Returns drho/dH at p=constant //CL:- using Bridgeman's Table template inline Foam::scalar Foam::realGasSpecieThermo::drhodH ( const scalar rho, const scalar T - + ) const { return -(rho*this->isobarExpCoef(rho,T))/this->Cp(rho,T); } -//CL:- Returns drho/dE at p=constant +//CL:- Returns drho/dE at p=constant //CL:- using Bridgeman's Table template inline Foam::scalar Foam::realGasSpecieThermo::drhodE ( const scalar rho, const scalar T - + ) const { scalar beta=this->isobarExpCoef(rho,T);