teqp 0.23.1
Loading...
Searching...
No Matches
teqp::iteration::NRIterator Class Reference

#include <iteration.hpp>

Public Member Functions

 NRIterator (const AlphaModel &alphamodel, const std::vector< char > &vars, const Eigen::Array2d &vals, double T, double rho, const Eigen::Ref< const Eigen::ArrayXd > &z, const std::tuple< bool, bool > &relative_error, const std::vector< std::shared_ptr< StoppingCondition > > stopping_conditions)
 
std::vector< char > get_vars () const
 Return the variables that are being used in the iteration.
 
Eigen::Array2d get_vals () const
 Return the target values to be obtained.
 
auto get_T () const
 Return the current temperature.
 
auto get_rho () const
 Return the current molar density.
 
Eigen::ArrayXd get_molefrac () const
 Return the current mole fractions.
 
int get_step_count () const
 Return the current step counter.
 
std::string get_message () const
 Return the current message relaying information about success or failure of the iteration.
 
auto get_nonconstant_indices () const
 Get the indices of the nonconstant variables.
 
void reset (double T, double rho)
 
auto calc_matrices (double T, double rho) const
 
auto calc_step (double T, double rho) const
 
auto calc_just_step (double T, double rho) const
 
auto calc_vals (double T, double rho) const
 
auto calc_r (double T, double rho) const
 
auto calc_J (double T, double rho) const
 
auto calc_maxabsr (double T, double rho) const
 Calculate the maximum absolute value of the values in r.
 
auto get_maxabsr () const
 Get the maximum absolute value of residual vector, using the cached value for r.
 
auto take_steps (int N, bool apply_stopping=true)
 
auto take_steps_logrho (int N)
 
auto path_integration (double T, double rho, std::size_t N)
 

Public Attributes

bool verbose = false
 

Detailed Description

A class for doing Newton-Raphson steps to solve for two unknown thermodynamic variables

Definition at line 235 of file iteration.hpp.

Constructor & Destructor Documentation

◆ NRIterator()

teqp::iteration::NRIterator::NRIterator ( const AlphaModel & alphamodel,
const std::vector< char > & vars,
const Eigen::Array2d & vals,
double T,
double rho,
const Eigen::Ref< const Eigen::ArrayXd > & z,
const std::tuple< bool, bool > & relative_error,
const std::vector< std::shared_ptr< StoppingCondition > > stopping_conditions )
inline

Definition at line 254 of file iteration.hpp.

Member Function Documentation

◆ calc_J()

auto teqp::iteration::NRIterator::calc_J ( double T,
double rho ) const
inline

Definition at line 309 of file iteration.hpp.

◆ calc_just_step()

auto teqp::iteration::NRIterator::calc_just_step ( double T,
double rho ) const
inline

Definition at line 296 of file iteration.hpp.

◆ calc_matrices()

auto teqp::iteration::NRIterator::calc_matrices ( double T,
double rho ) const
inline

Do the calculations needed for the step and return the step and the other data In C++, the copy will be elided (the return value will be moved)

Parameters
TTemperature
rhoMolar density

Definition at line 288 of file iteration.hpp.

◆ calc_maxabsr()

auto teqp::iteration::NRIterator::calc_maxabsr ( double T,
double rho ) const
inline

Calculate the maximum absolute value of the values in r.

Definition at line 316 of file iteration.hpp.

◆ calc_r()

auto teqp::iteration::NRIterator::calc_r ( double T,
double rho ) const
inline

Definition at line 302 of file iteration.hpp.

◆ calc_step()

auto teqp::iteration::NRIterator::calc_step ( double T,
double rho ) const
inline

Definition at line 292 of file iteration.hpp.

◆ calc_vals()

auto teqp::iteration::NRIterator::calc_vals ( double T,
double rho ) const
inline

Definition at line 299 of file iteration.hpp.

◆ get_maxabsr()

auto teqp::iteration::NRIterator::get_maxabsr ( ) const
inline

Get the maximum absolute value of residual vector, using the cached value for r.

Definition at line 323 of file iteration.hpp.

◆ get_message()

std::string teqp::iteration::NRIterator::get_message ( ) const
inline

Return the current message relaying information about success or failure of the iteration.

Definition at line 274 of file iteration.hpp.

◆ get_molefrac()

Eigen::ArrayXd teqp::iteration::NRIterator::get_molefrac ( ) const
inline

Return the current mole fractions.

Definition at line 270 of file iteration.hpp.

◆ get_nonconstant_indices()

auto teqp::iteration::NRIterator::get_nonconstant_indices ( ) const
inline

Get the indices of the nonconstant variables.

Definition at line 276 of file iteration.hpp.

◆ get_rho()

auto teqp::iteration::NRIterator::get_rho ( ) const
inline

Return the current molar density.

Definition at line 268 of file iteration.hpp.

◆ get_step_count()

int teqp::iteration::NRIterator::get_step_count ( ) const
inline

Return the current step counter.

Definition at line 272 of file iteration.hpp.

◆ get_T()

auto teqp::iteration::NRIterator::get_T ( ) const
inline

Return the current temperature.

Definition at line 266 of file iteration.hpp.

◆ get_vals()

Eigen::Array2d teqp::iteration::NRIterator::get_vals ( ) const
inline

Return the target values to be obtained.

Definition at line 264 of file iteration.hpp.

◆ get_vars()

std::vector< char > teqp::iteration::NRIterator::get_vars ( ) const
inline

Return the variables that are being used in the iteration.

Definition at line 262 of file iteration.hpp.

◆ path_integration()

auto teqp::iteration::NRIterator::path_integration ( double T,
double rho,
std::size_t N )
inline

Definition at line 467 of file iteration.hpp.

◆ reset()

void teqp::iteration::NRIterator::reset ( double T,
double rho )
inline

Definition at line 278 of file iteration.hpp.

◆ take_steps()

auto teqp::iteration::NRIterator::take_steps ( int N,
bool apply_stopping = true )
inline

Take a given number of steps

Parameters
NThe number of steps to take
apply_stoppingTrue to apply the stopping conditions

Special-case temperature-density inputs, which require only one step

Definition at line 331 of file iteration.hpp.

◆ take_steps_logrho()

auto teqp::iteration::NRIterator::take_steps_logrho ( int N)
inline

Take a given number of steps, with log(rho) as the density variable rather than rho, which helps when rho is VERY small to ensure that you can't have negative density

Parameters
NThe number of steps to take

Definition at line 386 of file iteration.hpp.

Member Data Documentation

◆ verbose

bool teqp::iteration::NRIterator::verbose = false

Definition at line 259 of file iteration.hpp.


The documentation for this class was generated from the following file: