Container to encapsulate various operations for cubic equation of the forms with real coefficients: More...
Public Types | |
enum | components { A, B, C, D } |
![]() | |
typedef VectorSpace< Form, Cmpt, Ncmpts > | vsType |
typedef Cmpt | cmptType |
typedef Cmpt | magType |
typedef Cmpt * | iterator |
Public Member Functions | |
cubicEqn () | |
cubicEqn (const Foam::zero) | |
cubicEqn (const scalar a, const scalar b, const scalar c, const scalar d) | |
scalar | a () const |
scalar | b () const |
scalar | c () const |
scalar | d () const |
scalar & | a () |
scalar & | b () |
scalar & | c () |
scalar & | d () |
scalar | value (const scalar x) const |
scalar | derivative (const scalar x) const |
scalar | error (const scalar x) const |
Roots< 3 > | roots () const |
![]() | |
VectorSpace ()=default | |
VectorSpace (const Foam::zero) | |
VectorSpace (const VectorSpace< Form, Cmpt, Ncmpts > &vs) | |
VectorSpace (const VectorSpace< Form2, Cmpt2, Ncmpts > &) | |
VectorSpace (Istream &is) | |
const Cmpt & | component (const direction) const |
Cmpt & | component (const direction) |
void | component (Cmpt &, const direction) const |
void | replace (const direction, const Cmpt &) |
const Cmpt * | cdata () const noexcept |
Cmpt * | data () noexcept |
const ConstBlock< SubVector, BStart > | block () const |
const Foam::VectorSpace< Form, Cmpt, Ncmpts >::template ConstBlock< SubVector, BStart > | block () const |
const Cmpt & | operator[] (const direction) const |
Cmpt & | operator[] (const direction) |
void | operator= (const VectorSpace< Form, Cmpt, Ncmpts > &) |
void | operator= (const Foam::zero) |
void | operator+= (const VectorSpace< Form, Cmpt, Ncmpts > &) |
void | operator-= (const VectorSpace< Form, Cmpt, Ncmpts > &) |
void | operator*= (const scalar) |
void | operator/= (const scalar) |
iterator | begin () noexcept |
const_iterator | begin () const noexcept |
iterator | end () noexcept |
const_iterator | end () const noexcept |
const_iterator | cbegin () const noexcept |
const_iterator | cend () const noexcept |
Additional Inherited Members | |
![]() | |
static constexpr direction | size () noexcept |
static Form | uniform (const Cmpt &s) |
![]() | |
const typedef Cmpt * | const_iterator |
Cmpt | v_ [Ncmpts] |
![]() | |
static constexpr direction | dim |
static constexpr direction | nComponents |
static constexpr direction | mRows |
static constexpr direction | nCols |
static const char *const | typeName |
static const char *const | componentNames [] |
static const Form | zero |
static const Form | one |
static const Form | max |
static const Form | min |
static const Form | rootMax |
static const Form | rootMin |
Container to encapsulate various operations for cubic equation of the forms with real coefficients:
The following two substitutions into the above forms are used:
This reduces the problem to a quadratic in w^3
:
where Q
and P
are given in the code.
The properties of the cubic can be related to the properties of this quadratic in w^3
.
If the quadratic eqn has two identical real roots at zero, three identical real roots exist in the cubic eqn.
If the quadratic eqn has two identical real roots at non-zero, two identical and one distinct real roots exist in the cubic eqn.
If the quadratic eqn has two complex roots (a complex conjugate pair), three distinct real roots exist in the cubic eqn.
If the quadratic eqn has two distinct real roots, one real root and two complex roots (a complex conjugate pair) exist in the cubic eqn.
The quadratic eqn is solved for the most numerically accurate value of w^3
. See the quadraticEqn.H for details on how to pick a value. This single value of w^3
can yield up to three cube roots for w
, which relate to the three solutions for x
.
Only a single root, or pair of conjugate roots, is directly evaluated; the one, or ones with the lowest relative numerical error. Root identities are then used to recover the remaining roots, possibly utilising a quadratic and/or linear solution. This seems to be a good way of maintaining the accuracy of roots at very different magnitudes.
Reference:
Kahan's algo. to compute 'p' using fused multiply-adds (tag:JML): Jeannerod, C. P., Louvet, N., & Muller, J. M. (2013). Further analysis of Kahan's algorithm for the accurate computation of 2× 2 determinants. Mathematics of Computation, 82(284), 2245-2264. DOI:10.1090/S0025-5718-2013-02679-8
Definition at line 108 of file cubicEqn.H.
enum components |
Enumerator | |
---|---|
A | |
B | |
C | |
D |
Definition at line 115 of file cubicEqn.H.
|
inline |
Definition at line 23 of file cubicEqnI.H.
|
inline |
Definition at line 27 of file cubicEqnI.H.
|
inline |
Definition at line 34 of file cubicEqnI.H.
References A, B, Foam::constant::physicoChemical::b, Foam::constant::universal::c, C, and D.
|
inline |
Definition at line 50 of file cubicEqnI.H.
References A.
Referenced by cubicEqn::roots().
|
inline |
Definition at line 56 of file cubicEqnI.H.
References B.
Referenced by cubicEqn::roots().
|
inline |
Definition at line 62 of file cubicEqnI.H.
References C.
Referenced by cubicEqn::roots().
|
inline |
Definition at line 68 of file cubicEqnI.H.
References D.
Referenced by cubicEqn::roots().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Definition at line 98 of file cubicEqnI.H.
References Foam::constant::physicoChemical::b, Foam::constant::universal::c, and x.
Referenced by particle< Type >::trackToMovingTri().
|
inline |
Definition at line 104 of file cubicEqnI.H.
References Foam::constant::physicoChemical::b, Foam::constant::universal::c, and x.
|
inline |
Definition at line 110 of file cubicEqnI.H.
References Foam::constant::physicoChemical::b, Foam::constant::universal::c, Foam::mag(), Foam::magSqr(), and x.
Foam::Roots< 3 > roots | ( | ) | const |
Definition at line 28 of file cubicEqn.C.
References cubicEqn::a(), Foam::atan2(), cubicEqn::b(), cubicEqn::c(), Foam::cbrt(), Foam::roots::complex, Foam::cos(), cubicEqn::d(), Foam::endl(), Foam::hypot(), Foam::Info, Foam::mag(), Foam::roots::nan, Foam::nl, p, Foam::roots::real, Foam::sign(), Foam::sin(), Foam::sqrt(), Foam::tab, Roots< N >::type(), and x.
Copyright © 2011-2018 OpenFOAM | OPENFOAM® is a registered trademark of OpenCFD Ltd.