9using namespace cppinterface;
17 const std::vector<char> vars;
18 const Eigen::Ref<const Eigen::ArrayXd> vals;
20 const Eigen::Ref<const Eigen::ArrayXd> z;
23 NRIterator(
const AbstractModel* ar,
const AbstractModel* aig,
const std::vector<char>& vars,
const Eigen::Ref<const Eigen::ArrayXd>& vals,
double T,
double rho,
const Eigen::Ref<const Eigen::ArrayXd>& z) : ar(ar), aig(aig), vars(vars), vals(vals), T(T), rho(rho), z(z){}
26 std::vector<char>
get_vars()
const {
return vars; }
28 Eigen::ArrayXd
get_vals()
const {
return vals; }
30 auto get_T()
const {
return T; }
44 auto R = ar->
get_R(z);
46 return std::make_tuple((im.J.matrix().colPivHouseholderQr().solve((-(im.v-vals)).matrix())).eval(), im);
54 return (im.v-vals).eval();
64 for (
auto i = 0; i < N; ++i){
virtual double get_R(const EArrayd &) const =0
virtual EArray33d get_deriv_mat2(const double T, double rho, const EArrayd &z) const =0
Eigen::ArrayXd get_molefrac() const
Return the current mole fractions.
std::vector< char > get_vars() const
Return the variables that are being used in the iteration.
auto take_step()
Take one step, return the residuals.
auto get_T() const
Return the current temperature.
auto get_rho() const
Return the current molar density.
auto calc_step(double T, double rho)
Eigen::ArrayXd get_vals() const
Return the target values to be obtained.
NRIterator(const AbstractModel *ar, const AbstractModel *aig, const std::vector< char > &vars, const Eigen::Ref< const Eigen::ArrayXd > &vals, double T, double rho, const Eigen::Ref< const Eigen::ArrayXd > &z)
auto build_iteration_Jv(const std::vector< char > &vars, const Eigen::Array< double, 3, 3 > &Ar, const Eigen::Array< double, 3, 3 > &Aig, const double R, const double T, const double rho, const Array &z)
A convenience function for calculation of Jacobian terms of the form and where is one of the therm...