Skip to content

Commit

Permalink
Create access to volscalarField data for entropy and Gibbs ebergy at …
Browse files Browse the repository at this point in the history
…solver level. Entropy can be accessed by thermo.Se(p,T) and Gibbs energy by thermo.G(p,T)
  • Loading branch information
stanabng2501 committed May 27, 2021
1 parent b909560 commit 82bd71b
Show file tree
Hide file tree
Showing 7 changed files with 95 additions and 3 deletions.
17 changes: 17 additions & 0 deletions src/thermophysicalModels/basic/basicThermo/basicThermo.H
Expand Up @@ -314,7 +314,24 @@ public:
const scalarField& T,
const label patchi
) const = 0;


// Entropy for given pressure and temperature [J/kg-K]
virtual tmp<volScalarField> Se
(
const volScalarField& p,
const volScalarField& T
) const = 0;


// Gibbs free energy for given pressure and temperature [J/kg]
virtual tmp<volScalarField> G
(
const volScalarField& p,
const volScalarField& T
) const = 0;


//- Absolute enthalpy [J/kg]
virtual tmp<volScalarField> ha() const = 0;

Expand Down
41 changes: 39 additions & 2 deletions src/thermophysicalModels/basic/heThermo/heThermo.C
Expand Up @@ -57,7 +57,6 @@ Foam::heThermo<BasicThermo, MixtureType>::volScalarFieldProperty
psiDim
)
);

volScalarField& psi = tPsi.ref();

forAll(this->T_, celli)
Expand All @@ -66,7 +65,6 @@ Foam::heThermo<BasicThermo, MixtureType>::volScalarFieldProperty
}

volScalarField::Boundary& psiBf = psi.boundaryFieldRef();

forAll(psiBf, patchi)
{
fvPatchScalarField& pPsi = psiBf[patchi];
Expand Down Expand Up @@ -485,6 +483,45 @@ Foam::tmp<Foam::scalarField> Foam::heThermo<BasicThermo, MixtureType>::ha
);
}

template<class BasicThermo, class MixtureType>
Foam::tmp<Foam::volScalarField> Foam::heThermo<BasicThermo, MixtureType>::Se
(
const volScalarField& p,
const volScalarField& T
) const
{
return volScalarFieldProperty
(
"S",
dimEnergy/(dimMass*dimTemperature),
&MixtureType::cellThermoMixture,
&MixtureType::patchFaceThermoMixture,
&MixtureType::thermoMixtureType::Se,
p,
T
);
}

template<class BasicThermo, class MixtureType>
Foam::tmp<Foam::volScalarField> Foam::heThermo<BasicThermo, MixtureType>::G
(
const volScalarField& p,
const volScalarField& T
) const
{
return volScalarFieldProperty
(
"G",
dimEnergy/dimMass,
&MixtureType::cellThermoMixture,
&MixtureType::patchFaceThermoMixture,
&MixtureType::thermoMixtureType::G,
p,
T
);

}


template<class BasicThermo, class MixtureType>
Foam::tmp<Foam::volScalarField>
Expand Down
17 changes: 17 additions & 0 deletions src/thermophysicalModels/basic/heThermo/heThermo.H
Expand Up @@ -274,6 +274,23 @@ public:
const labelList& cells
) const;



// entropy for given pressure and temperature [J/kg-K]
virtual tmp<volScalarField> Se
(
const volScalarField& p,
const volScalarField& T
) const;

// gibbs free energy for given pressure and temperature [J/kg]
virtual tmp<volScalarField> G
(
const volScalarField& p,
const volScalarField& T
) const;


//- Enthalpy of formation [J/kg]
virtual tmp<volScalarField> hc() const;

Expand Down
Expand Up @@ -194,6 +194,8 @@ thermoMixtureFunction(Cpv)
thermoMixtureFunction(gamma)
thermoMixtureFunction(CpByCpv)
thermoMixtureFunction(HE)
thermoMixtureFunction(Se)
thermoMixtureFunction(G)


template<class ThermoType>
Expand Down
Expand Up @@ -116,6 +116,14 @@ public:
// Absolute enthalpy [J/kg]
scalar Ha(const scalar p, const scalar T) const;

// entropy[J/kg-K]
scalar Se(const scalar p, const scalar T) const;


// gibbs free energy[J/kg]
scalar G(const scalar p, const scalar T) const;


// Enthalpy of formation [J/kg]
scalar Hf() const;

Expand Down
5 changes: 4 additions & 1 deletion src/thermophysicalModels/specie/thermo/thermo/thermo.H
Expand Up @@ -181,7 +181,10 @@ public:
//- Helmholtz free energy [J/kg]
inline scalar A(const scalar p, const scalar T) const;


//- Entropy name Se to avoid conflict [J/kg-K]
inline scalar Se(const scalar p, const scalar T) const;


// Mole specific derived properties

//- Heat capacity at constant pressure [J/kmol/K]
Expand Down
8 changes: 8 additions & 0 deletions src/thermophysicalModels/specie/thermo/thermo/thermoI.H
Expand Up @@ -111,6 +111,14 @@ Foam::species::thermo<Thermo, Type>::A(const scalar p, const scalar T) const
return this->Ea(p, T) - T*this->S(p, T);
}

template<class Thermo, template<class> class Type>
inline Foam::scalar
Foam::species::thermo<Thermo, Type>::Se(const scalar p, const scalar T) const
{
return this->S(p, T);
}



template<class Thermo, template<class> class Type>
inline Foam::scalar
Expand Down

0 comments on commit 82bd71b

Please sign in to comment.