157 {
158 Vector<V,N_COMPONENTS> molarRhoField{}, a_i{}, x_i{};
159 Vector<V,N_COMPONENTS*N_COMPONENTS> g_jk{}, beta_jk{};
160 V R = 1;
161 V molarRho = 0;
162 V Rho = 0;
163 for(unsigned i = 0; i < N_COMPONENTS; i++){
165 for(unsigned j = 0; j < N_COMPONENTS; j++){
166 g_jk[N_COMPONENTS*i+j] = g_I[N_COMPONENTS*i+j] + g_II[N_COMPONENTS*i+j] * _T;
167 beta_jk[N_COMPONENTS*i+j] = b[j] *
util::exp(-alpha[N_COMPONENTS*i+j]*g_jk[N_COMPONENTS*i+j]/(R*_T));
168 }
169 molarRhoField[i] = rhoField[i]/_M[i];
170 molarRho += molarRhoField[i];
171 Rho += rhoField[i];
172 }
173 for(unsigned i = 0; i < N_COMPONENTS; i++){
174 x_i[i] = molarRhoField[i]/molarRho;
175 }
176 V g_E =
G_Excess(x_i, g_jk, beta_jk);
177 V b_m =
b_mix(x_i, b);
178 V a_m =
a_mix(x_i, a_i, b, b_m, g_E);
179 V p = molarRho*R*_T/(1-b_m*molarRho) - a_m*molarRho*molarRho/(1+2*b_m*molarRho-b_m*molarRho*b_m*molarRho);
181 return psi;
182 };
cpu::simd::Pack< T > sqrt(cpu::simd::Pack< T > value)
cpu::simd::Pack< T > pow(cpu::simd::Pack< T > base, cpu::simd::Pack< T > exp)
ADf< T, DIM > exp(const ADf< T, DIM > &a)
V b_mix(const X_I &x_i, const B &b) any_platform
V a_mix(const X_I &x_i, const A_I &a_i, const B &b, V b_m, V G_E) any_platform
V G_Excess(const X_I &x_i, const G_JK &g_jk, const BETA_JK &beta_jk) any_platform