Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #include "icoPolynomial.H"
00027
00028
00029
00030 template<int PolySize>
00031 inline Foam::icoPolynomial<PolySize>::icoPolynomial
00032 (
00033 const specie& sp,
00034 const Polynomial<PolySize>& rhoPoly
00035 )
00036 :
00037 specie(sp),
00038 rhoPolynomial_(rhoPoly)
00039 {}
00040
00041
00042
00043
00044 template<int PolySize>
00045 inline Foam::icoPolynomial<PolySize>::icoPolynomial
00046 (
00047 const icoPolynomial<PolySize>& ip
00048 )
00049 :
00050 specie(ip),
00051 rhoPolynomial_(ip.rhoPolynomial_)
00052 {}
00053
00054
00055 template<int PolySize>
00056 inline Foam::icoPolynomial<PolySize>::icoPolynomial
00057 (
00058 const word& name,
00059 const icoPolynomial<PolySize>& ip
00060 )
00061 :
00062 specie(name, ip),
00063 rhoPolynomial_(ip.rhoPolynomial_)
00064 {}
00065
00066
00067 template<int PolySize>
00068 inline Foam::autoPtr<Foam::icoPolynomial<PolySize> >
00069 Foam::icoPolynomial<PolySize>::clone() const
00070 {
00071 return autoPtr<icoPolynomial<PolySize> >
00072 (
00073 new icoPolynomial<PolySize>(*this)
00074 );
00075 }
00076
00077
00078 template<int PolySize>
00079 inline Foam::autoPtr<Foam::icoPolynomial<PolySize> >
00080 Foam::icoPolynomial<PolySize>::New(Istream& is)
00081 {
00082 return autoPtr<icoPolynomial<PolySize> >(new icoPolynomial<PolySize>(is));
00083 }
00084
00085
00086
00087
00088 template<int PolySize>
00089 inline Foam::scalar Foam::icoPolynomial<PolySize>::rho(scalar, scalar T) const
00090 {
00091 return rhoPolynomial_.evaluate(T)/this->W();
00092 }
00093
00094
00095 template<int PolySize>
00096 inline Foam::scalar Foam::icoPolynomial<PolySize>::psi(scalar, scalar) const
00097 {
00098 return 0.0;
00099 }
00100
00101
00102 template<int PolySize>
00103 inline Foam::scalar Foam::icoPolynomial<PolySize>::Z(scalar, scalar) const
00104 {
00105 return 0.0;
00106 }
00107
00108
00109
00110
00111 template<int PolySize>
00112 inline Foam::icoPolynomial<PolySize>& Foam::icoPolynomial<PolySize>::operator=
00113 (
00114 const icoPolynomial<PolySize>& ip
00115 )
00116 {
00117 specie::operator=(ip);
00118
00119 rhoPolynomial_ = ip.rhoPolynomial_;
00120
00121 return *this;
00122 }
00123
00124
00125 template<int PolySize>
00126 inline void Foam::icoPolynomial<PolySize>::operator+=
00127 (
00128 const icoPolynomial<PolySize>& ip
00129 )
00130 {
00131 scalar molr1 = this->nMoles();
00132
00133 specie::operator+=(ip);
00134
00135 molr1 /= this->nMoles();
00136 scalar molr2 = ip.nMoles()/this->nMoles();
00137
00138 rhoPolynomial_ = molr1*rhoPolynomial_ + molr2*ip.rhoPolynomial_;
00139 }
00140
00141
00142 template<int PolySize>
00143 inline void Foam::icoPolynomial<PolySize>::operator-=
00144 (
00145 const icoPolynomial<PolySize>& ip
00146 )
00147 {
00148 scalar molr1 = this->nMoles();
00149
00150 specie::operator-=(ip);
00151
00152 molr1 /= this->nMoles();
00153 scalar molr2 = ip.nMoles()/this->nMoles();
00154
00155 rhoPolynomial_ = molr1*rhoPolynomial_ - molr2*ip.rhoPolynomial_;
00156 }
00157
00158
00159 template<int PolySize>
00160 inline void Foam::icoPolynomial<PolySize>::operator*=(const scalar s)
00161 {
00162 specie::operator*=(s);
00163 }
00164
00165
00166
00167
00168 template<int PolySize>
00169 Foam::icoPolynomial<PolySize> Foam::operator+
00170 (
00171 const icoPolynomial<PolySize>& ip1,
00172 const icoPolynomial<PolySize>& ip2
00173 )
00174 {
00175 scalar nMoles = ip1.nMoles() + ip2.nMoles();
00176 scalar molr1 = ip1.nMoles()/nMoles;
00177 scalar molr2 = ip2.nMoles()/nMoles;
00178
00179 return icoPolynomial<PolySize>
00180 (
00181 static_cast<const specie&>(ip1)
00182 + static_cast<const specie&>(ip2),
00183 molr1*ip1.rhoPolynomial_ + molr2*ip2.rhoPolynomial_
00184 );
00185 }
00186
00187
00188 template<int PolySize>
00189 Foam::icoPolynomial<PolySize> Foam::operator-
00190 (
00191 const icoPolynomial<PolySize>& ip1,
00192 const icoPolynomial<PolySize>& ip2
00193 )
00194 {
00195 scalar nMoles = ip1.nMoles() + ip2.nMoles();
00196 scalar molr1 = ip1.nMoles()/nMoles;
00197 scalar molr2 = ip2.nMoles()/nMoles;
00198
00199 return icoPolynomial<PolySize>
00200 (
00201 static_cast<const specie&>(ip1)
00202 - static_cast<const specie&>(ip2),
00203 molr1*ip1.rhoPolynomial_ - molr2*ip2.rhoPolynomial_
00204 );
00205 }
00206
00207
00208 template<int PolySize>
00209 Foam::icoPolynomial<PolySize> Foam::operator*
00210 (
00211 const scalar s,
00212 const icoPolynomial<PolySize>& ip
00213 )
00214 {
00215 return icoPolynomial<PolySize>
00216 (
00217 s*static_cast<const specie&>(ip),
00218 ip.rhoPolynomial_
00219 );
00220 }
00221
00222
00223 template<int PolySize>
00224 Foam::icoPolynomial<PolySize> Foam::operator==
00225 (
00226 const icoPolynomial<PolySize>& ip1,
00227 const icoPolynomial<PolySize>& ip2
00228 )
00229 {
00230 return ip2 - ip1;
00231 }
00232
00233
00234