mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Thermodynamics: renamed isobaricPerfectGas -> incompressiblePerfectGas and incompressible -> rhoConst
Added isochoric and incompressible identifiers to equations of state to indicate the supported processes
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -91,30 +91,6 @@ Foam::Polynomial<PolySize>::Polynomial(const UList<scalar>& coeffs)
|
||||
}
|
||||
|
||||
|
||||
// template<int PolySize>
|
||||
// Foam::Polynomial<PolySize>::Polynomial(const polynomialFunction& poly)
|
||||
// :
|
||||
// VectorSpace<Polynomial<PolySize>, scalar, PolySize>(),
|
||||
// logActive_(poly.logActive()),
|
||||
// logCoeff_(poly.logCoeff())
|
||||
// {
|
||||
// if (poly.size() != PolySize)
|
||||
// {
|
||||
// FatalErrorIn
|
||||
// (
|
||||
// "Polynomial<PolySize>::Polynomial(const polynomialFunction&)"
|
||||
// ) << "Size mismatch: Needed " << PolySize
|
||||
// << " but given " << poly.size()
|
||||
// << nl << exit(FatalError);
|
||||
// }
|
||||
//
|
||||
// for (int i = 0; i < PolySize; ++i)
|
||||
// {
|
||||
// this->v_[i] = poly[i];
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
template<int PolySize>
|
||||
Foam::Polynomial<PolySize>::Polynomial(Istream& is)
|
||||
:
|
||||
@ -178,11 +154,11 @@ Foam::scalar Foam::Polynomial<PolySize>::value(const scalar x) const
|
||||
scalar val = this->v_[0];
|
||||
|
||||
// avoid costly pow() in calculation
|
||||
scalar powX = x;
|
||||
scalar powX = 1;
|
||||
for (label i=1; i<PolySize; ++i)
|
||||
{
|
||||
val += this->v_[i]*powX;
|
||||
powX *= x;
|
||||
val += this->v_[i]*powX;
|
||||
}
|
||||
|
||||
if (logActive_)
|
||||
@ -195,39 +171,57 @@ Foam::scalar Foam::Polynomial<PolySize>::value(const scalar x) const
|
||||
|
||||
|
||||
template<int PolySize>
|
||||
Foam::scalar Foam::Polynomial<PolySize>::integrate
|
||||
Foam::scalar Foam::Polynomial<PolySize>::derivative(const scalar x) const
|
||||
{
|
||||
scalar deriv = 0;
|
||||
|
||||
if (PolySize > 1)
|
||||
{
|
||||
// avoid costly pow() in calculation
|
||||
deriv += this->v_[1];
|
||||
|
||||
scalar powX = 1;
|
||||
for (label i=2; i<PolySize; ++i)
|
||||
{
|
||||
powX *= x;
|
||||
deriv += i*this->v_[i]*powX;
|
||||
}
|
||||
}
|
||||
|
||||
if (logActive_)
|
||||
{
|
||||
deriv += logCoeff_/x;
|
||||
}
|
||||
|
||||
return deriv;
|
||||
}
|
||||
|
||||
|
||||
template<int PolySize>
|
||||
Foam::scalar Foam::Polynomial<PolySize>::integral
|
||||
(
|
||||
const scalar x1,
|
||||
const scalar x2
|
||||
) const
|
||||
{
|
||||
if (logActive_)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"scalar Polynomial<PolySize>::integrate"
|
||||
"("
|
||||
"const scalar, "
|
||||
"const scalar"
|
||||
") const"
|
||||
) << "Cannot integrate polynomial with logarithmic coefficients"
|
||||
<< nl << abort(FatalError);
|
||||
}
|
||||
|
||||
|
||||
// avoid costly pow() in calculation
|
||||
scalar powX1 = x1;
|
||||
scalar powX2 = x2;
|
||||
|
||||
scalar val = this->v_[0]*(powX2 - powX1);
|
||||
scalar integ = this->v_[0]*(powX2 - powX1);
|
||||
for (label i=1; i<PolySize; ++i)
|
||||
{
|
||||
val += this->v_[i]/(i + 1) * (powX2 - powX1);
|
||||
powX1 *= x1;
|
||||
powX2 *= x2;
|
||||
integ += this->v_[i]/(i + 1)*(powX2 - powX1);
|
||||
}
|
||||
|
||||
return val;
|
||||
if (logActive_)
|
||||
{
|
||||
integ += logCoeff_*((x2*log(x2) - x2) - (x1*log(x1) - x1));
|
||||
}
|
||||
|
||||
return integ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -27,13 +27,14 @@ Class
|
||||
Description
|
||||
Polynomial templated on size (order):
|
||||
|
||||
poly = logCoeff*log(x) + sum(coeff_[i]*x^i)
|
||||
poly = sum(coeff_[i]*x^i) logCoeff*log(x)
|
||||
|
||||
where 0 \<= i \<= N
|
||||
|
||||
- integer powers, starting at zero
|
||||
- value(x) to evaluate the poly for a given value
|
||||
- integrate(x1, x2) between two scalar values
|
||||
- derivative(x) returns derivative at value
|
||||
- integral(x1, x2) returns integral between two scalar values
|
||||
- integral() to return a new, integral coeff polynomial
|
||||
- increases the size (order)
|
||||
- integralMinus1() to return a new, integral coeff polynomial where
|
||||
@ -136,16 +137,18 @@ public:
|
||||
//- Return polynomial value
|
||||
scalar value(const scalar x) const;
|
||||
|
||||
//- Integrate between two values
|
||||
scalar integrate(const scalar x1, const scalar x2) const;
|
||||
//- Return derivative of the polynomial at the given x
|
||||
scalar derivative(const scalar x) const;
|
||||
|
||||
//- Return integral between two values
|
||||
scalar integral(const scalar x1, const scalar x2) const;
|
||||
|
||||
//- Return integral coefficients.
|
||||
// Argument becomes zeroth element (constant of integration)
|
||||
// Argument becomes zero'th element (constant of integration)
|
||||
intPolyType integral(const scalar intConstant = 0.0) const;
|
||||
|
||||
//- Return integral coefficients when lowest order is -1.
|
||||
// Argument becomes zeroth element (constant of integration)
|
||||
// Argument becomes zero'th element (constant of integration)
|
||||
polyType integralMinus1(const scalar intConstant = 0.0) const;
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user