ENH: Adding new access to basic thermo for rho and Cp

This commit is contained in:
sergio
2021-12-10 10:20:52 +00:00
committed by Andrew Heather
parent b18dd0cb43
commit 13b1417710
8 changed files with 191 additions and 2 deletions

View File

@ -455,6 +455,18 @@ Foam::tmp<Foam::scalarField> Foam::phaseSystem::Cp
}
Foam::tmp<Foam::scalarField> Foam::phaseSystem::CpThermo
(
const scalarField& T,
const scalarField& p,
const labelList& cells
) const
{
NotImplemented;
return nullptr;
}
Foam::tmp<Foam::volScalarField> Foam::phaseSystem::Cv() const
{
auto iter = phaseModels_.cbegin();
@ -496,6 +508,18 @@ Foam::tmp<Foam::scalarField> Foam::phaseSystem::Cv
}
Foam::tmp<Foam::scalarField> Foam::phaseSystem::rhoEoS
(
const scalarField& T,
const scalarField& p,
const labelList& cells
) const
{
NotImplemented;
return nullptr;
}
Foam::tmp<Foam::volScalarField> Foam::phaseSystem::gamma() const
{
auto iter = phaseModels_.cbegin();

View File

@ -351,6 +351,14 @@ public:
const label patchi
) const;
//- Heat capacity using pressure and temperature
virtual tmp<scalarField> CpThermo
(
const scalarField& T,
const scalarField& p,
const labelList& cells
) const;
//- Return Cv of the mixture
virtual tmp<volScalarField> Cv() const;
@ -362,6 +370,14 @@ public:
const label patchI
) const;
//- Density from pressure and temperature
virtual tmp<scalarField> rhoEoS
(
const scalarField& T,
const scalarField& p,
const labelList& cells
) const;
//- Gamma = Cp/Cv []
virtual tmp<volScalarField> gamma() const;

View File

@ -443,6 +443,14 @@ public:
const label patchi
) const = 0;
//- Heat capacity using pressure and temperature
virtual tmp<scalarField> CpThermo
(
const scalarField& T,
const scalarField& p,
const labelList& cells
) const = 0;
//- Heat capacity at constant volume [J/kg/K]
virtual tmp<volScalarField> Cv() const = 0;
@ -454,6 +462,14 @@ public:
const label patchi
) const = 0;
//- Density from pressure and temperature
virtual tmp<scalarField> rhoEoS
(
const scalarField& T,
const scalarField& p,
const labelList& cells
) const = 0;
//- Gamma = Cp/Cv []
virtual tmp<volScalarField> gamma() const = 0;

View File

@ -376,6 +376,28 @@ Foam::tmp<Foam::scalarField> Foam::heThermo<BasicThermo, MixtureType>::Cp
}
template<class BasicThermo, class MixtureType>
Foam::tmp<Foam::scalarField>
Foam::heThermo<BasicThermo, MixtureType>::CpThermo
(
const scalarField& T,
const scalarField& p,
const labelList& cells
) const
{
auto tCp = tmp<scalarField>::New(T.size());
auto& Cp = tCp.ref();
forAll(cells, i)
{
const label celli = cells[i];
Cp[i] = this->cellMixture(celli).Cp(p[i], T[i]);
}
return tCp;
}
template<class BasicThermo, class MixtureType>
Foam::tmp<Foam::volScalarField>
Foam::heThermo<BasicThermo, MixtureType>::Cp() const
@ -449,6 +471,28 @@ Foam::heThermo<BasicThermo, MixtureType>::Cv
}
template<class BasicThermo, class MixtureType>
Foam::tmp<Foam::scalarField>
Foam::heThermo<BasicThermo, MixtureType>::rhoEoS
(
const scalarField& T,
const scalarField& p,
const labelList& cells
) const
{
auto tRho = tmp<scalarField>::New(T.size());
auto& rho = tRho.ref();
forAll(cells, i)
{
const label celli = cells[i];
rho[i] = this->cellMixture(celli).rho(p[i], T[i]);
}
return tRho;
}
template<class BasicThermo, class MixtureType>
Foam::tmp<Foam::volScalarField>
Foam::heThermo<BasicThermo, MixtureType>::Cv() const

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2015-2017 OpenCFD Ltd.
Copyright (C) 2015-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -228,6 +228,14 @@ public:
const label patchi
) const;
//- Heat capacity using pressure and temperature
virtual tmp<scalarField> CpThermo
(
const scalarField& T,
const scalarField& p,
const labelList& cells
) const;
//- Heat capacity at constant pressure [J/kg/K]
virtual tmp<volScalarField> Cp() const;
@ -239,6 +247,14 @@ public:
const label patchi
) const;
//- Density from pressure and temperature
virtual tmp<scalarField> rhoEoS
(
const scalarField& T,
const scalarField& p,
const labelList& cells
) const;
//- Heat capacity at constant volume [J/kg/K]
virtual tmp<volScalarField> Cv() const;