From a39923fb3414d15b3a3525abe61a99e766793468 Mon Sep 17 00:00:00 2001 From: fedebenelli Date: Tue, 27 Aug 2024 18:52:57 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20ipqa-res?= =?UTF-8?q?earch/yaeos@caff0d6724deab6b035b9ae71569b635bd5f2e7d=20?= =?UTF-8?q?=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 2 +- interface/abs.html | 2 +- interface/abs_alpha.html | 12 +- interface/abs_bmix.html | 14 +- interface/abs_d1mix.html | 14 +- interface/abs_dmix.html | 26 +- interface/abs_optimize.html | 10 +- interface/abs_residual_helmholtz.html | 30 +- interface/abs_volume_initializer.html | 10 +- interface/acos.html | 2 +- interface/admm_rebase.html | 2 +- interface/admm_rebaseshadowed.html | 2 +- interface/admm_register.html | 2 +- interface/admm_registershadowed.html | 2 +- interface/admm_unregister.html | 2 +- interface/admm_unregistershadowed.html | 2 +- interface/ares.html | 24 +- interface/asin.html | 2 +- interface/assignment (=).html | 2 +- interface/atan.html | 2 +- interface/atan2.html | 2 +- interface/continuation_function.html | 14 +- interface/continuation_solver.html | 20 +- interface/continuation_stopper.html | 14 +- interface/cos.html | 2 +- interface/cosh.html | 2 +- interface/excess_gibbs.html | 8 +- interface/exp.html | 2 +- interface/f_1d.html | 8 +- interface/get_aij.html | 14 +- interface/hyperdual_ar.html | 10 +- interface/initial_volume.html | 8 +- interface/int.html | 2 +- interface/log.html | 2 +- interface/log10.html | 2 +- interface/max.html | 2 +- interface/mhv.html | 12 +- interface/min.html | 2 +- interface/model_from_x.html | 4 +- interface/newton.html | 8 +- interface/nint.html | 2 +- interface/nrtl.html | 12 +- interface/obj_func.html | 10 +- interface/operator (+).html | 2 +- interface/operator (+)~2.html | 2 +- interface/operator (-).html | 2 +- interface/operator (-)~2.html | 2 +- interface/operator (.eq.).html | 2 +- interface/operator (.ge.).html | 2 +- interface/operator (.gt.).html | 2 +- interface/operator (.le.).html | 2 +- interface/operator (.lt.).html | 2 +- interface/operator (.ne.).html | 2 +- interface/operator (ASTERISK).html | 2 +- interface/operator (ASTERISKASTERISK).html | 2 +- interface/operator (SLASH).html | 2 +- interface/optval.html | 4 +- interface/popinteger4.html | 4 +- interface/poppointer8.html | 2 +- interface/popreal8.html | 4 +- interface/popreal8array.html | 6 +- interface/process.html | 14 +- interface/pushinteger4.html | 4 +- interface/pushpointer8.html | 2 +- interface/pushreal8.html | 4 +- interface/pushreal8array.html | 6 +- interface/real.html | 2 +- interface/sign.html | 2 +- interface/sin.html | 2 +- interface/sinh.html | 2 +- interface/size.html | 4 +- interface/sqrt.html | 2 +- interface/sum.html | 2 +- interface/tan.html | 2 +- interface/tanh.html | 2 +- interface/tapenade_ar.html | 10 +- interface/tapenade_ar_b.html | 14 +- interface/tapenade_ar_d.html | 12 +- interface/tapenade_ar_d_b.html | 20 +- interface/tapenade_ar_d_d.html | 12 +- interface/tapenade_ge.html | 10 +- interface/tapenade_ge_b.html | 16 +- interface/tapenade_ge_d.html | 16 +- interface/tapenade_ge_d_b.html | 28 +- interface/tapenade_ge_d_d.html | 22 +- interface/tapenade_v0.html | 10 +- interface/temperature_dependence.html | 6 +- lists/absint.html | 2 +- lists/files.html | 2 +- lists/modules.html | 10 +- lists/procedures.html | 42 +- lists/types.html | 2 +- module/admm_tapenade_interface.html | 2 +- module/ar_interface.html | 30 +- module/auxiliar_functions.html | 10 +- module/hyperdual_mod.html | 6 +- module/legacy_ar_models.html | 162 ++--- module/legacy_thermo_properties.html | 36 +- module/yaeos.html | 8 +- module/yaeos__adiff_hyperdual_ar_api.html | 46 +- module/yaeos__autodiff.html | 4 +- module/yaeos__auxiliar.html | 4 +- module/yaeos__consistency.html | 2 +- module/yaeos__consistency_armodel.html | 46 +- module/yaeos__consistency_gemodel.html | 20 +- module/yaeos__constants.html | 2 +- module/yaeos__equilibria.html | 10 +- module/yaeos__equilibria_auxiliar.html | 18 +- ...ilibria_boundaries_phase_envelopes_pt.html | 12 +- ...ilibria_boundaries_phase_envelopes_px.html | 24 +- .../yaeos__equilibria_equilibrium_state.html | 18 +- module/yaeos__equilibria_flash.html | 16 +- module/yaeos__equilibria_pure_psat.html | 8 +- module/yaeos__equilibria_rachford_rice.html | 22 +- .../yaeos__equilibria_saturation_points.html | 34 +- module/yaeos__fitting.html | 14 +- module/yaeos__fitting_fit_kij_lij.html | 22 +- module/yaeos__fitting_fit_nrtl_mhv.html | 22 +- module/yaeos__math.html | 26 +- module/yaeos__math_continuation.html | 94 +-- module/yaeos__math_linalg.html | 6 +- module/yaeos__models.html | 10 +- module/yaeos__models_ar.html | 158 ++--- module/yaeos__models_ar_cubic_alphas.html | 30 +- ...aeos__models_ar_cubic_implementations.html | 4 +- .../yaeos__models_ar_cubic_mixing_base.html | 26 +- ...eos__models_ar_cubic_quadratic_mixing.html | 112 ++-- module/yaeos__models_ar_genericcubic.html | 132 ++-- module/yaeos__models_base.html | 4 +- ...models_cubic_mixing_rules_huron_vidal.html | 80 +-- module/yaeos__models_ge.html | 16 +- ...e_group_contribution_model_parameters.html | 24 +- ...__models_ge_group_contribution_unifac.html | 60 +- ..._group_contribution_unifac_parameters.html | 4 +- module/yaeos__models_ge_implementations.html | 4 +- module/yaeos__models_ge_nrtl.html | 144 ++--- module/yaeos__models_solvers.html | 16 +- module/yaeos__optimizers.html | 20 +- module/yaeos__optimizers_powell_wrap.html | 18 +- module/yaeos__phase_equilibria_stability.html | 34 +- module/yaeos__solvers_pressure_equality.html | 18 +- module/yaeos__substance.html | 2 +- module/yaeos__tapenade_ar_api.html | 118 ++-- module/yaeos__tapenade_ge_api.html | 120 ++-- module/yaeos__tapenade_interfaces.html | 18 +- page/contributing/index.html | 2 +- page/contributing/styleguide.html | 2 +- page/index.html | 2 +- page/python-api/.doctrees/environment.pickle | Bin 131070 -> 131070 bytes page/python-api/.doctrees/index.doctree | Bin 56158 -> 56158 bytes page/usage/eos/cubics/alpha.html | 2 +- page/usage/eos/cubics/index.html | 2 +- page/usage/eos/cubics/mixing.html | 2 +- page/usage/eos/index.html | 2 +- page/usage/excessmodels/index.html | 2 +- page/usage/excessmodels/nrtl.html | 2 +- page/usage/excessmodels/unifaclv.html | 2 +- page/usage/index.html | 2 +- page/usage/newmodels/analtical.html | 2 +- page/usage/newmodels/autodiff.html | 2 +- page/usage/newmodels/index.html | 2 +- page/usage/phase_equilibrium/envelopes.html | 2 +- page/usage/phase_equilibrium/flash.html | 2 +- page/usage/phase_equilibrium/index.html | 2 +- .../phase_equilibrium/saturation_points.html | 2 +- proc/abshyperdual.html | 2 +- proc/acoshyperdual.html | 2 +- proc/addhyperdualhyperdual.html | 2 +- proc/addhyperdualreal.html | 2 +- proc/addrealhyperdual.html | 2 +- proc/aijtder.html | 24 +- proc/allclose.html | 6 +- proc/alpha.html | 12 +- proc/alpha_rkpr.html | 12 +- proc/ar_consistency.html | 42 +- proc/ar_rkpr.html | 22 +- proc/ar_srkpr.html | 22 +- proc/arvnder.html | 20 +- proc/asinhyperdual.html | 2 +- proc/atan2hyperdual.html | 14 +- proc/atanhyperdual.html | 2 +- proc/atder.html | 12 +- proc/betalimits.html | 6 +- proc/betato01.html | 6 +- proc/bmix.html | 14 +- proc/bmix_linear.html | 10 +- proc/bmix_qmr.html | 26 +- proc/bmixmhv.html | 12 +- proc/bnder.html | 26 +- proc/continuation.html | 46 +- proc/coshhyperdual.html | 2 +- proc/coshyperdual.html | 10 +- proc/cp_residual_vt.html | 26 +- proc/cubic_roots.html | 10 +- proc/cubic_roots_rosendo.html | 10 +- proc/cubic_v0.html | 16 +- proc/cv_residual_vt.html | 18 +- proc/d1mix_constant.html | 14 +- proc/d1mix_rkpr.html | 26 +- proc/d1mixmhv.html | 14 +- proc/dandtnder.html | 36 +- proc/deltander.html | 20 +- proc/dividehyperdualhyperdual.html | 2 +- proc/dividehyperdualreal.html | 2 +- proc/dividerealhyperdual.html | 2 +- proc/dmix.html | 50 +- proc/dmixmhv.html | 60 +- proc/dx_to_dn.html | 8 +- proc/enthalpy_residual_vt.html | 46 +- proc/entropy_residual_vt.html | 30 +- proc/eq_dd.html | 2 +- proc/eq_di.html | 2 +- proc/eq_dr.html | 2 +- proc/eq_id.html | 2 +- proc/eq_rd.html | 2 +- proc/equalhyperdualhyperdual.html | 2 +- proc/equalhyperdualreal.html | 2 +- proc/error_function.html | 6 +- proc/excess_gibbs.html | 266 ++++---- proc/excess_gibbs_b.html | 44 +- proc/excess_gibbs_d.html | 44 +- proc/excess_gibbs_d_b.html | 56 +- proc/excess_gibbs_d_d.html | 50 +- proc/excess_gibbs_d_d_d.html | 50 +- proc/excess_gibbs~2.html | 406 ++++-------- proc/exphyperdual.html | 6 +- proc/flash.html | 36 +- proc/foo_wrap.html | 8 +- proc/fugacity_pt.html | 22 +- proc/fugacity_vt.html | 68 +- proc/full_newton.html | 22 +- proc/ge_combinatorial.html | 18 +- proc/ge_consistency.html | 16 +- proc/ge_dd.html | 2 +- proc/ge_di.html | 2 +- proc/ge_dr.html | 2 +- proc/ge_id.html | 2 +- proc/ge_rd.html | 2 +- proc/ge_residual.html | 30 +- proc/genericcubic_ar.html | 106 ++-- proc/get_maingroup_index.html | 4 +- proc/get_maingroups_aij.html | 14 +- proc/get_maingroups_bij.html | 14 +- proc/get_maingroups_cij.html | 12 +- proc/get_oma_omb.html | 6 +- proc/get_subgroup_index.html | 4 +- proc/get_subgroup_maingroup.html | 4 +- proc/get_subgroup_q.html | 4 +- proc/get_subgroup_r.html | 4 +- proc/get_subgroups_aij.html | 14 +- proc/get_subgroups_bij.html | 14 +- proc/get_subgroups_cij.html | 12 +- proc/get_v0.html | 12 +- proc/get_z.html | 6 +- proc/get_zc_oma_omb.html | 6 +- proc/gibbs_residual_vt.html | 42 +- proc/gt_dd.html | 2 +- proc/gt_di.html | 2 +- proc/gt_dr.html | 2 +- proc/gt_id.html | 2 +- proc/gt_rd.html | 2 +- proc/helmrkpr.html | 90 +-- proc/helmsrkpr.html | 80 +-- proc/init.html | 110 +++- proc/init~2.html | 110 +--- proc/inthyperdual.html | 2 +- proc/k_wilson.html | 12 +- proc/kij_constant.html | 22 +- proc/le_dd.html | 2 +- proc/le_di.html | 2 +- proc/le_dr.html | 2 +- proc/le_id.html | 2 +- proc/le_rd.html | 2 +- proc/ln_activity_coefficient.html | 12 +- proc/log10hyperdual.html | 2 +- proc/loghyperdual.html | 2 +- proc/lt_dd.html | 2 +- proc/lt_di.html | 2 +- proc/lt_dr.html | 2 +- proc/lt_id.html | 2 +- proc/lt_rd.html | 2 +- proc/max_dd.html | 2 +- proc/max_ddd.html | 2 +- proc/max_dr.html | 2 +- proc/max_rd.html | 2 +- proc/min_dd.html | 2 +- proc/min_dr.html | 2 +- proc/min_rd.html | 2 +- proc/min_tpd.html | 14 +- proc/min_tpd_to_optimize.html | 8 +- proc/minushyperdualhyperdual.html | 2 +- proc/model_from_x.html | 67 +- proc/model_from_x~2.html | 67 +- proc/multiplyhyperdualhyperdual.html | 2 +- proc/multiplyhyperdualint.html | 2 +- proc/multiplyhyperdualreal.html | 2 +- proc/multiplyinthyperdual.html | 2 +- proc/multiplyrealhyperdual.html | 2 +- proc/ne_dd.html | 2 +- proc/ne_di.html | 2 +- proc/ne_dr.html | 2 +- proc/ne_id.html | 2 +- proc/ne_rd.html | 2 +- proc/newton_1d.html | 20 +- proc/ninthyperdual.html | 2 +- proc/numeric_ar_derivatives.html | 52 +- proc/numeric_ge_derivatives.html | 28 +- proc/optimize.html | 6 +- proc/optval_integer.html | 4 +- proc/optval_real.html | 4 +- proc/p_wilson.html | 12 +- proc/pengrobinson76.html | 20 +- proc/pengrobinson78.html | 20 +- proc/plushyperdualhyperdual.html | 2 +- proc/powell_optimize.html | 14 +- proc/powerhyperdualhyperdual.html | 2 +- proc/powerhyperdualint.html | 6 +- proc/powerhyperdualreal.html | 6 +- proc/pr76_factory.html | 6 +- proc/pr78_factory.html | 6 +- proc/pressure.html | 46 +- proc/pressure_equality_v_beta_xy.html | 16 +- proc/psat.html | 20 +- proc/pt_envelope_2ph.html | 28 +- proc/purefug_calc.html | 38 +- proc/px_envelope_2ph.html | 90 +-- proc/rachford_rice.html | 8 +- proc/realhyperdual.html | 2 +- proc/rel_error.html | 6 +- proc/residual_helmholtz.html | 580 +++++------------- proc/residual_helmholtz~2.html | 580 +++++++++++++----- proc/rkpr.html | 20 +- proc/rkpr_d1mix.html | 14 +- proc/saturation_pressure.html | 60 +- proc/saturation_temperature.html | 56 +- proc/setup.html | 4 +- proc/setup_unifac.html | 14 +- proc/sign_dd.html | 2 +- proc/sign_dr.html | 2 +- proc/sign_rd.html | 2 +- proc/sinhhyperdual.html | 2 +- proc/sinhyperdual.html | 10 +- proc/size_ar_model.html | 4 +- proc/soaveredlichkwong.html | 16 +- proc/solve_rr.html | 16 +- proc/solve_system.html | 18 +- proc/sort.html | 4 +- proc/sq_error.html | 2 +- proc/sqrthyperdual.html | 2 +- proc/srk_factory.html | 10 +- proc/subtracthyperdualhyperdual.html | 2 +- proc/subtracthyperdualreal.html | 2 +- proc/subtractrealhyperdual.html | 2 +- proc/sumhyperdual.html | 6 +- proc/sumhyperdual2.html | 6 +- proc/tanhhyperdual.html | 2 +- proc/tanhyperdual.html | 10 +- proc/termo.html | 42 +- proc/thetas_i.html | 14 +- proc/tm.html | 14 +- proc/unifac_temperature_dependence.html | 14 +- proc/unifacparameters.html | 2 +- proc/v0.html | 18 +- proc/vcalc.html | 50 +- proc/volume.html | 538 ++++------------ proc/volume_michelsen.html | 34 +- proc/volume~2.html | 540 ++++++++++++---- proc/write_equilibriumstate.html | 2 +- proc/write_ptenvel2.html | 10 +- proc/ztvtermo.html | 42 +- search.html | 2 +- sourcefile/admm_tapenade_interface.f90.html | 2 +- sourcefile/alphas.f90.html | 2 +- sourcefile/ar_interface.f90.html | 2 +- sourcefile/ar_models.f90.html | 2 +- sourcefile/armodel_adiff_api.f90.html | 2 +- sourcefile/autodiff.f90.html | 2 +- sourcefile/auxiliar.f90.html | 71 +-- sourcefile/auxiliar.f90~2.html | 71 ++- sourcefile/auxiliar_functions.f90.html | 2 +- sourcefile/base.f90.html | 124 +--- sourcefile/base.f90~2.html | 124 +++- sourcefile/consistency.f90.html | 2 +- sourcefile/consistency_armodel.f90.html | 2 +- sourcefile/consistency_gemodel.f90.html | 2 +- sourcefile/constants.f90.html | 2 +- sourcefile/continuation.f90.html | 2 +- sourcefile/equilibria.f90.html | 2 +- sourcefile/equilibria_state.f90.html | 2 +- sourcefile/fit_kij_lij.f90.html | 2 +- sourcefile/fit_nrtl_mhv.f90.html | 2 +- sourcefile/fitting.f90.html | 2 +- sourcefile/flash.f90.html | 2 +- sourcefile/ge_models.f90.html | 2 +- sourcefile/generic_cubic.f90.html | 2 +- sourcefile/huron_vidal.f90.html | 2 +- sourcefile/hyperdual.f90.html | 2 +- sourcefile/implementations.f90.html | 2 +- sourcefile/implementations.f90~2.html | 2 +- sourcefile/interfaces.f90.html | 2 +- sourcefile/legacy.f90.html | 2 +- sourcefile/linalg.f90.html | 2 +- sourcefile/math.f90.html | 2 +- sourcefile/model_parameters.f90.html | 2 +- sourcefile/models.f90.html | 2 +- sourcefile/nrtl.f90.html | 2 +- sourcefile/optimizers.f90.html | 2 +- sourcefile/phase_envelopes_pt.f90.html | 2 +- sourcefile/phase_envelopes_px.f90.html | 2 +- sourcefile/pressure_equality.f90.html | 2 +- sourcefile/pure_psat.f90.html | 2 +- sourcefile/quadratic_mixing.f90.html | 2 +- sourcefile/rachford_rice.f90.html | 2 +- sourcefile/saturations_points.f90.html | 2 +- sourcefile/stability.f90.html | 2 +- sourcefile/substance.f90.html | 2 +- sourcefile/tapenade_ar_api.f90.html | 2 +- sourcefile/tapenade_ge_api.f90.html | 2 +- sourcefile/unifac.f90.html | 2 +- sourcefile/unifac_parameters.f90.html | 2 +- sourcefile/volume.f90.html | 2 +- sourcefile/yaeos.f90.html | 2 +- src/auxiliar.f90 | 59 +- src/base.f90 | 110 +++- tipuesearch/tipuesearch_content.js | 2 +- type/alphafunction.html | 6 +- type/alpharkpr.html | 10 +- type/alphasoave.html | 10 +- type/armodel.html | 18 +- type/armodeladiff.html | 24 +- type/armodeltapenade.html | 24 +- type/basemodel.html | 4 +- type/continuationvariable.html | 18 +- type/criticalpoint.html | 10 +- type/criticalpoint~2.html | 10 +- type/cubiceos.html | 30 +- type/cubicmixrule.html | 14 +- type/equilibriumstate.html | 34 +- type/fitkijlij.html | 22 +- type/fitmhvnrtl.html | 18 +- type/fittingproblem.html | 14 +- type/gegcmodelparameters.html | 2 +- type/gemodel.html | 2 +- type/gemodeltapenade.html | 28 +- type/groups.html | 6 +- type/hyperdual.html | 10 +- type/mhv.html | 34 +- type/nrtl.html | 48 +- type/optimizer.html | 6 +- type/powellwrapper.html | 6 +- type/psifunction.html | 2 +- type/ptenvel2.html | 2 +- type/pxenvel2.html | 6 +- type/qmr.html | 26 +- type/qmr_rkpr.html | 26 +- type/substances.html | 2 +- type/tmoptimizedata.html | 18 +- type/unifac.html | 14 +- type/unifacpsi.html | 2 +- 459 files changed, 4867 insertions(+), 4978 deletions(-) diff --git a/index.html b/index.html index 98d17b323..d9a2a6043 100644 --- a/index.html +++ b/index.html @@ -354,7 +354,7 @@

Derived Types

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/abs.html b/interface/abs.html index 1f5db0c93..f62e80deb 100644 --- a/interface/abs.html +++ b/interface/abs.html @@ -216,7 +216,7 @@

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/abs_alpha.html b/interface/abs_alpha.html index fca795787..10832373d 100644 --- a/interface/abs_alpha.html +++ b/interface/abs_alpha.html @@ -157,7 +157,7 @@

Arguments

- + class(AlphaFunction), intent(in) @@ -172,7 +172,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -187,7 +187,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -202,7 +202,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -217,7 +217,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -253,7 +253,7 @@

Arguments

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/abs_bmix.html b/interface/abs_bmix.html index 129484687..ef9c4d6e9 100644 --- a/interface/abs_bmix.html +++ b/interface/abs_bmix.html @@ -157,7 +157,7 @@

Arguments

- + class(CubicMixRule), intent(in) @@ -172,7 +172,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -187,7 +187,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -202,7 +202,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -217,7 +217,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -232,7 +232,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -268,7 +268,7 @@

Arguments

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/abs_d1mix.html b/interface/abs_d1mix.html index 0ce521f2e..d7a53a352 100644 --- a/interface/abs_d1mix.html +++ b/interface/abs_d1mix.html @@ -157,7 +157,7 @@

Arguments

- + class(CubicMixRule), intent(in) @@ -172,7 +172,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -187,7 +187,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -202,7 +202,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -217,7 +217,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -232,7 +232,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -268,7 +268,7 @@

Arguments

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/abs_dmix.html b/interface/abs_dmix.html index d39e9ebcf..e903cb28e 100644 --- a/interface/abs_dmix.html +++ b/interface/abs_dmix.html @@ -157,7 +157,7 @@

Arguments

- + class(CubicMixRule), intent(in) @@ -172,7 +172,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -187,7 +187,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -202,7 +202,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -217,7 +217,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -232,7 +232,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -247,7 +247,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -262,7 +262,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -277,7 +277,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -292,7 +292,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -307,7 +307,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -322,7 +322,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -358,7 +358,7 @@

Arguments

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/abs_optimize.html b/interface/abs_optimize.html index 09996d5f6..6176a3ebb 100644 --- a/interface/abs_optimize.html +++ b/interface/abs_optimize.html @@ -172,7 +172,7 @@

Arguments

- + procedure(obj_func) @@ -187,7 +187,7 @@

Arguments

- + real(kind=pr), intent(inout) @@ -202,7 +202,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -217,7 +217,7 @@

Arguments

- + class(*), intent(inout), @@ -253,7 +253,7 @@

Arguments

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/abs_residual_helmholtz.html b/interface/abs_residual_helmholtz.html index de38ffe90..54055c348 100644 --- a/interface/abs_residual_helmholtz.html +++ b/interface/abs_residual_helmholtz.html @@ -157,7 +157,7 @@

Arguments

- + class(ArModel), intent(in) @@ -172,7 +172,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -187,7 +187,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -202,7 +202,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -217,7 +217,7 @@

Arguments

- + real(kind=pr), intent(out), @@ -232,7 +232,7 @@

Arguments

- + real(kind=pr), intent(out), @@ -249,7 +249,7 @@

Arguments

- + real(kind=pr), intent(out), @@ -266,7 +266,7 @@

Arguments

- + real(kind=pr), intent(out), @@ -283,7 +283,7 @@

Arguments

- + real(kind=pr), intent(out), @@ -300,7 +300,7 @@

Arguments

- + real(kind=pr), intent(out), @@ -317,7 +317,7 @@

Arguments

- + real(kind=pr), intent(out), @@ -334,7 +334,7 @@

Arguments

- + real(kind=pr), intent(out), @@ -351,7 +351,7 @@

Arguments

- + real(kind=pr), intent(out), @@ -368,7 +368,7 @@

Arguments

- + real(kind=pr), intent(out), @@ -421,7 +421,7 @@

Description

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/abs_volume_initializer.html b/interface/abs_volume_initializer.html index b6479f3b3..a0c9e1fb0 100644 --- a/interface/abs_volume_initializer.html +++ b/interface/abs_volume_initializer.html @@ -157,7 +157,7 @@

Arguments

- + class(ArModel), intent(in) @@ -172,7 +172,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -187,7 +187,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -202,7 +202,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -245,7 +245,7 @@

Description

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/acos.html b/interface/acos.html index a090d431a..d6a47c7dc 100644 --- a/interface/acos.html +++ b/interface/acos.html @@ -216,7 +216,7 @@

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/admm_rebase.html b/interface/admm_rebase.html index 6c72ebfcf..12e2768dd 100644 --- a/interface/admm_rebase.html +++ b/interface/admm_rebase.html @@ -210,7 +210,7 @@

Arguments

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/admm_rebaseshadowed.html b/interface/admm_rebaseshadowed.html index 09f5ef543..5049094b1 100644 --- a/interface/admm_rebaseshadowed.html +++ b/interface/admm_rebaseshadowed.html @@ -225,7 +225,7 @@

Arguments

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/admm_register.html b/interface/admm_register.html index 117a12e6b..07f7bae31 100644 --- a/interface/admm_register.html +++ b/interface/admm_register.html @@ -255,7 +255,7 @@

Arguments

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/admm_registershadowed.html b/interface/admm_registershadowed.html index 7c067e772..e57a0e3e4 100644 --- a/interface/admm_registershadowed.html +++ b/interface/admm_registershadowed.html @@ -300,7 +300,7 @@

Arguments

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/admm_unregister.html b/interface/admm_unregister.html index 1675ac72b..02f9faadf 100644 --- a/interface/admm_unregister.html +++ b/interface/admm_unregister.html @@ -225,7 +225,7 @@

Arguments

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/admm_unregistershadowed.html b/interface/admm_unregistershadowed.html index c90d6d593..0d8a07f68 100644 --- a/interface/admm_unregistershadowed.html +++ b/interface/admm_unregistershadowed.html @@ -240,7 +240,7 @@

Arguments

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/ares.html b/interface/ares.html index 0d53c618b..56e59d9ef 100644 --- a/interface/ares.html +++ b/interface/ares.html @@ -157,7 +157,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -172,7 +172,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -187,7 +187,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -202,7 +202,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -217,7 +217,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -232,7 +232,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -247,7 +247,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -262,7 +262,7 @@

Arguments

- + real(kind=pr), intent(out), @@ -277,7 +277,7 @@

Arguments

- + real(kind=pr), intent(out), @@ -292,7 +292,7 @@

Arguments

- + real(kind=pr), intent(out), @@ -307,7 +307,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -343,7 +343,7 @@

Arguments

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/asin.html b/interface/asin.html index 20608919f..15fb89fc5 100644 --- a/interface/asin.html +++ b/interface/asin.html @@ -216,7 +216,7 @@

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/assignment (=).html b/interface/assignment (=).html index cc7e74eff..edbc4b922 100644 --- a/interface/assignment (=).html +++ b/interface/assignment (=).html @@ -282,7 +282,7 @@

Arguments

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/atan.html b/interface/atan.html index ba1793f33..a2ec962ac 100644 --- a/interface/atan.html +++ b/interface/atan.html @@ -216,7 +216,7 @@

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/atan2.html b/interface/atan2.html index 4c93bab97..e25ae80b2 100644 --- a/interface/atan2.html +++ b/interface/atan2.html @@ -231,7 +231,7 @@

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/continuation_function.html b/interface/continuation_function.html index 74428144b..8ac8812df 100644 --- a/interface/continuation_function.html +++ b/interface/continuation_function.html @@ -157,7 +157,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -172,7 +172,7 @@

Arguments

- + integer, intent(in) @@ -187,7 +187,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -202,7 +202,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -217,7 +217,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -232,7 +232,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -268,7 +268,7 @@

Arguments

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/continuation_solver.html b/interface/continuation_solver.html index 513c4491a..574ff2d18 100644 --- a/interface/continuation_solver.html +++ b/interface/continuation_solver.html @@ -187,7 +187,7 @@

Arguments

- + real(kind=pr), intent(inout) @@ -202,7 +202,7 @@

Arguments

- + integer, intent(in) @@ -217,7 +217,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -232,7 +232,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -247,7 +247,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -262,7 +262,7 @@

Arguments

- + integer, intent(in) @@ -292,7 +292,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -307,7 +307,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -337,7 +337,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -375,7 +375,7 @@

Description

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/continuation_stopper.html b/interface/continuation_stopper.html index 26943a1ed..edbe8a79b 100644 --- a/interface/continuation_stopper.html +++ b/interface/continuation_stopper.html @@ -157,7 +157,7 @@

Arguments

- + real(kind=pr), intent(inout) @@ -173,7 +173,7 @@

Arguments

- + integer, intent(inout) @@ -188,7 +188,7 @@

Arguments

- + real(kind=pr), intent(inout) @@ -203,7 +203,7 @@

Arguments

- + real(kind=pr), intent(inout) @@ -218,7 +218,7 @@

Arguments

- + real(kind=pr), intent(inout) @@ -235,7 +235,7 @@

Arguments

- + integer, intent(in) @@ -275,7 +275,7 @@

Description

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/cos.html b/interface/cos.html index bf17a557e..975075cce 100644 --- a/interface/cos.html +++ b/interface/cos.html @@ -216,7 +216,7 @@

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/cosh.html b/interface/cosh.html index 4a8bb5e63..44a500683 100644 --- a/interface/cosh.html +++ b/interface/cosh.html @@ -216,7 +216,7 @@

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/excess_gibbs.html b/interface/excess_gibbs.html index 284f26dd0..47e51a227 100644 --- a/interface/excess_gibbs.html +++ b/interface/excess_gibbs.html @@ -157,7 +157,7 @@

Arguments

- + class(GeModel), intent(in) @@ -172,7 +172,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -187,7 +187,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -319,7 +319,7 @@

Description

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/exp.html b/interface/exp.html index c5561d7eb..f2d38f3b7 100644 --- a/interface/exp.html +++ b/interface/exp.html @@ -216,7 +216,7 @@

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/f_1d.html b/interface/f_1d.html index 8bfd71fe1..62c16d4f1 100644 --- a/interface/f_1d.html +++ b/interface/f_1d.html @@ -157,7 +157,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -172,7 +172,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -187,7 +187,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -223,7 +223,7 @@

Arguments

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/get_aij.html b/interface/get_aij.html index 4eb1c8a1f..4a815bbd2 100644 --- a/interface/get_aij.html +++ b/interface/get_aij.html @@ -157,7 +157,7 @@

Arguments

- + class(QMR), intent(in) @@ -172,7 +172,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -187,7 +187,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -202,7 +202,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -217,7 +217,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -232,7 +232,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -302,7 +302,7 @@

Description

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/hyperdual_ar.html b/interface/hyperdual_ar.html index 01abff11a..8e5b55e47 100644 --- a/interface/hyperdual_ar.html +++ b/interface/hyperdual_ar.html @@ -157,7 +157,7 @@

Arguments

- + class(ArModelAdiff) @@ -172,7 +172,7 @@

Arguments

- + type(hyperdual), intent(in) @@ -187,7 +187,7 @@

Arguments

- + type(hyperdual), intent(in) @@ -202,7 +202,7 @@

Arguments

- + type(hyperdual), intent(in) @@ -240,7 +240,7 @@

Return Value t

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/initial_volume.html b/interface/initial_volume.html index e4701d374..05ad13b35 100644 --- a/interface/initial_volume.html +++ b/interface/initial_volume.html @@ -157,7 +157,7 @@

Arguments

- + real(kind=pr) @@ -172,7 +172,7 @@

Arguments

- + real(kind=pr) @@ -187,7 +187,7 @@

Arguments

- + real(kind=pr) @@ -225,7 +225,7 @@

Return Value Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/int.html b/interface/int.html index 50926408a..e58aff738 100644 --- a/interface/int.html +++ b/interface/int.html @@ -216,7 +216,7 @@

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/log.html b/interface/log.html index 70c1d41f1..2f15b024d 100644 --- a/interface/log.html +++ b/interface/log.html @@ -216,7 +216,7 @@

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/log10.html b/interface/log10.html index 425cfec3c..5d1d67811 100644 --- a/interface/log10.html +++ b/interface/log10.html @@ -216,7 +216,7 @@

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/max.html b/interface/max.html index 515b761fe..f98d1c9c9 100644 --- a/interface/max.html +++ b/interface/max.html @@ -429,7 +429,7 @@

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/mhv.html b/interface/mhv.html index 8acb97a78..23ff97b09 100644 --- a/interface/mhv.html +++ b/interface/mhv.html @@ -135,7 +135,7 @@

Module Procedures

- init + init
@@ -155,7 +155,7 @@

public interface MHV

Module Procedures

-

private function init(Ge, b, q, lij) result(mixrule) +

private function init(Ge, b, q, lij) result(mixrule)

@@ -174,7 +174,7 @@

Arguments

- + class(GeModel), intent(in) @@ -189,7 +189,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -219,7 +219,7 @@

Arguments

- + real(kind=pr), intent(in), @@ -261,7 +261,7 @@

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/min.html b/interface/min.html index 59b713b30..b8792decb 100644 --- a/interface/min.html +++ b/interface/min.html @@ -353,7 +353,7 @@

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/model_from_x.html b/interface/model_from_x.html index 7bfd17e48..6fd357d55 100644 --- a/interface/model_from_x.html +++ b/interface/model_from_x.html @@ -157,7 +157,7 @@

Arguments

- + class(FittingProblem), intent(inout) @@ -210,7 +210,7 @@

Description

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/newton.html b/interface/newton.html index 70498d7ab..293c44dfb 100644 --- a/interface/newton.html +++ b/interface/newton.html @@ -174,7 +174,7 @@

Arguments

- + procedure(f_1d) @@ -189,7 +189,7 @@

Arguments

- + real(kind=pr), intent(inout) @@ -204,7 +204,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -256,7 +256,7 @@

Arguments

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/nint.html b/interface/nint.html index efb25e0ca..4d7c7722a 100644 --- a/interface/nint.html +++ b/interface/nint.html @@ -216,7 +216,7 @@

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/nrtl.html b/interface/nrtl.html index 2cb0f33da..32375bd80 100644 --- a/interface/nrtl.html +++ b/interface/nrtl.html @@ -135,7 +135,7 @@

Module Procedures

- init + init
@@ -155,7 +155,7 @@

public interface NRTL

Module Procedures

-

public function init(a, b, c) +

public function init(a, b, c)

@@ -174,7 +174,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -189,7 +189,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -204,7 +204,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -246,7 +246,7 @@

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/obj_func.html b/interface/obj_func.html index 69ee788d4..40525f3af 100644 --- a/interface/obj_func.html +++ b/interface/obj_func.html @@ -157,7 +157,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -172,7 +172,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -187,7 +187,7 @@

Arguments

- + real(kind=pr), intent(out), @@ -202,7 +202,7 @@

Arguments

- + class(*), intent(inout), @@ -238,7 +238,7 @@

Arguments

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/operator (+).html b/interface/operator (+).html index d0c114fde..75f33b0de 100644 --- a/interface/operator (+).html +++ b/interface/operator (+).html @@ -216,7 +216,7 @@

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/operator (+)~2.html b/interface/operator (+)~2.html index f5726b38f..7c372ca8e 100644 --- a/interface/operator (+)~2.html +++ b/interface/operator (+)~2.html @@ -353,7 +353,7 @@

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/operator (-).html b/interface/operator (-).html index 8e64132f9..9d43539b9 100644 --- a/interface/operator (-).html +++ b/interface/operator (-).html @@ -216,7 +216,7 @@

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/operator (-)~2.html b/interface/operator (-)~2.html index 1d054b85f..d612cf251 100644 --- a/interface/operator (-)~2.html +++ b/interface/operator (-)~2.html @@ -353,7 +353,7 @@

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/operator (.eq.).html b/interface/operator (.eq.).html index fdea92481..3d2a08217 100644 --- a/interface/operator (.eq.).html +++ b/interface/operator (.eq.).html @@ -475,7 +475,7 @@

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/operator (.ge.).html b/interface/operator (.ge.).html index ff87ad392..3bdfcb0f1 100644 --- a/interface/operator (.ge.).html +++ b/interface/operator (.ge.).html @@ -475,7 +475,7 @@

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/operator (.gt.).html b/interface/operator (.gt.).html index 5367a027a..ddc76326c 100644 --- a/interface/operator (.gt.).html +++ b/interface/operator (.gt.).html @@ -475,7 +475,7 @@

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/operator (.le.).html b/interface/operator (.le.).html index 1c5051c37..0d0b04e6b 100644 --- a/interface/operator (.le.).html +++ b/interface/operator (.le.).html @@ -475,7 +475,7 @@

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/operator (.lt.).html b/interface/operator (.lt.).html index de68f3c48..6c298e2a3 100644 --- a/interface/operator (.lt.).html +++ b/interface/operator (.lt.).html @@ -475,7 +475,7 @@

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/operator (.ne.).html b/interface/operator (.ne.).html index 0289e54c5..a418546b6 100644 --- a/interface/operator (.ne.).html +++ b/interface/operator (.ne.).html @@ -475,7 +475,7 @@

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/operator (ASTERISK).html b/interface/operator (ASTERISK).html index 2904bbcd7..3e504058e 100644 --- a/interface/operator (ASTERISK).html +++ b/interface/operator (ASTERISK).html @@ -475,7 +475,7 @@

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/operator (ASTERISKASTERISK).html b/interface/operator (ASTERISKASTERISK).html index 9a37a7f63..46c609920 100644 --- a/interface/operator (ASTERISKASTERISK).html +++ b/interface/operator (ASTERISKASTERISK).html @@ -353,7 +353,7 @@

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/operator (SLASH).html b/interface/operator (SLASH).html index af26dc411..6143a03ac 100644 --- a/interface/operator (SLASH).html +++ b/interface/operator (SLASH).html @@ -353,7 +353,7 @@

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/optval.html b/interface/optval.html index 89f1db41e..343d1dd8a 100644 --- a/interface/optval.html +++ b/interface/optval.html @@ -90,7 +90,7 @@

optval

diff --git a/interface/popinteger4.html b/interface/popinteger4.html index 99a5d68e3..e902c32e3 100644 --- a/interface/popinteger4.html +++ b/interface/popinteger4.html @@ -157,7 +157,7 @@

Arguments

- + integer @@ -193,7 +193,7 @@

Arguments

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/poppointer8.html b/interface/poppointer8.html index fafc94bce..233b8ef80 100644 --- a/interface/poppointer8.html +++ b/interface/poppointer8.html @@ -210,7 +210,7 @@

Arguments

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/popreal8.html b/interface/popreal8.html index c89d657e9..80733973a 100644 --- a/interface/popreal8.html +++ b/interface/popreal8.html @@ -157,7 +157,7 @@

Arguments

- + real(kind=pr) @@ -193,7 +193,7 @@

Arguments

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/popreal8array.html b/interface/popreal8array.html index be0e0e06f..e68ede2a3 100644 --- a/interface/popreal8array.html +++ b/interface/popreal8array.html @@ -157,7 +157,7 @@

Arguments

- + real(kind=pr), @@ -172,7 +172,7 @@

Arguments

- + integer @@ -208,7 +208,7 @@

Arguments

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/process.html b/interface/process.html index 688cd71ec..6341c2ba0 100644 --- a/interface/process.html +++ b/interface/process.html @@ -157,7 +157,7 @@

Arguments

- + real(kind=pr), intent(inout) @@ -173,7 +173,7 @@

Arguments

- + integer, intent(inout) @@ -188,7 +188,7 @@

Arguments

- + real(kind=pr), intent(inout) @@ -203,7 +203,7 @@

Arguments

- + real(kind=pr), intent(inout) @@ -218,7 +218,7 @@

Arguments

- + real(kind=pr), intent(inout) @@ -235,7 +235,7 @@

Arguments

- + integer, intent(in) @@ -273,7 +273,7 @@

Description

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/pushinteger4.html b/interface/pushinteger4.html index 17d6bc72e..0c5af11c8 100644 --- a/interface/pushinteger4.html +++ b/interface/pushinteger4.html @@ -157,7 +157,7 @@

Arguments

- + integer @@ -193,7 +193,7 @@

Arguments

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/pushpointer8.html b/interface/pushpointer8.html index 6ba1b510e..9bea9ab37 100644 --- a/interface/pushpointer8.html +++ b/interface/pushpointer8.html @@ -210,7 +210,7 @@

Arguments

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/pushreal8.html b/interface/pushreal8.html index 7ea379aac..ce8943190 100644 --- a/interface/pushreal8.html +++ b/interface/pushreal8.html @@ -157,7 +157,7 @@

Arguments

- + real(kind=pr) @@ -193,7 +193,7 @@

Arguments

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/pushreal8array.html b/interface/pushreal8array.html index 64f49ff3f..d9cee8bec 100644 --- a/interface/pushreal8array.html +++ b/interface/pushreal8array.html @@ -157,7 +157,7 @@

Arguments

- + real(kind=pr), @@ -172,7 +172,7 @@

Arguments

- + integer @@ -208,7 +208,7 @@

Arguments

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/real.html b/interface/real.html index d0c5bb1ba..d43a0b56d 100644 --- a/interface/real.html +++ b/interface/real.html @@ -216,7 +216,7 @@

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/sign.html b/interface/sign.html index b5df258dc..492580853 100644 --- a/interface/sign.html +++ b/interface/sign.html @@ -353,7 +353,7 @@

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/sin.html b/interface/sin.html index 03e561265..88a6916ee 100644 --- a/interface/sin.html +++ b/interface/sin.html @@ -216,7 +216,7 @@

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/sinh.html b/interface/sinh.html index 40e882467..38ec7c49e 100644 --- a/interface/sinh.html +++ b/interface/sinh.html @@ -216,7 +216,7 @@

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/size.html b/interface/size.html index f5c904c61..a9b474cb0 100644 --- a/interface/size.html +++ b/interface/size.html @@ -174,7 +174,7 @@

Arguments

- + class(ArModel), intent(in) @@ -216,7 +216,7 @@

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/sqrt.html b/interface/sqrt.html index 226cb7a8d..6199f2b3b 100644 --- a/interface/sqrt.html +++ b/interface/sqrt.html @@ -216,7 +216,7 @@

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/sum.html b/interface/sum.html index 6e1fb15e6..ea22498cc 100644 --- a/interface/sum.html +++ b/interface/sum.html @@ -292,7 +292,7 @@

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/tan.html b/interface/tan.html index 655eba5e1..aa04359c7 100644 --- a/interface/tan.html +++ b/interface/tan.html @@ -216,7 +216,7 @@

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/tanh.html b/interface/tanh.html index 1a97710da..41ff9820a 100644 --- a/interface/tanh.html +++ b/interface/tanh.html @@ -216,7 +216,7 @@

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/tapenade_ar.html b/interface/tapenade_ar.html index 181012d40..eeb8a3d9b 100644 --- a/interface/tapenade_ar.html +++ b/interface/tapenade_ar.html @@ -157,7 +157,7 @@

Arguments

- + class(ArModelTapenade), intent(in) @@ -172,7 +172,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -187,7 +187,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -202,7 +202,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -253,7 +253,7 @@

Arguments

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/tapenade_ar_b.html b/interface/tapenade_ar_b.html index 5c71f2bd2..d6a99fb06 100644 --- a/interface/tapenade_ar_b.html +++ b/interface/tapenade_ar_b.html @@ -157,7 +157,7 @@

Arguments

- + class(ArModelTapenade), intent(in) @@ -172,7 +172,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -187,7 +187,7 @@

Arguments

- + real(kind=pr) @@ -202,7 +202,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -232,7 +232,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -247,7 +247,7 @@

Arguments

- + real(kind=pr) @@ -313,7 +313,7 @@

Arguments

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/tapenade_ar_d.html b/interface/tapenade_ar_d.html index 9a8bf6ccd..e24908943 100644 --- a/interface/tapenade_ar_d.html +++ b/interface/tapenade_ar_d.html @@ -157,7 +157,7 @@

Arguments

- + class(ArModelTapenade), intent(in) @@ -172,7 +172,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -187,7 +187,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -202,7 +202,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -232,7 +232,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -313,7 +313,7 @@

Arguments

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/tapenade_ar_d_b.html b/interface/tapenade_ar_d_b.html index a7b5373ce..08f03621f 100644 --- a/interface/tapenade_ar_d_b.html +++ b/interface/tapenade_ar_d_b.html @@ -157,7 +157,7 @@

Arguments

- + class(ArModelTapenade), intent(in) @@ -172,7 +172,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -187,7 +187,7 @@

Arguments

- + real(kind=pr) @@ -202,7 +202,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -217,7 +217,7 @@

Arguments

- + real(kind=pr) @@ -232,7 +232,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -292,7 +292,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -307,7 +307,7 @@

Arguments

- + real(kind=pr) @@ -337,7 +337,7 @@

Arguments

- + real(kind=pr) @@ -433,7 +433,7 @@

Arguments

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/tapenade_ar_d_d.html b/interface/tapenade_ar_d_d.html index 660e6b4ac..ba3c4258e 100644 --- a/interface/tapenade_ar_d_d.html +++ b/interface/tapenade_ar_d_d.html @@ -157,7 +157,7 @@

Arguments

- + class(ArModelTapenade), intent(in) @@ -172,7 +172,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -187,7 +187,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -202,7 +202,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -247,7 +247,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -373,7 +373,7 @@

Arguments

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/tapenade_ge.html b/interface/tapenade_ge.html index e57ded26a..0fe6d79ff 100644 --- a/interface/tapenade_ge.html +++ b/interface/tapenade_ge.html @@ -157,7 +157,7 @@

Arguments

- + class(GeModelTapenade) @@ -172,7 +172,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -187,7 +187,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -202,7 +202,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -238,7 +238,7 @@

Arguments

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/tapenade_ge_b.html b/interface/tapenade_ge_b.html index 82efb664f..29aec508f 100644 --- a/interface/tapenade_ge_b.html +++ b/interface/tapenade_ge_b.html @@ -157,7 +157,7 @@

Arguments

- + class(GeModelTapenade) @@ -172,7 +172,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -187,7 +187,7 @@

Arguments

- + real(kind=pr) @@ -202,7 +202,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -217,7 +217,7 @@

Arguments

- + real(kind=pr) @@ -232,7 +232,7 @@

Arguments

- + real(kind=pr) @@ -247,7 +247,7 @@

Arguments

- + real(kind=pr) @@ -283,7 +283,7 @@

Arguments

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/tapenade_ge_d.html b/interface/tapenade_ge_d.html index ed981b11f..73d659418 100644 --- a/interface/tapenade_ge_d.html +++ b/interface/tapenade_ge_d.html @@ -157,7 +157,7 @@

Arguments

- + class(GeModelTapenade) @@ -172,7 +172,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -187,7 +187,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -202,7 +202,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -217,7 +217,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -232,7 +232,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -247,7 +247,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -283,7 +283,7 @@

Arguments

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/tapenade_ge_d_b.html b/interface/tapenade_ge_d_b.html index 2420b9848..304bfbda9 100644 --- a/interface/tapenade_ge_d_b.html +++ b/interface/tapenade_ge_d_b.html @@ -157,7 +157,7 @@

Arguments

- + class(GeModelTapenade) @@ -172,7 +172,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -187,7 +187,7 @@

Arguments

- + real(kind=pr) @@ -202,7 +202,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -217,7 +217,7 @@

Arguments

- + real(kind=pr) @@ -232,7 +232,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -247,7 +247,7 @@

Arguments

- + real(kind=pr) @@ -262,7 +262,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -277,7 +277,7 @@

Arguments

- + real(kind=pr) @@ -292,7 +292,7 @@

Arguments

- + real(kind=pr) @@ -307,7 +307,7 @@

Arguments

- + real(kind=pr) @@ -322,7 +322,7 @@

Arguments

- + real(kind=pr) @@ -337,7 +337,7 @@

Arguments

- + real(kind=pr) @@ -373,7 +373,7 @@

Arguments

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/tapenade_ge_d_d.html b/interface/tapenade_ge_d_d.html index 8468702c2..d444cf7a7 100644 --- a/interface/tapenade_ge_d_d.html +++ b/interface/tapenade_ge_d_d.html @@ -157,7 +157,7 @@

Arguments

- + class(GeModelTapenade) @@ -172,7 +172,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -187,7 +187,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -202,7 +202,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -217,7 +217,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -232,7 +232,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -247,7 +247,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -262,7 +262,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -277,7 +277,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -292,7 +292,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -328,7 +328,7 @@

Arguments

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/tapenade_v0.html b/interface/tapenade_v0.html index 1d2503451..729b822b2 100644 --- a/interface/tapenade_v0.html +++ b/interface/tapenade_v0.html @@ -157,7 +157,7 @@

Arguments

- + class(ArModelTapenade), intent(in) @@ -172,7 +172,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -187,7 +187,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -202,7 +202,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -240,7 +240,7 @@

Return Value re

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/interface/temperature_dependence.html b/interface/temperature_dependence.html index d5a3ade4b..03aa59a4e 100644 --- a/interface/temperature_dependence.html +++ b/interface/temperature_dependence.html @@ -157,7 +157,7 @@

Arguments

- + class(PsiFunction) @@ -188,7 +188,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -279,7 +279,7 @@

temperature_dependence interface

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/lists/absint.html b/lists/absint.html index 96358ed18..e9fba3aeb 100644 --- a/lists/absint.html +++ b/lists/absint.html @@ -250,7 +250,7 @@

Abstract Interfaces

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/lists/files.html b/lists/files.html index 9f356c0fc..373ee6f8e 100644 --- a/lists/files.html +++ b/lists/files.html @@ -295,7 +295,7 @@

Source Files

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/lists/modules.html b/lists/modules.html index e2e04c323..aaf3aba93 100644 --- a/lists/modules.html +++ b/lists/modules.html @@ -123,7 +123,7 @@

Modules

yaeos__auxiliar - auxiliar.f90 + auxiliar.f90 @@ -153,7 +153,7 @@

Modules

yaeos__equilibria_auxiliar - auxiliar.f90 + auxiliar.f90

Auxiliar functions used for phase-equilibria calculation.

@@ -248,7 +248,7 @@

Modules

yaeos__models_ar_cubic_mixing_base - base.f90 + base.f90

Procedures of the core calculations of CubicEoS mixing rules.

Read more… @@ -263,7 +263,7 @@

Modules

yaeos__models_base - base.f90 + base.f90

Basic element of a thermodynamic model.

@@ -369,7 +369,7 @@

Modules

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/lists/procedures.html b/lists/procedures.html index f31d5ed83..04f698117 100644 --- a/lists/procedures.html +++ b/lists/procedures.html @@ -485,22 +485,22 @@

Procedures

points and an error function of:

Read more… - EXCESS_GIBBS - yaeos__models_ge_NRTL + excess_gibbs + yaeos__tapenade_ge_api Subroutine - +

Excess Gibbs model generic interface

- excess_gibbs + excess_gibbs yaeos__models_ge_group_contribution_unifac Subroutine -

Calculate the Gibbs excess energy of the UNIFAC model

Read more… +

Calculate the Gibbs excess energy of the UNIFAC model

Read more… - excess_gibbs - yaeos__tapenade_ge_api + EXCESS_GIBBS + yaeos__models_ge_NRTL Subroutine -

Excess Gibbs model generic interface

+ EXCESS_GIBBS_B @@ -776,13 +776,13 @@

Procedures

init - yaeos__models_ge_NRTL + yaeos__models_cubic_mixing_rules_huron_vidal Function init - yaeos__models_cubic_mixing_rules_huron_vidal + yaeos__models_ge_NRTL Function @@ -980,13 +980,13 @@

Procedures

model_from_X - yaeos__fitting_fit_nrtl_mhv + yaeos__fitting_fit_kij_lij Subroutine model_from_X - yaeos__fitting_fit_kij_lij + yaeos__fitting_fit_nrtl_mhv Subroutine @@ -1366,15 +1366,15 @@

Procedures

residual_helmholtz - yaeos__tapenade_ar_api + yaeos__adiff_hyperdual_ar_api Subroutine -

Residual Helmholtz model generic interface

+ residual_helmholtz - yaeos__adiff_hyperdual_ar_api + yaeos__tapenade_ar_api Subroutine - +

Residual Helmholtz model generic interface

RKPR @@ -1627,15 +1627,15 @@

Procedures

volume - yaeos__models_ar_genericcubic + yaeos__models_ar Subroutine -

Volume solver optimized for Cubic Equations of State.

Read more… +

Solves volume roots using newton method. Given pressure and temperature.

Read more… volume - yaeos__models_ar + yaeos__models_ar_genericcubic Subroutine -

Solves volume roots using newton method. Given pressure and temperature.

Read more… +

Volume solver optimized for Cubic Equations of State.

Read more… volume_michelsen @@ -1688,7 +1688,7 @@

Procedures

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/lists/types.html b/lists/types.html index 8693badd9..e6eb628ef 100644 --- a/lists/types.html +++ b/lists/types.html @@ -322,7 +322,7 @@

Derived Types

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/module/admm_tapenade_interface.html b/module/admm_tapenade_interface.html index 8e1c1aa69..96bef74d1 100644 --- a/module/admm_tapenade_interface.html +++ b/module/admm_tapenade_interface.html @@ -770,7 +770,7 @@

Arguments

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/module/ar_interface.html b/module/ar_interface.html index 2e94d012b..b5855d42c 100644 --- a/module/ar_interface.html +++ b/module/ar_interface.html @@ -260,7 +260,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -275,7 +275,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -290,7 +290,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -305,7 +305,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -320,7 +320,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -335,7 +335,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -350,7 +350,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -365,7 +365,7 @@

Arguments

- + real(kind=pr), intent(out), @@ -380,7 +380,7 @@

Arguments

- + real(kind=pr), intent(out), @@ -395,7 +395,7 @@

Arguments

- + real(kind=pr), intent(out), @@ -410,7 +410,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -456,7 +456,7 @@

Arguments

- + real(kind=pr) @@ -471,7 +471,7 @@

Arguments

- + real(kind=pr) @@ -486,7 +486,7 @@

Arguments

- + real(kind=pr) @@ -538,7 +538,7 @@

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/module/auxiliar_functions.html b/module/auxiliar_functions.html index 6a821680c..6b48d8b4c 100644 --- a/module/auxiliar_functions.html +++ b/module/auxiliar_functions.html @@ -193,7 +193,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -208,7 +208,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -268,7 +268,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -283,7 +283,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -332,7 +332,7 @@

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/module/hyperdual_mod.html b/module/hyperdual_mod.html index b6109e8f9..2425bcd7d 100644 --- a/module/hyperdual_mod.html +++ b/module/hyperdual_mod.html @@ -5223,7 +5223,7 @@

Components

- + real(kind=pr), public @@ -5257,7 +5257,7 @@

Components

- + real(kind=pr), public @@ -9894,7 +9894,7 @@

Arguments

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/module/legacy_ar_models.html b/module/legacy_ar_models.html index b5afcbabe..06f9a02d5 100644 --- a/module/legacy_ar_models.html +++ b/module/legacy_ar_models.html @@ -118,24 +118,24 @@

Variables

@@ -255,7 +255,7 @@

Variables

- + real(kind=pr), public, @@ -272,7 +272,7 @@

Variables

- + real(kind=pr), public, @@ -324,7 +324,7 @@

Variables

- + real(kind=pr), public, @@ -392,7 +392,7 @@

Variables

- + real(kind=pr), public, @@ -426,7 +426,7 @@

Variables

- + integer, public @@ -545,7 +545,7 @@

Variables

- + real(kind=pr), public, @@ -592,7 +592,7 @@

Arguments

- + real(kind=pr) @@ -607,7 +607,7 @@

Arguments

- + real(kind=pr) @@ -622,7 +622,7 @@

Arguments

- + real(kind=pr) @@ -672,7 +672,7 @@

Arguments

- + integer, intent(in) @@ -717,7 +717,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -732,7 +732,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -747,7 +747,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -762,7 +762,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -822,7 +822,7 @@

Arguments

- + real(kind=pr), intent(out), @@ -837,7 +837,7 @@

Arguments

- + real(kind=pr), intent(out), @@ -852,7 +852,7 @@

Arguments

- + real(kind=pr), intent(out), @@ -867,7 +867,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -907,7 +907,7 @@

Arguments

- + integer, intent(in) @@ -937,7 +937,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -952,7 +952,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -967,7 +967,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -1007,7 +1007,7 @@

Arguments

- + integer, intent(in) @@ -1052,7 +1052,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -1067,7 +1067,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -1122,7 +1122,7 @@

Arguments

- + integer, intent(in) @@ -1137,7 +1137,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -1167,7 +1167,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -1182,7 +1182,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -1212,7 +1212,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -1227,7 +1227,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -1242,7 +1242,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -1342,7 +1342,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -1357,7 +1357,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -1372,7 +1372,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -1387,7 +1387,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -1402,7 +1402,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -1417,7 +1417,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -1432,7 +1432,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -1447,7 +1447,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -1462,7 +1462,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -1477,7 +1477,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -1517,7 +1517,7 @@

Arguments

- + integer, intent(in) @@ -1532,7 +1532,7 @@

Arguments

- + integer, intent(in) @@ -1577,7 +1577,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -1592,7 +1592,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -1607,7 +1607,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -1667,7 +1667,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -1682,7 +1682,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -1697,7 +1697,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -1712,7 +1712,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -2172,7 +2172,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -2187,7 +2187,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -2202,7 +2202,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -2287,7 +2287,7 @@

Arguments

- + integer, intent(in) @@ -2302,7 +2302,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -2317,7 +2317,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -2387,7 +2387,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -2402,7 +2402,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -2417,7 +2417,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -2432,7 +2432,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -2492,7 +2492,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -2507,7 +2507,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -2522,7 +2522,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -2537,7 +2537,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -2578,7 +2578,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -2593,7 +2593,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -2608,7 +2608,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -2623,7 +2623,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -2683,7 +2683,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -2698,7 +2698,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -2713,7 +2713,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -2728,7 +2728,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -2853,7 +2853,7 @@

Arguments

- + integer, intent(in) @@ -2941,7 +2941,7 @@

Arguments

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/module/legacy_thermo_properties.html b/module/legacy_thermo_properties.html index 6bb731f3f..ece0415c6 100644 --- a/module/legacy_thermo_properties.html +++ b/module/legacy_thermo_properties.html @@ -157,8 +157,8 @@

Uses

@@ -197,7 +197,7 @@

Arguments

- + integer, intent(in) @@ -227,7 +227,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -242,7 +242,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -257,7 +257,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -312,7 +312,7 @@

Arguments

- + integer, intent(in) @@ -357,7 +357,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -372,7 +372,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -402,7 +402,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -517,7 +517,7 @@

Arguments

- + integer, intent(in) @@ -562,7 +562,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -577,7 +577,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -592,7 +592,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -640,7 +640,7 @@

Arguments

- + integer, intent(in) @@ -670,7 +670,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -700,7 +700,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -715,7 +715,7 @@

Arguments

- + real(kind=pr), intent(out) @@ -833,7 +833,7 @@

Arguments

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/module/yaeos.html b/module/yaeos.html index 3e56ef67e..2b5f0f2c9 100644 --- a/module/yaeos.html +++ b/module/yaeos.html @@ -164,11 +164,11 @@

Uses

@@ -240,7 +240,7 @@

Variables

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/module/yaeos__adiff_hyperdual_ar_api.html b/module/yaeos__adiff_hyperdual_ar_api.html index f91cb7e39..3533a3b90 100644 --- a/module/yaeos__adiff_hyperdual_ar_api.html +++ b/module/yaeos__adiff_hyperdual_ar_api.html @@ -150,7 +150,7 @@

Subroutines

@@ -215,8 +215,8 @@

Uses

  • @@ -258,7 +258,7 @@

    Arguments

    - + class(ArModelAdiff) @@ -273,7 +273,7 @@

    Arguments

    - + type(hyperdual), intent(in) @@ -288,7 +288,7 @@

    Arguments

    - + type(hyperdual), intent(in) @@ -303,7 +303,7 @@

    Arguments

    - + type(hyperdual), intent(in) @@ -402,7 +402,7 @@

    Type-Bound Procedures

    procedure(hyperdual_Ar), public, deferred :: - Ar + Ar @@ -427,7 +427,7 @@

    Type-Bound Procedures

    procedure(abs_volume_initializer), public, deferred :: - get_v0 + get_v0 @@ -452,12 +452,12 @@

    Type-Bound Procedures

    procedure, public :: - residual_helmholtz + residual_helmholtz procedure, public :: - volume + volume @@ -472,7 +472,7 @@

    Type-Bound Procedures

    Subroutines

    -

    public subroutine residual_helmholtz(self, n, v, t, Ar, ArV, ArT, ArTV, ArV2, ArT2, Arn, ArVn, ArTn, Arn2) +

    public subroutine residual_helmholtz(self, n, v, t, Ar, ArV, ArT, ArTV, ArV2, ArT2, Arn, ArVn, ArTn, Arn2)

    @@ -491,7 +491,7 @@

    Arguments

    - + class(ArModelAdiff), intent(in) @@ -506,7 +506,7 @@

    Arguments

    - + real(kind=pr), intent(in) @@ -521,7 +521,7 @@

    Arguments

    - + real(kind=pr), intent(in) @@ -536,7 +536,7 @@

    Arguments

    - + real(kind=pr), intent(in) @@ -551,7 +551,7 @@

    Arguments

    - + real(kind=pr), intent(out), @@ -566,7 +566,7 @@

    Arguments

    - + real(kind=pr), intent(out), @@ -581,7 +581,7 @@

    Arguments

    - + real(kind=pr), intent(out), @@ -596,7 +596,7 @@

    Arguments

    - + real(kind=pr), intent(out), @@ -611,7 +611,7 @@

    Arguments

    - + real(kind=pr), intent(out), @@ -626,7 +626,7 @@

    Arguments

    - + real(kind=pr), intent(out), @@ -686,7 +686,7 @@

    Arguments

    - + real(kind=pr), intent(out), @@ -729,7 +729,7 @@

    Arguments

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/module/yaeos__autodiff.html b/module/yaeos__autodiff.html index bd7560edf..c1471c765 100644 --- a/module/yaeos__autodiff.html +++ b/module/yaeos__autodiff.html @@ -144,8 +144,8 @@

    Uses

    @@ -183,7 +183,7 @@

    Uses

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/module/yaeos__auxiliar.html b/module/yaeos__auxiliar.html index 65704cbdd..dfe5ac594 100644 --- a/module/yaeos__auxiliar.html +++ b/module/yaeos__auxiliar.html @@ -90,7 +90,7 @@

    yaeos__auxiliar
    @@ -530,7 +530,7 @@

    Arguments

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/module/yaeos__consistency.html b/module/yaeos__consistency.html index c45191ddb..1bb6d5b7c 100644 --- a/module/yaeos__consistency.html +++ b/module/yaeos__consistency.html @@ -204,7 +204,7 @@

    Uses

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/module/yaeos__consistency_armodel.html b/module/yaeos__consistency_armodel.html index bcecca908..5796c7168 100644 --- a/module/yaeos__consistency_armodel.html +++ b/module/yaeos__consistency_armodel.html @@ -179,8 +179,8 @@

    Uses

    @@ -220,7 +220,7 @@

    Arguments

    - + class(ArModel), intent(in) @@ -235,7 +235,7 @@

    Arguments

    - + real(kind=pr), intent(in) @@ -250,7 +250,7 @@

    Arguments

    - + real(kind=pr), intent(in) @@ -265,7 +265,7 @@

    Arguments

    - + real(kind=pr), intent(in) @@ -380,7 +380,7 @@

    Arguments

    - + class(ArModel), intent(in) @@ -395,7 +395,7 @@

    Arguments

    - + real(kind=pr), intent(in) @@ -410,7 +410,7 @@

    Arguments

    - + real(kind=pr), intent(in) @@ -425,7 +425,7 @@

    Arguments

    - + real(kind=pr), intent(in) @@ -440,7 +440,7 @@

    Arguments

    - + real(kind=pr), intent(in) @@ -455,7 +455,7 @@

    Arguments

    - + real(kind=pr), intent(in) @@ -470,7 +470,7 @@

    Arguments

    - + real(kind=pr), intent(in) @@ -485,7 +485,7 @@

    Arguments

    - + real(kind=pr), intent(out) @@ -500,7 +500,7 @@

    Arguments

    - + real(kind=pr), intent(out), @@ -517,7 +517,7 @@

    Arguments

    - + real(kind=pr), intent(out), @@ -534,7 +534,7 @@

    Arguments

    - + real(kind=pr), intent(out), @@ -551,7 +551,7 @@

    Arguments

    - + real(kind=pr), intent(out), @@ -568,7 +568,7 @@

    Arguments

    - + real(kind=pr), intent(out), @@ -585,7 +585,7 @@

    Arguments

    - + real(kind=pr), intent(out), @@ -602,7 +602,7 @@

    Arguments

    - + real(kind=pr), intent(out), @@ -619,7 +619,7 @@

    Arguments

    - + real(kind=pr), intent(out), @@ -636,7 +636,7 @@

    Arguments

    - + real(kind=pr), intent(out), @@ -681,7 +681,7 @@

    Arguments

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/module/yaeos__consistency_gemodel.html b/module/yaeos__consistency_gemodel.html index 17c7e9225..72045e6aa 100644 --- a/module/yaeos__consistency_gemodel.html +++ b/module/yaeos__consistency_gemodel.html @@ -179,8 +179,8 @@

    Uses

    @@ -220,7 +220,7 @@

    Arguments

    - + class(GeModel), intent(in) @@ -236,7 +236,7 @@

    Arguments

    - + real(kind=pr), intent(in) @@ -251,7 +251,7 @@

    Arguments

    - + real(kind=pr), intent(in) @@ -351,7 +351,7 @@

    Arguments

    - + class(GeModel), intent(in) @@ -367,7 +367,7 @@

    Arguments

    - + real(kind=pr), intent(in) @@ -382,7 +382,7 @@

    Arguments

    - + real(kind=pr), intent(in) @@ -397,7 +397,7 @@

    Arguments

    - + real(kind=pr), intent(in) @@ -412,7 +412,7 @@

    Arguments

    - + real(kind=pr), intent(in) @@ -555,7 +555,7 @@

    Arguments

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/module/yaeos__constants.html b/module/yaeos__constants.html index 89fef9ad0..838d098ac 100644 --- a/module/yaeos__constants.html +++ b/module/yaeos__constants.html @@ -298,7 +298,7 @@

    Variables

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/module/yaeos__equilibria.html b/module/yaeos__equilibria.html index 98bd338bf..38962cc08 100644 --- a/module/yaeos__equilibria.html +++ b/module/yaeos__equilibria.html @@ -145,12 +145,12 @@

    Uses

@@ -188,7 +188,7 @@

Uses

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/module/yaeos__equilibria_auxiliar.html b/module/yaeos__equilibria_auxiliar.html index cb1a2819d..4ae3edc85 100644 --- a/module/yaeos__equilibria_auxiliar.html +++ b/module/yaeos__equilibria_auxiliar.html @@ -90,7 +90,7 @@

yaeos__equilibria_auxiliar
@@ -155,8 +155,8 @@

Uses

@@ -194,7 +194,7 @@

Arguments

- + class(BaseModel), intent(in) @@ -209,7 +209,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -224,7 +224,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -269,7 +269,7 @@

Arguments

- + class(BaseModel), intent(in) @@ -284,7 +284,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -299,7 +299,7 @@

Arguments

- + real(kind=pr), intent(in) @@ -348,7 +348,7 @@

Documentation generated by FORD - on 2024-08-27 18:43

+ on 2024-08-27 18:52


diff --git a/module/yaeos__equilibria_boundaries_phase_envelopes_pt.html b/module/yaeos__equilibria_boundaries_phase_envelopes_pt.html index ca3b46d90..fed18b234 100644 --- a/module/yaeos__equilibria_boundaries_phase_envelopes_pt.html +++ b/module/yaeos__equilibria_boundaries_phase_envelopes_pt.html @@ -189,9 +189,9 @@

Uses

  • @@ -285,7 +285,7 @@

    Components

    - + real(kind=pr), public @@ -302,7 +302,7 @@

    Components

    - + real(kind=pr), public @@ -433,7 +433,7 @@

    Arguments

    - + class(ArModel), intent(in) @@ -725,7 +725,7 @@

    Arguments

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/module/yaeos__equilibria_boundaries_phase_envelopes_px.html b/module/yaeos__equilibria_boundaries_phase_envelopes_px.html index da6b13238..10baac1be 100644 --- a/module/yaeos__equilibria_boundaries_phase_envelopes_px.html +++ b/module/yaeos__equilibria_boundaries_phase_envelopes_px.html @@ -117,7 +117,7 @@

    Variables

    - Vy + Vy Vz
    @@ -189,9 +189,9 @@

    Uses

    • @@ -217,7 +217,7 @@

      Variables

      - + real(kind=pr), private @@ -285,7 +285,7 @@

      Components

      - + real(kind=pr), public @@ -302,7 +302,7 @@

      Components

      - + real(kind=pr), public @@ -355,7 +355,7 @@

      Components

      - + real(kind=pr), public, @@ -472,7 +472,7 @@

      Arguments

      - + class(ArModel), intent(in) @@ -612,7 +612,7 @@

      Arguments

      - + procedure(continuation_solver), @@ -678,7 +678,7 @@

      Arguments

      - + real(kind=pr), intent(in) @@ -724,7 +724,7 @@

      Arguments

      - + real(kind=pr), intent(out) @@ -783,7 +783,7 @@

      Arguments

      Documentation generated by FORD - on 2024-08-27 18:43

      + on 2024-08-27 18:52


      diff --git a/module/yaeos__equilibria_equilibrium_state.html b/module/yaeos__equilibria_equilibrium_state.html index 5b961ee52..4a7987223 100644 --- a/module/yaeos__equilibria_equilibrium_state.html +++ b/module/yaeos__equilibria_equilibrium_state.html @@ -207,7 +207,7 @@

      Components

      - + real(kind=pr), public @@ -224,7 +224,7 @@

      Components

      - + real(kind=pr), public @@ -258,7 +258,7 @@

      Components

      - + real(kind=pr), public @@ -275,7 +275,7 @@

      Components

      - + real(kind=pr), public @@ -292,7 +292,7 @@

      Components

      - + integer, public @@ -309,7 +309,7 @@

      Components

      - + character(len=14), public @@ -326,7 +326,7 @@

      Components

      - + real(kind=pr), public, @@ -343,7 +343,7 @@

      Components

      - + real(kind=pr), public, @@ -526,7 +526,7 @@

      Arguments

      Documentation generated by FORD - on 2024-08-27 18:43

      + on 2024-08-27 18:52


      diff --git a/module/yaeos__equilibria_flash.html b/module/yaeos__equilibria_flash.html index fc99ba32e..3f3cefc61 100644 --- a/module/yaeos__equilibria_flash.html +++ b/module/yaeos__equilibria_flash.html @@ -154,12 +154,12 @@

      Uses

      @@ -197,7 +197,7 @@

      Arguments

      - + class(ArModel), intent(in) @@ -212,7 +212,7 @@

      Arguments

      - + real(kind=pr), intent(in) @@ -287,7 +287,7 @@

      Arguments

      - + integer, intent(out), @@ -336,7 +336,7 @@

      Documentation generated by FORD - on 2024-08-27 18:43

      + on 2024-08-27 18:52


      diff --git a/module/yaeos__equilibria_pure_psat.html b/module/yaeos__equilibria_pure_psat.html index a1713b4a2..7ccc45b6e 100644 --- a/module/yaeos__equilibria_pure_psat.html +++ b/module/yaeos__equilibria_pure_psat.html @@ -155,8 +155,8 @@

      Uses

      @@ -195,7 +195,7 @@

      Arguments

      - + class(ArModel), intent(in) @@ -226,7 +226,7 @@

      Arguments

      - + real(kind=pr), intent(in) @@ -275,7 +275,7 @@

      Documentation generated by FORD - on 2024-08-27 18:43

      + on 2024-08-27 18:52


      diff --git a/module/yaeos__equilibria_rachford_rice.html b/module/yaeos__equilibria_rachford_rice.html index 8e306f3f5..ec8f0343c 100644 --- a/module/yaeos__equilibria_rachford_rice.html +++ b/module/yaeos__equilibria_rachford_rice.html @@ -197,7 +197,7 @@

      Arguments

      - + real(kind=pr), intent(in) @@ -212,7 +212,7 @@

      Arguments

      - + real(kind=pr), intent(in) @@ -282,7 +282,7 @@

      Arguments

      - + real(kind=pr), intent(in) @@ -297,7 +297,7 @@

      Arguments

      - + real(kind=pr) @@ -338,7 +338,7 @@

      Arguments

      - + real(kind=pr), intent(in) @@ -353,7 +353,7 @@

      Arguments

      - + real(kind=pr), intent(in) @@ -368,7 +368,7 @@

      Arguments

      - + real(kind=pr), intent(in) @@ -438,7 +438,7 @@

      Arguments

      - + real(kind=pr), intent(in) @@ -453,7 +453,7 @@

      Arguments

      - + real(kind=pr), intent(in) @@ -468,7 +468,7 @@

      Arguments

      - + real(kind=pr), intent(out) @@ -544,7 +544,7 @@

      Arguments

      Documentation generated by FORD - on 2024-08-27 18:43

      + on 2024-08-27 18:52


      diff --git a/module/yaeos__equilibria_saturation_points.html b/module/yaeos__equilibria_saturation_points.html index 60e7a2b6c..9e5a6a2a0 100644 --- a/module/yaeos__equilibria_saturation_points.html +++ b/module/yaeos__equilibria_saturation_points.html @@ -117,9 +117,9 @@

      Variables

      @@ -168,9 +168,9 @@

      Uses

      • @@ -196,7 +196,7 @@

        Variables

        - + integer, public @@ -230,7 +230,7 @@

        Variables

        - + real(kind=pr), public @@ -277,7 +277,7 @@

        Arguments

        - + class(ArModel), intent(in) @@ -292,7 +292,7 @@

        Arguments

        - + real(kind=pr), intent(in) @@ -307,7 +307,7 @@

        Arguments

        - + real(kind=pr), intent(in) @@ -322,7 +322,7 @@

        Arguments

        - + character(len=*), intent(in) @@ -367,7 +367,7 @@

        Arguments

        - + integer, intent(in), @@ -412,7 +412,7 @@

        Arguments

        - + class(ArModel), intent(in) @@ -427,7 +427,7 @@

        Arguments

        - + real(kind=pr), intent(in) @@ -442,7 +442,7 @@

        Arguments

        - + real(kind=pr), intent(in) @@ -457,7 +457,7 @@

        Arguments

        - + character(len=*), intent(in) @@ -502,7 +502,7 @@

        Arguments

        - + integer, intent(in), @@ -551,7 +551,7 @@

        Documentation generated by FORD - on 2024-08-27 18:43

        + on 2024-08-27 18:52


        diff --git a/module/yaeos__fitting.html b/module/yaeos__fitting.html index 360a503da..27a9b7e31 100644 --- a/module/yaeos__fitting.html +++ b/module/yaeos__fitting.html @@ -187,9 +187,9 @@

        Uses

        • @@ -231,7 +231,7 @@

          Arguments

          - + class(FittingProblem), intent(inout) @@ -317,7 +317,7 @@

          Components

          - + class(ArModel), public, @@ -334,7 +334,7 @@

          Components

          - + logical, public @@ -360,7 +360,7 @@

          Type-Bound Procedures

          procedure(model_from_X), public, deferred :: - get_model_from_X + get_model_from_X @@ -424,7 +424,7 @@

          Arguments

          - + class(FittingProblem), intent(inout), @@ -564,7 +564,7 @@

          Arguments

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/module/yaeos__fitting_fit_kij_lij.html b/module/yaeos__fitting_fit_kij_lij.html index ab5944b28..08d863578 100644 --- a/module/yaeos__fitting_fit_kij_lij.html +++ b/module/yaeos__fitting_fit_kij_lij.html @@ -117,7 +117,7 @@

          Variables

          - nc + nc
          @@ -150,7 +150,7 @@

          Subroutines

          @@ -201,7 +201,7 @@

          Variables

          - + integer, public, @@ -286,7 +286,7 @@

          Components

          - + logical, public @@ -303,7 +303,7 @@

          Components

          - + class(ArModel), public, @@ -320,7 +320,7 @@

          Components

          - + logical, public @@ -346,7 +346,7 @@

          Type-Bound Procedures

          procedure, public :: - get_model_from_X => model_from_X + get_model_from_X => model_from_X @@ -361,7 +361,7 @@

          Type-Bound Procedures

          Subroutines

          -

          public subroutine model_from_X(problem, X) +

          public subroutine model_from_X(problem, X)

          @@ -380,7 +380,7 @@

          Arguments

          - + class(FitKijLij), intent(inout) @@ -395,7 +395,7 @@

          Arguments

          - + real(kind=pr), intent(in) @@ -438,7 +438,7 @@

          Arguments

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/module/yaeos__fitting_fit_nrtl_mhv.html b/module/yaeos__fitting_fit_nrtl_mhv.html index 4cb4de80f..beac1b85a 100644 --- a/module/yaeos__fitting_fit_nrtl_mhv.html +++ b/module/yaeos__fitting_fit_nrtl_mhv.html @@ -117,7 +117,7 @@

          Variables

          - nc + nc
          @@ -150,7 +150,7 @@

          Subroutines

          @@ -177,9 +177,9 @@

          Uses

        @@ -204,7 +204,7 @@

        Variables

        - + integer, public, @@ -272,7 +272,7 @@

        Components

        - + logical, public @@ -306,7 +306,7 @@

        Components

        - + class(ArModel), public, @@ -323,7 +323,7 @@

        Components

        - + logical, public @@ -349,7 +349,7 @@

        Type-Bound Procedures

        procedure, public :: - get_model_from_X => model_from_X + get_model_from_X => model_from_X @@ -364,7 +364,7 @@

        Type-Bound Procedures

        Subroutines

        -

        public subroutine model_from_X(problem, X) +

        public subroutine model_from_X(problem, X)

        @@ -398,7 +398,7 @@

        Arguments

        - + real(kind=pr), intent(in) @@ -441,7 +441,7 @@

        Arguments

        Documentation generated by FORD - on 2024-08-27 18:43

        + on 2024-08-27 18:52


        diff --git a/module/yaeos__math.html b/module/yaeos__math.html index fec5ba62d..083d7d2c0 100644 --- a/module/yaeos__math.html +++ b/module/yaeos__math.html @@ -209,9 +209,9 @@

        Uses

        @@ -254,7 +254,7 @@

        Arguments

        - + procedure(f_1d) @@ -269,7 +269,7 @@

        Arguments

        - + real(kind=pr), intent(inout) @@ -284,7 +284,7 @@

        Arguments

        - + real(kind=pr), intent(in) @@ -350,7 +350,7 @@

        Arguments

        - + real(kind=pr), intent(in) @@ -365,7 +365,7 @@

        Arguments

        - + real(kind=pr), intent(out) @@ -380,7 +380,7 @@

        Arguments

        - + real(kind=pr), intent(out) @@ -431,7 +431,7 @@

        Arguments

        - + real(kind=pr), intent(in) @@ -446,7 +446,7 @@

        Arguments

        - + real(kind=pr), intent(in) @@ -556,7 +556,7 @@

        Arguments

        - + procedure(f_1d) @@ -571,7 +571,7 @@

        Arguments

        - + real(kind=pr), intent(inout) @@ -586,7 +586,7 @@

        Arguments

        - + real(kind=pr), intent(in) @@ -644,7 +644,7 @@

        Arguments

        Documentation generated by FORD - on 2024-08-27 18:43

        + on 2024-08-27 18:52


        diff --git a/module/yaeos__math_continuation.html b/module/yaeos__math_continuation.html index 0e067b618..f594dfd8e 100644 --- a/module/yaeos__math_continuation.html +++ b/module/yaeos__math_continuation.html @@ -190,8 +190,8 @@

        Uses

        @@ -232,7 +232,7 @@

        Arguments

        - + real(kind=pr), intent(in) @@ -247,7 +247,7 @@

        Arguments

        - + integer, intent(in) @@ -262,7 +262,7 @@

        Arguments

        - + real(kind=pr), intent(in) @@ -277,7 +277,7 @@

        Arguments

        - + real(kind=pr), intent(out) @@ -292,7 +292,7 @@

        Arguments

        - + real(kind=pr), intent(out) @@ -307,7 +307,7 @@

        Arguments

        - + real(kind=pr), intent(out) @@ -383,7 +383,7 @@

        Arguments

        - + real(kind=pr), intent(inout) @@ -398,7 +398,7 @@

        Arguments

        - + integer, intent(in) @@ -413,7 +413,7 @@

        Arguments

        - + real(kind=pr), intent(in) @@ -428,7 +428,7 @@

        Arguments

        - + real(kind=pr), intent(in) @@ -443,7 +443,7 @@

        Arguments

        - + real(kind=pr), intent(in) @@ -458,7 +458,7 @@

        Arguments

        - + integer, intent(in) @@ -488,7 +488,7 @@

        Arguments

        - + real(kind=pr), intent(out) @@ -503,7 +503,7 @@

        Arguments

        - + real(kind=pr), intent(out) @@ -533,7 +533,7 @@

        Arguments

        - + real(kind=pr), intent(in) @@ -579,7 +579,7 @@

        Arguments

        - + real(kind=pr), intent(inout) @@ -595,7 +595,7 @@

        Arguments

        - + integer, intent(inout) @@ -610,7 +610,7 @@

        Arguments

        - + real(kind=pr), intent(inout) @@ -625,7 +625,7 @@

        Arguments

        - + real(kind=pr), intent(inout) @@ -640,7 +640,7 @@

        Arguments

        - + real(kind=pr), intent(inout) @@ -657,7 +657,7 @@

        Arguments

        - + integer, intent(in) @@ -708,7 +708,7 @@

        Arguments

        - + real(kind=pr), intent(inout) @@ -724,7 +724,7 @@

        Arguments

        - + integer, intent(inout) @@ -739,7 +739,7 @@

        Arguments

        - + real(kind=pr), intent(inout) @@ -754,7 +754,7 @@

        Arguments

        - + real(kind=pr), intent(inout) @@ -769,7 +769,7 @@

        Arguments

        - + real(kind=pr), intent(inout) @@ -786,7 +786,7 @@

        Arguments

        - + integer, intent(in) @@ -837,7 +837,7 @@

        Components

        - + real(kind=pr), public @@ -854,7 +854,7 @@

        Components

        - + real(kind=pr), public, @@ -871,7 +871,7 @@

        Components

        - + real(kind=pr), public @@ -888,7 +888,7 @@

        Components

        - + integer, public @@ -937,7 +937,7 @@

        Arguments

        - + procedure(continuation_function) @@ -982,7 +982,7 @@

        Arguments

        - + real(kind=pr), intent(in) @@ -997,7 +997,7 @@

        Arguments

        - + real(kind=pr), intent(in) @@ -1013,7 +1013,7 @@

        Arguments

        - + integer, intent(in) @@ -1075,7 +1075,7 @@

        Arguments

        - + procedure(continuation_solver), @@ -1170,7 +1170,7 @@

        Arguments

        - + real(kind=pr), intent(inout) @@ -1185,7 +1185,7 @@

        Arguments

        - + integer, intent(in) @@ -1200,7 +1200,7 @@

        Arguments

        - + real(kind=pr), intent(in) @@ -1215,7 +1215,7 @@

        Arguments

        - + real(kind=pr), intent(in) @@ -1230,7 +1230,7 @@

        Arguments

        - + real(kind=pr), intent(in) @@ -1245,7 +1245,7 @@

        Arguments

        - + integer, intent(in) @@ -1275,7 +1275,7 @@

        Arguments

        - + real(kind=pr), intent(out) @@ -1290,7 +1290,7 @@

        Arguments

        - + real(kind=pr), intent(out) @@ -1320,7 +1320,7 @@

        Arguments

        - + real(kind=pr), intent(in) @@ -1363,7 +1363,7 @@

        Arguments

        Documentation generated by FORD - on 2024-08-27 18:43

        + on 2024-08-27 18:52


        diff --git a/module/yaeos__math_linalg.html b/module/yaeos__math_linalg.html index 95db40797..86e50e874 100644 --- a/module/yaeos__math_linalg.html +++ b/module/yaeos__math_linalg.html @@ -204,7 +204,7 @@

        Arguments

        - + real(kind=pr), intent(in) @@ -219,7 +219,7 @@

        Arguments

        - + real(kind=pr), intent(in) @@ -446,7 +446,7 @@

        Arguments

        Documentation generated by FORD - on 2024-08-27 18:43

        + on 2024-08-27 18:52


        diff --git a/module/yaeos__models.html b/module/yaeos__models.html index 9507a1a06..7ad21bfca 100644 --- a/module/yaeos__models.html +++ b/module/yaeos__models.html @@ -163,14 +163,14 @@

        Uses

        • @@ -209,7 +209,7 @@

          Uses

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/module/yaeos__models_ar.html b/module/yaeos__models_ar.html index c8122ac7f..e60eb1bf8 100644 --- a/module/yaeos__models_ar.html +++ b/module/yaeos__models_ar.html @@ -181,7 +181,7 @@

          Subroutines

          fugacity_vt gibbs_residual_VT pressure - volume + volume @@ -233,8 +233,8 @@

          Uses

          @@ -277,7 +277,7 @@

          Arguments

          - + class(ArModel), intent(in) @@ -346,7 +346,7 @@

          Arguments

          - + class(ArModel), intent(in) @@ -361,7 +361,7 @@

          Arguments

          - + real(kind=pr), intent(in) @@ -376,7 +376,7 @@

          Arguments

          - + real(kind=pr), intent(in) @@ -391,7 +391,7 @@

          Arguments

          - + real(kind=pr), intent(in) @@ -406,7 +406,7 @@

          Arguments

          - + real(kind=pr), intent(out), @@ -421,7 +421,7 @@

          Arguments

          - + real(kind=pr), intent(out), @@ -438,7 +438,7 @@

          Arguments

          - + real(kind=pr), intent(out), @@ -455,7 +455,7 @@

          Arguments

          - + real(kind=pr), intent(out), @@ -472,7 +472,7 @@

          Arguments

          - + real(kind=pr), intent(out), @@ -489,7 +489,7 @@

          Arguments

          - + real(kind=pr), intent(out), @@ -506,7 +506,7 @@

          Arguments

          - + real(kind=pr), intent(out), @@ -523,7 +523,7 @@

          Arguments

          - + real(kind=pr), intent(out), @@ -540,7 +540,7 @@

          Arguments

          - + real(kind=pr), intent(out), @@ -557,7 +557,7 @@

          Arguments

          - + real(kind=pr), intent(out), @@ -608,7 +608,7 @@

          Arguments

          - + class(ArModel), intent(in) @@ -623,7 +623,7 @@

          Arguments

          - + real(kind=pr), intent(in) @@ -638,7 +638,7 @@

          Arguments

          - + real(kind=pr), intent(in) @@ -653,7 +653,7 @@

          Arguments

          - + real(kind=pr), intent(in) @@ -772,7 +772,7 @@

          Type-Bound Procedures

          procedure(abs_volume_initializer), public, deferred :: - get_v0 + get_v0 @@ -797,12 +797,12 @@

          Type-Bound Procedures

          procedure(abs_residual_helmholtz), public, deferred :: - residual_helmholtz + residual_helmholtz procedure, public :: - volume + volume @@ -835,7 +835,7 @@

          Arguments

          - + class(ArModel), intent(in) @@ -885,7 +885,7 @@

          Arguments

          - + class(ArModel), intent(in) @@ -900,7 +900,7 @@

          Arguments

          - + real(kind=pr), intent(in) @@ -915,7 +915,7 @@

          Arguments

          - + real(kind=pr), intent(in) @@ -930,7 +930,7 @@

          Arguments

          - + real(kind=pr), intent(in) @@ -985,7 +985,7 @@

          Arguments

          - + class(ArModel), intent(in) @@ -1000,7 +1000,7 @@

          Arguments

          - + real(kind=pr), intent(in) @@ -1015,7 +1015,7 @@

          Arguments

          - + real(kind=pr), intent(in) @@ -1030,7 +1030,7 @@

          Arguments

          - + real(kind=pr), intent(in) @@ -1085,7 +1085,7 @@

          Arguments

          - + class(ArModel), intent(in) @@ -1100,7 +1100,7 @@

          Arguments

          - + real(kind=pr), intent(in) @@ -1115,7 +1115,7 @@

          Arguments

          - + real(kind=pr), intent(in) @@ -1130,7 +1130,7 @@

          Arguments

          - + real(kind=pr), intent(in) @@ -1236,7 +1236,7 @@

          Arguments

          - + class(ArModel), intent(in) @@ -1251,7 +1251,7 @@

          Arguments

          - + real(kind=pr), intent(in) @@ -1266,7 +1266,7 @@

          Arguments

          - + real(kind=pr), intent(in) @@ -1281,7 +1281,7 @@

          Arguments

          - + real(kind=pr), intent(in) @@ -1387,7 +1387,7 @@

          Arguments

          - + class(ArModel), intent(in) @@ -1402,7 +1402,7 @@

          Arguments

          - + real(kind=pr), intent(in) @@ -1417,7 +1417,7 @@

          Arguments

          - + real(kind=pr), intent(in) @@ -1432,7 +1432,7 @@

          Arguments

          - + real(kind=pr), intent(in) @@ -1447,7 +1447,7 @@

          Arguments

          - + real(kind=pr), intent(out), @@ -1462,7 +1462,7 @@

          Arguments

          - + character(len=*), intent(in) @@ -1493,7 +1493,7 @@

          Arguments

          - + real(kind=pr), intent(out), @@ -1508,7 +1508,7 @@

          Arguments

          - + real(kind=pr), intent(out), @@ -1523,7 +1523,7 @@

          Arguments

          - + real(kind=pr), intent(out), @@ -1572,7 +1572,7 @@

          Arguments

          - + real(kind=pr), intent(out), @@ -1614,7 +1614,7 @@

          Arguments

          - + class(ArModel) @@ -1629,7 +1629,7 @@

          Arguments

          - + real(kind=pr), intent(in) @@ -1644,7 +1644,7 @@

          Arguments

          - + real(kind=pr), intent(in) @@ -1659,7 +1659,7 @@

          Arguments

          - + real(kind=pr), intent(in) @@ -1674,7 +1674,7 @@

          Arguments

          - + real(kind=pr), intent(out), @@ -1705,7 +1705,7 @@

          Arguments

          - + real(kind=pr), intent(out), @@ -1721,7 +1721,7 @@

          Arguments

          - + real(kind=pr), intent(out), @@ -1737,7 +1737,7 @@

          Arguments

          - + real(kind=pr), intent(out), @@ -1787,7 +1787,7 @@

          Arguments

          - + real(kind=pr), intent(out), @@ -1829,7 +1829,7 @@

          Arguments

          - + class(ArModel), intent(in) @@ -1844,7 +1844,7 @@

          Arguments

          - + real(kind=pr), intent(in) @@ -1859,7 +1859,7 @@

          Arguments

          - + real(kind=pr), intent(in) @@ -1874,7 +1874,7 @@

          Arguments

          - + real(kind=pr), intent(in) @@ -1980,7 +1980,7 @@

          Arguments

          - + class(ArModel), intent(in) @@ -1995,7 +1995,7 @@

          Arguments

          - + real(kind=pr), intent(in) @@ -2010,7 +2010,7 @@

          Arguments

          - + real(kind=pr), intent(in) @@ -2025,7 +2025,7 @@

          Arguments

          - + real(kind=pr), intent(in) @@ -2040,7 +2040,7 @@

          Arguments

          - + real(kind=pr), intent(out) @@ -2089,7 +2089,7 @@

          Arguments

          - + real(kind=pr), intent(out), @@ -2112,11 +2112,11 @@

          Arguments

          -

          public subroutine volume(eos, n, P, T, V, root_type) +

          public subroutine volume(eos, n, P, T, V, root_type)

          -

          Solves volume roots using newton method. Given pressure and temperature.

          Read more… +

          Solves volume roots using newton method. Given pressure and temperature.

          Read more…

          Arguments

          @@ -2131,7 +2131,7 @@

          Arguments

          @@ -2146,7 +2146,7 @@

          Arguments

          @@ -2161,7 +2161,7 @@

          Arguments

          @@ -2176,7 +2176,7 @@

          Arguments

          @@ -2191,7 +2191,7 @@

          Arguments

          @@ -2206,7 +2206,7 @@

          Arguments

          @@ -2250,7 +2250,7 @@

          Arguments

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/module/yaeos__models_ar_cubic_alphas.html b/module/yaeos__models_ar_cubic_alphas.html index 56bb5f95e..d78fbb7c0 100644 --- a/module/yaeos__models_ar_cubic_alphas.html +++ b/module/yaeos__models_ar_cubic_alphas.html @@ -216,7 +216,7 @@

          Components

          @@ -243,7 +243,7 @@

          Type-Bound Procedures

          + alpha => alpha_rkpr @@ -278,7 +278,7 @@

          Components

          @@ -305,7 +305,7 @@

          Type-Bound Procedures

          + alpha @@ -339,7 +339,7 @@

          Arguments

          @@ -354,7 +354,7 @@

          Arguments

          @@ -369,7 +369,7 @@

          Arguments

          @@ -386,7 +386,7 @@

          Arguments

          @@ -403,7 +403,7 @@

          Arguments

          @@ -445,7 +445,7 @@

          Arguments

          @@ -460,7 +460,7 @@

          Arguments

          @@ -475,7 +475,7 @@

          Arguments

          @@ -492,7 +492,7 @@

          Arguments

          @@ -509,7 +509,7 @@

          Arguments

          @@ -554,7 +554,7 @@

          Arguments

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/module/yaeos__models_ar_cubic_implementations.html b/module/yaeos__models_ar_cubic_implementations.html index 194bc40d0..1e56f7c3d 100644 --- a/module/yaeos__models_ar_cubic_implementations.html +++ b/module/yaeos__models_ar_cubic_implementations.html @@ -533,7 +533,7 @@

          Arguments

          @@ -763,7 +763,7 @@

          Arguments

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/module/yaeos__models_ar_cubic_mixing_base.html b/module/yaeos__models_ar_cubic_mixing_base.html index 3de8914b8..6323aa573 100644 --- a/module/yaeos__models_ar_cubic_mixing_base.html +++ b/module/yaeos__models_ar_cubic_mixing_base.html @@ -90,7 +90,7 @@

          yaeos__models_ar_cubic_mixing_base
          @@ -208,7 +208,7 @@

          Arguments

          @@ -223,7 +223,7 @@

          Arguments

          @@ -238,7 +238,7 @@

          Arguments

          @@ -308,7 +308,7 @@

          Arguments

          @@ -323,7 +323,7 @@

          Arguments

          @@ -353,7 +353,7 @@

          Arguments

          @@ -423,7 +423,7 @@

          Arguments

          @@ -438,7 +438,7 @@

          Arguments

          @@ -453,7 +453,7 @@

          Arguments

          @@ -468,7 +468,7 @@

          Arguments

          @@ -483,7 +483,7 @@

          Arguments

          @@ -526,7 +526,7 @@

          Arguments

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/module/yaeos__models_ar_cubic_quadratic_mixing.html b/module/yaeos__models_ar_cubic_quadratic_mixing.html index 176f0dd70..8d357ffe1 100644 --- a/module/yaeos__models_ar_cubic_quadratic_mixing.html +++ b/module/yaeos__models_ar_cubic_quadratic_mixing.html @@ -181,9 +181,9 @@

          Uses

          @@ -242,7 +242,7 @@

          Arguments

          @@ -257,7 +257,7 @@

          Arguments

          @@ -272,7 +272,7 @@

          Arguments

          @@ -287,7 +287,7 @@

          Arguments

          @@ -302,7 +302,7 @@

          Arguments

          @@ -384,7 +384,7 @@

          Components

          @@ -402,7 +402,7 @@

          Components

          @@ -419,7 +419,7 @@

          Components

          @@ -445,17 +445,17 @@

          Type-Bound Procedures

          + Bmix + D1mix => D1mix_constant + Dmix @@ -488,7 +488,7 @@

          Components

          @@ -506,7 +506,7 @@

          Components

          @@ -523,7 +523,7 @@

          Components

          @@ -549,17 +549,17 @@

          Type-Bound Procedures

          + Bmix + D1Mix => RKPR_D1mix + Dmix @@ -593,7 +593,7 @@

          Arguments

          @@ -608,7 +608,7 @@

          Arguments

          @@ -623,7 +623,7 @@

          Arguments

          @@ -638,7 +638,7 @@

          Arguments

          @@ -653,7 +653,7 @@

          Arguments

          @@ -670,7 +670,7 @@

          Arguments

          @@ -712,7 +712,7 @@

          Arguments

          @@ -727,7 +727,7 @@

          Arguments

          @@ -742,7 +742,7 @@

          Arguments

          @@ -758,7 +758,7 @@

          Arguments

          @@ -774,7 +774,7 @@

          Arguments

          @@ -791,7 +791,7 @@

          Arguments

          @@ -833,7 +833,7 @@

          Arguments

          @@ -848,7 +848,7 @@

          Arguments

          @@ -863,7 +863,7 @@

          Arguments

          @@ -878,7 +878,7 @@

          Arguments

          @@ -894,7 +894,7 @@

          Arguments

          @@ -911,7 +911,7 @@

          Arguments

          @@ -928,7 +928,7 @@

          Arguments

          @@ -944,7 +944,7 @@

          Arguments

          @@ -961,7 +961,7 @@

          Arguments

          @@ -978,7 +978,7 @@

          Arguments

          @@ -995,7 +995,7 @@

          Arguments

          @@ -1012,7 +1012,7 @@

          Arguments

          @@ -1054,7 +1054,7 @@

          Arguments

          @@ -1069,7 +1069,7 @@

          Arguments

          @@ -1084,7 +1084,7 @@

          Arguments

          @@ -1099,7 +1099,7 @@

          Arguments

          @@ -1114,7 +1114,7 @@

          Arguments

          @@ -1129,7 +1129,7 @@

          Arguments

          @@ -1169,7 +1169,7 @@

          Arguments

          @@ -1184,7 +1184,7 @@

          Arguments

          @@ -1199,7 +1199,7 @@

          Arguments

          @@ -1214,7 +1214,7 @@

          Arguments

          @@ -1231,7 +1231,7 @@

          Arguments

          @@ -1248,7 +1248,7 @@

          Arguments

          @@ -1326,7 +1326,7 @@

          Arguments

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/module/yaeos__models_ar_genericcubic.html b/module/yaeos__models_ar_genericcubic.html index ccea4bf59..a3f156bed 100644 --- a/module/yaeos__models_ar_genericcubic.html +++ b/module/yaeos__models_ar_genericcubic.html @@ -167,7 +167,7 @@

          Subroutines

          @@ -193,8 +193,8 @@

          Uses

          @@ -251,7 +251,7 @@

          Arguments

          @@ -266,7 +266,7 @@

          Arguments

          @@ -281,7 +281,7 @@

          Arguments

          @@ -296,7 +296,7 @@

          Arguments

          @@ -311,7 +311,7 @@

          Arguments

          @@ -357,7 +357,7 @@

          Arguments

          @@ -372,7 +372,7 @@

          Arguments

          @@ -387,7 +387,7 @@

          Arguments

          @@ -402,7 +402,7 @@

          Arguments

          @@ -417,7 +417,7 @@

          Arguments

          @@ -432,7 +432,7 @@

          Arguments

          @@ -478,7 +478,7 @@

          Arguments

          @@ -493,7 +493,7 @@

          Arguments

          @@ -508,7 +508,7 @@

          Arguments

          @@ -523,7 +523,7 @@

          Arguments

          @@ -538,7 +538,7 @@

          Arguments

          @@ -553,7 +553,7 @@

          Arguments

          @@ -568,7 +568,7 @@

          Arguments

          @@ -583,7 +583,7 @@

          Arguments

          @@ -598,7 +598,7 @@

          Arguments

          @@ -613,7 +613,7 @@

          Arguments

          @@ -628,7 +628,7 @@

          Arguments

          @@ -643,7 +643,7 @@

          Arguments

          @@ -689,7 +689,7 @@

          Arguments

          @@ -704,7 +704,7 @@

          Arguments

          @@ -719,7 +719,7 @@

          Arguments

          @@ -734,7 +734,7 @@

          Arguments

          @@ -749,7 +749,7 @@

          Arguments

          @@ -796,7 +796,7 @@

          Type-Bound Procedures

          + alpha @@ -851,7 +851,7 @@

          Components

          @@ -866,12 +866,12 @@

          Components

          Uses the abstract derived type AlphaFunction to define the Alpha function that the CubicEoS will use. The Alpha function receives the reduced temperature and returns the values of alpha -and its derivatives, named a, dadt and dadt2 respectively.

          Read more… +and its derivatives, named a, dadt and dadt2 respectively.

          Read more… @@ -941,7 +941,7 @@

          Components

          @@ -956,7 +956,7 @@

          Components

          Uses the abstract derived type CubicMixRule to define the mixing rule that the CubicEoS will use. It includes internally three methods to calculate the corresponding parameters for the -Cubic EoS: Dmix, Bmix and D1mix.

          Read more… +Cubic EoS: Dmix, Bmix and D1mix.

          Read more… @@ -1007,7 +1007,7 @@

          Type-Bound Procedures

          + get_v0 => v0 @@ -1032,12 +1032,12 @@

          Type-Bound Procedures

          + residual_helmholtz => GenericCubic_Ar + volume @@ -1066,17 +1066,17 @@

          Type-Bound Procedures

          + Bmix + D1mix + Dmix @@ -1112,7 +1112,7 @@

          Arguments

          @@ -1127,7 +1127,7 @@

          Arguments

          @@ -1142,7 +1142,7 @@

          Arguments

          @@ -1157,7 +1157,7 @@

          Arguments

          @@ -1207,7 +1207,7 @@

          Arguments

          @@ -1222,7 +1222,7 @@

          Arguments

          @@ -1237,7 +1237,7 @@

          Arguments

          @@ -1252,7 +1252,7 @@

          Arguments

          @@ -1299,7 +1299,7 @@

          Arguments

          @@ -1350,7 +1350,7 @@

          Arguments

          @@ -1367,7 +1367,7 @@

          Arguments

          @@ -1384,7 +1384,7 @@

          Arguments

          @@ -1401,7 +1401,7 @@

          Arguments

          @@ -1418,7 +1418,7 @@

          Arguments

          @@ -1441,11 +1441,11 @@

          Arguments

          -

          public subroutine volume(eos, n, P, T, V, root_type) +

          public subroutine volume(eos, n, P, T, V, root_type)

          -

          Volume solver optimized for Cubic Equations of State.

          Read more… +

          Volume solver optimized for Cubic Equations of State.

          Read more…

          Arguments

          - + class(ArModel), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(out)
          - + character(len=*), intent(in)
          - + real(kind=pr), public,
          procedure, public :: - alpha => alpha_rkpr
          - + real(kind=pr), public,
          procedure, public :: - alpha ../../../

          Alpha function

          - + class(AlphaSoave), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + class(AlphaRKPR), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(in),
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + class(QMR), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(out)
          - + procedure(get_aij), public,
          - + real(kind=pr), public,
          - + real(kind=pr), public,
          procedure, public :: - Bmix ../../../

          Repulsive parameter mixing rule

          procedure, public :: - D1mix => D1mix_constant
          procedure, public :: - Dmix ../../../

          Attractive parameter mixing rule

          - + procedure(get_aij), public,
          - + real(kind=pr), public,
          - + real(kind=pr), public,
          procedure, public :: - Bmix ../../../

          Repulsive parameter mixing rule

          procedure, public :: - D1Mix => RKPR_D1mix
          procedure, public :: - Dmix ../../../

          Attractive parameter mixing rule

          - + class(QMR), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + class(QMR), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + class(QMR), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + class(QMR_RKPR), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + class(QMR), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(out)
          - + class(CubicMixRule), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + class(CubicMixRule), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + class(CubicMixRule), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + class(AlphaFunction), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          procedure(abs_alpha), public, deferred :: - alpha
          - + class(AlphaFunction), public,
          - + real(kind=pr), public,
          - + class(CubicMixRule), public,
          procedure, public :: - get_v0 => v0
          procedure, public :: - residual_helmholtz => GenericCubic_Ar
          procedure, public :: - volume
          procedure(abs_Bmix), public, deferred :: - Bmix
          procedure(abs_D1mix), public, deferred :: - D1mix
          procedure(abs_Dmix), public, deferred :: - Dmix
          - + class(CubicEoS), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + class(CubicEoS), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(out),
          - + real(kind=pr), intent(out),
          - + real(kind=pr), intent(out),
          - + real(kind=pr), intent(out),
          - + real(kind=pr), intent(out),
          - + real(kind=pr), intent(out),
          @@ -1460,7 +1460,7 @@

          Arguments

          @@ -1475,7 +1475,7 @@

          Arguments

          @@ -1490,7 +1490,7 @@

          Arguments

          @@ -1505,7 +1505,7 @@

          Arguments

          @@ -1520,7 +1520,7 @@

          Arguments

          @@ -1535,7 +1535,7 @@

          Arguments

          @@ -1578,7 +1578,7 @@

          Arguments

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/module/yaeos__models_base.html b/module/yaeos__models_base.html index 68bd383bc..41cf00233 100644 --- a/module/yaeos__models_base.html +++ b/module/yaeos__models_base.html @@ -90,7 +90,7 @@

          yaeos__models_base
          @@ -245,7 +245,7 @@

          Components

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/module/yaeos__models_cubic_mixing_rules_huron_vidal.html b/module/yaeos__models_cubic_mixing_rules_huron_vidal.html index c4db47a50..3b3e2a403 100644 --- a/module/yaeos__models_cubic_mixing_rules_huron_vidal.html +++ b/module/yaeos__models_cubic_mixing_rules_huron_vidal.html @@ -149,7 +149,7 @@

          Functions

          - init + init
          @@ -200,9 +200,9 @@

          Uses

          @@ -261,7 +261,7 @@

          Arguments

          @@ -291,7 +291,7 @@

          Arguments

          @@ -349,7 +349,7 @@

          Components

          @@ -400,7 +400,7 @@

          Components

          @@ -434,7 +434,7 @@

          Components

          @@ -451,7 +451,7 @@

          Components

          @@ -480,7 +480,7 @@

          Constructor

          function - init + init (Ge, b, q, lij) @@ -494,12 +494,12 @@

          Type-Bound Procedures

          + Bmix => BmixMHV + D1Mix => D1MixMHV @@ -518,7 +518,7 @@

          Type-Bound Procedures

          Functions

          -

          private function init(Ge, b, q, lij) result(mixrule) +

          private function init(Ge, b, q, lij) result(mixrule)

          @@ -537,7 +537,7 @@

          Arguments

          @@ -552,7 +552,7 @@

          Arguments

          @@ -582,7 +582,7 @@

          Arguments

          @@ -633,7 +633,7 @@

          Arguments

          @@ -648,7 +648,7 @@

          Arguments

          @@ -663,7 +663,7 @@

          Arguments

          @@ -693,7 +693,7 @@

          Arguments

          @@ -708,7 +708,7 @@

          Arguments

          @@ -723,7 +723,7 @@

          Arguments

          @@ -738,7 +738,7 @@

          Arguments

          @@ -753,7 +753,7 @@

          Arguments

          @@ -768,7 +768,7 @@

          Arguments

          @@ -783,7 +783,7 @@

          Arguments

          @@ -798,7 +798,7 @@

          Arguments

          @@ -839,7 +839,7 @@

          Arguments

          @@ -854,7 +854,7 @@

          Arguments

          @@ -884,7 +884,7 @@

          Arguments

          @@ -899,7 +899,7 @@

          Arguments

          @@ -914,7 +914,7 @@

          Arguments

          @@ -954,7 +954,7 @@

          Arguments

          @@ -969,7 +969,7 @@

          Arguments

          @@ -984,7 +984,7 @@

          Arguments

          @@ -999,7 +999,7 @@

          Arguments

          @@ -1014,7 +1014,7 @@

          Arguments

          @@ -1029,7 +1029,7 @@

          Arguments

          @@ -1072,7 +1072,7 @@

          Arguments

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/module/yaeos__models_ge.html b/module/yaeos__models_ge.html index 3d2a8f573..005559827 100644 --- a/module/yaeos__models_ge.html +++ b/module/yaeos__models_ge.html @@ -176,8 +176,8 @@

          Uses

          @@ -218,7 +218,7 @@

          Arguments

          @@ -233,7 +233,7 @@

          Arguments

          @@ -248,7 +248,7 @@

          Arguments

          @@ -458,7 +458,7 @@

          Arguments

          @@ -473,7 +473,7 @@

          Arguments

          @@ -488,7 +488,7 @@

          Arguments

          @@ -546,7 +546,7 @@

          Arguments

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/module/yaeos__models_ge_group_contribution_model_parameters.html b/module/yaeos__models_ge_group_contribution_model_parameters.html index b252eaf68..5cd38aedc 100644 --- a/module/yaeos__models_ge_group_contribution_model_parameters.html +++ b/module/yaeos__models_ge_group_contribution_model_parameters.html @@ -456,7 +456,7 @@

          Arguments

          @@ -517,7 +517,7 @@

          Arguments

          @@ -594,7 +594,7 @@

          Arguments

          @@ -671,7 +671,7 @@

          Arguments

          @@ -747,7 +747,7 @@

          Arguments

          @@ -808,7 +808,7 @@

          Arguments

          @@ -869,7 +869,7 @@

          Arguments

          @@ -929,7 +929,7 @@

          Arguments

          @@ -990,7 +990,7 @@

          Arguments

          @@ -1067,7 +1067,7 @@

          Arguments

          @@ -1144,7 +1144,7 @@

          Arguments

          @@ -1224,7 +1224,7 @@

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/module/yaeos__models_ge_group_contribution_unifac.html b/module/yaeos__models_ge_group_contribution_unifac.html index 6b7441bcf..ecff6ba6e 100644 --- a/module/yaeos__models_ge_group_contribution_unifac.html +++ b/module/yaeos__models_ge_group_contribution_unifac.html @@ -168,7 +168,7 @@

          Subroutines

          Ge_combinatorialGe_residualUNIFAC_temperature_dependence - excess_gibbs + excess_gibbs @@ -261,10 +261,10 @@

          Uses

          @@ -307,7 +307,7 @@

          Arguments

          @@ -338,7 +338,7 @@

          Arguments

          @@ -492,7 +492,7 @@

          Components

          @@ -759,7 +759,7 @@

          Components

          @@ -785,7 +785,7 @@

          Type-Bound Procedures

          + excess_gibbs @@ -1056,7 +1056,7 @@

          Arguments

          @@ -1071,7 +1071,7 @@

          Arguments

          @@ -1086,7 +1086,7 @@

          Arguments

          @@ -1101,7 +1101,7 @@

          Arguments

          @@ -1175,7 +1175,7 @@

          Arguments

          @@ -1190,7 +1190,7 @@

          Arguments

          @@ -1205,7 +1205,7 @@

          Arguments

          @@ -1220,7 +1220,7 @@

          Arguments

          @@ -1345,7 +1345,7 @@

          Arguments

          @@ -1376,7 +1376,7 @@

          Arguments

          @@ -1448,11 +1448,11 @@

          Arguments

          -

          public subroutine excess_gibbs(self, n, T, Ge, GeT, GeT2, Gen, GeTn, Gen2) +

          public subroutine excess_gibbs(self, n, T, Ge, GeT, GeT2, Gen, GeTn, Gen2)

          -

          Calculate the Gibbs excess energy of the UNIFAC model

          Read more… +

          Calculate the Gibbs excess energy of the UNIFAC model

          Read more…

          Arguments

          - + class(CubicEoS), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(out)
          - + character(len=*), intent(in)
          - + class(GeModel), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in),
          - + class(GeModel), public,
          - + real(kind=pr), private,
          - + real(kind=pr), private,
          - + real(kind=pr), private,
          procedure, public :: - Bmix => BmixMHV
          procedure, public :: - D1Mix => D1MixMHV
          - + class(GeModel), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in),
          - + class(MHV), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + class(MHV), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + class(MHV), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + class(GeModel), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + class(GeModel), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + class(GeGCModelParameters)
          - + class(GeGCModelParameters)
          - + class(GeGCModelParameters)
          - + class(GeGCModelParameters)
          - + class(GeGCModelParameters)
          - + class(GeGCModelParameters)
          - + class(GeGCModelParameters)
          - + class(GeGCModelParameters)
          - + class(GeGCModelParameters)
          - + class(GeGCModelParameters)
          - + class(GeGCModelParameters)
          - + class(PsiFunction)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), public
          - + real(kind=pr), public
          procedure, public :: - excess_gibbs
          - + class(UNIFAC)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(out),
          - + class(UNIFAC)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(out),
          - + class(UNIFACPsi)
          - + real(kind=pr), intent(in)
          @@ -1467,7 +1467,7 @@

          Arguments

          @@ -1482,7 +1482,7 @@

          Arguments

          @@ -1497,7 +1497,7 @@

          Arguments

          @@ -1512,7 +1512,7 @@

          Arguments

          @@ -1527,7 +1527,7 @@

          Arguments

          @@ -1544,7 +1544,7 @@

          Arguments

          @@ -1561,7 +1561,7 @@

          Arguments

          @@ -1578,7 +1578,7 @@

          Arguments

          @@ -1595,7 +1595,7 @@

          Arguments

          @@ -1640,7 +1640,7 @@

          Arguments

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/module/yaeos__models_ge_group_contribution_unifac_parameters.html b/module/yaeos__models_ge_group_contribution_unifac_parameters.html index 4090cefa5..7c2192016 100644 --- a/module/yaeos__models_ge_group_contribution_unifac_parameters.html +++ b/module/yaeos__models_ge_group_contribution_unifac_parameters.html @@ -207,8 +207,8 @@

          Uses

          @@ -268,7 +268,7 @@

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/module/yaeos__models_ge_implementations.html b/module/yaeos__models_ge_implementations.html index 1e0506cb8..676645115 100644 --- a/module/yaeos__models_ge_implementations.html +++ b/module/yaeos__models_ge_implementations.html @@ -144,8 +144,8 @@

          Uses

          @@ -183,7 +183,7 @@

          Uses

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/module/yaeos__models_ge_nrtl.html b/module/yaeos__models_ge_nrtl.html index 784575161..2dd59aa86 100644 --- a/module/yaeos__models_ge_nrtl.html +++ b/module/yaeos__models_ge_nrtl.html @@ -149,7 +149,7 @@

          Functions

          - init + init
          @@ -192,9 +192,9 @@

          Uses

          @@ -218,7 +218,7 @@

          public interface NRTL
          • - public function init(a, b, c) + public function init(a, b, c)

            @@ -237,7 +237,7 @@

            Arguments

          @@ -252,7 +252,7 @@

          Arguments

          @@ -267,7 +267,7 @@

          Arguments

          @@ -324,7 +324,7 @@

          Components

          @@ -341,7 +341,7 @@

          Components

          @@ -358,7 +358,7 @@

          Components

          @@ -404,7 +404,7 @@

          Constructor

          function - init + init (a, b, c) @@ -418,32 +418,32 @@

          Type-Bound Procedures

          + excess_gibbs + ge => EXCESS_GIBBS + ge_b => EXCESS_GIBBS_B + ge_d => EXCESS_GIBBS_D + ge_d_b => EXCESS_GIBBS_D_B + ge_d_d => EXCESS_GIBBS_D_D @@ -462,7 +462,7 @@

          Type-Bound Procedures

          Functions

          -

          public function init(a, b, c) +

          public function init(a, b, c)

          @@ -481,7 +481,7 @@

          Arguments

          @@ -496,7 +496,7 @@

          Arguments

          @@ -511,7 +511,7 @@

          Arguments

          @@ -561,7 +561,7 @@

          Arguments

          @@ -576,7 +576,7 @@

          Arguments

          @@ -591,7 +591,7 @@

          Arguments

          @@ -606,7 +606,7 @@

          Arguments

          @@ -646,7 +646,7 @@

          Arguments

          @@ -661,7 +661,7 @@

          Arguments

          @@ -676,7 +676,7 @@

          Arguments

          @@ -691,7 +691,7 @@

          Arguments

          @@ -706,7 +706,7 @@

          Arguments

          @@ -721,7 +721,7 @@

          Arguments

          @@ -736,7 +736,7 @@

          Arguments

          @@ -776,7 +776,7 @@

          Arguments

          @@ -791,7 +791,7 @@

          Arguments

          @@ -806,7 +806,7 @@

          Arguments

          @@ -821,7 +821,7 @@

          Arguments

          @@ -836,7 +836,7 @@

          Arguments

          @@ -851,7 +851,7 @@

          Arguments

          @@ -866,7 +866,7 @@

          Arguments

          @@ -906,7 +906,7 @@

          Arguments

          @@ -921,7 +921,7 @@

          Arguments

          @@ -936,7 +936,7 @@

          Arguments

          @@ -951,7 +951,7 @@

          Arguments

          @@ -966,7 +966,7 @@

          Arguments

          @@ -981,7 +981,7 @@

          Arguments

          @@ -996,7 +996,7 @@

          Arguments

          @@ -1011,7 +1011,7 @@

          Arguments

          @@ -1026,7 +1026,7 @@

          Arguments

          @@ -1041,7 +1041,7 @@

          Arguments

          @@ -1056,7 +1056,7 @@

          Arguments

          @@ -1071,7 +1071,7 @@

          Arguments

          @@ -1086,7 +1086,7 @@

          Arguments

          @@ -1126,7 +1126,7 @@

          Arguments

          @@ -1141,7 +1141,7 @@

          Arguments

          @@ -1156,7 +1156,7 @@

          Arguments

          @@ -1171,7 +1171,7 @@

          Arguments

          @@ -1186,7 +1186,7 @@

          Arguments

          @@ -1201,7 +1201,7 @@

          Arguments

          @@ -1216,7 +1216,7 @@

          Arguments

          @@ -1231,7 +1231,7 @@

          Arguments

          @@ -1246,7 +1246,7 @@

          Arguments

          @@ -1261,7 +1261,7 @@

          Arguments

          @@ -1301,7 +1301,7 @@

          Arguments

          @@ -1316,7 +1316,7 @@

          Arguments

          @@ -1331,7 +1331,7 @@

          Arguments

          @@ -1346,7 +1346,7 @@

          Arguments

          @@ -1376,7 +1376,7 @@

          Arguments

          @@ -1391,7 +1391,7 @@

          Arguments

          @@ -1406,7 +1406,7 @@

          Arguments

          @@ -1436,7 +1436,7 @@

          Arguments

          @@ -1466,7 +1466,7 @@

          Arguments

          @@ -1496,7 +1496,7 @@

          Arguments

          @@ -1554,7 +1554,7 @@

          Arguments

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/module/yaeos__models_solvers.html b/module/yaeos__models_solvers.html index ebbf9b273..8aa3e419c 100644 --- a/module/yaeos__models_solvers.html +++ b/module/yaeos__models_solvers.html @@ -169,8 +169,8 @@

          Uses

          @@ -209,7 +209,7 @@

          Arguments

          @@ -224,7 +224,7 @@

          Arguments

          @@ -239,7 +239,7 @@

          Arguments

          @@ -254,7 +254,7 @@

          Arguments

          @@ -269,7 +269,7 @@

          Arguments

          @@ -299,7 +299,7 @@

          Arguments

          @@ -357,7 +357,7 @@

          Arguments

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/module/yaeos__optimizers.html b/module/yaeos__optimizers.html index e5ff0ce37..c500f3cca 100644 --- a/module/yaeos__optimizers.html +++ b/module/yaeos__optimizers.html @@ -222,7 +222,7 @@

          Arguments

          @@ -237,7 +237,7 @@

          Arguments

          @@ -252,7 +252,7 @@

          Arguments

          @@ -267,7 +267,7 @@

          Arguments

          @@ -313,7 +313,7 @@

          Arguments

          @@ -328,7 +328,7 @@

          Arguments

          @@ -343,7 +343,7 @@

          Arguments

          @@ -358,7 +358,7 @@

          Arguments

          @@ -443,7 +443,7 @@

          Components

          @@ -502,7 +502,7 @@

          Type-Bound Procedures

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/module/yaeos__optimizers_powell_wrap.html b/module/yaeos__optimizers_powell_wrap.html index 2103cf44c..5c676f22e 100644 --- a/module/yaeos__optimizers_powell_wrap.html +++ b/module/yaeos__optimizers_powell_wrap.html @@ -306,7 +306,7 @@

          Components

          @@ -366,7 +366,7 @@

          Arguments

          @@ -381,7 +381,7 @@

          Arguments

          @@ -396,7 +396,7 @@

          Arguments

          @@ -451,7 +451,7 @@

          Arguments

          @@ -466,7 +466,7 @@

          Arguments

          @@ -481,7 +481,7 @@

          Arguments

          @@ -496,7 +496,7 @@

          Arguments

          @@ -539,7 +539,7 @@

          Arguments

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/module/yaeos__phase_equilibria_stability.html b/module/yaeos__phase_equilibria_stability.html index 3a3414471..e555977f2 100644 --- a/module/yaeos__phase_equilibria_stability.html +++ b/module/yaeos__phase_equilibria_stability.html @@ -205,8 +205,8 @@

          Uses

          @@ -248,7 +248,7 @@

          Components

          @@ -265,7 +265,7 @@

          Components

          @@ -299,7 +299,7 @@

          Components

          @@ -316,7 +316,7 @@

          Components

          @@ -365,7 +365,7 @@

          Arguments

          @@ -380,7 +380,7 @@

          Arguments

          @@ -410,7 +410,7 @@

          Arguments

          @@ -425,7 +425,7 @@

          Arguments

          @@ -506,7 +506,7 @@

          Arguments

          @@ -521,7 +521,7 @@

          Arguments

          @@ -536,7 +536,7 @@

          Arguments

          @@ -551,7 +551,7 @@

          Arguments

          @@ -637,7 +637,7 @@

          Arguments

          @@ -652,7 +652,7 @@

          Arguments

          @@ -667,7 +667,7 @@

          Arguments

          @@ -725,7 +725,7 @@

          Arguments

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/module/yaeos__solvers_pressure_equality.html b/module/yaeos__solvers_pressure_equality.html index a9a416a1d..91700344f 100644 --- a/module/yaeos__solvers_pressure_equality.html +++ b/module/yaeos__solvers_pressure_equality.html @@ -154,8 +154,8 @@

          Uses

          @@ -195,7 +195,7 @@

          Arguments

          @@ -210,7 +210,7 @@

          Arguments

          @@ -225,7 +225,7 @@

          Arguments

          @@ -240,7 +240,7 @@

          Arguments

          @@ -255,7 +255,7 @@

          Arguments

          @@ -270,7 +270,7 @@

          Arguments

          @@ -315,7 +315,7 @@

          Arguments

          @@ -358,7 +358,7 @@

          Arguments

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/module/yaeos__substance.html b/module/yaeos__substance.html index d1e7b1e1a..c10f56d81 100644 --- a/module/yaeos__substance.html +++ b/module/yaeos__substance.html @@ -297,7 +297,7 @@

          Components

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/module/yaeos__tapenade_ar_api.html b/module/yaeos__tapenade_ar_api.html index 7694069e8..3f8e3f2bc 100644 --- a/module/yaeos__tapenade_ar_api.html +++ b/module/yaeos__tapenade_ar_api.html @@ -166,7 +166,7 @@

          Subroutines

          @@ -193,8 +193,8 @@

          Uses

          @@ -235,7 +235,7 @@

          Arguments

          @@ -250,7 +250,7 @@

          Arguments

          @@ -265,7 +265,7 @@

          Arguments

          @@ -280,7 +280,7 @@

          Arguments

          @@ -341,7 +341,7 @@

          Arguments

          @@ -356,7 +356,7 @@

          Arguments

          @@ -371,7 +371,7 @@

          Arguments

          @@ -386,7 +386,7 @@

          Arguments

          @@ -416,7 +416,7 @@

          Arguments

          @@ -431,7 +431,7 @@

          Arguments

          @@ -507,7 +507,7 @@

          Arguments

          @@ -522,7 +522,7 @@

          Arguments

          @@ -537,7 +537,7 @@

          Arguments

          @@ -552,7 +552,7 @@

          Arguments

          @@ -582,7 +582,7 @@

          Arguments

          @@ -673,7 +673,7 @@

          Arguments

          @@ -688,7 +688,7 @@

          Arguments

          @@ -703,7 +703,7 @@

          Arguments

          @@ -718,7 +718,7 @@

          Arguments

          @@ -733,7 +733,7 @@

          Arguments

          @@ -748,7 +748,7 @@

          Arguments

          @@ -808,7 +808,7 @@

          Arguments

          @@ -823,7 +823,7 @@

          Arguments

          @@ -853,7 +853,7 @@

          Arguments

          @@ -959,7 +959,7 @@

          Arguments

          @@ -974,7 +974,7 @@

          Arguments

          @@ -989,7 +989,7 @@

          Arguments

          @@ -1004,7 +1004,7 @@

          Arguments

          @@ -1049,7 +1049,7 @@

          Arguments

          @@ -1185,7 +1185,7 @@

          Arguments

          @@ -1200,7 +1200,7 @@

          Arguments

          @@ -1215,7 +1215,7 @@

          Arguments

          @@ -1230,7 +1230,7 @@

          Arguments

          @@ -1339,7 +1339,7 @@

          Type-Bound Procedures

          + ar @@ -1374,7 +1374,7 @@

          Type-Bound Procedures

          + get_v0 @@ -1399,7 +1399,7 @@

          Type-Bound Procedures

          + residual_helmholtz @@ -1409,7 +1409,7 @@

          Type-Bound Procedures

          + volume @@ -1442,7 +1442,7 @@

          Arguments

          @@ -1457,7 +1457,7 @@

          Arguments

          @@ -1472,7 +1472,7 @@

          Arguments

          @@ -1487,7 +1487,7 @@

          Arguments

          @@ -1518,7 +1518,7 @@

          Subroutines

          -

          private subroutine residual_helmholtz(self, n, v, t, Ar, ArV, ArT, ArTV, ArV2, ArT2, Arn, ArVn, ArTn, Arn2) +

          private subroutine residual_helmholtz(self, n, v, t, Ar, ArV, ArT, ArTV, ArV2, ArT2, Arn, ArVn, ArTn, Arn2)

          @@ -1537,7 +1537,7 @@

          Arguments

          @@ -1552,7 +1552,7 @@

          Arguments

          @@ -1567,7 +1567,7 @@

          Arguments

          @@ -1582,7 +1582,7 @@

          Arguments

          @@ -1597,7 +1597,7 @@

          Arguments

          @@ -1612,7 +1612,7 @@

          Arguments

          @@ -1627,7 +1627,7 @@

          Arguments

          @@ -1642,7 +1642,7 @@

          Arguments

          @@ -1657,7 +1657,7 @@

          Arguments

          @@ -1672,7 +1672,7 @@

          Arguments

          @@ -1687,7 +1687,7 @@

          Arguments

          @@ -1702,7 +1702,7 @@

          Arguments

          @@ -1717,7 +1717,7 @@

          Arguments

          @@ -1732,7 +1732,7 @@

          Arguments

          @@ -1775,7 +1775,7 @@

          Arguments

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/module/yaeos__tapenade_ge_api.html b/module/yaeos__tapenade_ge_api.html index 8c87f7222..3c2403463 100644 --- a/module/yaeos__tapenade_ge_api.html +++ b/module/yaeos__tapenade_ge_api.html @@ -154,7 +154,7 @@

          Subroutines

          @@ -181,8 +181,8 @@

          Uses

          @@ -223,7 +223,7 @@

          Arguments

          @@ -238,7 +238,7 @@

          Arguments

          @@ -253,7 +253,7 @@

          Arguments

          @@ -268,7 +268,7 @@

          Arguments

          @@ -314,7 +314,7 @@

          Arguments

          @@ -329,7 +329,7 @@

          Arguments

          @@ -344,7 +344,7 @@

          Arguments

          @@ -359,7 +359,7 @@

          Arguments

          @@ -374,7 +374,7 @@

          Arguments

          @@ -389,7 +389,7 @@

          Arguments

          @@ -404,7 +404,7 @@

          Arguments

          @@ -450,7 +450,7 @@

          Arguments

          @@ -465,7 +465,7 @@

          Arguments

          @@ -480,7 +480,7 @@

          Arguments

          @@ -495,7 +495,7 @@

          Arguments

          @@ -510,7 +510,7 @@

          Arguments

          @@ -525,7 +525,7 @@

          Arguments

          @@ -540,7 +540,7 @@

          Arguments

          @@ -586,7 +586,7 @@

          Arguments

          @@ -601,7 +601,7 @@

          Arguments

          @@ -616,7 +616,7 @@

          Arguments

          @@ -631,7 +631,7 @@

          Arguments

          @@ -646,7 +646,7 @@

          Arguments

          @@ -661,7 +661,7 @@

          Arguments

          @@ -676,7 +676,7 @@

          Arguments

          @@ -691,7 +691,7 @@

          Arguments

          @@ -706,7 +706,7 @@

          Arguments

          @@ -721,7 +721,7 @@

          Arguments

          @@ -736,7 +736,7 @@

          Arguments

          @@ -751,7 +751,7 @@

          Arguments

          @@ -766,7 +766,7 @@

          Arguments

          @@ -812,7 +812,7 @@

          Arguments

          @@ -827,7 +827,7 @@

          Arguments

          @@ -842,7 +842,7 @@

          Arguments

          @@ -857,7 +857,7 @@

          Arguments

          @@ -872,7 +872,7 @@

          Arguments

          @@ -887,7 +887,7 @@

          Arguments

          @@ -902,7 +902,7 @@

          Arguments

          @@ -917,7 +917,7 @@

          Arguments

          @@ -932,7 +932,7 @@

          Arguments

          @@ -947,7 +947,7 @@

          Arguments

          @@ -1024,32 +1024,32 @@

          Type-Bound Procedures

          + excess_gibbs + ge + ge_b + ge_d + ge_d_b + ge_d_d @@ -1069,7 +1069,7 @@

          Type-Bound Procedures

          Subroutines

          -

          private subroutine excess_gibbs(self, n, t, Ge, GeT, GeT2, Gen, GeTn, Gen2) +

          private subroutine excess_gibbs(self, n, t, Ge, GeT, GeT2, Gen, GeTn, Gen2)

          @@ -1088,7 +1088,7 @@

          Arguments

          @@ -1103,7 +1103,7 @@

          Arguments

          @@ -1118,7 +1118,7 @@

          Arguments

          @@ -1133,7 +1133,7 @@

          Arguments

          @@ -1148,7 +1148,7 @@

          Arguments

          @@ -1163,7 +1163,7 @@

          Arguments

          @@ -1178,7 +1178,7 @@

          Arguments

          @@ -1193,7 +1193,7 @@

          Arguments

          @@ -1208,7 +1208,7 @@

          Arguments

          @@ -1251,7 +1251,7 @@

          Arguments

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/module/yaeos__tapenade_interfaces.html b/module/yaeos__tapenade_interfaces.html index 0ee776d5e..5db14a957 100644 --- a/module/yaeos__tapenade_interfaces.html +++ b/module/yaeos__tapenade_interfaces.html @@ -201,7 +201,7 @@

          Arguments

          @@ -249,7 +249,7 @@

          Arguments

          @@ -264,7 +264,7 @@

          Arguments

          @@ -312,7 +312,7 @@

          Arguments

          @@ -360,7 +360,7 @@

          Arguments

          @@ -408,7 +408,7 @@

          Arguments

          @@ -456,7 +456,7 @@

          Arguments

          @@ -471,7 +471,7 @@

          Arguments

          @@ -519,7 +519,7 @@

          Arguments

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/page/contributing/index.html b/page/contributing/index.html index cd9f1aca2..23941de8b 100644 --- a/page/contributing/index.html +++ b/page/contributing/index.html @@ -314,7 +314,7 @@

          Join The Project Team

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/page/contributing/styleguide.html b/page/contributing/styleguide.html index b1125cf2b..e45357c78 100644 --- a/page/contributing/styleguide.html +++ b/page/contributing/styleguide.html @@ -245,7 +245,7 @@

          Document public API code with FORD Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/page/index.html b/page/index.html index 89c6be32f..c0c651663 100644 --- a/page/index.html +++ b/page/index.html @@ -177,7 +177,7 @@

          Basic usage

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/page/python-api/.doctrees/environment.pickle b/page/python-api/.doctrees/environment.pickle index 019d7dba122ca7431b9c24bed1252f1e04102b59..5f282286b053395856fb3051c25f5c6c11bd5a58 100644 GIT binary patch delta 6245 zcmZXY2~<_r)qvTLhfhER6h%=)1>(%$z@R9gjG|1Uh>A}{R4y_J!~u~wL;^wK_dGpn zwI(%LW|@>~ZX<2uFDB6@YEom8rZtUKYx5gZsoJCoQGxD#_IuZ6{cExA-uv6b8SWYG zqo>!>(`z|-GD(yq2Z~cSL&g0hKT(xDNWPQ>W@lUT2yrUOPu{EmGuXthk|si!e7Ow5 z#@U+POUqXkt*Z(xE-S9KHG5arRF|(WE?5`pP;AZS!t(V+;(Bt>a4TJ_`r2`b z(p*WSCN($Gs4dN%v>wv>k>+I9yHjJG>#2n%%X=46&bE#0qgrXQ{Qd!3RKLj*;F+p? z)JBtKMFTFRZfF*~V&W zd2ZIn<_!fAx8Ga(0}RxQmTV$xfc{|VXG#$dmU`&7^Iv15rErkU_X1b_ZR0AR+q!1nJ2eHIVB}FhGBA)9>tBOYK*ziI&=D^f&4{{>wU6f6g9Nvn|jh zhE$j1EA|n?cBY62)j^_R=V@`N#$8W&{uqb@JIe9BTSei{ApLqnIiTXL=Qmzcipbv` zr#HNK!A^I(n8>ZD-g2Hpw5~}qGXe(bm;UD?MfRSFloh@>)nALn96#>01byHBmpMM* zM1ua}fty@%%b}?paj-Sip%SJwyMP-C=JHVRv5pA%{Cswu}aEectbI60w0d&y44g8E2<+$d*GY zBv|+z@z%dR_W_ss@ZDhL-g_ohPrL9b!_fCfa8B4;DrbOx{9-bf>%Dwc#faL^V|4#N z@IZCb$0ON2<&$BoSU+=TrS|jgrwJGS{CjTU@E2y~7W2QGBvyRlsds+a3u4KJa@^?8 zh;27gL|v_YDR$mC4c+=HHy?udRjIKQqs4Iy9Dh4S_*L1r-2U5DfYtzg*jJsb_}vjE zMLO={#zL1U>5A6B{0DZzVRUxloKn)2`%NlVbli>BU-{Pors>~3;n?Mk6UEI=4|y&G z%=*Fa&#}9t%axO^+>a)gmwx5ZBM|%kR*uKh7-8*B5x=}^AIIhH)BV($GS1@Uly6JN z3weV6o1TrhA)owY1LKKSDvoytwTA)30BYXtbtXt;?NeuPHYs+;1y(X!Vu3(&JRL)6 zZtCz$GpUm=4b-uh)<>OrXwiX}HddW>XwgxZ)=!;tXgQhXS$9aCPlsndo@x`Yms%1% z7UH8w70kD3ZD7JA4P;n1I)72zE8MmQvr{cSkRAsICpqM%DwPKN35 zSiUhCVo}_i3<)U0r$CDOG}GFo7aou@Z3+Z?7TUDRK~7F%`GP#fp6gQ}6f-=gqUe<~ zr$PqKi`+96a!KBq3i;|&PJ5Tbt<$iwx=b$^VAlQ!aHHsc5wL<}Sp;Y#zleYWk~1Tr zkdr>+q_-p4F(L{!u;UAMoQ#5Hl+iyL)>u?CH+|&8I7pRVe&8v7eyp#DeGJNZo3nbN zA(OH)r^6~PcUQ(o!UE|r1Nt$zXEZ$9aRf`RSg^47zP_e;Vj!Iy z4`N^)$>lSlm;-u@fNAPb9^#l|)jz=LZgweLS5Q?YN5w(9+%pT@IMFOeCE$zEXF0lT zVSrPkDh10uQI77pv8yc>tkk+^9B5p`iygK&Sj1o;gVty+GCF~rNA<@cBiNYI#Zwkt&CJCM)BKJ+~By8AEiP>fZAHm;Tf?uW^GJkwQZYCJBV*a zYaUFyp-X1W1%KQFr6hXgizsMZC+5O%9LD=-j#S-=#+;`W8Zg;j;fZs*ISnd+w&k<) zAc*AQc`$+G#d#1y^2d1)NpkXhmL+!i%6ync{4aLfCmm*!y*M4>NFGYZ$^1cnln!%H zcxS*Q6tNjliF^N42E@D4Il4ARyE#~fWI>P&$b>OCmgG!Kdn`9+LKcb-Ghq>mz$_&; zv$&cCxd_K)LnMy6ARF^~Wn(tf(ct?ofHaZ|7r@qjYAtu*{AnFNa#T4?kgYk8)~5^) z6bxCK13M}7mR+t{2s_BWw-9!dtX%{R?yAI9Dsfeomq0+xp_70A?db;{mpjSe=R)EgAJj!L*&B}m`HOy zTUu9xOJ8HqLyK{>b<3t=e4pL&Rx#|b*jK24+y3$e4QAjTIIlq?iu4jVfZ|RG>_Abn z4jNE=%c8avTF`PYQ@)lm*oD^Ma(Eua;c^ujRG~tCT><$P^-Z&UkeHM^LPk`=IND(a zmAKRJvin6PmrZ+zHWF>owJ~VD z=diS$?7m=t1_tjNpozgn1MFsS*#NB!J~Dt%pkBLTko_ET)c^+>d}@Hh4E{(!{oec> zHSFp&2T&dVi^I~sWcLjM>R0K@T;OjGu(qB?`gbzbZ`D`Xf5!n-y}J%edyU=yFu>~! zIt|dq;JyJ)F?eWzUo-fYK(BK>K7YgHdnWeT?;=a>)idmV>;S4y-3|*60yPD_26&eN z_&N$)VBlqLjeNtdoCm6uYV3Gmo+`@=Z1Gq5=H-JYylPL!AVld4B0~tgbU@(Jd0}N#_ z!vMn>%rrm%gIEKMW)Sa7>rbt+U?y{nkg*IB4KRU0vH|F5#NnkHAe=!O0rk(FX$;aG zKrP)&vK-fVJylrXAj-ecVQDd(o@;8(;~85(4(KSxruv1E`@@kfr{yRf!soyjsmB5#@i@@NZ!MW&_kR z*lK`!2HP3PuQtIImlyiayfv%+x0~UF$!#STrC(`y(3jT1cslS=`pT1aFp!LZt!R8% z2R;r%gl4&VV4n(}CSuGOujC=v>ACbsphsr=qOGvXOj&2PLlnyP@3+J8cyGEmnl16` z=hHvAZFrB!w(~I9Phl@R4p~=Lv9{P+f&b4&|6kERRr&in{LhxJtD*0SpJuJb@AkF! zENo<$?C^%+E-FZdoyU(v{F%A-0#uvvhvoH)a3ENH1vmSM8)8tXTHnq6GmFaBWS6fj zE~_dpi;SQz7OeDB8l}EtI_`t7xAK~^(=xL;vPNc1g@|_l2N3P4K9`$^$gAUF=v=ju zo1L@fV<0W+W=~W@s*0+urNtZ9*Q~>_DC|5xWsxHS)&Cz+BjXYwx=*#OreMiWg;+S(YkrZpy7W0OWvf$n|wd)H=lE!N$8e|tFdx%bi4 zZSLwex3smi?k;$dS^!dv8 ze5|aNoVhwtGPKpZ< zze*qN(yVoeAJRvQfb<~ID|3ceo-rNSLvb==7CaR}87ZPDGe8{87|@eCLRG_sXXbO> z77J|~izTFD4VHc4BHqtzg-HUkLR=y&VWK2!y11DY09~RhYYRR%XHTKtoyxu-w&V;K zEprQn`~2aezIv#bKQB%^LA`x-A8{V_ji`^GKhGI=*U$w+#lm_&@$URMcqoP}7$$;p zo)@0E!^P_;CCaee zUt_w#`jnL&CBvM>?!N|#*zNw}wQnYhOE0;Kpt2J2_8lJ?2+&u&U3M3`^!??ffUDqE zc@vFqD#HK+`iOB=cg5b#<+ut~QMe^o_|}{d)3$o(pVe#yaret|T#|*N{d%yT^r8l+ z_~;+3d6$))>#$!)#Ljgi^|xwIJu{Bfon~W$wWnUYagek4c3U|vsIM5bC0WGnvG=Qf z%L(Yvr*C~50CtB%fPCr<14Z-dXk2iMD7SK$eyzS7(CVWvY50>;#F8Dcdi~31?R1C9 zncRx%yUuV($)j;HGZOmg=l|y-$NfS`jvMnvg1&ptVU8PeEJ1&H?+p&A-9M2-_O~R6 z)B8Pi?*r@+S6dTgi$Bg~*l{1-dZ^7vmZ5{dRbP9U8xfZFNa^hlUi!f!xQx`Rg>4Bk zZVH(73rFXu;`*33zT)PF92?Hf)$UIa*IGQpp*KDC*0*?&`u>&>j=$O(#9>2@CF&Xa zC9aDtiAybBV#7Ob`ubm==ZXv4_Blc$<*s4iqtE%jBOLz=p-3M+<-MC69CI?-(Y$hv z5dH^z^zTpqf!!BB2xhmDnR@n9c7>e_R4(1pzDp^;x?u0sOP^2G13$XLVJ?>jb6CVD z{;Vv$;?BxTpX2VO>7j(PfBHQq9JuPD+#>ylaboEwUi!T+x<)wf7(`g^NMY$rmc0Oi#fP0IdaEmDwAsli-QRtaPxSlXqgWLs)a;Gu6?_z9WjU`GOs=Dn&8il@SyTs`Rncb_ zRV9lq@n%((EV{m%RrzNYl_!g?@n+S|Gplc3_R(B7YyExMdfevj33<-=Vrnb)g3q1Z zc!XNFOy~o7(AjpN4}1;KA-DNLEWVH0&iTTRec_=zISSUm)3&J5aLCme$MWY8D00SW ziVcPAD4OlL^J~pUnZcww_K$F}a3Uje9GAInfNoIvX7|G3H z5KZ!A7|=^pK1SI?y>FUj%mlnOWud2B8VIRY5nhEht+Jn!(|WKoOU_BjYE-T}sOuhd6bBIlS>AWGc3XDqMsC9}_pK6z*yc*~1PV8-mv zl2nnfWLS*Wj%3xqy=1&2pUR9Bu%h^F3LbDg$d6MXay&xUpNbXO^$?TFB(;)$c zPX>%f5t{*(c=nHHKzvWSM_0sXH~PzvEC`l^Ghrl-B`FirI_26-$U<=;6LL@t&r)J7 zi_2M%i*R%{OvX_cWMf{3Y{-UM8ob+FNF_OcF0AjR_VOv5KkbyS99j-zW%E2p?NNpo z3WhA22U{rgrd=+d51YxpJ0EtCT$cm&9;(D;DsfqsCuiBFbw?0!}W^GH6b#Fre(F{>blLe5IgVPz9IyR~?PP73 zs9{(C>;S6ce{opa7wo=HK>bub%mx1H04wTfq+gM#UeZU|f7=06y*my|dxPEI8sJR^ z_YBa&;JyKlGk9QtcNlz6pu?pOpTA-9BNO}VKO#$=)%V!_!~s;FIvo~X1ZoPp4e$X2 z@N*P6%fQ6|e_-H>ppM)4kcrs{`G`SJ1JI3uQ{`cRD-1jh@J9w-2Dr+=#{kzD^fkZ@ zUmQPH?Pn0WTM+me;O`6u8sH9tK?bgkDnTJ|gvV@7(<9Dtq9q(>4xX1C?6hawYY;s1%FP`3TJ30{x)p%+J! zIet|d{p;I??-AK@2KxIe>}|&(E6XZYSS=O!Uu^V$iT()X@9prvP`hs ztDW5Bl9h&mw5glCPz|XnuC|m~UtCqQ633#jOImV{BLda`j;N7wi4fhR+E!DuEacz1 CMwuM| diff --git a/page/python-api/.doctrees/index.doctree b/page/python-api/.doctrees/index.doctree index b3532dbe4a4b7fbfb583b5396940046ab4d23f8b..62a28065f48da93c85a781b0f05636a6d1ded647 100644 GIT binary patch delta 1211 zcmX|>TTBx{6hONzv=p#n#0CKyQn0Cl6x0xvXndz2v{ecMjbeqhbS-^sA0iffVO3ld zGc|sgXox086A8Ex{qaG3C1`vk68%sUqJH_Ki5h=Qymz+UpEEOO?##WjJG-AJRi7tS z<98bgZ!0B}Hj7fwlb}OyND2i#fiBh;wy?dOY&hKE@$TIlw)pvoFDV$vti6zo+tiF1 zdS+EpsDieP)Y){oIjLn{zc)g3HhpGBXMktPS6f+eB154Nv|fJ~+gr(pBS|ifVlG`k ztacNrw`Vi`q}sla`0d&1BRFeJrOL>amK;S{O|!kU&t(S4NBauq7|CWvvPoSN`4`lR)w^ii zq20Y{JM7nrrF&X%S)cnXHrmdU3}ipwbpu$--ecn8FLoX(wdXz)zxu?3{fXB3kG4b=h%LtB9_ zLYskkJUmcw8y~_0-w!VaehF9LM8pDIA6W%FNO_y`d!z=8F^b+5-2}W6-2j}8u7G+M z#5MujV#|OhV*`h29T%abM3U2I!7D=1t%gxSdc<9lrVC|pSrWyv7?p%U7S|+EB8%&i zFv{X46>VIZY;H**CRvP2!Ym6>5=&9g3ttXBD77*zXyH|KL_Qsu$ULQ6JG)LKz1ywj zcrHP+fp5gmJxPx#xRlRdEAb*uzxfS=M{nJ5okZii8F1p? MnQ3euzrUpV58MZY6951J delta 1239 zcmYk6ZAep57=XRbwq`XKttnb!TaB5iTSZhO`i@HXQ7%(QA48YhZS8x@O6_B&W!Ey! zjeZ1%BuIhQx_$kTii*IZ5)%DUf`q^N6;$*`>V41MF8z7#InQ~|`@ZMy>`pzAO+Ar4 zcxq*gWZG^l;JKW}V8p|7^G*btJpO2mb(5ue*%nHlh$2{tY# z_iZYow-w3f_ySFy7P8EiuMoEu!*XGITuwv(T64*aO<&rUla<9OX?#T_8spg{ioE{{ zi@Ked?RsLe7m|QISAGG5beL3)1;mhxD9!2YN`)vp$rt+?rj@827Un#ub`&$`$Z^Le z7uIDjBd{Rbjc7+)L3AKE1Xf~u5SX65is(dKL$o4#5$6%t5$6QizEP$C3v??CdDgz+ z5;-l>tx#>Y_K}(Wdzm(3sCaJn&q50q*7z(Mn27JtKIE@SQ8&(N|%O(yDWHzJ}%!g>)nZqp^ z+Y?X<`lGeD?X>$UK9r4J3{=0~bQfsxJY$l=PtQVB^5zjHdFORAj#G7u$fWo2Tx_l? z7dpG)+Xi~lw{9uE%U)Ka$jZ9L8|k5YS$$?El(CL%sM6}6$cA`luv&pBE;5(G|dN(N(w*s|0R|tp}c>d`S5{whoLgj@}jD4!j-T3Y?CwfqoY!wgc-E z<-o2)`&rt@O=zi;XSH+TCqm(s!>k}PV{eJeg_7tK#S%&Mi=tQ(1EMIA#Goj2lDJ1j zJ-b{oLt=f>1l;O5c2wtB;b#WVPx#Nrkch}0ilQ|8jZu(MBJ##Y)l0G@e>&X^ IHE~P!4+i>Alpha functions

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/page/usage/eos/cubics/index.html b/page/usage/eos/cubics/index.html index 8f510a0e7..c1520e203 100644 --- a/page/usage/eos/cubics/index.html +++ b/page/usage/eos/cubics/index.html @@ -164,7 +164,7 @@

          RKPR

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/page/usage/eos/cubics/mixing.html b/page/usage/eos/cubics/mixing.html index 1ae7917c2..6ec093718 100644 --- a/page/usage/eos/cubics/mixing.html +++ b/page/usage/eos/cubics/mixing.html @@ -220,7 +220,7 @@

          Michelsen’s Modified

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/page/usage/eos/index.html b/page/usage/eos/index.html index a361bd5da..7e5245625 100644 --- a/page/usage/eos/index.html +++ b/page/usage/eos/index.html @@ -158,7 +158,7 @@

          Equations of State

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/page/usage/excessmodels/index.html b/page/usage/excessmodels/index.html index ef4c9b2eb..c1b4c3fcf 100644 --- a/page/usage/excessmodels/index.html +++ b/page/usage/excessmodels/index.html @@ -158,7 +158,7 @@

          Gibbs Excess Models

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/page/usage/excessmodels/nrtl.html b/page/usage/excessmodels/nrtl.html index 3c0bc3359..0938af9ab 100644 --- a/page/usage/excessmodels/nrtl.html +++ b/page/usage/excessmodels/nrtl.html @@ -159,7 +159,7 @@

          NRTL

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/page/usage/excessmodels/unifaclv.html b/page/usage/excessmodels/unifaclv.html index 93b39f8be..d548e28d9 100644 --- a/page/usage/excessmodels/unifaclv.html +++ b/page/usage/excessmodels/unifaclv.html @@ -258,7 +258,7 @@

          References

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/page/usage/index.html b/page/usage/index.html index 67932f5bb..43c51cd34 100644 --- a/page/usage/index.html +++ b/page/usage/index.html @@ -265,7 +265,7 @@

          Phase equilibria

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/page/usage/newmodels/analtical.html b/page/usage/newmodels/analtical.html index e4eca7f99..8394138de 100644 --- a/page/usage/newmodels/analtical.html +++ b/page/usage/newmodels/analtical.html @@ -159,7 +159,7 @@

          Analytical derivatives

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/page/usage/newmodels/autodiff.html b/page/usage/newmodels/autodiff.html index 0bf7bc60e..473bfbe35 100644 --- a/page/usage/newmodels/autodiff.html +++ b/page/usage/newmodels/autodiff.html @@ -347,7 +347,7 @@

          Obtain a tapenade differentiated E

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/page/usage/newmodels/index.html b/page/usage/newmodels/index.html index afe0085f5..adf28bad2 100644 --- a/page/usage/newmodels/index.html +++ b/page/usage/newmodels/index.html @@ -206,7 +206,7 @@

          Residual Helmholtz models

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/page/usage/phase_equilibrium/envelopes.html b/page/usage/phase_equilibrium/envelopes.html index ca8d7f8f0..911059f4c 100644 --- a/page/usage/phase_equilibrium/envelopes.html +++ b/page/usage/phase_equilibrium/envelopes.html @@ -253,7 +253,7 @@

          Isoplets

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/page/usage/phase_equilibrium/flash.html b/page/usage/phase_equilibrium/flash.html index 2e0eaedd6..45f84ccc0 100644 --- a/page/usage/phase_equilibrium/flash.html +++ b/page/usage/phase_equilibrium/flash.html @@ -159,7 +159,7 @@

          Flash calculations

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/page/usage/phase_equilibrium/index.html b/page/usage/phase_equilibrium/index.html index 1e5278871..9df71c9f7 100644 --- a/page/usage/phase_equilibrium/index.html +++ b/page/usage/phase_equilibrium/index.html @@ -231,7 +231,7 @@

          Phase envelopes

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/page/usage/phase_equilibrium/saturation_points.html b/page/usage/phase_equilibrium/saturation_points.html index 912515ab7..d7ece3573 100644 --- a/page/usage/phase_equilibrium/saturation_points.html +++ b/page/usage/phase_equilibrium/saturation_points.html @@ -159,7 +159,7 @@

          Saturation Points

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/abshyperdual.html b/proc/abshyperdual.html index 10c30207d..d82760614 100644 --- a/proc/abshyperdual.html +++ b/proc/abshyperdual.html @@ -210,7 +210,7 @@

          Return Value

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/acoshyperdual.html b/proc/acoshyperdual.html index df2854c97..7c55d83af 100644 --- a/proc/acoshyperdual.html +++ b/proc/acoshyperdual.html @@ -273,7 +273,7 @@

          Variables

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/addhyperdualhyperdual.html b/proc/addhyperdualhyperdual.html index d330c5932..edbb1e3b1 100644 --- a/proc/addhyperdualhyperdual.html +++ b/proc/addhyperdualhyperdual.html @@ -225,7 +225,7 @@

          Return Value

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/addhyperdualreal.html b/proc/addhyperdualreal.html index f0c010460..72d99f6c3 100644 --- a/proc/addhyperdualreal.html +++ b/proc/addhyperdualreal.html @@ -225,7 +225,7 @@

          Return Value

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/addrealhyperdual.html b/proc/addrealhyperdual.html index 4f5d92ddd..118794510 100644 --- a/proc/addrealhyperdual.html +++ b/proc/addrealhyperdual.html @@ -225,7 +225,7 @@

          Return Value

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/aijtder.html b/proc/aijtder.html index 2df30edbc..43f2ced2b 100644 --- a/proc/aijtder.html +++ b/proc/aijtder.html @@ -118,12 +118,12 @@

          Variables

          - ai - aux + ai + aux daidT daidT2 - i - j + i + j ratK
          @@ -188,7 +188,7 @@

          Arguments

          @@ -203,7 +203,7 @@

          Arguments

          @@ -218,7 +218,7 @@

          Arguments

          @@ -281,7 +281,7 @@

          Variables

          @@ -298,7 +298,7 @@

          Variables

          @@ -349,7 +349,7 @@

          Variables

          @@ -366,7 +366,7 @@

          Variables

          @@ -431,7 +431,7 @@

          Variables

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/allclose.html b/proc/allclose.html index 2a8f3e154..6b5b663f4 100644 --- a/proc/allclose.html +++ b/proc/allclose.html @@ -156,7 +156,7 @@

          Arguments

          @@ -171,7 +171,7 @@

          Arguments

          @@ -240,7 +240,7 @@

          Return Value

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/alpha.html b/proc/alpha.html index 392ce1db1..cb6dac67c 100644 --- a/proc/alpha.html +++ b/proc/alpha.html @@ -159,7 +159,7 @@

          Arguments

          @@ -174,7 +174,7 @@

          Arguments

          @@ -189,7 +189,7 @@

          Arguments

          @@ -206,7 +206,7 @@

          Arguments

          @@ -223,7 +223,7 @@

          Arguments

          @@ -272,7 +272,7 @@

          Arguments

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/alpha_rkpr.html b/proc/alpha_rkpr.html index c5dec2d67..41693e1e1 100644 --- a/proc/alpha_rkpr.html +++ b/proc/alpha_rkpr.html @@ -158,7 +158,7 @@

          Arguments

          @@ -173,7 +173,7 @@

          Arguments

          @@ -188,7 +188,7 @@

          Arguments

          @@ -205,7 +205,7 @@

          Arguments

          @@ -222,7 +222,7 @@

          Arguments

          @@ -271,7 +271,7 @@

          Arguments

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/ar_consistency.html b/proc/ar_consistency.html index 1136300d6..5896713fe 100644 --- a/proc/ar_consistency.html +++ b/proc/ar_consistency.html @@ -121,16 +121,16 @@

          Variables

          GrpGrvHrv - P - dPdn - dlnPhidP - dlnPhidT - dlnPhidn - i - j + P + dPdn + dlnPhidP + dlnPhidT + dlnPhidn + i + jlnphintot - z + z @@ -255,7 +255,7 @@

          Arguments

          @@ -270,7 +270,7 @@

          Arguments

          @@ -285,7 +285,7 @@

          Arguments

          @@ -300,7 +300,7 @@

          Arguments

          @@ -459,7 +459,7 @@

          Variables

          @@ -476,7 +476,7 @@

          Variables

          @@ -493,7 +493,7 @@

          Variables

          @@ -510,7 +510,7 @@

          Variables

          @@ -527,7 +527,7 @@

          Variables

          @@ -544,7 +544,7 @@

          Variables

          @@ -561,7 +561,7 @@

          Variables

          @@ -612,7 +612,7 @@

          Variables

          @@ -660,7 +660,7 @@

          Variables

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/ar_rkpr.html b/proc/ar_rkpr.html index 767f5b920..e35a1f893 100644 --- a/proc/ar_rkpr.html +++ b/proc/ar_rkpr.html @@ -118,7 +118,7 @@

          Variables

          - nd + nd nt
          @@ -168,7 +168,7 @@

          Arguments

          @@ -183,7 +183,7 @@

          Arguments

          @@ -198,7 +198,7 @@

          Arguments

          @@ -213,7 +213,7 @@

          Arguments

          @@ -273,7 +273,7 @@

          Arguments

          @@ -288,7 +288,7 @@

          Arguments

          @@ -303,7 +303,7 @@

          Arguments

          @@ -318,7 +318,7 @@

          Arguments

          @@ -351,7 +351,7 @@

          Variables

          @@ -416,7 +416,7 @@

          Variables

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/ar_srkpr.html b/proc/ar_srkpr.html index d913e31cd..e00e17c32 100644 --- a/proc/ar_srkpr.html +++ b/proc/ar_srkpr.html @@ -118,7 +118,7 @@

          Variables

          - nd + nd nt
          @@ -170,7 +170,7 @@

          Arguments

          @@ -185,7 +185,7 @@

          Arguments

          @@ -200,7 +200,7 @@

          Arguments

          @@ -215,7 +215,7 @@

          Arguments

          @@ -275,7 +275,7 @@

          Arguments

          @@ -290,7 +290,7 @@

          Arguments

          @@ -305,7 +305,7 @@

          Arguments

          @@ -320,7 +320,7 @@

          Arguments

          @@ -353,7 +353,7 @@

          Variables

          @@ -418,7 +418,7 @@

          Variables

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/arvnder.html b/proc/arvnder.html index 8cd5b34ec..7a054f269 100644 --- a/proc/arvnder.html +++ b/proc/arvnder.html @@ -156,7 +156,7 @@

          Arguments

          @@ -201,7 +201,7 @@

          Arguments

          @@ -216,7 +216,7 @@

          Arguments

          @@ -231,7 +231,7 @@

          Arguments

          @@ -246,7 +246,7 @@

          Arguments

          @@ -306,7 +306,7 @@

          Arguments

          @@ -321,7 +321,7 @@

          Arguments

          @@ -336,7 +336,7 @@

          Arguments

          @@ -351,7 +351,7 @@

          Arguments

          @@ -398,7 +398,7 @@

          Arguments

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/asinhyperdual.html b/proc/asinhyperdual.html index ddcf4448c..5d01eb5ba 100644 --- a/proc/asinhyperdual.html +++ b/proc/asinhyperdual.html @@ -273,7 +273,7 @@

          Variables

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/atan2hyperdual.html b/proc/atan2hyperdual.html index 10192adc3..5e34dda05 100644 --- a/proc/atan2hyperdual.html +++ b/proc/atan2hyperdual.html @@ -118,9 +118,9 @@

          Variables

          - a - b - c + a + b + c d
          @@ -225,7 +225,7 @@

          Variables

          @@ -242,7 +242,7 @@

          Variables

          @@ -259,7 +259,7 @@

          Variables

          @@ -324,7 +324,7 @@

          Variables

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/atanhyperdual.html b/proc/atanhyperdual.html index 063b17f43..3a965764f 100644 --- a/proc/atanhyperdual.html +++ b/proc/atanhyperdual.html @@ -273,7 +273,7 @@

          Variables

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/atder.html b/proc/atder.html index 15045d156..05f0f1991 100644 --- a/proc/atder.html +++ b/proc/atder.html @@ -118,7 +118,7 @@

          Variables

          - Tr + Tr
          @@ -197,7 +197,7 @@

          Arguments

          @@ -212,7 +212,7 @@

          Arguments

          @@ -227,7 +227,7 @@

          Arguments

          @@ -290,7 +290,7 @@

          Variables

          @@ -338,7 +338,7 @@

          Variables

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/betalimits.html b/proc/betalimits.html index 82593141c..c97a80859 100644 --- a/proc/betalimits.html +++ b/proc/betalimits.html @@ -171,7 +171,7 @@

          Arguments

          @@ -186,7 +186,7 @@

          Arguments

          @@ -314,7 +314,7 @@

          Variables

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/betato01.html b/proc/betato01.html index 1683c4763..f869ccfac 100644 --- a/proc/betato01.html +++ b/proc/betato01.html @@ -169,7 +169,7 @@

          Arguments

          @@ -184,7 +184,7 @@

          Arguments

          @@ -283,7 +283,7 @@

          Variables

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/bmix.html b/proc/bmix.html index c2cb27cac..5436ca126 100644 --- a/proc/bmix.html +++ b/proc/bmix.html @@ -166,7 +166,7 @@

          Arguments

          @@ -181,7 +181,7 @@

          Arguments

          @@ -196,7 +196,7 @@

          Arguments

          @@ -211,7 +211,7 @@

          Arguments

          @@ -226,7 +226,7 @@

          Arguments

          @@ -243,7 +243,7 @@

          Arguments

          @@ -292,7 +292,7 @@

          Arguments

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/bmix_linear.html b/proc/bmix_linear.html index 81d5df8cb..1f4f19a47 100644 --- a/proc/bmix_linear.html +++ b/proc/bmix_linear.html @@ -90,7 +90,7 @@

          bmix_linear

          @@ -171,7 +171,7 @@

          Arguments

          @@ -186,7 +186,7 @@

          Arguments

          @@ -263,7 +263,7 @@

          Arguments

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/bmix_qmr.html b/proc/bmix_qmr.html index e00b8165d..e9433d8db 100644 --- a/proc/bmix_qmr.html +++ b/proc/bmix_qmr.html @@ -90,7 +90,7 @@

          bmix_qmr
          @@ -172,7 +172,7 @@

          Arguments

          @@ -187,7 +187,7 @@

          Arguments

          @@ -217,7 +217,7 @@

          Arguments

          @@ -280,7 +280,7 @@

          Variables

          @@ -314,7 +314,7 @@

          Variables

          @@ -348,7 +348,7 @@

          Variables

          @@ -365,7 +365,7 @@

          Variables

          @@ -413,7 +413,7 @@

          Variables

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/bmixmhv.html b/proc/bmixmhv.html index f3b9e2dc6..db61100c3 100644 --- a/proc/bmixmhv.html +++ b/proc/bmixmhv.html @@ -193,7 +193,7 @@

          Arguments

          @@ -208,7 +208,7 @@

          Arguments

          @@ -238,7 +238,7 @@

          Arguments

          @@ -253,7 +253,7 @@

          Arguments

          @@ -268,7 +268,7 @@

          Arguments

          @@ -315,7 +315,7 @@

          Arguments

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/bnder.html b/proc/bnder.html index 5a4fbd533..928380d5d 100644 --- a/proc/bnder.html +++ b/proc/bnder.html @@ -118,10 +118,10 @@

          Variables

          - aux - i - j - totn + aux + i + j + totn
          @@ -170,7 +170,7 @@

          Arguments

          @@ -200,7 +200,7 @@

          Arguments

          @@ -215,7 +215,7 @@

          Arguments

          @@ -230,7 +230,7 @@

          Arguments

          @@ -263,7 +263,7 @@

          Variables

          @@ -280,7 +280,7 @@

          Variables

          @@ -297,7 +297,7 @@

          Variables

          @@ -314,7 +314,7 @@

          Variables

          @@ -362,7 +362,7 @@

          Variables

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/continuation.html b/proc/continuation.html index 7fa91f8e5..d90d00bb1 100644 --- a/proc/continuation.html +++ b/proc/continuation.html @@ -118,17 +118,17 @@

          Variables

          - S - X - dF - dFdS - dS - dXdS + S + X + dF + dFdS + dS + dXdS fval - i + i max_iters newton_its - ns + ns
          @@ -188,7 +188,7 @@

          Arguments

          @@ -233,7 +233,7 @@

          Arguments

          @@ -248,7 +248,7 @@

          Arguments

          @@ -264,7 +264,7 @@

          Arguments

          @@ -331,7 +331,7 @@

          Arguments

          @@ -364,7 +364,7 @@

          Arguments

          Return Value - + real(kind=pr), (max_points,size(X0))

          @@ -386,7 +386,7 @@

          Variables

          @@ -403,7 +403,7 @@

          Variables

          @@ -420,7 +420,7 @@

          Variables

          @@ -437,7 +437,7 @@

          Variables

          @@ -454,7 +454,7 @@

          Variables

          @@ -471,7 +471,7 @@

          Variables

          @@ -505,7 +505,7 @@

          Variables

          @@ -556,7 +556,7 @@

          Variables

          @@ -604,7 +604,7 @@

          Variables

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/coshhyperdual.html b/proc/coshhyperdual.html index 57efdabce..0b8343008 100644 --- a/proc/coshhyperdual.html +++ b/proc/coshhyperdual.html @@ -273,7 +273,7 @@

          Variables

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/coshyperdual.html b/proc/coshyperdual.html index 5d3881353..a00ae5d11 100644 --- a/proc/coshyperdual.html +++ b/proc/coshyperdual.html @@ -118,8 +118,8 @@

          Variables

          - dx - f + dx + f
          @@ -208,7 +208,7 @@

          Variables

          @@ -225,7 +225,7 @@

          Variables

          @@ -273,7 +273,7 @@

          Variables

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/cp_residual_vt.html b/proc/cp_residual_vt.html index d49a16ef9..7566a8e35 100644 --- a/proc/cp_residual_vt.html +++ b/proc/cp_residual_vt.html @@ -118,13 +118,13 @@

          Variables

          - Ar - ArT2 + Ar + ArT2 Cv dPdT dPdV - p - totn + p + totn
          @@ -188,7 +188,7 @@

          Arguments

          @@ -203,7 +203,7 @@

          Arguments

          @@ -218,7 +218,7 @@

          Arguments

          @@ -233,7 +233,7 @@

          Arguments

          @@ -281,7 +281,7 @@

          Variables

          @@ -298,7 +298,7 @@

          Variables

          @@ -366,7 +366,7 @@

          Variables

          @@ -383,7 +383,7 @@

          Variables

          @@ -431,7 +431,7 @@

          Variables

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/cubic_roots.html b/proc/cubic_roots.html index 58808aacb..76258037f 100644 --- a/proc/cubic_roots.html +++ b/proc/cubic_roots.html @@ -120,12 +120,12 @@

          Variables

          disc nan - p + p pi q theta u - v + v
          @@ -302,7 +302,7 @@

          Variables

          @@ -387,7 +387,7 @@

          Variables

          @@ -435,7 +435,7 @@

          Variables

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/cubic_roots_rosendo.html b/proc/cubic_roots_rosendo.html index 0984c00df..d2eeccd05 100644 --- a/proc/cubic_roots_rosendo.html +++ b/proc/cubic_roots_rosendo.html @@ -119,7 +119,7 @@

          Variables

          A - B + B Q R alp @@ -128,7 +128,7 @@

          Variables

          d2 d3 gam - i + i pi theta
          @@ -286,7 +286,7 @@

          Variables

          @@ -439,7 +439,7 @@

          Variables

          @@ -521,7 +521,7 @@

          Variables

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/cubic_v0.html b/proc/cubic_v0.html index 34f3f0038..cdb8017fd 100644 --- a/proc/cubic_v0.html +++ b/proc/cubic_v0.html @@ -118,8 +118,8 @@

          Variables

          - dbi - dbij + dbi + dbij
          @@ -168,7 +168,7 @@

          Arguments

          @@ -183,7 +183,7 @@

          Arguments

          @@ -198,7 +198,7 @@

          Arguments

          @@ -238,7 +238,7 @@

          Variables

          @@ -255,7 +255,7 @@

          Variables

          @@ -303,7 +303,7 @@

          Variables

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/cv_residual_vt.html b/proc/cv_residual_vt.html index 232bdf0da..f8aebea4b 100644 --- a/proc/cv_residual_vt.html +++ b/proc/cv_residual_vt.html @@ -118,8 +118,8 @@

          Variables

          - Ar - ArT2 + Ar + ArT2
          @@ -171,7 +171,7 @@

          Arguments

          @@ -186,7 +186,7 @@

          Arguments

          @@ -201,7 +201,7 @@

          Arguments

          @@ -216,7 +216,7 @@

          Arguments

          @@ -264,7 +264,7 @@

          Variables

          @@ -281,7 +281,7 @@

          Variables

          @@ -329,7 +329,7 @@

          Variables

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/d1mix_constant.html b/proc/d1mix_constant.html index 1fb2f5e33..90a575fc0 100644 --- a/proc/d1mix_constant.html +++ b/proc/d1mix_constant.html @@ -174,7 +174,7 @@

          Arguments

          @@ -189,7 +189,7 @@

          Arguments

          @@ -204,7 +204,7 @@

          Arguments

          @@ -220,7 +220,7 @@

          Arguments

          @@ -236,7 +236,7 @@

          Arguments

          @@ -253,7 +253,7 @@

          Arguments

          @@ -302,7 +302,7 @@

          Arguments

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/d1mix_rkpr.html b/proc/d1mix_rkpr.html index 5e1aee323..614faf018 100644 --- a/proc/d1mix_rkpr.html +++ b/proc/d1mix_rkpr.html @@ -90,7 +90,7 @@

          d1mix_rkpr
          @@ -179,7 +179,7 @@

          Arguments

          @@ -194,7 +194,7 @@

          Arguments

          @@ -209,7 +209,7 @@

          Arguments

          @@ -224,7 +224,7 @@

          Arguments

          @@ -239,7 +239,7 @@

          Arguments

          @@ -272,7 +272,7 @@

          Variables

          @@ -306,7 +306,7 @@

          Variables

          @@ -323,7 +323,7 @@

          Variables

          @@ -371,7 +371,7 @@

          Variables

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/d1mixmhv.html b/proc/d1mixmhv.html index c8db732c5..49af05ab6 100644 --- a/proc/d1mixmhv.html +++ b/proc/d1mixmhv.html @@ -170,7 +170,7 @@

          Arguments

          @@ -185,7 +185,7 @@

          Arguments

          @@ -200,7 +200,7 @@

          Arguments

          @@ -215,7 +215,7 @@

          Arguments

          @@ -230,7 +230,7 @@

          Arguments

          @@ -245,7 +245,7 @@

          Arguments

          @@ -292,7 +292,7 @@

          Arguments

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/dandtnder.html b/proc/dandtnder.html index 9e62c305f..4164cb499 100644 --- a/proc/dandtnder.html +++ b/proc/dandtnder.html @@ -118,13 +118,13 @@

          Variables

          - aij - aux - aux2 + aij + aux + aux2 daijdT daijdT2 - i - j + i + j
          @@ -188,7 +188,7 @@

          Arguments

          @@ -203,7 +203,7 @@

          Arguments

          @@ -233,7 +233,7 @@

          Arguments

          @@ -248,7 +248,7 @@

          Arguments

          @@ -278,7 +278,7 @@

          Arguments

          @@ -293,7 +293,7 @@

          Arguments

          @@ -308,7 +308,7 @@

          Arguments

          @@ -341,7 +341,7 @@

          Variables

          @@ -358,7 +358,7 @@

          Variables

          @@ -375,7 +375,7 @@

          Variables

          @@ -426,7 +426,7 @@

          Variables

          @@ -443,7 +443,7 @@

          Variables

          @@ -491,7 +491,7 @@

          Variables

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/deltander.html b/proc/deltander.html index 2199210d9..1e1982eea 100644 --- a/proc/deltander.html +++ b/proc/deltander.html @@ -118,9 +118,9 @@

          Variables

          - i - j - totn + i + j + totn
          @@ -169,7 +169,7 @@

          Arguments

          @@ -214,7 +214,7 @@

          Arguments

          @@ -229,7 +229,7 @@

          Arguments

          @@ -262,7 +262,7 @@

          Variables

          @@ -279,7 +279,7 @@

          Variables

          @@ -296,7 +296,7 @@

          Variables

          @@ -344,7 +344,7 @@

          Variables

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/dividehyperdualhyperdual.html b/proc/dividehyperdualhyperdual.html index 4f03b1969..9ed3b80ca 100644 --- a/proc/dividehyperdualhyperdual.html +++ b/proc/dividehyperdualhyperdual.html @@ -225,7 +225,7 @@

          Return Value

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/dividehyperdualreal.html b/proc/dividehyperdualreal.html index 9bf158965..877dc5bb9 100644 --- a/proc/dividehyperdualreal.html +++ b/proc/dividehyperdualreal.html @@ -270,7 +270,7 @@

          Variables

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/dividerealhyperdual.html b/proc/dividerealhyperdual.html index 243162037..bbbd58c67 100644 --- a/proc/dividerealhyperdual.html +++ b/proc/dividerealhyperdual.html @@ -270,7 +270,7 @@

          Variables

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/dmix.html b/proc/dmix.html index 98b81372b..831014e0c 100644 --- a/proc/dmix.html +++ b/proc/dmix.html @@ -118,14 +118,14 @@

          Variables

          - aij - aux - aux2 + aij + aux + aux2 daijdt daijdt2 - i - j - nc + i + j + nc
          @@ -194,7 +194,7 @@

          Arguments

          @@ -209,7 +209,7 @@

          Arguments

          @@ -224,7 +224,7 @@

          Arguments

          @@ -239,7 +239,7 @@

          Arguments

          @@ -255,7 +255,7 @@

          Arguments

          @@ -272,7 +272,7 @@

          Arguments

          @@ -289,7 +289,7 @@

          Arguments

          @@ -305,7 +305,7 @@

          Arguments

          @@ -322,7 +322,7 @@

          Arguments

          @@ -339,7 +339,7 @@

          Arguments

          @@ -356,7 +356,7 @@

          Arguments

          @@ -373,7 +373,7 @@

          Arguments

          @@ -408,7 +408,7 @@

          Variables

          @@ -425,7 +425,7 @@

          Variables

          @@ -442,7 +442,7 @@

          Variables

          @@ -493,7 +493,7 @@

          Variables

          @@ -510,7 +510,7 @@

          Variables

          @@ -527,7 +527,7 @@

          Variables

          @@ -575,7 +575,7 @@

          Variables

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/dmixmhv.html b/proc/dmixmhv.html index 26a0df76a..37bf0f33d 100644 --- a/proc/dmixmhv.html +++ b/proc/dmixmhv.html @@ -118,32 +118,32 @@

          Variables

          @@ -225,7 +225,7 @@

          Arguments

          @@ -240,7 +240,7 @@

          Arguments

          @@ -255,7 +255,7 @@

          Arguments

          @@ -285,7 +285,7 @@

          Arguments

          @@ -300,7 +300,7 @@

          Arguments

          @@ -315,7 +315,7 @@

          Arguments

          @@ -330,7 +330,7 @@

          Arguments

          @@ -345,7 +345,7 @@

          Arguments

          @@ -360,7 +360,7 @@

          Arguments

          @@ -375,7 +375,7 @@

          Arguments

          @@ -390,7 +390,7 @@

          Arguments

          @@ -423,7 +423,7 @@

          Variables

          @@ -525,7 +525,7 @@

          Variables

          @@ -576,7 +576,7 @@

          Variables

          @@ -593,7 +593,7 @@

          Variables

          @@ -644,7 +644,7 @@

          Variables

          @@ -746,7 +746,7 @@

          Variables

          @@ -763,7 +763,7 @@

          Variables

          @@ -816,7 +816,7 @@

          Variables

          @@ -850,7 +850,7 @@

          Variables

          @@ -898,7 +898,7 @@

          Variables

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/dx_to_dn.html b/proc/dx_to_dn.html index 132819977..680e24cfc 100644 --- a/proc/dx_to_dn.html +++ b/proc/dx_to_dn.html @@ -186,7 +186,7 @@

          Arguments

          @@ -201,7 +201,7 @@

          Arguments

          @@ -219,7 +219,7 @@

          Arguments

          Return Value - + real(kind=pr), (size(x))

          @@ -289,7 +289,7 @@

          Variables

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/enthalpy_residual_vt.html b/proc/enthalpy_residual_vt.html index eeda2bd0b..54b359e3a 100644 --- a/proc/enthalpy_residual_vt.html +++ b/proc/enthalpy_residual_vt.html @@ -118,15 +118,15 @@

          Variables

          - Ar - ArT - ArT2 - ArTV - ArTn - ArV - ArV2 - ArVn - Arn + Ar + ArT + ArT2 + ArTV + ArTn + ArV + ArV2 + ArVn + Arn
          @@ -178,7 +178,7 @@

          Arguments

          @@ -193,7 +193,7 @@

          Arguments

          @@ -208,7 +208,7 @@

          Arguments

          @@ -223,7 +223,7 @@

          Arguments

          @@ -322,7 +322,7 @@

          Variables

          @@ -339,7 +339,7 @@

          Variables

          @@ -356,7 +356,7 @@

          Variables

          @@ -373,7 +373,7 @@

          Variables

          @@ -390,7 +390,7 @@

          Variables

          @@ -407,7 +407,7 @@

          Variables

          @@ -424,7 +424,7 @@

          Variables

          @@ -441,7 +441,7 @@

          Variables

          @@ -458,7 +458,7 @@

          Variables

          @@ -506,7 +506,7 @@

          Variables

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/entropy_residual_vt.html b/proc/entropy_residual_vt.html index 162a53f0c..91ba8b55c 100644 --- a/proc/entropy_residual_vt.html +++ b/proc/entropy_residual_vt.html @@ -118,11 +118,11 @@

          Variables

          - Ar - ArT - ArT2 - ArTV - ArTn + Ar + ArT + ArT2 + ArTV + ArTn
          @@ -174,7 +174,7 @@

          Arguments

          @@ -189,7 +189,7 @@

          Arguments

          @@ -204,7 +204,7 @@

          Arguments

          @@ -219,7 +219,7 @@

          Arguments

          @@ -318,7 +318,7 @@

          Variables

          @@ -335,7 +335,7 @@

          Variables

          @@ -352,7 +352,7 @@

          Variables

          @@ -369,7 +369,7 @@

          Variables

          @@ -386,7 +386,7 @@

          Variables

          @@ -434,7 +434,7 @@

          Variables

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/eq_dd.html b/proc/eq_dd.html index 44104f1c5..3aad10ede 100644 --- a/proc/eq_dd.html +++ b/proc/eq_dd.html @@ -225,7 +225,7 @@

          Return Value

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/eq_di.html b/proc/eq_di.html index 84df876cf..d52a5eb0b 100644 --- a/proc/eq_di.html +++ b/proc/eq_di.html @@ -225,7 +225,7 @@

          Return Value

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/eq_dr.html b/proc/eq_dr.html index bd026d6c0..012882b22 100644 --- a/proc/eq_dr.html +++ b/proc/eq_dr.html @@ -225,7 +225,7 @@

          Return Value

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/eq_id.html b/proc/eq_id.html index 5f56346ee..d4c324db7 100644 --- a/proc/eq_id.html +++ b/proc/eq_id.html @@ -225,7 +225,7 @@

          Return Value

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/eq_rd.html b/proc/eq_rd.html index c789060a0..20b485537 100644 --- a/proc/eq_rd.html +++ b/proc/eq_rd.html @@ -225,7 +225,7 @@

          Return Value

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/equalhyperdualhyperdual.html b/proc/equalhyperdualhyperdual.html index 66e0f6539..850f93c62 100644 --- a/proc/equalhyperdualhyperdual.html +++ b/proc/equalhyperdualhyperdual.html @@ -218,7 +218,7 @@

          Arguments

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/equalhyperdualreal.html b/proc/equalhyperdualreal.html index a043e96e3..ab2281ddc 100644 --- a/proc/equalhyperdualreal.html +++ b/proc/equalhyperdualreal.html @@ -218,7 +218,7 @@

          Arguments

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/error_function.html b/proc/error_function.html index 13c1c7fb5..96d185642 100644 --- a/proc/error_function.html +++ b/proc/error_function.html @@ -119,7 +119,7 @@

          Variables

          @@ -287,7 +287,7 @@

          Variables

          @@ -352,7 +352,7 @@

          Variables

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/excess_gibbs.html b/proc/excess_gibbs.html index 7a69d28b6..d0f7dc5f9 100644 --- a/proc/excess_gibbs.html +++ b/proc/excess_gibbs.html @@ -10,7 +10,7 @@ - excess_gibbs – yaeos + EXCESS_GIBBS – yaeos @@ -66,7 +66,7 @@
          -

          excess_gibbs +

          EXCESS_GIBBS Subroutine

          @@ -78,21 +78,21 @@

          excess_gibbs
        • 32 statements + title=" 0.5% of total for procedures.">26 statements
        • - Source File + Source File
        • @@ -118,12 +118,17 @@

          Variables

          - Ge_c - dGe_c_dn - dGe_c_dn2 - dn - dn2 - pge + a + arg1 + arg2 + b + c + down + g + i + j + tau + x
          @@ -153,70 +158,13 @@

          Variables

          -

          public subroutine excess_gibbs(self, n, T, Ge, GeT, GeT2, Gen, GeTn, Gen2) +

          public subroutine EXCESS_GIBBS(model, n, t, ge)

          -

          Excess Gibbs energy

          -

          Calculate the Gibbs excess energy of the UNIFAC model

          -

          Description

          -

          Calculate the Gibbs excess energy of the UNIFAC model and its -derivatives.

          -

          Examples

          -
           ! Gibbs excess of ethane-ethanol-methyl amine mixture.
          - use yaeos, only: R, pr, Groups, setup_unifac, UNIFAC
          -
          - type(UNIFAC) :: model
          -
          - integer, parameter :: nc = 3, ng = 4
          -
          - type(Groups) :: molecules(nc)
          -
          - real(pr) :: Ge, Gen(nc), GeT, GeT2, GeTn(nc), Gen2(nc, nc)
          -
          - real(pr) :: n(nc), ln_gammas(nc), T
          -
          - T = 150.0_pr
          - n = [2.0_pr, 7.0_pr, 1.0_pr]
          -
          - ! Ethane [CH3]
          - molecules(1)%groups_ids = [1]
          - molecules(1)%number_of_groups = [2]
          -
          - ! Ethanol [CH3, CH2, OH]
          - molecules(2)%groups_ids = [1, 2, 14]
          - molecules(2)%number_of_groups = [1, 1, 1]
          -
          - ! Methylamine [H3C-NH2]
          - molecules(3)%groups_ids = [28]
          - molecules(3)%number_of_groups = [1]
          -
          - ! setup UNIFAC model
          - model = setup_unifac(molecules)
          -
          - ! Call all Ge and derivatives
          - call model%excess_gibbs(model, n, T, Ge, GeT, GeT2, Gen, GeTn, Gen2)
          -
          - print *, "Ge: ", Ge
          - print *, "GeT: ", GeT
          - print *, "GeT2: ", GeT2
          - print *, "Gen: ", Gen
          - print *, "GeTn: ", GeTn
          - print *, "Gen2:"
          - print *, Gen2(1,:)
          - print *, Gen2(2,:)
          - print *, Gen2(3,:)
          -
          - ! If you want the ln_gammas from "Gen" derivative:
          - print *, "ln_gammas: ", Gen / R / T
          -
          - ! Or
          - call model%ln_activity_coefficient(n, T, ln_gammas)
          - print *, "ln_gammas: ", ln_gammas
          -

          Type Bound

          -

          UNIFAC

          +

          NRTL

          Arguments

          - + class(UNIFAC), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(out),
          - + real(kind=pr), intent(out),
          - + real(kind=pr), intent(out),
          - + real(kind=pr), intent(out),
          - + real(kind=pr), intent(out),
          - + real(kind=pr), intent(out),
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), public,
          - + real(kind=pr), public,
          - + real(kind=pr), public,
          procedure, public :: - excess_gibbs
          procedure, public :: - ge => EXCESS_GIBBS
          procedure, public :: - ge_b => EXCESS_GIBBS_B
          procedure, public :: - ge_d => EXCESS_GIBBS_D
          procedure, public :: - ge_d_b => EXCESS_GIBBS_D_B
          procedure, public :: - ge_d_d => EXCESS_GIBBS_D_D
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + class(NRTL)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(out)
          - + class(NRTL)
          - + real(kind=pr), intent(in)
          - + real(kind=pr)
          - + real(kind=pr), intent(in)
          - + real(kind=pr)
          - + real(kind=pr)
          - + real(kind=pr)
          - + class(NRTL)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + class(NRTL)
          - + real(kind=pr), intent(in)
          - + real(kind=pr)
          - + real(kind=pr), intent(in)
          - + real(kind=pr)
          - + real(kind=pr), intent(in)
          - + real(kind=pr)
          - + real(kind=pr), intent(in)
          - + real(kind=pr)
          - + real(kind=pr)
          - + real(kind=pr)
          - + real(kind=pr)
          - + real(kind=pr)
          - + class(NRTL)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + class(NRTL)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + class(ArModel), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(out)
          - + integer, intent(in),
          - + procedure(obj_func)
          - + real(kind=pr), intent(inout)
          - + real(kind=pr), intent(out)
          - + class(*), intent(inout),
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out),
          - + class(*), intent(inout),
          - + logical, public
          - + logical, public
          - + integer
          - + real(kind=pr)
          - + real(kind=pr)
          - + procedure(obj_func)
          - + real(kind=pr), intent(inout)
          - + real(kind=pr), intent(out)
          - + class(*), intent(inout),
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + class(ArModel), public,
          - + real(kind=pr), public,
          - + class(ArModel), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + class(ArModel),
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out),
          - + class(ArModel), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(out)
          - + class(ArModelTapenade), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + class(ArModelTapenade), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr)
          - + class(ArModelTapenade), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + class(ArModelTapenade), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr)
          - + real(kind=pr), intent(in)
          - + real(kind=pr)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr)
          - + real(kind=pr)
          - + class(ArModelTapenade), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + class(ArModelTapenade), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          procedure(tapenade_ar), public, deferred :: - ar
          procedure, public :: - get_v0
          procedure, public :: - residual_helmholtz
          procedure, public :: - volume
          - + class(ArModelTapenade), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + class(ArModelTapenade), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(out),
          - + real(kind=pr), intent(out),
          - + real(kind=pr), intent(out),
          - + real(kind=pr), intent(out),
          - + real(kind=pr), intent(out),
          - + real(kind=pr), intent(out),
          - + real(kind=pr), intent(out),
          - + real(kind=pr), intent(out),
          - + real(kind=pr), intent(out),
          - + real(kind=pr), intent(out),
          - + class(GeModelTapenade)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(out)
          - + class(GeModelTapenade)
          - + real(kind=pr), intent(in)
          - + real(kind=pr)
          - + real(kind=pr), intent(in)
          - + real(kind=pr)
          - + real(kind=pr)
          - + real(kind=pr)
          - + class(GeModelTapenade)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + class(GeModelTapenade)
          - + real(kind=pr), intent(in)
          - + real(kind=pr)
          - + real(kind=pr), intent(in)
          - + real(kind=pr)
          - + real(kind=pr), intent(in)
          - + real(kind=pr)
          - + real(kind=pr), intent(in)
          - + real(kind=pr)
          - + real(kind=pr)
          - + real(kind=pr)
          - + real(kind=pr)
          - + real(kind=pr)
          - + class(GeModelTapenade)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          procedure, public :: - excess_gibbs
          procedure(tapenade_ge), public, deferred :: - ge
          procedure(tapenade_ge_b), public, deferred :: - ge_b
          procedure(tapenade_ge_d), public, deferred :: - ge_d
          procedure(tapenade_ge_d_b), public, deferred :: - ge_d_b
          procedure(tapenade_ge_d_d), public, deferred :: - ge_d_d
          - + class(GeModelTapenade), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(out),
          - + real(kind=pr), intent(out),
          - + real(kind=pr), intent(out),
          - + real(kind=pr), intent(out),
          - + real(kind=pr), intent(out),
          - + real(kind=pr), intent(out),
          - + real(kind=pr)
          - + real(kind=pr),
          - + integer
          - + integer
          - + integer
          - + real(kind=pr)
          - + real(kind=pr),
          - + integer
          - + integer, intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + integer, public
          - + integer, public
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + class(AlphaSoave), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + class(AlphaRKPR), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + class(ArModel), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + integer, public
          - + integer, public
          - + real(kind=pr), public
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + integer, public
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + integer, public
          - + integer, intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out),
          - + real(kind=pr), intent(out),
          - + real(kind=pr), intent(out),
          - + real(kind=pr), intent(out)
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), public
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr)
          - + class(QMR), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), public
          - + integer, public
          - + integer, public
          - + real(kind=pr), public
          - + class(MHV), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + integer, intent(in)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), public
          - + integer, public
          - + integer, public
          - + real(kind=pr), public
          - + procedure(continuation_function)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + integer, intent(in)
          - + procedure(continuation_solver),
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + integer, public
          - + integer, public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + class(ArModel), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=16), public
          - + integer, public
          - + real(kind=pr)
          - + real(kind=pr)
          - + real(kind=pr)
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + class(ArModel), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + class(QMR), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + integer, public
          - + integer, public
          - + real(kind=pr), public
          - + class(MHV), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + integer, intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + integer, public
          - + integer, public
          - + integer, intent(in)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + integer, public
          - + integer, public
          - + real(kind=pr), public
          - + class(QMR), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + integer, public
          - + integer, public
          - + integer, public
          - + class(MHV), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), private
          - + real(kind=pr), private
          - + real(kind=pr), private
          - + real(kind=pr), private
          - + real(kind=pr), private
          - + integer, private
          - + integer, private
          - + integer, private
          - + real(kind=pr), private
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + class(ArModel), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + class(ArModel), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + integer, public
          @@ -231,22 +179,22 @@

          Arguments

          - + - + @@ -256,12 +204,12 @@

          Arguments

          @@ -269,132 +217,132 @@

          Arguments

          - + - - + - + + +
          - - class(UNIFAC), + + class(NRTL) intent(in) ::selfmodel -

          UNIFAC model

          +
          - + real(kind=pr), intent(in) :: n(:) -

          Moles vector [mol]

          +
          - + real(kind=pr), intent(in) ::Tt -

          Temperature [K]

          +
          - + real(kind=pr), intent(out),optional +intent(out) ::Gege -

          Excess Gibbs energy

          +
          + +
          + + +
          +

          Variables

          + + + + + + + + + + - - + - + + + - - + - + + + - - + - + + + - - + - + + + - - + - + + + - -
          TypeVisibility AttributesNameInitial
          - + real(kind=pr), intent(out),optional + public ::GeTa(size(n),size(n)) -

          - -

          +
          - + real(kind=pr), intent(out),optional - + public, + dimension(size(n)) ::GeT2arg1 -

          - -

          +
          - + real(kind=pr), intent(out),optional - + public, + dimension(size(n)) ::Gen(size(n))arg2 -

          - -

          +
          - + real(kind=pr), intent(out),optional + public ::GeTn(size(n))b(size(n),size(n)) -

          - -

          +
          - + real(kind=pr), intent(out),optional + public ::Gen2(size(n),size(n))c(size(n),size(n)) -

          - -

          +
          - -
          - - -
          -

          Variables

          - - - - - - - - - - @@ -402,7 +350,7 @@

          Variables

          - + @@ -419,7 +367,7 @@

          Variables

          - + - + - + - + - + @@ -204,7 +204,7 @@

          Arguments

          @@ -219,7 +219,7 @@

          Arguments

          @@ -234,7 +234,7 @@

          Arguments

          @@ -249,7 +249,7 @@

          Arguments

          @@ -264,7 +264,7 @@

          Arguments

          @@ -279,7 +279,7 @@

          Arguments

          @@ -312,7 +312,7 @@

          Variables

          @@ -414,7 +414,7 @@

          Variables

          @@ -431,7 +431,7 @@

          Variables

          @@ -465,7 +465,7 @@

          Variables

          @@ -499,7 +499,7 @@

          Variables

          @@ -516,7 +516,7 @@

          Variables

          @@ -635,7 +635,7 @@

          Variables

          @@ -700,7 +700,7 @@

          Variables

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/excess_gibbs_d.html b/proc/excess_gibbs_d.html index 665efecfe..cc09b3eab 100644 --- a/proc/excess_gibbs_d.html +++ b/proc/excess_gibbs_d.html @@ -118,24 +118,24 @@

          Variables

          - a + a arg1 arg1d arg2 arg2d - b - c + b + c down - g + g gd - i - j + i + j tau taud temp temp0 temp1 - x + x xd
          @@ -187,7 +187,7 @@

          Arguments

          @@ -202,7 +202,7 @@

          Arguments

          @@ -217,7 +217,7 @@

          Arguments

          @@ -232,7 +232,7 @@

          Arguments

          @@ -247,7 +247,7 @@

          Arguments

          @@ -262,7 +262,7 @@

          Arguments

          @@ -277,7 +277,7 @@

          Arguments

          @@ -310,7 +310,7 @@

          Variables

          @@ -395,7 +395,7 @@

          Variables

          @@ -412,7 +412,7 @@

          Variables

          @@ -446,7 +446,7 @@

          Variables

          @@ -480,7 +480,7 @@

          Variables

          @@ -497,7 +497,7 @@

          Variables

          @@ -599,7 +599,7 @@

          Variables

          @@ -664,7 +664,7 @@

          Variables

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/excess_gibbs_d_b.html b/proc/excess_gibbs_d_b.html index 8ce42b0b6..c5196a3df 100644 --- a/proc/excess_gibbs_d_b.html +++ b/proc/excess_gibbs_d_b.html @@ -118,7 +118,7 @@

          Variables

          - a + a ad_to arg1 arg10 @@ -129,15 +129,15 @@

          Variables

          arg2b arg2d arg2db - b - c + b + c down - g + g gb gd gdb - i - j + i + j result1 tau taub @@ -159,7 +159,7 @@

          Variables

          tempb3 tempb4 tempb5 - x + x xb xd xdb @@ -213,7 +213,7 @@

          Arguments

          @@ -228,7 +228,7 @@

          Arguments

          @@ -243,7 +243,7 @@

          Arguments

          @@ -258,7 +258,7 @@

          Arguments

          @@ -273,7 +273,7 @@

          Arguments

          @@ -288,7 +288,7 @@

          Arguments

          @@ -303,7 +303,7 @@

          Arguments

          @@ -318,7 +318,7 @@

          Arguments

          @@ -333,7 +333,7 @@

          Arguments

          @@ -348,7 +348,7 @@

          Arguments

          @@ -363,7 +363,7 @@

          Arguments

          @@ -378,7 +378,7 @@

          Arguments

          @@ -393,7 +393,7 @@

          Arguments

          @@ -426,7 +426,7 @@

          Variables

          @@ -613,7 +613,7 @@

          Variables

          @@ -630,7 +630,7 @@

          Variables

          @@ -664,7 +664,7 @@

          Variables

          @@ -732,7 +732,7 @@

          Variables

          @@ -749,7 +749,7 @@

          Variables

          @@ -1123,7 +1123,7 @@

          Variables

          @@ -1222,7 +1222,7 @@

          Variables

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/excess_gibbs_d_d.html b/proc/excess_gibbs_d_d.html index 3f020959e..f00113570 100644 --- a/proc/excess_gibbs_d_d.html +++ b/proc/excess_gibbs_d_d.html @@ -118,7 +118,7 @@

          Variables

          - a + a arg1 arg1d arg1d0 @@ -127,15 +127,15 @@

          Variables

          arg2d arg2d0 arg2dd - b - c + b + c down - g + g gd gd0 gdd - i - j + i + j tau taud taud0 @@ -151,7 +151,7 @@

          Variables

          temp5 temp6 tempd - x + x xd
          @@ -203,7 +203,7 @@

          Arguments

          @@ -218,7 +218,7 @@

          Arguments

          @@ -233,7 +233,7 @@

          Arguments

          @@ -248,7 +248,7 @@

          Arguments

          @@ -263,7 +263,7 @@

          Arguments

          @@ -278,7 +278,7 @@

          Arguments

          @@ -293,7 +293,7 @@

          Arguments

          @@ -308,7 +308,7 @@

          Arguments

          @@ -323,7 +323,7 @@

          Arguments

          @@ -338,7 +338,7 @@

          Arguments

          @@ -371,7 +371,7 @@

          Variables

          @@ -524,7 +524,7 @@

          Variables

          @@ -541,7 +541,7 @@

          Variables

          @@ -575,7 +575,7 @@

          Variables

          @@ -643,7 +643,7 @@

          Variables

          @@ -660,7 +660,7 @@

          Variables

          @@ -932,7 +932,7 @@

          Variables

          @@ -997,7 +997,7 @@

          Variables

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/excess_gibbs_d_d_d.html b/proc/excess_gibbs_d_d_d.html index a370a8db0..7ee44cdd3 100644 --- a/proc/excess_gibbs_d_d_d.html +++ b/proc/excess_gibbs_d_d_d.html @@ -118,7 +118,7 @@

          Variables

          - a + a arg1 arg1d arg1d0 @@ -135,10 +135,10 @@

          Variables

          arg2dd arg2dd0 arg2ddd - b - c + b + c down - g + g gd gd0 gd0d @@ -146,8 +146,8 @@

          Variables

          gdd gdd0 gddd - i - j + i + j tau taud taud0 @@ -183,7 +183,7 @@

          Variables

          tempd tempd0 tempdd - x + x xd
          @@ -233,7 +233,7 @@

          Arguments

          @@ -248,7 +248,7 @@

          Arguments

          @@ -263,7 +263,7 @@

          Arguments

          @@ -278,7 +278,7 @@

          Arguments

          @@ -308,7 +308,7 @@

          Arguments

          @@ -323,7 +323,7 @@

          Arguments

          @@ -338,7 +338,7 @@

          Arguments

          @@ -368,7 +368,7 @@

          Arguments

          @@ -398,7 +398,7 @@

          Arguments

          @@ -428,7 +428,7 @@

          Arguments

          @@ -476,7 +476,7 @@

          Variables

          @@ -765,7 +765,7 @@

          Variables

          @@ -782,7 +782,7 @@

          Variables

          @@ -816,7 +816,7 @@

          Variables

          @@ -952,7 +952,7 @@

          Variables

          @@ -969,7 +969,7 @@

          Variables

          @@ -1581,7 +1581,7 @@

          Variables

          @@ -1646,7 +1646,7 @@

          Variables

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/excess_gibbs~2.html b/proc/excess_gibbs~2.html index 8e7f5b9ff..83bb54194 100644 --- a/proc/excess_gibbs~2.html +++ b/proc/excess_gibbs~2.html @@ -78,20 +78,20 @@

          excess_gibbs
        • 68 statements + title=" 0.6% of total for procedures.">32 statements
        • - Source File + Source File
        • @@ -118,20 +118,12 @@

          Variables

          - geb - ged - ged0 - gedb - gedd - i - nb - nc - nd - ndb - tb - td - td0 - tdb + Ge_c + dGe_c_dn + dGe_c_dn2 + dn + dn2 + pge
          @@ -145,31 +137,8 @@

          Variables

          - - - - + + @@ -184,14 +153,70 @@

          Subroutines

          -

          private subroutine excess_gibbs(self, n, t, Ge, GeT, GeT2, Gen, GeTn, Gen2) +

          public subroutine excess_gibbs(self, n, T, Ge, GeT, GeT2, Gen, GeTn, Gen2)

          -

          Excess Gibbs model generic interface

          +

          Excess Gibbs energy

          +

          Calculate the Gibbs excess energy of the UNIFAC model

          +

          Description

          +

          Calculate the Gibbs excess energy of the UNIFAC model and its +derivatives.

          +

          Examples

          +
           ! Gibbs excess of ethane-ethanol-methyl amine mixture.
          + use yaeos, only: R, pr, Groups, setup_unifac, UNIFAC
          +
          + type(UNIFAC) :: model
          +
          + integer, parameter :: nc = 3, ng = 4
          +
          + type(Groups) :: molecules(nc)
          +
          + real(pr) :: Ge, Gen(nc), GeT, GeT2, GeTn(nc), Gen2(nc, nc)
          +
          + real(pr) :: n(nc), ln_gammas(nc), T
          +
          + T = 150.0_pr
          + n = [2.0_pr, 7.0_pr, 1.0_pr]
          +
          + ! Ethane [CH3]
          + molecules(1)%groups_ids = [1]
          + molecules(1)%number_of_groups = [2]
          +
          + ! Ethanol [CH3, CH2, OH]
          + molecules(2)%groups_ids = [1, 2, 14]
          + molecules(2)%number_of_groups = [1, 1, 1]
          +
          + ! Methylamine [H3C-NH2]
          + molecules(3)%groups_ids = [28]
          + molecules(3)%number_of_groups = [1]
          +
          + ! setup UNIFAC model
          + model = setup_unifac(molecules)
          +
          + ! Call all Ge and derivatives
          + call model%excess_gibbs(model, n, T, Ge, GeT, GeT2, Gen, GeTn, Gen2)
          +
          + print *, "Ge: ", Ge
          + print *, "GeT: ", GeT
          + print *, "GeT2: ", GeT2
          + print *, "Gen: ", Gen
          + print *, "GeTn: ", GeTn
          + print *, "Gen2:"
          + print *, Gen2(1,:)
          + print *, Gen2(2,:)
          + print *, Gen2(3,:)
          +
          + ! If you want the ln_gammas from "Gen" derivative:
          + print *, "ln_gammas: ", Gen / R / T
          +
          + ! Or
          + call model%ln_activity_coefficient(n, T, ln_gammas)
          + print *, "ln_gammas: ", ln_gammas
          +

          Type Bound

          -

          GeModelTapenade

          +

          UNIFAC

          Arguments

          TypeVisibility AttributesNameInitial
          - + real(kind=pr), public ::Ge_cdown @@ -411,7 +359,7 @@

          Variables

          - + real(kind=pr), public ::dGe_c_dn(self%nmolecules)g(size(n),size(n)) @@ -428,15 +376,15 @@

          Variables

          - - real(kind=pr), + + integer, public ::dGe_c_dn2(self%nmolecules,self%nmolecules)i @@ -445,15 +393,15 @@

          Variables

          - - logical, + + integer, public ::dnj @@ -462,15 +410,15 @@

          Variables

          - - logical, + + real(kind=pr), public ::dn2tau(size(n),size(n)) @@ -479,15 +427,15 @@

          Variables

          - - logical, + + real(kind=pr), public ::pgex(size(n)) @@ -527,7 +475,7 @@

          Variables

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/excess_gibbs_b.html b/proc/excess_gibbs_b.html index f9055a1a9..675a7b314 100644 --- a/proc/excess_gibbs_b.html +++ b/proc/excess_gibbs_b.html @@ -118,26 +118,26 @@

          Variables

          - a + a ad_to arg1 arg1b arg2 arg2b - b - c + b + c down - g + g gb - i - j + i + j tau taub temp temp0 tempb tempb0 - x + x xb
          @@ -189,7 +189,7 @@

          Arguments

          - + class(NRTL)
          - + real(kind=pr), intent(in)
          - + real(kind=pr)
          - + real(kind=pr), intent(in)
          - + real(kind=pr)
          - + real(kind=pr)
          - + real(kind=pr)
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + integer, public
          - + integer, public
          - + real(kind=pr), public
          - + class(NRTL)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + integer, public
          - + integer, public
          - + real(kind=pr), public
          - + class(NRTL)
          - + real(kind=pr), intent(in)
          - + real(kind=pr)
          - + real(kind=pr), intent(in)
          - + real(kind=pr)
          - + real(kind=pr), intent(in)
          - + real(kind=pr)
          - + real(kind=pr), intent(in)
          - + real(kind=pr)
          - + real(kind=pr)
          - + real(kind=pr)
          - + real(kind=pr)
          - + real(kind=pr)
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + integer, public
          - + integer, public
          - + real(kind=pr), public
          - + class(NRTL)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + integer, public
          - + integer, public
          - + real(kind=pr), public
          - + class(NRTL)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + integer, public
          - + integer, public
          - + real(kind=pr), public
          @@ -206,8 +231,8 @@

          Arguments

          @@ -231,12 +256,12 @@

          Arguments

          @@ -244,14 +269,14 @@

          Arguments

          - + @@ -261,7 +286,7 @@

          Arguments

          @@ -276,7 +301,9 @@

          Arguments

          @@ -291,7 +318,9 @@

          Arguments

          @@ -300,13 +329,15 @@

          Arguments

          real(kind=pr), - - + @@ -315,13 +346,15 @@

          Arguments

          real(kind=pr), - - + @@ -336,7 +369,9 @@

          Arguments

          @@ -359,49 +394,15 @@

          Variables

          - - - - - - - - - - - - - - - - - - - - - + - + - + - + - + - + - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -255,7 +255,7 @@

          Variables

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/flash.html b/proc/flash.html index 7e4a693a5..4f8a5944f 100644 --- a/proc/flash.html +++ b/proc/flash.html @@ -118,11 +118,11 @@

          Variables

          - K - P - V + K + P + V Vx - Vy + Vy beta bmax bmin @@ -133,10 +133,10 @@

          Variables

          lnK lnKold lnfug_x - lnfug_y + lnfug_y spec - x - y + x + y
          @@ -207,7 +207,7 @@

          Arguments

          @@ -222,7 +222,7 @@

          Arguments

          @@ -297,7 +297,7 @@

          Arguments

          @@ -337,7 +337,7 @@

          Variables

          @@ -354,7 +354,7 @@

          Variables

          @@ -371,7 +371,7 @@

          Variables

          @@ -405,7 +405,7 @@

          Variables

          @@ -592,7 +592,7 @@

          Variables

          @@ -626,7 +626,7 @@

          Variables

          @@ -643,7 +643,7 @@

          Variables

          @@ -691,7 +691,7 @@

          Variables

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/foo_wrap.html b/proc/foo_wrap.html index f22c52d9f..4d36e1f3f 100644 --- a/proc/foo_wrap.html +++ b/proc/foo_wrap.html @@ -167,7 +167,7 @@

          Arguments

          @@ -182,7 +182,7 @@

          Arguments

          @@ -197,7 +197,7 @@

          Arguments

          @@ -278,7 +278,7 @@

          Variables

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/fugacity_pt.html b/proc/fugacity_pt.html index 301ec7117..4e9927566 100644 --- a/proc/fugacity_pt.html +++ b/proc/fugacity_pt.html @@ -185,7 +185,7 @@

          Arguments

          @@ -200,7 +200,7 @@

          Arguments

          @@ -215,7 +215,7 @@

          Arguments

          @@ -230,7 +230,7 @@

          Arguments

          @@ -245,7 +245,7 @@

          Arguments

          @@ -260,7 +260,7 @@

          Arguments

          @@ -291,7 +291,7 @@

          Arguments

          @@ -306,7 +306,7 @@

          Arguments

          @@ -321,7 +321,7 @@

          Arguments

          @@ -370,7 +370,7 @@

          Arguments

          @@ -470,7 +470,7 @@

          Variables

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/fugacity_vt.html b/proc/fugacity_vt.html index d7f3c78a3..cf061bb3e 100644 --- a/proc/fugacity_vt.html +++ b/proc/fugacity_vt.html @@ -118,24 +118,24 @@

          Variables

          - Ar - ArTV - ArTn - ArV - ArV2 - ArVn - Arn - Arn2 + Ar + ArTV + ArTn + ArV + ArV2 + ArVn + Arn + Arn2 P_in RT Z dPdT_in dPdV_in dPdn_in - i - j - nc - totn + i + j + nc + totn
          @@ -194,7 +194,7 @@

          Arguments

          @@ -209,7 +209,7 @@

          Arguments

          @@ -224,7 +224,7 @@

          Arguments

          @@ -239,7 +239,7 @@

          Arguments

          @@ -254,7 +254,7 @@

          Arguments

          @@ -285,7 +285,7 @@

          Arguments

          @@ -301,7 +301,7 @@

          Arguments

          @@ -317,7 +317,7 @@

          Arguments

          @@ -367,7 +367,7 @@

          Arguments

          @@ -402,7 +402,7 @@

          Variables

          @@ -419,7 +419,7 @@

          Variables

          @@ -436,7 +436,7 @@

          Variables

          @@ -453,7 +453,7 @@

          Variables

          @@ -470,7 +470,7 @@

          Variables

          @@ -487,7 +487,7 @@

          Variables

          @@ -504,7 +504,7 @@

          Variables

          @@ -521,7 +521,7 @@

          Variables

          @@ -640,7 +640,7 @@

          Variables

          @@ -657,7 +657,7 @@

          Variables

          @@ -674,7 +674,7 @@

          Variables

          @@ -691,7 +691,7 @@

          Variables

          @@ -739,7 +739,7 @@

          Variables

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/full_newton.html b/proc/full_newton.html index ad7113ec0..c1fcd8e34 100644 --- a/proc/full_newton.html +++ b/proc/full_newton.html @@ -158,8 +158,8 @@

          Uses

          @@ -214,7 +214,7 @@

          Arguments

          @@ -229,7 +229,7 @@

          Arguments

          @@ -244,7 +244,7 @@

          Arguments

          @@ -259,7 +259,7 @@

          Arguments

          @@ -274,7 +274,7 @@

          Arguments

          @@ -289,7 +289,7 @@

          Arguments

          @@ -319,7 +319,7 @@

          Arguments

          @@ -334,7 +334,7 @@

          Arguments

          @@ -364,7 +364,7 @@

          Arguments

          @@ -479,7 +479,7 @@

          Variables

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/ge_combinatorial.html b/proc/ge_combinatorial.html index 504ee7210..61e36301f 100644 --- a/proc/ge_combinatorial.html +++ b/proc/ge_combinatorial.html @@ -124,8 +124,8 @@

          Variables

          dGe_fh_dn2dGe_sg_dndGe_sg_dn2 - i - j + i + jn_tnqnr @@ -248,7 +248,7 @@

          Arguments

          @@ -263,7 +263,7 @@

          Arguments

          @@ -278,7 +278,7 @@

          Arguments

          @@ -293,7 +293,7 @@

          Arguments

          @@ -462,7 +462,7 @@

          Variables

          @@ -479,7 +479,7 @@

          Variables

          @@ -578,7 +578,7 @@

          Variables

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/ge_consistency.html b/proc/ge_consistency.html index 200e330c6..fc7f7a000 100644 --- a/proc/ge_consistency.html +++ b/proc/ge_consistency.html @@ -121,8 +121,8 @@

          Variables

          GeGenGen2 - i - j + i + jln_gammas @@ -255,7 +255,7 @@

          Arguments

          @@ -271,7 +271,7 @@

          Arguments

          @@ -286,7 +286,7 @@

          Arguments

          @@ -430,7 +430,7 @@

          Variables

          @@ -447,7 +447,7 @@

          Variables

          @@ -512,7 +512,7 @@

          Variables

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/ge_dd.html b/proc/ge_dd.html index 2974bbc1d..0b5bd344b 100644 --- a/proc/ge_dd.html +++ b/proc/ge_dd.html @@ -225,7 +225,7 @@

          Return Value

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/ge_di.html b/proc/ge_di.html index c7e0b1ecd..459906494 100644 --- a/proc/ge_di.html +++ b/proc/ge_di.html @@ -225,7 +225,7 @@

          Return Value

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/ge_dr.html b/proc/ge_dr.html index 7e6b5ffc3..df3ae800d 100644 --- a/proc/ge_dr.html +++ b/proc/ge_dr.html @@ -225,7 +225,7 @@

          Return Value

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/ge_id.html b/proc/ge_id.html index 535e3c106..7687f2b3e 100644 --- a/proc/ge_id.html +++ b/proc/ge_id.html @@ -225,7 +225,7 @@

          Return Value

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/ge_rd.html b/proc/ge_rd.html index fd2567c6c..75226e6df 100644 --- a/proc/ge_rd.html +++ b/proc/ge_rd.html @@ -225,7 +225,7 @@

          Return Value

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/ge_residual.html b/proc/ge_residual.html index a865e6e79..45fc5c085 100644 --- a/proc/ge_residual.html +++ b/proc/ge_residual.html @@ -133,15 +133,15 @@

          Variables

          dlambda_k_dndlambda_k_dn2dlambda_k_dndT - dn + dndn2dtdt2dtn - i - j - k - l + i + j + k + llambda_iklambda_kpge @@ -367,7 +367,7 @@

          Arguments

          @@ -382,7 +382,7 @@

          Arguments

          @@ -397,7 +397,7 @@

          Arguments

          @@ -412,7 +412,7 @@

          Arguments

          @@ -785,7 +785,7 @@

          Variables

          @@ -870,7 +870,7 @@

          Variables

          @@ -887,7 +887,7 @@

          Variables

          @@ -904,7 +904,7 @@

          Variables

          @@ -921,7 +921,7 @@

          Variables

          @@ -1241,7 +1241,7 @@

          Variables

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/genericcubic_ar.html b/proc/genericcubic_ar.html index bf8161e1b..f158a1b21 100644 --- a/proc/genericcubic_ar.html +++ b/proc/genericcubic_ar.html @@ -119,28 +119,28 @@

          Variables

          AUX - Bmix - D + Bmix + D FFB FFBB FFBV - Tr - a + Tr + a auxD2 d1 d2 - dBi - dBij - dD1i - dD1ij - dDdT - dDdT2 - dDi - dDidT - dDij - dadt - dadt2 - f + dBi + dBij + dD1i + dD1ij + dDdT + dDdT2 + dDi + dDidT + dDij + dadt + dadt2 + f fB fBD1 fD1 @@ -148,13 +148,13 @@

          Variables

          fVD1 fv fv2 - g + g gv gv2 - i - j - nc - totn + i + j + nc + totn
          @@ -230,7 +230,7 @@

          Arguments

          @@ -245,7 +245,7 @@

          Arguments

          @@ -260,7 +260,7 @@

          Arguments

          @@ -275,7 +275,7 @@

          Arguments

          @@ -322,7 +322,7 @@

          Arguments

          @@ -373,7 +373,7 @@

          Arguments

          @@ -390,7 +390,7 @@

          Arguments

          @@ -407,7 +407,7 @@

          Arguments

          @@ -424,7 +424,7 @@

          Arguments

          @@ -441,7 +441,7 @@

          Arguments

          @@ -493,7 +493,7 @@

          Variables

          @@ -510,7 +510,7 @@

          Variables

          @@ -578,7 +578,7 @@

          Variables

          @@ -595,7 +595,7 @@

          Variables

          @@ -663,7 +663,7 @@

          Variables

          @@ -680,7 +680,7 @@

          Variables

          @@ -697,7 +697,7 @@

          Variables

          @@ -714,7 +714,7 @@

          Variables

          @@ -731,7 +731,7 @@

          Variables

          @@ -748,7 +748,7 @@

          Variables

          @@ -765,7 +765,7 @@

          Variables

          @@ -782,7 +782,7 @@

          Variables

          @@ -799,7 +799,7 @@

          Variables

          @@ -816,7 +816,7 @@

          Variables

          @@ -833,7 +833,7 @@

          Variables

          @@ -850,7 +850,7 @@

          Variables

          @@ -986,7 +986,7 @@

          Variables

          @@ -1037,7 +1037,7 @@

          Variables

          @@ -1054,7 +1054,7 @@

          Variables

          @@ -1071,7 +1071,7 @@

          Variables

          @@ -1088,7 +1088,7 @@

          Variables

          @@ -1136,7 +1136,7 @@

          Variables

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/get_maingroup_index.html b/proc/get_maingroup_index.html index 643dc77c0..71ad502a6 100644 --- a/proc/get_maingroup_index.html +++ b/proc/get_maingroup_index.html @@ -180,7 +180,7 @@

          Arguments

          @@ -249,7 +249,7 @@

          Return Value

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/get_maingroups_aij.html b/proc/get_maingroups_aij.html index bc3f662b2..750a8f8f9 100644 --- a/proc/get_maingroups_aij.html +++ b/proc/get_maingroups_aij.html @@ -118,8 +118,8 @@

          Variables

          - i - j + i + j
          @@ -193,7 +193,7 @@

          Arguments

          @@ -241,7 +241,7 @@

          Arguments

          Return Value - + real(kind=pr)

          @@ -264,7 +264,7 @@

          Variables

          @@ -281,7 +281,7 @@

          Variables

          @@ -329,7 +329,7 @@

          Variables

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/get_maingroups_bij.html b/proc/get_maingroups_bij.html index 84db10005..362d77b25 100644 --- a/proc/get_maingroups_bij.html +++ b/proc/get_maingroups_bij.html @@ -118,8 +118,8 @@

          Variables

          - i - j + i + j
          @@ -195,7 +195,7 @@

          Arguments

          @@ -243,7 +243,7 @@

          Arguments

          Return Value - + real(kind=pr)

          @@ -266,7 +266,7 @@

          Variables

          @@ -283,7 +283,7 @@

          Variables

          @@ -331,7 +331,7 @@

          Variables

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/get_maingroups_cij.html b/proc/get_maingroups_cij.html index 3c8aec5dc..780cbadb8 100644 --- a/proc/get_maingroups_cij.html +++ b/proc/get_maingroups_cij.html @@ -118,8 +118,8 @@

          Variables

          - i - j + i + j
          @@ -195,7 +195,7 @@

          Arguments

          @@ -266,7 +266,7 @@

          Variables

          @@ -283,7 +283,7 @@

          Variables

          @@ -331,7 +331,7 @@

          Variables

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/get_oma_omb.html b/proc/get_oma_omb.html index 8c69a23f3..48171f246 100644 --- a/proc/get_oma_omb.html +++ b/proc/get_oma_omb.html @@ -119,7 +119,7 @@

          Variables

          d1 - y + y
          @@ -248,7 +248,7 @@

          Variables

          @@ -296,7 +296,7 @@

          Variables

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/get_subgroup_index.html b/proc/get_subgroup_index.html index ec61cb8e7..672355e3b 100644 --- a/proc/get_subgroup_index.html +++ b/proc/get_subgroup_index.html @@ -181,7 +181,7 @@

          Arguments

          @@ -250,7 +250,7 @@

          Return Value

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/get_subgroup_maingroup.html b/proc/get_subgroup_maingroup.html index 782ccda0e..d913b63de 100644 --- a/proc/get_subgroup_maingroup.html +++ b/proc/get_subgroup_maingroup.html @@ -191,7 +191,7 @@

          Arguments

          @@ -294,7 +294,7 @@

          Variables

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/get_subgroup_q.html b/proc/get_subgroup_q.html index 83e2b6a4c..bbb1115da 100644 --- a/proc/get_subgroup_q.html +++ b/proc/get_subgroup_q.html @@ -191,7 +191,7 @@

          Arguments

          @@ -295,7 +295,7 @@

          Variables

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/get_subgroup_r.html b/proc/get_subgroup_r.html index f3ba55fd4..19cd472cd 100644 --- a/proc/get_subgroup_r.html +++ b/proc/get_subgroup_r.html @@ -191,7 +191,7 @@

          Arguments

          @@ -295,7 +295,7 @@

          Variables

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/get_subgroups_aij.html b/proc/get_subgroups_aij.html index de9b141f9..b54723911 100644 --- a/proc/get_subgroups_aij.html +++ b/proc/get_subgroups_aij.html @@ -118,8 +118,8 @@

          Variables

          - i - j + i + j mi_id mj_id
          @@ -196,7 +196,7 @@

          Arguments

          @@ -244,7 +244,7 @@

          Arguments

          Return Value - + real(kind=pr)

          @@ -267,7 +267,7 @@

          Variables

          @@ -284,7 +284,7 @@

          Variables

          @@ -366,7 +366,7 @@

          Variables

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/get_subgroups_bij.html b/proc/get_subgroups_bij.html index 8af83b05e..1bdfdb383 100644 --- a/proc/get_subgroups_bij.html +++ b/proc/get_subgroups_bij.html @@ -118,8 +118,8 @@

          Variables

          - i - j + i + j mi_id mj_id
          @@ -198,7 +198,7 @@

          Arguments

          @@ -246,7 +246,7 @@

          Arguments

          Return Value - + real(kind=pr)

          @@ -269,7 +269,7 @@

          Variables

          @@ -286,7 +286,7 @@

          Variables

          @@ -368,7 +368,7 @@

          Variables

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/get_subgroups_cij.html b/proc/get_subgroups_cij.html index 949bb7e90..0e8fe9c8c 100644 --- a/proc/get_subgroups_cij.html +++ b/proc/get_subgroups_cij.html @@ -118,8 +118,8 @@

          Variables

          - i - j + i + j mi_id mj_id
          @@ -198,7 +198,7 @@

          Arguments

          @@ -269,7 +269,7 @@

          Variables

          @@ -286,7 +286,7 @@

          Variables

          @@ -368,7 +368,7 @@

          Variables

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/get_v0.html b/proc/get_v0.html index b3bdf404e..a69a5ffd9 100644 --- a/proc/get_v0.html +++ b/proc/get_v0.html @@ -158,7 +158,7 @@

          Arguments

          @@ -173,7 +173,7 @@

          Arguments

          @@ -188,7 +188,7 @@

          Arguments

          @@ -203,7 +203,7 @@

          Arguments

          @@ -221,7 +221,7 @@

          Arguments

          Return Value - + real(kind=pr)

          @@ -257,7 +257,7 @@

          Return Value

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/get_z.html b/proc/get_z.html index 9f0340099..aa8f583ff 100644 --- a/proc/get_z.html +++ b/proc/get_z.html @@ -162,7 +162,7 @@

          Arguments

          @@ -208,7 +208,7 @@

          Arguments

          @@ -271,7 +271,7 @@

          Arguments

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/get_zc_oma_omb.html b/proc/get_zc_oma_omb.html index 6bc85aa29..fc1e07a87 100644 --- a/proc/get_zc_oma_omb.html +++ b/proc/get_zc_oma_omb.html @@ -119,7 +119,7 @@

          Variables

          d1 - y + y
          @@ -264,7 +264,7 @@

          Variables

          @@ -312,7 +312,7 @@

          Variables

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/gibbs_residual_vt.html b/proc/gibbs_residual_vt.html index 28dd4bc89..9d9633ef8 100644 --- a/proc/gibbs_residual_vt.html +++ b/proc/gibbs_residual_vt.html @@ -118,16 +118,16 @@

          Variables

          - Ar - ArT - ArV - Arn + Ar + ArT + ArV + Arn dPdT dPdV - dPdn - p - totn - z + dPdn + p + totn + z
          @@ -191,7 +191,7 @@

          Arguments

          @@ -206,7 +206,7 @@

          Arguments

          @@ -221,7 +221,7 @@

          Arguments

          @@ -236,7 +236,7 @@

          Arguments

          @@ -335,7 +335,7 @@

          Variables

          @@ -352,7 +352,7 @@

          Variables

          @@ -369,7 +369,7 @@

          Variables

          @@ -386,7 +386,7 @@

          Variables

          @@ -437,7 +437,7 @@

          Variables

          @@ -454,7 +454,7 @@

          Variables

          @@ -471,7 +471,7 @@

          Variables

          @@ -488,7 +488,7 @@

          Variables

          @@ -536,7 +536,7 @@

          Variables

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/gt_dd.html b/proc/gt_dd.html index 0145077df..7b960ac66 100644 --- a/proc/gt_dd.html +++ b/proc/gt_dd.html @@ -225,7 +225,7 @@

          Return Value

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/gt_di.html b/proc/gt_di.html index 4fffe6651..2af8cd510 100644 --- a/proc/gt_di.html +++ b/proc/gt_di.html @@ -225,7 +225,7 @@

          Return Value

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/gt_dr.html b/proc/gt_dr.html index f3552067e..b58203992 100644 --- a/proc/gt_dr.html +++ b/proc/gt_dr.html @@ -225,7 +225,7 @@

          Return Value

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/gt_id.html b/proc/gt_id.html index c645bc593..37664ae8e 100644 --- a/proc/gt_id.html +++ b/proc/gt_id.html @@ -225,7 +225,7 @@

          Return Value

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/gt_rd.html b/proc/gt_rd.html index 71e099331..8627e307d 100644 --- a/proc/gt_rd.html +++ b/proc/gt_rd.html @@ -225,7 +225,7 @@

          Return Value

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/helmrkpr.html b/proc/helmrkpr.html index 440729f9a..0f98a4272 100644 --- a/proc/helmrkpr.html +++ b/proc/helmrkpr.html @@ -119,26 +119,26 @@

          Variables

          AUX - ArT + ArT ArTT - Bmix - D - D1 + Bmix + D + D1 D2 FFB FFBB FFBV auxD2 - dBi - dBij - dD1i - dD1ij - dDdT - dDdT2 - dDi + dBi + dBij + dD1i + dD1ij + dDdT + dDdT2 + dDi dDiT - dDij - f + dDij + f fB fBD1 fD1 @@ -146,12 +146,12 @@

          Variables

          fVD1 fv fv2 - g + g gv gv2 - i - j - totn + i + j + totn
          @@ -261,7 +261,7 @@

          Arguments

          @@ -276,7 +276,7 @@

          Arguments

          @@ -291,7 +291,7 @@

          Arguments

          @@ -306,7 +306,7 @@

          Arguments

          @@ -321,7 +321,7 @@

          Arguments

          @@ -336,7 +336,7 @@

          Arguments

          @@ -351,7 +351,7 @@

          Arguments

          @@ -366,7 +366,7 @@

          Arguments

          @@ -381,7 +381,7 @@

          Arguments

          @@ -396,7 +396,7 @@

          Arguments

          @@ -446,7 +446,7 @@

          Variables

          @@ -480,7 +480,7 @@

          Variables

          @@ -497,7 +497,7 @@

          Variables

          @@ -514,7 +514,7 @@

          Variables

          @@ -616,7 +616,7 @@

          Variables

          @@ -633,7 +633,7 @@

          Variables

          @@ -650,7 +650,7 @@

          Variables

          @@ -667,7 +667,7 @@

          Variables

          @@ -684,7 +684,7 @@

          Variables

          @@ -701,7 +701,7 @@

          Variables

          @@ -718,7 +718,7 @@

          Variables

          @@ -752,7 +752,7 @@

          Variables

          @@ -769,7 +769,7 @@

          Variables

          @@ -905,7 +905,7 @@

          Variables

          @@ -956,7 +956,7 @@

          Variables

          @@ -973,7 +973,7 @@

          Variables

          @@ -990,7 +990,7 @@

          Variables

          @@ -1038,7 +1038,7 @@

          Variables

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/helmsrkpr.html b/proc/helmsrkpr.html index c4995adce..795e8e068 100644 --- a/proc/helmsrkpr.html +++ b/proc/helmsrkpr.html @@ -119,34 +119,34 @@

          Variables

          AUX - ArT + ArT ArTT - Bmix - D + Bmix + D FFB FFBB FFBV - a + a b_v d1 d2 - dBi - dBij - dDdT - dDdT2 - dDi + dBi + dBij + dDdT + dDdT2 + dDi dDiT - dDij - f + dDij + f fB fv fv2 - g + g gv gv2 - i - j - totn + i + j + totn
          @@ -195,7 +195,7 @@

          Arguments

          @@ -210,7 +210,7 @@

          Arguments

          @@ -255,7 +255,7 @@

          Arguments

          @@ -270,7 +270,7 @@

          Arguments

          @@ -285,7 +285,7 @@

          Arguments

          @@ -345,7 +345,7 @@

          Arguments

          @@ -360,7 +360,7 @@

          Arguments

          @@ -375,7 +375,7 @@

          Arguments

          @@ -390,7 +390,7 @@

          Arguments

          @@ -440,7 +440,7 @@

          Variables

          @@ -474,7 +474,7 @@

          Variables

          @@ -491,7 +491,7 @@

          Variables

          @@ -559,7 +559,7 @@

          Variables

          @@ -627,7 +627,7 @@

          Variables

          @@ -644,7 +644,7 @@

          Variables

          @@ -661,7 +661,7 @@

          Variables

          @@ -678,7 +678,7 @@

          Variables

          @@ -695,7 +695,7 @@

          Variables

          @@ -729,7 +729,7 @@

          Variables

          @@ -746,7 +746,7 @@

          Variables

          @@ -814,7 +814,7 @@

          Variables

          @@ -865,7 +865,7 @@

          Variables

          @@ -882,7 +882,7 @@

          Variables

          @@ -899,7 +899,7 @@

          Variables

          @@ -947,7 +947,7 @@

          Variables

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/init.html b/proc/init.html index b2af68c82..53115d3a1 100644 --- a/proc/init.html +++ b/proc/init.html @@ -78,20 +78,20 @@

          init
        • 8 statements + title=" 0.3% of total for procedures.">16 statements
        • - Source File + Source File
        • @@ -111,7 +111,19 @@

          init
          -

          public function init(a, b, c) +

          private function init(Ge, b, q, lij) result(mixrule)

          @@ -156,22 +168,22 @@

          Arguments

          - + @@ -179,14 +191,14 @@

          Arguments

          - + @@ -194,7 +206,22 @@

          Arguments

          - + + + + + + + + + @@ -204,14 +231,65 @@

          Arguments

          Return Value - - type(NRTL) + + type(MHV)


          +
          +

          Variables

          +
          - - class(GeModelTapenade), + + class(UNIFAC), intent(in) @@ -216,12 +241,12 @@

          Arguments

          :: self - +

          UNIFAC model

          - + real(kind=pr), intent(in) :: n(:) - +

          Moles vector [mol]

          - + real(kind=pr), intent(in) ::tT - +

          Temperature [K]

          - + real(kind=pr), intent(out), :: Ge - +

          Excess Gibbs energy

          :: GeT - +

          + +

          :: GeT2 - +

          + +

          intent(out),optional, - dimension(size(n)) + optional + ::GenGen(size(n)) - +

          + +

          intent(out),optional, - dimension(size(n)) + optional + ::GeTnGeTn(size(n)) - +

          + +

          :: Gen2(size(n),size(n)) - +

          + +

          - - real(kind=pr), - private - - ::geb - -
          - - real(kind=pr), - private - - ::ged - -
          - + real(kind=pr), privatepublic ::ged0Ge_c @@ -410,15 +411,15 @@

          Variables

          - + real(kind=pr), privatepublic ::gedbdGe_c_dn(self%nmolecules) @@ -427,15 +428,15 @@

          Variables

          - + real(kind=pr), privatepublic ::gedddGe_c_dn2(self%nmolecules,self%nmolecules) @@ -444,15 +445,15 @@

          Variables

          - - integer, + + logical, privatepublic ::idn @@ -461,15 +462,15 @@

          Variables

          - - real(kind=pr), + + logical, privatepublic ::nb(size(n))dn2 @@ -478,117 +479,15 @@

          Variables

          - - integer, + + logical, privatepublic ::nc - -
          - - real(kind=pr), - private - - ::nd(size(n)) - -
          - - real(kind=pr), - private - - ::ndb(size(n)) - -
          - - real(kind=pr), - private - - ::tb - -
          - - real(kind=pr), - private - - ::td - -
          - - real(kind=pr), - private - - ::td0 - -
          - - real(kind=pr), - private - - ::tdbpge @@ -605,65 +504,8 @@

          Variables

          - -
          -

          Functions

          -
          -

          function get_GenT() -

          -
          - - - -

          Arguments

          - None -

          - Return Value - real(kind=pr), (size(n)) -

          - - -
          -
          - -
          -

          function get_dGedT2() -

          -
          - - - -

          Arguments

          - None -

          - Return Value - real(kind=pr) -

          - - -
          -
          - -
          -
          - -
          -

          Subroutines

          -
          -

          subroutine reset_vars() -

          -
          - - - -

          Arguments

          - None - -
          -
          -
          @@ -685,7 +527,7 @@

          Arguments

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/exphyperdual.html b/proc/exphyperdual.html index 399914d48..0a95599d7 100644 --- a/proc/exphyperdual.html +++ b/proc/exphyperdual.html @@ -118,7 +118,7 @@

          Variables

          - dx + dx
          @@ -207,7 +207,7 @@

          Variables

          - + real(kind=pr), public
          - + class(ArModel), intent(in)
          - + real(kind=pr), intent(in)
          - + integer, intent(out),
          - + real(kind=pr), public,
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public,
          - + real(kind=pr), public,
          - + real(kind=pr), public,
          - + integer
          - + real(kind=pr)
          - + real(kind=pr)
          - + class(ArModel), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(out),
          - + character(len=*), intent(in)
          - + real(kind=pr), intent(out),
          - + real(kind=pr), intent(out),
          - + real(kind=pr), intent(out),
          - + real(kind=pr), intent(out),
          - + class(ArModel)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(out),
          - + real(kind=pr), intent(out),
          - + real(kind=pr), intent(out),
          - + real(kind=pr), intent(out),
          - + real(kind=pr), intent(out),
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public,
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public,
          - + real(kind=pr), public,
          - + real(kind=pr), public
          - + integer, public
          - + integer, public
          - + integer, public
          - + real(kind=pr), public
          - + real(kind=pr), intent(inout)
          - + integer, intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + integer, intent(in)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(in)
          - + class(UNIFAC)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(out),
          - + integer, public
          - + integer, public
          - + class(GeModel), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + integer, public
          - + integer, public
          - + class(UNIFAC)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(out),
          - + logical, public
          - + integer, public
          - + integer, public
          - + integer, public
          - + integer, public
          - + class(CubicEoS), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(out),
          - + real(kind=pr), intent(out),
          - + real(kind=pr), intent(out),
          - + real(kind=pr), intent(out),
          - + real(kind=pr), intent(out),
          - + real(kind=pr), intent(out),
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + integer, public
          - + integer, public
          - + integer, public
          - + real(kind=pr), public
          - + class(GeGCModelParameters)
          - + class(GeGCModelParameters)
          - + integer, public
          - + integer, public
          - + class(GeGCModelParameters)
          - + integer, public
          - + integer, public
          - + class(GeGCModelParameters)
          - + integer, public
          - + integer, public
          - + real(kind=pr), private
          - + class(GeGCModelParameters)
          - + class(GeGCModelParameters)
          - + class(GeGCModelParameters)
          - + class(GeGCModelParameters)
          - + class(GeGCModelParameters)
          - + integer, public
          - + integer, public
          - + class(GeGCModelParameters)
          - + integer, public
          - + integer, public
          - + class(GeGCModelParameters)
          - + integer, public
          - + integer, public
          - + class(ArModelTapenade), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), public
          - + class(ArModel), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + integer, public
          - + integer, public
          - + real(kind=pr), public
          - + integer, intent(in)
          - + integer, intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(in)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), intent(out)
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + real(kind=pr), public
          - + integer, public
          - + integer, public
          - + real(kind=pr), public
          - - real(kind=pr), + + class(GeModel), intent(in) ::a(:,:)Ge
          - + real(kind=pr), intent(in) ::b(:,:)b(:)
          - + real(kind=pr), intent(in) ::c(:,:)q + +
          + + real(kind=pr), + intent(in),optional + + ::lij(:,:)
          + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
          TypeVisibility AttributesNameInitial
          + + integer, + private + + ::i + +
          + + integer, + private + + ::nc + +
          + +
          +
          @@ -240,7 +318,7 @@

          Return Value

          Documentation generated by FORD - on 2024-08-27 18:43

          + on 2024-08-27 18:52


          diff --git a/proc/init~2.html b/proc/init~2.html index 1c6297dc3..fc30780c2 100644 --- a/proc/init~2.html +++ b/proc/init~2.html @@ -78,20 +78,20 @@

          init
        • 16 statements + title=" 0.1% of total for procedures.">8 statements
        • - Source File + Source File
        @@ -111,19 +111,7 @@

        init
        -

        private function init(Ge, b, q, lij) result(mixrule) +

        public function init(a, b, c)

        @@ -168,22 +156,22 @@

        Arguments

        - - class(GeModel), + + real(kind=pr), intent(in) :: - Ge + a(:,:) - + real(kind=pr), intent(in) @@ -191,14 +179,14 @@

        Arguments

        :: - b(:) + b(:,:) - + real(kind=pr), intent(in) @@ -206,22 +194,7 @@

        Arguments

        :: - q - - - - - - - - real(kind=pr), - -intent(in), - optional - - - :: - lij(:,:) + c(:,:) @@ -231,65 +204,14 @@

        Arguments

        Return Value - - type(MHV) + + type(NRTL)


        -
        -

        Variables

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        TypeVisibility AttributesNameInitial
        - - integer, - private - - ::i - -
        - - integer, - private - - ::nc - -
        - -
        -
        @@ -318,7 +240,7 @@

        Variables

        Documentation generated by FORD - on 2024-08-27 18:43

        + on 2024-08-27 18:52


        diff --git a/proc/inthyperdual.html b/proc/inthyperdual.html index 56da93105..09838ed65 100644 --- a/proc/inthyperdual.html +++ b/proc/inthyperdual.html @@ -210,7 +210,7 @@

        Return Value

        Documentation generated by FORD - on 2024-08-27 18:43

        + on 2024-08-27 18:52


        diff --git a/proc/k_wilson.html b/proc/k_wilson.html index fe9bace2a..758039cf5 100644 --- a/proc/k_wilson.html +++ b/proc/k_wilson.html @@ -90,7 +90,7 @@

        k_wilson

        diff --git a/proc/kij_constant.html b/proc/kij_constant.html index df0d1938c..d5c6a62ba 100644 --- a/proc/kij_constant.html +++ b/proc/kij_constant.html @@ -119,9 +119,9 @@

        Variables

        @@ -175,7 +175,7 @@

        Arguments

        - + class(QMR), intent(in) @@ -190,7 +190,7 @@

        Arguments

        - + real(kind=pr), intent(in) @@ -205,7 +205,7 @@

        Arguments

        - + real(kind=pr), intent(in) @@ -220,7 +220,7 @@

        Arguments

        - + real(kind=pr), intent(in) @@ -237,7 +237,7 @@

        Arguments

        - + real(kind=pr), intent(in) @@ -254,7 +254,7 @@

        Arguments

        - + real(kind=pr), intent(out) @@ -339,7 +339,7 @@

        Variables

        - + integer, public @@ -373,7 +373,7 @@

        Variables

        - + integer, public @@ -438,7 +438,7 @@

        Variables

        Documentation generated by FORD - on 2024-08-27 18:43

        + on 2024-08-27 18:52


        diff --git a/proc/le_dd.html b/proc/le_dd.html index 6548ad243..d5a47e6c2 100644 --- a/proc/le_dd.html +++ b/proc/le_dd.html @@ -225,7 +225,7 @@

        Return Value

        Documentation generated by FORD - on 2024-08-27 18:43

        + on 2024-08-27 18:52


        diff --git a/proc/le_di.html b/proc/le_di.html index 216bf9e41..f2deded00 100644 --- a/proc/le_di.html +++ b/proc/le_di.html @@ -225,7 +225,7 @@

        Return Value

        Documentation generated by FORD - on 2024-08-27 18:43

        + on 2024-08-27 18:52


        diff --git a/proc/le_dr.html b/proc/le_dr.html index 4716bbc01..3e24fe63c 100644 --- a/proc/le_dr.html +++ b/proc/le_dr.html @@ -225,7 +225,7 @@

        Return Value

        Documentation generated by FORD - on 2024-08-27 18:43

        + on 2024-08-27 18:52


        diff --git a/proc/le_id.html b/proc/le_id.html index 28ea5a483..4785d9839 100644 --- a/proc/le_id.html +++ b/proc/le_id.html @@ -225,7 +225,7 @@

        Return Value

        Documentation generated by FORD - on 2024-08-27 18:43

        + on 2024-08-27 18:52


        diff --git a/proc/le_rd.html b/proc/le_rd.html index 68b1b3f70..0d208fc88 100644 --- a/proc/le_rd.html +++ b/proc/le_rd.html @@ -225,7 +225,7 @@

        Return Value

        Documentation generated by FORD - on 2024-08-27 18:43

        + on 2024-08-27 18:52


        diff --git a/proc/ln_activity_coefficient.html b/proc/ln_activity_coefficient.html index 020ee7cd2..1906758ed 100644 --- a/proc/ln_activity_coefficient.html +++ b/proc/ln_activity_coefficient.html @@ -119,7 +119,7 @@

        Variables

        dgedn - ge + ge
        @@ -170,7 +170,7 @@

        Arguments

        - + class(GeModel), intent(in) @@ -185,7 +185,7 @@

        Arguments

        - + real(kind=pr), intent(in) @@ -200,7 +200,7 @@

        Arguments

        - + real(kind=pr), intent(in) @@ -265,7 +265,7 @@

        Variables

        - + real(kind=pr), public @@ -313,7 +313,7 @@

        Variables

        Documentation generated by FORD - on 2024-08-27 18:43

        + on 2024-08-27 18:52


        diff --git a/proc/log10hyperdual.html b/proc/log10hyperdual.html index 81a251f17..b0f5428e3 100644 --- a/proc/log10hyperdual.html +++ b/proc/log10hyperdual.html @@ -210,7 +210,7 @@

        Return Value

        Documentation generated by FORD - on 2024-08-27 18:43

        + on 2024-08-27 18:52


        diff --git a/proc/loghyperdual.html b/proc/loghyperdual.html index c2aa36db9..16de1cf87 100644 --- a/proc/loghyperdual.html +++ b/proc/loghyperdual.html @@ -273,7 +273,7 @@

        Variables

        Documentation generated by FORD - on 2024-08-27 18:43

        + on 2024-08-27 18:52


        diff --git a/proc/lt_dd.html b/proc/lt_dd.html index b569328f8..982258674 100644 --- a/proc/lt_dd.html +++ b/proc/lt_dd.html @@ -225,7 +225,7 @@

        Return Value

        Documentation generated by FORD - on 2024-08-27 18:43

        + on 2024-08-27 18:52


        diff --git a/proc/lt_di.html b/proc/lt_di.html index 6a561cb18..69251eca3 100644 --- a/proc/lt_di.html +++ b/proc/lt_di.html @@ -225,7 +225,7 @@

        Return Value

        Documentation generated by FORD - on 2024-08-27 18:43

        + on 2024-08-27 18:52


        diff --git a/proc/lt_dr.html b/proc/lt_dr.html index 938b12314..faa7ba805 100644 --- a/proc/lt_dr.html +++ b/proc/lt_dr.html @@ -225,7 +225,7 @@

        Return Value

        Documentation generated by FORD - on 2024-08-27 18:43

        + on 2024-08-27 18:52


        diff --git a/proc/lt_id.html b/proc/lt_id.html index 7a23a0f2e..02a0d09b5 100644 --- a/proc/lt_id.html +++ b/proc/lt_id.html @@ -225,7 +225,7 @@

        Return Value

        Documentation generated by FORD - on 2024-08-27 18:43

        + on 2024-08-27 18:52


        diff --git a/proc/lt_rd.html b/proc/lt_rd.html index baa3c1718..3d1d143ea 100644 --- a/proc/lt_rd.html +++ b/proc/lt_rd.html @@ -225,7 +225,7 @@

        Return Value

        Documentation generated by FORD - on 2024-08-27 18:43

        + on 2024-08-27 18:52


        diff --git a/proc/max_dd.html b/proc/max_dd.html index 4a1d42c93..910cbea76 100644 --- a/proc/max_dd.html +++ b/proc/max_dd.html @@ -225,7 +225,7 @@

        Return Value

        Documentation generated by FORD - on 2024-08-27 18:43

        + on 2024-08-27 18:52


        diff --git a/proc/max_ddd.html b/proc/max_ddd.html index 8d5a361ee..d4db0e731 100644 --- a/proc/max_ddd.html +++ b/proc/max_ddd.html @@ -240,7 +240,7 @@

        Return Value

        Documentation generated by FORD - on 2024-08-27 18:43

        + on 2024-08-27 18:52


        diff --git a/proc/max_dr.html b/proc/max_dr.html index c298dfba8..1a96dd1e7 100644 --- a/proc/max_dr.html +++ b/proc/max_dr.html @@ -225,7 +225,7 @@

        Return Value

        Documentation generated by FORD - on 2024-08-27 18:43

        + on 2024-08-27 18:52


        diff --git a/proc/max_rd.html b/proc/max_rd.html index 95d80c25c..c22d88ef8 100644 --- a/proc/max_rd.html +++ b/proc/max_rd.html @@ -225,7 +225,7 @@

        Return Value

        Documentation generated by FORD - on 2024-08-27 18:43

        + on 2024-08-27 18:52


        diff --git a/proc/min_dd.html b/proc/min_dd.html index 33cdbcdd0..0fe343131 100644 --- a/proc/min_dd.html +++ b/proc/min_dd.html @@ -225,7 +225,7 @@

        Return Value

        Documentation generated by FORD - on 2024-08-27 18:43

        + on 2024-08-27 18:52


        diff --git a/proc/min_dr.html b/proc/min_dr.html index 95a4395ae..64ccbe343 100644 --- a/proc/min_dr.html +++ b/proc/min_dr.html @@ -225,7 +225,7 @@

        Return Value

        Documentation generated by FORD - on 2024-08-27 18:43

        + on 2024-08-27 18:52


        diff --git a/proc/min_rd.html b/proc/min_rd.html index d4bf546fa..f9d134d48 100644 --- a/proc/min_rd.html +++ b/proc/min_rd.html @@ -225,7 +225,7 @@

        Return Value

        Documentation generated by FORD - on 2024-08-27 18:43

        + on 2024-08-27 18:52


        diff --git a/proc/min_tpd.html b/proc/min_tpd.html index 94b501246..7fb2b2415 100644 --- a/proc/min_tpd.html +++ b/proc/min_tpd.html @@ -122,7 +122,7 @@

        Variables

        data di dx - i + i lnphi_z mins opt @@ -188,7 +188,7 @@

        Arguments

        - + class(ArModel), @@ -203,7 +203,7 @@

        Arguments

        - + real(kind=pr), intent(in) @@ -218,7 +218,7 @@

        Arguments

        - + real(kind=pr), intent(in) @@ -233,7 +233,7 @@

        Arguments

        - + real(kind=pr), intent(in) @@ -380,7 +380,7 @@

        Variables

        - + integer, public @@ -513,7 +513,7 @@

        Variables

        Documentation generated by FORD - on 2024-08-27 18:43

        + on 2024-08-27 18:52


        diff --git a/proc/min_tpd_to_optimize.html b/proc/min_tpd_to_optimize.html index 9fc0ef3a0..f47373f64 100644 --- a/proc/min_tpd_to_optimize.html +++ b/proc/min_tpd_to_optimize.html @@ -156,7 +156,7 @@

        Arguments

        - + real(kind=pr), intent(in) @@ -171,7 +171,7 @@

        Arguments

        - + real(kind=pr), intent(out) @@ -186,7 +186,7 @@

        Arguments

        - + real(kind=pr), intent(out), @@ -248,7 +248,7 @@

        Arguments

        Documentation generated by FORD - on 2024-08-27 18:43

        + on 2024-08-27 18:52


        diff --git a/proc/minushyperdualhyperdual.html b/proc/minushyperdualhyperdual.html index faff6c0e1..a309ac95e 100644 --- a/proc/minushyperdualhyperdual.html +++ b/proc/minushyperdualhyperdual.html @@ -210,7 +210,7 @@

        Return Value

        Documentation generated by FORD - on 2024-08-27 18:43

        + on 2024-08-27 18:52


        diff --git a/proc/model_from_x.html b/proc/model_from_x.html index aee18d3fb..1a11bed2f 100644 --- a/proc/model_from_x.html +++ b/proc/model_from_x.html @@ -78,20 +78,20 @@

        model_from_X
      • 31 statements + title=" 0.5% of total for procedures.">25 statements
      • - Source File + Source File
      @@ -118,10 +118,8 @@

      Variables

      - a - b - c - ge + kij + lij
      @@ -160,7 +158,6 @@

      Uses

    @@ -170,7 +167,7 @@

    Uses

    Type Bound

    -

    FitMHVNRTL

    +

    FitKijLij

    Arguments

    @@ -185,8 +182,8 @@

    Arguments

    @@ -233,7 +230,7 @@

    Variables

    @@ -241,7 +238,7 @@

    Variables

    - + @@ -258,41 +255,7 @@

    Variables

    - - - - - - - - - - - - - - - - - - - - - + @@ -331,7 +331,7 @@

    Variables

    @@ -379,7 +379,7 @@

    Variables

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/ztvtermo.html b/proc/ztvtermo.html index e3bc55c58..0c058c3b7 100644 --- a/proc/ztvtermo.html +++ b/proc/ztvtermo.html @@ -118,24 +118,24 @@

    Variables

    - ArTn - ArVn - Arn - Arn2 + ArTn + ArVn + Arn + Arn2 DPDN RT Z - ar + ar artv arv arv2 dpdt - i + i igz - k + k nder ntemp - totn + totn
    @@ -194,7 +194,7 @@

    Arguments

    @@ -224,7 +224,7 @@

    Arguments

    @@ -254,7 +254,7 @@

    Arguments

    @@ -269,7 +269,7 @@

    Arguments

    @@ -377,7 +377,7 @@

    Variables

    @@ -394,7 +394,7 @@

    Variables

    @@ -411,7 +411,7 @@

    Variables

    @@ -428,7 +428,7 @@

    Variables

    @@ -496,7 +496,7 @@

    Variables

    @@ -581,7 +581,7 @@

    Variables

    @@ -615,7 +615,7 @@

    Variables

    @@ -666,7 +666,7 @@

    Variables

    @@ -714,7 +714,7 @@

    Variables

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/search.html b/search.html index a4252a230..23dbfe452 100644 --- a/search.html +++ b/search.html @@ -102,7 +102,7 @@

    Search Results

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/sourcefile/admm_tapenade_interface.f90.html b/sourcefile/admm_tapenade_interface.f90.html index 3540e60d5..e71a1a5be 100644 --- a/sourcefile/admm_tapenade_interface.f90.html +++ b/sourcefile/admm_tapenade_interface.f90.html @@ -247,7 +247,7 @@

    Source Code

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/sourcefile/alphas.f90.html b/sourcefile/alphas.f90.html index a397840ad..b351f5e35 100644 --- a/sourcefile/alphas.f90.html +++ b/sourcefile/alphas.f90.html @@ -232,7 +232,7 @@

    Source Code

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/sourcefile/ar_interface.f90.html b/sourcefile/ar_interface.f90.html index c693ad710..8497eaff2 100644 --- a/sourcefile/ar_interface.f90.html +++ b/sourcefile/ar_interface.f90.html @@ -207,7 +207,7 @@

    Source Code

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/sourcefile/ar_models.f90.html b/sourcefile/ar_models.f90.html index 17f75948d..539df525e 100644 --- a/sourcefile/ar_models.f90.html +++ b/sourcefile/ar_models.f90.html @@ -677,7 +677,7 @@

    Source Code

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/sourcefile/armodel_adiff_api.f90.html b/sourcefile/armodel_adiff_api.f90.html index f1b0300c9..b32d7e436 100644 --- a/sourcefile/armodel_adiff_api.f90.html +++ b/sourcefile/armodel_adiff_api.f90.html @@ -401,7 +401,7 @@

    Source Code

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/sourcefile/autodiff.f90.html b/sourcefile/autodiff.f90.html index 57ccf6c4c..b30b6a92b 100644 --- a/sourcefile/autodiff.f90.html +++ b/sourcefile/autodiff.f90.html @@ -182,7 +182,7 @@

    Source Code

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/sourcefile/auxiliar.f90.html b/sourcefile/auxiliar.f90.html index 7dbef6f35..b8d8f4b5b 100644 --- a/sourcefile/auxiliar.f90.html +++ b/sourcefile/auxiliar.f90.html @@ -78,7 +78,7 @@

    auxiliar.f90
  • 26 statements + title=" 0.3% of total for source files.">19 statements
  • @@ -119,7 +119,7 @@

    Modules

    @@ -155,43 +155,36 @@

    Modules

    Source Code

    -
    module yaeos__auxiliar
    -   use yaeos__constants, only: pr
    -   implicit none
    -
    -   interface optval
    -      module procedure optval_integer, optval_real
    -   end interface optval
    -
    -contains
    -
    -   integer function optval_integer(val, default)
    -      !! Set a value to a default if it is not defined
    -      use stdlib_optval, only: std => optval
    -      integer, optional, intent(in out) :: val
    -      integer, intent(in) :: default
    -      optval_integer = std(val, default)
    -   end function optval_integer
    -
    -   real(pr) function optval_real(val, default)
    -      !! Set a value to a default if it is not defined
    -      use stdlib_optval, only: std => optval
    -      real(pr), optional, intent(in out) :: val
    -      real(pr), intent(in) :: default
    +        
    module yaeos__equilibria_auxiliar
    +   !! Auxiliar functions used for phase-equilibria calculation.
    +   use yaeos__constants, only: pr
    +   use yaeos__models_base, only: BaseModel
    +   implicit none
    +
    +contains
    +   function k_wilson(model, T, P) result(K)
    +      !! K-factors regressión done by Wilson, used for initialization.
    +      class(BaseModel), intent(in) :: model
    +      real(pr), intent(in) :: T
    +      real(pr), intent(in) :: P
    +      real(pr)  :: K(size(model%components%pc))
    +
    +      K = (model%components%Pc/P) &
    +         * exp(5.373_pr*(1 + model%components%w)&
    +         * (1 - model%components%Tc/T))
    +   end function k_wilson
    +
    +   real(pr) function P_wilson(model, z, T) result(P)
    +      class(BaseModel), intent(in) :: model
    +      real(pr), intent(in) :: z(:)
    +      real(pr), intent(in) :: T
     
    -      optval_real = std(val, default)
    -   end function optval_real
    -
    -   subroutine sort(array, idx)
    -      use stdlib_sorting, only: std => sort
    -      !! Sort an array and return the indexes
    -      real(pr), intent(in out) :: array(:)
    -      integer, optional, intent(out) :: idx(:)
    -
    -      call std(array)
    -
    -   end subroutine sort
    -end module yaeos__auxiliar
    +      P = 1.0_pr/sum(&
    +         z*model%components%Pc &
    +         * exp(5.373_pr &
    +         * (1 + model%components%w)*(1 - model%components%Tc/T)))
    +   end function P_wilson
    +end module yaeos__equilibria_auxiliar
     
    @@ -213,7 +206,7 @@

    Source Code

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/sourcefile/auxiliar.f90~2.html b/sourcefile/auxiliar.f90~2.html index 6fb188581..ace52b9ff 100644 --- a/sourcefile/auxiliar.f90~2.html +++ b/sourcefile/auxiliar.f90~2.html @@ -78,7 +78,7 @@

    auxiliar.f90
  • 19 statements + title=" 0.4% of total for source files.">26 statements
  • @@ -119,7 +119,7 @@

    Modules

    @@ -155,36 +155,43 @@

    Modules

    Source Code

    -
    module yaeos__equilibria_auxiliar
    -   !! Auxiliar functions used for phase-equilibria calculation.
    -   use yaeos__constants, only: pr
    -   use yaeos__models_base, only: BaseModel
    -   implicit none
    -
    -contains
    -   function k_wilson(model, T, P) result(K)
    -      !! K-factors regressión done by Wilson, used for initialization.
    -      class(BaseModel), intent(in) :: model
    -      real(pr), intent(in) :: T
    -      real(pr), intent(in) :: P
    -      real(pr)  :: K(size(model%components%pc))
    -
    -      K = (model%components%Pc/P) &
    -         * exp(5.373_pr*(1 + model%components%w)&
    -         * (1 - model%components%Tc/T))
    -   end function k_wilson
    -
    -   real(pr) function P_wilson(model, z, T) result(P)
    -      class(BaseModel), intent(in) :: model
    -      real(pr), intent(in) :: z(:)
    -      real(pr), intent(in) :: T
    +        
    module yaeos__auxiliar
    +   use yaeos__constants, only: pr
    +   implicit none
    +
    +   interface optval
    +      module procedure optval_integer, optval_real
    +   end interface optval
    +
    +contains
    +
    +   integer function optval_integer(val, default)
    +      !! Set a value to a default if it is not defined
    +      use stdlib_optval, only: std => optval
    +      integer, optional, intent(in out) :: val
    +      integer, intent(in) :: default
    +      optval_integer = std(val, default)
    +   end function optval_integer
    +
    +   real(pr) function optval_real(val, default)
    +      !! Set a value to a default if it is not defined
    +      use stdlib_optval, only: std => optval
    +      real(pr), optional, intent(in out) :: val
    +      real(pr), intent(in) :: default
     
    -      P = 1.0_pr/sum(&
    -         z*model%components%Pc &
    -         * exp(5.373_pr &
    -         * (1 + model%components%w)*(1 - model%components%Tc/T)))
    -   end function P_wilson
    -end module yaeos__equilibria_auxiliar
    +      optval_real = std(val, default)
    +   end function optval_real
    +
    +   subroutine sort(array, idx)
    +      use stdlib_sorting, only: std => sort
    +      !! Sort an array and return the indexes
    +      real(pr), intent(in out) :: array(:)
    +      integer, optional, intent(out) :: idx(:)
    +
    +      call std(array)
    +
    +   end subroutine sort
    +end module yaeos__auxiliar
     
    @@ -206,7 +213,7 @@

    Source Code

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/sourcefile/auxiliar_functions.f90.html b/sourcefile/auxiliar_functions.f90.html index 08609532e..e0d160d24 100644 --- a/sourcefile/auxiliar_functions.f90.html +++ b/sourcefile/auxiliar_functions.f90.html @@ -195,7 +195,7 @@

    Source Code

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/sourcefile/base.f90.html b/sourcefile/base.f90.html index 2127cf411..be01a593d 100644 --- a/sourcefile/base.f90.html +++ b/sourcefile/base.f90.html @@ -78,7 +78,7 @@

    base.f90
  • 61 statements + title=" 0.1% of total for source files.">7 statements
  • @@ -119,7 +119,7 @@

    Modules

    @@ -155,111 +155,19 @@

    Modules

    Source Code

    -
    module yaeos__models_ar_cubic_mixing_base
    -    !! # Mixing rules core math
    -    !! Procedures of the core calculations of CubicEoS mixing rules.
    -    !!
    -    !! # Description
    -    !! This module holds all the basic math to use mixing rules in other codes.
    -    !! Keeping it simple and accesible.
    -    !!
    -    !! # Examples
    -    !!
    -    !! ```fortran
    -    !! bi = [0.2, 0.3]
    -    !! lij = reshape([0.0, 0.2, 0.2, 0], [2,2])
    -    !!
    -    !! ! Calculate B parameter with Quadratric Mixing Rules.
    -    !! call bmix_qmr(n, bi, lij, b, dbi, dbij)
    -    !! 
    -    !! ```
    -    !!
    -    !! # References
    -    use yaeos__constants, only: pr
    -    implicit none
    -contains
    -
    -    pure subroutine bmix_linear(n, bi, b, dbi, dbij)
    -        real(pr), intent(in) :: n(:)
    -        real(pr), intent(in) :: bi(:)
    -        real(pr), intent(out) :: b, dbi(:), dbij(:, :)
    -
    -        b = sum(n*bi)
    -        dbi = bi
    -        dbij = 0
    -    end subroutine
    -
    -    pure subroutine bmix_qmr(n, bi, lij, b, dbi, dbij)
    -        real(pr), intent(in) :: n(:)
    -        real(pr), intent(in) :: bi(:)
    -        real(pr), intent(in) :: lij(:, :)
    -        real(pr), intent(out) :: b, dbi(:), dbij(:, :)
    -        
    -        real(pr) :: bij(size(n), size(n))
    -
    -        real(pr) :: totn, aux(size(n))
    -
    -        integer :: i, j, nc
    -
    -        nc = size(n)
    -        TOTN = sum(n)
    -        B = 0
    -        dBi = 0
    -        dBij = 0
    -        aux = 0
    -
    -        do i = 1, nc
    -            do j = 1, nc
    -                bij(i, j) = 0.5_pr * (bi(i) + bi(j)) * (1.0_pr - lij(i,j))
    -                aux(i) = aux(i) + n(j) * bij(i, j)
    -            end do
    -            B = B + n(i)*aux(i)
    -        end do
    -
    -        B = B/totn
    -
    -        do i = 1, nc
    -            dBi(i) = (2*aux(i) - B)/totn
    -            do j = 1, i
    -                dBij(i, j) = (2*bij(i, j) - dBi(i) - dBi(j))/totn
    -                dBij(j, i) = dBij(i, j)
    -            end do
    -        end do
    -    end subroutine
    -
    -    pure subroutine d1mix_rkpr(n, d1i, d1, dd1i, dd1ij)
    -        !! RKPR \(\delta_1\) parameter mixing rule.
    -        !!
    -        !! The RKPR EoS doesn't have a constant \(\delta_1\) value for each 
    -        !! component, so a proper mixing rule should be provided. A linear
    -        !! combination is used.
    -        !!
    -        !! \[
    -        !!     \Delta_1 = \sum_i^N n_i \delta_{1i}
    -        !! \]
    -        !!
    -        real(pr), intent(in) :: n(:)
    -        real(pr), intent(in) :: d1i(:)
    -        real(pr), intent(out) :: D1
    -        real(pr), intent(out) :: dD1i(:)
    -        real(pr), intent(out) :: dD1ij(:, :)
    -
    -        integer :: i, j, nc
    -        real(pr) :: totn
    -
    -        nc = size(n)
    -        totn = sum(n)
    -
    -        D1 = sum(n * d1i)/totn
    -
    -        do i = 1, nc
    -            dD1i(i) = (d1i(i) - D1)/totn
    -            do j = 1, nc
    -                dD1ij(i, j) = (2 * D1 - d1i(i) - d1i(j))/totn**2
    -            end do
    -        end do
    -    end subroutine
    -end module
    +        
    module yaeos__models_base
    +    !! Basic element of a thermodynamic model.
    +    use yaeos__substance, only: Substances
    +    implicit none
    +
    +    type, abstract :: BaseModel
    +        !! Base model type.
    +        !!
    +        !! Contains the important parts of most models and other procedures.
    +        type(Substances) :: components 
    +            !! Substances contained in the module
    +    end type
    +end module
     
    @@ -281,7 +189,7 @@

    Source Code

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/sourcefile/base.f90~2.html b/sourcefile/base.f90~2.html index dd99b23c2..7b10f7d57 100644 --- a/sourcefile/base.f90~2.html +++ b/sourcefile/base.f90~2.html @@ -78,7 +78,7 @@

    base.f90
  • 7 statements + title=" 1.0% of total for source files.">61 statements
  • @@ -119,7 +119,7 @@

    Modules

    @@ -155,19 +155,111 @@

    Modules

    Source Code

    -
    module yaeos__models_base
    -    !! Basic element of a thermodynamic model.
    -    use yaeos__substance, only: Substances
    -    implicit none
    -
    -    type, abstract :: BaseModel
    -        !! Base model type.
    -        !!
    -        !! Contains the important parts of most models and other procedures.
    -        type(Substances) :: components 
    -            !! Substances contained in the module
    -    end type
    -end module
    +        
    module yaeos__models_ar_cubic_mixing_base
    +    !! # Mixing rules core math
    +    !! Procedures of the core calculations of CubicEoS mixing rules.
    +    !!
    +    !! # Description
    +    !! This module holds all the basic math to use mixing rules in other codes.
    +    !! Keeping it simple and accesible.
    +    !!
    +    !! # Examples
    +    !!
    +    !! ```fortran
    +    !! bi = [0.2, 0.3]
    +    !! lij = reshape([0.0, 0.2, 0.2, 0], [2,2])
    +    !!
    +    !! ! Calculate B parameter with Quadratric Mixing Rules.
    +    !! call bmix_qmr(n, bi, lij, b, dbi, dbij)
    +    !! 
    +    !! ```
    +    !!
    +    !! # References
    +    use yaeos__constants, only: pr
    +    implicit none
    +contains
    +
    +    pure subroutine bmix_linear(n, bi, b, dbi, dbij)
    +        real(pr), intent(in) :: n(:)
    +        real(pr), intent(in) :: bi(:)
    +        real(pr), intent(out) :: b, dbi(:), dbij(:, :)
    +
    +        b = sum(n*bi)
    +        dbi = bi
    +        dbij = 0
    +    end subroutine
    +
    +    pure subroutine bmix_qmr(n, bi, lij, b, dbi, dbij)
    +        real(pr), intent(in) :: n(:)
    +        real(pr), intent(in) :: bi(:)
    +        real(pr), intent(in) :: lij(:, :)
    +        real(pr), intent(out) :: b, dbi(:), dbij(:, :)
    +        
    +        real(pr) :: bij(size(n), size(n))
    +
    +        real(pr) :: totn, aux(size(n))
    +
    +        integer :: i, j, nc
    +
    +        nc = size(n)
    +        TOTN = sum(n)
    +        B = 0
    +        dBi = 0
    +        dBij = 0
    +        aux = 0
    +
    +        do i = 1, nc
    +            do j = 1, nc
    +                bij(i, j) = 0.5_pr * (bi(i) + bi(j)) * (1.0_pr - lij(i,j))
    +                aux(i) = aux(i) + n(j) * bij(i, j)
    +            end do
    +            B = B + n(i)*aux(i)
    +        end do
    +
    +        B = B/totn
    +
    +        do i = 1, nc
    +            dBi(i) = (2*aux(i) - B)/totn
    +            do j = 1, i
    +                dBij(i, j) = (2*bij(i, j) - dBi(i) - dBi(j))/totn
    +                dBij(j, i) = dBij(i, j)
    +            end do
    +        end do
    +    end subroutine
    +
    +    pure subroutine d1mix_rkpr(n, d1i, d1, dd1i, dd1ij)
    +        !! RKPR \(\delta_1\) parameter mixing rule.
    +        !!
    +        !! The RKPR EoS doesn't have a constant \(\delta_1\) value for each 
    +        !! component, so a proper mixing rule should be provided. A linear
    +        !! combination is used.
    +        !!
    +        !! \[
    +        !!     \Delta_1 = \sum_i^N n_i \delta_{1i}
    +        !! \]
    +        !!
    +        real(pr), intent(in) :: n(:)
    +        real(pr), intent(in) :: d1i(:)
    +        real(pr), intent(out) :: D1
    +        real(pr), intent(out) :: dD1i(:)
    +        real(pr), intent(out) :: dD1ij(:, :)
    +
    +        integer :: i, j, nc
    +        real(pr) :: totn
    +
    +        nc = size(n)
    +        totn = sum(n)
    +
    +        D1 = sum(n * d1i)/totn
    +
    +        do i = 1, nc
    +            dD1i(i) = (d1i(i) - D1)/totn
    +            do j = 1, nc
    +                dD1ij(i, j) = (2 * D1 - d1i(i) - d1i(j))/totn**2
    +            end do
    +        end do
    +    end subroutine
    +end module
     
    @@ -189,7 +281,7 @@

    Source Code

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/sourcefile/consistency.f90.html b/sourcefile/consistency.f90.html index 45ebe49e9..40712e993 100644 --- a/sourcefile/consistency.f90.html +++ b/sourcefile/consistency.f90.html @@ -202,7 +202,7 @@

    Source Code

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/sourcefile/consistency_armodel.f90.html b/sourcefile/consistency_armodel.f90.html index 1c00c7814..04f3bf511 100644 --- a/sourcefile/consistency_armodel.f90.html +++ b/sourcefile/consistency_armodel.f90.html @@ -571,7 +571,7 @@

    Source Code

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/sourcefile/consistency_gemodel.f90.html b/sourcefile/consistency_gemodel.f90.html index dcc6c3ba3..cd21857dc 100644 --- a/sourcefile/consistency_gemodel.f90.html +++ b/sourcefile/consistency_gemodel.f90.html @@ -535,7 +535,7 @@

    Source Code

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/sourcefile/constants.f90.html b/sourcefile/constants.f90.html index 88ba179f8..cadde3fc3 100644 --- a/sourcefile/constants.f90.html +++ b/sourcefile/constants.f90.html @@ -189,7 +189,7 @@

    Source Code

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/sourcefile/continuation.f90.html b/sourcefile/continuation.f90.html index 32443fea8..38711ea99 100644 --- a/sourcefile/continuation.f90.html +++ b/sourcefile/continuation.f90.html @@ -436,7 +436,7 @@

    Source Code

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/sourcefile/equilibria.f90.html b/sourcefile/equilibria.f90.html index a980f1340..697dc9b4d 100644 --- a/sourcefile/equilibria.f90.html +++ b/sourcefile/equilibria.f90.html @@ -202,7 +202,7 @@

    Source Code

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/sourcefile/equilibria_state.f90.html b/sourcefile/equilibria_state.f90.html index d06a17218..38d0397f9 100644 --- a/sourcefile/equilibria_state.f90.html +++ b/sourcefile/equilibria_state.f90.html @@ -225,7 +225,7 @@

    Source Code

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/sourcefile/fit_kij_lij.f90.html b/sourcefile/fit_kij_lij.f90.html index 626d03e4e..97bb32128 100644 --- a/sourcefile/fit_kij_lij.f90.html +++ b/sourcefile/fit_kij_lij.f90.html @@ -255,7 +255,7 @@

    Source Code

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/sourcefile/fit_nrtl_mhv.f90.html b/sourcefile/fit_nrtl_mhv.f90.html index 1be281c99..336122a71 100644 --- a/sourcefile/fit_nrtl_mhv.f90.html +++ b/sourcefile/fit_nrtl_mhv.f90.html @@ -231,7 +231,7 @@

    Source Code

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/sourcefile/fitting.f90.html b/sourcefile/fitting.f90.html index 606bc01c2..e82666599 100644 --- a/sourcefile/fitting.f90.html +++ b/sourcefile/fitting.f90.html @@ -295,7 +295,7 @@

    Source Code

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/sourcefile/flash.f90.html b/sourcefile/flash.f90.html index a6e4be9fc..7969c5aa5 100644 --- a/sourcefile/flash.f90.html +++ b/sourcefile/flash.f90.html @@ -354,7 +354,7 @@

    Source Code

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/sourcefile/ge_models.f90.html b/sourcefile/ge_models.f90.html index f4e5af502..5a6ccd30f 100644 --- a/sourcefile/ge_models.f90.html +++ b/sourcefile/ge_models.f90.html @@ -219,7 +219,7 @@

    Source Code

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/sourcefile/generic_cubic.f90.html b/sourcefile/generic_cubic.f90.html index 8d095b794..ae415b23c 100644 --- a/sourcefile/generic_cubic.f90.html +++ b/sourcefile/generic_cubic.f90.html @@ -588,7 +588,7 @@

    Source Code

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/sourcefile/huron_vidal.f90.html b/sourcefile/huron_vidal.f90.html index b179e221c..8bfb4f7ba 100644 --- a/sourcefile/huron_vidal.f90.html +++ b/sourcefile/huron_vidal.f90.html @@ -463,7 +463,7 @@

    Source Code

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/sourcefile/hyperdual.f90.html b/sourcefile/hyperdual.f90.html index 3ecd9f42b..3c4262386 100644 --- a/sourcefile/hyperdual.f90.html +++ b/sourcefile/hyperdual.f90.html @@ -1448,7 +1448,7 @@

    Source Code

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/sourcefile/implementations.f90.html b/sourcefile/implementations.f90.html index 80d2c307c..960f30039 100644 --- a/sourcefile/implementations.f90.html +++ b/sourcefile/implementations.f90.html @@ -182,7 +182,7 @@

    Source Code

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/sourcefile/implementations.f90~2.html b/sourcefile/implementations.f90~2.html index bcec3f2f7..b5f39a179 100644 --- a/sourcefile/implementations.f90~2.html +++ b/sourcefile/implementations.f90~2.html @@ -515,7 +515,7 @@

    Source Code

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/sourcefile/interfaces.f90.html b/sourcefile/interfaces.f90.html index d75e16149..d1520d63d 100644 --- a/sourcefile/interfaces.f90.html +++ b/sourcefile/interfaces.f90.html @@ -212,7 +212,7 @@

    Source Code

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/sourcefile/legacy.f90.html b/sourcefile/legacy.f90.html index de2205d50..3aa15d7ba 100644 --- a/sourcefile/legacy.f90.html +++ b/sourcefile/legacy.f90.html @@ -1159,7 +1159,7 @@

    Source Code

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/sourcefile/linalg.f90.html b/sourcefile/linalg.f90.html index 595c829a9..74e82afa7 100644 --- a/sourcefile/linalg.f90.html +++ b/sourcefile/linalg.f90.html @@ -327,7 +327,7 @@

    Source Code

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/sourcefile/math.f90.html b/sourcefile/math.f90.html index 7c1563b30..7d5320700 100644 --- a/sourcefile/math.f90.html +++ b/sourcefile/math.f90.html @@ -291,7 +291,7 @@

    Source Code

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/sourcefile/model_parameters.f90.html b/sourcefile/model_parameters.f90.html index 8f558da84..6dbbe51e4 100644 --- a/sourcefile/model_parameters.f90.html +++ b/sourcefile/model_parameters.f90.html @@ -716,7 +716,7 @@

    Source Code

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/sourcefile/models.f90.html b/sourcefile/models.f90.html index 56c875028..dca44a634 100644 --- a/sourcefile/models.f90.html +++ b/sourcefile/models.f90.html @@ -226,7 +226,7 @@

    Source Code

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/sourcefile/nrtl.f90.html b/sourcefile/nrtl.f90.html index df2cd1803..5b6b2e7d1 100644 --- a/sourcefile/nrtl.f90.html +++ b/sourcefile/nrtl.f90.html @@ -811,7 +811,7 @@

    Source Code

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/sourcefile/optimizers.f90.html b/sourcefile/optimizers.f90.html index c1bbfcd64..a220e64f3 100644 --- a/sourcefile/optimizers.f90.html +++ b/sourcefile/optimizers.f90.html @@ -271,7 +271,7 @@

    Source Code

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/sourcefile/phase_envelopes_pt.f90.html b/sourcefile/phase_envelopes_pt.f90.html index 7529e4d38..c390d09ae 100644 --- a/sourcefile/phase_envelopes_pt.f90.html +++ b/sourcefile/phase_envelopes_pt.f90.html @@ -563,7 +563,7 @@

    Source Code

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/sourcefile/phase_envelopes_px.f90.html b/sourcefile/phase_envelopes_px.f90.html index 443df6e70..338e29a64 100644 --- a/sourcefile/phase_envelopes_px.f90.html +++ b/sourcefile/phase_envelopes_px.f90.html @@ -583,7 +583,7 @@

    Source Code

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/sourcefile/pressure_equality.f90.html b/sourcefile/pressure_equality.f90.html index aff4332d6..ba0948fac 100644 --- a/sourcefile/pressure_equality.f90.html +++ b/sourcefile/pressure_equality.f90.html @@ -264,7 +264,7 @@

    Source Code

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/sourcefile/pure_psat.f90.html b/sourcefile/pure_psat.f90.html index 464b7d3d1..8570ed789 100644 --- a/sourcefile/pure_psat.f90.html +++ b/sourcefile/pure_psat.f90.html @@ -220,7 +220,7 @@

    Source Code

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/sourcefile/quadratic_mixing.f90.html b/sourcefile/quadratic_mixing.f90.html index 0a80a77fd..9993988ab 100644 --- a/sourcefile/quadratic_mixing.f90.html +++ b/sourcefile/quadratic_mixing.f90.html @@ -411,7 +411,7 @@

    Source Code

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/sourcefile/rachford_rice.f90.html b/sourcefile/rachford_rice.f90.html index 42140323b..7e598782f 100644 --- a/sourcefile/rachford_rice.f90.html +++ b/sourcefile/rachford_rice.f90.html @@ -277,7 +277,7 @@

    Source Code

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/sourcefile/saturations_points.f90.html b/sourcefile/saturations_points.f90.html index e2a762232..8d06dede7 100644 --- a/sourcefile/saturations_points.f90.html +++ b/sourcefile/saturations_points.f90.html @@ -414,7 +414,7 @@

    Source Code

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/sourcefile/stability.f90.html b/sourcefile/stability.f90.html index 780b3743f..5965b3e25 100644 --- a/sourcefile/stability.f90.html +++ b/sourcefile/stability.f90.html @@ -358,7 +358,7 @@

    Source Code

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/sourcefile/substance.f90.html b/sourcefile/substance.f90.html index 606ba8d08..ca13179a8 100644 --- a/sourcefile/substance.f90.html +++ b/sourcefile/substance.f90.html @@ -190,7 +190,7 @@

    Source Code

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/sourcefile/tapenade_ar_api.f90.html b/sourcefile/tapenade_ar_api.f90.html index 5d47be0a3..4138a0962 100644 --- a/sourcefile/tapenade_ar_api.f90.html +++ b/sourcefile/tapenade_ar_api.f90.html @@ -404,7 +404,7 @@

    Source Code

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/sourcefile/tapenade_ge_api.f90.html b/sourcefile/tapenade_ge_api.f90.html index 51473deb0..30151dfec 100644 --- a/sourcefile/tapenade_ge_api.f90.html +++ b/sourcefile/tapenade_ge_api.f90.html @@ -353,7 +353,7 @@

    Source Code

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/sourcefile/unifac.f90.html b/sourcefile/unifac.f90.html index e518e8c9f..e05ef76be 100644 --- a/sourcefile/unifac.f90.html +++ b/sourcefile/unifac.f90.html @@ -1471,7 +1471,7 @@

    Source Code

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/sourcefile/unifac_parameters.f90.html b/sourcefile/unifac_parameters.f90.html index 92ba0e27a..d154b7c22 100644 --- a/sourcefile/unifac_parameters.f90.html +++ b/sourcefile/unifac_parameters.f90.html @@ -1028,7 +1028,7 @@

    Source Code

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/sourcefile/volume.f90.html b/sourcefile/volume.f90.html index f05a5be6a..183610c06 100644 --- a/sourcefile/volume.f90.html +++ b/sourcefile/volume.f90.html @@ -324,7 +324,7 @@

    Source Code

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/sourcefile/yaeos.f90.html b/sourcefile/yaeos.f90.html index 6200e8213..d8d558078 100644 --- a/sourcefile/yaeos.f90.html +++ b/sourcefile/yaeos.f90.html @@ -195,7 +195,7 @@

    Source Code

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/src/auxiliar.f90 b/src/auxiliar.f90 index 7ea871753..32bac06c6 100644 --- a/src/auxiliar.f90 +++ b/src/auxiliar.f90 @@ -1,30 +1,37 @@ -module yaeos__equilibria_auxiliar - !! Auxiliar functions used for phase-equilibria calculation. +module yaeos__auxiliar use yaeos__constants, only: pr - use yaeos__models_base, only: BaseModel implicit none + interface optval + module procedure optval_integer, optval_real + end interface optval + contains - function k_wilson(model, T, P) result(K) - !! K-factors regressión done by Wilson, used for initialization. - class(BaseModel), intent(in) :: model - real(pr), intent(in) :: T - real(pr), intent(in) :: P - real(pr) :: K(size(model%components%pc)) - - K = (model%components%Pc/P) & - * exp(5.373_pr*(1 + model%components%w)& - * (1 - model%components%Tc/T)) - end function k_wilson - - real(pr) function P_wilson(model, z, T) result(P) - class(BaseModel), intent(in) :: model - real(pr), intent(in) :: z(:) - real(pr), intent(in) :: T - - P = 1.0_pr/sum(& - z*model%components%Pc & - * exp(5.373_pr & - * (1 + model%components%w)*(1 - model%components%Tc/T))) - end function P_wilson -end module yaeos__equilibria_auxiliar + + integer function optval_integer(val, default) + !! Set a value to a default if it is not defined + use stdlib_optval, only: std => optval + integer, optional, intent(in out) :: val + integer, intent(in) :: default + optval_integer = std(val, default) + end function optval_integer + + real(pr) function optval_real(val, default) + !! Set a value to a default if it is not defined + use stdlib_optval, only: std => optval + real(pr), optional, intent(in out) :: val + real(pr), intent(in) :: default + + optval_real = std(val, default) + end function optval_real + + subroutine sort(array, idx) + use stdlib_sorting, only: std => sort + !! Sort an array and return the indexes + real(pr), intent(in out) :: array(:) + integer, optional, intent(out) :: idx(:) + + call std(array) + + end subroutine sort +end module yaeos__auxiliar diff --git a/src/base.f90 b/src/base.f90 index 63fb61340..bdae22d57 100644 --- a/src/base.f90 +++ b/src/base.f90 @@ -1,13 +1,105 @@ -module yaeos__models_base - !! Basic element of a thermodynamic model. - use yaeos__substance, only: Substances +module yaeos__models_ar_cubic_mixing_base + !! # Mixing rules core math + !! Procedures of the core calculations of CubicEoS mixing rules. + !! + !! # Description + !! This module holds all the basic math to use mixing rules in other codes. + !! Keeping it simple and accesible. + !! + !! # Examples + !! + !! ```fortran + !! bi = [0.2, 0.3] + !! lij = reshape([0.0, 0.2, 0.2, 0], [2,2]) + !! + !! ! Calculate B parameter with Quadratric Mixing Rules. + !! call bmix_qmr(n, bi, lij, b, dbi, dbij) + !! + !! ``` + !! + !! # References + use yaeos__constants, only: pr implicit none +contains - type, abstract :: BaseModel - !! Base model type. + pure subroutine bmix_linear(n, bi, b, dbi, dbij) + real(pr), intent(in) :: n(:) + real(pr), intent(in) :: bi(:) + real(pr), intent(out) :: b, dbi(:), dbij(:, :) + + b = sum(n*bi) + dbi = bi + dbij = 0 + end subroutine + + pure subroutine bmix_qmr(n, bi, lij, b, dbi, dbij) + real(pr), intent(in) :: n(:) + real(pr), intent(in) :: bi(:) + real(pr), intent(in) :: lij(:, :) + real(pr), intent(out) :: b, dbi(:), dbij(:, :) + + real(pr) :: bij(size(n), size(n)) + + real(pr) :: totn, aux(size(n)) + + integer :: i, j, nc + + nc = size(n) + TOTN = sum(n) + B = 0 + dBi = 0 + dBij = 0 + aux = 0 + + do i = 1, nc + do j = 1, nc + bij(i, j) = 0.5_pr * (bi(i) + bi(j)) * (1.0_pr - lij(i,j)) + aux(i) = aux(i) + n(j) * bij(i, j) + end do + B = B + n(i)*aux(i) + end do + + B = B/totn + + do i = 1, nc + dBi(i) = (2*aux(i) - B)/totn + do j = 1, i + dBij(i, j) = (2*bij(i, j) - dBi(i) - dBi(j))/totn + dBij(j, i) = dBij(i, j) + end do + end do + end subroutine + + pure subroutine d1mix_rkpr(n, d1i, d1, dd1i, dd1ij) + !! RKPR \(\delta_1\) parameter mixing rule. + !! + !! The RKPR EoS doesn't have a constant \(\delta_1\) value for each + !! component, so a proper mixing rule should be provided. A linear + !! combination is used. !! - !! Contains the important parts of most models and other procedures. - type(Substances) :: components - !! Substances contained in the module - end type + !! \[ + !! \Delta_1 = \sum_i^N n_i \delta_{1i} + !! \] + !! + real(pr), intent(in) :: n(:) + real(pr), intent(in) :: d1i(:) + real(pr), intent(out) :: D1 + real(pr), intent(out) :: dD1i(:) + real(pr), intent(out) :: dD1ij(:, :) + + integer :: i, j, nc + real(pr) :: totn + + nc = size(n) + totn = sum(n) + + D1 = sum(n * d1i)/totn + + do i = 1, nc + dD1i(i) = (d1i(i) - D1)/totn + do j = 1, nc + dD1ij(i, j) = (2 * D1 - d1i(i) - d1i(j))/totn**2 + end do + end do + end subroutine end module \ No newline at end of file diff --git a/tipuesearch/tipuesearch_content.js b/tipuesearch/tipuesearch_content.js index bac5bc2fe..9e76f1cf0 100644 --- a/tipuesearch/tipuesearch_content.js +++ b/tipuesearch/tipuesearch_content.js @@ -1 +1 @@ -var tipuesearch = {"pages":[{"title":" yaeos ","text":"yaeos Available models Available properties A little taste of yaeos How to install/run it Dependencies Debian/Ubuntu-like Installing yaeos Developing with vscode Available examples Including new models with Automatic Differentiation. Hyperdual Numbers autodiff Tapenade-based autodiff Documentation There are multiple open source equations of state libraries, like: Clapeyron julia FeOs rust with Python bindings teqp C++ with Python bindings thermo python thermopack Fortran with Python bindings CoolProp C++ with Python bindings Here we are presenting yet another (still in development) one, that tackles the\nsame problem just, in another way. Mostly exploiting the readability and\nextensibility of Modern Fortran for scientists to have an easy way to implement\nnew thermodynamic models without dealing with lower-level languages but still\ngetting decent performance.\nAnd also this framework provides the possibility of using analytically obtained\nderivatives so both options are easily available. This is an experimental work in progress and we recommend the before\nmentioned libraries if you are intending to use some of this in real work.\nBig part of the code comes from a refactoring process of older codes so\nnot all parts are easily readable, yet. We focus mainly on that the addition of a new thermodynamic model as easily as\npossible. Also providing our models too! Available models CubicEoS SoaveRedlichKwong PengRobinson76 PengRobinson78 ExcessGibbs models NRTL UNIFAC VLE Available properties Bulk Properties Volume(n, P, T) Pressure(n, V, T) Residual Properties H^R(n, V, T) S^R(n, V, T) G^R(n, V, T) Cv^R(n, V, T) Cp^R(n, V, T) Phase-Equilibria FlashPT, FlashVT Saturation points (bubble, dew and liquid-liquid) Phase Envelope PT (isopleths) A little taste of yaeos A lot of users get the bad picture of Fortran being old and archaic since most\nof the codes they’ve seen are written in ancient F77 . use yaeos , only : PengRobinson76 , ArModel integer , parameter :: n = 2 ! Number of components real ( 8 ) :: V , T , P , dPdN ( n ) ! variables to calculate class ( ArModel ), allocatable :: model ! Model real ( pr ) :: z ( n ), tc ( n ), pc ( n ), w ( n ), kij ( n , n ), lij ( n , n ) z = [ 0.3 , 0.7 ] tc = [ 19 0. , 31 0. ] pc = [ 1 4. , 3 0. ] w = [ 0.001 , 0.03 ] kij = reshape ([ 0. , 0.1 , 0.1 , 0. ], [ n , n ]) lij = kij / 2 model = PengRobinson76 ( tc , pc , w , kij , lij ) V = 1 T = 150 call model % pressure ( z , V , T , P ) print * , P ! Obtain derivatives adding them as optional arguments! call model % pressure ( model , z , V , T , P , dPdN = dPdN ) print * , dPdN Examples of code with simple applications showing the capabilities of yaeos can be found at example/tutorials . Each example can be run\nwith: fpm run --example Not providing any example will show all the possible examples that can be run. How to install/run it Dependencies yaeos needs to have both lapack and nlopt libraries on your system. Debian/Ubuntu-like sudo apt install libnlopt-dev libblas-dev liblapack-dev Installing yaeos yaeos is intended to use as a fpm package. fpm is the Fortran Package Manager, which automates the compilation and running\nprocess of Fortran libraries/programs. You can either: Generate a new project that uses yaeos as a dependency with: bash\nfpm new my_project In the fpm.toml file add: toml\n[dependencies]\nyaeos = {git=\"https://github.com/ipqa-research/yaeos\"} Clone this repository and just modify the executables in the app directory bash\ngit clone https://github.com/ipqa-research/yaeos\ncd yaeos\nfpm run Developing with vscode If your intention is either to develop for yaeos or to explore in more detail\nthe library with debugging. We provide some predefined defuaults to work with vscode . You can add them to the cloned repository by running: git clone https://github.com/ipqa-research/vscode-fortran .vscode From the project main directory Available examples In this repository we provide a series of examples of the different things that\ncan be calculated with yaeos . The source codes for the examples can be seen\nat the example/tutorials directory. All the examples can be run with fpm run --example Including new models with Automatic Differentiation. Hyperdual Numbers autodiff We are using the hyperdual module developed by Philipp Rehner and Gernot Bauer The automatic differentiation API isn’t fully optimized yet so performance is\nmuch slower than it should be. A complete implementation of the PR76 Equation of State can me found in example/adiff/adiff_pr76.f90 . Or in the documentation pages. Tapenade-based autodiff It is also possible to differentiate with tapenade . Examples can be seen\nin the documentation pages or in The tools directory Documentation The latest API documentation for the main branch can be found here . This was generated from the source\ncode using FORD . We’re\nworking in extending it more. Developer Info Federico Benelli PhD student with focus on reservoir PVT simulation.","tags":"home","loc":"index.html"},{"title":"CriticalPoint – yaeos ","text":"type, public :: CriticalPoint Critical point Components Type Visibility Attributes Name Initial real(kind=pr), public :: P Pressure [bar] real(kind=pr), public :: T Temperature [K]","tags":"","loc":"type/criticalpoint.html"},{"title":"PTEnvel2 – yaeos ","text":"type, public :: PTEnvel2 Two-phase isopleth.\nPhase boundary line of a fluid at constant composition. Components Type Visibility Attributes Name Initial type( CriticalPoint ), public, allocatable :: cps (:) Critical points found along the line. type( EquilibriumState ), public, allocatable :: points (:) Each point through the line. Type-Bound Procedures procedure, public, pass :: write => write_PTEnvel2 public subroutine write_PTEnvel2 (pt2, unit, iotype, v_list, iostat, iomsg) Arguments Type Intent Optional Attributes Name class( PTEnvel2 ), intent(in) :: pt2 integer, intent(in) :: unit character(len=*), intent(in) :: iotype integer, intent(in) :: v_list (:) integer, intent(out) :: iostat character(len=*), intent(inout) :: iomsg generic, public :: write (FORMATTED) => write public subroutine write_PTEnvel2 (pt2, unit, iotype, v_list, iostat, iomsg) Arguments Type Intent Optional Attributes Name class( PTEnvel2 ), intent(in) :: pt2 integer, intent(in) :: unit character(len=*), intent(in) :: iotype integer, intent(in) :: v_list (:) integer, intent(out) :: iostat character(len=*), intent(inout) :: iomsg","tags":"","loc":"type/ptenvel2.html"},{"title":"Substances – yaeos ","text":"type, public :: Substances Set of pure components Components Type Visibility Attributes Name Initial character(len=50), public, allocatable :: names (:) Composition names. real(kind=pr), public, allocatable :: pc (:) Critical Pressure [bar] real(kind=pr), public, allocatable :: tc (:) Critical Temperature [K] real(kind=pr), public, allocatable :: w (:) Acentric factor","tags":"","loc":"type/substances.html"},{"title":"CriticalPoint – yaeos ","text":"type, public :: CriticalPoint Critical point Components Type Visibility Attributes Name Initial real(kind=pr), public :: P Pressure [bar] real(kind=pr), public :: alpha","tags":"","loc":"type/criticalpoint~2.html"},{"title":"PXEnvel2 – yaeos ","text":"type, public :: PXEnvel2 Two-phase PX envelope.\nPhase boundary line of a fluid at constant temperature\nwith variation in composition. Components Type Visibility Attributes Name Initial real(kind=pr), public, allocatable :: alpha (:) Second fluid molar fraction type( CriticalPoint ), public, allocatable :: cps (:) Critical points found along the line. type( EquilibriumState ), public, allocatable :: points (:) Each point through the line. real(kind=pr), public, allocatable :: z0 (:) Original fluid composition real(kind=pr), public, allocatable :: z_inj (:) Second fluid composition","tags":"","loc":"type/pxenvel2.html"},{"title":"NRTL – yaeos ","text":"type, public, extends( GeModelTapenade ) :: NRTL Non-Random-Two-Liquid model with: Components Type Visibility Attributes Name Initial real(kind=pr), public, allocatable :: a (:,:) A_{ij} matrix real(kind=pr), public, allocatable :: b (:,:) B_{ij} matrix real(kind=pr), public, allocatable :: c (:,:) C_{ij} matrix type( Substances ), public :: components Substances contained in the module Constructor public interface NRTL public function init (a, b, c) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: a (:,:) real(kind=pr), intent(in) :: b (:,:) real(kind=pr), intent(in) :: c (:,:) Return Value type( NRTL ) Type-Bound Procedures procedure, public :: excess_gibbs private subroutine excess_gibbs (self, n, t, Ge, GeT, GeT2, Gen, GeTn, Gen2) Excess Gibbs model generic interface Arguments Type Intent Optional Attributes Name class( GeModelTapenade ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: t real(kind=pr), intent(out), optional :: Ge real(kind=pr), intent(out), optional :: GeT real(kind=pr), intent(out), optional :: GeT2 real(kind=pr), intent(out), optional, dimension(size(n)) :: Gen real(kind=pr), intent(out), optional, dimension(size(n)) :: GeTn real(kind=pr), intent(out), optional :: Gen2 (size(n),size(n)) procedure, public :: ge => EXCESS_GIBBS public subroutine EXCESS_GIBBS (model, n, t, ge) Arguments Type Intent Optional Attributes Name class( NRTL ) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: t real(kind=pr), intent(out) :: ge procedure, public :: ge_b => EXCESS_GIBBS_B public subroutine EXCESS_GIBBS_B (model, n, nb, t, tb, ge, geb) Arguments Type Intent Optional Attributes Name class( NRTL ) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr) :: nb (:) real(kind=pr), intent(in) :: t real(kind=pr) :: tb real(kind=pr) :: ge real(kind=pr) :: geb procedure, public :: ge_d => EXCESS_GIBBS_D public subroutine EXCESS_GIBBS_D (model, n, nd, t, td, ge, ged) Arguments Type Intent Optional Attributes Name class( NRTL ) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: nd (:) real(kind=pr), intent(in) :: t real(kind=pr), intent(in) :: td real(kind=pr), intent(out) :: ge real(kind=pr), intent(out) :: ged procedure, public :: ge_d_b => EXCESS_GIBBS_D_B public subroutine EXCESS_GIBBS_D_B (model, n, nb, nd, ndb, t, tb, td, tdb, ge, geb, ged, gedb) Arguments Type Intent Optional Attributes Name class( NRTL ) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr) :: nb (:) real(kind=pr), intent(in) :: nd (:) real(kind=pr) :: ndb (:) real(kind=pr), intent(in) :: t real(kind=pr) :: tb real(kind=pr), intent(in) :: td real(kind=pr) :: tdb real(kind=pr) :: ge real(kind=pr) :: geb real(kind=pr) :: ged real(kind=pr) :: gedb procedure, public :: ge_d_d => EXCESS_GIBBS_D_D public subroutine EXCESS_GIBBS_D_D (model, n, nd, t, td0, td, ge, ged0, ged, gedd) Arguments Type Intent Optional Attributes Name class( NRTL ) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: nd (:) real(kind=pr), intent(in) :: t real(kind=pr), intent(in) :: td0 real(kind=pr), intent(in) :: td real(kind=pr), intent(out) :: ge real(kind=pr), intent(out) :: ged0 real(kind=pr), intent(out) :: ged real(kind=pr), intent(out) :: gedd procedure, public :: ln_activity_coefficient public subroutine ln_activity_coefficient (self, n, T, lngamma) Arguments Type Intent Optional Attributes Name class( GeModel ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: T real(kind=pr), intent(out) :: lngamma (:)","tags":"","loc":"type/nrtl.html"},{"title":"EquilibriumState – yaeos ","text":"type, public :: EquilibriumState Description of a two-phase equilibria state. Contains the relevant information of an equilibrium point obtained\nfrom some kind of equilibria calculation. Components Type Visibility Attributes Name Initial real(kind=pr), public :: P Pressure [bar] real(kind=pr), public :: T Temperature [K] real(kind=pr), public :: Vx Heavy-phase volume [L/mol] real(kind=pr), public :: Vy Light-phase volume [L/mol] real(kind=pr), public :: beta Mole fraction of light-phase integer, public :: iters = 0 Iterations needed to reach the state character(len=14), public :: kind Kind of point [“bubble”, “dew”, “liquid-liquid”, “split”] real(kind=pr), public, allocatable :: x (:) Heavy-phase molar fractions real(kind=pr), public, allocatable :: y (:) Light-phase molar fractions Type-Bound Procedures generic, public :: write (FORMATTED) => write public subroutine write_EquilibriumState (eq, unit, iotype, v_list, iostat, iomsg) Arguments Type Intent Optional Attributes Name class( EquilibriumState ), intent(in) :: eq integer, intent(in) :: unit character(len=*), intent(in) :: iotype integer, intent(in) :: v_list (:) integer, intent(out) :: iostat character(len=*), intent(inout) :: iomsg procedure, private, pass :: write => write_EquilibriumState public subroutine write_EquilibriumState (eq, unit, iotype, v_list, iostat, iomsg) Arguments Type Intent Optional Attributes Name class( EquilibriumState ), intent(in) :: eq integer, intent(in) :: unit character(len=*), intent(in) :: iotype integer, intent(in) :: v_list (:) integer, intent(out) :: iostat character(len=*), intent(inout) :: iomsg","tags":"","loc":"type/equilibriumstate.html"},{"title":"FittingProblem – yaeos ","text":"type, public, abstract :: FittingProblem Fitting problem setting Description This derived type holds all the relevant information for a parameter\noptimization problem. It keeps the base model structure that will be\noptimized and a procedure get_model_from_X that should reconstruct\nthe model with the desired parameters to optimize. Components Type Visibility Attributes Name Initial type( EquilibriumState ), public, allocatable :: experimental_points (:) Experimental points to fit class( ArModel ), public, allocatable :: model Residual Helmholtz Model to fit logical, public :: verbose = .false. If true log the fitting process Type-Bound Procedures procedure( model_from_X ), public, deferred :: get_model_from_X subroutine model_from_X(problem, X) Prototype Function that returns a setted model from the parameters vector Arguments Type Intent Optional Attributes Name class( FittingProblem ), intent(inout) :: problem Fitting problem to optimize real(kind=pr), intent(in) :: X (:) Vector of parameters to fit","tags":"","loc":"type/fittingproblem.html"},{"title":"AlphaFunction – yaeos ","text":"type, public, abstract :: AlphaFunction Abstract derived type that describe the required\nprocedure for an alpha function. Type-Bound Procedures procedure( abs_alpha ), public, deferred :: alpha subroutine abs_alpha(self, Tr, a, dadt, dadt2) Prototype Arguments Type Intent Optional Attributes Name class( AlphaFunction ), intent(in) :: self real(kind=pr), intent(in) :: Tr (:) real(kind=pr), intent(out) :: a (:) real(kind=pr), intent(out) :: dadt (:) real(kind=pr), intent(out) :: dadt2 (:)","tags":"","loc":"type/alphafunction.html"},{"title":"CubicEoS – yaeos ","text":"type, public, extends( ArModel ) :: CubicEoS Cubic Equation of State. Generic Cubic Equation of State as defined by Michelsen and Mollerup\nwith a parameter that is not constant, \nand a parameter that depends on it. In the case of a \ntwo parameter EoS like PengRobinson the is the same for\nall components so it can be considered as a constant instead of a \nvariable. The expression of the Equation is: Components Type Visibility Attributes Name Initial real(kind=pr), public, allocatable :: ac (:) Attractive critical parameter class( AlphaFunction ), public, allocatable :: alpha AlphaFunction derived type. Uses the abstract derived type AlphaFunction to define the\nAlpha function that the CubicEoS will use. The Alpha function\nreceives the reduced temperature and returns the values of alpha\nand its derivatives, named a , dadt and dadt2 respectively. Examples Callign the AlphaFunction of a setted up model. use yaeos , only : CubicEoS , PengRobinson76 type ( CubicEoS ) :: eos eos = PengRobinson76 ( tc , pc , w ) call eos % alpha % alpha ( Tr , a , dadt , dadt2 ) real(kind=pr), public, allocatable :: b (:) Repulsive parameter type( Substances ), public :: components Substances contained in the module real(kind=pr), public, allocatable :: del1 (:) paramter real(kind=pr), public, allocatable :: del2 (:) paramter class( CubicMixRule ), public, allocatable :: mixrule CubicMixRule derived type. Uses the abstract derived type CubicMixRule to define the\nmixing rule that the CubicEoS will use. It includes internally\nthree methods to calculate the corresponding parameters for the\nCubic EoS: Dmix , Bmix and D1mix . Examples Calculation of the B parameter. use yaeos , only : CubicEoS , PengRobinson76 type ( CubicEoS ) :: eos eos = PengRobinson76 ( tc , pc , w ) call eos % mixrule % Bmix ( n , eos % b , B , dBi , dBij ) Calculation of the D parameter. use yaeos , only : CubicEoS , PengRobinson76 type ( CubicEoS ) :: eos eos = PengRobinson76 ( tc , pc , w ) ! The mixing rule takes the `a` parameters of the components so ! they should be calculated externally call eos % alpha % alpha ( Tr , a , dadt , dadt2 ) a = a * eos % ac dadt = dadt * eos % ac / eos % components % Tc dadt = dadt * eos % ac / eos % components % Tc ** 2 ! Calculate parameter call eos % mixrule % Dmix ( n , T , a , dadt , dadt2 , D , dDdT , dDdT2 , dDi , dDidT , dDij ) Calculation of the D1 parameter. use yaeos , only : CubicEoS , PengRobinson76 type ( CubicEoS ) :: eos eos = PengRobinson76 ( tc , pc , w ) call eos % mixrule % D1mix ( n , eos % del1 , D1 , dD1i , dD1ij ) character(len=:), public, allocatable :: name Name of the model Type-Bound Procedures procedure, public :: Cp_residual_vt public subroutine Cp_residual_vt (eos, n, V, T, Cp) Calculate residual heat capacity pressure constant given v and t. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: V Volume [L] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out) :: Cp heat capacity p constant [bar L / K / mol] procedure, public :: Cv_residual_vt public subroutine Cv_residual_vt (eos, n, V, T, Cv) Calculate residual heat capacity volume constant given v and t. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: V Volume [L] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out) :: Cv heat capacity v constant [bar L / K / mol] procedure, public :: enthalpy_residual_vt public subroutine enthalpy_residual_vt (eos, n, v, t, Hr, HrT, HrV, Hrn) Calculate residual enthalpy given volume and temperature. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: v Volume [L] real(kind=pr), intent(in) :: t Temperature [K] real(kind=pr), intent(out) :: Hr Residual enthalpy [bar L / mol] real(kind=pr), intent(out), optional :: HrT real(kind=pr), intent(out), optional :: HrV real(kind=pr), intent(out), optional :: Hrn (size(n)) procedure, public :: entropy_residual_vt public subroutine entropy_residual_vt (eos, n, V, T, Sr, SrT, SrV, Srn) Calculate residual entropy given volume and temperature. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: V Volume [L] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out) :: Sr Entropy [bar L / K / mol] real(kind=pr), intent(out), optional :: SrT real(kind=pr), intent(out), optional :: SrV real(kind=pr), intent(out), optional :: Srn (size(n)) procedure, public :: get_v0 => v0 public function v0 (self, n, p, t) Cubic EoS volume initializer.\nFor a Cubic Equation of State, the covolume calculated with the mixing\nrule is a good estimate for the initial volume solver on the liquid\nregion. Arguments Type Intent Optional Attributes Name class( CubicEoS ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: p real(kind=pr), intent(in) :: t Return Value real(kind=pr) procedure, public :: gibbs_residual_vt => gibbs_residual_VT public subroutine gibbs_residual_VT (eos, n, V, T, Gr, GrT, GrV, Grn) Calculate residual Gibbs energy given volume and temperature. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: V Volume [L] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out) :: Gr Gibbs energy [bar L / mol] real(kind=pr), intent(out), optional :: GrT real(kind=pr), intent(out), optional :: GrV real(kind=pr), intent(out), optional :: Grn (size(n)) procedure, public :: lnphi_pt => fugacity_pt public subroutine fugacity_pt (eos, n, P, T, V, root_type, lnPhi, dlnPhidP, dlnPhidT, dlnPhidn, dPdV, dPdT, dPdn) Calculate logarithm of fugacity, given pressure and temperature. Read more… Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Mixture mole numbers real(kind=pr), intent(in) :: P Pressure [bar] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out), optional :: V Volume [L] character(len=*), intent(in) :: root_type Type of root desired [“liquid”, “vapor”, “stable”] real(kind=pr), intent(out), optional :: lnPhi (size(n)) vector real(kind=pr), intent(out), optional :: dlnPhidP (size(n)) ln(phi) Presssure derivative real(kind=pr), intent(out), optional :: dlnPhidT (size(n)) ln(phi) Temp derivative real(kind=pr), intent(out), optional :: dlnPhidn (size(n),size(n)) ln(phi) compositional derivative real(kind=pr), intent(out), optional :: dPdV real(kind=pr), intent(out), optional :: dPdT real(kind=pr), intent(out), optional :: dPdn (size(n)) procedure, public :: lnphi_vt => fugacity_vt public subroutine fugacity_vt (eos, n, V, T, P, lnPhi, dlnPhidP, dlnPhidT, dlnPhidn, dPdV, dPdT, dPdn) Calculate fugacity coefficent given volume and temperature. Read more… Arguments Type Intent Optional Attributes Name class( ArModel ) :: eos Model real(kind=pr), intent(in) :: n (:) Mixture mole numbers real(kind=pr), intent(in) :: V Volume [L] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out), optional :: P Pressure [bar] real(kind=pr), intent(out), optional :: lnPhi (size(n)) vector real(kind=pr), intent(out), optional :: dlnPhidP (size(n)) Presssure derivative real(kind=pr), intent(out), optional :: dlnPhidT (size(n)) Temp derivative real(kind=pr), intent(out), optional :: dlnPhidn (size(n),size(n)) compositional derivative real(kind=pr), intent(out), optional :: dPdV real(kind=pr), intent(out), optional :: dPdT real(kind=pr), intent(out), optional :: dPdn (:) procedure, public :: pressure public subroutine pressure (eos, n, v, t, p, dPdV, dPdT, dPdn) Pressure calculation. Read more… Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: v Volume [L] real(kind=pr), intent(in) :: t Temperature [K] real(kind=pr), intent(out) :: p Pressure [bar] real(kind=pr), intent(out), optional :: dPdV real(kind=pr), intent(out), optional :: dPdT real(kind=pr), intent(out), optional :: dPdn (:) procedure, public :: residual_helmholtz => GenericCubic_Ar public subroutine GenericCubic_Ar (self, n, v, t, ar, arv, ArT, artv, arv2, ArT2, Arn, ArVn, ArTn, Arn2) Residual Helmholtz Energy for a generic Cubic Equation of State. Read more… Arguments Type Intent Optional Attributes Name class( CubicEoS ), intent(in) :: self real(kind=pr), intent(in) :: n (:) Number of moles real(kind=pr), intent(in) :: v Volume [L] real(kind=pr), intent(in) :: t Temperature [K] real(kind=pr), intent(out), optional :: ar Residual Helmholtz real(kind=pr), intent(out), optional :: arv real(kind=pr), intent(out), optional :: ArT real(kind=pr), intent(out), optional :: artv real(kind=pr), intent(out), optional :: arv2 real(kind=pr), intent(out), optional :: ArT2 real(kind=pr), intent(out), optional :: Arn (size(n)) real(kind=pr), intent(out), optional :: ArVn (size(n)) real(kind=pr), intent(out), optional :: ArTn (size(n)) real(kind=pr), intent(out), optional :: Arn2 (size(n),size(n)) procedure, public :: volume public subroutine volume (eos, n, P, T, V, root_type) Volume solver optimized for Cubic Equations of State. Read more… Arguments Type Intent Optional Attributes Name class( CubicEoS ), intent(in) :: eos real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: P real(kind=pr), intent(in) :: T real(kind=pr), intent(out) :: V character(len=*), intent(in) :: root_type","tags":"","loc":"type/cubiceos.html"},{"title":"CubicMixRule – yaeos ","text":"type, public, abstract :: CubicMixRule Abstract derived type that describe the required\nprocedure for a mixing rule on a Cubic EoS Type-Bound Procedures procedure( abs_Bmix ), public, deferred :: Bmix subroutine abs_Bmix(self, n, bi, B, dBi, dBij) Prototype Arguments Type Intent Optional Attributes Name class( CubicMixRule ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: bi (:) real(kind=pr), intent(out) :: B real(kind=pr), intent(out) :: dBi (:) real(kind=pr), intent(out) :: dBij (:,:) procedure( abs_D1mix ), public, deferred :: D1mix subroutine abs_D1mix(self, n, d1i, D1, dD1i, dD1ij) Prototype Arguments Type Intent Optional Attributes Name class( CubicMixRule ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: d1i (:) real(kind=pr), intent(out) :: D1 real(kind=pr), intent(out) :: dD1i (:) real(kind=pr), intent(out) :: dD1ij (:,:) procedure( abs_Dmix ), public, deferred :: Dmix subroutine abs_Dmix(self, n, T, ai, daidt, daidt2, D, dDdT, dDdT2, dDi, dDidT, dDij) Prototype Arguments Type Intent Optional Attributes Name class( CubicMixRule ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: T real(kind=pr), intent(in) :: ai (:) real(kind=pr), intent(in) :: daidt (:) real(kind=pr), intent(in) :: daidt2 (:) real(kind=pr), intent(out) :: D real(kind=pr), intent(out) :: dDdT real(kind=pr), intent(out) :: dDdT2 real(kind=pr), intent(out) :: dDi (:) real(kind=pr), intent(out) :: dDidT (:) real(kind=pr), intent(out) :: dDij (:,:)","tags":"","loc":"type/cubicmixrule.html"},{"title":"ArModelTapenade – yaeos ","text":"type, public, abstract, extends( ArModel ) :: ArModelTapenade Components Type Visibility Attributes Name Initial type( Substances ), public :: components Substances contained in the module character(len=:), public, allocatable :: name Name of the model Type-Bound Procedures procedure, public :: Cp_residual_vt public subroutine Cp_residual_vt (eos, n, V, T, Cp) Calculate residual heat capacity pressure constant given v and t. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: V Volume [L] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out) :: Cp heat capacity p constant [bar L / K / mol] procedure, public :: Cv_residual_vt public subroutine Cv_residual_vt (eos, n, V, T, Cv) Calculate residual heat capacity volume constant given v and t. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: V Volume [L] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out) :: Cv heat capacity v constant [bar L / K / mol] procedure( tapenade_ar ), public, deferred :: ar subroutine tapenade_ar(model, n, v, t, arval) Prototype Arguments Type Intent Optional Attributes Name class( ArModelTapenade ), intent(in) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: v real(kind=pr), intent(in) :: t real(kind=pr), intent(out) :: arval procedure( tapenade_ar_b ), public, deferred :: ar_b subroutine tapenade_ar_b(model, n, nb, v, vb, t, tb, arval, arvalb) Prototype Arguments Type Intent Optional Attributes Name class( ArModelTapenade ), intent(in) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr) :: nb (:) real(kind=pr), intent(in) :: v real(kind=pr) :: vb real(kind=pr), intent(in) :: t real(kind=pr) :: tb real(kind=pr) :: arval real(kind=pr) :: arvalb procedure( tapenade_ar_d ), public, deferred :: ar_d subroutine tapenade_ar_d(model, n, nd, v, vd, t, td, arval, arvald) Prototype Arguments Type Intent Optional Attributes Name class( ArModelTapenade ), intent(in) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: nd (:) real(kind=pr), intent(in) :: v real(kind=pr), intent(in) :: vd real(kind=pr), intent(in) :: t real(kind=pr), intent(in) :: td real(kind=pr), intent(out) :: arval real(kind=pr), intent(out) :: arvald procedure( tapenade_ar_d_b ), public, deferred :: ar_d_b subroutine tapenade_ar_d_b(model, n, nb, nd, ndb, v, vb, vd, vdb, t, tb, td, tdb, arval, arvalb, arvald, arvaldb) Prototype Arguments Type Intent Optional Attributes Name class( ArModelTapenade ), intent(in) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr) :: nb (:) real(kind=pr), intent(in) :: nd (:) real(kind=pr) :: ndb (:) real(kind=pr), intent(in) :: v real(kind=pr) :: vb real(kind=pr), intent(in) :: vd real(kind=pr) :: vdb real(kind=pr), intent(in) :: t real(kind=pr) :: tb real(kind=pr), intent(in) :: td real(kind=pr) :: tdb real(kind=pr) :: arval real(kind=pr) :: arvalb real(kind=pr) :: arvald real(kind=pr) :: arvaldb procedure( tapenade_ar_d_d ), public, deferred :: ar_d_d subroutine tapenade_ar_d_d(model, n, nd, v, vd0, vd, t, td0, td, arval, arvald0, arvald, arvaldd) Prototype Arguments Type Intent Optional Attributes Name class( ArModelTapenade ), intent(in) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: nd (:) real(kind=pr), intent(in) :: v real(kind=pr), intent(in) :: vd0 real(kind=pr), intent(in) :: vd real(kind=pr), intent(in) :: t real(kind=pr), intent(in) :: td0 real(kind=pr), intent(in) :: td real(kind=pr), intent(out) :: arval real(kind=pr), intent(out) :: arvald0 real(kind=pr), intent(out) :: arvald real(kind=pr), intent(out) :: arvaldd procedure, public :: enthalpy_residual_vt public subroutine enthalpy_residual_vt (eos, n, v, t, Hr, HrT, HrV, Hrn) Calculate residual enthalpy given volume and temperature. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: v Volume [L] real(kind=pr), intent(in) :: t Temperature [K] real(kind=pr), intent(out) :: Hr Residual enthalpy [bar L / mol] real(kind=pr), intent(out), optional :: HrT real(kind=pr), intent(out), optional :: HrV real(kind=pr), intent(out), optional :: Hrn (size(n)) procedure, public :: entropy_residual_vt public subroutine entropy_residual_vt (eos, n, V, T, Sr, SrT, SrV, Srn) Calculate residual entropy given volume and temperature. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: V Volume [L] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out) :: Sr Entropy [bar L / K / mol] real(kind=pr), intent(out), optional :: SrT real(kind=pr), intent(out), optional :: SrV real(kind=pr), intent(out), optional :: Srn (size(n)) procedure, public :: get_v0 private function get_v0 (self, n, p, t) Arguments Type Intent Optional Attributes Name class( ArModelTapenade ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: p real(kind=pr), intent(in) :: t Return Value real(kind=pr) procedure, public :: gibbs_residual_vt => gibbs_residual_VT public subroutine gibbs_residual_VT (eos, n, V, T, Gr, GrT, GrV, Grn) Calculate residual Gibbs energy given volume and temperature. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: V Volume [L] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out) :: Gr Gibbs energy [bar L / mol] real(kind=pr), intent(out), optional :: GrT real(kind=pr), intent(out), optional :: GrV real(kind=pr), intent(out), optional :: Grn (size(n)) procedure, public :: lnphi_pt => fugacity_pt public subroutine fugacity_pt (eos, n, P, T, V, root_type, lnPhi, dlnPhidP, dlnPhidT, dlnPhidn, dPdV, dPdT, dPdn) Calculate logarithm of fugacity, given pressure and temperature. Read more… Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Mixture mole numbers real(kind=pr), intent(in) :: P Pressure [bar] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out), optional :: V Volume [L] character(len=*), intent(in) :: root_type Type of root desired [“liquid”, “vapor”, “stable”] real(kind=pr), intent(out), optional :: lnPhi (size(n)) vector real(kind=pr), intent(out), optional :: dlnPhidP (size(n)) ln(phi) Presssure derivative real(kind=pr), intent(out), optional :: dlnPhidT (size(n)) ln(phi) Temp derivative real(kind=pr), intent(out), optional :: dlnPhidn (size(n),size(n)) ln(phi) compositional derivative real(kind=pr), intent(out), optional :: dPdV real(kind=pr), intent(out), optional :: dPdT real(kind=pr), intent(out), optional :: dPdn (size(n)) procedure, public :: lnphi_vt => fugacity_vt public subroutine fugacity_vt (eos, n, V, T, P, lnPhi, dlnPhidP, dlnPhidT, dlnPhidn, dPdV, dPdT, dPdn) Calculate fugacity coefficent given volume and temperature. Read more… Arguments Type Intent Optional Attributes Name class( ArModel ) :: eos Model real(kind=pr), intent(in) :: n (:) Mixture mole numbers real(kind=pr), intent(in) :: V Volume [L] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out), optional :: P Pressure [bar] real(kind=pr), intent(out), optional :: lnPhi (size(n)) vector real(kind=pr), intent(out), optional :: dlnPhidP (size(n)) Presssure derivative real(kind=pr), intent(out), optional :: dlnPhidT (size(n)) Temp derivative real(kind=pr), intent(out), optional :: dlnPhidn (size(n),size(n)) compositional derivative real(kind=pr), intent(out), optional :: dPdV real(kind=pr), intent(out), optional :: dPdT real(kind=pr), intent(out), optional :: dPdn (:) procedure, public :: pressure public subroutine pressure (eos, n, v, t, p, dPdV, dPdT, dPdn) Pressure calculation. Read more… Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: v Volume [L] real(kind=pr), intent(in) :: t Temperature [K] real(kind=pr), intent(out) :: p Pressure [bar] real(kind=pr), intent(out), optional :: dPdV real(kind=pr), intent(out), optional :: dPdT real(kind=pr), intent(out), optional :: dPdn (:) procedure, public :: residual_helmholtz private subroutine residual_helmholtz (self, n, v, t, Ar, ArV, ArT, ArTV, ArV2, ArT2, Arn, ArVn, ArTn, Arn2) Residual Helmholtz model generic interface Arguments Type Intent Optional Attributes Name class( ArModelTapenade ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: v real(kind=pr), intent(in) :: t real(kind=pr), intent(out), optional :: Ar real(kind=pr), intent(out), optional :: ArV real(kind=pr), intent(out), optional :: ArT real(kind=pr), intent(out), optional :: ArTV real(kind=pr), intent(out), optional :: ArV2 real(kind=pr), intent(out), optional :: ArT2 real(kind=pr), intent(out), optional, dimension(size(n)) :: Arn real(kind=pr), intent(out), optional, dimension(size(n)) :: ArVn real(kind=pr), intent(out), optional, dimension(size(n)) :: ArTn real(kind=pr), intent(out), optional :: Arn2 (size(n),size(n)) procedure( tapenade_v0 ), public, deferred :: v0 pure function tapenade_v0(model, n, p, t) Prototype Arguments Type Intent Optional Attributes Name class( ArModelTapenade ), intent(in) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: p real(kind=pr), intent(in) :: t Return Value real(kind=pr) procedure, public :: volume public subroutine volume (eos, n, P, T, V, root_type) Solves volume roots using newton method. Given pressure and temperature. Read more… Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: P Pressure [bar] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out) :: V Volume [L] character(len=*), intent(in) :: root_type Desired root-type to solve. Options are: [\"liquid\", \"vapor\", \"stable\"]","tags":"","loc":"type/armodeltapenade.html"},{"title":"GeModel – yaeos ","text":"type, public, abstract, extends( BaseModel ) :: GeModel Excess Gibbs energy model. Components Type Visibility Attributes Name Initial type( Substances ), public :: components Substances contained in the module Type-Bound Procedures procedure( excess_gibbs ), public, deferred :: excess_gibbs subroutine excess_gibbs(self, n, t, Ge, GeT, GeT2, Gen, GeTn, Gen2) Prototype Excess Gibbs and derivs procedure Arguments Type Intent Optional Attributes Name class( GeModel ), intent(in) :: self Model real(kind=pr), intent(in) :: n (:) Moles vector real(kind=pr), intent(in) :: t Temperature [K] real(kind=pr), intent(out), optional :: Ge Excess Gibbs real(kind=pr), intent(out), optional :: GeT real(kind=pr), intent(out), optional :: GeT2 real(kind=pr), intent(out), optional :: Gen (size(n)) real(kind=pr), intent(out), optional :: GeTn (size(n)) real(kind=pr), intent(out), optional :: Gen2 (size(n),size(n)) procedure, public :: ln_activity_coefficient public subroutine ln_activity_coefficient (self, n, T, lngamma) Arguments Type Intent Optional Attributes Name class( GeModel ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: T real(kind=pr), intent(out) :: lngamma (:)","tags":"","loc":"type/gemodel.html"},{"title":"Optimizer – yaeos ","text":"type, public, abstract :: Optimizer Components Type Visibility Attributes Name Initial real(kind=pr), public, allocatable :: parameter_step (:) real(kind=pr), public :: solver_tolerance = 1e-9_pr logical, public :: verbose Type-Bound Procedures procedure( abs_optimize ), public, deferred :: optimize subroutine abs_optimize(self, foo, X, F, data) Prototype Arguments Type Intent Optional Attributes Name class( Optimizer ), intent(inout) :: self procedure( obj_func ) :: foo real(kind=pr), intent(inout) :: X (:) real(kind=pr), intent(out) :: F class(*), intent(inout), optional, target :: data","tags":"","loc":"type/optimizer.html"},{"title":"PowellWrapper – yaeos ","text":"type, public, extends( Optimizer ) :: PowellWrapper Wrapper derived type to optimize with the Powell method Components Type Visibility Attributes Name Initial real(kind=pr), public, allocatable :: parameter_step (:) real(kind=pr), public :: solver_tolerance = 1e-9_pr logical, public :: verbose Type-Bound Procedures procedure, public :: optimize => powell_optimize private subroutine powell_optimize (self, foo, X, F, data) Arguments Type Intent Optional Attributes Name class( PowellWrapper ), intent(inout) :: self procedure( obj_func ) :: foo real(kind=pr), intent(inout) :: X (:) real(kind=pr), intent(out) :: F class(*), intent(inout), optional, target :: data","tags":"","loc":"type/powellwrapper.html"},{"title":"Groups – yaeos ","text":"type, public :: Groups Groups Derived type used to represent a molecule and its UNIFAC groups. Description Derived type used to represent a molecule and its UNIFAC groups. Is\nnecessary to specify the subgroups ids and the subgroups on each\nmolecule as shown in the example. Examples ! Define toluene molecule groups use yaeos , only : Groups type ( Groups ) :: toluene ! Toluene [ACH, ACCH3] toluene % groups_ids = [ 9 , 11 ] ! Subgroups ids toluene % number_of_groups = [ 5 , 1 ] ! Subgroups occurrences References Dortmund Data Bank Software & Separation Technology Components Type Visibility Attributes Name Initial integer, public, allocatable :: groups_ids (:) Indexes (ids) of each subgroup in the main group matrix integer, public, allocatable :: number_of_groups (:) Occurrences of each subgroup in the molecule real(kind=pr), public :: surface_area Molecule surface area real(kind=pr), public :: volume Molecule volume","tags":"","loc":"type/groups.html"},{"title":"PsiFunction – yaeos ","text":"type, public, abstract :: PsiFunction function UNIFAC functions abstract type Description Abstract derived type for UNIFAC models temperature dependent functions Type-Bound Procedures procedure( temperature_dependence ), public, deferred :: psi subroutine temperature_dependence(self, systems_groups, T, psi, dpsi_dt, dpsi_dt2) Prototype temperature_dependence interface Interface subroutine for UNIFAC models temperature dependent\nfunctions Arguments Type Intent Optional Attributes Name class( PsiFunction ) :: self PsiFunction type variable class( Groups ) :: systems_groups Groups type variable containig all the system’s groups. See the groups_stew variable on the UNIFAC documentation. real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out), optional :: psi (:,:) real(kind=pr), intent(out), optional :: dpsi_dt (:,:) real(kind=pr), intent(out), optional :: dpsi_dt2 (:,:)","tags":"","loc":"type/psifunction.html"},{"title":"UNIFAC – yaeos ","text":"type, public, extends( GeModel ) :: UNIFAC UNIFAC model Classic liquid-vapor UNIFAC model derived type Description This type holds the needed parameters for using a UNIFAC model\nmainly group areas, volumes and what temperature dependence function to use. It also holds the individual molecules of a particular system and\nthe set of all groups in the system as a “stew” of groups instead of\nbeing them included in particular molecules. Examples ! UNIFAC model with ethanol-formic acid mix and calculate gammas use yaeos , only : pr , Groups , setup_unifac , UNIFAC type ( UNIFAC ) :: model type ( Groups ) :: molecules ( 2 ) real ( pr ) :: ln_gammas ( 2 ) ! Ethanol definition [CH3, CH2, OH] molecules ( 1 )% groups_ids = [ 1 , 2 , 14 ] ! Subgroups ids molecules ( 1 )% number_of_groups = [ 1 , 1 , 1 ] ! Subgroups occurrences ! formic acid definition [HCOOH] molecules ( 2 )% groups_ids = [ 43 ] molecules ( 2 )% number_of_groups = [ 1 ] ! Model setup model = setup_unifac ( molecules ) ! Calculate ln_gammas call model % ln_activity_coefficient ([ 0.5_pr , 0.5_pr ], 29 8.0_pr , ln_gammas ) print * , ln_gammas ! result: 0.10505475697637946 0.28073129552766890 References Dortmund Data Bank Software & Separation Technology Fredenslund, A., Jones, R. L., & Prausnitz, J. M. (1975).\nGroup‐contribution estimation of activity coefficients in nonideal liquid\nmixtures. AIChE Journal, 21(6), 1086–1099. https://doi.org/10.1002/aic.690210607 Skjold-Jorgensen, S., Kolbe, B., Gmehling, J., & Rasmussen, P. (1979).\nVapor-Liquid Equilibria by UNIFAC Group Contribution. Revision and\nExtension. Industrial & Engineering Chemistry Process Design and\nDevelopment, 18(4), 714–722. https://doi.org/10.1021/i260072a024 Gmehling, J., Rasmussen, P., & Fredenslund, A. (1982). Vapor-liquid\nequilibriums by UNIFAC group contribution. Revision and extension. 2.\nIndustrial & Engineering Chemistry Process Design and Development, 21(1),\n118–127. https://doi.org/10.1021/i200016a021 Macedo, E. A., Weidlich, U., Gmehling, J., & Rasmussen, P. (1983).\nVapor-liquid equilibriums by UNIFAC group contribution. Revision and\nextension. 3. Industrial & Engineering Chemistry Process Design and\nDevelopment, 22(4), 676–678. https://doi.org/10.1021/i200023a023 Tiegs, D., Rasmussen, P., Gmehling, J., & Fredenslund, A. (1987).\nVapor-liquid equilibria by UNIFAC group contribution. 4. Revision and\nextension. Industrial & Engineering Chemistry Research, 26(1), 159–161. https://doi.org/10.1021/ie00061a030 Hansen, H. K., Rasmussen, P., Fredenslund, A., Schiller, M., &\nGmehling, J. (1991). Vapor-liquid equilibria by UNIFAC group\ncontribution. 5. Revision and extension. Industrial & Engineering\nChemistry Research, 30 (10), 2352–2355. https://doi.org/10.1021/ie00058a017 Wittig, R., Lohmann, J., & Gmehling, J. (2003). Vapor−Liquid Equilibria\nby UNIFAC Group Contribution. 6. Revision and Extension. Industrial &\nEngineering Chemistry Research, 42(1), 183–188. https://doi.org/10.1021/ie020506l SINTEF - Thermopack Components Type Visibility Attributes Name Initial type( Substances ), public :: components Substances contained in the module real(kind=pr), public, allocatable :: group_area (:) Group areas real(kind=pr), public, allocatable :: group_volume (:) Group volumes type( Groups ), public :: groups_stew All the groups present in the system type( Groups ), public, allocatable :: molecules (:) Substances present in the system integer, public :: ngroups Total number of individual groups in the mixture integer, public :: nmolecules Total number of molecules in the mixture class( PsiFunction ), public, allocatable :: psi_function Temperature dependance function of the model real(kind=pr), public, allocatable :: qk (:) Area of each group k real(kind=pr), public, allocatable :: thetas_ij (:,:) Area fractions of the groups j on molecules i real(kind=pr), public, allocatable :: vij (:,:) Ocurrences of each group j on each molecule i real(kind=pr), public :: z = 10 Model constant Type-Bound Procedures procedure, public :: excess_gibbs public subroutine excess_gibbs (self, n, T, Ge, GeT, GeT2, Gen, GeTn, Gen2) Calculate the Gibbs excess energy of the UNIFAC model Read more… Arguments Type Intent Optional Attributes Name class( UNIFAC ), intent(in) :: self UNIFAC model real(kind=pr), intent(in) :: n (:) Moles vector [mol] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out), optional :: Ge Excess Gibbs energy real(kind=pr), intent(out), optional :: GeT real(kind=pr), intent(out), optional :: GeT2 real(kind=pr), intent(out), optional :: Gen (size(n)) real(kind=pr), intent(out), optional :: GeTn (size(n)) real(kind=pr), intent(out), optional :: Gen2 (size(n),size(n)) procedure, public :: ln_activity_coefficient public subroutine ln_activity_coefficient (self, n, T, lngamma) Arguments Type Intent Optional Attributes Name class( GeModel ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: T real(kind=pr), intent(out) :: lngamma (:)","tags":"","loc":"type/unifac.html"},{"title":"UNIFACPsi – yaeos ","text":"type, public, extends( PsiFunction ) :: UNIFACPsi Original UNIFAC function References Dortmund Data Bank Software & Separation Technology Fredenslund, A., Jones, R. L., & Prausnitz, J. M. (1975).\nGroup‐contribution estimation of activity coefficients in nonideal liquid\nmixtures. AIChE Journal, 21(6), 1086–1099. https://doi.org/10.1002/aic.690210607 Skjold-Jorgensen, S., Kolbe, B., Gmehling, J., & Rasmussen, P. (1979).\nVapor-Liquid Equilibria by UNIFAC Group Contribution. Revision and\nExtension. Industrial & Engineering Chemistry Process Design and\nDevelopment, 18(4), 714–722. https://doi.org/10.1021/i260072a024 Gmehling, J., Rasmussen, P., & Fredenslund, A. (1982). Vapor-liquid\nequilibriums by UNIFAC group contribution. Revision and extension. 2.\nIndustrial & Engineering Chemistry Process Design and Development, 21(1),\n118–127. https://doi.org/10.1021/i200016a021 Macedo, E. A., Weidlich, U., Gmehling, J., & Rasmussen, P. (1983).\nVapor-liquid equilibriums by UNIFAC group contribution. Revision and\nextension. 3. Industrial & Engineering Chemistry Process Design and\nDevelopment, 22(4), 676–678. https://doi.org/10.1021/i200023a023 Tiegs, D., Rasmussen, P., Gmehling, J., & Fredenslund, A. (1987).\nVapor-liquid equilibria by UNIFAC group contribution. 4. Revision and\nextension. Industrial & Engineering Chemistry Research, 26(1), 159–161. https://doi.org/10.1021/ie00061a030 Hansen, H. K., Rasmussen, P., Fredenslund, A., Schiller, M., &\nGmehling, J. (1991). Vapor-liquid equilibria by UNIFAC group\ncontribution. 5. Revision and extension. Industrial & Engineering\nChemistry Research, 30 (10), 2352–2355. https://doi.org/10.1021/ie00058a017 Wittig, R., Lohmann, J., & Gmehling, J. (2003). Vapor−Liquid Equilibria\nby UNIFAC Group Contribution. 6. Revision and Extension. Industrial &\nEngineering Chemistry Research, 42(1), 183–188. https://doi.org/10.1021/ie020506l SINTEF - Thermopack Components Type Visibility Attributes Name Initial real(kind=pr), public, allocatable :: Aij (:,:) Type-Bound Procedures procedure, public :: psi => UNIFAC_temperature_dependence public subroutine UNIFAC_temperature_dependence (self, systems_groups, T, psi, dpsi_dt, dpsi_dt2) Implementation of the function of the UNIFAC model. Read more… Arguments Type Intent Optional Attributes Name class( UNIFACPsi ) :: self function class( Groups ) :: systems_groups Groups in the system real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out), optional :: psi (:,:) real(kind=pr), intent(out), optional :: dpsi_dt (:,:) real(kind=pr), intent(out), optional :: dpsi_dt2 (:,:)","tags":"","loc":"type/unifacpsi.html"},{"title":"ContinuationVariable – yaeos ","text":"type, public :: ContinuationVariable Components Type Visibility Attributes Name Initial real(kind=pr), public :: S real(kind=pr), public, allocatable :: X (:) real(kind=pr), public :: dS integer, public :: ns","tags":"","loc":"type/continuationvariable.html"},{"title":"ArModelAdiff – yaeos ","text":"type, public, abstract, extends( ArModel ) :: ArModelAdiff Components Type Visibility Attributes Name Initial type( Substances ), public :: components Substances contained in the module character(len=:), public, allocatable :: name Name of the model Type-Bound Procedures procedure( hyperdual_Ar ), public, deferred :: Ar function hyperdual_Ar(self, n, v, t) Prototype Arguments Type Intent Optional Attributes Name class( ArModelAdiff ) :: self type( hyperdual ), intent(in) :: n (:) type( hyperdual ), intent(in) :: v type( hyperdual ), intent(in) :: t Return Value type( hyperdual ) procedure, public :: Cp_residual_vt public subroutine Cp_residual_vt (eos, n, V, T, Cp) Calculate residual heat capacity pressure constant given v and t. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: V Volume [L] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out) :: Cp heat capacity p constant [bar L / K / mol] procedure, public :: Cv_residual_vt public subroutine Cv_residual_vt (eos, n, V, T, Cv) Calculate residual heat capacity volume constant given v and t. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: V Volume [L] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out) :: Cv heat capacity v constant [bar L / K / mol] procedure, public :: enthalpy_residual_vt public subroutine enthalpy_residual_vt (eos, n, v, t, Hr, HrT, HrV, Hrn) Calculate residual enthalpy given volume and temperature. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: v Volume [L] real(kind=pr), intent(in) :: t Temperature [K] real(kind=pr), intent(out) :: Hr Residual enthalpy [bar L / mol] real(kind=pr), intent(out), optional :: HrT real(kind=pr), intent(out), optional :: HrV real(kind=pr), intent(out), optional :: Hrn (size(n)) procedure, public :: entropy_residual_vt public subroutine entropy_residual_vt (eos, n, V, T, Sr, SrT, SrV, Srn) Calculate residual entropy given volume and temperature. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: V Volume [L] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out) :: Sr Entropy [bar L / K / mol] real(kind=pr), intent(out), optional :: SrT real(kind=pr), intent(out), optional :: SrV real(kind=pr), intent(out), optional :: Srn (size(n)) procedure( abs_volume_initializer ), public, deferred :: get_v0 function abs_volume_initializer(self, n, p, t) Prototype Function that provides an initializer value for the liquid-root\nof newton solver of volume. In the case the model will use the volume_michelsen routine this value should provide the co-volume\nof the model. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: self Ar Model real(kind=pr), intent(in) :: n (:) Moles vector real(kind=pr), intent(in) :: p Pressure [bar] real(kind=pr), intent(in) :: t Temperature [K] Return Value real(kind=pr) Initial volume [L] procedure, public :: gibbs_residual_vt => gibbs_residual_VT public subroutine gibbs_residual_VT (eos, n, V, T, Gr, GrT, GrV, Grn) Calculate residual Gibbs energy given volume and temperature. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: V Volume [L] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out) :: Gr Gibbs energy [bar L / mol] real(kind=pr), intent(out), optional :: GrT real(kind=pr), intent(out), optional :: GrV real(kind=pr), intent(out), optional :: Grn (size(n)) procedure, public :: lnphi_pt => fugacity_pt public subroutine fugacity_pt (eos, n, P, T, V, root_type, lnPhi, dlnPhidP, dlnPhidT, dlnPhidn, dPdV, dPdT, dPdn) Calculate logarithm of fugacity, given pressure and temperature. Read more… Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Mixture mole numbers real(kind=pr), intent(in) :: P Pressure [bar] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out), optional :: V Volume [L] character(len=*), intent(in) :: root_type Type of root desired [“liquid”, “vapor”, “stable”] real(kind=pr), intent(out), optional :: lnPhi (size(n)) vector real(kind=pr), intent(out), optional :: dlnPhidP (size(n)) ln(phi) Presssure derivative real(kind=pr), intent(out), optional :: dlnPhidT (size(n)) ln(phi) Temp derivative real(kind=pr), intent(out), optional :: dlnPhidn (size(n),size(n)) ln(phi) compositional derivative real(kind=pr), intent(out), optional :: dPdV real(kind=pr), intent(out), optional :: dPdT real(kind=pr), intent(out), optional :: dPdn (size(n)) procedure, public :: lnphi_vt => fugacity_vt public subroutine fugacity_vt (eos, n, V, T, P, lnPhi, dlnPhidP, dlnPhidT, dlnPhidn, dPdV, dPdT, dPdn) Calculate fugacity coefficent given volume and temperature. Read more… Arguments Type Intent Optional Attributes Name class( ArModel ) :: eos Model real(kind=pr), intent(in) :: n (:) Mixture mole numbers real(kind=pr), intent(in) :: V Volume [L] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out), optional :: P Pressure [bar] real(kind=pr), intent(out), optional :: lnPhi (size(n)) vector real(kind=pr), intent(out), optional :: dlnPhidP (size(n)) Presssure derivative real(kind=pr), intent(out), optional :: dlnPhidT (size(n)) Temp derivative real(kind=pr), intent(out), optional :: dlnPhidn (size(n),size(n)) compositional derivative real(kind=pr), intent(out), optional :: dPdV real(kind=pr), intent(out), optional :: dPdT real(kind=pr), intent(out), optional :: dPdn (:) procedure, public :: pressure public subroutine pressure (eos, n, v, t, p, dPdV, dPdT, dPdn) Pressure calculation. Read more… Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: v Volume [L] real(kind=pr), intent(in) :: t Temperature [K] real(kind=pr), intent(out) :: p Pressure [bar] real(kind=pr), intent(out), optional :: dPdV real(kind=pr), intent(out), optional :: dPdT real(kind=pr), intent(out), optional :: dPdn (:) procedure, public :: residual_helmholtz public subroutine residual_helmholtz (self, n, v, t, Ar, ArV, ArT, ArTV, ArV2, ArT2, Arn, ArVn, ArTn, Arn2) Arguments Type Intent Optional Attributes Name class( ArModelAdiff ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: v real(kind=pr), intent(in) :: t real(kind=pr), intent(out), optional :: Ar real(kind=pr), intent(out), optional :: ArV real(kind=pr), intent(out), optional :: ArT real(kind=pr), intent(out), optional :: ArTV real(kind=pr), intent(out), optional :: ArV2 real(kind=pr), intent(out), optional :: ArT2 real(kind=pr), intent(out), optional, dimension(size(n)) :: Arn real(kind=pr), intent(out), optional, dimension(size(n)) :: ArVn real(kind=pr), intent(out), optional, dimension(size(n)) :: ArTn real(kind=pr), intent(out), optional :: Arn2 (size(n),size(n)) procedure, public :: volume public subroutine volume (eos, n, P, T, V, root_type) Solves volume roots using newton method. Given pressure and temperature. Read more… Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: P Pressure [bar] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out) :: V Volume [L] character(len=*), intent(in) :: root_type Desired root-type to solve. Options are: [\"liquid\", \"vapor\", \"stable\"]","tags":"","loc":"type/armodeladiff.html"},{"title":"ArModel – yaeos ","text":"type, public, abstract, extends( BaseModel ) :: ArModel Abstract residual Helmholtz model. This derived type defines the basics needed for the calculation\nof residual properties.\nThe basics of a residual Helmholtz model is a routine that calculates\nall the needed derivatives of residual_helmholtz and\na volume initializer function, that is used to initialize a Newton\nsolver of volume when specifying pressure. Components Type Visibility Attributes Name Initial type( Substances ), public :: components Substances contained in the module character(len=:), public, allocatable :: name Name of the model Type-Bound Procedures procedure, public :: Cp_residual_vt public subroutine Cp_residual_vt (eos, n, V, T, Cp) Calculate residual heat capacity pressure constant given v and t. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: V Volume [L] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out) :: Cp heat capacity p constant [bar L / K / mol] procedure, public :: Cv_residual_vt public subroutine Cv_residual_vt (eos, n, V, T, Cv) Calculate residual heat capacity volume constant given v and t. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: V Volume [L] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out) :: Cv heat capacity v constant [bar L / K / mol] procedure, public :: enthalpy_residual_vt public subroutine enthalpy_residual_vt (eos, n, v, t, Hr, HrT, HrV, Hrn) Calculate residual enthalpy given volume and temperature. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: v Volume [L] real(kind=pr), intent(in) :: t Temperature [K] real(kind=pr), intent(out) :: Hr Residual enthalpy [bar L / mol] real(kind=pr), intent(out), optional :: HrT real(kind=pr), intent(out), optional :: HrV real(kind=pr), intent(out), optional :: Hrn (size(n)) procedure, public :: entropy_residual_vt public subroutine entropy_residual_vt (eos, n, V, T, Sr, SrT, SrV, Srn) Calculate residual entropy given volume and temperature. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: V Volume [L] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out) :: Sr Entropy [bar L / K / mol] real(kind=pr), intent(out), optional :: SrT real(kind=pr), intent(out), optional :: SrV real(kind=pr), intent(out), optional :: Srn (size(n)) procedure( abs_volume_initializer ), public, deferred :: get_v0 function abs_volume_initializer(self, n, p, t) Prototype Function that provides an initializer value for the liquid-root\nof newton solver of volume. In the case the model will use the volume_michelsen routine this value should provide the co-volume\nof the model. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: self Ar Model real(kind=pr), intent(in) :: n (:) Moles vector real(kind=pr), intent(in) :: p Pressure [bar] real(kind=pr), intent(in) :: t Temperature [K] Return Value real(kind=pr) Initial volume [L] procedure, public :: gibbs_residual_vt => gibbs_residual_VT public subroutine gibbs_residual_VT (eos, n, V, T, Gr, GrT, GrV, Grn) Calculate residual Gibbs energy given volume and temperature. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: V Volume [L] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out) :: Gr Gibbs energy [bar L / mol] real(kind=pr), intent(out), optional :: GrT real(kind=pr), intent(out), optional :: GrV real(kind=pr), intent(out), optional :: Grn (size(n)) procedure, public :: lnphi_pt => fugacity_pt public subroutine fugacity_pt (eos, n, P, T, V, root_type, lnPhi, dlnPhidP, dlnPhidT, dlnPhidn, dPdV, dPdT, dPdn) Calculate logarithm of fugacity, given pressure and temperature. Read more… Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Mixture mole numbers real(kind=pr), intent(in) :: P Pressure [bar] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out), optional :: V Volume [L] character(len=*), intent(in) :: root_type Type of root desired [“liquid”, “vapor”, “stable”] real(kind=pr), intent(out), optional :: lnPhi (size(n)) vector real(kind=pr), intent(out), optional :: dlnPhidP (size(n)) ln(phi) Presssure derivative real(kind=pr), intent(out), optional :: dlnPhidT (size(n)) ln(phi) Temp derivative real(kind=pr), intent(out), optional :: dlnPhidn (size(n),size(n)) ln(phi) compositional derivative real(kind=pr), intent(out), optional :: dPdV real(kind=pr), intent(out), optional :: dPdT real(kind=pr), intent(out), optional :: dPdn (size(n)) procedure, public :: lnphi_vt => fugacity_vt public subroutine fugacity_vt (eos, n, V, T, P, lnPhi, dlnPhidP, dlnPhidT, dlnPhidn, dPdV, dPdT, dPdn) Calculate fugacity coefficent given volume and temperature. Read more… Arguments Type Intent Optional Attributes Name class( ArModel ) :: eos Model real(kind=pr), intent(in) :: n (:) Mixture mole numbers real(kind=pr), intent(in) :: V Volume [L] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out), optional :: P Pressure [bar] real(kind=pr), intent(out), optional :: lnPhi (size(n)) vector real(kind=pr), intent(out), optional :: dlnPhidP (size(n)) Presssure derivative real(kind=pr), intent(out), optional :: dlnPhidT (size(n)) Temp derivative real(kind=pr), intent(out), optional :: dlnPhidn (size(n),size(n)) compositional derivative real(kind=pr), intent(out), optional :: dPdV real(kind=pr), intent(out), optional :: dPdT real(kind=pr), intent(out), optional :: dPdn (:) procedure, public :: pressure public subroutine pressure (eos, n, v, t, p, dPdV, dPdT, dPdn) Pressure calculation. Read more… Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: v Volume [L] real(kind=pr), intent(in) :: t Temperature [K] real(kind=pr), intent(out) :: p Pressure [bar] real(kind=pr), intent(out), optional :: dPdV real(kind=pr), intent(out), optional :: dPdT real(kind=pr), intent(out), optional :: dPdn (:) procedure( abs_residual_helmholtz ), public, deferred :: residual_helmholtz subroutine abs_residual_helmholtz(self, n, v, t, Ar, ArV, ArT, ArTV, ArV2, ArT2, Arn, ArVn, ArTn, Arn2) Prototype Residual Helmholtz model generic interface. This interface represents how an Ar model should be implemented.\nBy our standard, a Resiudal Helmholtz model takes as input: The mixture’s number of moles vector. Volume, by default in liters. Temperature, by default in Kelvin. All the output arguments are optional. While this keeps a long\nsignature for the implementation, this is done this way to take\nadvantage of any inner optimizations to calculate derivatives\ninside the procedure. Once the model is implemented, the signature can be short like model%residual_helmholtz(n, v, t, ArT2=dArdT2) Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: self ArModel real(kind=pr), intent(in) :: n (:) Moles vector real(kind=pr), intent(in) :: v Volume [L] real(kind=pr), intent(in) :: t Temperature [K] real(kind=pr), intent(out), optional :: Ar Residual Helmoltz energy real(kind=pr), intent(out), optional :: ArV real(kind=pr), intent(out), optional :: ArT real(kind=pr), intent(out), optional :: ArTV real(kind=pr), intent(out), optional :: ArV2 real(kind=pr), intent(out), optional :: ArT2 real(kind=pr), intent(out), optional :: Arn (size(n)) real(kind=pr), intent(out), optional :: ArVn (size(n)) real(kind=pr), intent(out), optional :: ArTn (size(n)) real(kind=pr), intent(out), optional :: Arn2 (size(n),size(n)) procedure, public :: volume public subroutine volume (eos, n, P, T, V, root_type) Solves volume roots using newton method. Given pressure and temperature. Read more… Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: P Pressure [bar] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out) :: V Volume [L] character(len=*), intent(in) :: root_type Desired root-type to solve. Options are: [\"liquid\", \"vapor\", \"stable\"]","tags":"","loc":"type/armodel.html"},{"title":"hyperdual – yaeos ","text":"type, public, bind(c) :: hyperdual Components Type Visibility Attributes Name Initial real(kind=pr), public :: f0 = 0 real part of the hyperdual number real(kind=pr), public :: f1 = 0 \\f$\\varepsilon_1\\f$-part of the hyperdual number real(kind=pr), public :: f12 = 0 \\f$\\varepsilon_1\\varepsilon_2\\f$-part of the real(kind=pr), public :: f2 = 0 \\f$\\varepsilon_2\\f$-part of the hyperdual number","tags":"","loc":"type/hyperdual.html"},{"title":"FitMHVNRTL – yaeos ","text":"type, public, extends( FittingProblem ) :: FitMHVNRTL Components Type Visibility Attributes Name Initial type( EquilibriumState ), public, allocatable :: experimental_points (:) Experimental points to fit logical, public :: fit_lij = .false. logical, public :: fit_nrtl = .false. class( ArModel ), public, allocatable :: model Residual Helmholtz Model to fit logical, public :: verbose = .false. If true log the fitting process Type-Bound Procedures procedure, public :: get_model_from_X => model_from_X public subroutine model_from_X (problem, X) Arguments Type Intent Optional Attributes Name class( FitMHVNRTL ), intent(inout) :: problem real(kind=pr), intent(in) :: X (:)","tags":"","loc":"type/fitmhvnrtl.html"},{"title":"FitKijLij – yaeos ","text":"type, public, extends( FittingProblem ) :: FitKijLij Binary Interaction Parameters of Cubic EoS fitting problem Fit the binary interaction parameters of a mixtures. Description Fitting setup for quadratic combining rules, it is possible to select\nwhich parameters will be optimized with the fit_lij and fit_kij attributes. Examples Fit the kij BIP type ( CubicEoS ) :: model ! Model to fit type ( FitKijLij ) :: fitting_problem ! Fitting problem specification type ( EquilibriumState ) :: exp_data ( 3 ) real ( pr ) :: X ( 2 ) ! parameter variables real ( pr ) :: error ! model = PengRobinson76 ( tc , pc , w ) ! Model to fit fitting_problem % exp_data = exp_data fitting_problem % model = model fitting_problem % fit_kij = . true . X = 0 ! initial values == 0 err = optimize ( X , fitting_problem ) References Components Type Visibility Attributes Name Initial type( EquilibriumState ), public, allocatable :: experimental_points (:) Experimental points to fit logical, public :: fit_kij = .false. Fit the parameter logical, public :: fit_lij = .false. Fit the parameter class( ArModel ), public, allocatable :: model Residual Helmholtz Model to fit logical, public :: verbose = .false. If true log the fitting process Type-Bound Procedures procedure, public :: get_model_from_X => model_from_X public subroutine model_from_X (problem, X) Arguments Type Intent Optional Attributes Name class( FitKijLij ), intent(inout) :: problem real(kind=pr), intent(in) :: X (:)","tags":"","loc":"type/fitkijlij.html"},{"title":"MHV – yaeos ","text":"type, public, extends( CubicMixRule ) :: MHV Michelsen’s modified Huron-Vidal mixing rule Mixing rule at zero-pressure which allows for the inclusion of an\nexcess-gibbs model. Description This mixing rule is based on the aproximate zero-pressure limit \n of a cubic equation of state. At the aproximate zero-pressure limit the\nattractive parameter can be expressed as: Where is a weak function of temperature. In the case of MHV and simplicity it is considered that depends on the model used. Examples To use the modified Huron-Vidal mixing rule it is necessary to define\na CubicEoS and replace its original mixing rule with the one generated\nby the user. type ( MHV ) :: mixrule type ( NRTL ) :: ge_model type ( CubicEoS ) :: model ! Define the Ge model to be used and the CubicEoS ge_model = NRTL ( a , b , c ) model = SoaveRedlichKwong ( tc , pc , w ) ! Use the initialization function to setup mixrule = MHV ( ge = ge_model , q =- 0.593_pr , bi = model % b ) ! Replace the original mixrule on the previously defined model model % mixrule = mixrule ! Ready to do calculations call pressure ( model , n , v , T ) References Components Type Visibility Attributes Name Initial class( GeModel ), public, allocatable :: ge real(kind=pr), public, allocatable :: l (:,:) real(kind=pr), public :: q real(kind=pr), private, allocatable :: B real(kind=pr), private, allocatable :: bi (:) real(kind=pr), private, allocatable :: dBi (:) real(kind=pr), private, allocatable :: dBij (:,:) Constructor public interface MHV private function init (Ge, b, q, lij) result(mixrule) Arguments Type Intent Optional Attributes Name class( GeModel ), intent(in) :: Ge real(kind=pr), intent(in) :: b (:) real(kind=pr), intent(in) :: q real(kind=pr), intent(in), optional :: lij (:,:) Return Value type( MHV ) Type-Bound Procedures procedure, public :: Bmix => BmixMHV private subroutine BmixMHV (self, n, bi, B, dBi, dBij) Quadratinc mixing rule for the repulsive parameter, using as a combining rule. Read more… Arguments Type Intent Optional Attributes Name class( MHV ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: bi (:) real(kind=pr), intent(out) :: B real(kind=pr), intent(out) :: dBi (:) real(kind=pr), intent(out) :: dBij (:,:) procedure, public :: D1Mix => D1MixMHV private subroutine D1MixMHV (self, n, d1i, D1, dD1i, dD1ij) Arguments Type Intent Optional Attributes Name class( MHV ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: d1i (:) real(kind=pr), intent(out) :: D1 real(kind=pr), intent(out) :: dD1i (:) real(kind=pr), intent(out) :: dD1ij (:,:) procedure, public :: Dmix => DmixMHV public subroutine DmixMHV (self, n, T, ai, daidt, daidt2, D, dDdT, dDdT2, dDi, dDidT, dDij) Mixing rule at infinite pressure as defined in the book of Michelsen and\nMøllerup. Read more… Arguments Type Intent Optional Attributes Name class( MHV ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: T real(kind=pr), intent(in) :: ai (:) real(kind=pr), intent(in) :: daidt (:) real(kind=pr), intent(in) :: daidt2 (:) real(kind=pr), intent(out) :: D real(kind=pr), intent(out) :: dDdT real(kind=pr), intent(out) :: dDdT2 real(kind=pr), intent(out) :: dDi (:) real(kind=pr), intent(out) :: dDidT (:) real(kind=pr), intent(out) :: dDij (:,:)","tags":"","loc":"type/mhv.html"},{"title":"AlphaRKPR – yaeos ","text":"type, public, extends( AlphaFunction ) :: AlphaRKPR RKPR function Components Type Visibility Attributes Name Initial real(kind=pr), public, allocatable :: k (:) parameter. Type-Bound Procedures procedure, public :: alpha => alpha_rkpr public subroutine alpha_rkpr (self, Tr, a, dadt, dadt2) Arguments Type Intent Optional Attributes Name class( AlphaRKPR ), intent(in) :: self real(kind=pr), intent(in) :: Tr (:) Reduced temperature real(kind=pr), intent(out) :: a (:) real(kind=pr), intent(out) :: dadt (:) real(kind=pr), intent(out) :: dadt2 (:)","tags":"","loc":"type/alpharkpr.html"},{"title":"AlphaSoave – yaeos ","text":"type, public, extends( AlphaFunction ) :: AlphaSoave Soave function. Components Type Visibility Attributes Name Initial real(kind=pr), public, allocatable :: k (:) parameter. Type-Bound Procedures procedure, public :: alpha Alpha function public subroutine alpha (self, Tr, a, dadt, dadt2) Soave function and it’s derivatives. Arguments Type Intent Optional Attributes Name class( AlphaSoave ), intent(in) :: self real(kind=pr), intent(in) :: Tr (:) Reduced temperature real(kind=pr), intent(out) :: a (:) real(kind=pr), intent(out) :: dadt (:) real(kind=pr), intent(out) :: dadt2 (:)","tags":"","loc":"type/alphasoave.html"},{"title":"QMR – yaeos ","text":"type, public, extends( CubicMixRule ) :: QMR Quadratic Mixing Rule (QMR) derived type. Classic Van der Waals mixing\nrules. QMR depends on binary interaction parameters, on a Cubic EoS\nthe mixture is obtained by the combination of an attractive and\nrepulsive parameter matrices. By default the attractive parameter matrix is calculated with: generating the matrix, but this procedure can be overriden\nreplacing the aij pointer procedure. Components Type Visibility Attributes Name Initial procedure( get_aij ), public, pointer :: aij => null() Procedure to calculate matrix. Can be overloaded\nby any method that respets the interface get_aij . real(kind=pr), public, allocatable :: k (:,:) Attractive Binary Interatction parameter matrix real(kind=pr), public, allocatable :: l (:,:) Repulsive Binary Interatction parameter matrix Type-Bound Procedures procedure, public :: Bmix Repulsive parameter mixing rule public subroutine Bmix (self, n, bi, B, dBi, dBij) Mixture repulsive parameter. Read more… Arguments Type Intent Optional Attributes Name class( QMR ), intent(in) :: self Mixing rule object. real(kind=pr), intent(in) :: n (:) Moles vector. real(kind=pr), intent(in) :: bi (:) Pure components repulsive parameters. real(kind=pr), intent(out) :: B Mixture repulsive parameter. real(kind=pr), intent(out) :: dBi (:) real(kind=pr), intent(out) :: dBij (:,:) procedure, public :: D1mix => D1mix_constant public subroutine D1mix_constant (self, n, d1i, D1, dD1i, dD1ij) Constant parameter. Read more… Arguments Type Intent Optional Attributes Name class( QMR ), intent(in) :: self Mixing rule real(kind=pr), intent(in) :: n (:) Moles vector real(kind=pr), intent(in) :: d1i (:) parameter real(kind=pr), intent(out) :: D1 Mixture’s real(kind=pr), intent(out) :: dD1i (:) real(kind=pr), intent(out) :: dD1ij (:,:) procedure, public :: Dmix Attractive parameter mixing rule public subroutine Dmix (self, n, T, ai, daidt, daidt2, D, dDdT, dDdT2, dDi, dDidT, dDij) Attractive parameter mixing rule with quadratic mix. Read more… Arguments Type Intent Optional Attributes Name class( QMR ), intent(in) :: self Mixing rule object. real(kind=pr), intent(in) :: n (:) Moles vector [mol] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(in) :: ai (:) Pure components attractive parameters real(kind=pr), intent(in) :: daidt (:) real(kind=pr), intent(in) :: daidt2 (:) real(kind=pr), intent(out) :: D Mixture attractive parameter real(kind=pr), intent(out) :: dDdT real(kind=pr), intent(out) :: dDdT2 real(kind=pr), intent(out) :: dDi (:) real(kind=pr), intent(out) :: dDidT (:) real(kind=pr), intent(out) :: dDij (:,:)","tags":"","loc":"type/qmr.html"},{"title":"QMR_RKPR – yaeos ","text":"type, public, extends( QMR ) :: QMR_RKPR Components Type Visibility Attributes Name Initial procedure( get_aij ), public, pointer :: aij => null() Procedure to calculate matrix. Can be overloaded\nby any method that respets the interface get_aij . real(kind=pr), public, allocatable :: k (:,:) Attractive Binary Interatction parameter matrix real(kind=pr), public, allocatable :: l (:,:) Repulsive Binary Interatction parameter matrix Type-Bound Procedures procedure, public :: Bmix Repulsive parameter mixing rule public subroutine Bmix (self, n, bi, B, dBi, dBij) Mixture repulsive parameter. Read more… Arguments Type Intent Optional Attributes Name class( QMR ), intent(in) :: self Mixing rule object. real(kind=pr), intent(in) :: n (:) Moles vector. real(kind=pr), intent(in) :: bi (:) Pure components repulsive parameters. real(kind=pr), intent(out) :: B Mixture repulsive parameter. real(kind=pr), intent(out) :: dBi (:) real(kind=pr), intent(out) :: dBij (:,:) procedure, public :: D1Mix => RKPR_D1mix public subroutine RKPR_D1mix (self, n, d1i, D1, dD1i, dD1ij) RKPR parameter mixing rule. Read more… Arguments Type Intent Optional Attributes Name class( QMR_RKPR ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: d1i (:) real(kind=pr), intent(out) :: D1 real(kind=pr), intent(out) :: dD1i (:) real(kind=pr), intent(out) :: dD1ij (:,:) procedure, public :: Dmix Attractive parameter mixing rule public subroutine Dmix (self, n, T, ai, daidt, daidt2, D, dDdT, dDdT2, dDi, dDidT, dDij) Attractive parameter mixing rule with quadratic mix. Read more… Arguments Type Intent Optional Attributes Name class( QMR ), intent(in) :: self Mixing rule object. real(kind=pr), intent(in) :: n (:) Moles vector [mol] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(in) :: ai (:) Pure components attractive parameters real(kind=pr), intent(in) :: daidt (:) real(kind=pr), intent(in) :: daidt2 (:) real(kind=pr), intent(out) :: D Mixture attractive parameter real(kind=pr), intent(out) :: dDdT real(kind=pr), intent(out) :: dDdT2 real(kind=pr), intent(out) :: dDi (:) real(kind=pr), intent(out) :: dDidT (:) real(kind=pr), intent(out) :: dDij (:,:)","tags":"","loc":"type/qmr_rkpr.html"},{"title":"GeModelTapenade – yaeos ","text":"type, public, abstract, extends( GeModel ) :: GeModelTapenade Components Type Visibility Attributes Name Initial type( Substances ), public :: components Substances contained in the module Type-Bound Procedures procedure, public :: excess_gibbs private subroutine excess_gibbs (self, n, t, Ge, GeT, GeT2, Gen, GeTn, Gen2) Excess Gibbs model generic interface Arguments Type Intent Optional Attributes Name class( GeModelTapenade ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: t real(kind=pr), intent(out), optional :: Ge real(kind=pr), intent(out), optional :: GeT real(kind=pr), intent(out), optional :: GeT2 real(kind=pr), intent(out), optional, dimension(size(n)) :: Gen real(kind=pr), intent(out), optional, dimension(size(n)) :: GeTn real(kind=pr), intent(out), optional :: Gen2 (size(n),size(n)) procedure( tapenade_ge ), public, deferred :: ge subroutine tapenade_ge(model, n, t, ge) Prototype Arguments Type Intent Optional Attributes Name class( GeModelTapenade ) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: t real(kind=pr), intent(out) :: ge procedure( tapenade_ge_b ), public, deferred :: ge_b subroutine tapenade_ge_b(model, n, nb, t, tb, ge, geb) Prototype Arguments Type Intent Optional Attributes Name class( GeModelTapenade ) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr) :: nb (:) real(kind=pr), intent(in) :: t real(kind=pr) :: tb real(kind=pr) :: ge real(kind=pr) :: geb procedure( tapenade_ge_d ), public, deferred :: ge_d subroutine tapenade_ge_d(model, n, nd, t, td, ge, ged) Prototype Arguments Type Intent Optional Attributes Name class( GeModelTapenade ) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: nd (:) real(kind=pr), intent(in) :: t real(kind=pr), intent(in) :: td real(kind=pr), intent(out) :: ge real(kind=pr), intent(out) :: ged procedure( tapenade_ge_d_b ), public, deferred :: ge_d_b subroutine tapenade_ge_d_b(model, n, nb, nd, ndb, t, tb, td, tdb, ge, geb, ged, gedb) Prototype Arguments Type Intent Optional Attributes Name class( GeModelTapenade ) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr) :: nb (:) real(kind=pr), intent(in) :: nd (:) real(kind=pr) :: ndb (:) real(kind=pr), intent(in) :: t real(kind=pr) :: tb real(kind=pr), intent(in) :: td real(kind=pr) :: tdb real(kind=pr) :: ge real(kind=pr) :: geb real(kind=pr) :: ged real(kind=pr) :: gedb procedure( tapenade_ge_d_d ), public, deferred :: ge_d_d subroutine tapenade_ge_d_d(model, n, nd, t, td0, td, ge, ged0, ged, gedd) Prototype Arguments Type Intent Optional Attributes Name class( GeModelTapenade ) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: nd (:) real(kind=pr), intent(in) :: t real(kind=pr), intent(in) :: td0 real(kind=pr), intent(in) :: td real(kind=pr), intent(out) :: ge real(kind=pr), intent(out) :: ged0 real(kind=pr), intent(out) :: ged real(kind=pr), intent(out) :: gedd procedure, public :: ln_activity_coefficient public subroutine ln_activity_coefficient (self, n, T, lngamma) Arguments Type Intent Optional Attributes Name class( GeModel ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: T real(kind=pr), intent(out) :: lngamma (:)","tags":"","loc":"type/gemodeltapenade.html"},{"title":"TMOptimizeData – yaeos ","text":"type, private :: TMOptimizeData Data structure to hold the data for the min_tpd optimization Components Type Visibility Attributes Name Initial real(kind=pr), public :: P real(kind=pr), public :: T real(kind=pr), public, allocatable :: di (:) class( ArModel ), public, pointer :: model real(kind=pr), public, allocatable :: z (:)","tags":"","loc":"type/tmoptimizedata.html"},{"title":"GeGCModelParameters – yaeos ","text":"type, public :: GeGCModelParameters GeGCModelParameters group contribution model parameters container Description Type to represent a UNIFAC like models parameters. The type must be\nprovided with the subgroups ids, maingroups ids, subgroups Rs,\nsubgroups Qs, subgroups maingroups, and maingroups interaction\nparameters. Specifically, the type requires , , and for the maingroups interaction parameters. In the case of\nthe classic UNIFAC model that only requires parameters, the and must be set as null matrixes.\nThe documentation and source code of yaeos UNIFACParameters function could be consulted to understand how to instantiate a GeGCModelParameters object with the classic liquid-vapor UNIFAC\nparameters defined in DDBST. References Dortmund Data Bank Software & Separation Technology Components Type Visibility Attributes Name Initial real(kind=pr), public, allocatable :: maingroups_aij (:,:) Maingroup interaction parameters matrix real(kind=pr), public, allocatable :: maingroups_bij (:,:) Maingroup interaction parameters matrix real(kind=pr), public, allocatable :: maingroups_cij (:,:) Maingroup interaction parameters matrix integer, public, allocatable :: maingroups_ids (:) ID of each model’s maingroup real(kind=pr), public, allocatable :: subgroups_Qs (:) value of each subgroup real(kind=pr), public, allocatable :: subgroups_Rs (:) value of each subgroup integer, public, allocatable :: subgroups_ids (:) ID of each model’s subgroup integer, public, allocatable :: subgroups_maingroups (:) Maingroup of each subgroup Type-Bound Procedures procedure, public :: get_maingroup_index public function get_maingroup_index (self, maingroup_id) result(maingroup_idx) Get index of the maingoup with id: maingoup_id Read more… Arguments Type Intent Optional Attributes Name class( GeGCModelParameters ) :: self integer, intent(in) :: maingroup_id ID of the subgroup Return Value integer Index of the maingroup on the self%maingroups_ids vector procedure, public :: get_maingroups_aij public function get_maingroups_aij (self, maingroup_i_id, maingroup_j_id) result(aij) Get the interaction parameter Read more… Arguments Type Intent Optional Attributes Name class( GeGCModelParameters ) :: self integer, intent(in) :: maingroup_i_id ID of the maingroup i integer, intent(in) :: maingroup_j_id ID of the maingroup j Return Value real(kind=pr) Interaction parameter procedure, public :: get_maingroups_bij public function get_maingroups_bij (self, maingroup_i_id, maingroup_j_id) result(bij) Get the interaction parameter Read more… Arguments Type Intent Optional Attributes Name class( GeGCModelParameters ) :: self integer, intent(in) :: maingroup_i_id ID of the maingroup i integer, intent(in) :: maingroup_j_id ID of the maingroup j Return Value real(kind=pr) Interaction parameter procedure, public :: get_maingroups_cij public function get_maingroups_cij (self, maingroup_i_id, maingroup_j_id) result(cij) Get the interaction parameter Read more… Arguments Type Intent Optional Attributes Name class( GeGCModelParameters ) :: self integer, intent(in) :: maingroup_i_id ID of the maingroup i integer, intent(in) :: maingroup_j_id ID of the maingroup j Return Value real(kind=pr) Interaction parameter procedure, public :: get_subgroup_Q public function get_subgroup_Q (self, subgroup_id) result(subgroup_Q) Get the subgroup’s value Read more… Arguments Type Intent Optional Attributes Name class( GeGCModelParameters ) :: self integer, intent(in) :: subgroup_id ID of the subgroup Return Value real(kind=pr) value of the subgroup procedure, public :: get_subgroup_R public function get_subgroup_R (self, subgroup_id) result(subgroup_R) Get the subgroup’s value Read more… Arguments Type Intent Optional Attributes Name class( GeGCModelParameters ) :: self integer, intent(in) :: subgroup_id ID of the subgroup Return Value real(kind=pr) value of the subgroup procedure, public :: get_subgroup_index public function get_subgroup_index (self, subgroup_id) result(subgroup_idx) Get index of the subgroup with id: subgroup_id Read more… Arguments Type Intent Optional Attributes Name class( GeGCModelParameters ) :: self integer, intent(in) :: subgroup_id ID of the subgroup Return Value integer Index of the subgroup on the self%subgroups_ids vector procedure, public :: get_subgroup_maingroup public function get_subgroup_maingroup (self, subgroup_id) result(subgroup_maingroup) Get the subgroup’s maingroup Read more… Arguments Type Intent Optional Attributes Name class( GeGCModelParameters ) :: self integer, intent(in) :: subgroup_id ID of the subgroup Return Value integer Maingroup of the subgroup procedure, public :: get_subgroups_aij public function get_subgroups_aij (self, subgroup_i_id, subgroup_j_id) result(aij) Get the interaction parameter Read more… Arguments Type Intent Optional Attributes Name class( GeGCModelParameters ) :: self integer, intent(in) :: subgroup_i_id ID of the subgroup i integer, intent(in) :: subgroup_j_id ID of the subgroup j Return Value real(kind=pr) Interaction parameter procedure, public :: get_subgroups_bij public function get_subgroups_bij (self, subgroup_i_id, subgroup_j_id) result(bij) Get the interaction parameter Read more… Arguments Type Intent Optional Attributes Name class( GeGCModelParameters ) :: self integer, intent(in) :: subgroup_i_id ID of the subgroup i integer, intent(in) :: subgroup_j_id ID of the subgroup j Return Value real(kind=pr) Interaction parameter procedure, public :: get_subgroups_cij public function get_subgroups_cij (self, subgroup_i_id, subgroup_j_id) result(cij) Get the interaction parameter Read more… Arguments Type Intent Optional Attributes Name class( GeGCModelParameters ) :: self integer, intent(in) :: subgroup_i_id ID of the subgroup i integer, intent(in) :: subgroup_j_id ID of the subgroup j Return Value real(kind=pr) Interaction parameter","tags":"","loc":"type/gegcmodelparameters.html"},{"title":"BaseModel – yaeos ","text":"type, public, abstract :: BaseModel Base model type. Contains the important parts of most models and other procedures. Components Type Visibility Attributes Name Initial type( Substances ), public :: components Substances contained in the module","tags":"","loc":"type/basemodel.html"},{"title":"Ares – yaeos","text":"interface public subroutine Ares(z, v, t, Ar, ArV, ArTV, ArV2, Arn, ArVn, ArTn, Arn2) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: z (:) real(kind=pr), intent(in) :: v real(kind=pr), intent(in) :: t real(kind=pr), intent(out) :: Ar real(kind=pr), intent(out) :: ArV real(kind=pr), intent(out) :: ArTV real(kind=pr), intent(out) :: ArV2 real(kind=pr), intent(out), dimension(size(z)) :: Arn real(kind=pr), intent(out), dimension(size(z)) :: ArVn real(kind=pr), intent(out), dimension(size(z)) :: ArTn real(kind=pr), intent(out) :: Arn2 (size(z),size(z))","tags":"","loc":"interface/ares.html"},{"title":"initial_volume – yaeos","text":"interface public function initial_volume(z, p, t) Arguments Type Intent Optional Attributes Name real(kind=pr) :: z (:) real(kind=pr) :: p real(kind=pr) :: t Return Value real(kind=pr)","tags":"","loc":"interface/initial_volume.html"},{"title":"model_from_X – yaeos","text":"interface public subroutine model_from_X(problem, X) Arguments Type Intent Optional Attributes Name class( FittingProblem ), intent(inout) :: problem Fitting problem to optimize real(kind=pr), intent(in) :: X (:) Vector of parameters to fit Description Function that returns a setted model from the parameters vector","tags":"","loc":"interface/model_from_x.html"},{"title":"abs_Bmix – yaeos","text":"interface public subroutine abs_Bmix(self, n, bi, B, dBi, dBij) Arguments Type Intent Optional Attributes Name class( CubicMixRule ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: bi (:) real(kind=pr), intent(out) :: B real(kind=pr), intent(out) :: dBi (:) real(kind=pr), intent(out) :: dBij (:,:)","tags":"","loc":"interface/abs_bmix.html"},{"title":"abs_D1mix – yaeos","text":"interface public subroutine abs_D1mix(self, n, d1i, D1, dD1i, dD1ij) Arguments Type Intent Optional Attributes Name class( CubicMixRule ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: d1i (:) real(kind=pr), intent(out) :: D1 real(kind=pr), intent(out) :: dD1i (:) real(kind=pr), intent(out) :: dD1ij (:,:)","tags":"","loc":"interface/abs_d1mix.html"},{"title":"abs_Dmix – yaeos","text":"interface public subroutine abs_Dmix(self, n, T, ai, daidt, daidt2, D, dDdT, dDdT2, dDi, dDidT, dDij) Arguments Type Intent Optional Attributes Name class( CubicMixRule ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: T real(kind=pr), intent(in) :: ai (:) real(kind=pr), intent(in) :: daidt (:) real(kind=pr), intent(in) :: daidt2 (:) real(kind=pr), intent(out) :: D real(kind=pr), intent(out) :: dDdT real(kind=pr), intent(out) :: dDdT2 real(kind=pr), intent(out) :: dDi (:) real(kind=pr), intent(out) :: dDidT (:) real(kind=pr), intent(out) :: dDij (:,:)","tags":"","loc":"interface/abs_dmix.html"},{"title":"abs_alpha – yaeos","text":"interface public subroutine abs_alpha(self, Tr, a, dadt, dadt2) Arguments Type Intent Optional Attributes Name class( AlphaFunction ), intent(in) :: self real(kind=pr), intent(in) :: Tr (:) real(kind=pr), intent(out) :: a (:) real(kind=pr), intent(out) :: dadt (:) real(kind=pr), intent(out) :: dadt2 (:)","tags":"","loc":"interface/abs_alpha.html"},{"title":"tapenade_ar – yaeos","text":"interface private subroutine tapenade_ar(model, n, v, t, arval) Arguments Type Intent Optional Attributes Name class( ArModelTapenade ), intent(in) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: v real(kind=pr), intent(in) :: t real(kind=pr), intent(out) :: arval","tags":"","loc":"interface/tapenade_ar.html"},{"title":"tapenade_ar_b – yaeos","text":"interface private subroutine tapenade_ar_b(model, n, nb, v, vb, t, tb, arval, arvalb) Arguments Type Intent Optional Attributes Name class( ArModelTapenade ), intent(in) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr) :: nb (:) real(kind=pr), intent(in) :: v real(kind=pr) :: vb real(kind=pr), intent(in) :: t real(kind=pr) :: tb real(kind=pr) :: arval real(kind=pr) :: arvalb","tags":"","loc":"interface/tapenade_ar_b.html"},{"title":"tapenade_ar_d – yaeos","text":"interface private subroutine tapenade_ar_d(model, n, nd, v, vd, t, td, arval, arvald) Arguments Type Intent Optional Attributes Name class( ArModelTapenade ), intent(in) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: nd (:) real(kind=pr), intent(in) :: v real(kind=pr), intent(in) :: vd real(kind=pr), intent(in) :: t real(kind=pr), intent(in) :: td real(kind=pr), intent(out) :: arval real(kind=pr), intent(out) :: arvald","tags":"","loc":"interface/tapenade_ar_d.html"},{"title":"tapenade_ar_d_b – yaeos","text":"interface private subroutine tapenade_ar_d_b(model, n, nb, nd, ndb, v, vb, vd, vdb, t, tb, td, tdb, arval, arvalb, arvald, arvaldb) Arguments Type Intent Optional Attributes Name class( ArModelTapenade ), intent(in) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr) :: nb (:) real(kind=pr), intent(in) :: nd (:) real(kind=pr) :: ndb (:) real(kind=pr), intent(in) :: v real(kind=pr) :: vb real(kind=pr), intent(in) :: vd real(kind=pr) :: vdb real(kind=pr), intent(in) :: t real(kind=pr) :: tb real(kind=pr), intent(in) :: td real(kind=pr) :: tdb real(kind=pr) :: arval real(kind=pr) :: arvalb real(kind=pr) :: arvald real(kind=pr) :: arvaldb","tags":"","loc":"interface/tapenade_ar_d_b.html"},{"title":"tapenade_ar_d_d – yaeos","text":"interface private subroutine tapenade_ar_d_d(model, n, nd, v, vd0, vd, t, td0, td, arval, arvald0, arvald, arvaldd) Arguments Type Intent Optional Attributes Name class( ArModelTapenade ), intent(in) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: nd (:) real(kind=pr), intent(in) :: v real(kind=pr), intent(in) :: vd0 real(kind=pr), intent(in) :: vd real(kind=pr), intent(in) :: t real(kind=pr), intent(in) :: td0 real(kind=pr), intent(in) :: td real(kind=pr), intent(out) :: arval real(kind=pr), intent(out) :: arvald0 real(kind=pr), intent(out) :: arvald real(kind=pr), intent(out) :: arvaldd","tags":"","loc":"interface/tapenade_ar_d_d.html"},{"title":"tapenade_v0 – yaeos","text":"interface private pure function tapenade_v0(model, n, p, t) Arguments Type Intent Optional Attributes Name class( ArModelTapenade ), intent(in) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: p real(kind=pr), intent(in) :: t Return Value real(kind=pr)","tags":"","loc":"interface/tapenade_v0.html"},{"title":"excess_gibbs – yaeos","text":"interface public subroutine excess_gibbs(self, n, t, Ge, GeT, GeT2, Gen, GeTn, Gen2) Arguments Type Intent Optional Attributes Name class( GeModel ), intent(in) :: self Model real(kind=pr), intent(in) :: n (:) Moles vector real(kind=pr), intent(in) :: t Temperature [K] real(kind=pr), intent(out), optional :: Ge Excess Gibbs real(kind=pr), intent(out), optional :: GeT real(kind=pr), intent(out), optional :: GeT2 real(kind=pr), intent(out), optional :: Gen (size(n)) real(kind=pr), intent(out), optional :: GeTn (size(n)) real(kind=pr), intent(out), optional :: Gen2 (size(n),size(n)) Description Excess Gibbs and derivs procedure","tags":"","loc":"interface/excess_gibbs.html"},{"title":"abs_optimize – yaeos","text":"interface public subroutine abs_optimize(self, foo, X, F, data) Arguments Type Intent Optional Attributes Name class( Optimizer ), intent(inout) :: self procedure( obj_func ) :: foo real(kind=pr), intent(inout) :: X (:) real(kind=pr), intent(out) :: F class(*), intent(inout), optional, target :: data","tags":"","loc":"interface/abs_optimize.html"},{"title":"obj_func – yaeos","text":"interface public subroutine obj_func(X, F, dF, data) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: X (:) real(kind=pr), intent(out) :: F real(kind=pr), intent(out), optional :: dF (:) class(*), intent(inout), optional :: data","tags":"","loc":"interface/obj_func.html"},{"title":"temperature_dependence – yaeos","text":"interface public subroutine temperature_dependence(self, systems_groups, T, psi, dpsi_dt, dpsi_dt2) Arguments Type Intent Optional Attributes Name class( PsiFunction ) :: self PsiFunction type variable class( Groups ) :: systems_groups Groups type variable containig all the system’s groups. See the groups_stew variable on the UNIFAC documentation. real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out), optional :: psi (:,:) real(kind=pr), intent(out), optional :: dpsi_dt (:,:) real(kind=pr), intent(out), optional :: dpsi_dt2 (:,:) Description temperature_dependence interface Interface subroutine for UNIFAC models temperature dependent\nfunctions","tags":"","loc":"interface/temperature_dependence.html"},{"title":"continuation_function – yaeos","text":"interface public subroutine continuation_function(X, ns, S, F, dF, dFdS) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: X (:) integer, intent(in) :: ns real(kind=pr), intent(in) :: S real(kind=pr), intent(out) :: F (:) real(kind=pr), intent(out) :: dF (:,:) real(kind=pr), intent(out) :: dFdS (:)","tags":"","loc":"interface/continuation_function.html"},{"title":"continuation_solver – yaeos","text":"interface public subroutine continuation_solver(fun, iters, X, ns, S, dS, dXdS, point, max_iters, F, df, dfds, tol) Arguments Type Intent Optional Attributes Name procedure( continuation_function ) :: fun Function to solve integer, intent(out) :: iters Number of iterations needed real(kind=pr), intent(inout) :: X (:) Variables vector integer, intent(in) :: ns Specification number real(kind=pr), intent(in) :: S Specification value real(kind=pr), intent(in) :: dS Delta spec real(kind=pr), intent(in) :: dXdS (:) integer, intent(in) :: point Point number integer, intent(in) :: max_iters Maximum iterations real(kind=pr), intent(out) :: F (:) Function values at solved point real(kind=pr), intent(out) :: df (:,:) Jacobian values real(kind=pr), intent(out) :: dfds (:) dFdS real(kind=pr), intent(in) :: tol Solver tolerance Description Solver to solve a point during numerical contination.","tags":"","loc":"interface/continuation_solver.html"},{"title":"continuation_stopper – yaeos","text":"interface public function continuation_stopper(X, ns, S, dS, dXdS, iterations) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(inout) :: X (:) Vector of variables integer, intent(inout) :: ns Position of specified variable real(kind=pr), intent(inout) :: S Specification variable value real(kind=pr), intent(inout) :: dS Step of specification in the method real(kind=pr), intent(inout) :: dXdS (:) integer, intent(in) :: iterations Iterations needed to converge point Return Value logical Description Function that returns true if the method should stop","tags":"","loc":"interface/continuation_stopper.html"},{"title":"process – yaeos","text":"interface public subroutine process(X, ns, S, dS, dXdS, iterations) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(inout) :: X (:) Vector of variables integer, intent(inout) :: ns Position of specified variable real(kind=pr), intent(inout) :: S Specification variable value real(kind=pr), intent(inout) :: dS Step of specification in the method real(kind=pr), intent(inout) :: dXdS (:) integer, intent(in) :: iterations Iterations needed to converge point Description Subroutine to make variation in the method after a point converged","tags":"","loc":"interface/process.html"},{"title":"f_1d – yaeos","text":"interface public subroutine f_1d(x, f, df) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: x real(kind=pr), intent(out) :: f real(kind=pr), intent(out) :: df","tags":"","loc":"interface/f_1d.html"},{"title":"hyperdual_Ar – yaeos","text":"interface public function hyperdual_Ar(self, n, v, t) Arguments Type Intent Optional Attributes Name class( ArModelAdiff ) :: self type( hyperdual ), intent(in) :: n (:) type( hyperdual ), intent(in) :: v type( hyperdual ), intent(in) :: t Return Value type( hyperdual )","tags":"","loc":"interface/hyperdual_ar.html"},{"title":"abs_residual_helmholtz – yaeos","text":"interface public subroutine abs_residual_helmholtz(self, n, v, t, Ar, ArV, ArT, ArTV, ArV2, ArT2, Arn, ArVn, ArTn, Arn2) Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: self ArModel real(kind=pr), intent(in) :: n (:) Moles vector real(kind=pr), intent(in) :: v Volume [L] real(kind=pr), intent(in) :: t Temperature [K] real(kind=pr), intent(out), optional :: Ar Residual Helmoltz energy real(kind=pr), intent(out), optional :: ArV real(kind=pr), intent(out), optional :: ArT real(kind=pr), intent(out), optional :: ArTV real(kind=pr), intent(out), optional :: ArV2 real(kind=pr), intent(out), optional :: ArT2 real(kind=pr), intent(out), optional :: Arn (size(n)) real(kind=pr), intent(out), optional :: ArVn (size(n)) real(kind=pr), intent(out), optional :: ArTn (size(n)) real(kind=pr), intent(out), optional :: Arn2 (size(n),size(n)) Description Residual Helmholtz model generic interface. This interface represents how an Ar model should be implemented.\nBy our standard, a Resiudal Helmholtz model takes as input: The mixture’s number of moles vector. Volume, by default in liters. Temperature, by default in Kelvin. All the output arguments are optional. While this keeps a long\nsignature for the implementation, this is done this way to take\nadvantage of any inner optimizations to calculate derivatives\ninside the procedure. Once the model is implemented, the signature can be short like model%residual_helmholtz(n, v, t, ArT2=dArdT2)","tags":"","loc":"interface/abs_residual_helmholtz.html"},{"title":"abs_volume_initializer – yaeos","text":"interface public function abs_volume_initializer(self, n, p, t) Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: self Ar Model real(kind=pr), intent(in) :: n (:) Moles vector real(kind=pr), intent(in) :: p Pressure [bar] real(kind=pr), intent(in) :: t Temperature [K] Return Value real(kind=pr) Initial volume [L] Description Function that provides an initializer value for the liquid-root\nof newton solver of volume. In the case the model will use the volume_michelsen routine this value should provide the co-volume\nof the model.","tags":"","loc":"interface/abs_volume_initializer.html"},{"title":"get_aij – yaeos","text":"interface public subroutine get_aij(self, T, ai, daidt, daidt2, aij, daijdt, daijdt2) Arguments Type Intent Optional Attributes Name class( QMR ), intent(in) :: self real(kind=pr), intent(in) :: T real(kind=pr), intent(in) :: ai (:) real(kind=pr), intent(in) :: daidt (:) real(kind=pr), intent(in) :: daidt2 (:) real(kind=pr), intent(out) :: aij (:,:) real(kind=pr), intent(out) :: daijdt (:,:) real(kind=pr), intent(out) :: daijdt2 (:,:) Description Combining rule for the attractive parameter. From previously calculated attractive parameters calculate the matrix and it’s corresponding derivatives.","tags":"","loc":"interface/get_aij.html"},{"title":"tapenade_ge – yaeos","text":"interface private subroutine tapenade_ge(model, n, t, ge) Arguments Type Intent Optional Attributes Name class( GeModelTapenade ) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: t real(kind=pr), intent(out) :: ge","tags":"","loc":"interface/tapenade_ge.html"},{"title":"tapenade_ge_b – yaeos","text":"interface private subroutine tapenade_ge_b(model, n, nb, t, tb, ge, geb) Arguments Type Intent Optional Attributes Name class( GeModelTapenade ) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr) :: nb (:) real(kind=pr), intent(in) :: t real(kind=pr) :: tb real(kind=pr) :: ge real(kind=pr) :: geb","tags":"","loc":"interface/tapenade_ge_b.html"},{"title":"tapenade_ge_d – yaeos","text":"interface private subroutine tapenade_ge_d(model, n, nd, t, td, ge, ged) Arguments Type Intent Optional Attributes Name class( GeModelTapenade ) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: nd (:) real(kind=pr), intent(in) :: t real(kind=pr), intent(in) :: td real(kind=pr), intent(out) :: ge real(kind=pr), intent(out) :: ged","tags":"","loc":"interface/tapenade_ge_d.html"},{"title":"tapenade_ge_d_b – yaeos","text":"interface private subroutine tapenade_ge_d_b(model, n, nb, nd, ndb, t, tb, td, tdb, ge, geb, ged, gedb) Arguments Type Intent Optional Attributes Name class( GeModelTapenade ) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr) :: nb (:) real(kind=pr), intent(in) :: nd (:) real(kind=pr) :: ndb (:) real(kind=pr), intent(in) :: t real(kind=pr) :: tb real(kind=pr), intent(in) :: td real(kind=pr) :: tdb real(kind=pr) :: ge real(kind=pr) :: geb real(kind=pr) :: ged real(kind=pr) :: gedb","tags":"","loc":"interface/tapenade_ge_d_b.html"},{"title":"tapenade_ge_d_d – yaeos","text":"interface private subroutine tapenade_ge_d_d(model, n, nd, t, td0, td, ge, ged0, ged, gedd) Arguments Type Intent Optional Attributes Name class( GeModelTapenade ) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: nd (:) real(kind=pr), intent(in) :: t real(kind=pr), intent(in) :: td0 real(kind=pr), intent(in) :: td real(kind=pr), intent(out) :: ge real(kind=pr), intent(out) :: ged0 real(kind=pr), intent(out) :: ged real(kind=pr), intent(out) :: gedd","tags":"","loc":"interface/tapenade_ge_d_d.html"},{"title":"pt_envelope_2ph – yaeos","text":"public function pt_envelope_2ph(model, z, first_point, points, iterations, delta_0, specified_variable_0, solver, stop_conditions) result(envelopes) Uses stdlib_optval PT two-phase envelope calculation procedure. Phase envelope calculation using the continuation method.\nDefaults to solving the saturation temperature and continues with\nan increment in it. The variable to specify can be changed by modifying specified_variable_0 with the corresponding variable number. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: model Thermodyanmic model real(kind=pr), intent(in) :: z (:) Vector of molar fractions type( EquilibriumState ) :: first_point integer, intent(in), optional :: points Maxmimum number of points, defaults to 500 integer, intent(in), optional :: iterations Point solver maximum iterations, defaults to 100 real(kind=pr), intent(in), optional :: delta_0 Initial extrapolation integer, intent(in), optional :: specified_variable_0 Position of specified variable, since the vector of variables is the values for specification\nwill be for the equilibria constants, for and for . procedure( continuation_solver ), optional :: solver Specify solver for each point, defaults to a full newton procedure procedure( continuation_stopper ), optional :: stop_conditions Function that returns true if the continuation method should stop Return Value type( PTEnvel2 ) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: S0 Initial specification value real(kind=pr), public :: X (size(z)+2) Vector of variables used in the continuation method real(kind=pr), public, allocatable :: XS (:,:) All the calculated variables that are returned on the continuation\nmethod procedure (unused since each point is saved on the fly) real(kind=pr), public :: dS0 Initial specification step character(len=14), public :: kind integer, public :: max_iterations Maximum number of iterations integer, public :: max_points Maximum number of points integer, public :: nc Number of components integer, public :: ns Number of specified variable Subroutines subroutine detect_critical (X, dXdS, ns, S, dS) Critical point detection Read more… Arguments Type Intent Optional Attributes Name real(kind=pr), intent(inout) :: X (:) Vector of variables real(kind=pr), intent(inout) :: dXdS (:) Variation of variables wrt S integer, intent(inout) :: ns Number of specified variable real(kind=pr), intent(inout) :: S Specification value real(kind=pr), intent(inout) :: dS Step in specification subroutine foo (X, ns, S, F, dF, dFdS) Function that needs to be solved at each envelope point Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: X (:) integer, intent(in) :: ns real(kind=pr), intent(in) :: S real(kind=pr), intent(out) :: F (:) real(kind=pr), intent(out) :: dF (:,:) real(kind=pr), intent(out) :: dFdS (:) subroutine save_point (X, iters) Save the converged point Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: X (:) integer, intent(in) :: iters subroutine update_spec (X, ns, S, dS, dXdS, step_iters) Update the specification during continuation. Arguments Type Intent Optional Attributes Name real(kind=pr), intent(inout) :: X (:) Vector of variables integer, intent(inout) :: ns Number of specified variable in the vector real(kind=pr), intent(inout) :: S Variable specification value real(kind=pr), intent(inout) :: dS Step in specification real(kind=pr), intent(inout) :: dXdS (:) Variation of variables with respect to specification integer, intent(in) :: step_iters Iterations used in the solver","tags":"","loc":"proc/pt_envelope_2ph.html"},{"title":"write_PTEnvel2 – yaeos","text":"public subroutine write_PTEnvel2(pt2, unit, iotype, v_list, iostat, iomsg) Type Bound PTEnvel2 Arguments Type Intent Optional Attributes Name class( PTEnvel2 ), intent(in) :: pt2 integer, intent(in) :: unit character(len=*), intent(in) :: iotype integer, intent(in) :: v_list (:) integer, intent(out) :: iostat character(len=*), intent(inout) :: iomsg Variables Type Visibility Attributes Name Initial integer, public :: cp integer, public, allocatable :: cps (:) integer, public :: i integer, public :: nc","tags":"","loc":"proc/write_ptenvel2.html"},{"title":"ar_consistency – yaeos","text":"public subroutine ar_consistency(eos, n, V, T, eq31, eq33, eq34, eq36, eq37) ar_consistency models consistency tests. Description The evaluated equations are taken from Fundamentals & Computational\nAspects 2 ed. by Michelsen and Mollerup Chapter 2 section 3. The\n“eq” are evaluations of the left hand side of the following\nexpressions: Equation 31: Equation 33: Equation 34: Equation 36: Equation 37: The consistency test could be applied to any instantiated ArModel as shown in the following example. Examples use yaeos , only : pr , SoaveRedlichKwong , ArModel use yaeos__consistency_armodel , only : ar_consistency class ( ArModel ), allocatable :: model real ( pr ) :: tc ( 4 ), pc ( 4 ), w ( 4 ) real ( pr ) :: n ( 4 ), T , V real ( pr ) :: eq31 , eq33 ( size ( n ), size ( n )), eq34 ( size ( n )), eq36 , eq37 n = [ 1.5 , 0.2 , 0.7 , 2.3 ] tc = [ 19 0.564 , 42 5.12 , 30 0.11 , 32 0.25 ] pc = [ 4 5.99 , 3 7.96 , 3 9.23 , 4 0.21 ] w = [ 0.0115478 , 0.200164 , 0.3624 , 0.298 ] T = 600_pr V = 0.5_pr model = SoaveRedlichKwong ( tc , pc , w ) call ar_consistency (& model , n , V , T , eq31 = eq31 , eq33 = eq33 , eq34 = eq34 , eq36 = eq36 , eq37 = eq37 & ) All eqXX variables should be close to zero. References Michelsen, M. L., & Mollerup, J. M. (2007). Thermodynamic models:\nFundamentals & computational aspects (2. ed). Tie-Line Publications. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Equation of state real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: V Volume [L] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out), optional :: eq31 MM Eq. 31 real(kind=pr), intent(out), optional :: eq33 (size(n),size(n)) MM Eq. 33 real(kind=pr), intent(out), optional :: eq34 (size(n)) MM Eq. 34 real(kind=pr), intent(out), optional :: eq36 MM Eq. 36 real(kind=pr), intent(out), optional :: eq37 MM Eq. 37 Variables Type Visibility Attributes Name Initial real(kind=pr), public :: Grp real(kind=pr), public :: Grv real(kind=pr), public :: Hrv real(kind=pr), public :: P real(kind=pr), public :: dPdn (size(n)) real(kind=pr), public :: dlnPhidP (size(n)) real(kind=pr), public :: dlnPhidT (size(n)) real(kind=pr), public :: dlnPhidn (size(n),size(n)) integer, public :: i integer, public :: j real(kind=pr), public :: lnphi (size(n)) real(kind=pr), public :: ntot real(kind=pr), public :: z","tags":"","loc":"proc/ar_consistency.html"},{"title":"numeric_ar_derivatives – yaeos","text":"public subroutine numeric_ar_derivatives(eos, n, V, T, d_n, d_v, d_t, Ar, ArV, ArT, Arn, ArV2, ArT2, ArTV, ArVn, ArTn, Arn2) numeric_ar_derivatives Evaluate the Helmholtz derivatives with central finite difference. Description Tool to facilitate the development of new ArModel by testing\nthe implementation of analytic derivatives. Examples use yaeos , only : pr , SoaveRedlichKwong , ArModel use yaeos__consistency_armodel , only : numeric_ar_derivatives class ( ArModel ), allocatable :: model real ( pr ) :: tc ( 4 ), pc ( 4 ), w ( 4 ) real ( pr ) :: n ( 4 ), T , V real ( pr ) :: Ar_num , ArV_num , ArT_num , Arn_num ( size ( n )), ArV2_num , ArT2_num real ( pr ) :: ArTV_num , ArVn_num ( size ( n )), ArTn_num ( size ( n )) real ( pr ) :: Arn2_num ( size ( n ), size ( n )) n = [ 1.5 , 0.2 , 0.7 , 2.3 ] tc = [ 19 0.564 , 42 5.12 , 30 0.11 , 32 0.25 ] pc = [ 4 5.99 , 3 7.96 , 3 9.23 , 4 0.21 ] w = [ 0.0115478 , 0.200164 , 0.3624 , 0.298 ] T = 600_pr V = 0.5_pr model = SoaveRedlichKwong ( tc , pc , w ) call numeric_ar_derivatives (& model , n , V , T , d_n = 0.0001_pr , d_v = 0.0001_pr , d_t = 0.01_pr , & Ar = Ar_num , ArV = ArV_num , ArT = ArT_num , ArTV = ArTV_num , ArV2 = ArV2_num , & ArT2 = ArT2_num , Arn = Arn_num , ArVn = ArVn_num , ArTn = ArTn_num , & Arn2 = Arn2_num & ) Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Equation of state real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: V Volume [L] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(in) :: d_n Moles finite difference step real(kind=pr), intent(in) :: d_v Volume finite difference step real(kind=pr), intent(in) :: d_t Temperature finite difference step real(kind=pr), intent(out) :: Ar Residual Helmoltz energy real(kind=pr), intent(out), optional :: ArV real(kind=pr), intent(out), optional :: ArT real(kind=pr), intent(out), optional :: Arn (size(n)) real(kind=pr), intent(out), optional :: ArV2 real(kind=pr), intent(out), optional :: ArT2 real(kind=pr), intent(out), optional :: ArTV real(kind=pr), intent(out), optional :: ArVn (size(n)) real(kind=pr), intent(out), optional :: ArTn (size(n)) real(kind=pr), intent(out), optional :: Arn2 (size(n),size(n)) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: Ar_aux1 real(kind=pr), public :: Ar_aux2 real(kind=pr), public :: Ar_aux3 real(kind=pr), public :: Ar_aux4 real(kind=pr), public :: dn_aux1 (size(n)) real(kind=pr), public :: dn_aux2 (size(n)) integer, public :: i integer, public :: j","tags":"","loc":"proc/numeric_ar_derivatives.html"},{"title":"bmix_linear – yaeos","text":"public pure subroutine bmix_linear(n, bi, b, dbi, dbij) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: bi (:) real(kind=pr), intent(out) :: b real(kind=pr), intent(out) :: dbi (:) real(kind=pr), intent(out) :: dbij (:,:)","tags":"","loc":"proc/bmix_linear.html"},{"title":"bmix_qmr – yaeos","text":"public pure subroutine bmix_qmr(n, bi, lij, b, dbi, dbij) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: bi (:) real(kind=pr), intent(in) :: lij (:,:) real(kind=pr), intent(out) :: b real(kind=pr), intent(out) :: dbi (:) real(kind=pr), intent(out) :: dbij (:,:) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: aux (size(n)) real(kind=pr), public :: bij (size(n),size(n)) integer, public :: i integer, public :: j integer, public :: nc real(kind=pr), public :: totn","tags":"","loc":"proc/bmix_qmr.html"},{"title":"d1mix_rkpr – yaeos","text":"public pure subroutine d1mix_rkpr(n, d1i, D1, dD1i, dD1ij) RKPR parameter mixing rule. The RKPR EoS doesn’t have a constant value for each \ncomponent, so a proper mixing rule should be provided. A linear\ncombination is used. Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: d1i (:) real(kind=pr), intent(out) :: D1 real(kind=pr), intent(out) :: dD1i (:) real(kind=pr), intent(out) :: dD1ij (:,:) Variables Type Visibility Attributes Name Initial integer, public :: i integer, public :: j integer, public :: nc real(kind=pr), public :: totn","tags":"","loc":"proc/d1mix_rkpr.html"},{"title":"pressure_equality_V_beta_xy – yaeos","text":"public subroutine pressure_equality_V_beta_xy(model, T, V, beta, x, y, Vx, Vy, P) Uses iso_fortran_env Solve pressure equality between two phases at a given temperature,\ntotal volume, vapor molar fractions and compositions. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: model real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(in) :: V Total volume [L/mol] real(kind=pr), intent(in) :: beta Molar fraction of light-phase real(kind=pr), intent(in) :: x (:) Molar fractions of heavy-phase real(kind=pr), intent(in) :: y (:) Molar fractions of light-phase real(kind=pr), intent(inout) :: Vx Heavy-phase molar volume [L/mol] real(kind=pr), intent(inout) :: Vy Light-Phase molar volume [L/mol] real(kind=pr), intent(out) :: P Pressure [bar] Variables Type Visibility Attributes Name Initial real(kind=pr), public :: Bx Liquid phase covolume real(kind=pr), public :: Px real(kind=pr), public :: Py real(kind=pr), public :: dPxdV real(kind=pr), public :: dPydV real(kind=pr), public :: dVydVx Derivative of Vy wrt Vx real(kind=pr), public :: dh dh/ real(kind=pr), public :: h Pressure equality integer, public :: its real(kind=pr), public :: stepv","tags":"","loc":"proc/pressure_equality_v_beta_xy.html"},{"title":"saturation_pressure – yaeos","text":"public function saturation_pressure(model, n, t, kind, p0, y0, max_iters) Uses stdlib_optval Saturation pressure calculation function. Calculates the saturation pressure of a multicomponent mixture with\na given molar composition n .\nIt is possible to calculate: Bubble point: kind=\"bubble\" Dew point: kind=\"dew\" Liquid-Liquid point: kind=\"liquid-liquid\" Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: model real(kind=pr), intent(in) :: n (:) Composition vector [moles / molar fraction] real(kind=pr), intent(in) :: t Temperature [K] character(len=*), intent(in) :: kind [bubble|dew|liquid-liquid] real(kind=pr), intent(in), optional :: p0 Initial pressure [bar] real(kind=pr), intent(in), optional :: y0 (:) Initial composition integer, intent(in), optional :: max_iters Maximum number of iterations Return Value type( EquilibriumState ) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: dlnphi_dp_y (size(n)) real(kind=pr), public :: dlnphi_dp_z (size(n)) real(kind=pr), public :: f integer, public :: i character(len=50), public :: incipient integer, public :: iterations integer, public :: its real(kind=pr), public :: k (size(n)) real(kind=pr), public :: lnfug_y (size(n)) real(kind=pr), public :: lnfug_z (size(n)) real(kind=pr), public :: lnk (size(n)) character(len=50), public :: main real(kind=pr), public :: p real(kind=pr), public :: step real(kind=pr), public :: vy real(kind=pr), public :: vz real(kind=pr), public :: y (size(n)) real(kind=pr), public :: z (size(n))","tags":"","loc":"proc/saturation_pressure.html"},{"title":"saturation_temperature – yaeos","text":"public function saturation_temperature(model, n, p, kind, t0, y0, max_iters) Uses stdlib_optval Saturation temperature calculation function. Calculates the saturation pressure of a multicomponent mixture with\na given molar composition n .\nIt is possible to calculate: Bubble point: kind=\"bubble\" Dew point: kind=\"dew\" Liquid-Liquid point: kind=\"liquid-liquid\" Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: model real(kind=pr), intent(in) :: n (:) Composition vector [moles / molar fraction] real(kind=pr), intent(in) :: p Pressure [bar] character(len=*), intent(in) :: kind [bubble|dew|liquid-liquid] real(kind=pr), intent(in), optional :: t0 Initial temperature [K] real(kind=pr), intent(in), optional :: y0 (:) Initial composition integer, intent(in), optional :: max_iters Maximum number of iterations Return Value type( EquilibriumState ) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: dlnphi_dt_y (size(n)) real(kind=pr), public :: dlnphi_dt_z (size(n)) real(kind=pr), public :: f character(len=50), public :: incipient logical, public :: is_incipient (size(n)) integer, public :: iterations integer, public :: its real(kind=pr), public :: k (size(n)) real(kind=pr), public :: lnfug_y (size(n)) real(kind=pr), public :: lnfug_z (size(n)) real(kind=pr), public :: lnk (size(n)) character(len=50), public :: main real(kind=pr), public :: step real(kind=pr), public :: t real(kind=pr), public :: vy real(kind=pr), public :: vz real(kind=pr), public :: y (size(n)) real(kind=pr), public :: z (size(n))","tags":"","loc":"proc/saturation_temperature.html"},{"title":"px_envelope_2ph – yaeos","text":"public function px_envelope_2ph(model, z0, alpha0, z_injection, first_point, points, iterations, delta_0, specified_variable_0, solver, stop_conditions) result(envelopes) Uses stdlib_optval PX two-phase envelope calculation procedure. Phase envelope calculation using the continuation method.\nDefaults to solving the saturation temperature and continues with\nan increment in it. The variable to specify can be changed by modifying specified_variable_0 with the corresponding variable number. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: model Thermodyanmic model real(kind=pr), intent(in) :: z0 (:) Vector of molar fractions of the global composition (main phase) real(kind=pr), intent(in) :: alpha0 First point of real(kind=pr), intent(in) :: z_injection (:) Vector of molar fractions of the injection fluid type( EquilibriumState ) :: first_point integer, intent(in), optional :: points Maxmimum number of points, defaults to 500 integer, intent(in), optional :: iterations Point solver maximum iterations, defaults to 100 real(kind=pr), intent(in), optional :: delta_0 Initial extrapolation integer, intent(in), optional :: specified_variable_0 Position of specified variable, since the vector of variables is the values for specification\nwill be for the equilibria constants, for and for . procedure( continuation_solver ), optional :: solver Specify solver for each point, defaults to a full newton procedure procedure( continuation_stopper ), optional :: stop_conditions Function that returns true if the continuation method should stop Return Value type( PXEnvel2 ) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: S0 Initial specification value real(kind=pr), public :: T real(kind=pr), public :: X (size(z)+2) real(kind=pr), public, allocatable :: XS (:,:) real(kind=pr), public :: dS0 Initial specification step character(len=14), public :: kind integer, public :: max_iterations Maximum number of iterations integer, public :: max_points Maximum number of points integer, public :: nc Number of components integer, public :: ns Number of specified variable real(kind=pr), public :: z (size(z0)) Composition at some point Subroutines subroutine detect_critical (X, dXdS, ns, S, dS) Critical point detection Read more… Arguments Type Intent Optional Attributes Name real(kind=pr), intent(inout) :: X (:) Vector of variables real(kind=pr), intent(inout) :: dXdS (:) Variation of variables wrt S integer, intent(inout) :: ns Number of specified variable real(kind=pr), intent(inout) :: S Specification value real(kind=pr), intent(inout) :: dS Step in specification recursive subroutine foo (X, ns, S, F, dF, dFdS) Function that needs to be solved at each envelope point Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: X (:) integer, intent(in) :: ns real(kind=pr), intent(in) :: S real(kind=pr), intent(out) :: F (:) real(kind=pr), intent(out) :: dF (:,:) real(kind=pr), intent(out) :: dFdS (:) subroutine save_point (X, iters) Save the converged point Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: X (:) integer, intent(in) :: iters subroutine update_spec (X, ns, S, dS, dXdS, step_iters) Update the specification during continuation. Arguments Type Intent Optional Attributes Name real(kind=pr), intent(inout) :: X (:) Vector of variables integer, intent(inout) :: ns Number of specified variable in the vector real(kind=pr), intent(inout) :: S Variable specification value real(kind=pr), intent(inout) :: dS Step in specification real(kind=pr), intent(inout) :: dXdS (:) Variation of variables with respect to specification integer, intent(in) :: step_iters Iterations used in the solver","tags":"","loc":"proc/px_envelope_2ph.html"},{"title":"get_z – yaeos","text":"public subroutine get_z(alpha, z_0, z_inj, z, dzda) Calculate the fluid composition based on an amount of addition\nof second fluid. The injection can be considered as two kinds of injection:\n- Displacement: - Addition: Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: alpha Addition percentaje real(kind=pr), intent(in) :: z_0 (:) real(kind=pr), intent(in) :: z_inj (:) real(kind=pr), intent(out) :: z (size(z_0)) New composition real(kind=pr), intent(out), optional :: dzda (size(z_0)) Derivative wrt","tags":"","loc":"proc/get_z.html"},{"title":"init – yaeos","text":"public function init(a, b, c) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: a (:,:) real(kind=pr), intent(in) :: b (:,:) real(kind=pr), intent(in) :: c (:,:) Return Value type( NRTL )","tags":"","loc":"proc/init.html"},{"title":"EXCESS_GIBBS – yaeos","text":"public subroutine EXCESS_GIBBS(model, n, t, ge) Type Bound NRTL Arguments Type Intent Optional Attributes Name class( NRTL ) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: t real(kind=pr), intent(out) :: ge Variables Type Visibility Attributes Name Initial real(kind=pr), public :: a (size(n),size(n)) real(kind=pr), public, dimension(size(n)) :: arg1 real(kind=pr), public, dimension(size(n)) :: arg2 real(kind=pr), public :: b (size(n),size(n)) real(kind=pr), public :: c (size(n),size(n)) real(kind=pr), public :: down real(kind=pr), public :: g (size(n),size(n)) integer, public :: i integer, public :: j real(kind=pr), public :: tau (size(n),size(n)) real(kind=pr), public :: x (size(n))","tags":"","loc":"proc/excess_gibbs.html"},{"title":"EXCESS_GIBBS_B – yaeos","text":"public subroutine EXCESS_GIBBS_B(model, n, nb, t, tb, ge, geb) Type Bound NRTL Arguments Type Intent Optional Attributes Name class( NRTL ) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr) :: nb (:) real(kind=pr), intent(in) :: t real(kind=pr) :: tb real(kind=pr) :: ge real(kind=pr) :: geb Variables Type Visibility Attributes Name Initial real(kind=pr), public :: a (size(n),size(n)) integer, public :: ad_to real(kind=pr), public, dimension(size(n)) :: arg1 real(kind=pr), public, dimension(size(n)) :: arg1b real(kind=pr), public, dimension(size(n)) :: arg2 real(kind=pr), public, dimension(size(n)) :: arg2b real(kind=pr), public :: b (size(n),size(n)) real(kind=pr), public :: c (size(n),size(n)) real(kind=pr), public :: down real(kind=pr), public :: g (size(n),size(n)) real(kind=pr), public :: gb (size(n),size(n)) integer, public :: i integer, public :: j real(kind=pr), public :: tau (size(n),size(n)) real(kind=pr), public :: taub (size(n),size(n)) real(kind=pr), public :: temp real(kind=pr), public :: temp0 real(kind=pr), public :: tempb real(kind=pr), public :: tempb0 real(kind=pr), public :: x (size(n)) real(kind=pr), public :: xb (size(n))","tags":"","loc":"proc/excess_gibbs_b.html"},{"title":"EXCESS_GIBBS_D – yaeos","text":"public subroutine EXCESS_GIBBS_D(model, n, nd, t, td, ge, ged) Type Bound NRTL Arguments Type Intent Optional Attributes Name class( NRTL ) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: nd (:) real(kind=pr), intent(in) :: t real(kind=pr), intent(in) :: td real(kind=pr), intent(out) :: ge real(kind=pr), intent(out) :: ged Variables Type Visibility Attributes Name Initial real(kind=pr), public :: a (size(n),size(n)) real(kind=pr), public, dimension(size(n)) :: arg1 real(kind=pr), public, dimension(size(n)) :: arg1d real(kind=pr), public, dimension(size(n)) :: arg2 real(kind=pr), public, dimension(size(n)) :: arg2d real(kind=pr), public :: b (size(n),size(n)) real(kind=pr), public :: c (size(n),size(n)) real(kind=pr), public :: down real(kind=pr), public :: g (size(n),size(n)) real(kind=pr), public :: gd (size(n),size(n)) integer, public :: i integer, public :: j real(kind=pr), public :: tau (size(n),size(n)) real(kind=pr), public :: taud (size(n),size(n)) real(kind=pr), public :: temp real(kind=pr), public :: temp0 real(kind=pr), public :: temp1 real(kind=pr), public :: x (size(n)) real(kind=pr), public :: xd (size(n))","tags":"","loc":"proc/excess_gibbs_d.html"},{"title":"EXCESS_GIBBS_D_B – yaeos","text":"public subroutine EXCESS_GIBBS_D_B(model, n, nb, nd, ndb, t, tb, td, tdb, ge, geb, ged, gedb) Type Bound NRTL Arguments Type Intent Optional Attributes Name class( NRTL ) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr) :: nb (:) real(kind=pr), intent(in) :: nd (:) real(kind=pr) :: ndb (:) real(kind=pr), intent(in) :: t real(kind=pr) :: tb real(kind=pr), intent(in) :: td real(kind=pr) :: tdb real(kind=pr) :: ge real(kind=pr) :: geb real(kind=pr) :: ged real(kind=pr) :: gedb Variables Type Visibility Attributes Name Initial real(kind=pr), public :: a (size(n),size(n)) integer, public :: ad_to real(kind=pr), public, dimension(size(n)) :: arg1 integer, public :: arg10 real(kind=pr), public, dimension(size(n)) :: arg1b real(kind=pr), public, dimension(size(n)) :: arg1d real(kind=pr), public, dimension(size(n)) :: arg1db real(kind=pr), public, dimension(size(n)) :: arg2 real(kind=pr), public, dimension(size(n)) :: arg2b real(kind=pr), public, dimension(size(n)) :: arg2d real(kind=pr), public, dimension(size(n)) :: arg2db real(kind=pr), public :: b (size(n),size(n)) real(kind=pr), public :: c (size(n),size(n)) real(kind=pr), public :: down real(kind=pr), public :: g (size(n),size(n)) real(kind=pr), public :: gb (size(n),size(n)) real(kind=pr), public :: gd (size(n),size(n)) real(kind=pr), public :: gdb (size(n),size(n)) integer, public :: i integer, public :: j real(kind=pr), public :: result1 real(kind=pr), public :: tau (size(n),size(n)) real(kind=pr), public :: taub (size(n),size(n)) real(kind=pr), public :: taud (size(n),size(n)) real(kind=pr), public :: taudb (size(n),size(n)) real(kind=pr), public :: temp real(kind=pr), public :: temp0 real(kind=pr), public :: temp0b real(kind=pr), public :: temp1 real(kind=pr), public :: temp1b real(kind=pr), public, dimension(size(n, 1)) :: temp2 real(kind=pr), public :: temp3 real(kind=pr), public :: temp4 real(kind=pr), public :: temp5 real(kind=pr), public :: tempb real(kind=pr), public, dimension(size(n, 1)) :: tempb0 real(kind=pr), public, dimension(size(n, 1)) :: tempb1 real(kind=pr), public :: tempb2 real(kind=pr), public, dimension(size(n)) :: tempb3 real(kind=pr), public :: tempb4 real(kind=pr), public :: tempb5 real(kind=pr), public :: x (size(n)) real(kind=pr), public :: xb (size(n)) real(kind=pr), public :: xd (size(n)) real(kind=pr), public :: xdb (size(n))","tags":"","loc":"proc/excess_gibbs_d_b.html"},{"title":"EXCESS_GIBBS_D_D – yaeos","text":"public subroutine EXCESS_GIBBS_D_D(model, n, nd, t, td0, td, ge, ged0, ged, gedd) Type Bound NRTL Arguments Type Intent Optional Attributes Name class( NRTL ) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: nd (:) real(kind=pr), intent(in) :: t real(kind=pr), intent(in) :: td0 real(kind=pr), intent(in) :: td real(kind=pr), intent(out) :: ge real(kind=pr), intent(out) :: ged0 real(kind=pr), intent(out) :: ged real(kind=pr), intent(out) :: gedd Variables Type Visibility Attributes Name Initial real(kind=pr), public :: a (size(n),size(n)) real(kind=pr), public, dimension(size(n)) :: arg1 real(kind=pr), public, dimension(size(n)) :: arg1d real(kind=pr), public, dimension(size(n)) :: arg1d0 real(kind=pr), public, dimension(size(n)) :: arg1dd real(kind=pr), public, dimension(size(n)) :: arg2 real(kind=pr), public, dimension(size(n)) :: arg2d real(kind=pr), public, dimension(size(n)) :: arg2d0 real(kind=pr), public, dimension(size(n)) :: arg2dd real(kind=pr), public :: b (size(n),size(n)) real(kind=pr), public :: c (size(n),size(n)) real(kind=pr), public :: down real(kind=pr), public :: g (size(n),size(n)) real(kind=pr), public :: gd (size(n),size(n)) real(kind=pr), public :: gd0 (size(n),size(n)) real(kind=pr), public :: gdd (size(n),size(n)) integer, public :: i integer, public :: j real(kind=pr), public :: tau (size(n),size(n)) real(kind=pr), public :: taud (size(n),size(n)) real(kind=pr), public :: taud0 (size(n),size(n)) real(kind=pr), public :: taudd (size(n),size(n)) real(kind=pr), public :: temp real(kind=pr), public :: temp0 real(kind=pr), public :: temp0d real(kind=pr), public :: temp1 real(kind=pr), public :: temp1d real(kind=pr), public, dimension(size(b, 1), size(b, 2)) :: temp2 real(kind=pr), public, dimension(size(n), size(n)) :: temp3 real(kind=pr), public, dimension(size(n)) :: temp4 real(kind=pr), public :: temp5 real(kind=pr), public :: temp6 real(kind=pr), public :: tempd real(kind=pr), public :: x (size(n)) real(kind=pr), public :: xd (size(n))","tags":"","loc":"proc/excess_gibbs_d_d.html"},{"title":"EXCESS_GIBBS_D_D_D – yaeos","text":"public subroutine EXCESS_GIBBS_D_D_D(model, n, nd, t, td1, td0, td, ge, ged1, ged0, ged0d, ged, gedd0, gedd, geddd) Arguments Type Intent Optional Attributes Name class( NRTL ) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: nd (:) real(kind=pr), intent(in) :: t real(kind=pr), intent(in) :: td1 real(kind=pr), intent(in) :: td0 real(kind=pr), intent(in) :: td real(kind=pr), intent(out) :: ge real(kind=pr), intent(out) :: ged1 real(kind=pr), intent(out) :: ged0 real(kind=pr), intent(out) :: ged0d real(kind=pr), intent(out) :: ged real(kind=pr), intent(out) :: gedd0 real(kind=pr), intent(out) :: gedd real(kind=pr), intent(out) :: geddd Variables Type Visibility Attributes Name Initial real(kind=pr), public :: a (size(n),size(n)) real(kind=pr), public, dimension(size(n)) :: arg1 real(kind=pr), public, dimension(size(n)) :: arg1d real(kind=pr), public, dimension(size(n)) :: arg1d0 real(kind=pr), public, dimension(size(n)) :: arg1d0d real(kind=pr), public, dimension(size(n)) :: arg1d1 real(kind=pr), public, dimension(size(n)) :: arg1dd real(kind=pr), public, dimension(size(n)) :: arg1dd0 real(kind=pr), public, dimension(size(n)) :: arg1ddd real(kind=pr), public, dimension(size(n)) :: arg2 real(kind=pr), public, dimension(size(n)) :: arg2d real(kind=pr), public, dimension(size(n)) :: arg2d0 real(kind=pr), public, dimension(size(n)) :: arg2d0d real(kind=pr), public, dimension(size(n)) :: arg2d1 real(kind=pr), public, dimension(size(n)) :: arg2dd real(kind=pr), public, dimension(size(n)) :: arg2dd0 real(kind=pr), public, dimension(size(n)) :: arg2ddd real(kind=pr), public :: b (size(n),size(n)) real(kind=pr), public :: c (size(n),size(n)) real(kind=pr), public :: down real(kind=pr), public :: g (size(n),size(n)) real(kind=pr), public :: gd (size(n),size(n)) real(kind=pr), public :: gd0 (size(n),size(n)) real(kind=pr), public :: gd0d (size(n),size(n)) real(kind=pr), public :: gd1 (size(n),size(n)) real(kind=pr), public :: gdd (size(n),size(n)) real(kind=pr), public :: gdd0 (size(n),size(n)) real(kind=pr), public :: gddd (size(n),size(n)) integer, public :: i integer, public :: j real(kind=pr), public :: tau (size(n),size(n)) real(kind=pr), public :: taud (size(n),size(n)) real(kind=pr), public :: taud0 (size(n),size(n)) real(kind=pr), public :: taud0d (size(n),size(n)) real(kind=pr), public :: taud1 (size(n),size(n)) real(kind=pr), public :: taudd (size(n),size(n)) real(kind=pr), public :: taudd0 (size(n),size(n)) real(kind=pr), public :: tauddd (size(n),size(n)) real(kind=pr), public :: temp real(kind=pr), public :: temp0 real(kind=pr), public :: temp0d real(kind=pr), public :: temp0d0 real(kind=pr), public :: temp0dd real(kind=pr), public :: temp1 real(kind=pr), public :: temp10 real(kind=pr), public :: temp11 real(kind=pr), public :: temp1d real(kind=pr), public :: temp1d0 real(kind=pr), public :: temp1dd real(kind=pr), public, dimension(size(b, 1), size(b, 2)) :: temp2 real(kind=pr), public, dimension(size(b, 1), size(b, 2)) :: temp2d real(kind=pr), public, dimension(size(n), size(n)) :: temp3 real(kind=pr), public, dimension(size(n), size(n)) :: temp3d real(kind=pr), public, dimension(size(n)) :: temp4 real(kind=pr), public, dimension(size(n)) :: temp4d real(kind=pr), public :: temp5 real(kind=pr), public :: temp5d real(kind=pr), public :: temp6 real(kind=pr), public :: temp6d real(kind=pr), public, dimension(size(b, 1), size(b, 2)) :: temp7 real(kind=pr), public, dimension(size(n), size(n)) :: temp8 real(kind=pr), public, dimension(size(n)) :: temp9 real(kind=pr), public :: tempd real(kind=pr), public :: tempd0 real(kind=pr), public :: tempdd real(kind=pr), public :: x (size(n)) real(kind=pr), public :: xd (size(n))","tags":"","loc":"proc/excess_gibbs_d_d_d.html"},{"title":"NRTL – yaeos","text":"public interface NRTL Module Procedures public function init (a, b, c) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: a (:,:) real(kind=pr), intent(in) :: b (:,:) real(kind=pr), intent(in) :: c (:,:) Return Value type( NRTL )","tags":"","loc":"interface/nrtl.html"},{"title":"solve_system – yaeos","text":"public function solve_system(a, b) result(x) Solve a linear sytem AX = b Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: a (size(b),size(b)) real(kind=pr), intent(in) :: b (:) Return Value real(kind=pr), (size(b)) Variables Type Visibility Attributes Name Initial real(kind=dp), public :: a_lapack (size(b),size(b)) real(kind=dp), public :: b_lapack (size(b)) integer, public, parameter :: dp = selected_real_kind(15) integer, public :: info integer, public :: ipiv (size(b)) integer, public :: lda integer, public :: ldb integer, public :: n integer, public :: nrhs Interfaces interface subroutine dgesv(n, nrhs, a, lda, ipiv, b, ldb, info) Arguments Type Intent Optional Attributes Name integer :: n integer :: nrhs real(kind=dp) :: a (n,n) integer :: lda integer :: ipiv (n) real(kind=dp) :: b (n) integer :: ldb integer :: info","tags":"","loc":"proc/solve_system.html"},{"title":"cubic_roots – yaeos","text":"public subroutine cubic_roots(parameters, real_roots, complex_roots, flag) Uses yaeos__auxiliar Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: parameters (4) real(kind=pr), intent(out) :: real_roots (3) complex(kind=pr), intent(out) :: complex_roots (3) integer, intent(out) :: flag flag that identifies which case the solution is\n- 0 : 3 real rotos, one of them repeated (use real_roots(1) and real_roots(2))\n- 1 : 1 real root, 2 complex roots.\n Use real_roots(1) and complex_roots(1) and complex_roots(2)\n- -1 : 3 real roots, all different Variables Type Visibility Attributes Name Initial real(kind=pr), public :: disc real(kind=pr), public :: nan real(kind=pr), public :: p real(kind=pr), public, parameter :: pi = atan(1.0_pr)*4.0_pr real(kind=pr), public :: q real(kind=pr), public :: theta real(kind=pr), public :: u real(kind=pr), public :: v","tags":"","loc":"proc/cubic_roots.html"},{"title":"cubic_roots_rosendo – yaeos","text":"public subroutine cubic_roots_rosendo(parameters, real_roots, complex_roots, flag) Uses yaeos__auxiliar Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: parameters (4) real(kind=pr), intent(out) :: real_roots (3) complex(kind=pr), intent(out) :: complex_roots (3) integer, intent(out) :: flag Variables Type Visibility Attributes Name Initial real(kind=16), public :: A real(kind=16), public :: B real(kind=16), public :: Q real(kind=16), public :: R real(kind=16), public :: alp real(kind=16), public :: bet real(kind=16), public :: d1 real(kind=16), public :: d2 real(kind=16), public :: d3 real(kind=16), public :: gam integer, public :: i real(kind=pr), public, parameter :: pi = atan(1.0_pr)*4.0_pr real(kind=16), public :: theta","tags":"","loc":"proc/cubic_roots_rosendo.html"},{"title":"optval_integer – yaeos","text":"public function optval_integer(val, default) Uses stdlib_optval Set a value to a default if it is not defined Arguments Type Intent Optional Attributes Name integer, intent(inout), optional :: val integer, intent(in) :: default Return Value integer","tags":"","loc":"proc/optval_integer.html"},{"title":"optval_real – yaeos","text":"public function optval_real(val, default) Uses stdlib_optval Set a value to a default if it is not defined Arguments Type Intent Optional Attributes Name real(kind=pr), intent(inout), optional :: val real(kind=pr), intent(in) :: default Return Value real(kind=pr)","tags":"","loc":"proc/optval_real.html"},{"title":"sort – yaeos","text":"public subroutine sort(array, idx) Uses stdlib_sorting Sort an array and return the indexes Arguments Type Intent Optional Attributes Name real(kind=pr), intent(inout) :: array (:) integer, intent(out), optional :: idx (:)","tags":"","loc":"proc/sort.html"},{"title":"optval – yaeos","text":"public interface optval Module Procedures public function optval_integer (val, default) Set a value to a default if it is not defined Arguments Type Intent Optional Attributes Name integer, intent(inout), optional :: val integer, intent(in) :: default Return Value integer public function optval_real (val, default) Set a value to a default if it is not defined Arguments Type Intent Optional Attributes Name real(kind=pr), intent(inout), optional :: val real(kind=pr), intent(in) :: default Return Value real(kind=pr)","tags":"","loc":"interface/optval.html"},{"title":"write_EquilibriumState – yaeos","text":"public subroutine write_EquilibriumState(eq, unit, iotype, v_list, iostat, iomsg) Type Bound EquilibriumState Arguments Type Intent Optional Attributes Name class( EquilibriumState ), intent(in) :: eq integer, intent(in) :: unit character(len=*), intent(in) :: iotype integer, intent(in) :: v_list (:) integer, intent(out) :: iostat character(len=*), intent(inout) :: iomsg Variables Type Visibility Attributes Name Initial character(len=*), public, parameter :: nl = new_line(\"G\")","tags":"","loc":"proc/write_equilibriumstate.html"},{"title":"optimize – yaeos","text":"public function optimize(X, opt, data) result(y) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(inout) :: X (:) Vector of parameters to fit class( Optimizer ), intent(inout) :: opt Optimizer object, bsaed on the Optimizer class from yaeos__optimizers class( FittingProblem ), intent(inout), optional :: data Fitting problem to optimize Return Value real(kind=pr)","tags":"","loc":"proc/optimize.html"},{"title":"error_function – yaeos","text":"public subroutine error_function(X, Fobj, dF, func_data) Uses yaeos__math error_function Error function for phase-equilibria optimization. Using two-phase\npoints and an error function of: Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: X (:) Vector of parameters real(kind=pr), intent(out) :: Fobj Objective function real(kind=pr), intent(out), optional :: dF (:) Gradient of the objective function, only exists to be consistent\nwith the Optimizer class API class(*), intent(inout), optional :: func_data Variables Type Visibility Attributes Name Initial type( EquilibriumState ), public :: exp_point integer, public :: i type( EquilibriumState ), public :: model_point Each solved point","tags":"","loc":"proc/error_function.html"},{"title":"v0 – yaeos","text":"public function v0(self, n, p, t) Cubic EoS volume initializer.\nFor a Cubic Equation of State, the covolume calculated with the mixing\nrule is a good estimate for the initial volume solver on the liquid\nregion. Type Bound CubicEoS Arguments Type Intent Optional Attributes Name class( CubicEoS ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: p real(kind=pr), intent(in) :: t Return Value real(kind=pr) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: dbi (size(n)) real(kind=pr), public :: dbij (size(n),size(n))","tags":"","loc":"proc/v0.html"},{"title":"GenericCubic_Ar – yaeos","text":"public subroutine GenericCubic_Ar(self, n, v, t, ar, arv, ArT, artv, arv2, ArT2, Arn, ArVn, ArTn, Arn2) Uses yaeos__constants Residual Helmholtz Energy for a generic Cubic Equation of State. Calculates the residual Helmholtz Energy for a generic Cubic EoS as\ndefined by Michelsen and Møllerup: This routine assumes that the is not a constant parameter\n(as it uses to be in classical Cubic EoS) to be compatible with the\nthree parameter EoS RKPR where is not a constant and\nhas its own mixing rule. Type Bound CubicEoS Arguments Type Intent Optional Attributes Name class( CubicEoS ), intent(in) :: self real(kind=pr), intent(in) :: n (:) Number of moles real(kind=pr), intent(in) :: v Volume [L] real(kind=pr), intent(in) :: t Temperature [K] real(kind=pr), intent(out), optional :: ar Residual Helmholtz real(kind=pr), intent(out), optional :: arv real(kind=pr), intent(out), optional :: ArT real(kind=pr), intent(out), optional :: artv real(kind=pr), intent(out), optional :: arv2 real(kind=pr), intent(out), optional :: ArT2 real(kind=pr), intent(out), optional :: Arn (size(n)) real(kind=pr), intent(out), optional :: ArVn (size(n)) real(kind=pr), intent(out), optional :: ArTn (size(n)) real(kind=pr), intent(out), optional :: Arn2 (size(n),size(n)) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: AUX real(kind=pr), public :: Bmix real(kind=pr), public :: D real(kind=pr), public :: FFB real(kind=pr), public :: FFBB real(kind=pr), public :: FFBV real(kind=pr), public :: Tr (size(n)) real(kind=pr), public :: a (size(n)) real(kind=pr), public :: auxD2 real(kind=pr), public :: d1 real(kind=pr), public :: d2 real(kind=pr), public :: dBi (size(n)) real(kind=pr), public :: dBij (size(n),size(n)) real(kind=pr), public :: dD1i (size(n)) real(kind=pr), public :: dD1ij (size(n),size(n)) real(kind=pr), public :: dDdT real(kind=pr), public :: dDdT2 real(kind=pr), public :: dDi (size(n)) real(kind=pr), public :: dDidT (size(n)) real(kind=pr), public :: dDij (size(n),size(n)) real(kind=pr), public :: dadt (size(n)) real(kind=pr), public :: dadt2 (size(n)) real(kind=pr), public :: f real(kind=pr), public :: fB real(kind=pr), public :: fBD1 real(kind=pr), public :: fD1 real(kind=pr), public :: fD1D1 real(kind=pr), public :: fVD1 real(kind=pr), public :: fv real(kind=pr), public :: fv2 real(kind=pr), public :: g real(kind=pr), public :: gv real(kind=pr), public :: gv2 integer, public :: i integer, public :: j integer, public :: nc real(kind=pr), public :: totn","tags":"","loc":"proc/genericcubic_ar.html"},{"title":"volume – yaeos","text":"public subroutine volume(eos, n, P, T, V, root_type) Uses yaeos__constants yaeos__models_solvers yaeos__math_linalg Cubic EoS volume solver Volume solver optimized for Cubic Equations of State. @warn\nThis routine intends to use the analyitical solution of the cubic\nequation, but due to errors in the solutions it is not used. And\nthe general volume solver by Michelsen is used instead.\n@endwarn Description Cubic equations can be analytically solved. Using an anallytical\nsolution provides the best possible solution in terms of speed and\nprecision. This subroutine uses the modified cardano method proposed\nby Rosendo. Examples use yaeos , only : CubicEoS , PengRobinson type ( CubicEoS ) :: eos eos = PengRobinson ( tc , pc , w ) ! Possible roots to solve call eos % volume ( n , P , T , V , \"liquid\" ) call eos % volume ( n , P , T , V , \"vapor\" ) call eos % volume ( n , P , T , V , \"stable\" ) References [1] “Thermodynamic Models: Fundamental and Computational Aspects”,\n Michael L. Michelsen, Jørgen M. Mollerup. \n Tie-Line Publications, Denmark (2004) doi [2] “A Note on the Analytical Solution of Cubic Equations of State \nin Process Simulation”, Rosendo Monroy-Loperena doi Type Bound CubicEoS Arguments Type Intent Optional Attributes Name class( CubicEoS ), intent(in) :: eos real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: P real(kind=pr), intent(in) :: T real(kind=pr), intent(out) :: V character(len=*), intent(in) :: root_type Variables Type Visibility Attributes Name Initial real(kind=pr), public :: AT_Liq real(kind=pr), public :: AT_Vap real(kind=pr), public :: Ar real(kind=pr), public :: Bmix real(kind=pr), public :: D real(kind=pr), public :: D1 real(kind=pr), public :: D2 real(kind=pr), public :: Tr (size(n)) real(kind=pr), public :: V_liq real(kind=pr), public :: V_vap real(kind=pr), public :: a (size(n)) real(kind=pr), public :: cp (4) complex(kind=pr), public :: cr (3) real(kind=pr), public :: dBi (size(n)) real(kind=pr), public :: dBij (size(n),size(n)) real(kind=pr), public :: dD1i (size(n)) real(kind=pr), public :: dD1ij (size(n),size(n)) real(kind=pr), public :: dDdT real(kind=pr), public :: dDdT2 real(kind=pr), public :: dDi (size(n)) real(kind=pr), public :: dDidT (size(n)) real(kind=pr), public :: dDij (size(n),size(n)) real(kind=pr), public :: dadt (size(n)) real(kind=pr), public :: dadt2 (size(n)) integer, public :: flag real(kind=pr), public :: rr (3) real(kind=pr), public :: totn real(kind=pr), public :: z (size(n))","tags":"","loc":"proc/volume.html"},{"title":"get_v0 – yaeos","text":"private function get_v0(self, n, p, t) Type Bound ArModelTapenade Arguments Type Intent Optional Attributes Name class( ArModelTapenade ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: p real(kind=pr), intent(in) :: t Return Value real(kind=pr)","tags":"","loc":"proc/get_v0.html"},{"title":"residual_helmholtz – yaeos","text":"private subroutine residual_helmholtz(self, n, v, t, Ar, ArV, ArT, ArTV, ArV2, ArT2, Arn, ArVn, ArTn, Arn2) Residual Helmholtz model generic interface Type Bound ArModelTapenade Arguments Type Intent Optional Attributes Name class( ArModelTapenade ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: v real(kind=pr), intent(in) :: t real(kind=pr), intent(out), optional :: Ar real(kind=pr), intent(out), optional :: ArV real(kind=pr), intent(out), optional :: ArT real(kind=pr), intent(out), optional :: ArTV real(kind=pr), intent(out), optional :: ArV2 real(kind=pr), intent(out), optional :: ArT2 real(kind=pr), intent(out), optional, dimension(size(n)) :: Arn real(kind=pr), intent(out), optional, dimension(size(n)) :: ArVn real(kind=pr), intent(out), optional, dimension(size(n)) :: ArTn real(kind=pr), intent(out), optional :: Arn2 (size(n),size(n)) Variables Type Visibility Attributes Name Initial real(kind=pr), private :: arval real(kind=pr), private :: arvalb real(kind=pr), private :: arvald real(kind=pr), private :: arvald0 real(kind=pr), private :: arvaldb real(kind=pr), private :: arvaldd real(kind=pr), private :: df (size(n)+2) real(kind=pr), private :: df2 (size(n)+2,size(n)+2) integer, private :: i real(kind=pr), private :: nb (size(n)) integer, private :: nc real(kind=pr), private :: nd (size(n)) real(kind=pr), private :: ndb (size(n)) real(kind=pr), private :: tb real(kind=pr), private :: td real(kind=pr), private :: td0 real(kind=pr), private :: tdb real(kind=pr), private :: vb real(kind=pr), private :: vd real(kind=pr), private :: vd0 real(kind=pr), private :: vdb Functions function get_ArnX (var) Arguments Type Intent Optional Attributes Name character(len=*), intent(in) :: var Return Value real(kind=pr), (size(n)) function get_dArdX2 (var) Arguments Type Intent Optional Attributes Name character(len=*), intent(in) :: var Return Value real(kind=pr) Subroutines subroutine reset_vars () Arguments None","tags":"","loc":"proc/residual_helmholtz.html"},{"title":"ln_activity_coefficient – yaeos","text":"public subroutine ln_activity_coefficient(self, n, T, lngamma) Type Bound GeModel Arguments Type Intent Optional Attributes Name class( GeModel ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: T real(kind=pr), intent(out) :: lngamma (:) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: dgedn (size(n)) real(kind=pr), public :: ge","tags":"","loc":"proc/ln_activity_coefficient.html"},{"title":"foo_wrap – yaeos","text":"private subroutine foo_wrap(n, x, f) Arguments Type Intent Optional Attributes Name integer :: n real(kind=pr) :: x (*) real(kind=pr) :: f Variables Type Visibility Attributes Name Initial real(kind=pr), private :: xx (n)","tags":"","loc":"proc/foo_wrap.html"},{"title":"powell_optimize – yaeos","text":"private subroutine powell_optimize(self, foo, X, F, data) Uses newuoa_module Type Bound PowellWrapper Arguments Type Intent Optional Attributes Name class( PowellWrapper ), intent(inout) :: self procedure( obj_func ) :: foo real(kind=pr), intent(inout) :: X (:) real(kind=pr), intent(out) :: F class(*), intent(inout), optional, target :: data Variables Type Visibility Attributes Name Initial real(kind=pr), private :: dx (size(x)) integer, private :: n integer, private :: npt","tags":"","loc":"proc/powell_optimize.html"},{"title":"allclose – yaeos","text":"public function allclose(x, y, atol) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: x (:) real(kind=pr), intent(in) :: y (:) real(kind=pr), intent(in) :: atol Return Value logical","tags":"","loc":"proc/allclose.html"},{"title":"rel_error – yaeos","text":"public elemental function rel_error(x, y) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: x real(kind=pr), intent(in) :: y Return Value real(kind=pr)","tags":"","loc":"proc/rel_error.html"},{"title":"setup_unifac – yaeos","text":"public function setup_unifac(molecules, parameters) Setup UNIFAC Instantiate a UNIFAC model Description Subroutine used to instantiate a UNIFAC model. Examples ! Instantiate an UNIFAC model with ethanol-water mix and calculate gammas use yaeos , only : pr , Groups , setup_unifac , UNIFAC type ( UNIFAC ) :: model type ( Groups ) :: molecules ( 2 ) real ( pr ) :: ln_gammas ( 2 ) ! Ethanol definition [CH3, CH2, OH] molecules ( 1 )% groups_ids = [ 1 , 2 , 14 ] ! Subgroups ids molecules ( 1 )% number_of_groups = [ 1 , 1 , 1 ] ! Subgroups occurrences ! Water definition [H2O] molecules ( 2 )% groups_ids = [ 16 ] molecules ( 2 )% number_of_groups = [ 1 ] ! Model setup model = setup_unifac ( molecules ) ! Calculate ln_gammas call model % ln_activity_coefficient ([ 0.5_pr , 0.5_pr ], 29 8.0_pr , ln_gammas ) print * , ln_gammas ! result: 0.18534142000449058 0.40331395945417559 References Dortmund Data Bank Software & Separation Technology Arguments Type Intent Optional Attributes Name type( Groups ), intent(in) :: molecules (:) Molecules (Group type) objects type( GeGCModelParameters ), intent(in), optional :: parameters UNIFAC parameters Return Value type( UNIFAC ) Variables Type Visibility Attributes Name Initial real(kind=pr), public, allocatable :: Aij (:,:) integer, public :: gi integer, public :: i integer, public :: j integer, public :: k type( GeGCModelParameters ), public :: params type( UNIFACPsi ), public :: psi_function real(kind=pr), public, allocatable :: qks (:) type( Groups ), public :: soup integer, public, allocatable :: vij (:,:)","tags":"","loc":"proc/setup_unifac.html"},{"title":"thetas_i – yaeos","text":"public function thetas_i(nm, ng, parameters, stew, molecules) result(thetas_ij) calculation Calculate the area fraciton of each froup on each molecule. Description Calculate the area fraciton of each froup on each molecule. The values\nare obtained on the setup_unifac function and stored on the UNIFAC\ntype, since the values can be reused (no compositional or temperature\ndependence) References SINTEF - Thermopack Arguments Type Intent Optional Attributes Name integer, intent(in) :: nm Number of molecules integer, intent(in) :: ng Number of groups type( GeGCModelParameters ), intent(in) :: parameters UNIFAC parameters type( Groups ), intent(in) :: stew All the groups present in the system type( Groups ), intent(in) :: molecules (:) Molecules Return Value real(kind=pr), (nm,ng) Group j area fraction on molecule i Variables Type Visibility Attributes Name Initial integer, public :: gi integer, public :: i integer, public :: j integer, public :: k real(kind=pr), public :: qki_contribution real(kind=pr), public :: total_area_i (nm)","tags":"","loc":"proc/thetas_i.html"},{"title":"Ge_combinatorial – yaeos","text":"public subroutine Ge_combinatorial(self, n, T, Ge, dGe_dn, dGe_dn2) UNIFAC combinatorial term Calculate the UNIFAC combinatorial term of Gibbs excess energy Description Calculate the UNIFAC combinatorial term of reduced Gibbs excess energy.\nThe subroutine uses the Flory-Huggins and Staverman-Guggenheim\ncombinatory terms as follows: Flory-Huggins Staverman-Guggenheim Fredenslund et al. (UNIFAC) References SINTEF - Thermopack Arguments Type Intent Optional Attributes Name class( UNIFAC ) :: self real(kind=pr), intent(in) :: n (self%nmolecules) Moles vector [mol] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out), optional :: Ge Combinatorial Gibbs excess energy real(kind=pr), intent(out), optional :: dGe_dn (self%nmolecules) real(kind=pr), intent(out), optional :: dGe_dn2 (self%nmolecules,self%nmolecules) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: Ge_fh real(kind=pr), public :: Ge_sg real(kind=pr), public :: dGe_fh_dn (self%nmolecules) real(kind=pr), public :: dGe_fh_dn2 (self%nmolecules,self%nmolecules) real(kind=pr), public :: dGe_sg_dn (self%nmolecules) real(kind=pr), public :: dGe_sg_dn2 (self%nmolecules,self%nmolecules) integer, public :: i integer, public :: j real(kind=pr), public :: n_t real(kind=pr), public :: nq real(kind=pr), public :: nr","tags":"","loc":"proc/ge_combinatorial.html"},{"title":"Ge_residual – yaeos","text":"public subroutine Ge_residual(self, n, T, Ge, dGe_dn, dGe_dn2, dGe_dT, dGe_dT2, dGe_dTn) UNIFAC residual term Evaluate the UNIFAC residual therm Description Evaluate the UNIFAC residual therm. The residual Gibbs excess energy\nand its derivatives are evaluated as: With: In the UNIFAC model, the values are calculated assuming\nthat the molecule “i” is pure, hence only the subgroups of the molecule\n“i” must be considered for the calculation. On the other hand, for the values, all the system’s subgroups are considered. The compositional derivatives: With: The temperature derivatives: With: Temperature-compositional cross derivative: With: References SINTEF - Thermopack Arguments Type Intent Optional Attributes Name class( UNIFAC ) :: self real(kind=pr), intent(in) :: n (self%nmolecules) Moles vector real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out), optional :: Ge Residual Gibbs excess energy real(kind=pr), intent(out), optional :: dGe_dn (self%nmolecules) real(kind=pr), intent(out), optional :: dGe_dn2 (self%nmolecules,self%nmolecules) real(kind=pr), intent(out), optional :: dGe_dT real(kind=pr), intent(out), optional :: dGe_dT2 real(kind=pr), intent(out), optional :: dGe_dTn (self%nmolecules) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: Ejk (self%ngroups,self%ngroups) real(kind=pr), public :: Ge_aux real(kind=pr), public :: aux_sum (self%nmolecules) real(kind=pr), public :: aux_sum2 real(kind=pr), public :: dEjk_dt (self%ngroups,self%ngroups) real(kind=pr), public :: dEjk_dt2 (self%ngroups,self%ngroups) real(kind=pr), public :: dGe_dT_aux real(kind=pr), public :: dGe_dn_aux (self%nmolecules) real(kind=pr), public :: dlambda_ik_dT (self%nmolecules,self%ngroups) real(kind=pr), public :: dlambda_ik_dT2 (self%nmolecules,self%ngroups) real(kind=pr), public :: dlambda_k_dT (self%ngroups) real(kind=pr), public :: dlambda_k_dT2 (self%ngroups) real(kind=pr), public :: dlambda_k_dn (self%nmolecules,self%ngroups) real(kind=pr), public :: dlambda_k_dn2 (self%nmolecules,self%nmolecules,self%ngroups) real(kind=pr), public :: dlambda_k_dndT (self%nmolecules,self%ngroups) logical, public :: dn logical, public :: dn2 logical, public :: dt logical, public :: dt2 logical, public :: dtn integer, public :: i integer, public :: j integer, public :: k integer, public :: l real(kind=pr), public :: lambda_ik (self%nmolecules,self%ngroups) real(kind=pr), public :: lambda_k (self%ngroups) logical, public :: pge real(kind=pr), public :: sum_Q_v_dlambda_k_dn (self%nmolecules,self%nmolecules) real(kind=pr), public :: sum_ni_vij_Qj_Ejk (self%ngroups) real(kind=pr), public :: sum_ni_vij_Qj_dEjk_dT (self%ngroups) real(kind=pr), public :: sum_ni_vik_Qk real(kind=pr), public :: sum_nl_vlj (self%ngroups) real(kind=pr), public :: sum_vQ_Lambda (self%nmolecules) real(kind=pr), public :: sum_vij_Qj_Ejk (self%nmolecules,self%ngroups) real(kind=pr), public :: sum_vij_Qj_dEjk_dT (self%nmolecules,self%ngroups) real(kind=pr), public :: sum_vij_Qj_dEjk_dT2 (self%nmolecules,self%ngroups) real(kind=pr), public :: sum_vij_Qj_dlambdas_dT (self%nmolecules) real(kind=pr), public :: sum_vij_Qj_dlambdas_dT2 (self%nmolecules) real(kind=pr), public :: sum_vik_Qk (self%nmolecules) real(kind=pr), public :: theta_j (self%ngroups)","tags":"","loc":"proc/ge_residual.html"},{"title":"UNIFAC_temperature_dependence – yaeos","text":"public subroutine UNIFAC_temperature_dependence(self, systems_groups, T, psi, dpsi_dt, dpsi_dt2) UNIFAC temperature dependence Implementation of the function of the UNIFAC model. References Dortmund Data Bank Software & Separation Technology Fredenslund, A., Jones, R. L., & Prausnitz, J. M. (1975).\nGroup‐contribution estimation of activity coefficients in nonideal liquid\nmixtures. AIChE Journal, 21(6), 1086–1099. https://doi.org/10.1002/aic.690210607 Skjold-Jorgensen, S., Kolbe, B., Gmehling, J., & Rasmussen, P. (1979).\nVapor-Liquid Equilibria by UNIFAC Group Contribution. Revision and\nExtension. Industrial & Engineering Chemistry Process Design and\nDevelopment, 18(4), 714–722. https://doi.org/10.1021/i260072a024 Gmehling, J., Rasmussen, P., & Fredenslund, A. (1982). Vapor-liquid\nequilibriums by UNIFAC group contribution. Revision and extension. 2.\nIndustrial & Engineering Chemistry Process Design and Development, 21(1),\n118–127. https://doi.org/10.1021/i200016a021 Macedo, E. A., Weidlich, U., Gmehling, J., & Rasmussen, P. (1983).\nVapor-liquid equilibriums by UNIFAC group contribution. Revision and\nextension. 3. Industrial & Engineering Chemistry Process Design and\nDevelopment, 22(4), 676–678. https://doi.org/10.1021/i200023a023 Tiegs, D., Rasmussen, P., Gmehling, J., & Fredenslund, A. (1987).\nVapor-liquid equilibria by UNIFAC group contribution. 4. Revision and\nextension. Industrial & Engineering Chemistry Research, 26(1), 159–161. https://doi.org/10.1021/ie00061a030 Hansen, H. K., Rasmussen, P., Fredenslund, A., Schiller, M., &\nGmehling, J. (1991). Vapor-liquid equilibria by UNIFAC group\ncontribution. 5. Revision and extension. Industrial & Engineering\nChemistry Research, 30 (10), 2352–2355. https://doi.org/10.1021/ie00058a017 Wittig, R., Lohmann, J., & Gmehling, J. (2003). Vapor−Liquid Equilibria\nby UNIFAC Group Contribution. 6. Revision and Extension. Industrial &\nEngineering Chemistry Research, 42(1), 183–188. https://doi.org/10.1021/ie020506l SINTEF - Thermopack Type Bound UNIFACPsi Arguments Type Intent Optional Attributes Name class( UNIFACPsi ) :: self function class( Groups ) :: systems_groups Groups in the system real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out), optional :: psi (:,:) real(kind=pr), intent(out), optional :: dpsi_dt (:,:) real(kind=pr), intent(out), optional :: dpsi_dt2 (:,:) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: Aij real(kind=pr), public :: Eij integer, public :: i integer, public :: j integer, public :: ngroups","tags":"","loc":"proc/unifac_temperature_dependence.html"},{"title":"excess_gibbs – yaeos","text":"public subroutine excess_gibbs(self, n, T, Ge, GeT, GeT2, Gen, GeTn, Gen2) Excess Gibbs energy Calculate the Gibbs excess energy of the UNIFAC model Description Calculate the Gibbs excess energy of the UNIFAC model and its\nderivatives. Examples ! Gibbs excess of ethane-ethanol-methyl amine mixture. use yaeos , only : R , pr , Groups , setup_unifac , UNIFAC type ( UNIFAC ) :: model integer , parameter :: nc = 3 , ng = 4 type ( Groups ) :: molecules ( nc ) real ( pr ) :: Ge , Gen ( nc ), GeT , GeT2 , GeTn ( nc ), Gen2 ( nc , nc ) real ( pr ) :: n ( nc ), ln_gammas ( nc ), T T = 15 0.0_pr n = [ 2.0_pr , 7.0_pr , 1.0_pr ] ! Ethane [CH3] molecules ( 1 )% groups_ids = [ 1 ] molecules ( 1 )% number_of_groups = [ 2 ] ! Ethanol [CH3, CH2, OH] molecules ( 2 )% groups_ids = [ 1 , 2 , 14 ] molecules ( 2 )% number_of_groups = [ 1 , 1 , 1 ] ! Methylamine [H3C-NH2] molecules ( 3 )% groups_ids = [ 28 ] molecules ( 3 )% number_of_groups = [ 1 ] ! setup UNIFAC model model = setup_unifac ( molecules ) ! Call all Ge and derivatives call model % excess_gibbs ( model , n , T , Ge , GeT , GeT2 , Gen , GeTn , Gen2 ) print * , \"Ge: \" , Ge print * , \"GeT: \" , GeT print * , \"GeT2: \" , GeT2 print * , \"Gen: \" , Gen print * , \"GeTn: \" , GeTn print * , \"Gen2:\" print * , Gen2 ( 1 ,:) print * , Gen2 ( 2 ,:) print * , Gen2 ( 3 ,:) ! If you want the ln_gammas from \"Gen\" derivative: print * , \"ln_gammas: \" , Gen / R / T ! Or call model % ln_activity_coefficient ( n , T , ln_gammas ) print * , \"ln_gammas: \" , ln_gammas Type Bound UNIFAC Arguments Type Intent Optional Attributes Name class( UNIFAC ), intent(in) :: self UNIFAC model real(kind=pr), intent(in) :: n (:) Moles vector [mol] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out), optional :: Ge Excess Gibbs energy real(kind=pr), intent(out), optional :: GeT real(kind=pr), intent(out), optional :: GeT2 real(kind=pr), intent(out), optional :: Gen (size(n)) real(kind=pr), intent(out), optional :: GeTn (size(n)) real(kind=pr), intent(out), optional :: Gen2 (size(n),size(n)) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: Ge_c real(kind=pr), public :: dGe_c_dn (self%nmolecules) real(kind=pr), public :: dGe_c_dn2 (self%nmolecules,self%nmolecules) logical, public :: dn logical, public :: dn2 logical, public :: pge","tags":"","loc":"proc/excess_gibbs.html"},{"title":"continuation – yaeos","text":"public function continuation(f, X0, ns0, S0, dS0, max_points, solver_tol, update_specification, postprocess, solver, stop) result(XS) Numerical continuation of a function. Uses Algower method of numerical continuation to trace a line that\nsolves a system of the kind: Where is the variables vector and (S)\\ is the value of the\nspecification.\nThe method works with by providing a good set of initial points to\nsolve the system of equations with an extrapolation using the previous\nsolved point information. Arguments Type Intent Optional Attributes Name procedure( continuation_function ) :: f Function to trace real(kind=pr), intent(in) :: X0 (:) Initial point integer, intent(in) :: ns0 Initial specification real(kind=pr), intent(in) :: S0 Initial specification value real(kind=pr), intent(in) :: dS0 Initial integer, intent(in) :: max_points Maximum number of points to trace real(kind=pr), intent(in) :: solver_tol Point solver tolerance procedure( process ), optional :: update_specification Procedure to select the new specification and define the next step\n(\\DeltaS)\\, defaults to: ns = maxloc ( abs ( dXdS ), dim = 1 ) dS = dXdS ( ns ) * dS dXdS = dXdS / dXdS ( ns ) dS = sign ( minval ( abs ([ 0.05_pr , dS ])), dS ) procedure( process ), optional :: postprocess Any kind of postprocess that could be done after defining the\nnext step procedure( continuation_solver ), optional :: solver Solver procedures, uses Newton-Raphson by default procedure( continuation_stopper ), optional :: stop Stopping procedure Return Value real(kind=pr), (max_points,size(X0)) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: S real(kind=pr), public :: X (size(X0)) real(kind=pr), public :: dF (size(X0),size(X0)) real(kind=pr), public :: dFdS (size(X0)) real(kind=pr), public :: dS real(kind=pr), public :: dXdS (size(X0)) real(kind=pr), public :: fval (size(X0)) integer, public :: i integer, public :: max_iters = 500 integer, public :: newton_its integer, public :: ns","tags":"","loc":"proc/continuation.html"},{"title":"full_newton – yaeos","text":"public subroutine full_newton(fun, iters, X, ns, S, dS, dXdS, point, max_iters, F, df, dfds, tol) Uses stdlib_optval yaeos__math_linalg Subroutine to solve a point. Procedure that solves a point with the Newton-Raphson method. Arguments Type Intent Optional Attributes Name procedure( continuation_function ) :: fun Function to solve integer, intent(out) :: iters Number of iterations needed real(kind=pr), intent(inout) :: X (:) Variables vector integer, intent(in) :: ns real(kind=pr), intent(in) :: S real(kind=pr), intent(in) :: dS real(kind=pr), intent(in) :: dXdS (:) integer, intent(in) :: point integer, intent(in) :: max_iters Maximum iterations real(kind=pr), intent(out) :: F (:) Function values at solved point real(kind=pr), intent(out) :: df (:,:) Jacobian values real(kind=pr), intent(out) :: dfds (:) dFdS real(kind=pr), intent(in) :: tol Variables Type Visibility Attributes Name Initial real(kind=pr), public :: X0 (size(X)) real(kind=pr), public :: dX (size(X)) real(kind=pr), public :: solve_tol","tags":"","loc":"proc/full_newton.html"},{"title":"P_wilson – yaeos","text":"public function P_wilson(model, z, T) result(P) Arguments Type Intent Optional Attributes Name class( BaseModel ), intent(in) :: model real(kind=pr), intent(in) :: z (:) real(kind=pr), intent(in) :: T Return Value real(kind=pr)","tags":"","loc":"proc/p_wilson.html"},{"title":"k_wilson – yaeos","text":"public function k_wilson(model, T, P) result(K) K-factors regressión done by Wilson, used for initialization. Arguments Type Intent Optional Attributes Name class( BaseModel ), intent(in) :: model real(kind=pr), intent(in) :: T real(kind=pr), intent(in) :: P Return Value real(kind=pr), (size(model%components%pc))","tags":"","loc":"proc/k_wilson.html"},{"title":"POPREAL8 – yaeos","text":"interface public subroutine POPREAL8(a) Arguments Type Intent Optional Attributes Name real(kind=pr) :: a","tags":"","loc":"interface/popreal8.html"},{"title":"POPREAL8ARRAY – yaeos","text":"interface public subroutine POPREAL8ARRAY(a, n) Arguments Type Intent Optional Attributes Name real(kind=pr), dimension(n) :: a integer :: n","tags":"","loc":"interface/popreal8array.html"},{"title":"popinteger4 – yaeos","text":"interface public subroutine popinteger4(i) Arguments Type Intent Optional Attributes Name integer :: i","tags":"","loc":"interface/popinteger4.html"},{"title":"pushinteger4 – yaeos","text":"interface public subroutine pushinteger4(i) Arguments Type Intent Optional Attributes Name integer :: i","tags":"","loc":"interface/pushinteger4.html"},{"title":"pushreal8 – yaeos","text":"interface public subroutine pushreal8(a) Arguments Type Intent Optional Attributes Name real(kind=pr) :: a","tags":"","loc":"interface/pushreal8.html"},{"title":"pushreal8array – yaeos","text":"interface public subroutine pushreal8array(a, n) Arguments Type Intent Optional Attributes Name real(kind=pr), dimension(n) :: a integer :: n","tags":"","loc":"interface/pushreal8array.html"},{"title":"dx_to_dn – yaeos","text":"public function dx_to_dn(x, dx) result(dn) Uses yaeos__constants dx_to_dn Description Convert the mole fraction derivatives of a quantity (calculated\nso they do not sum to 1) to mole number derivatives (where the mole\nfractions do sum to one). Requires the derivatives and the mole fractions\nof the mixture.\nFrom https://chemicals.readthedocs.io/chemicals.utils.html?highlight=dxs_to_dns#chemicals.utils.dxs_to_dns Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: x (:) real(kind=pr), intent(in) :: dx (:) Return Value real(kind=pr), (size(x)) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: sum_xdx","tags":"","loc":"proc/dx_to_dn.html"},{"title":"sq_error – yaeos","text":"public elemental function sq_error(exp, pred) Uses yaeos__constants Squared error between two values. Description … Examples error = sq_error ( true_value , model_value ) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: exp real(kind=pr), intent(in) :: pred Return Value real(kind=pr)","tags":"","loc":"proc/sq_error.html"},{"title":"newton_1d – yaeos","text":"public subroutine newton_1d(f, x, tol, max_iters) Arguments Type Intent Optional Attributes Name procedure( f_1d ) :: f real(kind=pr), intent(inout) :: x real(kind=pr), intent(in) :: tol integer, intent(in) :: max_iters Variables Type Visibility Attributes Name Initial real(kind=pr), public :: df real(kind=pr), public :: fval integer, public :: i real(kind=pr), public :: step","tags":"","loc":"proc/newton_1d.html"},{"title":"newton – yaeos","text":"public interface newton Module Procedures public subroutine newton_1d (f, x, tol, max_iters) Arguments Type Intent Optional Attributes Name procedure( f_1d ) :: f real(kind=pr), intent(inout) :: x real(kind=pr), intent(in) :: tol integer, intent(in) :: max_iters","tags":"","loc":"interface/newton.html"},{"title":"residual_helmholtz – yaeos","text":"public subroutine residual_helmholtz(self, n, v, t, Ar, ArV, ArT, ArTV, ArV2, ArT2, Arn, ArVn, ArTn, Arn2) Type Bound ArModelAdiff Arguments Type Intent Optional Attributes Name class( ArModelAdiff ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: v real(kind=pr), intent(in) :: t real(kind=pr), intent(out), optional :: Ar real(kind=pr), intent(out), optional :: ArV real(kind=pr), intent(out), optional :: ArT real(kind=pr), intent(out), optional :: ArTV real(kind=pr), intent(out), optional :: ArV2 real(kind=pr), intent(out), optional :: ArT2 real(kind=pr), intent(out), optional, dimension(size(n)) :: Arn real(kind=pr), intent(out), optional, dimension(size(n)) :: ArVn real(kind=pr), intent(out), optional, dimension(size(n)) :: ArTn real(kind=pr), intent(out), optional :: Arn2 (size(n),size(n)) Variables Type Visibility Attributes Name Initial type( hyperdual ), public :: d_Ar type( hyperdual ), public :: d_n (size(n)) type( hyperdual ), public :: d_t type( hyperdual ), public :: d_v Subroutines subroutine get_dardn () Arguments None subroutine get_dardn2 () Arguments None subroutine get_dardt () Arguments None subroutine get_dardt2 () Arguments None subroutine get_dardtn () Arguments None subroutine get_dardv () Arguments None subroutine get_dardv2 () Arguments None subroutine get_dardvn () Arguments None subroutine get_dardvt () Arguments None subroutine reset_vars () Arguments None","tags":"","loc":"proc/residual_helmholtz~2.html"},{"title":"Psat – yaeos","text":"public function Psat(eos, ncomp, T) Calculation of saturation pressure of a pure component using the\nsecant method. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model that will be used integer, intent(in) :: ncomp Number of component in the mixture from which the saturation pressure\nwill be calculated real(kind=pr), intent(in) :: T Temperature [K] Return Value real(kind=pr) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: P1 real(kind=pr), public :: P2 real(kind=pr), public :: f1 real(kind=pr), public :: f2 real(kind=pr), public :: n (size(eos)) Functions function diff (P) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: P Return Value real(kind=pr)","tags":"","loc":"proc/psat.html"},{"title":"size_ar_model – yaeos","text":"public pure function size_ar_model(eos) Get the size of the model. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Return Value integer","tags":"","loc":"proc/size_ar_model.html"},{"title":"Cp_residual_vt – yaeos","text":"public subroutine Cp_residual_vt(eos, n, V, T, Cp) Uses yaeos__constants Calculate residual heat capacity pressure constant given v and t. Type Bound ArModel Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: V Volume [L] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out) :: Cp heat capacity p constant [bar L / K / mol] Variables Type Visibility Attributes Name Initial real(kind=pr), public :: Ar real(kind=pr), public :: ArT2 real(kind=pr), public :: Cv real(kind=pr), public :: dPdT real(kind=pr), public :: dPdV real(kind=pr), public :: p real(kind=pr), public :: totn","tags":"","loc":"proc/cp_residual_vt.html"},{"title":"Cv_residual_vt – yaeos","text":"public subroutine Cv_residual_vt(eos, n, V, T, Cv) Calculate residual heat capacity volume constant given v and t. Type Bound ArModel Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: V Volume [L] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out) :: Cv heat capacity v constant [bar L / K / mol] Variables Type Visibility Attributes Name Initial real(kind=pr), public :: Ar real(kind=pr), public :: ArT2","tags":"","loc":"proc/cv_residual_vt.html"},{"title":"enthalpy_residual_vt – yaeos","text":"public subroutine enthalpy_residual_vt(eos, n, v, t, Hr, HrT, HrV, Hrn) Calculate residual enthalpy given volume and temperature. Type Bound ArModel Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: v Volume [L] real(kind=pr), intent(in) :: t Temperature [K] real(kind=pr), intent(out) :: Hr Residual enthalpy [bar L / mol] real(kind=pr), intent(out), optional :: HrT real(kind=pr), intent(out), optional :: HrV real(kind=pr), intent(out), optional :: Hrn (size(n)) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: Ar real(kind=pr), public :: ArT real(kind=pr), public :: ArT2 real(kind=pr), public :: ArTV real(kind=pr), public :: ArTn (size(n)) real(kind=pr), public :: ArV real(kind=pr), public :: ArV2 real(kind=pr), public :: ArVn (size(n)) real(kind=pr), public :: Arn (size(n))","tags":"","loc":"proc/enthalpy_residual_vt.html"},{"title":"entropy_residual_vt – yaeos","text":"public subroutine entropy_residual_vt(eos, n, V, T, Sr, SrT, SrV, Srn) Calculate residual entropy given volume and temperature. Type Bound ArModel Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: V Volume [L] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out) :: Sr Entropy [bar L / K / mol] real(kind=pr), intent(out), optional :: SrT real(kind=pr), intent(out), optional :: SrV real(kind=pr), intent(out), optional :: Srn (size(n)) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: Ar real(kind=pr), public :: ArT real(kind=pr), public :: ArT2 real(kind=pr), public :: ArTV real(kind=pr), public :: ArTn (size(n))","tags":"","loc":"proc/entropy_residual_vt.html"},{"title":"fugacity_pt – yaeos","text":"public subroutine fugacity_pt(eos, n, P, T, V, root_type, lnPhi, dlnPhidP, dlnPhidT, dlnPhidn, dPdV, dPdT, dPdn) Uses iso_fortran_env Calculate logarithm of fugacity, given pressure and temperature. This routine will obtain the desired volume root at the specified\npressure and calculate fugacity at that point. Type Bound ArModel Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Mixture mole numbers real(kind=pr), intent(in) :: P Pressure [bar] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out), optional :: V Volume [L] character(len=*), intent(in) :: root_type Type of root desired [“liquid”, “vapor”, “stable”] real(kind=pr), intent(out), optional :: lnPhi (size(n)) vector real(kind=pr), intent(out), optional :: dlnPhidP (size(n)) ln(phi) Presssure derivative real(kind=pr), intent(out), optional :: dlnPhidT (size(n)) ln(phi) Temp derivative real(kind=pr), intent(out), optional :: dlnPhidn (size(n),size(n)) ln(phi) compositional derivative real(kind=pr), intent(out), optional :: dPdV real(kind=pr), intent(out), optional :: dPdT real(kind=pr), intent(out), optional :: dPdn (size(n)) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: P_in real(kind=pr), public :: V_in","tags":"","loc":"proc/fugacity_pt.html"},{"title":"fugacity_vt – yaeos","text":"public subroutine fugacity_vt(eos, n, V, T, P, lnPhi, dlnPhidP, dlnPhidT, dlnPhidn, dPdV, dPdT, dPdn) Calculate fugacity coefficent given volume and temperature. Note While the natural output variable is . The calculated\nderivatives will be the derivatives of the fugacity coefficient Type Bound ArModel Arguments Type Intent Optional Attributes Name class( ArModel ) :: eos Model real(kind=pr), intent(in) :: n (:) Mixture mole numbers real(kind=pr), intent(in) :: V Volume [L] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out), optional :: P Pressure [bar] real(kind=pr), intent(out), optional :: lnPhi (size(n)) vector real(kind=pr), intent(out), optional :: dlnPhidP (size(n)) Presssure derivative real(kind=pr), intent(out), optional :: dlnPhidT (size(n)) Temp derivative real(kind=pr), intent(out), optional :: dlnPhidn (size(n),size(n)) compositional derivative real(kind=pr), intent(out), optional :: dPdV real(kind=pr), intent(out), optional :: dPdT real(kind=pr), intent(out), optional :: dPdn (:) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: Ar real(kind=pr), public :: ArTV real(kind=pr), public, dimension(size(n)) :: ArTn real(kind=pr), public :: ArV real(kind=pr), public :: ArV2 real(kind=pr), public, dimension(size(n)) :: ArVn real(kind=pr), public, dimension(size(n)) :: Arn real(kind=pr), public :: Arn2 (size(n),size(n)) real(kind=pr), public :: P_in real(kind=pr), public :: RT real(kind=pr), public :: Z real(kind=pr), public :: dPdT_in real(kind=pr), public :: dPdV_in real(kind=pr), public :: dPdn_in (size(n)) integer, public :: i integer, public :: j integer, public :: nc real(kind=pr), public :: totn","tags":"","loc":"proc/fugacity_vt.html"},{"title":"gibbs_residual_VT – yaeos","text":"public subroutine gibbs_residual_VT(eos, n, V, T, Gr, GrT, GrV, Grn) Uses yaeos__constants Calculate residual Gibbs energy given volume and temperature. Type Bound ArModel Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: V Volume [L] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out) :: Gr Gibbs energy [bar L / mol] real(kind=pr), intent(out), optional :: GrT real(kind=pr), intent(out), optional :: GrV real(kind=pr), intent(out), optional :: Grn (size(n)) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: Ar real(kind=pr), public :: ArT real(kind=pr), public :: ArV real(kind=pr), public :: Arn (size(n)) real(kind=pr), public :: dPdT real(kind=pr), public :: dPdV real(kind=pr), public :: dPdn (size(n)) real(kind=pr), public :: p real(kind=pr), public :: totn real(kind=pr), public :: z","tags":"","loc":"proc/gibbs_residual_vt.html"},{"title":"pressure – yaeos","text":"public subroutine pressure(eos, n, v, t, p, dPdV, dPdT, dPdn) Pressure calculation. Calculate pressure using residual helmholtz models. Examples class ( ArModel ), allocatable :: eos real ( pr ) :: n ( 2 ), t , v , p , dPdV , dPdT , dPdn ( 2 ) eos = PengRobinson ( Tc , Pc , w ) n = [ 1.0_pr , 1.0_pr ] t = 30 0.0_pr v = 1.0_pr call eos % pressure ( n , V , T , P , dPdV = dPdV , dPdT = dPdT , dPdn = dPdn ) Type Bound ArModel Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: v Volume [L] real(kind=pr), intent(in) :: t Temperature [K] real(kind=pr), intent(out) :: p Pressure [bar] real(kind=pr), intent(out), optional :: dPdV real(kind=pr), intent(out), optional :: dPdT real(kind=pr), intent(out), optional :: dPdn (:) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: Ar real(kind=pr), public :: ArTV real(kind=pr), public :: ArV real(kind=pr), public :: ArV2 real(kind=pr), public :: ArVn (size(eos)) logical, public :: dn integer, public :: nc real(kind=pr), public :: totn","tags":"","loc":"proc/pressure.html"},{"title":"volume – yaeos","text":"public subroutine volume(eos, n, P, T, V, root_type) Uses yaeos__constants yaeos__math Volume solver routine for residual Helmholtz models. Solves volume roots using newton method. Given pressure and temperature. Description This subroutine solves the volume using a newton method. The variable root_type Examples class ( ArModel ) :: eos call eos % volume ( n , P , T , V , root_type = \"liquid\" ) call eos % volume ( n , P , T , V , root_type = \"vapor\" ) call eos % volume ( n , P , T , V , root_type = \"stable\" ) Type Bound ArModel Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: P Pressure [bar] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out) :: V Volume [L] character(len=*), intent(in) :: root_type Desired root-type to solve. Options are: [\"liquid\", \"vapor\", \"stable\"] Variables Type Visibility Attributes Name Initial real(kind=pr), public :: Gr real(kind=pr), public :: GrL real(kind=pr), public :: GrV real(kind=pr), public :: Vliq real(kind=pr), public :: Vvap integer, public :: max_iters = 30 real(kind=pr), public :: tol = 1e-7 real(kind=pr), public :: totnRT Subroutines subroutine foo (x, f, df) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: x real(kind=pr), intent(out) :: f real(kind=pr), intent(out) :: df","tags":"","loc":"proc/volume~2.html"},{"title":"size – yaeos","text":"public interface size Module Procedures public pure function size_ar_model (eos) Get the size of the model. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Return Value integer","tags":"","loc":"interface/size.html"},{"title":"AddHyperDualHyperDual – yaeos","text":"public elemental function AddHyperDualHyperDual(v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual )","tags":"","loc":"proc/addhyperdualhyperdual.html"},{"title":"AddHyperDualReal – yaeos","text":"public elemental function AddHyperDualReal(v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 real(kind=pr), intent(in) :: v2 Return Value type( hyperdual )","tags":"","loc":"proc/addhyperdualreal.html"},{"title":"AddRealHyperDual – yaeos","text":"public elemental function AddRealHyperDual(v1, v2) result(v3) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual )","tags":"","loc":"proc/addrealhyperdual.html"},{"title":"DivideHyperDualHyperDual – yaeos","text":"public elemental function DivideHyperDualHyperDual(v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual )","tags":"","loc":"proc/dividehyperdualhyperdual.html"},{"title":"DivideHyperDualReal – yaeos","text":"public elemental function DivideHyperDualReal(v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 real(kind=pr), intent(in) :: v2 Return Value type( hyperdual ) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: invV2","tags":"","loc":"proc/dividehyperdualreal.html"},{"title":"DivideRealHyperDual – yaeos","text":"public elemental function DivideRealHyperDual(v1, v2) result(v3) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) Variables Type Visibility Attributes Name Initial type( hyperdual ), public :: invV2","tags":"","loc":"proc/dividerealhyperdual.html"},{"title":"MinusHyperDualHyperDual – yaeos","text":"public elemental function MinusHyperDualHyperDual(v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual )","tags":"","loc":"proc/minushyperdualhyperdual.html"},{"title":"MultiplyHyperDualHyperDual – yaeos","text":"public elemental function MultiplyHyperDualHyperDual(v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual )","tags":"","loc":"proc/multiplyhyperdualhyperdual.html"},{"title":"MultiplyHyperDualInt – yaeos","text":"public elemental function MultiplyHyperDualInt(v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 integer, intent(in) :: v2 Return Value type( hyperdual )","tags":"","loc":"proc/multiplyhyperdualint.html"},{"title":"MultiplyHyperDualReal – yaeos","text":"public elemental function MultiplyHyperDualReal(v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 real(kind=pr), intent(in) :: v2 Return Value type( hyperdual )","tags":"","loc":"proc/multiplyhyperdualreal.html"},{"title":"MultiplyIntHyperDual – yaeos","text":"public elemental function MultiplyIntHyperDual(v1, v2) result(v3) Arguments Type Intent Optional Attributes Name integer, intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual )","tags":"","loc":"proc/multiplyinthyperdual.html"},{"title":"MultiplyRealHyperDual – yaeos","text":"public elemental function MultiplyRealHyperDual(v1, v2) result(v3) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual )","tags":"","loc":"proc/multiplyrealhyperdual.html"},{"title":"PlusHyperDualHyperDual – yaeos","text":"public elemental function PlusHyperDualHyperDual(v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual )","tags":"","loc":"proc/plushyperdualhyperdual.html"},{"title":"PowerHyperDualHyperDual – yaeos","text":"public elemental function PowerHyperDualHyperDual(v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) Variables Type Visibility Attributes Name Initial type( hyperdual ), public :: v4","tags":"","loc":"proc/powerhyperdualhyperdual.html"},{"title":"PowerHyperDualInt – yaeos","text":"public elemental function PowerHyperDualInt(v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 integer, intent(in) :: v2 Return Value type( hyperdual ) Variables Type Visibility Attributes Name Initial integer, public :: i integer, public :: vv2","tags":"","loc":"proc/powerhyperdualint.html"},{"title":"PowerHyperDualReal – yaeos","text":"public elemental function PowerHyperDualReal(v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 real(kind=pr), intent(in) :: v2 Return Value type( hyperdual ) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: deriv real(kind=pr), public, parameter :: tol = 1.0e-15_pr real(kind=pr), public :: xval","tags":"","loc":"proc/powerhyperdualreal.html"},{"title":"SubtractHyperDualHyperDual – yaeos","text":"public elemental function SubtractHyperDualHyperDual(v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual )","tags":"","loc":"proc/subtracthyperdualhyperdual.html"},{"title":"SubtractHyperDualReal – yaeos","text":"public elemental function SubtractHyperDualReal(v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 real(kind=pr), intent(in) :: v2 Return Value type( hyperdual )","tags":"","loc":"proc/subtracthyperdualreal.html"},{"title":"SubtractRealHyperDual – yaeos","text":"public elemental function SubtractRealHyperDual(v1, v2) result(v3) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual )","tags":"","loc":"proc/subtractrealhyperdual.html"},{"title":"SumHyperDual – yaeos","text":"public pure function SumHyperDual(v1, mask) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 (:) logical, intent(in), optional :: mask (:) Return Value type( hyperdual ) Variables Type Visibility Attributes Name Initial integer, public :: i","tags":"","loc":"proc/sumhyperdual.html"},{"title":"SumHyperDual2 – yaeos","text":"public pure function SumHyperDual2(v1, dim) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 (:,:) integer, intent(in) :: dim Return Value type( hyperdual ), allocatable, (:) Variables Type Visibility Attributes Name Initial integer, public :: i","tags":"","loc":"proc/sumhyperdual2.html"},{"title":"absHyperDual – yaeos","text":"public elemental function absHyperDual(v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual )","tags":"","loc":"proc/abshyperdual.html"},{"title":"acosHyperDual – yaeos","text":"public elemental function acosHyperDual(v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: deriv real(kind=pr), public :: deriv1","tags":"","loc":"proc/acoshyperdual.html"},{"title":"asinHyperDual – yaeos","text":"public elemental function asinHyperDual(v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: deriv real(kind=pr), public :: deriv1","tags":"","loc":"proc/asinhyperdual.html"},{"title":"atan2HyperDual – yaeos","text":"public elemental function atan2HyperDual(v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: a real(kind=pr), public :: b real(kind=pr), public :: c real(kind=pr), public :: d","tags":"","loc":"proc/atan2hyperdual.html"},{"title":"atanHyperDual – yaeos","text":"public elemental function atanHyperDual(v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: deriv real(kind=pr), public :: deriv1","tags":"","loc":"proc/atanhyperdual.html"},{"title":"cosHyperDual – yaeos","text":"public elemental function cosHyperDual(v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: dx real(kind=pr), public :: f","tags":"","loc":"proc/coshyperdual.html"},{"title":"coshHyperDual – yaeos","text":"public elemental function coshHyperDual(v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) Variables Type Visibility Attributes Name Initial type( hyperdual ), public :: t1 type( hyperdual ), public :: t2","tags":"","loc":"proc/coshhyperdual.html"},{"title":"eq_dd – yaeos","text":"public function eq_dd(lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical","tags":"","loc":"proc/eq_dd.html"},{"title":"eq_di – yaeos","text":"public function eq_di(lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs integer, intent(in) :: rhs Return Value logical","tags":"","loc":"proc/eq_di.html"},{"title":"eq_dr – yaeos","text":"public elemental function eq_dr(lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs real(kind=pr), intent(in) :: rhs Return Value logical","tags":"","loc":"proc/eq_dr.html"},{"title":"eq_id – yaeos","text":"public function eq_id(lhs, rhs) Arguments Type Intent Optional Attributes Name integer, intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical","tags":"","loc":"proc/eq_id.html"},{"title":"eq_rd – yaeos","text":"public elemental function eq_rd(lhs, rhs) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical","tags":"","loc":"proc/eq_rd.html"},{"title":"expHyperDual – yaeos","text":"public elemental function expHyperDual(v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: dx","tags":"","loc":"proc/exphyperdual.html"},{"title":"ge_dd – yaeos","text":"public function ge_dd(lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical","tags":"","loc":"proc/ge_dd.html"},{"title":"ge_di – yaeos","text":"public function ge_di(lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs integer, intent(in) :: rhs Return Value logical","tags":"","loc":"proc/ge_di.html"},{"title":"ge_dr – yaeos","text":"public function ge_dr(lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs real(kind=pr), intent(in) :: rhs Return Value logical","tags":"","loc":"proc/ge_dr.html"},{"title":"ge_id – yaeos","text":"public function ge_id(lhs, rhs) Arguments Type Intent Optional Attributes Name integer, intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical","tags":"","loc":"proc/ge_id.html"},{"title":"ge_rd – yaeos","text":"public function ge_rd(lhs, rhs) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical","tags":"","loc":"proc/ge_rd.html"},{"title":"gt_dd – yaeos","text":"public function gt_dd(lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical","tags":"","loc":"proc/gt_dd.html"},{"title":"gt_di – yaeos","text":"public function gt_di(lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs integer, intent(in) :: rhs Return Value logical","tags":"","loc":"proc/gt_di.html"},{"title":"gt_dr – yaeos","text":"public function gt_dr(lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs real(kind=pr), intent(in) :: rhs Return Value logical","tags":"","loc":"proc/gt_dr.html"},{"title":"gt_id – yaeos","text":"public function gt_id(lhs, rhs) Arguments Type Intent Optional Attributes Name integer, intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical","tags":"","loc":"proc/gt_id.html"},{"title":"gt_rd – yaeos","text":"public function gt_rd(lhs, rhs) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical","tags":"","loc":"proc/gt_rd.html"},{"title":"intHyperDual – yaeos","text":"public elemental function intHyperDual(v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value integer","tags":"","loc":"proc/inthyperdual.html"},{"title":"le_dd – yaeos","text":"public function le_dd(lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical","tags":"","loc":"proc/le_dd.html"},{"title":"le_di – yaeos","text":"public function le_di(lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs integer, intent(in) :: rhs Return Value logical","tags":"","loc":"proc/le_di.html"},{"title":"le_dr – yaeos","text":"public function le_dr(lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs real(kind=pr), intent(in) :: rhs Return Value logical","tags":"","loc":"proc/le_dr.html"},{"title":"le_id – yaeos","text":"public function le_id(lhs, rhs) Arguments Type Intent Optional Attributes Name integer, intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical","tags":"","loc":"proc/le_id.html"},{"title":"le_rd – yaeos","text":"public function le_rd(lhs, rhs) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical","tags":"","loc":"proc/le_rd.html"},{"title":"log10HyperDual – yaeos","text":"public elemental function log10HyperDual(v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual )","tags":"","loc":"proc/log10hyperdual.html"},{"title":"logHyperDual – yaeos","text":"public elemental function logHyperDual(v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: dx1 real(kind=pr), public :: dx2","tags":"","loc":"proc/loghyperdual.html"},{"title":"lt_dd – yaeos","text":"public function lt_dd(lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical","tags":"","loc":"proc/lt_dd.html"},{"title":"lt_di – yaeos","text":"public function lt_di(lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs integer, intent(in) :: rhs Return Value logical","tags":"","loc":"proc/lt_di.html"},{"title":"lt_dr – yaeos","text":"public function lt_dr(lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs real(kind=pr), intent(in) :: rhs Return Value logical","tags":"","loc":"proc/lt_dr.html"},{"title":"lt_id – yaeos","text":"public function lt_id(lhs, rhs) Arguments Type Intent Optional Attributes Name integer, intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical","tags":"","loc":"proc/lt_id.html"},{"title":"lt_rd – yaeos","text":"public function lt_rd(lhs, rhs) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical","tags":"","loc":"proc/lt_rd.html"},{"title":"max_dd – yaeos","text":"public elemental function max_dd(v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual )","tags":"","loc":"proc/max_dd.html"},{"title":"max_ddd – yaeos","text":"public elemental function max_ddd(v1, v2, v3) result(v4) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 type( hyperdual ), intent(in) :: v3 Return Value type( hyperdual )","tags":"","loc":"proc/max_ddd.html"},{"title":"max_dr – yaeos","text":"public elemental function max_dr(v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 real(kind=pr), intent(in) :: v2 Return Value type( hyperdual )","tags":"","loc":"proc/max_dr.html"},{"title":"max_rd – yaeos","text":"public elemental function max_rd(v1, v2) result(v3) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual )","tags":"","loc":"proc/max_rd.html"},{"title":"min_dd – yaeos","text":"public elemental function min_dd(v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual )","tags":"","loc":"proc/min_dd.html"},{"title":"min_dr – yaeos","text":"public elemental function min_dr(v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 real(kind=pr), intent(in) :: v2 Return Value type( hyperdual )","tags":"","loc":"proc/min_dr.html"},{"title":"min_rd – yaeos","text":"public elemental function min_rd(v1, v2) result(v3) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual )","tags":"","loc":"proc/min_rd.html"},{"title":"ne_dd – yaeos","text":"public function ne_dd(lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical","tags":"","loc":"proc/ne_dd.html"},{"title":"ne_di – yaeos","text":"public function ne_di(lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs integer, intent(in) :: rhs Return Value logical","tags":"","loc":"proc/ne_di.html"},{"title":"ne_dr – yaeos","text":"public function ne_dr(lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs real(kind=pr), intent(in) :: rhs Return Value logical","tags":"","loc":"proc/ne_dr.html"},{"title":"ne_id – yaeos","text":"public function ne_id(lhs, rhs) Arguments Type Intent Optional Attributes Name integer, intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical","tags":"","loc":"proc/ne_id.html"},{"title":"ne_rd – yaeos","text":"public function ne_rd(lhs, rhs) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical","tags":"","loc":"proc/ne_rd.html"},{"title":"nintHyperDual – yaeos","text":"public elemental function nintHyperDual(v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value integer","tags":"","loc":"proc/ninthyperdual.html"},{"title":"realHyperDual – yaeos","text":"public elemental function realHyperDual(v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value real(kind=pr)","tags":"","loc":"proc/realhyperdual.html"},{"title":"sign_dd – yaeos","text":"public elemental function sign_dd(v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: ssign","tags":"","loc":"proc/sign_dd.html"},{"title":"sign_dr – yaeos","text":"public elemental function sign_dr(v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 real(kind=pr), intent(in) :: v2 Return Value type( hyperdual ) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: ssign","tags":"","loc":"proc/sign_dr.html"},{"title":"sign_rd – yaeos","text":"public elemental function sign_rd(v1, v2) result(v3) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: ssign","tags":"","loc":"proc/sign_rd.html"},{"title":"sinHyperDual – yaeos","text":"public elemental function sinHyperDual(v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: dx real(kind=pr), public :: f","tags":"","loc":"proc/sinhyperdual.html"},{"title":"sinhHyperDual – yaeos","text":"public elemental function sinhHyperDual(v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) Variables Type Visibility Attributes Name Initial type( hyperdual ), public :: t1 type( hyperdual ), public :: t2","tags":"","loc":"proc/sinhhyperdual.html"},{"title":"sqrtHyperDual – yaeos","text":"public elemental function sqrtHyperDual(v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) Variables Type Visibility Attributes Name Initial real(kind=pr), public, parameter :: expo = 3.0_pr/2.0_pr real(kind=pr), public :: square","tags":"","loc":"proc/sqrthyperdual.html"},{"title":"tanHyperDual – yaeos","text":"public elemental function tanHyperDual(v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: dx real(kind=pr), public :: f","tags":"","loc":"proc/tanhyperdual.html"},{"title":"tanhHyperDual – yaeos","text":"public elemental function tanhHyperDual(v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) Variables Type Visibility Attributes Name Initial type( hyperdual ), public :: t1 type( hyperdual ), public :: t2","tags":"","loc":"proc/tanhhyperdual.html"},{"title":"EqualHyperDualHyperDual – yaeos","text":"public elemental subroutine EqualHyperDualHyperDual(res, inp) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(out) :: res type( hyperdual ), intent(in) :: inp","tags":"","loc":"proc/equalhyperdualhyperdual.html"},{"title":"EqualHyperDualReal – yaeos","text":"public elemental subroutine EqualHyperDualReal(res, inp) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(out) :: res real(kind=pr), intent(in) :: inp","tags":"","loc":"proc/equalhyperdualreal.html"},{"title":"abs – yaeos","text":"public interface abs Module Procedures public elemental function absHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual )","tags":"","loc":"interface/abs.html"},{"title":"acos – yaeos","text":"public interface acos Module Procedures public elemental function acosHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual )","tags":"","loc":"interface/acos.html"},{"title":"asin – yaeos","text":"public interface asin Module Procedures public elemental function asinHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual )","tags":"","loc":"interface/asin.html"},{"title":"assignment (=) – yaeos","text":"public interface assignment (=) Module Procedures public elemental subroutine EqualHyperDualHyperDual (res, inp) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(out) :: res type( hyperdual ), intent(in) :: inp public elemental subroutine EqualHyperDualReal (res, inp) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(out) :: res real(kind=pr), intent(in) :: inp","tags":"","loc":"interface/assignment (=).html"},{"title":"atan – yaeos","text":"public interface atan Module Procedures public elemental function atanHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual )","tags":"","loc":"interface/atan.html"},{"title":"atan2 – yaeos","text":"public interface atan2 Module Procedures public elemental function atan2HyperDual (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual )","tags":"","loc":"interface/atan2.html"},{"title":"cos – yaeos","text":"public interface cos Module Procedures public elemental function cosHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual )","tags":"","loc":"interface/cos.html"},{"title":"cosh – yaeos","text":"public interface cosh Module Procedures public elemental function coshHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual )","tags":"","loc":"interface/cosh.html"},{"title":"exp – yaeos","text":"public interface exp Module Procedures public elemental function expHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual )","tags":"","loc":"interface/exp.html"},{"title":"int – yaeos","text":"public interface int Module Procedures public elemental function intHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value integer","tags":"","loc":"interface/int.html"},{"title":"log – yaeos","text":"public interface log Module Procedures public elemental function logHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual )","tags":"","loc":"interface/log.html"},{"title":"log10 – yaeos","text":"public interface log10 Module Procedures public elemental function log10HyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual )","tags":"","loc":"interface/log10.html"},{"title":"max – yaeos","text":"public interface max Module Procedures public elemental function max_dd (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public elemental function max_ddd (v1, v2, v3) result(v4) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 type( hyperdual ), intent(in) :: v3 Return Value type( hyperdual ) public elemental function max_dr (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 real(kind=pr), intent(in) :: v2 Return Value type( hyperdual ) public elemental function max_rd (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual )","tags":"","loc":"interface/max.html"},{"title":"min – yaeos","text":"public interface min Module Procedures public elemental function min_dd (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public elemental function min_dr (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 real(kind=pr), intent(in) :: v2 Return Value type( hyperdual ) public elemental function min_rd (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual )","tags":"","loc":"interface/min.html"},{"title":"nint – yaeos","text":"public interface nint Module Procedures public elemental function nintHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value integer","tags":"","loc":"interface/nint.html"},{"title":"operator (*) – yaeos","text":"public interface operator (*) Module Procedures public elemental function MultiplyHyperDualHyperDual (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public elemental function MultiplyHyperDualReal (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 real(kind=pr), intent(in) :: v2 Return Value type( hyperdual ) public elemental function MultiplyRealHyperDual (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public elemental function MultiplyHyperDualInt (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 integer, intent(in) :: v2 Return Value type( hyperdual ) public elemental function MultiplyIntHyperDual (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name integer, intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual )","tags":"","loc":"interface/operator (ASTERISK).html"},{"title":"operator (**) – yaeos","text":"public interface operator (**) Module Procedures public elemental function PowerHyperDualInt (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 integer, intent(in) :: v2 Return Value type( hyperdual ) public elemental function PowerHyperDualHyperDual (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public elemental function PowerHyperDualReal (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 real(kind=pr), intent(in) :: v2 Return Value type( hyperdual )","tags":"","loc":"interface/operator (ASTERISKASTERISK).html"},{"title":"operator (+) – yaeos","text":"public interface operator (+) Module Procedures public elemental function PlusHyperDualHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual )","tags":"","loc":"interface/operator (+).html"},{"title":"operator (+) – yaeos","text":"public interface operator (+) Module Procedures public elemental function AddHyperDualHyperDual (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public elemental function AddHyperDualReal (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 real(kind=pr), intent(in) :: v2 Return Value type( hyperdual ) public elemental function AddRealHyperDual (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual )","tags":"","loc":"interface/operator (+)~2.html"},{"title":"operator (-) – yaeos","text":"public interface operator (-) Module Procedures public elemental function MinusHyperDualHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual )","tags":"","loc":"interface/operator (-).html"},{"title":"operator (-) – yaeos","text":"public interface operator (-) Module Procedures public elemental function SubtractHyperDualHyperDual (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public elemental function SubtractHyperDualReal (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 real(kind=pr), intent(in) :: v2 Return Value type( hyperdual ) public elemental function SubtractRealHyperDual (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual )","tags":"","loc":"interface/operator (-)~2.html"},{"title":"operator (.eq.) – yaeos","text":"public interface operator (.eq.) Module Procedures public function eq_dd (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public elemental function eq_dr (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs real(kind=pr), intent(in) :: rhs Return Value logical public elemental function eq_rd (lhs, rhs) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public function eq_di (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs integer, intent(in) :: rhs Return Value logical public function eq_id (lhs, rhs) Arguments Type Intent Optional Attributes Name integer, intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical","tags":"","loc":"interface/operator (.eq.).html"},{"title":"operator (.ge.) – yaeos","text":"public interface operator (.ge.) Module Procedures public function ge_dd (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public function ge_dr (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs real(kind=pr), intent(in) :: rhs Return Value logical public function ge_rd (lhs, rhs) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public function ge_di (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs integer, intent(in) :: rhs Return Value logical public function ge_id (lhs, rhs) Arguments Type Intent Optional Attributes Name integer, intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical","tags":"","loc":"interface/operator (.ge.).html"},{"title":"operator (.gt.) – yaeos","text":"public interface operator (.gt.) Module Procedures public function gt_dd (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public function gt_dr (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs real(kind=pr), intent(in) :: rhs Return Value logical public function gt_rd (lhs, rhs) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public function gt_di (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs integer, intent(in) :: rhs Return Value logical public function gt_id (lhs, rhs) Arguments Type Intent Optional Attributes Name integer, intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical","tags":"","loc":"interface/operator (.gt.).html"},{"title":"operator (.le.) – yaeos","text":"public interface operator (.le.) Module Procedures public function le_dd (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public function le_dr (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs real(kind=pr), intent(in) :: rhs Return Value logical public function le_rd (lhs, rhs) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public function le_di (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs integer, intent(in) :: rhs Return Value logical public function le_id (lhs, rhs) Arguments Type Intent Optional Attributes Name integer, intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical","tags":"","loc":"interface/operator (.le.).html"},{"title":"operator (.lt.) – yaeos","text":"public interface operator (.lt.) Module Procedures public function lt_dd (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public function lt_dr (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs real(kind=pr), intent(in) :: rhs Return Value logical public function lt_rd (lhs, rhs) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public function lt_di (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs integer, intent(in) :: rhs Return Value logical public function lt_id (lhs, rhs) Arguments Type Intent Optional Attributes Name integer, intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical","tags":"","loc":"interface/operator (.lt.).html"},{"title":"operator (.ne.) – yaeos","text":"public interface operator (.ne.) Module Procedures public function ne_dd (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public function ne_dr (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs real(kind=pr), intent(in) :: rhs Return Value logical public function ne_rd (lhs, rhs) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public function ne_di (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs integer, intent(in) :: rhs Return Value logical public function ne_id (lhs, rhs) Arguments Type Intent Optional Attributes Name integer, intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical","tags":"","loc":"interface/operator (.ne.).html"},{"title":"operator (/) – yaeos","text":"public interface operator (/) Module Procedures public elemental function DivideHyperDualHyperDual (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public elemental function DivideHyperDualReal (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 real(kind=pr), intent(in) :: v2 Return Value type( hyperdual ) public elemental function DivideRealHyperDual (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual )","tags":"","loc":"interface/operator (SLASH).html"},{"title":"real – yaeos","text":"public interface real Module Procedures public elemental function realHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value real(kind=pr)","tags":"","loc":"interface/real.html"},{"title":"sign – yaeos","text":"public interface sign Module Procedures public elemental function sign_dd (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public elemental function sign_dr (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 real(kind=pr), intent(in) :: v2 Return Value type( hyperdual ) public elemental function sign_rd (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual )","tags":"","loc":"interface/sign.html"},{"title":"sin – yaeos","text":"public interface sin Module Procedures public elemental function sinHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual )","tags":"","loc":"interface/sin.html"},{"title":"sinh – yaeos","text":"public interface sinh Module Procedures public elemental function sinhHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual )","tags":"","loc":"interface/sinh.html"},{"title":"sqrt – yaeos","text":"public interface sqrt Module Procedures public elemental function sqrtHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual )","tags":"","loc":"interface/sqrt.html"},{"title":"sum – yaeos","text":"public interface sum Module Procedures public pure function SumHyperDual (v1, mask) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 (:) logical, intent(in), optional :: mask (:) Return Value type( hyperdual ) public pure function SumHyperDual2 (v1, dim) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 (:,:) integer, intent(in) :: dim Return Value type( hyperdual ), allocatable, (:)","tags":"","loc":"interface/sum.html"},{"title":"tan – yaeos","text":"public interface tan Module Procedures public elemental function tanHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual )","tags":"","loc":"interface/tan.html"},{"title":"tanh – yaeos","text":"public interface tanh Module Procedures public elemental function tanhHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual )","tags":"","loc":"interface/tanh.html"},{"title":"UNIFACParameters – yaeos","text":"public function UNIFACParameters() UNIFACParameters UNIFAC parameters Description Create a Instance of the yaeos GeGCModelParameters with the classic\nliquid-vapor UNIFAC parameters. Examples ! Instantiate an UNIFAC model with ethanol-water mix and calculate gammas use yaeos , only : pr , Groups , setup_unifac , UNIFAC use yaeos__models_ge_group_contribution_unifac_parameters , only : UNIFACParameters use yaeos__models_ge_group_contribution_model_parameters , only : GeGCModelParameters type ( UNIFAC ) :: model type ( Groups ) :: molecules ( 2 ) real ( pr ) :: ln_gammas ( 2 ) type ( GeGCModelParameters ) :: parameters ! Ethanol definition [CH3, CH2, OH] molecules ( 1 )% groups_ids = [ 1 , 2 , 14 ] ! Subgroups ids molecules ( 1 )% number_of_groups = [ 1 , 1 , 1 ] ! Subgroups occurrences ! Water definition [H2O] molecules ( 2 )% groups_ids = [ 16 ] molecules ( 2 )% number_of_groups = [ 1 ] parameters = UNIFACParameters () ! Model setup ! Disclaimer: the default parameters object can be ommited in the ! setup_unifac call, because if the parameters argument is not ! provided, the return of the constructor UNIFACParameters() will be ! used either way. This is just a demostration. model = setup_unifac ( molecules , parameters ) ! Calculate ln_gammas call model % ln_activity_coefficient ([ 0.5_pr , 0.5_pr ], 29 8.0_pr , ln_gammas ) print * , ln_gammas ! result: 0.18534142000449058 0.40331395945417559 References Dortmund Data Bank Software & Separation Technology Fredenslund, A., Jones, R. L., & Prausnitz, J. M. (1975).\nGroup‐contribution estimation of activity coefficients in nonideal liquid\nmixtures. AIChE Journal, 21(6), 1086–1099. https://doi.org/10.1002/aic.690210607 Skjold-Jorgensen, S., Kolbe, B., Gmehling, J., & Rasmussen, P. (1979).\nVapor-Liquid Equilibria by UNIFAC Group Contribution. Revision and\nExtension. Industrial & Engineering Chemistry Process Design and\nDevelopment, 18(4), 714–722. https://doi.org/10.1021/i260072a024 Gmehling, J., Rasmussen, P., & Fredenslund, A. (1982). Vapor-liquid\nequilibriums by UNIFAC group contribution. Revision and extension. 2.\nIndustrial & Engineering Chemistry Process Design and Development, 21(1),\n118–127. https://doi.org/10.1021/i200016a021 Macedo, E. A., Weidlich, U., Gmehling, J., & Rasmussen, P. (1983).\nVapor-liquid equilibriums by UNIFAC group contribution. Revision and\nextension. 3. Industrial & Engineering Chemistry Process Design and\nDevelopment, 22(4), 676–678. https://doi.org/10.1021/i200023a023 Tiegs, D., Rasmussen, P., Gmehling, J., & Fredenslund, A. (1987).\nVapor-liquid equilibria by UNIFAC group contribution. 4. Revision and\nextension. Industrial & Engineering Chemistry Research, 26(1), 159–161. https://doi.org/10.1021/ie00061a030 Hansen, H. K., Rasmussen, P., Fredenslund, A., Schiller, M., &\nGmehling, J. (1991). Vapor-liquid equilibria by UNIFAC group\ncontribution. 5. Revision and extension. Industrial & Engineering\nChemistry Research, 30 (10), 2352–2355. https://doi.org/10.1021/ie00058a017 Wittig, R., Lohmann, J., & Gmehling, J. (2003). Vapor−Liquid Equilibria\nby UNIFAC Group Contribution. 6. Revision and Extension. Industrial &\nEngineering Chemistry Research, 42(1), 183–188. https://doi.org/10.1021/ie020506l Arguments None Return Value type( GeGCModelParameters )","tags":"","loc":"proc/unifacparameters.html"},{"title":"model_from_X – yaeos","text":"public subroutine model_from_X(problem, X) Uses yaeos yaeos__models_ar_cubic_quadratic_mixing Type Bound FitMHVNRTL Arguments Type Intent Optional Attributes Name class( FitMHVNRTL ), intent(inout) :: problem real(kind=pr), intent(in) :: X (:) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: a (nc,nc) real(kind=pr), public :: b (nc,nc) real(kind=pr), public :: c (nc,nc) type( NRTL ), public :: ge","tags":"","loc":"proc/model_from_x.html"},{"title":"betalimits – yaeos","text":"public subroutine betalimits(z, K, bmin, bmax) Define beta limits to avoid overshooting when solving the Rachford-Rice\nequation. This is based on the assumtion that either and . Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: z (:) Molar fractions vector real(kind=pr), intent(in) :: K (:) K-factors real(kind=pr), intent(out) :: bmin Minimum beta value real(kind=pr), intent(out) :: bmax Maximum beta value Variables Type Visibility Attributes Name Initial real(kind=pr), public, dimension(size(z)) :: vmax real(kind=pr), public, dimension(size(z)) :: vmin","tags":"","loc":"proc/betalimits.html"},{"title":"betato01 – yaeos","text":"public subroutine betato01(z, K) Modify K-factor values to assure that lies between (0,1) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: z (:) Molar fractions of the system real(kind=pr) :: K (:) K factors Variables Type Visibility Attributes Name Initial real(kind=pr), public :: g0 real(kind=pr), public :: g1","tags":"","loc":"proc/betato01.html"},{"title":"rachford_rice – yaeos","text":"public subroutine rachford_rice(z, K, beta, rr, drrdb) Rachford-Rice equation for a two phase system Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: z (:) real(kind=pr), intent(in) :: K (:) real(kind=pr), intent(in) :: beta real(kind=pr), intent(out) :: rr real(kind=pr), intent(out) :: drrdb Variables Type Visibility Attributes Name Initial real(kind=pr), public :: denom (size(z))","tags":"","loc":"proc/rachford_rice.html"},{"title":"solve_rr – yaeos","text":"public subroutine solve_rr(z, K, beta, beta_min, beta_max) Solve the Rachford-Rice Equation. Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: z (:) Mole fractions vector real(kind=pr), intent(in) :: K (:) K-factors real(kind=pr), intent(out) :: beta value real(kind=pr), intent(out) :: beta_min Lower limit for real(kind=pr), intent(out) :: beta_max Upper limit for Variables Type Visibility Attributes Name Initial real(kind=pr), public :: dgdb real(kind=pr), public :: g real(kind=pr), public :: step","tags":"","loc":"proc/solve_rr.html"},{"title":"model_from_X – yaeos","text":"public subroutine model_from_X(problem, X) Uses yaeos Type Bound FitKijLij Arguments Type Intent Optional Attributes Name class( FitKijLij ), intent(inout) :: problem real(kind=pr), intent(in) :: X (:) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: kij (nc,nc) real(kind=pr), public :: lij (nc,nc)","tags":"","loc":"proc/model_from_x~2.html"},{"title":"cubic_v0 – yaeos","text":"public function cubic_v0(z, p, t) Arguments Type Intent Optional Attributes Name real(kind=pr) :: z (:) real(kind=pr) :: p real(kind=pr) :: t Return Value real(kind=pr) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: dbi (nc) real(kind=pr), public :: dbij (nc,nc)","tags":"","loc":"proc/cubic_v0.html"},{"title":"ArVnder – yaeos","text":"public subroutine ArVnder(nc, nder, ntemp, z, V, T, ar, arv, artv, arv2, Arn, ArVn, ArTn, Arn2) Arguments Type Intent Optional Attributes Name integer, intent(in) :: nc integer, intent(in) :: nder integer, intent(in) :: ntemp real(kind=pr), intent(in) :: z (nc) real(kind=pr), intent(in) :: V real(kind=pr), intent(in) :: T real(kind=pr), intent(out) :: ar real(kind=pr), intent(out) :: arv real(kind=pr), intent(out) :: artv real(kind=pr), intent(out) :: arv2 real(kind=pr), intent(out), dimension(size(z)) :: Arn real(kind=pr), intent(out), dimension(size(z)) :: ArVn real(kind=pr), intent(out), dimension(size(z)) :: ArTn real(kind=pr), intent(out) :: Arn2 (size(z),size(z))","tags":"","loc":"proc/arvnder.html"},{"title":"Bnder – yaeos","text":"public subroutine Bnder(nc, rn, Bmix, dBi, dBij) Arguments Type Intent Optional Attributes Name integer, intent(in) :: nc real(kind=pr), intent(in) :: rn (nc) real(kind=pr), intent(out) :: Bmix real(kind=pr), intent(out) :: dBi (nc) real(kind=pr), intent(out) :: dBij (nc,nc) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: aux (nc) integer, public :: i integer, public :: j real(kind=pr), public :: totn","tags":"","loc":"proc/bnder.html"},{"title":"DELTAnder – yaeos","text":"public subroutine DELTAnder(nc, rn, D1m, dD1i, dD1ij) Arguments Type Intent Optional Attributes Name integer, intent(in) :: nc real(kind=pr), intent(in) :: rn (nc) real(kind=pr), intent(out) :: D1m real(kind=pr), intent(out) :: dD1i (nc) real(kind=pr), intent(out) :: dD1ij (nc,nc) Variables Type Visibility Attributes Name Initial integer, public :: i integer, public :: j real(kind=pr), public :: totn","tags":"","loc":"proc/deltander.html"},{"title":"DandTnder – yaeos","text":"public subroutine DandTnder(ntd, nc, T, rn, D, dDi, dDiT, dDij, dDdT, dDdT2) Arguments Type Intent Optional Attributes Name integer, intent(in) :: ntd integer, intent(in) :: nc real(kind=pr), intent(in) :: T real(kind=pr), intent(in) :: rn (nc) real(kind=pr), intent(out) :: D real(kind=pr), intent(out) :: dDi (nc) real(kind=pr), intent(out) :: dDiT (nc) real(kind=pr), intent(out) :: dDij (nc,nc) real(kind=pr), intent(out) :: dDdT real(kind=pr), intent(out) :: dDdT2 Variables Type Visibility Attributes Name Initial real(kind=pr), public :: aij (nc,nc) real(kind=pr), public :: aux real(kind=pr), public :: aux2 real(kind=pr), public :: daijdT (nc,nc) real(kind=pr), public :: daijdT2 (nc,nc) integer, public :: i integer, public :: j","tags":"","loc":"proc/dandtnder.html"},{"title":"HelmRKPR – yaeos","text":"public subroutine HelmRKPR(nco, NDE, NTD, rn, V, T, Ar, ArV, ArTV, ArV2, Arn, ArVn, ArTn, Arn2) Calculate the reduced residual Helmholtz Energy and it’s derivatives with the RKPR EOS Arguments Type Intent Optional Attributes Name integer, intent(in) :: nco integer, intent(in) :: NDE integer, intent(in) :: NTD real(kind=pr), intent(in) :: rn (nco) real(kind=pr), intent(in) :: V real(kind=pr), intent(in) :: T real(kind=pr), intent(out) :: Ar real(kind=pr), intent(out) :: ArV real(kind=pr), intent(out) :: ArTV real(kind=pr), intent(out) :: ArV2 real(kind=pr), intent(out) :: Arn (nco) real(kind=pr), intent(out) :: ArVn (nco) real(kind=pr), intent(out) :: ArTn (nco) real(kind=pr), intent(out) :: Arn2 (nco,nco) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: AUX real(kind=pr), public :: ArT real(kind=pr), public :: ArTT real(kind=pr), public :: Bmix real(kind=pr), public :: D real(kind=pr), public :: D1 real(kind=pr), public :: D2 real(kind=pr), public :: FFB real(kind=pr), public :: FFBB real(kind=pr), public :: FFBV real(kind=pr), public :: auxD2 real(kind=pr), public :: dBi (nco) real(kind=pr), public :: dBij (nco,nco) real(kind=pr), public :: dD1i (nco) real(kind=pr), public :: dD1ij (nco,nco) real(kind=pr), public :: dDdT real(kind=pr), public :: dDdT2 real(kind=pr), public :: dDi (nco) real(kind=pr), public :: dDiT (nco) real(kind=pr), public :: dDij (nco,nco) real(kind=pr), public :: f real(kind=pr), public :: fB real(kind=pr), public :: fBD1 real(kind=pr), public :: fD1 real(kind=pr), public :: fD1D1 real(kind=pr), public :: fVD1 real(kind=pr), public :: fv real(kind=pr), public :: fv2 real(kind=pr), public :: g real(kind=pr), public :: gv real(kind=pr), public :: gv2 integer, public :: i integer, public :: j real(kind=pr), public :: totn","tags":"","loc":"proc/helmrkpr.html"},{"title":"HelmSRKPR – yaeos","text":"public subroutine HelmSRKPR(nc, nd, nt, rn, v, t, ar, arv, artv, arv2, Arn, ArVn, ArTn, Arn2) Arguments Type Intent Optional Attributes Name integer, intent(in) :: nc Number of components integer, intent(in) :: nd Compositional derivatives integer, intent(in) :: nt Temperature derivatives real(kind=pr), intent(in) :: rn (nc) Number of moles real(kind=pr), intent(in) :: v Volume [L] real(kind=pr), intent(in) :: t Temperature [K] real(kind=pr), intent(out) :: ar Residual Helmholtz real(kind=pr), intent(out) :: arv dAr/dV real(kind=pr), intent(out) :: artv dAr2/dTV real(kind=pr), intent(out) :: arv2 dAr2/dV2 real(kind=pr), intent(out) :: Arn (nc) dAr/dn real(kind=pr), intent(out) :: ArVn (nc) dAr2/dVn real(kind=pr), intent(out) :: ArTn (nc) dAr2/dTn real(kind=pr), intent(out) :: Arn2 (nc,nc) dAr2/dn2 Variables Type Visibility Attributes Name Initial real(kind=pr), public :: AUX real(kind=pr), public :: ArT real(kind=pr), public :: ArTT real(kind=pr), public :: Bmix real(kind=pr), public :: D real(kind=pr), public :: FFB real(kind=pr), public :: FFBB real(kind=pr), public :: FFBV real(kind=pr), public :: a real(kind=pr), public :: b_v real(kind=pr), public :: d1 real(kind=pr), public :: d2 real(kind=pr), public :: dBi (nc) real(kind=pr), public :: dBij (nc,nc) real(kind=pr), public :: dDdT real(kind=pr), public :: dDdT2 real(kind=pr), public :: dDi (nc) real(kind=pr), public :: dDiT (nc) real(kind=pr), public :: dDij (nc,nc) real(kind=pr), public :: f real(kind=pr), public :: fB real(kind=pr), public :: fv real(kind=pr), public :: fv2 real(kind=pr), public :: g real(kind=pr), public :: gv real(kind=pr), public :: gv2 integer, public :: i integer, public :: j real(kind=pr), public :: totn","tags":"","loc":"proc/helmsrkpr.html"},{"title":"PR76_factory – yaeos","text":"public subroutine PR76_factory(moles_in, ac_in, b_in, tc_in, pc_in, w_in, k_in) PengRobinson 76 factory Takes either the critical parameters or the fitted model parameters\nand gets ones in base of the others Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: moles_in (nc) real(kind=pr), intent(in), optional :: ac_in (nc) real(kind=pr), intent(in), optional :: b_in (nc) real(kind=pr), intent(in), optional :: tc_in (nc) real(kind=pr), intent(in), optional :: pc_in (nc) real(kind=pr), intent(in), optional :: w_in (nc) real(kind=pr), intent(in), optional :: k_in (nc) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: RTc (nc) real(kind=pr), public :: al real(kind=pr), public :: be logical, public :: critical_spec real(kind=pr), public :: ga (nc) integer, public :: i real(kind=pr), public :: oma (nc) real(kind=pr), public :: omb (nc) logical, public :: params_spec real(kind=pr), public :: vceos (nc) real(kind=pr), public :: zc (nc)","tags":"","loc":"proc/pr76_factory.html"},{"title":"PR78_factory – yaeos","text":"public subroutine PR78_factory(moles_in, ac_in, b_in, tc_in, pc_in, w_in, k_in) PengRobinson 78 factory Takes either the critical parameters or the fitted model parameters\nand gets ones in base of the others Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: moles_in (nc) real(kind=pr), intent(in), optional :: ac_in (nc) real(kind=pr), intent(in), optional :: b_in (nc) real(kind=pr), intent(in), optional :: tc_in (nc) real(kind=pr), intent(in), optional :: pc_in (nc) real(kind=pr), intent(in), optional :: w_in (nc) real(kind=pr), intent(in), optional :: k_in (nc) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: RTc (nc) real(kind=pr), public :: al real(kind=pr), public :: be logical, public :: critical_spec real(kind=pr), public :: ga (nc) integer, public :: i real(kind=pr), public :: oma (nc) real(kind=pr), public :: omb (nc) logical, public :: params_spec real(kind=pr), public :: vceos (nc) real(kind=pr), public :: zc (nc)","tags":"","loc":"proc/pr78_factory.html"},{"title":"SRK_factory – yaeos","text":"public subroutine SRK_factory(moles_in, ac_in, b_in, tc_in, pc_in, w_in, k_in) SoaveRedlichKwong factory Takes either the critical parameters or the fitted model parameters\nand gets ones in base of the others Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: moles_in (nc) real(kind=pr), intent(in), optional :: ac_in (nc) real(kind=pr), intent(in), optional :: b_in (nc) real(kind=pr), intent(in), optional :: tc_in (nc) real(kind=pr), intent(in), optional :: pc_in (nc) real(kind=pr), intent(in), optional :: w_in (nc) real(kind=pr), intent(in), optional :: k_in (nc) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: RTc (nc) real(kind=pr), public :: al real(kind=pr), public :: be logical, public :: critical_spec real(kind=pr), public :: ga (nc) integer, public :: i integer, public :: j real(kind=pr), public :: oma (nc) real(kind=pr), public :: omb (nc) logical, public :: params_spec real(kind=pr), public :: vceos (nc) real(kind=pr), public :: zc (nc)","tags":"","loc":"proc/srk_factory.html"},{"title":"aTder – yaeos","text":"public subroutine aTder(ac, Tc, k, T, a, dadT, dadT2) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: ac real(kind=pr), intent(in) :: Tc real(kind=pr), intent(in) :: k real(kind=pr), intent(in) :: T real(kind=pr), intent(out) :: a real(kind=pr), intent(out) :: dadT real(kind=pr), intent(out) :: dadT2 Variables Type Visibility Attributes Name Initial real(kind=pr), public :: Tr","tags":"","loc":"proc/atder.html"},{"title":"aijTder – yaeos","text":"public subroutine aijTder(ntd, nc, T, aij, daijdT, daijdT2) Arguments Type Intent Optional Attributes Name integer, intent(in) :: ntd integer, intent(in) :: nc real(kind=pr), intent(in) :: T real(kind=pr), intent(out) :: aij (nc,nc) real(kind=pr), intent(out) :: daijdT (nc,nc) real(kind=pr), intent(out) :: daijdT2 (nc,nc) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: ai (nc) real(kind=pr), public :: aux (nc,nc) real(kind=pr), public :: daidT (nc) real(kind=pr), public :: daidT2 (nc) integer, public :: i integer, public :: j real(kind=pr), public :: ratK (nc,nc)","tags":"","loc":"proc/aijtder.html"},{"title":"ar_rkpr – yaeos","text":"public subroutine ar_rkpr(z, v, t, ar, arv, artv, arv2, Arn, ArVn, ArTn, Arn2) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: z (:) Number of moles real(kind=pr), intent(in) :: v Volume [L] real(kind=pr), intent(in) :: t Temperature [K] real(kind=pr), intent(out) :: ar Residual Helmholtz real(kind=pr), intent(out) :: arv dAr/dV real(kind=pr), intent(out) :: artv dAr2/dTV real(kind=pr), intent(out) :: arv2 dAr2/dV2 real(kind=pr), intent(out) :: Arn (size(z)) dAr/dn real(kind=pr), intent(out) :: ArVn (size(z)) dAr2/dVn real(kind=pr), intent(out) :: ArTn (size(z)) dAr2/dTn real(kind=pr), intent(out) :: Arn2 (size(z),size(z)) dAr2/dn2 Variables Type Visibility Attributes Name Initial integer, public :: nd Compositional derivatives integer, public :: nt Temperature derivatives","tags":"","loc":"proc/ar_rkpr.html"},{"title":"ar_srkpr – yaeos","text":"public subroutine ar_srkpr(z, v, t, ar, arv, artv, arv2, Arn, ArVn, ArTn, Arn2) Wrapper subroutine to the SRK/PR Residula Helmholtz function to\nuse the general interface Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: z (:) Number of moles real(kind=pr), intent(in) :: v Volume [L] real(kind=pr), intent(in) :: t Temperature [K] real(kind=pr), intent(out) :: ar Residual Helmholtz real(kind=pr), intent(out) :: arv dAr/dV real(kind=pr), intent(out) :: artv dAr2/dTV real(kind=pr), intent(out) :: arv2 dAr2/dV2 real(kind=pr), intent(out) :: Arn (size(z)) dAr/dn real(kind=pr), intent(out) :: ArVn (size(z)) dAr2/dVn real(kind=pr), intent(out) :: ArTn (size(z)) dAr2/dTn real(kind=pr), intent(out) :: Arn2 (size(z),size(z)) dAr2/dn2 Variables Type Visibility Attributes Name Initial integer, public :: nd Compositional derivatives integer, public :: nt Temperature derivatives","tags":"","loc":"proc/ar_srkpr.html"},{"title":"get_Zc_OMa_OMb – yaeos","text":"public subroutine get_Zc_OMa_OMb(del1, Zc, OMa, OMb) Calculate Zc, OMa and OMb from the delta_1 parameter. Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: del1 (:) delta_1 parameter real(kind=pr), intent(out) :: Zc (:) Critical compressibility factor real(kind=pr), intent(out) :: OMa (:) OMa real(kind=pr), intent(out) :: OMb (:) OMb Variables Type Visibility Attributes Name Initial real(kind=pr), public :: d1 (size(del1)) real(kind=pr), public :: y (size(del1))","tags":"","loc":"proc/get_zc_oma_omb.html"},{"title":"setup – yaeos","text":"public subroutine setup(n, nmodel, ntdep, ncomb) Setup the basics variables that describe the model. Arguments Type Intent Optional Attributes Name integer, intent(in) :: n Number of components integer, intent(in) :: nmodel Number of model integer, intent(in) :: ntdep Kij dependant of temperature integer, intent(in) :: ncomb Combining rule","tags":"","loc":"proc/setup.html"},{"title":"PUREFUG_CALC – yaeos","text":"public subroutine PUREFUG_CALC(nc, icomp, T, P, V, phi) Fugacity of a pure component Arguments Type Intent Optional Attributes Name integer, intent(in) :: nc integer, intent(in) :: icomp real(kind=pr), intent(in) :: T real(kind=pr), intent(in) :: P real(kind=pr), intent(in) :: V real(kind=pr), intent(out) :: phi Variables Type Visibility Attributes Name Initial real(kind=pr), public :: Ar real(kind=pr), public :: ArTV real(kind=pr), public :: ArTn (nc) real(kind=pr), public :: ArV2 real(kind=pr), public :: ArVn (nc) real(kind=pr), public :: Arn (nc) real(kind=pr), public :: Arn2 (nc,nc) real(kind=pr), public :: Arv real(kind=pr), public :: RT real(kind=pr), public :: Z real(kind=pr), public :: philog real(kind=pr), public :: rn (nc)","tags":"","loc":"proc/purefug_calc.html"},{"title":"TERMO – yaeos","text":"public subroutine TERMO(nc, mtyp, indic, t, p, rn, v, PHILOG, DLPHIP, DLPHIT, FUGN) Arguments Type Intent Optional Attributes Name integer, intent(in) :: nc Number of components integer, intent(in) :: mtyp Type of root desired (-1 vapor, 1 liquid, 0 lower Gr) integer, intent(in) :: indic Desired element, this should be setted with optionals real(kind=pr), intent(in) :: t Temperature [K] real(kind=pr), intent(in) :: p Pressure [bar] real(kind=pr), intent(in) :: rn (nc) Mixture mole numbers real(kind=pr), intent(out) :: v Volume [L] real(kind=pr), intent(out) :: PHILOG (nc) ln(phi*p) vector real(kind=pr), intent(out), optional :: DLPHIP (nc) ln(phi) Presssure derivative real(kind=pr), intent(out), optional :: DLPHIT (nc) ln(phi) Temp derivative real(kind=pr), intent(out), optional :: FUGN (nc,nc) ln(phi) compositional derivative Variables Type Visibility Attributes Name Initial real(kind=pr), public :: ArTn (nc) real(kind=pr), public :: ArVn (nc) real(kind=pr), public :: Arn (nc) real(kind=pr), public :: Arn2 (nc,nc) real(kind=pr), public :: DPDN (nc) real(kind=pr), public :: RT real(kind=pr), public :: Z real(kind=pr), public :: ar real(kind=pr), public :: artv real(kind=pr), public :: arv real(kind=pr), public :: arv2 real(kind=pr), public :: dpdt real(kind=pr), public :: dpv integer, public :: i integer, public :: igz integer, public :: k integer, public :: nder integer, public :: ntemp real(kind=pr), public :: totn","tags":"","loc":"proc/termo.html"},{"title":"VCALC – yaeos","text":"public recursive subroutine VCALC(ITYP, nc, ntemp, rn, T, P, V) ROUTINE FOR CALCULATION OF VOLUME, GIVEN PRESSURE Arguments Type Intent Optional Attributes Name integer, intent(in) :: ITYP TYPE OF ROOT DESIRED (-1 vapor, 1 liquid, 0 lower Gibbs energy phase) integer, intent(in) :: nc NO. OF COMPONENTS integer, intent(in) :: ntemp 1 if T-derivatives are required real(kind=pr), intent(in) :: rn (nc) FEED MOELS real(kind=pr), intent(in) :: T TEMPERATURE real(kind=pr), intent(in) :: P PRESURE real(kind=pr), intent(out) :: V VOLUME Variables Type Visibility Attributes Name Initial real(kind=pr), public :: AT real(kind=pr), public :: AVAP real(kind=pr), public :: Ar real(kind=pr), public :: ArTV real(kind=pr), public :: ArTn (nc) real(kind=pr), public :: ArV real(kind=pr), public :: ArV2 real(kind=pr), public :: ArVn (nc) real(kind=pr), public :: Arn (nc) real(kind=pr), public :: Arn2 (nc,nc) real(kind=pr), public :: B real(kind=pr), public :: CPV logical, public :: FIRST_RUN real(kind=pr), public :: S3R real(kind=pr), public :: VVAP real(kind=pr), public :: ZETA real(kind=pr), public :: ZETMAX real(kind=pr), public :: ZETMIN real(kind=pr), public :: del real(kind=pr), public :: der integer, public :: iter integer, public :: nder real(kind=pr), public :: pcalc real(kind=pr), public :: totn","tags":"","loc":"proc/vcalc.html"},{"title":"zTVTERMO – yaeos","text":"public subroutine zTVTERMO(nc, indic, t, rn, v, p, dpv, PHILOG, DLPHIP, DLPHIT, FUGN) Calculation of lnphi P and derivatives\n rn mixture mole numbers (input)\n t temperature (k) (input)\n v volume (L) (input)\n p pressure (bar) (output)\n PHILOG vector of ln(phi(i) P) (output) 0 < INDIC < 5\n DLPHIT t-derivative of ln(phi(i)) (const P, n) (output) 0 < INDIC = 2 or 4\n DLPHIP P-derivative of ln(phi(i)) (const T, n) (output) 0 < INDIC < 5\n FUGN comp-derivative of ln(phi(i)) (const t & P)(output) 2 < INDIC Arguments Type Intent Optional Attributes Name integer, intent(in) :: nc integer, intent(in) :: indic real(kind=pr), intent(in) :: t real(kind=pr), intent(in) :: rn (nc) real(kind=pr), intent(in) :: v real(kind=pr), intent(out) :: p real(kind=pr), intent(out) :: dpv real(kind=pr), intent(out) :: PHILOG (nc) real(kind=pr), intent(out) :: DLPHIP (nc) real(kind=pr), intent(out) :: DLPHIT (nc) real(kind=pr), intent(out) :: FUGN (nc,nc) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: ArTn (nc) real(kind=pr), public :: ArVn (nc) real(kind=pr), public :: Arn (nc) real(kind=pr), public :: Arn2 (nc,nc) real(kind=pr), public :: DPDN (nc) real(kind=pr), public :: RT real(kind=pr), public :: Z real(kind=pr), public :: ar real(kind=pr), public :: artv real(kind=pr), public :: arv real(kind=pr), public :: arv2 real(kind=pr), public :: dpdt integer, public :: i integer, public :: igz integer, public :: k integer, public :: nder integer, public :: ntemp real(kind=pr), public :: totn","tags":"","loc":"proc/ztvtermo.html"},{"title":"init – yaeos","text":"private function init(Ge, b, q, lij) result(mixrule) Arguments Type Intent Optional Attributes Name class( GeModel ), intent(in) :: Ge real(kind=pr), intent(in) :: b (:) real(kind=pr), intent(in) :: q real(kind=pr), intent(in), optional :: lij (:,:) Return Value type( MHV ) Variables Type Visibility Attributes Name Initial integer, private :: i integer, private :: nc","tags":"","loc":"proc/init~2.html"},{"title":"DmixMHV – yaeos","text":"public subroutine DmixMHV(self, n, T, ai, daidt, daidt2, D, dDdT, dDdT2, dDi, dDidT, dDij) Uses hyperdual_mod Michelsen Modified Huron-Vidal mixing rule. Mixing rule at infinite pressure as defined in the book of Michelsen and\nMøllerup. Description At the infinite pressure limit of a cubic equation of state it is possible to\nrelate teh mixing rule for the attractive term with a excess Gibbs energy\nmodel like NRTL with the expression: Examples type ( CubicEoS ) References Autodiff injection until we can decipher this derivative Type Bound MHV Arguments Type Intent Optional Attributes Name class( MHV ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: T real(kind=pr), intent(in) :: ai (:) real(kind=pr), intent(in) :: daidt (:) real(kind=pr), intent(in) :: daidt2 (:) real(kind=pr), intent(out) :: D real(kind=pr), intent(out) :: dDdT real(kind=pr), intent(out) :: dDdT2 real(kind=pr), intent(out) :: dDi (:) real(kind=pr), intent(out) :: dDidT (:) real(kind=pr), intent(out) :: dDij (:,:) Variables Type Visibility Attributes Name Initial real(kind=pr), private :: Ge real(kind=pr), private :: GeT real(kind=pr), private :: GeT2 real(kind=pr), private :: GeTn (size(n)) real(kind=pr), private :: Gen (size(n)) real(kind=pr), private :: Gen2 (size(n),size(n)) real(kind=pr), private :: b real(kind=pr), private :: bi (size(n)) real(kind=pr), private :: d2logBi_nbi (size(n),size(n)) real(kind=pr), private :: dbi (size(n)) real(kind=pr), private :: dbij (size(n),size(n)) real(kind=pr), private :: dlogBi_nbi (size(n)) real(kind=pr), private :: dot_n_logB_nbi real(kind=pr), private :: f real(kind=pr), private :: fdi (size(n)) real(kind=pr), private :: fdij (size(n),size(n)) real(kind=pr), private :: fdit (size(n)) real(kind=pr), private :: fdt real(kind=pr), private :: fdt2 integer, private :: i integer, private :: j integer, private :: l real(kind=pr), private :: logB_nbi (size(n)) integer, private :: nc real(kind=pr), private :: q real(kind=pr), private :: totn Total number of moles","tags":"","loc":"proc/dmixmhv.html"},{"title":"BmixMHV – yaeos","text":"private subroutine BmixMHV(self, n, bi, B, dBi, dBij) Uses yaeos__models_ar_cubic_mixing_base Repulsive parameter mixing rule Quadratinc mixing rule for the repulsive parameter, using as a combining rule. Description Michelsen’s modified Huron-Vidal mixing rule assumes a linear mix of\nthe repulsive parameter. In this implementation the most known crossed combining rule is used: to provide versatility to the used model. Warning This mixing rule is intended to use only with a linear combining\nrule, using could negatively affect the thermodynamic\nconsistency of the model. Examples A basic code example References Type Bound MHV Arguments Type Intent Optional Attributes Name class( MHV ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: bi (:) real(kind=pr), intent(out) :: B real(kind=pr), intent(out) :: dBi (:) real(kind=pr), intent(out) :: dBij (:,:)","tags":"","loc":"proc/bmixmhv.html"},{"title":"D1MixMHV – yaeos","text":"private subroutine D1MixMHV(self, n, d1i, D1, dD1i, dD1ij) Uses yaeos__models_ar_cubic_mixing_base Type Bound MHV Arguments Type Intent Optional Attributes Name class( MHV ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: d1i (:) real(kind=pr), intent(out) :: D1 real(kind=pr), intent(out) :: dD1i (:) real(kind=pr), intent(out) :: dD1ij (:,:)","tags":"","loc":"proc/d1mixmhv.html"},{"title":"MHV – yaeos","text":"public interface MHV Module Procedures private function init (Ge, b, q, lij) result(mixrule) Arguments Type Intent Optional Attributes Name class( GeModel ), intent(in) :: Ge real(kind=pr), intent(in) :: b (:) real(kind=pr), intent(in) :: q real(kind=pr), intent(in), optional :: lij (:,:) Return Value type( MHV )","tags":"","loc":"interface/mhv.html"},{"title":"volume_michelsen – yaeos","text":"public subroutine volume_michelsen(eos, n, P, T, V, root_type, max_iters, V0) Uses stdlib_optval iso_fortran_env Volume solver at a given pressure. Obtain the volume using the method described by Michelsen and Møllerup.\nWhile can be obtained with a simple Newton method, a better\napproach is solving where is the EoS covolume.\nThis method is easier to solve because: and At chapter 3 page 94 of Michelsen and Møllerup’s book a more complete\nexplanation can be seen Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos real(kind=pr), intent(in) :: n (:) Mixture moles real(kind=pr), intent(in) :: P Pressure [bar] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out) :: V Volume [L] character(len=*), intent(in), optional :: root_type Type of root [“vapor” | “liquid” | “stable”] integer, intent(in), optional :: max_iters Maxiumum number of iterations, defaults to 100 real(kind=pr), intent(in), optional :: V0 Specified initial volume Variables Type Visibility Attributes Name Initial real(kind=pr), public :: AT real(kind=pr), public :: AVAP real(kind=pr), public :: Ar real(kind=pr), public :: ArV real(kind=pr), public :: ArV2 real(kind=pr), public :: B Covolume real(kind=pr), public :: VVAP real(kind=pr), public :: ZETA real(kind=pr), public :: ZETMAX real(kind=pr), public :: ZETMIN integer, public :: iter integer, public :: maximum_iterations real(kind=pr), public :: pcalc character(len=10), public :: root real(kind=pr), public :: totn Subroutines subroutine solve_point (P, V, Pcalc, AT, iter) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: P Objective pressure [bar] real(kind=pr), intent(out) :: V Obtained volume [L] real(kind=pr), intent(out) :: Pcalc Calculated pressure at V [bar] real(kind=pr), intent(out) :: AT integer, intent(out) :: iter","tags":"","loc":"proc/volume_michelsen.html"},{"title":"flash – yaeos","text":"public function flash(model, z, t, v_spec, p_spec, k0, iters) Uses stdlib_optval Flash algorithm using sucessive substitutions. Available specifications: TP (with T and P_spec variables) TV (with T and V_spec variables) This algorithm assumes that the specified T and P/V correspond to\nvapor-liquid separation predicted by the provided model (0 new_aij_procedure Type Bound QMR Arguments Type Intent Optional Attributes Name class( QMR ), intent(in) :: self Mixing rule object. real(kind=pr), intent(in) :: n (:) Moles vector [mol] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(in) :: ai (:) Pure components attractive parameters real(kind=pr), intent(in) :: daidt (:) real(kind=pr), intent(in) :: daidt2 (:) real(kind=pr), intent(out) :: D Mixture attractive parameter real(kind=pr), intent(out) :: dDdT real(kind=pr), intent(out) :: dDdT2 real(kind=pr), intent(out) :: dDi (:) real(kind=pr), intent(out) :: dDidT (:) real(kind=pr), intent(out) :: dDij (:,:) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: aij (size(ai),size(ai)) real(kind=pr), public :: aux real(kind=pr), public :: aux2 real(kind=pr), public :: daijdt (size(ai),size(ai)) real(kind=pr), public :: daijdt2 (size(ai),size(ai)) integer, public :: i integer, public :: j integer, public :: nc","tags":"","loc":"proc/dmix.html"},{"title":"RKPR_D1mix – yaeos","text":"public subroutine RKPR_D1mix(self, n, d1i, D1, dD1i, dD1ij) Uses yaeos__models_ar_cubic_mixing_base RKPR parameter mixing rule. The RKPR EoS doesn’t have a constant value for each \ncomponent, so a proper mixing rule should be provided. A linear\ncombination is used. Type Bound QMR_RKPR Arguments Type Intent Optional Attributes Name class( QMR_RKPR ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: d1i (:) real(kind=pr), intent(out) :: D1 real(kind=pr), intent(out) :: dD1i (:) real(kind=pr), intent(out) :: dD1ij (:,:)","tags":"","loc":"proc/rkpr_d1mix.html"},{"title":"kij_constant – yaeos","text":"public subroutine kij_constant(self, T, a, dadt, dadt2, aij, daijdt, daijdt2) Combining rule that uses constant values. [\n a_{ij} = \\sqrt{a_i a_j} (1 - k_{ij})\n] Arguments Type Intent Optional Attributes Name class( QMR ), intent(in) :: self real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(in) :: a (:) Pure components attractive parameters (\\a_i) real(kind=pr), intent(in) :: dadt (:) real(kind=pr), intent(in) :: dadt2 (:) real(kind=pr), intent(out) :: aij (:,:) Matrix real(kind=pr), intent(out) :: daijdt (:,:) real(kind=pr), intent(out) :: daijdt2 (:,:) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: aij_daidt integer, public :: i real(kind=pr), public :: inner_sum integer, public :: j real(kind=pr), public :: sqrt_aii_ajj","tags":"","loc":"proc/kij_constant.html"},{"title":"PengRobinson76 – yaeos","text":"public function PengRobinson76(tc, pc, w, kij, lij) result(model) Uses yaeos__constants yaeos__substance yaeos__models_ar_genericcubic yaeos__models_ar_cubic_quadratic_mixing yaeos__models_ar_cubic_alphas PengRobinson76. Using the critical constants setup the parameters to use the \nPengRobinson Equation of State There is also the optional posibility to include the and matrices. Using by default Classic Van der Waals mixing\nrules. After setting up the model, it is possible to redefine either the\nmixing rule or the alpha function using a different derived type\ndefined outside the function. Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: tc (:) Critical Temperatures [K] real(kind=pr), intent(in) :: pc (:) Critical Pressures [bar] real(kind=pr), intent(in) :: w (:) Acentric Factors real(kind=pr), intent(in), optional :: kij (:,:) matrix real(kind=pr), intent(in), optional :: lij (:,:) matrix Return Value type( CubicEoS ) Variables Type Visibility Attributes Name Initial type( AlphaSoave ), private :: alpha type( Substances ), private :: composition integer, private :: i type( QMR ), private :: mixrule integer, private :: nc","tags":"","loc":"proc/pengrobinson76.html"},{"title":"PengRobinson78 – yaeos","text":"public function PengRobinson78(tc, pc, w, kij, lij) result(model) Uses yaeos__constants yaeos__substance yaeos__models_ar_genericcubic yaeos__models_ar_cubic_quadratic_mixing yaeos__models_ar_cubic_alphas PengRobinson78. Using the critical constants setup the parameters to use the \nPengRobinson Equation of State There is also the optional posibility to include the and matrices. Using by default Classic Van der Waals mixing\nrules. After setting up the model, it is possible to redefine either the\nmixing rule or the alpha function using a different derived type\ndefined outside the function. Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: tc (:) Critical Temperatures [K] real(kind=pr), intent(in) :: pc (:) Critical Pressures [bar] real(kind=pr), intent(in) :: w (:) Acentric Factors real(kind=pr), intent(in), optional :: kij (:,:) matrix real(kind=pr), intent(in), optional :: lij (:,:) matrix Return Value type( CubicEoS ) Variables Type Visibility Attributes Name Initial type( AlphaSoave ), private :: alpha type( Substances ), private :: composition integer, private :: i type( QMR ), private :: mixrule integer, private :: nc","tags":"","loc":"proc/pengrobinson78.html"},{"title":"RKPR – yaeos","text":"public function RKPR(tc, pc, w, zc, kij, lij, delta_1, k) result(model) Uses yaeos__models_ar_cubic_alphas yaeos__models_ar_cubic_quadratic_mixing RKPR Equation of State The RKPR EoS extends the classical formulation of Cubic Equations \nof State by freeing the parameter . This extra degree\nprovides extra ways of implementing the equation in comparison\nof other Cubic EoS (like PR and SRK) which are limited to definition\nof their critical constants. Besides that extra parameter, the RKRR includes another function: In this implementation we take the simplest form which correlates\nthe extra parameter to the critical compressibility factor and\nthe parameter of the function to and : Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: tc (:) Critical Temperature [K] real(kind=pr), intent(in) :: pc (:) Critical Pressure [bar] real(kind=pr), intent(in) :: w (:) Acentric Factor real(kind=pr), intent(in) :: zc (:) Critical compressibility real(kind=pr), intent(in), optional :: kij (:,:) k_{ij} matrix real(kind=pr), intent(in), optional :: lij (:,:) l_{ij} matrix real(kind=pr), intent(in), optional :: delta_1 (:) real(kind=pr), intent(in), optional :: k (:) Return Value type( CubicEoS ) Variables Type Visibility Attributes Name Initial real(kind=pr), private, parameter :: A0 = 0.0017 real(kind=pr), private, parameter :: A1 = -2.4407 real(kind=pr), private, parameter :: B0 = 1.9681 real(kind=pr), private, parameter :: B1 = 7.4513 real(kind=pr), private, parameter :: C0 = -2.6238 real(kind=pr), private, parameter :: C1 = 12.504 real(kind=pr), private :: OMa (size(pc)) real(kind=pr), private :: OMb (size(pc)) real(kind=pr), private :: Zc_eos (size(pc)) type( AlphaRKPR ), private :: alpha type( Substances ), private :: composition real(kind=pr), private, parameter :: d1 = 0.428364 real(kind=pr), private, parameter :: d2 = 18.496215 real(kind=pr), private, parameter :: d3 = 0.338426 real(kind=pr), private, parameter :: d4 = 0.66 real(kind=pr), private, parameter :: d5 = 789.723105 real(kind=pr), private, parameter :: d6 = 2.512392 integer, private :: i type( QMR_RKPR ), private :: mixrule integer, private :: nc","tags":"","loc":"proc/rkpr.html"},{"title":"SoaveRedlichKwong – yaeos","text":"public function SoaveRedlichKwong(tc, pc, w, kij, lij) result(model) Uses yaeos__models_ar_genericcubic yaeos__models_ar_cubic_alphas yaeos__models_ar_cubic_quadratic_mixing SoaveRedlichKwong. Using the critical constants setup the parameters to use the \nSoaveRedlichKwong Equation of State There is also the optional posibility to include the k_{ij} and l_{ij}\nmatrices. Using by default Classic Van der Waals mixing rules. After setting up the model, it is possible to redefine either the\nmixing rule or the alpha function using a different derived type\ndefined outside the function. Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: tc (:) Critical temperature [K] real(kind=pr), intent(in) :: pc (:) Critical pressure [bar] real(kind=pr), intent(in) :: w (:) Acentric factor real(kind=pr), intent(in), optional :: kij (:,:) matrix real(kind=pr), intent(in), optional :: lij (:,:) matrix Return Value type( CubicEoS ) Variables Type Visibility Attributes Name Initial type( AlphaSoave ), private :: alpha type( Substances ), private :: composition integer, private :: i type( QMR ), private :: mixrule integer, private :: nc","tags":"","loc":"proc/soaveredlichkwong.html"},{"title":"get_OMa_OMb – yaeos","text":"private subroutine get_OMa_OMb(del1, OMa, OMb) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: del1 (:) real(kind=pr), intent(out) :: OMa (size(del1)) real(kind=pr), intent(out) :: OMb (size(del1)) Variables Type Visibility Attributes Name Initial real(kind=pr), private :: d1 (size(del1)) real(kind=pr), private :: y (size(del1))","tags":"","loc":"proc/get_oma_omb.html"},{"title":"excess_gibbs – yaeos","text":"private subroutine excess_gibbs(self, n, t, Ge, GeT, GeT2, Gen, GeTn, Gen2) Excess Gibbs model generic interface Type Bound GeModelTapenade Arguments Type Intent Optional Attributes Name class( GeModelTapenade ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: t real(kind=pr), intent(out), optional :: Ge real(kind=pr), intent(out), optional :: GeT real(kind=pr), intent(out), optional :: GeT2 real(kind=pr), intent(out), optional, dimension(size(n)) :: Gen real(kind=pr), intent(out), optional, dimension(size(n)) :: GeTn real(kind=pr), intent(out), optional :: Gen2 (size(n),size(n)) Variables Type Visibility Attributes Name Initial real(kind=pr), private :: geb real(kind=pr), private :: ged real(kind=pr), private :: ged0 real(kind=pr), private :: gedb real(kind=pr), private :: gedd integer, private :: i real(kind=pr), private :: nb (size(n)) integer, private :: nc real(kind=pr), private :: nd (size(n)) real(kind=pr), private :: ndb (size(n)) real(kind=pr), private :: tb real(kind=pr), private :: td real(kind=pr), private :: td0 real(kind=pr), private :: tdb Functions function get_GenT () Arguments None Return Value real(kind=pr), (size(n)) function get_dGedT2 () Arguments None Return Value real(kind=pr) Subroutines subroutine reset_vars () Arguments None","tags":"","loc":"proc/excess_gibbs~2.html"},{"title":"tm – yaeos","text":"public function tm(model, z, w, P, T, d, dtpd) Alternative formulation of tangent-plane-distance Michelsen’s modified function, . Description Alternative formulation of the reduced tangent plane function, \nwhere the test phase is defined in moles, which enables for unconstrained\nminimization. Examples Calculation of tm tm = tpd ( model , z , w , P , T ) --------------------------- Using precalculated trial-phase data It is possible to calculate externaly the d_i vector and use it for\nlater calculations. call fugacity_tp (& model , z , T = T , P = P , V = Vz , root_type = \"stable\" , lnphip = lnphi_z & ) lnphi_z = lnphi_z - log ( P ) di = log ( z ) + lnphi_z tm = tpd ( model , z , w , P , T , d = di ) --------------------------- References Thermodynamic Models: Fundamental and Computational Aspects, Michael L.\nMichelsen, Jørgen M. Mollerup. Tie-Line Publications, Denmark (2004) doi Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: model Thermodynamic model real(kind=pr), intent(in) :: z (:) Feed composition real(kind=pr), intent(in) :: w (:) Test-phase mole numbers vector real(kind=pr), intent(in) :: P Pressure [bar] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(in), optional :: d (:) vector real(kind=pr), intent(out), optional :: dtpd (:) Return Value real(kind=pr) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: di (size(z)) real(kind=pr), public :: lnphi_w (size(z)) real(kind=pr), public :: lnphi_z (size(z)) real(kind=pr), public :: vw real(kind=pr), public :: vz","tags":"","loc":"proc/tm.html"},{"title":"min_tpd – yaeos","text":"public subroutine min_tpd(model, z, P, T, mintpd, w, all_minima) Uses yaeos__optimizers_powell_wrap Arguments Type Intent Optional Attributes Name class( ArModel ), target :: model Thermodynamic model real(kind=pr), intent(in) :: z (:) Feed composition real(kind=pr), intent(in) :: P Pressure [bar] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out) :: mintpd Minimal value of real(kind=pr), intent(out) :: w (:) Trial composition real(kind=pr), intent(out), optional :: all_minima (:,:) All the found minima Variables Type Visibility Attributes Name Initial real(kind=pr), public :: V type( TMOptimizeData ), public :: data real(kind=pr), public :: di (size(z)) real(kind=pr), public :: dx (size(w)) integer, public :: i real(kind=pr), public :: lnphi_z (size(z)) real(kind=pr), public :: mins (size(w)) type( PowellWrapper ), public :: opt integer, public :: stat real(kind=pr), public :: ws (size(w),size(w))","tags":"","loc":"proc/min_tpd.html"},{"title":"min_tpd_to_optimize – yaeos","text":"public subroutine min_tpd_to_optimize(X, F, dF, data) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: X (:) real(kind=pr), intent(out) :: F real(kind=pr), intent(out), optional :: dF (:) class(*), intent(inout), optional :: data","tags":"","loc":"proc/min_tpd_to_optimize.html"},{"title":"ADMM_REBASE – yaeos","text":"public interface ADMM_REBASE Subroutines public subroutine ADMM_REBASE(base) bind(c, name='ADMM_rebase') Arguments Type Intent Optional Attributes Name type(C_PTR) :: base","tags":"","loc":"interface/admm_rebase.html"},{"title":"ADMM_REBASESHADOWED – yaeos","text":"public interface ADMM_REBASESHADOWED Subroutines public subroutine ADMM_REBASESHADOWED(base, baseb) bind(c, name= 'ADMM_rebaseShadowed') Arguments Type Intent Optional Attributes Name type(C_PTR) :: base type(C_PTR) :: baseb","tags":"","loc":"interface/admm_rebaseshadowed.html"},{"title":"ADMM_REGISTER – yaeos","text":"public interface ADMM_REGISTER Subroutines public subroutine ADMM_REGISTER(base, obase, size, nbelem) bind(c, name= 'ADMM_register') Arguments Type Intent Optional Attributes Name type(C_PTR), VALUE :: base type(C_PTR), VALUE :: obase integer, VALUE :: size integer, VALUE :: nbelem","tags":"","loc":"interface/admm_register.html"},{"title":"ADMM_REGISTERSHADOWED – yaeos","text":"public interface ADMM_REGISTERSHADOWED Subroutines public subroutine ADMM_REGISTERSHADOWED(base, obase, size, baseb, obaseb, sizeb, nbelem) bind(c, name='ADMM_registerShadowed') Arguments Type Intent Optional Attributes Name type(C_PTR), VALUE :: base type(C_PTR), VALUE :: obase integer, VALUE :: size type(C_PTR), VALUE :: baseb type(C_PTR), VALUE :: obaseb integer, VALUE :: sizeb integer, VALUE :: nbelem","tags":"","loc":"interface/admm_registershadowed.html"},{"title":"ADMM_UNREGISTER – yaeos","text":"public interface ADMM_UNREGISTER Subroutines public subroutine ADMM_UNREGISTER(base, nbelem) bind(c, name= 'ADMM_unregister') Arguments Type Intent Optional Attributes Name type(C_PTR), VALUE :: base integer :: nbelem","tags":"","loc":"interface/admm_unregister.html"},{"title":"ADMM_UNREGISTERSHADOWED – yaeos","text":"public interface ADMM_UNREGISTERSHADOWED Subroutines public subroutine ADMM_UNREGISTERSHADOWED(base, baseb, nbelem) bind(c, name='ADMM_unregisterShadowed') Arguments Type Intent Optional Attributes Name type(C_PTR), VALUE :: base type(C_PTR), VALUE :: baseb integer :: nbelem","tags":"","loc":"interface/admm_unregistershadowed.html"},{"title":"POPPOINTER8 – yaeos","text":"public interface POPPOINTER8 Subroutines public subroutine POPPOINTER8(pp) bind(c, name='popPointer8') Arguments Type Intent Optional Attributes Name type(C_PTR) :: pp","tags":"","loc":"interface/poppointer8.html"},{"title":"PUSHPOINTER8 – yaeos","text":"public interface PUSHPOINTER8 Subroutines public subroutine PUSHPOINTER8(pp) bind(c, name='pushPointer8') Arguments Type Intent Optional Attributes Name type(C_PTR), VALUE :: pp","tags":"","loc":"interface/pushpointer8.html"},{"title":"ge_consistency – yaeos","text":"public subroutine ge_consistency(model, n, t, eq58, eq59, eq60, eq61) ge_consistency models consistency tests Description Evaluate the models consistency tests described in\nThermodynamic Models: Fundamentals & Computational Aspects 2 ed. by\nMichelsen and Mollerup (MM) Chapter 5 section 4. The “eq” are\nevaluations of the left hand side of the following expressions: Equation 58 Equation 59 Equation 60 Equation 61 Examples use yaeos , only : pr use yaeos , only : Groups , setup_unifac , UNIFAC use yaeos__consistency_gemodel , only : ge_consistency type ( UNIFAC ) :: model integer , parameter :: nc = 4 , ng = 4 type ( Groups ) :: molecules ( nc ) real ( pr ) :: n ( nc ), T real ( pr ) :: dt , dn real ( pr ) :: eq58 , eq59 ( nc ), eq60 ( nc , nc ), eq61 ( nc ) T = 30 3.15 n = [ 40 0.0 , 10 0.0 , 30 0.0 , 20 0.0 ] ! Hexane [CH3, CH2] molecules ( 1 )% groups_ids = [ 1 , 2 ] molecules ( 1 )% number_of_groups = [ 2 , 4 ] ! Ethanol [CH3, CH2, OH] molecules ( 2 )% groups_ids = [ 1 , 2 , 14 ] molecules ( 2 )% number_of_groups = [ 1 , 1 , 1 ] ! Toluene [ACH, ACCH3] molecules ( 3 )% groups_ids = [ 9 , 11 ] molecules ( 3 )% number_of_groups = [ 5 , 1 ] ! Cyclohexane [CH2] molecules ( 4 )% groups_ids = [ 2 ] molecules ( 4 )% number_of_groups = [ 6 ] model = setup_unifac ( molecules ) ! ==================================================================== ! Consistency tests ! -------------------------------------------------------------------- call ge_consistency ( model , n , t , eq58 , eq59 , eq60 , eq61 ) References Michelsen, M. L., & Mollerup, J. M. (2007). Thermodynamic models:\nFundamentals & computational aspects (2. ed). Tie-Line Publications. Arguments Type Intent Optional Attributes Name class( GeModel ), intent(in) :: model model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: t Temperature [K] real(kind=pr), intent(out), optional :: eq58 MM Eq. 58 real(kind=pr), intent(out), optional :: eq59 (size(n)) MM Eq. 59 real(kind=pr), intent(out), optional :: eq60 (size(n),size(n)) MM Eq. 60 real(kind=pr), intent(out), optional :: eq61 (size(n)) MM Eq. 61 Variables Type Visibility Attributes Name Initial real(kind=pr), public :: Ge real(kind=pr), public :: Gen (size(n)) real(kind=pr), public :: Gen2 (size(n),size(n)) integer, public :: i integer, public :: j real(kind=pr), public :: ln_gammas (size(n))","tags":"","loc":"proc/ge_consistency.html"},{"title":"numeric_ge_derivatives – yaeos","text":"public subroutine numeric_ge_derivatives(model, n, t, d_n, d_t, Ge, GeT, Gen, GeT2, GeTn, Gen2) numeric_ge_derivatives Numeric model derivatives Description Tool to facilitate the development of new GeModel by testing\nthe implementation of analytic derivatives. Examples use yaeos , only : Groups , setup_unifac , UNIFAC use yaeos__consistency_gemodel , only : numeric_ge_derivatives type ( UNIFAC ) :: model integer , parameter :: nc = 4 , ng = 4 type ( Groups ) :: molecules ( nc ) real ( pr ) :: Ge , Gen ( nc ), GeT , GeT2 , GeTn ( nc ), Gen2 ( nc , nc ) real ( pr ) :: Ge_n , Gen_n ( nc ), GeT_n , GeT2_n , GeTn_n ( nc ), Gen2_n ( nc , nc ) real ( pr ) :: ln_gammas ( nc ) real ( pr ) :: n ( nc ), T real ( pr ) :: dt , dn T = 30 3.15 n = [ 40 0.0 , 10 0.0 , 30 0.0 , 20 0.0 ] ! always test with sum(n) > 1 dt = 0.1_pr dn = 0.1_pr ! Hexane [CH3, CH2] molecules ( 1 )% groups_ids = [ 1 , 2 ] molecules ( 1 )% number_of_groups = [ 2 , 4 ] ! Ethanol [CH3, CH2, OH] molecules ( 2 )% groups_ids = [ 1 , 2 , 14 ] molecules ( 2 )% number_of_groups = [ 1 , 1 , 1 ] ! Toluene [ACH, ACCH3] molecules ( 3 )% groups_ids = [ 9 , 11 ] molecules ( 3 )% number_of_groups = [ 5 , 1 ] ! Cyclohexane [CH2] molecules ( 4 )% groups_ids = [ 2 ] molecules ( 4 )% number_of_groups = [ 6 ] model = setup_unifac ( molecules ) ! ===================================================================== ! Call analytic derivatives ! --------------------------------------------------------------------- call model % excess_gibbs ( n , T , Ge , GeT , GeT2 , Gen , GeTn , Gen2 ) ! ===================================================================== ! Call numeric derivatives ! --------------------------------------------------------------------- call numeric_ge_derivatives ( model , n , T , dn , dt , Ge = Ge_n , GeT = GeT_n ) call numeric_ge_derivatives ( model , n , T , dn , dt , Ge = Ge_n , Gen = Gen_n ) call numeric_ge_derivatives ( model , n , T , dn , dt , Ge = Ge_n , GeT2 = GeT2_n ) call numeric_ge_derivatives ( model , n , T , dn , dt , Ge = Ge_n , GeTn = GeTn_n ) call numeric_ge_derivatives ( model , n , T , dn , dt , Ge = Ge_n , Gen2 = Gen2_n ) Arguments Type Intent Optional Attributes Name class( GeModel ), intent(in) :: model model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: t Temperature [K] real(kind=pr), intent(in) :: d_n Moles finite difference step real(kind=pr), intent(in) :: d_t Temperature finite difference step real(kind=pr), intent(out) :: Ge Residual Helmoltz energy real(kind=pr), intent(out), optional :: GeT real(kind=pr), intent(out), optional :: Gen (size(n)) real(kind=pr), intent(out), optional :: GeT2 real(kind=pr), intent(out), optional :: GeTn (size(n)) real(kind=pr), intent(out), optional :: Gen2 (size(n),size(n)) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: Ge_aux1 real(kind=pr), public :: Ge_aux2 real(kind=pr), public :: Ge_aux3 real(kind=pr), public :: Ge_aux4 real(kind=pr), public :: dn_aux1 (size(n)) real(kind=pr), public :: dn_aux2 (size(n)) integer, public :: i integer, public :: j","tags":"","loc":"proc/numeric_ge_derivatives.html"},{"title":"get_maingroup_index – yaeos","text":"public function get_maingroup_index(self, maingroup_id) result(maingroup_idx) get_maingroup_index Get index of the maingoup with id: maingoup_id Description Get index of the maingoup with id: maingoup_id . Gets the index of the\nmaingoup in the self%maingoups_ids vector. Examples use yaeos__models_ge_group_contribution_unifac_parameters , only : UNIFACParameters use yaeos__models_ge_group_contribution_model_parameters , only : GeGCModelParameters type ( GeGCModelParameters ) :: parameters parameters = UNIFACParameters () ! Get index of the maingroup with id 55 (Sulfones: [118](CH2)2SU [119]CH2CHSU) print * , parameters % get_maingroup_index ( 55 ) ! Will print: 52 References Dortmund Data Bank Software & Separation Technology Type Bound GeGCModelParameters Arguments Type Intent Optional Attributes Name class( GeGCModelParameters ) :: self integer, intent(in) :: maingroup_id ID of the subgroup Return Value integer Index of the maingroup on the self%maingroups_ids vector","tags":"","loc":"proc/get_maingroup_index.html"},{"title":"get_maingroups_aij – yaeos","text":"public function get_maingroups_aij(self, maingroup_i_id, maingroup_j_id) result(aij) get_maingroups_aij Get the interaction parameter Description Get the interaction parameter of the maingroups i and j ids. Examples use yaeos__models_ge_group_contribution_unifac_parameters , only : UNIFACParameters use yaeos__models_ge_group_contribution_model_parameters , only : GeGCModelParameters type ( GeGCModelParameters ) :: parameters parameters = UNIFACParameters () ! Get the maingroups i:1, j:7 interaction parameter aij (CH2-H2O) print * , parameters % get_maingroups_aij ( 1 , 7 ) ! prints: 1318.0000 References Dortmund Data Bank Software & Separation Technology Type Bound GeGCModelParameters Arguments Type Intent Optional Attributes Name class( GeGCModelParameters ) :: self integer, intent(in) :: maingroup_i_id ID of the maingroup i integer, intent(in) :: maingroup_j_id ID of the maingroup j Return Value real(kind=pr) Interaction parameter Variables Type Visibility Attributes Name Initial integer, public :: i integer, public :: j","tags":"","loc":"proc/get_maingroups_aij.html"},{"title":"get_maingroups_bij – yaeos","text":"public function get_maingroups_bij(self, maingroup_i_id, maingroup_j_id) result(bij) get_maingroups_bij Get the interaction parameter Description Get the interaction parameter of the maingroups i and j ids. Examples use yaeos__models_ge_group_contribution_unifac_parameters , only : UNIFACParameters use yaeos__models_ge_group_contribution_model_parameters , only : GeGCModelParameters type ( GeGCModelParameters ) :: parameters parameters = UNIFACParameters () ! Get the maingroups i:1, j:7 interaction parameter bij (CH2-H2O) print * , parameters % get_maingroups_bij ( 1 , 7 ) ! prints: 0.0 In the example we obtain 0.0 because UNIFAC only have parameters References Dortmund Data Bank Software & Separation Technology Type Bound GeGCModelParameters Arguments Type Intent Optional Attributes Name class( GeGCModelParameters ) :: self integer, intent(in) :: maingroup_i_id ID of the maingroup i integer, intent(in) :: maingroup_j_id ID of the maingroup j Return Value real(kind=pr) Interaction parameter Variables Type Visibility Attributes Name Initial integer, public :: i integer, public :: j","tags":"","loc":"proc/get_maingroups_bij.html"},{"title":"get_maingroups_cij – yaeos","text":"public function get_maingroups_cij(self, maingroup_i_id, maingroup_j_id) result(cij) get_maingroups_cij Get the interaction parameter Description Get the interaction parameter of the maingroups i and j ids. Examples use yaeos__models_ge_group_contribution_unifac_parameters , only : UNIFACParameters use yaeos__models_ge_group_contribution_model_parameters , only : GeGCModelParameters type ( GeGCModelParameters ) :: parameters parameters = UNIFACParameters () ! Get the maingroups i:1, j:7 interaction parameter cij (CH2-H2O) print * , parameters % get_maingroups_cij ( 1 , 7 ) ! prints: 0.0 In the example we obtain 0.0 because UNIFAC only have parameters References Dortmund Data Bank Software & Separation Technology Type Bound GeGCModelParameters Arguments Type Intent Optional Attributes Name class( GeGCModelParameters ) :: self integer, intent(in) :: maingroup_i_id ID of the maingroup i integer, intent(in) :: maingroup_j_id ID of the maingroup j Return Value real(kind=pr) Interaction parameter Variables Type Visibility Attributes Name Initial integer, public :: i integer, public :: j","tags":"","loc":"proc/get_maingroups_cij.html"},{"title":"get_subgroup_Q – yaeos","text":"public function get_subgroup_Q(self, subgroup_id) result(subgroup_Q) get_subgroup_Q Get the subgroup’s value Description Uses the self%subgroups_Qs attribute to locate the subgroup value. Examples use yaeos__models_ge_group_contribution_unifac_parameters , only : UNIFACParameters use yaeos__models_ge_group_contribution_model_parameters , only : GeGCModelParameters type ( GeGCModelParameters ) :: parameters parameters = UNIFACParameters () ! Get the subgroup, with id 1 (CH3), Q value print * , parameters % get_subgroup_Q ( 1 ) ! Will print: 0.8480 References Dortmund Data Bank Software & Separation Technology Type Bound GeGCModelParameters Arguments Type Intent Optional Attributes Name class( GeGCModelParameters ) :: self integer, intent(in) :: subgroup_id ID of the subgroup Return Value real(kind=pr) value of the subgroup Variables Type Visibility Attributes Name Initial integer, public :: subgroup_idx","tags":"","loc":"proc/get_subgroup_q.html"},{"title":"get_subgroup_R – yaeos","text":"public function get_subgroup_R(self, subgroup_id) result(subgroup_R) get_subgroup_R Get the subgroup’s value Description Uses the self%subgroups_Rs attribute to locate the subgroup value. Examples use yaeos__models_ge_group_contribution_unifac_parameters , only : UNIFACParameters use yaeos__models_ge_group_contribution_model_parameters , only : GeGCModelParameters type ( GeGCModelParameters ) :: parameters parameters = UNIFACParameters () ! Get the subgroup, with id 1 (CH3), R value print * , parameters % get_subgroup_R ( 1 ) ! Will print: 0.9011 References Dortmund Data Bank Software & Separation Technology Type Bound GeGCModelParameters Arguments Type Intent Optional Attributes Name class( GeGCModelParameters ) :: self integer, intent(in) :: subgroup_id ID of the subgroup Return Value real(kind=pr) value of the subgroup Variables Type Visibility Attributes Name Initial integer, public :: subgroup_idx","tags":"","loc":"proc/get_subgroup_r.html"},{"title":"get_subgroup_index – yaeos","text":"public function get_subgroup_index(self, subgroup_id) result(subgroup_idx) get_subgroup_index Get index of the subgroup with id: subgroup_id Description Get index of the subgroup with id: subgroup_id . Gets the index of the\nsubgroup in the self%subgroups_ids vector. Examples use yaeos__models_ge_group_contribution_unifac_parameters , only : UNIFACParameters use yaeos__models_ge_group_contribution_model_parameters , only : GeGCModelParameters type ( GeGCModelParameters ) :: parameters ! Default parameters of UNIFAC (ddbst) parameters = UNIFACParameters () ! Get index of the subgroup with id 178 (IMIDAZOL) print * , parameters % get_subgroup_index ( 178 ) ! Will print: 112 References Dortmund Data Bank Software & Separation Technology Type Bound GeGCModelParameters Arguments Type Intent Optional Attributes Name class( GeGCModelParameters ) :: self integer, intent(in) :: subgroup_id ID of the subgroup Return Value integer Index of the subgroup on the self%subgroups_ids vector","tags":"","loc":"proc/get_subgroup_index.html"},{"title":"get_subgroup_maingroup – yaeos","text":"public function get_subgroup_maingroup(self, subgroup_id) result(subgroup_maingroup) get_subgroup_maingroup Get the subgroup’s maingroup Description Uses the self%subgroups_maingroups attribute to locate the maingroup\nwhere the subgroup with id subgroup_id belongs Examples use yaeos__models_ge_group_contribution_unifac_parameters , only : UNIFACParameters use yaeos__models_ge_group_contribution_model_parameters , only : GeGCModelParameters type ( GeGCModelParameters ) :: parameters parameters = UNIFACParameters () ! Get the maingroup of the subgroup with id 16 (H2O) print * , parameters % get_subgroup_maingroup ( 16 ) ! Will print: 7 References Dortmund Data Bank Software & Separation Technology Type Bound GeGCModelParameters Arguments Type Intent Optional Attributes Name class( GeGCModelParameters ) :: self integer, intent(in) :: subgroup_id ID of the subgroup Return Value integer Maingroup of the subgroup Variables Type Visibility Attributes Name Initial integer, public :: subgroup_idx","tags":"","loc":"proc/get_subgroup_maingroup.html"},{"title":"get_subgroups_aij – yaeos","text":"public function get_subgroups_aij(self, subgroup_i_id, subgroup_j_id) result(aij) get_subgroups_aij Get the interaction parameter Description Get the interaction parameter of the subgroups i and j ids. Examples use yaeos__models_ge_group_contribution_unifac_parameters , only : UNIFACParameters use yaeos__models_ge_group_contribution_model_parameters , only : GeGCModelParameters type ( GeGCModelParameters ) :: parameters parameters = UNIFACParameters () ! Get the subgroups i:1, j:16 interaction parameter aij (CH3-H2O) ! with maingroups 1 and 7 respectively. print * , parameters % get_subgroups_aij ( 1 , 16 ) ! prints: 1318.0000 References Dortmund Data Bank Software & Separation Technology Type Bound GeGCModelParameters Arguments Type Intent Optional Attributes Name class( GeGCModelParameters ) :: self integer, intent(in) :: subgroup_i_id ID of the subgroup i integer, intent(in) :: subgroup_j_id ID of the subgroup j Return Value real(kind=pr) Interaction parameter Variables Type Visibility Attributes Name Initial integer, public :: i integer, public :: j integer, public :: mi_id integer, public :: mj_id","tags":"","loc":"proc/get_subgroups_aij.html"},{"title":"get_subgroups_bij – yaeos","text":"public function get_subgroups_bij(self, subgroup_i_id, subgroup_j_id) result(bij) get_subgroups_bij Get the interaction parameter Description Get the interaction parameter of the subgroups i and j ids. Examples use yaeos__models_ge_group_contribution_unifac_parameters , only : UNIFACParameters use yaeos__models_ge_group_contribution_model_parameters , only : GeGCModelParameters type ( GeGCModelParameters ) :: parameters parameters = UNIFACParameters () ! Get the subgroups i:1, j:16 interaction parameter bij (CH3-H2O) ! with maingroups 1 and 7 respectively. print * , parameters % get_subgroups_bij ( 1 , 16 ) ! prints: 0.0000 In the example we obtain 0.0 because UNIFAC only have parameters References Dortmund Data Bank Software & Separation Technology Type Bound GeGCModelParameters Arguments Type Intent Optional Attributes Name class( GeGCModelParameters ) :: self integer, intent(in) :: subgroup_i_id ID of the subgroup i integer, intent(in) :: subgroup_j_id ID of the subgroup j Return Value real(kind=pr) Interaction parameter Variables Type Visibility Attributes Name Initial integer, public :: i integer, public :: j integer, public :: mi_id integer, public :: mj_id","tags":"","loc":"proc/get_subgroups_bij.html"},{"title":"get_subgroups_cij – yaeos","text":"public function get_subgroups_cij(self, subgroup_i_id, subgroup_j_id) result(cij) get_subgroups_cij Get the interaction parameter Description Get the interaction parameter of the subgroups i and j ids. Examples use yaeos__models_ge_group_contribution_unifac_parameters , only : UNIFACParameters use yaeos__models_ge_group_contribution_model_parameters , only : GeGCModelParameters type ( GeGCModelParameters ) :: parameters parameters = UNIFACParameters () ! Get the subgroups i:1, j:16 interaction parameter cij (CH3-H2O) ! with maingroups 1 and 7 respectively. print * , parameters % get_subgroups_cij ( 1 , 16 ) ! prints: 0.0000 In the example we obtain 0.0 because UNIFAC only have parameters References Dortmund Data Bank Software & Separation Technology Type Bound GeGCModelParameters Arguments Type Intent Optional Attributes Name class( GeGCModelParameters ) :: self integer, intent(in) :: subgroup_i_id ID of the subgroup i integer, intent(in) :: subgroup_j_id ID of the subgroup j Return Value real(kind=pr) Interaction parameter Variables Type Visibility Attributes Name Initial integer, public :: i integer, public :: j integer, public :: mi_id integer, public :: mj_id","tags":"","loc":"proc/get_subgroups_cij.html"},{"title":"ar_interface – yaeos","text":"Uses yaeos__constants iso_fortran_env Variables Type Visibility Attributes Name Initial procedure( Ares ), public, pointer :: ar_fun procedure( initial_volume ), public, pointer :: vinit Abstract Interfaces abstract interface public subroutine Ares(z, v, t, Ar, ArV, ArTV, ArV2, Arn, ArVn, ArTn, Arn2) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: z (:) real(kind=pr), intent(in) :: v real(kind=pr), intent(in) :: t real(kind=pr), intent(out) :: Ar real(kind=pr), intent(out) :: ArV real(kind=pr), intent(out) :: ArTV real(kind=pr), intent(out) :: ArV2 real(kind=pr), intent(out), dimension(size(z)) :: Arn real(kind=pr), intent(out), dimension(size(z)) :: ArVn real(kind=pr), intent(out), dimension(size(z)) :: ArTn real(kind=pr), intent(out) :: Arn2 (size(z),size(z)) abstract interface public function initial_volume(z, p, t) Arguments Type Intent Optional Attributes Name real(kind=pr) :: z (:) real(kind=pr) :: p real(kind=pr) :: t Return Value real(kind=pr)","tags":"","loc":"module/ar_interface.html"},{"title":"yaeos__equilibria_boundaries_phase_envelopes_pt – yaeos","text":"Phase boundaries line on the plane calculation procedures. Uses yaeos__constants yaeos__models yaeos__equilibria_equilibrium_state yaeos__math_continuation Variables Type Visibility Attributes Name Initial real(kind=pr), private :: Vy real(kind=pr), private :: Vz Derived Types type, public :: CriticalPoint Critical point Components Type Visibility Attributes Name Initial real(kind=pr), public :: P Pressure [bar] real(kind=pr), public :: T Temperature [K] type, public :: PTEnvel2 Two-phase isopleth.\nPhase boundary line of a fluid at constant composition. Components Type Visibility Attributes Name Initial type( CriticalPoint ), public, allocatable :: cps (:) Critical points found along the line. type( EquilibriumState ), public, allocatable :: points (:) Each point through the line. Type-Bound Procedures procedure, public, pass :: write => write_PTEnvel2 generic, public :: write (FORMATTED) => write Functions public function pt_envelope_2ph (model, z, first_point, points, iterations, delta_0, specified_variable_0, solver, stop_conditions) result(envelopes) PT two-phase envelope calculation procedure. Read more… Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: model Thermodyanmic model real(kind=pr), intent(in) :: z (:) Vector of molar fractions type( EquilibriumState ) :: first_point integer, intent(in), optional :: points Maxmimum number of points, defaults to 500 integer, intent(in), optional :: iterations Point solver maximum iterations, defaults to 100 real(kind=pr), intent(in), optional :: delta_0 Initial extrapolation integer, intent(in), optional :: specified_variable_0 Position of specified variable, since the vector of variables is the values for specification\nwill be for the equilibria constants, for and for . procedure( continuation_solver ), optional :: solver Specify solver for each point, defaults to a full newton procedure procedure( continuation_stopper ), optional :: stop_conditions Function that returns true if the continuation method should stop Return Value type( PTEnvel2 ) Subroutines public subroutine write_PTEnvel2 (pt2, unit, iotype, v_list, iostat, iomsg) Arguments Type Intent Optional Attributes Name class( PTEnvel2 ), intent(in) :: pt2 integer, intent(in) :: unit character(len=*), intent(in) :: iotype integer, intent(in) :: v_list (:) integer, intent(out) :: iostat character(len=*), intent(inout) :: iomsg","tags":"","loc":"module/yaeos__equilibria_boundaries_phase_envelopes_pt.html"},{"title":"yaeos__consistency_armodel – yaeos","text":"yaeos__consistency_armodel Consistency checks of Helmholtz free energy models ( ArModel ). Description This module contains tools to validate the analityc derivatives of\nimplmented Helmholtz free energy models ( ArModel ). Also, allows to\nevaluate the consistency tests described in Thermodynamic Models:\nFundamentals & Computational Aspects 2 ed. by Michelsen and Mollerup\nChapter 2 section 3. Available tools: numeric_ar_derivatives : From an instantiated ArModel evaluate\nall the Helmholtz free energy derivatives from the central finite\ndifference method. ar_consistency : From an instantiated ArModel evaluate all the\nMichelsen and Mollerup consistency tests. References Michelsen, M. L., & Mollerup, J. M. (2007). Thermodynamic models:\nFundamentals & computational aspects (2. ed). Tie-Line Publications. Uses yaeos__constants yaeos__models_ar Subroutines public subroutine ar_consistency (eos, n, V, T, eq31, eq33, eq34, eq36, eq37) models consistency tests. Read more… Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Equation of state real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: V Volume [L] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out), optional :: eq31 MM Eq. 31 real(kind=pr), intent(out), optional :: eq33 (size(n),size(n)) MM Eq. 33 real(kind=pr), intent(out), optional :: eq34 (size(n)) MM Eq. 34 real(kind=pr), intent(out), optional :: eq36 MM Eq. 36 real(kind=pr), intent(out), optional :: eq37 MM Eq. 37 public subroutine numeric_ar_derivatives (eos, n, V, T, d_n, d_v, d_t, Ar, ArV, ArT, Arn, ArV2, ArT2, ArTV, ArVn, ArTn, Arn2) Evaluate the Helmholtz derivatives with central finite difference. Read more… Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Equation of state real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: V Volume [L] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(in) :: d_n Moles finite difference step real(kind=pr), intent(in) :: d_v Volume finite difference step real(kind=pr), intent(in) :: d_t Temperature finite difference step real(kind=pr), intent(out) :: Ar Residual Helmoltz energy real(kind=pr), intent(out), optional :: ArV real(kind=pr), intent(out), optional :: ArT real(kind=pr), intent(out), optional :: Arn (size(n)) real(kind=pr), intent(out), optional :: ArV2 real(kind=pr), intent(out), optional :: ArT2 real(kind=pr), intent(out), optional :: ArTV real(kind=pr), intent(out), optional :: ArVn (size(n)) real(kind=pr), intent(out), optional :: ArTn (size(n)) real(kind=pr), intent(out), optional :: Arn2 (size(n),size(n))","tags":"","loc":"module/yaeos__consistency_armodel.html"},{"title":"yaeos__substance – yaeos","text":"yaeos Subtance module. Module containing pure components properties and parameters. Uses yaeos__constants Derived Types type, public :: Substances Set of pure components Components Type Visibility Attributes Name Initial character(len=50), public, allocatable :: names (:) Composition names. real(kind=pr), public, allocatable :: pc (:) Critical Pressure [bar] real(kind=pr), public, allocatable :: tc (:) Critical Temperature [K] real(kind=pr), public, allocatable :: w (:) Acentric factor","tags":"","loc":"module/yaeos__substance.html"},{"title":"yaeos__models_ar_cubic_mixing_base – yaeos","text":"Mixing rules core math Procedures of the core calculations of CubicEoS mixing rules. Description This module holds all the basic math to use mixing rules in other codes.\nKeeping it simple and accesible. Examples bi = [ 0.2 , 0.3 ] lij = reshape ([ 0.0 , 0.2 , 0.2 , 0 ], [ 2 , 2 ]) ! Calculate B parameter with Quadratric Mixing Rules. call bmix_qmr ( n , bi , lij , b , dbi , dbij ) References Uses yaeos__constants Subroutines public pure subroutine bmix_linear (n, bi, b, dbi, dbij) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: bi (:) real(kind=pr), intent(out) :: b real(kind=pr), intent(out) :: dbi (:) real(kind=pr), intent(out) :: dbij (:,:) public pure subroutine bmix_qmr (n, bi, lij, b, dbi, dbij) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: bi (:) real(kind=pr), intent(in) :: lij (:,:) real(kind=pr), intent(out) :: b real(kind=pr), intent(out) :: dbi (:) real(kind=pr), intent(out) :: dbij (:,:) public pure subroutine d1mix_rkpr (n, d1i, D1, dD1i, dD1ij) RKPR parameter mixing rule. Read more… Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: d1i (:) real(kind=pr), intent(out) :: D1 real(kind=pr), intent(out) :: dD1i (:) real(kind=pr), intent(out) :: dD1ij (:,:)","tags":"","loc":"module/yaeos__models_ar_cubic_mixing_base.html"},{"title":"yaeos__solvers_pressure_equality – yaeos","text":"Solve the pressure equality of a Uses yaeos__constants yaeos__models_ar Subroutines public subroutine pressure_equality_V_beta_xy (model, T, V, beta, x, y, Vx, Vy, P) Solve pressure equality between two phases at a given temperature,\ntotal volume, vapor molar fractions and compositions. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: model real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(in) :: V Total volume [L/mol] real(kind=pr), intent(in) :: beta Molar fraction of light-phase real(kind=pr), intent(in) :: x (:) Molar fractions of heavy-phase real(kind=pr), intent(in) :: y (:) Molar fractions of light-phase real(kind=pr), intent(inout) :: Vx Heavy-phase molar volume [L/mol] real(kind=pr), intent(inout) :: Vy Light-Phase molar volume [L/mol] real(kind=pr), intent(out) :: P Pressure [bar]","tags":"","loc":"module/yaeos__solvers_pressure_equality.html"},{"title":"yaeos__equilibria_saturation_points – yaeos","text":"Uses yaeos__constants yaeos__models yaeos__equilibria_equilibrium_state yaeos__equilibria_auxiliar Variables Type Visibility Attributes Name Initial integer, public :: max_iterations = 1000 real(kind=pr), public :: step_tol = 0.1_pr real(kind=pr), public :: tol = 1e-9_pr Functions public function saturation_pressure (model, n, t, kind, p0, y0, max_iters) Saturation pressure calculation function. Read more… Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: model real(kind=pr), intent(in) :: n (:) Composition vector [moles / molar fraction] real(kind=pr), intent(in) :: t Temperature [K] character(len=*), intent(in) :: kind [bubble|dew|liquid-liquid] real(kind=pr), intent(in), optional :: p0 Initial pressure [bar] real(kind=pr), intent(in), optional :: y0 (:) Initial composition integer, intent(in), optional :: max_iters Maximum number of iterations Return Value type( EquilibriumState ) public function saturation_temperature (model, n, p, kind, t0, y0, max_iters) Saturation temperature calculation function. Read more… Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: model real(kind=pr), intent(in) :: n (:) Composition vector [moles / molar fraction] real(kind=pr), intent(in) :: p Pressure [bar] character(len=*), intent(in) :: kind [bubble|dew|liquid-liquid] real(kind=pr), intent(in), optional :: t0 Initial temperature [K] real(kind=pr), intent(in), optional :: y0 (:) Initial composition integer, intent(in), optional :: max_iters Maximum number of iterations Return Value type( EquilibriumState )","tags":"","loc":"module/yaeos__equilibria_saturation_points.html"},{"title":"yaeos__equilibria_boundaries_phase_envelopes_px – yaeos","text":"Phase boundaries line on the plane calculation procedures. Uses yaeos__constants yaeos__models yaeos__equilibria_equilibrium_state yaeos__math_continuation Variables Type Visibility Attributes Name Initial real(kind=pr), private :: Vy Incipient phase volume [L/mol] real(kind=pr), private :: Vz Main phase volume [L/mol] Derived Types type, public :: CriticalPoint Critical point Components Type Visibility Attributes Name Initial real(kind=pr), public :: P Pressure [bar] real(kind=pr), public :: alpha type, public :: PXEnvel2 Two-phase PX envelope.\nPhase boundary line of a fluid at constant temperature\nwith variation in composition. Components Type Visibility Attributes Name Initial real(kind=pr), public, allocatable :: alpha (:) Second fluid molar fraction type( CriticalPoint ), public, allocatable :: cps (:) Critical points found along the line. type( EquilibriumState ), public, allocatable :: points (:) Each point through the line. real(kind=pr), public, allocatable :: z0 (:) Original fluid composition real(kind=pr), public, allocatable :: z_inj (:) Second fluid composition Functions public function px_envelope_2ph (model, z0, alpha0, z_injection, first_point, points, iterations, delta_0, specified_variable_0, solver, stop_conditions) result(envelopes) PX two-phase envelope calculation procedure. Read more… Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: model Thermodyanmic model real(kind=pr), intent(in) :: z0 (:) Vector of molar fractions of the global composition (main phase) real(kind=pr), intent(in) :: alpha0 First point of real(kind=pr), intent(in) :: z_injection (:) Vector of molar fractions of the injection fluid type( EquilibriumState ) :: first_point integer, intent(in), optional :: points Maxmimum number of points, defaults to 500 integer, intent(in), optional :: iterations Point solver maximum iterations, defaults to 100 real(kind=pr), intent(in), optional :: delta_0 Initial extrapolation integer, intent(in), optional :: specified_variable_0 Position of specified variable, since the vector of variables is the values for specification\nwill be for the equilibria constants, for and for . procedure( continuation_solver ), optional :: solver Specify solver for each point, defaults to a full newton procedure procedure( continuation_stopper ), optional :: stop_conditions Function that returns true if the continuation method should stop Return Value type( PXEnvel2 ) Subroutines public subroutine get_z (alpha, z_0, z_inj, z, dzda) Calculate the fluid composition based on an amount of addition\nof second fluid. Read more… Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: alpha Addition percentaje real(kind=pr), intent(in) :: z_0 (:) real(kind=pr), intent(in) :: z_inj (:) real(kind=pr), intent(out) :: z (size(z_0)) New composition real(kind=pr), intent(out), optional :: dzda (size(z_0)) Derivative wrt","tags":"","loc":"module/yaeos__equilibria_boundaries_phase_envelopes_px.html"},{"title":"yaeos__models_ge_NRTL – yaeos","text":"Uses yaeos__constants yaeos__tapenade_interfaces yaeos__tapenade_ge_api Interfaces public interface NRTL public function init (a, b, c) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: a (:,:) real(kind=pr), intent(in) :: b (:,:) real(kind=pr), intent(in) :: c (:,:) Return Value type( NRTL ) Derived Types type, public, extends( GeModelTapenade ) :: NRTL Non-Random-Two-Liquid model Read more… Components Type Visibility Attributes Name Initial real(kind=pr), public, allocatable :: a (:,:) A_{ij} matrix real(kind=pr), public, allocatable :: b (:,:) B_{ij} matrix real(kind=pr), public, allocatable :: c (:,:) C_{ij} matrix type( Substances ), public :: components Substances contained in the module Constructor public\n\n \n function init (a, b, c) Type-Bound Procedures procedure, public :: excess_gibbs procedure, public :: ge => EXCESS_GIBBS procedure, public :: ge_b => EXCESS_GIBBS_B procedure, public :: ge_d => EXCESS_GIBBS_D procedure, public :: ge_d_b => EXCESS_GIBBS_D_B procedure, public :: ge_d_d => EXCESS_GIBBS_D_D procedure, public :: ln_activity_coefficient Functions public function init (a, b, c) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: a (:,:) real(kind=pr), intent(in) :: b (:,:) real(kind=pr), intent(in) :: c (:,:) Return Value type( NRTL ) Subroutines public subroutine EXCESS_GIBBS (model, n, t, ge) Arguments Type Intent Optional Attributes Name class( NRTL ) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: t real(kind=pr), intent(out) :: ge public subroutine EXCESS_GIBBS_B (model, n, nb, t, tb, ge, geb) Arguments Type Intent Optional Attributes Name class( NRTL ) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr) :: nb (:) real(kind=pr), intent(in) :: t real(kind=pr) :: tb real(kind=pr) :: ge real(kind=pr) :: geb public subroutine EXCESS_GIBBS_D (model, n, nd, t, td, ge, ged) Arguments Type Intent Optional Attributes Name class( NRTL ) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: nd (:) real(kind=pr), intent(in) :: t real(kind=pr), intent(in) :: td real(kind=pr), intent(out) :: ge real(kind=pr), intent(out) :: ged public subroutine EXCESS_GIBBS_D_B (model, n, nb, nd, ndb, t, tb, td, tdb, ge, geb, ged, gedb) Arguments Type Intent Optional Attributes Name class( NRTL ) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr) :: nb (:) real(kind=pr), intent(in) :: nd (:) real(kind=pr) :: ndb (:) real(kind=pr), intent(in) :: t real(kind=pr) :: tb real(kind=pr), intent(in) :: td real(kind=pr) :: tdb real(kind=pr) :: ge real(kind=pr) :: geb real(kind=pr) :: ged real(kind=pr) :: gedb public subroutine EXCESS_GIBBS_D_D (model, n, nd, t, td0, td, ge, ged0, ged, gedd) Arguments Type Intent Optional Attributes Name class( NRTL ) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: nd (:) real(kind=pr), intent(in) :: t real(kind=pr), intent(in) :: td0 real(kind=pr), intent(in) :: td real(kind=pr), intent(out) :: ge real(kind=pr), intent(out) :: ged0 real(kind=pr), intent(out) :: ged real(kind=pr), intent(out) :: gedd public subroutine EXCESS_GIBBS_D_D_D (model, n, nd, t, td1, td0, td, ge, ged1, ged0, ged0d, ged, gedd0, gedd, geddd) Arguments Type Intent Optional Attributes Name class( NRTL ) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: nd (:) real(kind=pr), intent(in) :: t real(kind=pr), intent(in) :: td1 real(kind=pr), intent(in) :: td0 real(kind=pr), intent(in) :: td real(kind=pr), intent(out) :: ge real(kind=pr), intent(out) :: ged1 real(kind=pr), intent(out) :: ged0 real(kind=pr), intent(out) :: ged0d real(kind=pr), intent(out) :: ged real(kind=pr), intent(out) :: gedd0 real(kind=pr), intent(out) :: gedd real(kind=pr), intent(out) :: geddd","tags":"","loc":"module/yaeos__models_ge_nrtl.html"},{"title":"yaeos__consistency – yaeos","text":"yaeos__consistency Subroutine to evaluate the consistency of thermodynamic models. Description Tools to evaluate the consistency of and models. This\nmodule also provides subroutines for numerical evaluations of and derivatives using central finite differences. The purpose of the\nmodule is to assist in the development of new models and ensure the\naccuracy of the derivatives implementation. Examples For detailed explanations and examples of each consistency test, please\nrefer to the API documentation of each submodule. consistency tests: yaeos__consistency_armodel consistency tests: yaeos__consistency_gemodel References Michelsen, M. L., & Mollerup, J. M. (2007). Thermodynamic models:\nFundamentals & computational aspects (2. ed). Tie-Line Publications. Uses yaeos__consistency_armodel yaeos__consistency_gemodel","tags":"","loc":"module/yaeos__consistency.html"},{"title":"yaeos__autodiff – yaeos","text":"This module holds the diferent ways of automatic differentiation Uses yaeos__adiff_hyperdual_ar_api hyperdual_mod","tags":"","loc":"module/yaeos__autodiff.html"},{"title":"yaeos__math_linalg – yaeos","text":"Wrapper module around LAPACK’s dgesv Uses yaeos__constants Functions public function solve_system (a, b) result(x) Solve a linear sytem AX = b Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: a (size(b),size(b)) real(kind=pr), intent(in) :: b (:) Return Value real(kind=pr), (size(b)) Subroutines public subroutine cubic_roots (parameters, real_roots, complex_roots, flag) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: parameters (4) real(kind=pr), intent(out) :: real_roots (3) complex(kind=pr), intent(out) :: complex_roots (3) integer, intent(out) :: flag flag that identifies which case the solution is\n- 0 : 3 real rotos, one of them repeated (use real_roots(1) and real_roots(2))\n- 1 : 1 real root, 2 complex roots.\n Use real_roots(1) and complex_roots(1) and complex_roots(2)\n- -1 : 3 real roots, all different public subroutine cubic_roots_rosendo (parameters, real_roots, complex_roots, flag) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: parameters (4) real(kind=pr), intent(out) :: real_roots (3) complex(kind=pr), intent(out) :: complex_roots (3) integer, intent(out) :: flag","tags":"","loc":"module/yaeos__math_linalg.html"},{"title":"yaeos__auxiliar – yaeos","text":"Uses yaeos__constants Interfaces public interface optval public function optval_integer (val, default) Set a value to a default if it is not defined Arguments Type Intent Optional Attributes Name integer, intent(inout), optional :: val integer, intent(in) :: default Return Value integer public function optval_real (val, default) Set a value to a default if it is not defined Arguments Type Intent Optional Attributes Name real(kind=pr), intent(inout), optional :: val real(kind=pr), intent(in) :: default Return Value real(kind=pr) Functions public function optval_integer (val, default) Set a value to a default if it is not defined Arguments Type Intent Optional Attributes Name integer, intent(inout), optional :: val integer, intent(in) :: default Return Value integer public function optval_real (val, default) Set a value to a default if it is not defined Arguments Type Intent Optional Attributes Name real(kind=pr), intent(inout), optional :: val real(kind=pr), intent(in) :: default Return Value real(kind=pr) Subroutines public subroutine sort (array, idx) Sort an array and return the indexes Arguments Type Intent Optional Attributes Name real(kind=pr), intent(inout) :: array (:) integer, intent(out), optional :: idx (:)","tags":"","loc":"module/yaeos__auxiliar.html"},{"title":"yaeos__equilibria – yaeos","text":"Uses yaeos__equilibria_pure_psat yaeos__equilibria_equilibrium_state yaeos__equilibria_boundaries_phase_envelopes_pt yaeos__equilibria_saturation_points yaeos__equilibria_auxiliar yaeos__equilibria_flash yaeos__equilibria_boundaries_phase_envelopes_px","tags":"","loc":"module/yaeos__equilibria.html"},{"title":"yaeos__equilibria_equilibrium_state – yaeos","text":"Uses yaeos__constants Derived Types type, public :: EquilibriumState Description of a two-phase equilibria state. Read more… Components Type Visibility Attributes Name Initial real(kind=pr), public :: P Pressure [bar] real(kind=pr), public :: T Temperature [K] real(kind=pr), public :: Vx Heavy-phase volume [L/mol] real(kind=pr), public :: Vy Light-phase volume [L/mol] real(kind=pr), public :: beta Mole fraction of light-phase integer, public :: iters = 0 Iterations needed to reach the state character(len=14), public :: kind Kind of point [“bubble”, “dew”, “liquid-liquid”, “split”] real(kind=pr), public, allocatable :: x (:) Heavy-phase molar fractions real(kind=pr), public, allocatable :: y (:) Light-phase molar fractions Type-Bound Procedures generic, public :: write (FORMATTED) => write procedure, private, pass :: write => write_EquilibriumState Subroutines public subroutine write_EquilibriumState (eq, unit, iotype, v_list, iostat, iomsg) Arguments Type Intent Optional Attributes Name class( EquilibriumState ), intent(in) :: eq integer, intent(in) :: unit character(len=*), intent(in) :: iotype integer, intent(in) :: v_list (:) integer, intent(out) :: iostat character(len=*), intent(inout) :: iomsg","tags":"","loc":"module/yaeos__equilibria_equilibrium_state.html"},{"title":"yaeos__fitting – yaeos","text":"Uses yaeos__constants yaeos__equilibria yaeos__models yaeos__optimizers Abstract Interfaces abstract interface public subroutine model_from_X(problem, X) Function that returns a setted model from the parameters vector Arguments Type Intent Optional Attributes Name class( FittingProblem ), intent(inout) :: problem Fitting problem to optimize real(kind=pr), intent(in) :: X (:) Vector of parameters to fit Derived Types type, public, abstract :: FittingProblem This derived type holds all the relevant information for a parameter\noptimization problem. It keeps the base model structure that will be\noptimized and a procedure get_model_from_X that should reconstruct\nthe model with the desired parameters to optimize. Read more… Components Type Visibility Attributes Name Initial type( EquilibriumState ), public, allocatable :: experimental_points (:) Experimental points to fit class( ArModel ), public, allocatable :: model Residual Helmholtz Model to fit logical, public :: verbose = .false. If true log the fitting process Type-Bound Procedures procedure( model_from_X ), public, deferred :: get_model_from_X Functions public function optimize (X, opt, data) result(y) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(inout) :: X (:) Vector of parameters to fit class( Optimizer ), intent(inout) :: opt Optimizer object, bsaed on the Optimizer class from yaeos__optimizers class( FittingProblem ), intent(inout), optional :: data Fitting problem to optimize Return Value real(kind=pr) Subroutines public subroutine error_function (X, Fobj, dF, func_data) Error function for phase-equilibria optimization. Using two-phase\npoints and an error function of: Read more… Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: X (:) Vector of parameters real(kind=pr), intent(out) :: Fobj Objective function real(kind=pr), intent(out), optional :: dF (:) Gradient of the objective function, only exists to be consistent\nwith the Optimizer class API class(*), intent(inout), optional :: func_data","tags":"","loc":"module/yaeos__fitting.html"},{"title":"yaeos__models_ar_genericcubic – yaeos","text":"Uses yaeos__constants yaeos__models_ar yaeos__substance Abstract Interfaces abstract interface public subroutine abs_Bmix(self, n, bi, B, dBi, dBij) Arguments Type Intent Optional Attributes Name class( CubicMixRule ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: bi (:) real(kind=pr), intent(out) :: B real(kind=pr), intent(out) :: dBi (:) real(kind=pr), intent(out) :: dBij (:,:) abstract interface public subroutine abs_D1mix(self, n, d1i, D1, dD1i, dD1ij) Arguments Type Intent Optional Attributes Name class( CubicMixRule ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: d1i (:) real(kind=pr), intent(out) :: D1 real(kind=pr), intent(out) :: dD1i (:) real(kind=pr), intent(out) :: dD1ij (:,:) abstract interface public subroutine abs_Dmix(self, n, T, ai, daidt, daidt2, D, dDdT, dDdT2, dDi, dDidT, dDij) Arguments Type Intent Optional Attributes Name class( CubicMixRule ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: T real(kind=pr), intent(in) :: ai (:) real(kind=pr), intent(in) :: daidt (:) real(kind=pr), intent(in) :: daidt2 (:) real(kind=pr), intent(out) :: D real(kind=pr), intent(out) :: dDdT real(kind=pr), intent(out) :: dDdT2 real(kind=pr), intent(out) :: dDi (:) real(kind=pr), intent(out) :: dDidT (:) real(kind=pr), intent(out) :: dDij (:,:) abstract interface public subroutine abs_alpha(self, Tr, a, dadt, dadt2) Arguments Type Intent Optional Attributes Name class( AlphaFunction ), intent(in) :: self real(kind=pr), intent(in) :: Tr (:) real(kind=pr), intent(out) :: a (:) real(kind=pr), intent(out) :: dadt (:) real(kind=pr), intent(out) :: dadt2 (:) Derived Types type, public, abstract :: AlphaFunction Abstract derived type that describe the required\nprocedure for an alpha function. Type-Bound Procedures procedure( abs_alpha ), public, deferred :: alpha type, public, extends( ArModel ) :: CubicEoS Generic Cubic Equation of State as defined by Michelsen and Mollerup\nwith a parameter that is not constant, \nand a parameter that depends on it. In the case of a \ntwo parameter EoS like PengRobinson the is the same for\nall components so it can be considered as a constant instead of a \nvariable. The expression of the Equation is: Read more… Components Type Visibility Attributes Name Initial real(kind=pr), public, allocatable :: ac (:) Attractive critical parameter class( AlphaFunction ), public, allocatable :: alpha Uses the abstract derived type AlphaFunction to define the\nAlpha function that the CubicEoS will use. The Alpha function\nreceives the reduced temperature and returns the values of alpha\nand its derivatives, named a , dadt and dadt2 respectively. Read more… real(kind=pr), public, allocatable :: b (:) Repulsive parameter type( Substances ), public :: components Substances contained in the module real(kind=pr), public, allocatable :: del1 (:) paramter real(kind=pr), public, allocatable :: del2 (:) paramter class( CubicMixRule ), public, allocatable :: mixrule Uses the abstract derived type CubicMixRule to define the\nmixing rule that the CubicEoS will use. It includes internally\nthree methods to calculate the corresponding parameters for the\nCubic EoS: Dmix , Bmix and D1mix . Read more… character(len=:), public, allocatable :: name Name of the model Type-Bound Procedures procedure, public :: Cp_residual_vt procedure, public :: Cv_residual_vt procedure, public :: enthalpy_residual_vt procedure, public :: entropy_residual_vt procedure, public :: get_v0 => v0 procedure, public :: gibbs_residual_vt => gibbs_residual_VT procedure, public :: lnphi_pt => fugacity_pt procedure, public :: lnphi_vt => fugacity_vt procedure, public :: pressure procedure, public :: residual_helmholtz => GenericCubic_Ar procedure, public :: volume type, public, abstract :: CubicMixRule Abstract derived type that describe the required\nprocedure for a mixing rule on a Cubic EoS Type-Bound Procedures procedure( abs_Bmix ), public, deferred :: Bmix procedure( abs_D1mix ), public, deferred :: D1mix procedure( abs_Dmix ), public, deferred :: Dmix Functions public function v0 (self, n, p, t) Cubic EoS volume initializer.\nFor a Cubic Equation of State, the covolume calculated with the mixing\nrule is a good estimate for the initial volume solver on the liquid\nregion. Arguments Type Intent Optional Attributes Name class( CubicEoS ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: p real(kind=pr), intent(in) :: t Return Value real(kind=pr) Subroutines public subroutine GenericCubic_Ar (self, n, v, t, ar, arv, ArT, artv, arv2, ArT2, Arn, ArVn, ArTn, Arn2) Residual Helmholtz Energy for a generic Cubic Equation of State. Read more… Arguments Type Intent Optional Attributes Name class( CubicEoS ), intent(in) :: self real(kind=pr), intent(in) :: n (:) Number of moles real(kind=pr), intent(in) :: v Volume [L] real(kind=pr), intent(in) :: t Temperature [K] real(kind=pr), intent(out), optional :: ar Residual Helmholtz real(kind=pr), intent(out), optional :: arv real(kind=pr), intent(out), optional :: ArT real(kind=pr), intent(out), optional :: artv real(kind=pr), intent(out), optional :: arv2 real(kind=pr), intent(out), optional :: ArT2 real(kind=pr), intent(out), optional :: Arn (size(n)) real(kind=pr), intent(out), optional :: ArVn (size(n)) real(kind=pr), intent(out), optional :: ArTn (size(n)) real(kind=pr), intent(out), optional :: Arn2 (size(n),size(n)) public subroutine volume (eos, n, P, T, V, root_type) Volume solver optimized for Cubic Equations of State. Read more… Arguments Type Intent Optional Attributes Name class( CubicEoS ), intent(in) :: eos real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: P real(kind=pr), intent(in) :: T real(kind=pr), intent(out) :: V character(len=*), intent(in) :: root_type","tags":"","loc":"module/yaeos__models_ar_genericcubic.html"},{"title":"yaeos__tapenade_ar_api – yaeos","text":"Module that wraps tapenade generated routines to calculate !\nAr and derivatives. Uses yaeos__constants yaeos__models_ar Abstract Interfaces abstract interface private subroutine tapenade_ar(model, n, v, t, arval) Arguments Type Intent Optional Attributes Name class( ArModelTapenade ), intent(in) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: v real(kind=pr), intent(in) :: t real(kind=pr), intent(out) :: arval abstract interface private subroutine tapenade_ar_b(model, n, nb, v, vb, t, tb, arval, arvalb) Arguments Type Intent Optional Attributes Name class( ArModelTapenade ), intent(in) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr) :: nb (:) real(kind=pr), intent(in) :: v real(kind=pr) :: vb real(kind=pr), intent(in) :: t real(kind=pr) :: tb real(kind=pr) :: arval real(kind=pr) :: arvalb abstract interface private subroutine tapenade_ar_d(model, n, nd, v, vd, t, td, arval, arvald) Arguments Type Intent Optional Attributes Name class( ArModelTapenade ), intent(in) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: nd (:) real(kind=pr), intent(in) :: v real(kind=pr), intent(in) :: vd real(kind=pr), intent(in) :: t real(kind=pr), intent(in) :: td real(kind=pr), intent(out) :: arval real(kind=pr), intent(out) :: arvald abstract interface private subroutine tapenade_ar_d_b(model, n, nb, nd, ndb, v, vb, vd, vdb, t, tb, td, tdb, arval, arvalb, arvald, arvaldb) Arguments Type Intent Optional Attributes Name class( ArModelTapenade ), intent(in) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr) :: nb (:) real(kind=pr), intent(in) :: nd (:) real(kind=pr) :: ndb (:) real(kind=pr), intent(in) :: v real(kind=pr) :: vb real(kind=pr), intent(in) :: vd real(kind=pr) :: vdb real(kind=pr), intent(in) :: t real(kind=pr) :: tb real(kind=pr), intent(in) :: td real(kind=pr) :: tdb real(kind=pr) :: arval real(kind=pr) :: arvalb real(kind=pr) :: arvald real(kind=pr) :: arvaldb abstract interface private subroutine tapenade_ar_d_d(model, n, nd, v, vd0, vd, t, td0, td, arval, arvald0, arvald, arvaldd) Arguments Type Intent Optional Attributes Name class( ArModelTapenade ), intent(in) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: nd (:) real(kind=pr), intent(in) :: v real(kind=pr), intent(in) :: vd0 real(kind=pr), intent(in) :: vd real(kind=pr), intent(in) :: t real(kind=pr), intent(in) :: td0 real(kind=pr), intent(in) :: td real(kind=pr), intent(out) :: arval real(kind=pr), intent(out) :: arvald0 real(kind=pr), intent(out) :: arvald real(kind=pr), intent(out) :: arvaldd abstract interface private pure function tapenade_v0(model, n, p, t) Arguments Type Intent Optional Attributes Name class( ArModelTapenade ), intent(in) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: p real(kind=pr), intent(in) :: t Return Value real(kind=pr) Derived Types type, public, abstract, extends( ArModel ) :: ArModelTapenade Components Type Visibility Attributes Name Initial type( Substances ), public :: components Substances contained in the module character(len=:), public, allocatable :: name Name of the model Type-Bound Procedures procedure, public :: Cp_residual_vt procedure, public :: Cv_residual_vt procedure( tapenade_ar ), public, deferred :: ar procedure( tapenade_ar_b ), public, deferred :: ar_b procedure( tapenade_ar_d ), public, deferred :: ar_d procedure( tapenade_ar_d_b ), public, deferred :: ar_d_b procedure( tapenade_ar_d_d ), public, deferred :: ar_d_d procedure, public :: enthalpy_residual_vt procedure, public :: entropy_residual_vt procedure, public :: get_v0 procedure, public :: gibbs_residual_vt => gibbs_residual_VT procedure, public :: lnphi_pt => fugacity_pt procedure, public :: lnphi_vt => fugacity_vt procedure, public :: pressure procedure, public :: residual_helmholtz procedure( tapenade_v0 ), public, deferred :: v0 procedure, public :: volume Functions private function get_v0 (self, n, p, t) Arguments Type Intent Optional Attributes Name class( ArModelTapenade ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: p real(kind=pr), intent(in) :: t Return Value real(kind=pr) Subroutines private subroutine residual_helmholtz (self, n, v, t, Ar, ArV, ArT, ArTV, ArV2, ArT2, Arn, ArVn, ArTn, Arn2) Residual Helmholtz model generic interface Arguments Type Intent Optional Attributes Name class( ArModelTapenade ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: v real(kind=pr), intent(in) :: t real(kind=pr), intent(out), optional :: Ar real(kind=pr), intent(out), optional :: ArV real(kind=pr), intent(out), optional :: ArT real(kind=pr), intent(out), optional :: ArTV real(kind=pr), intent(out), optional :: ArV2 real(kind=pr), intent(out), optional :: ArT2 real(kind=pr), intent(out), optional, dimension(size(n)) :: Arn real(kind=pr), intent(out), optional, dimension(size(n)) :: ArVn real(kind=pr), intent(out), optional, dimension(size(n)) :: ArTn real(kind=pr), intent(out), optional :: Arn2 (size(n),size(n))","tags":"","loc":"module/yaeos__tapenade_ar_api.html"},{"title":"yaeos__models_ge – yaeos","text":"Excess Gibbs Models. Uses yaeos__constants yaeos__models_base Abstract Interfaces abstract interface public subroutine excess_gibbs(self, n, t, Ge, GeT, GeT2, Gen, GeTn, Gen2) Excess Gibbs and derivs procedure Arguments Type Intent Optional Attributes Name class( GeModel ), intent(in) :: self Model real(kind=pr), intent(in) :: n (:) Moles vector real(kind=pr), intent(in) :: t Temperature [K] real(kind=pr), intent(out), optional :: Ge Excess Gibbs real(kind=pr), intent(out), optional :: GeT real(kind=pr), intent(out), optional :: GeT2 real(kind=pr), intent(out), optional :: Gen (size(n)) real(kind=pr), intent(out), optional :: GeTn (size(n)) real(kind=pr), intent(out), optional :: Gen2 (size(n),size(n)) Derived Types type, public, abstract, extends( BaseModel ) :: GeModel Excess Gibbs energy model. Components Type Visibility Attributes Name Initial type( Substances ), public :: components Substances contained in the module Type-Bound Procedures procedure( excess_gibbs ), public, deferred :: excess_gibbs procedure, public :: ln_activity_coefficient Subroutines public subroutine ln_activity_coefficient (self, n, T, lngamma) Arguments Type Intent Optional Attributes Name class( GeModel ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: T real(kind=pr), intent(out) :: lngamma (:)","tags":"","loc":"module/yaeos__models_ge.html"},{"title":"yaeos__optimizers – yaeos","text":"Uses yaeos__constants Abstract Interfaces abstract interface public subroutine abs_optimize(self, foo, X, F, data) Arguments Type Intent Optional Attributes Name class( Optimizer ), intent(inout) :: self procedure( obj_func ) :: foo real(kind=pr), intent(inout) :: X (:) real(kind=pr), intent(out) :: F class(*), intent(inout), optional, target :: data abstract interface public subroutine obj_func(X, F, dF, data) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: X (:) real(kind=pr), intent(out) :: F real(kind=pr), intent(out), optional :: dF (:) class(*), intent(inout), optional :: data Derived Types type, public, abstract :: Optimizer Components Type Visibility Attributes Name Initial real(kind=pr), public, allocatable :: parameter_step (:) real(kind=pr), public :: solver_tolerance = 1e-9_pr logical, public :: verbose Type-Bound Procedures procedure( abs_optimize ), public, deferred :: optimize","tags":"","loc":"module/yaeos__optimizers.html"},{"title":"yaeos__optimizers_powell_wrap – yaeos","text":"Uses yaeos__constants yaeos__optimizers Variables Type Visibility Attributes Name Initial class(*), private, pointer :: priv_data procedure( obj_func ), private, pointer :: priv_foo Derived Types type, public, extends( Optimizer ) :: PowellWrapper Wrapper derived type to optimize with the Powell method Components Type Visibility Attributes Name Initial real(kind=pr), public, allocatable :: parameter_step (:) real(kind=pr), public :: solver_tolerance = 1e-9_pr logical, public :: verbose Type-Bound Procedures procedure, public :: optimize => powell_optimize Subroutines private subroutine foo_wrap (n, x, f) Arguments Type Intent Optional Attributes Name integer :: n real(kind=pr) :: x (*) real(kind=pr) :: f private subroutine powell_optimize (self, foo, X, F, data) Arguments Type Intent Optional Attributes Name class( PowellWrapper ), intent(inout) :: self procedure( obj_func ) :: foo real(kind=pr), intent(inout) :: X (:) real(kind=pr), intent(out) :: F class(*), intent(inout), optional, target :: data","tags":"","loc":"module/yaeos__optimizers_powell_wrap.html"},{"title":"auxiliar_functions – yaeos","text":"Uses yaeos__constants Functions public function allclose (x, y, atol) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: x (:) real(kind=pr), intent(in) :: y (:) real(kind=pr), intent(in) :: atol Return Value logical public elemental function rel_error (x, y) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: x real(kind=pr), intent(in) :: y Return Value real(kind=pr)","tags":"","loc":"module/auxiliar_functions.html"},{"title":"yaeos__models_ge_group_contribution_unifac – yaeos","text":"UNIFAC module Classic liquid-vapor UNIFAC model implementation module. Description Classic liquid-vapor UNIFAC model implementation module. The\nimplementation is based on the Thermopack library (SINTEF) implementation. Examples ! Instantiate an UNIFAC model with ethanol-water mix and calculate gammas use yaeos , only : pr , Groups , setup_unifac , UNIFAC type ( UNIFAC ) :: model type ( Groups ) :: molecules ( 2 ) real ( pr ) :: ln_gammas ( 2 ) ! Ethanol definition [CH3, CH2, OH] molecules ( 1 )% groups_ids = [ 1 , 2 , 14 ] ! Subgroups ids molecules ( 1 )% number_of_groups = [ 1 , 1 , 1 ] ! Subgroups occurrences ! Water definition [H2O] molecules ( 2 )% groups_ids = [ 16 ] molecules ( 2 )% number_of_groups = [ 1 ] ! Model setup model = setup_unifac ( molecules ) ! Calculate ln_gammas call model % ln_activity_coefficient ([ 0.5_pr , 0.5_pr ], 29 8.0_pr , ln_gammas ) print * , ln_gammas ! result: 0.18534142000449058 0.40331395945417559 References Dortmund Data Bank Software & Separation Technology Fredenslund, A., Jones, R. L., & Prausnitz, J. M. (1975).\nGroup‐contribution estimation of activity coefficients in nonideal liquid\nmixtures. AIChE Journal, 21(6), 1086–1099. https://doi.org/10.1002/aic.690210607 Skjold-Jorgensen, S., Kolbe, B., Gmehling, J., & Rasmussen, P. (1979).\nVapor-Liquid Equilibria by UNIFAC Group Contribution. Revision and\nExtension. Industrial & Engineering Chemistry Process Design and\nDevelopment, 18(4), 714–722. https://doi.org/10.1021/i260072a024 Gmehling, J., Rasmussen, P., & Fredenslund, A. (1982). Vapor-liquid\nequilibriums by UNIFAC group contribution. Revision and extension. 2.\nIndustrial & Engineering Chemistry Process Design and Development, 21(1),\n118–127. https://doi.org/10.1021/i200016a021 Macedo, E. A., Weidlich, U., Gmehling, J., & Rasmussen, P. (1983).\nVapor-liquid equilibriums by UNIFAC group contribution. Revision and\nextension. 3. Industrial & Engineering Chemistry Process Design and\nDevelopment, 22(4), 676–678. https://doi.org/10.1021/i200023a023 Tiegs, D., Rasmussen, P., Gmehling, J., & Fredenslund, A. (1987).\nVapor-liquid equilibria by UNIFAC group contribution. 4. Revision and\nextension. Industrial & Engineering Chemistry Research, 26(1), 159–161. https://doi.org/10.1021/ie00061a030 Hansen, H. K., Rasmussen, P., Fredenslund, A., Schiller, M., &\nGmehling, J. (1991). Vapor-liquid equilibria by UNIFAC group\ncontribution. 5. Revision and extension. Industrial & Engineering\nChemistry Research, 30 (10), 2352–2355. https://doi.org/10.1021/ie00058a017 Wittig, R., Lohmann, J., & Gmehling, J. (2003). Vapor−Liquid Equilibria\nby UNIFAC Group Contribution. 6. Revision and Extension. Industrial &\nEngineering Chemistry Research, 42(1), 183–188. https://doi.org/10.1021/ie020506l SINTEF - Thermopack Uses yaeos__constants yaeos__models_ge_group_contribution_unifac_parameters yaeos__models_ge yaeos__models_ge_group_contribution_model_parameters Abstract Interfaces abstract interface public subroutine temperature_dependence(self, systems_groups, T, psi, dpsi_dt, dpsi_dt2) temperature_dependence interface Interface subroutine for UNIFAC models temperature dependent\nfunctions Arguments Type Intent Optional Attributes Name class( PsiFunction ) :: self PsiFunction type variable class( Groups ) :: systems_groups Groups type variable containig all the system’s groups. See the groups_stew variable on the UNIFAC documentation. real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out), optional :: psi (:,:) real(kind=pr), intent(out), optional :: dpsi_dt (:,:) real(kind=pr), intent(out), optional :: dpsi_dt2 (:,:) Derived Types type, public :: Groups Derived type used to represent a molecule and its UNIFAC groups. Read more… Components Type Visibility Attributes Name Initial integer, public, allocatable :: groups_ids (:) Indexes (ids) of each subgroup in the main group matrix integer, public, allocatable :: number_of_groups (:) Occurrences of each subgroup in the molecule real(kind=pr), public :: surface_area Molecule surface area real(kind=pr), public :: volume Molecule volume type, public, abstract :: PsiFunction UNIFAC functions abstract type Read more… Type-Bound Procedures procedure( temperature_dependence ), public, deferred :: psi type, public, extends( GeModel ) :: UNIFAC Classic liquid-vapor UNIFAC model derived type Read more… Components Type Visibility Attributes Name Initial type( Substances ), public :: components Substances contained in the module real(kind=pr), public, allocatable :: group_area (:) Group areas real(kind=pr), public, allocatable :: group_volume (:) Group volumes type( Groups ), public :: groups_stew All the groups present in the system type( Groups ), public, allocatable :: molecules (:) Substances present in the system integer, public :: ngroups Total number of individual groups in the mixture integer, public :: nmolecules Total number of molecules in the mixture class( PsiFunction ), public, allocatable :: psi_function Temperature dependance function of the model real(kind=pr), public, allocatable :: qk (:) Area of each group k real(kind=pr), public, allocatable :: thetas_ij (:,:) Area fractions of the groups j on molecules i real(kind=pr), public, allocatable :: vij (:,:) Ocurrences of each group j on each molecule i real(kind=pr), public :: z = 10 Model constant Type-Bound Procedures procedure, public :: excess_gibbs procedure, public :: ln_activity_coefficient type, public, extends( PsiFunction ) :: UNIFACPsi Read more… Components Type Visibility Attributes Name Initial real(kind=pr), public, allocatable :: Aij (:,:) Type-Bound Procedures procedure, public :: psi => UNIFAC_temperature_dependence Functions public function setup_unifac (molecules, parameters) Instantiate a UNIFAC model Read more… Arguments Type Intent Optional Attributes Name type( Groups ), intent(in) :: molecules (:) Molecules (Group type) objects type( GeGCModelParameters ), intent(in), optional :: parameters UNIFAC parameters Return Value type( UNIFAC ) public function thetas_i (nm, ng, parameters, stew, molecules) result(thetas_ij) Calculate the area fraciton of each froup on each molecule. Read more… Arguments Type Intent Optional Attributes Name integer, intent(in) :: nm Number of molecules integer, intent(in) :: ng Number of groups type( GeGCModelParameters ), intent(in) :: parameters UNIFAC parameters type( Groups ), intent(in) :: stew All the groups present in the system type( Groups ), intent(in) :: molecules (:) Molecules Return Value real(kind=pr), (nm,ng) Group j area fraction on molecule i Subroutines public subroutine Ge_combinatorial (self, n, T, Ge, dGe_dn, dGe_dn2) Calculate the UNIFAC combinatorial term of Gibbs excess energy Read more… Arguments Type Intent Optional Attributes Name class( UNIFAC ) :: self real(kind=pr), intent(in) :: n (self%nmolecules) Moles vector [mol] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out), optional :: Ge Combinatorial Gibbs excess energy real(kind=pr), intent(out), optional :: dGe_dn (self%nmolecules) real(kind=pr), intent(out), optional :: dGe_dn2 (self%nmolecules,self%nmolecules) public subroutine Ge_residual (self, n, T, Ge, dGe_dn, dGe_dn2, dGe_dT, dGe_dT2, dGe_dTn) Evaluate the UNIFAC residual therm Read more… Arguments Type Intent Optional Attributes Name class( UNIFAC ) :: self real(kind=pr), intent(in) :: n (self%nmolecules) Moles vector real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out), optional :: Ge Residual Gibbs excess energy real(kind=pr), intent(out), optional :: dGe_dn (self%nmolecules) real(kind=pr), intent(out), optional :: dGe_dn2 (self%nmolecules,self%nmolecules) real(kind=pr), intent(out), optional :: dGe_dT real(kind=pr), intent(out), optional :: dGe_dT2 real(kind=pr), intent(out), optional :: dGe_dTn (self%nmolecules) public subroutine UNIFAC_temperature_dependence (self, systems_groups, T, psi, dpsi_dt, dpsi_dt2) Implementation of the function of the UNIFAC model. Read more… Arguments Type Intent Optional Attributes Name class( UNIFACPsi ) :: self function class( Groups ) :: systems_groups Groups in the system real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out), optional :: psi (:,:) real(kind=pr), intent(out), optional :: dpsi_dt (:,:) real(kind=pr), intent(out), optional :: dpsi_dt2 (:,:) public subroutine excess_gibbs (self, n, T, Ge, GeT, GeT2, Gen, GeTn, Gen2) Calculate the Gibbs excess energy of the UNIFAC model Read more… Arguments Type Intent Optional Attributes Name class( UNIFAC ), intent(in) :: self UNIFAC model real(kind=pr), intent(in) :: n (:) Moles vector [mol] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out), optional :: Ge Excess Gibbs energy real(kind=pr), intent(out), optional :: GeT real(kind=pr), intent(out), optional :: GeT2 real(kind=pr), intent(out), optional :: Gen (size(n)) real(kind=pr), intent(out), optional :: GeTn (size(n)) real(kind=pr), intent(out), optional :: Gen2 (size(n),size(n))","tags":"","loc":"module/yaeos__models_ge_group_contribution_unifac.html"},{"title":"yaeos__math_continuation – yaeos","text":"Implementation of Algower’s numerical continuation method. Uses yaeos__constants yaeos__math_linalg Abstract Interfaces abstract interface public subroutine continuation_function(X, ns, S, F, dF, dFdS) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: X (:) integer, intent(in) :: ns real(kind=pr), intent(in) :: S real(kind=pr), intent(out) :: F (:) real(kind=pr), intent(out) :: dF (:,:) real(kind=pr), intent(out) :: dFdS (:) abstract interface public subroutine continuation_solver(fun, iters, X, ns, S, dS, dXdS, point, max_iters, F, df, dfds, tol) Solver to solve a point during numerical contination. Arguments Type Intent Optional Attributes Name procedure( continuation_function ) :: fun Function to solve integer, intent(out) :: iters Number of iterations needed real(kind=pr), intent(inout) :: X (:) Variables vector integer, intent(in) :: ns Specification number real(kind=pr), intent(in) :: S Specification value real(kind=pr), intent(in) :: dS Delta spec real(kind=pr), intent(in) :: dXdS (:) integer, intent(in) :: point Point number integer, intent(in) :: max_iters Maximum iterations real(kind=pr), intent(out) :: F (:) Function values at solved point real(kind=pr), intent(out) :: df (:,:) Jacobian values real(kind=pr), intent(out) :: dfds (:) dFdS real(kind=pr), intent(in) :: tol Solver tolerance abstract interface public function continuation_stopper(X, ns, S, dS, dXdS, iterations) Function that returns true if the method should stop Arguments Type Intent Optional Attributes Name real(kind=pr), intent(inout) :: X (:) Vector of variables integer, intent(inout) :: ns Position of specified variable real(kind=pr), intent(inout) :: S Specification variable value real(kind=pr), intent(inout) :: dS Step of specification in the method real(kind=pr), intent(inout) :: dXdS (:) integer, intent(in) :: iterations Iterations needed to converge point Return Value logical abstract interface public subroutine process(X, ns, S, dS, dXdS, iterations) Subroutine to make variation in the method after a point converged Arguments Type Intent Optional Attributes Name real(kind=pr), intent(inout) :: X (:) Vector of variables integer, intent(inout) :: ns Position of specified variable real(kind=pr), intent(inout) :: S Specification variable value real(kind=pr), intent(inout) :: dS Step of specification in the method real(kind=pr), intent(inout) :: dXdS (:) integer, intent(in) :: iterations Iterations needed to converge point Derived Types type, public :: ContinuationVariable Components Type Visibility Attributes Name Initial real(kind=pr), public :: S real(kind=pr), public, allocatable :: X (:) real(kind=pr), public :: dS integer, public :: ns Functions public function continuation (f, X0, ns0, S0, dS0, max_points, solver_tol, update_specification, postprocess, solver, stop) result(XS) Numerical continuation of a function. Read more… Arguments Type Intent Optional Attributes Name procedure( continuation_function ) :: f Function to trace real(kind=pr), intent(in) :: X0 (:) Initial point integer, intent(in) :: ns0 Initial specification real(kind=pr), intent(in) :: S0 Initial specification value real(kind=pr), intent(in) :: dS0 Initial integer, intent(in) :: max_points Maximum number of points to trace real(kind=pr), intent(in) :: solver_tol Point solver tolerance procedure( process ), optional :: update_specification Procedure to select the new specification and define the next step\n(\\DeltaS)\\, defaults to: Read more… procedure( process ), optional :: postprocess Any kind of postprocess that could be done after defining the\nnext step procedure( continuation_solver ), optional :: solver Solver procedures, uses Newton-Raphson by default procedure( continuation_stopper ), optional :: stop Stopping procedure Return Value real(kind=pr), (max_points,size(X0)) Subroutines public subroutine full_newton (fun, iters, X, ns, S, dS, dXdS, point, max_iters, F, df, dfds, tol) Subroutine to solve a point. Read more… Arguments Type Intent Optional Attributes Name procedure( continuation_function ) :: fun Function to solve integer, intent(out) :: iters Number of iterations needed real(kind=pr), intent(inout) :: X (:) Variables vector integer, intent(in) :: ns real(kind=pr), intent(in) :: S real(kind=pr), intent(in) :: dS real(kind=pr), intent(in) :: dXdS (:) integer, intent(in) :: point integer, intent(in) :: max_iters Maximum iterations real(kind=pr), intent(out) :: F (:) Function values at solved point real(kind=pr), intent(out) :: df (:,:) Jacobian values real(kind=pr), intent(out) :: dfds (:) dFdS real(kind=pr), intent(in) :: tol","tags":"","loc":"module/yaeos__math_continuation.html"},{"title":"yaeos__equilibria_auxiliar – yaeos","text":"Auxiliar functions used for phase-equilibria calculation. Uses yaeos__constants yaeos__models_base Functions public function P_wilson (model, z, T) result(P) Arguments Type Intent Optional Attributes Name class( BaseModel ), intent(in) :: model real(kind=pr), intent(in) :: z (:) real(kind=pr), intent(in) :: T Return Value real(kind=pr) public function k_wilson (model, T, P) result(K) K-factors regressión done by Wilson, used for initialization. Arguments Type Intent Optional Attributes Name class( BaseModel ), intent(in) :: model real(kind=pr), intent(in) :: T real(kind=pr), intent(in) :: P Return Value real(kind=pr), (size(model%components%pc))","tags":"","loc":"module/yaeos__equilibria_auxiliar.html"},{"title":"yaeos__tapenade_interfaces – yaeos","text":"Uses yaeos__constants Interfaces interface public subroutine POPREAL8(a) Arguments Type Intent Optional Attributes Name real(kind=pr) :: a interface public subroutine POPREAL8ARRAY(a, n) Arguments Type Intent Optional Attributes Name real(kind=pr), dimension(n) :: a integer :: n interface public subroutine popinteger4(i) Arguments Type Intent Optional Attributes Name integer :: i interface public subroutine pushinteger4(i) Arguments Type Intent Optional Attributes Name integer :: i interface public subroutine pushreal8(a) Arguments Type Intent Optional Attributes Name real(kind=pr) :: a interface public subroutine pushreal8array(a, n) Arguments Type Intent Optional Attributes Name real(kind=pr), dimension(n) :: a integer :: n","tags":"","loc":"module/yaeos__tapenade_interfaces.html"},{"title":"yaeos__models_ge_implementations – yaeos","text":"Uses yaeos__models_ge_NRTL yaeos__models_ge_group_contribution_unifac","tags":"","loc":"module/yaeos__models_ge_implementations.html"},{"title":"yaeos__math – yaeos","text":"Mathematical methods for yaeos Description This module provides all the relevant mathematical functions used in this\nlibrary. Most important ones are: newton: Newton solving method solve_system: Solving linear system Ax = b continuation: Continuation method for line tracing Examples Squared error calculation use yaeos__math , only : sq_error real ( pr ) :: x = 2.5 , y = 3.0 , error print * , sq_error ( 2.5 , 3.0 ) ------------------------------------ use yaeos__math , only : sq_error real ( pr ) :: x = [ 2.5 , 5.0 ], y = [ 3.0 , 4.5 ], error ! It also works with arrays print * , sq_error ( x , y ) Uses yaeos__constants yaeos__math_continuation yaeos__math_linalg Interfaces public interface newton public subroutine newton_1d (f, x, tol, max_iters) Arguments Type Intent Optional Attributes Name procedure( f_1d ) :: f real(kind=pr), intent(inout) :: x real(kind=pr), intent(in) :: tol integer, intent(in) :: max_iters Abstract Interfaces abstract interface public subroutine f_1d(x, f, df) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: x real(kind=pr), intent(out) :: f real(kind=pr), intent(out) :: df Functions public function dx_to_dn (x, dx) result(dn) Convert the mole fraction derivatives of a quantity (calculated\nso they do not sum to 1) to mole number derivatives (where the mole\nfractions do sum to one). Requires the derivatives and the mole fractions\nof the mixture.\nFrom https://chemicals.readthedocs.io/chemicals.utils.html?highlight=dxs_to_dns#chemicals.utils.dxs_to_dns Read more… Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: x (:) real(kind=pr), intent(in) :: dx (:) Return Value real(kind=pr), (size(x)) public elemental function sq_error (exp, pred) … Read more… Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: exp real(kind=pr), intent(in) :: pred Return Value real(kind=pr) Subroutines public subroutine newton_1d (f, x, tol, max_iters) Arguments Type Intent Optional Attributes Name procedure( f_1d ) :: f real(kind=pr), intent(inout) :: x real(kind=pr), intent(in) :: tol integer, intent(in) :: max_iters","tags":"","loc":"module/yaeos__math.html"},{"title":"yaeos__adiff_hyperdual_ar_api – yaeos","text":"Module that contains the automatic differentiation logic for an Ar model. All that is needed to define an Ar model that uses automatic\ndifferentiation with hyperdual numbers is to define a new derived type\nthat overloads the method to the Ar function that you want to use.\nA minimal example follows: module newmodel use yaeos__adiff_hyperdual_ar_api , only : ArModelAdiff type , extends ( ArModelAdiff ) :: YourNewModel type ( Substances ) :: composition real ( 8 ) :: parameters (:) contains procedure :: Ar => arfun procedure :: get_v0 => v0 end type contains subroutine arfun ( self , n , v , t , Ar ) class ( YourNewModel ), intent ( in ) :: self type ( hyperdual ), intent ( in ) :: n (:) ! Number of moles type ( hyperdual ), intent ( in ) :: v ! Volume [L] type ( hyperdual ), intent ( in ) :: t ! Temperature [K] type ( hyperdual ), intent ( out ) :: ar_value ! Residual Helmholtz Energy ! A very complicated residual helmholtz function of a mixture Ar = sum ( n ) * v * t end subroutine function v0 ( self , n , p , t ) class ( YourNewModel ), intent ( in ) :: self real ( pr ), intent ( in ) :: n (:) ! Number of moles real ( pr ), intent ( in ) :: p ! Pressure [bar] real ( pr ), intent ( in ) :: t ! Temperature [K] real ( pr ) :: v0 v0 = self % parameters ( 3 ) end function A complete implementation of the PR76 Equation of State can me found in example/adiff/adiff_pr76.f90 Uses yaeos__constants yaeos__models_ar hyperdual_mod Abstract Interfaces abstract interface public function hyperdual_Ar(self, n, v, t) Arguments Type Intent Optional Attributes Name class( ArModelAdiff ) :: self type( hyperdual ), intent(in) :: n (:) type( hyperdual ), intent(in) :: v type( hyperdual ), intent(in) :: t Return Value type( hyperdual ) Derived Types type, public, abstract, extends( ArModel ) :: ArModelAdiff Components Type Visibility Attributes Name Initial type( Substances ), public :: components Substances contained in the module character(len=:), public, allocatable :: name Name of the model Type-Bound Procedures procedure( hyperdual_Ar ), public, deferred :: Ar procedure, public :: Cp_residual_vt procedure, public :: Cv_residual_vt procedure, public :: enthalpy_residual_vt procedure, public :: entropy_residual_vt procedure( abs_volume_initializer ), public, deferred :: get_v0 procedure, public :: gibbs_residual_vt => gibbs_residual_VT procedure, public :: lnphi_pt => fugacity_pt procedure, public :: lnphi_vt => fugacity_vt procedure, public :: pressure procedure, public :: residual_helmholtz procedure, public :: volume Subroutines public subroutine residual_helmholtz (self, n, v, t, Ar, ArV, ArT, ArTV, ArV2, ArT2, Arn, ArVn, ArTn, Arn2) Arguments Type Intent Optional Attributes Name class( ArModelAdiff ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: v real(kind=pr), intent(in) :: t real(kind=pr), intent(out), optional :: Ar real(kind=pr), intent(out), optional :: ArV real(kind=pr), intent(out), optional :: ArT real(kind=pr), intent(out), optional :: ArTV real(kind=pr), intent(out), optional :: ArV2 real(kind=pr), intent(out), optional :: ArT2 real(kind=pr), intent(out), optional, dimension(size(n)) :: Arn real(kind=pr), intent(out), optional, dimension(size(n)) :: ArVn real(kind=pr), intent(out), optional, dimension(size(n)) :: ArTn real(kind=pr), intent(out), optional :: Arn2 (size(n),size(n))","tags":"","loc":"module/yaeos__adiff_hyperdual_ar_api.html"},{"title":"yaeos – yaeos","text":"Yet Another Equation-Of-State (library) Library to use EoS-based calculations. This main module imports all the\nrelevant constants, procedures and objects to have better access to them\nThe main submodules that it uses are: yaeos__constants : All the relevant costants and also the used precision (default=double precision). yaeos__consistency : Tools to evalaute the consistency of Ar and Ge models. yaeos__substance : Derived type that holds the important data (for example, critical constants) from a mixture. yaeos__models : All the implemented models, also their base types for making extensions. yaeos__equilibria : Phase equilibria related procedures. Uses yaeos__constants yaeos__equilibria yaeos__substance yaeos__consistency yaeos__models Variables Type Visibility Attributes Name Initial character(len=*), public, parameter :: version = \"1.0.0\" This version.","tags":"","loc":"module/yaeos.html"},{"title":"yaeos__equilibria_pure_psat – yaeos","text":"Module used to calculate the saturation pressure of pure components at\na given temperature. Uses yaeos__constants yaeos__models Functions public function Psat (eos, ncomp, T) Calculation of saturation pressure of a pure component using the\nsecant method. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model that will be used integer, intent(in) :: ncomp Number of component in the mixture from which the saturation pressure\nwill be calculated real(kind=pr), intent(in) :: T Temperature [K] Return Value real(kind=pr)","tags":"","loc":"module/yaeos__equilibria_pure_psat.html"},{"title":"yaeos__models_ar – yaeos","text":"Module that defines the basics of a residual Helmholtz energy. All the residual properties that are calculated in this library are\nbased on residual Helmholtz Equations of State. Following the book by\nMichelsen and Mollerup. In this library up to second derivatives of residual Helmholtz energy\nare used. Because they’re the fundamentals for phase equilibria\ncalculation. Note Later on, third derivative with respect to volume will be included\nsince it’s importance on calculation of critical points. Properties Available properties: pressure(n, V, T) fugacity(n, V, T) fugacity(n, P, T, root=[vapor, liquid, stable]) volume Calculate thermodynamic properties using Helmholtz energy as a basis.\nAll the routines in this module work with the logic: call foo ( x , V , T , [ dfoodv , dfoodT , ...]) Where the user can call the routine of the desired property. And include\nas optional values the desired derivatives of said properties. Uses yaeos__constants yaeos__models_base Interfaces public interface size public pure function size_ar_model (eos) Get the size of the model. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Return Value integer Abstract Interfaces abstract interface public subroutine abs_residual_helmholtz(self, n, v, t, Ar, ArV, ArT, ArTV, ArV2, ArT2, Arn, ArVn, ArTn, Arn2) Residual Helmholtz model generic interface. This interface represents how an Ar model should be implemented.\nBy our standard, a Resiudal Helmholtz model takes as input: The mixture’s number of moles vector. Volume, by default in liters. Temperature, by default in Kelvin. All the output arguments are optional. While this keeps a long\nsignature for the implementation, this is done this way to take\nadvantage of any inner optimizations to calculate derivatives\ninside the procedure. Once the model is implemented, the signature can be short like model%residual_helmholtz(n, v, t, ArT2=dArdT2) Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: self ArModel real(kind=pr), intent(in) :: n (:) Moles vector real(kind=pr), intent(in) :: v Volume [L] real(kind=pr), intent(in) :: t Temperature [K] real(kind=pr), intent(out), optional :: Ar Residual Helmoltz energy real(kind=pr), intent(out), optional :: ArV real(kind=pr), intent(out), optional :: ArT real(kind=pr), intent(out), optional :: ArTV real(kind=pr), intent(out), optional :: ArV2 real(kind=pr), intent(out), optional :: ArT2 real(kind=pr), intent(out), optional :: Arn (size(n)) real(kind=pr), intent(out), optional :: ArVn (size(n)) real(kind=pr), intent(out), optional :: ArTn (size(n)) real(kind=pr), intent(out), optional :: Arn2 (size(n),size(n)) abstract interface public function abs_volume_initializer(self, n, p, t) Function that provides an initializer value for the liquid-root\nof newton solver of volume. In the case the model will use the volume_michelsen routine this value should provide the co-volume\nof the model. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: self Ar Model real(kind=pr), intent(in) :: n (:) Moles vector real(kind=pr), intent(in) :: p Pressure [bar] real(kind=pr), intent(in) :: t Temperature [K] Return Value real(kind=pr) Initial volume [L] Derived Types type, public, abstract, extends( BaseModel ) :: ArModel Abstract residual Helmholtz model. Read more… Components Type Visibility Attributes Name Initial type( Substances ), public :: components Substances contained in the module character(len=:), public, allocatable :: name Name of the model Type-Bound Procedures procedure, public :: Cp_residual_vt procedure, public :: Cv_residual_vt procedure, public :: enthalpy_residual_vt procedure, public :: entropy_residual_vt procedure( abs_volume_initializer ), public, deferred :: get_v0 procedure, public :: gibbs_residual_vt => gibbs_residual_VT procedure, public :: lnphi_pt => fugacity_pt procedure, public :: lnphi_vt => fugacity_vt procedure, public :: pressure procedure( abs_residual_helmholtz ), public, deferred :: residual_helmholtz procedure, public :: volume Functions public pure function size_ar_model (eos) Get the size of the model. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Return Value integer Subroutines public subroutine Cp_residual_vt (eos, n, V, T, Cp) Calculate residual heat capacity pressure constant given v and t. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: V Volume [L] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out) :: Cp heat capacity p constant [bar L / K / mol] public subroutine Cv_residual_vt (eos, n, V, T, Cv) Calculate residual heat capacity volume constant given v and t. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: V Volume [L] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out) :: Cv heat capacity v constant [bar L / K / mol] public subroutine enthalpy_residual_vt (eos, n, v, t, Hr, HrT, HrV, Hrn) Calculate residual enthalpy given volume and temperature. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: v Volume [L] real(kind=pr), intent(in) :: t Temperature [K] real(kind=pr), intent(out) :: Hr Residual enthalpy [bar L / mol] real(kind=pr), intent(out), optional :: HrT real(kind=pr), intent(out), optional :: HrV real(kind=pr), intent(out), optional :: Hrn (size(n)) public subroutine entropy_residual_vt (eos, n, V, T, Sr, SrT, SrV, Srn) Calculate residual entropy given volume and temperature. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: V Volume [L] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out) :: Sr Entropy [bar L / K / mol] real(kind=pr), intent(out), optional :: SrT real(kind=pr), intent(out), optional :: SrV real(kind=pr), intent(out), optional :: Srn (size(n)) public subroutine fugacity_pt (eos, n, P, T, V, root_type, lnPhi, dlnPhidP, dlnPhidT, dlnPhidn, dPdV, dPdT, dPdn) Calculate logarithm of fugacity, given pressure and temperature. Read more… Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Mixture mole numbers real(kind=pr), intent(in) :: P Pressure [bar] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out), optional :: V Volume [L] character(len=*), intent(in) :: root_type Type of root desired [“liquid”, “vapor”, “stable”] real(kind=pr), intent(out), optional :: lnPhi (size(n)) vector real(kind=pr), intent(out), optional :: dlnPhidP (size(n)) ln(phi) Presssure derivative real(kind=pr), intent(out), optional :: dlnPhidT (size(n)) ln(phi) Temp derivative real(kind=pr), intent(out), optional :: dlnPhidn (size(n),size(n)) ln(phi) compositional derivative real(kind=pr), intent(out), optional :: dPdV real(kind=pr), intent(out), optional :: dPdT real(kind=pr), intent(out), optional :: dPdn (size(n)) public subroutine fugacity_vt (eos, n, V, T, P, lnPhi, dlnPhidP, dlnPhidT, dlnPhidn, dPdV, dPdT, dPdn) Calculate fugacity coefficent given volume and temperature. Read more… Arguments Type Intent Optional Attributes Name class( ArModel ) :: eos Model real(kind=pr), intent(in) :: n (:) Mixture mole numbers real(kind=pr), intent(in) :: V Volume [L] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out), optional :: P Pressure [bar] real(kind=pr), intent(out), optional :: lnPhi (size(n)) vector real(kind=pr), intent(out), optional :: dlnPhidP (size(n)) Presssure derivative real(kind=pr), intent(out), optional :: dlnPhidT (size(n)) Temp derivative real(kind=pr), intent(out), optional :: dlnPhidn (size(n),size(n)) compositional derivative real(kind=pr), intent(out), optional :: dPdV real(kind=pr), intent(out), optional :: dPdT real(kind=pr), intent(out), optional :: dPdn (:) public subroutine gibbs_residual_VT (eos, n, V, T, Gr, GrT, GrV, Grn) Calculate residual Gibbs energy given volume and temperature. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: V Volume [L] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out) :: Gr Gibbs energy [bar L / mol] real(kind=pr), intent(out), optional :: GrT real(kind=pr), intent(out), optional :: GrV real(kind=pr), intent(out), optional :: Grn (size(n)) public subroutine pressure (eos, n, v, t, p, dPdV, dPdT, dPdn) Pressure calculation. Read more… Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: v Volume [L] real(kind=pr), intent(in) :: t Temperature [K] real(kind=pr), intent(out) :: p Pressure [bar] real(kind=pr), intent(out), optional :: dPdV real(kind=pr), intent(out), optional :: dPdT real(kind=pr), intent(out), optional :: dPdn (:) public subroutine volume (eos, n, P, T, V, root_type) Solves volume roots using newton method. Given pressure and temperature. Read more… Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: P Pressure [bar] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out) :: V Volume [L] character(len=*), intent(in) :: root_type Desired root-type to solve. Options are: [\"liquid\", \"vapor\", \"stable\"]","tags":"","loc":"module/yaeos__models_ar.html"},{"title":"hyperdual_mod – yaeos","text":"Hyperdual number definition & type declaration Uses yaeos__constants Interfaces public interface abs public elemental function absHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) public interface acos public elemental function acosHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) public interface asin public elemental function asinHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) public interface assignment (=) public elemental subroutine EqualHyperDualHyperDual (res, inp) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(out) :: res type( hyperdual ), intent(in) :: inp public elemental subroutine EqualHyperDualReal (res, inp) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(out) :: res real(kind=pr), intent(in) :: inp public interface atan public elemental function atanHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) public interface atan2 public elemental function atan2HyperDual (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public interface cos public elemental function cosHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) public interface cosh public elemental function coshHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) public interface exp public elemental function expHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) public interface int public elemental function intHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value integer public interface log public elemental function logHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) public interface log10 public elemental function log10HyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) public interface max public elemental function max_dd (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public elemental function max_ddd (v1, v2, v3) result(v4) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 type( hyperdual ), intent(in) :: v3 Return Value type( hyperdual ) public elemental function max_dr (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 real(kind=pr), intent(in) :: v2 Return Value type( hyperdual ) public elemental function max_rd (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public interface min public elemental function min_dd (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public elemental function min_dr (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 real(kind=pr), intent(in) :: v2 Return Value type( hyperdual ) public elemental function min_rd (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public interface nint public elemental function nintHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value integer public interface operator (*) public elemental function MultiplyHyperDualHyperDual (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public elemental function MultiplyHyperDualReal (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 real(kind=pr), intent(in) :: v2 Return Value type( hyperdual ) public elemental function MultiplyRealHyperDual (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public elemental function MultiplyHyperDualInt (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 integer, intent(in) :: v2 Return Value type( hyperdual ) public elemental function MultiplyIntHyperDual (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name integer, intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public interface operator (**) public elemental function PowerHyperDualInt (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 integer, intent(in) :: v2 Return Value type( hyperdual ) public elemental function PowerHyperDualHyperDual (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public elemental function PowerHyperDualReal (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 real(kind=pr), intent(in) :: v2 Return Value type( hyperdual ) public interface operator (+) public elemental function PlusHyperDualHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) public interface operator (+) public elemental function AddHyperDualHyperDual (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public elemental function AddHyperDualReal (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 real(kind=pr), intent(in) :: v2 Return Value type( hyperdual ) public elemental function AddRealHyperDual (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public interface operator (-) public elemental function MinusHyperDualHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) public interface operator (-) public elemental function SubtractHyperDualHyperDual (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public elemental function SubtractHyperDualReal (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 real(kind=pr), intent(in) :: v2 Return Value type( hyperdual ) public elemental function SubtractRealHyperDual (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public interface operator (.eq.) public function eq_dd (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public elemental function eq_dr (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs real(kind=pr), intent(in) :: rhs Return Value logical public elemental function eq_rd (lhs, rhs) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public function eq_di (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs integer, intent(in) :: rhs Return Value logical public function eq_id (lhs, rhs) Arguments Type Intent Optional Attributes Name integer, intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public interface operator (.ge.) public function ge_dd (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public function ge_dr (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs real(kind=pr), intent(in) :: rhs Return Value logical public function ge_rd (lhs, rhs) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public function ge_di (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs integer, intent(in) :: rhs Return Value logical public function ge_id (lhs, rhs) Arguments Type Intent Optional Attributes Name integer, intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public interface operator (.gt.) public function gt_dd (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public function gt_dr (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs real(kind=pr), intent(in) :: rhs Return Value logical public function gt_rd (lhs, rhs) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public function gt_di (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs integer, intent(in) :: rhs Return Value logical public function gt_id (lhs, rhs) Arguments Type Intent Optional Attributes Name integer, intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public interface operator (.le.) public function le_dd (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public function le_dr (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs real(kind=pr), intent(in) :: rhs Return Value logical public function le_rd (lhs, rhs) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public function le_di (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs integer, intent(in) :: rhs Return Value logical public function le_id (lhs, rhs) Arguments Type Intent Optional Attributes Name integer, intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public interface operator (.lt.) public function lt_dd (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public function lt_dr (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs real(kind=pr), intent(in) :: rhs Return Value logical public function lt_rd (lhs, rhs) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public function lt_di (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs integer, intent(in) :: rhs Return Value logical public function lt_id (lhs, rhs) Arguments Type Intent Optional Attributes Name integer, intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public interface operator (.ne.) public function ne_dd (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public function ne_dr (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs real(kind=pr), intent(in) :: rhs Return Value logical public function ne_rd (lhs, rhs) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public function ne_di (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs integer, intent(in) :: rhs Return Value logical public function ne_id (lhs, rhs) Arguments Type Intent Optional Attributes Name integer, intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public interface operator (/) public elemental function DivideHyperDualHyperDual (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public elemental function DivideHyperDualReal (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 real(kind=pr), intent(in) :: v2 Return Value type( hyperdual ) public elemental function DivideRealHyperDual (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public interface real public elemental function realHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value real(kind=pr) public interface sign public elemental function sign_dd (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public elemental function sign_dr (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 real(kind=pr), intent(in) :: v2 Return Value type( hyperdual ) public elemental function sign_rd (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public interface sin public elemental function sinHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) public interface sinh public elemental function sinhHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) public interface sqrt public elemental function sqrtHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) public interface sum public pure function SumHyperDual (v1, mask) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 (:) logical, intent(in), optional :: mask (:) Return Value type( hyperdual ) public pure function SumHyperDual2 (v1, dim) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 (:,:) integer, intent(in) :: dim Return Value type( hyperdual ), allocatable, (:) public interface tan public elemental function tanHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) public interface tanh public elemental function tanhHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) Derived Types type, public, bind(c) :: hyperdual Components Type Visibility Attributes Name Initial real(kind=pr), public :: f0 = 0 real part of the hyperdual number real(kind=pr), public :: f1 = 0 \\f$\\varepsilon_1\\f$-part of the hyperdual number real(kind=pr), public :: f12 = 0 \\f$\\varepsilon_1\\varepsilon_2\\f$-part of the real(kind=pr), public :: f2 = 0 \\f$\\varepsilon_2\\f$-part of the hyperdual number Functions public elemental function AddHyperDualHyperDual (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public elemental function AddHyperDualReal (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 real(kind=pr), intent(in) :: v2 Return Value type( hyperdual ) public elemental function AddRealHyperDual (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public elemental function DivideHyperDualHyperDual (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public elemental function DivideHyperDualReal (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 real(kind=pr), intent(in) :: v2 Return Value type( hyperdual ) public elemental function DivideRealHyperDual (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public elemental function MinusHyperDualHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) public elemental function MultiplyHyperDualHyperDual (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public elemental function MultiplyHyperDualInt (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 integer, intent(in) :: v2 Return Value type( hyperdual ) public elemental function MultiplyHyperDualReal (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 real(kind=pr), intent(in) :: v2 Return Value type( hyperdual ) public elemental function MultiplyIntHyperDual (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name integer, intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public elemental function MultiplyRealHyperDual (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public elemental function PlusHyperDualHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) public elemental function PowerHyperDualHyperDual (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public elemental function PowerHyperDualInt (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 integer, intent(in) :: v2 Return Value type( hyperdual ) public elemental function PowerHyperDualReal (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 real(kind=pr), intent(in) :: v2 Return Value type( hyperdual ) public elemental function SubtractHyperDualHyperDual (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public elemental function SubtractHyperDualReal (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 real(kind=pr), intent(in) :: v2 Return Value type( hyperdual ) public elemental function SubtractRealHyperDual (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public pure function SumHyperDual (v1, mask) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 (:) logical, intent(in), optional :: mask (:) Return Value type( hyperdual ) public pure function SumHyperDual2 (v1, dim) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 (:,:) integer, intent(in) :: dim Return Value type( hyperdual ), allocatable, (:) public elemental function absHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) public elemental function acosHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) public elemental function asinHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) public elemental function atan2HyperDual (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public elemental function atanHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) public elemental function cosHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) public elemental function coshHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) public function eq_dd (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public function eq_di (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs integer, intent(in) :: rhs Return Value logical public elemental function eq_dr (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs real(kind=pr), intent(in) :: rhs Return Value logical public function eq_id (lhs, rhs) Arguments Type Intent Optional Attributes Name integer, intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public elemental function eq_rd (lhs, rhs) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public elemental function expHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) public function ge_dd (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public function ge_di (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs integer, intent(in) :: rhs Return Value logical public function ge_dr (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs real(kind=pr), intent(in) :: rhs Return Value logical public function ge_id (lhs, rhs) Arguments Type Intent Optional Attributes Name integer, intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public function ge_rd (lhs, rhs) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public function gt_dd (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public function gt_di (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs integer, intent(in) :: rhs Return Value logical public function gt_dr (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs real(kind=pr), intent(in) :: rhs Return Value logical public function gt_id (lhs, rhs) Arguments Type Intent Optional Attributes Name integer, intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public function gt_rd (lhs, rhs) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public elemental function intHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value integer public function le_dd (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public function le_di (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs integer, intent(in) :: rhs Return Value logical public function le_dr (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs real(kind=pr), intent(in) :: rhs Return Value logical public function le_id (lhs, rhs) Arguments Type Intent Optional Attributes Name integer, intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public function le_rd (lhs, rhs) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public elemental function log10HyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) public elemental function logHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) public function lt_dd (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public function lt_di (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs integer, intent(in) :: rhs Return Value logical public function lt_dr (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs real(kind=pr), intent(in) :: rhs Return Value logical public function lt_id (lhs, rhs) Arguments Type Intent Optional Attributes Name integer, intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public function lt_rd (lhs, rhs) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public elemental function max_dd (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public elemental function max_ddd (v1, v2, v3) result(v4) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 type( hyperdual ), intent(in) :: v3 Return Value type( hyperdual ) public elemental function max_dr (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 real(kind=pr), intent(in) :: v2 Return Value type( hyperdual ) public elemental function max_rd (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public elemental function min_dd (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public elemental function min_dr (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 real(kind=pr), intent(in) :: v2 Return Value type( hyperdual ) public elemental function min_rd (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public function ne_dd (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public function ne_di (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs integer, intent(in) :: rhs Return Value logical public function ne_dr (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs real(kind=pr), intent(in) :: rhs Return Value logical public function ne_id (lhs, rhs) Arguments Type Intent Optional Attributes Name integer, intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public function ne_rd (lhs, rhs) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public elemental function nintHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value integer public elemental function realHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value real(kind=pr) public elemental function sign_dd (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public elemental function sign_dr (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 real(kind=pr), intent(in) :: v2 Return Value type( hyperdual ) public elemental function sign_rd (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public elemental function sinHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) public elemental function sinhHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) public elemental function sqrtHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) public elemental function tanHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) public elemental function tanhHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) Subroutines public elemental subroutine EqualHyperDualHyperDual (res, inp) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(out) :: res type( hyperdual ), intent(in) :: inp public elemental subroutine EqualHyperDualReal (res, inp) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(out) :: res real(kind=pr), intent(in) :: inp","tags":"","loc":"module/hyperdual_mod.html"},{"title":"yaeos__models_ge_group_contribution_unifac_parameters – yaeos","text":"UNIFAC parameters UNIFAC parameters module Description Instances of the yaeos GeGCModelParameters with the classic liquid-vapor\nUNIFAC parameters. Examples use yaeos__models_ge_group_contribution_unifac_parameters , only : UNIFACParameters use yaeos__models_ge_group_contribution_model_parameters , only : GeGCModelParameters type ( GeGCModelParameters ) :: parameters parameters = UNIFACParameters () ! Get the maingroups i:1, j:7 interaction parameter aij (CH2-H2O) print * , parameters % get_maingroups_aij ( 1 , 7 ) ! prints: 1318.0000 References Dortmund Data Bank Software & Separation Technology Fredenslund, A., Jones, R. L., & Prausnitz, J. M. (1975).\nGroup‐contribution estimation of activity coefficients in nonideal liquid\nmixtures. AIChE Journal, 21(6), 1086–1099. https://doi.org/10.1002/aic.690210607 Skjold-Jorgensen, S., Kolbe, B., Gmehling, J., & Rasmussen, P. (1979).\nVapor-Liquid Equilibria by UNIFAC Group Contribution. Revision and\nExtension. Industrial & Engineering Chemistry Process Design and\nDevelopment, 18(4), 714–722. https://doi.org/10.1021/i260072a024 Gmehling, J., Rasmussen, P., & Fredenslund, A. (1982). Vapor-liquid\nequilibriums by UNIFAC group contribution. Revision and extension. 2.\nIndustrial & Engineering Chemistry Process Design and Development, 21(1),\n118–127. https://doi.org/10.1021/i200016a021 Macedo, E. A., Weidlich, U., Gmehling, J., & Rasmussen, P. (1983).\nVapor-liquid equilibriums by UNIFAC group contribution. Revision and\nextension. 3. Industrial & Engineering Chemistry Process Design and\nDevelopment, 22(4), 676–678. https://doi.org/10.1021/i200023a023 Tiegs, D., Rasmussen, P., Gmehling, J., & Fredenslund, A. (1987).\nVapor-liquid equilibria by UNIFAC group contribution. 4. Revision and\nextension. Industrial & Engineering Chemistry Research, 26(1), 159–161. https://doi.org/10.1021/ie00061a030 Hansen, H. K., Rasmussen, P., Fredenslund, A., Schiller, M., &\nGmehling, J. (1991). Vapor-liquid equilibria by UNIFAC group\ncontribution. 5. Revision and extension. Industrial & Engineering\nChemistry Research, 30 (10), 2352–2355. https://doi.org/10.1021/ie00058a017 Wittig, R., Lohmann, J., & Gmehling, J. (2003). Vapor−Liquid Equilibria\nby UNIFAC Group Contribution. 6. Revision and Extension. Industrial &\nEngineering Chemistry Research, 42(1), 183–188. https://doi.org/10.1021/ie020506l Uses yaeos__constants yaeos__models_ge_group_contribution_model_parameters Functions public function UNIFACParameters () UNIFAC parameters Read more… Arguments None Return Value type( GeGCModelParameters )","tags":"","loc":"module/yaeos__models_ge_group_contribution_unifac_parameters.html"},{"title":"yaeos__fitting_fit_nrtl_mhv – yaeos","text":"Uses forsus yaeos__constants yaeos__fitting yaeos__models Variables Type Visibility Attributes Name Initial integer, public, parameter :: nc = 2 Derived Types type, public, extends( FittingProblem ) :: FitMHVNRTL Components Type Visibility Attributes Name Initial type( EquilibriumState ), public, allocatable :: experimental_points (:) Experimental points to fit logical, public :: fit_lij = .false. logical, public :: fit_nrtl = .false. class( ArModel ), public, allocatable :: model Residual Helmholtz Model to fit logical, public :: verbose = .false. If true log the fitting process Type-Bound Procedures procedure, public :: get_model_from_X => model_from_X Subroutines public subroutine model_from_X (problem, X) Arguments Type Intent Optional Attributes Name class( FitMHVNRTL ), intent(inout) :: problem real(kind=pr), intent(in) :: X (:)","tags":"","loc":"module/yaeos__fitting_fit_nrtl_mhv.html"},{"title":"yaeos__equilibria_rachford_rice – yaeos","text":"Uses yaeos__constants Subroutines public subroutine betalimits (z, K, bmin, bmax) Define beta limits to avoid overshooting when solving the Rachford-Rice\nequation. Read more… Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: z (:) Molar fractions vector real(kind=pr), intent(in) :: K (:) K-factors real(kind=pr), intent(out) :: bmin Minimum beta value real(kind=pr), intent(out) :: bmax Maximum beta value public subroutine betato01 (z, K) Modify K-factor values to assure that lies between (0,1) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: z (:) Molar fractions of the system real(kind=pr) :: K (:) K factors public subroutine rachford_rice (z, K, beta, rr, drrdb) Rachford-Rice equation for a two phase system Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: z (:) real(kind=pr), intent(in) :: K (:) real(kind=pr), intent(in) :: beta real(kind=pr), intent(out) :: rr real(kind=pr), intent(out) :: drrdb public subroutine solve_rr (z, K, beta, beta_min, beta_max) Solve the Rachford-Rice Equation. Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: z (:) Mole fractions vector real(kind=pr), intent(in) :: K (:) K-factors real(kind=pr), intent(out) :: beta value real(kind=pr), intent(out) :: beta_min Lower limit for real(kind=pr), intent(out) :: beta_max Upper limit for","tags":"","loc":"module/yaeos__equilibria_rachford_rice.html"},{"title":"yaeos__fitting_fit_kij_lij – yaeos","text":"Binary interaction parameters fitting problem. Uses yaeos__fitting Variables Type Visibility Attributes Name Initial integer, public, parameter :: nc = 2 Derived Types type, public, extends( FittingProblem ) :: FitKijLij Fit the binary interaction parameters of a mixtures. Read more… Components Type Visibility Attributes Name Initial type( EquilibriumState ), public, allocatable :: experimental_points (:) Experimental points to fit logical, public :: fit_kij = .false. Fit the parameter logical, public :: fit_lij = .false. Fit the parameter class( ArModel ), public, allocatable :: model Residual Helmholtz Model to fit logical, public :: verbose = .false. If true log the fitting process Type-Bound Procedures procedure, public :: get_model_from_X => model_from_X Subroutines public subroutine model_from_X (problem, X) Arguments Type Intent Optional Attributes Name class( FitKijLij ), intent(inout) :: problem real(kind=pr), intent(in) :: X (:)","tags":"","loc":"module/yaeos__fitting_fit_kij_lij.html"},{"title":"legacy_ar_models – yaeos","text":"Legacy Thermodynamic routines\nModule for a cubic eos system, made with the intention to keep\ncompatiblity with legacy codes but with a better structure.\nthis should be later adapted into a simple oop system where an eos object\nstores the relevant parameters (or some functional oriented approach) Uses yaeos__constants ar_interface Variables Type Visibility Attributes Name Initial real(kind=pr), public, allocatable :: ac (:) Critical attractive parameter [bar (L/mol)^2] real(kind=pr), public, allocatable :: b (:) repulsive parameter [L] real(kind=pr), public, allocatable :: bij (:,:) real(kind=pr), public, allocatable :: dc (:) Critical density [mol/L] real(kind=pr), public, allocatable :: del1 (:) parameter real(kind=pr), public, allocatable :: k (:) Attractive parameter constant real(kind=pr), public, allocatable :: kij (:,:) Attractive BIP real(kind=pr), public, allocatable :: kij0 (:,:) real(kind=pr), public, allocatable :: kinf (:,:) real(kind=pr), public, allocatable :: lij (:,:) Repulsive BIP integer, public :: mixing_rule What mixing rule to use integer, public :: nc Number of components real(kind=pr), public, allocatable :: pc (:) Critical pressure [bar] real(kind=pr), public, allocatable :: tc (:) Critical temperature [K] integer, public :: tdep Temperature dependance of kij integer, public :: thermo_model Which thermodynamic model to use real(kind=pr), public, allocatable :: tstar (:,:) real(kind=pr), public, allocatable :: w (:) Acentric factor real(kind=pr), public, allocatable :: z (:) Mole fractions vector Functions public function cubic_v0 (z, p, t) Arguments Type Intent Optional Attributes Name real(kind=pr) :: z (:) real(kind=pr) :: p real(kind=pr) :: t Return Value real(kind=pr) Subroutines public subroutine ArVnder (nc, nder, ntemp, z, V, T, ar, arv, artv, arv2, Arn, ArVn, ArTn, Arn2) Arguments Type Intent Optional Attributes Name integer, intent(in) :: nc integer, intent(in) :: nder integer, intent(in) :: ntemp real(kind=pr), intent(in) :: z (nc) real(kind=pr), intent(in) :: V real(kind=pr), intent(in) :: T real(kind=pr), intent(out) :: ar real(kind=pr), intent(out) :: arv real(kind=pr), intent(out) :: artv real(kind=pr), intent(out) :: arv2 real(kind=pr), intent(out), dimension(size(z)) :: Arn real(kind=pr), intent(out), dimension(size(z)) :: ArVn real(kind=pr), intent(out), dimension(size(z)) :: ArTn real(kind=pr), intent(out) :: Arn2 (size(z),size(z)) public subroutine Bnder (nc, rn, Bmix, dBi, dBij) Arguments Type Intent Optional Attributes Name integer, intent(in) :: nc real(kind=pr), intent(in) :: rn (nc) real(kind=pr), intent(out) :: Bmix real(kind=pr), intent(out) :: dBi (nc) real(kind=pr), intent(out) :: dBij (nc,nc) public subroutine DELTAnder (nc, rn, D1m, dD1i, dD1ij) Arguments Type Intent Optional Attributes Name integer, intent(in) :: nc real(kind=pr), intent(in) :: rn (nc) real(kind=pr), intent(out) :: D1m real(kind=pr), intent(out) :: dD1i (nc) real(kind=pr), intent(out) :: dD1ij (nc,nc) public subroutine DandTnder (ntd, nc, T, rn, D, dDi, dDiT, dDij, dDdT, dDdT2) Arguments Type Intent Optional Attributes Name integer, intent(in) :: ntd integer, intent(in) :: nc real(kind=pr), intent(in) :: T real(kind=pr), intent(in) :: rn (nc) real(kind=pr), intent(out) :: D real(kind=pr), intent(out) :: dDi (nc) real(kind=pr), intent(out) :: dDiT (nc) real(kind=pr), intent(out) :: dDij (nc,nc) real(kind=pr), intent(out) :: dDdT real(kind=pr), intent(out) :: dDdT2 public subroutine HelmRKPR (nco, NDE, NTD, rn, V, T, Ar, ArV, ArTV, ArV2, Arn, ArVn, ArTn, Arn2) Calculate the reduced residual Helmholtz Energy and it’s derivatives with the RKPR EOS Arguments Type Intent Optional Attributes Name integer, intent(in) :: nco integer, intent(in) :: NDE integer, intent(in) :: NTD real(kind=pr), intent(in) :: rn (nco) real(kind=pr), intent(in) :: V real(kind=pr), intent(in) :: T real(kind=pr), intent(out) :: Ar real(kind=pr), intent(out) :: ArV real(kind=pr), intent(out) :: ArTV real(kind=pr), intent(out) :: ArV2 real(kind=pr), intent(out) :: Arn (nco) real(kind=pr), intent(out) :: ArVn (nco) real(kind=pr), intent(out) :: ArTn (nco) real(kind=pr), intent(out) :: Arn2 (nco,nco) public subroutine HelmSRKPR (nc, nd, nt, rn, v, t, ar, arv, artv, arv2, Arn, ArVn, ArTn, Arn2) Arguments Type Intent Optional Attributes Name integer, intent(in) :: nc Number of components integer, intent(in) :: nd Compositional derivatives integer, intent(in) :: nt Temperature derivatives real(kind=pr), intent(in) :: rn (nc) Number of moles real(kind=pr), intent(in) :: v Volume [L] real(kind=pr), intent(in) :: t Temperature [K] real(kind=pr), intent(out) :: ar Residual Helmholtz real(kind=pr), intent(out) :: arv dAr/dV real(kind=pr), intent(out) :: artv dAr2/dTV real(kind=pr), intent(out) :: arv2 dAr2/dV2 real(kind=pr), intent(out) :: Arn (nc) dAr/dn real(kind=pr), intent(out) :: ArVn (nc) dAr2/dVn real(kind=pr), intent(out) :: ArTn (nc) dAr2/dTn real(kind=pr), intent(out) :: Arn2 (nc,nc) dAr2/dn2 public subroutine PR76_factory (moles_in, ac_in, b_in, tc_in, pc_in, w_in, k_in) PengRobinson 76 factory Read more… Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: moles_in (nc) real(kind=pr), intent(in), optional :: ac_in (nc) real(kind=pr), intent(in), optional :: b_in (nc) real(kind=pr), intent(in), optional :: tc_in (nc) real(kind=pr), intent(in), optional :: pc_in (nc) real(kind=pr), intent(in), optional :: w_in (nc) real(kind=pr), intent(in), optional :: k_in (nc) public subroutine PR78_factory (moles_in, ac_in, b_in, tc_in, pc_in, w_in, k_in) PengRobinson 78 factory Read more… Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: moles_in (nc) real(kind=pr), intent(in), optional :: ac_in (nc) real(kind=pr), intent(in), optional :: b_in (nc) real(kind=pr), intent(in), optional :: tc_in (nc) real(kind=pr), intent(in), optional :: pc_in (nc) real(kind=pr), intent(in), optional :: w_in (nc) real(kind=pr), intent(in), optional :: k_in (nc) public subroutine SRK_factory (moles_in, ac_in, b_in, tc_in, pc_in, w_in, k_in) SoaveRedlichKwong factory Read more… Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: moles_in (nc) real(kind=pr), intent(in), optional :: ac_in (nc) real(kind=pr), intent(in), optional :: b_in (nc) real(kind=pr), intent(in), optional :: tc_in (nc) real(kind=pr), intent(in), optional :: pc_in (nc) real(kind=pr), intent(in), optional :: w_in (nc) real(kind=pr), intent(in), optional :: k_in (nc) public subroutine aTder (ac, Tc, k, T, a, dadT, dadT2) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: ac real(kind=pr), intent(in) :: Tc real(kind=pr), intent(in) :: k real(kind=pr), intent(in) :: T real(kind=pr), intent(out) :: a real(kind=pr), intent(out) :: dadT real(kind=pr), intent(out) :: dadT2 public subroutine aijTder (ntd, nc, T, aij, daijdT, daijdT2) Arguments Type Intent Optional Attributes Name integer, intent(in) :: ntd integer, intent(in) :: nc real(kind=pr), intent(in) :: T real(kind=pr), intent(out) :: aij (nc,nc) real(kind=pr), intent(out) :: daijdT (nc,nc) real(kind=pr), intent(out) :: daijdT2 (nc,nc) public subroutine ar_rkpr (z, v, t, ar, arv, artv, arv2, Arn, ArVn, ArTn, Arn2) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: z (:) Number of moles real(kind=pr), intent(in) :: v Volume [L] real(kind=pr), intent(in) :: t Temperature [K] real(kind=pr), intent(out) :: ar Residual Helmholtz real(kind=pr), intent(out) :: arv dAr/dV real(kind=pr), intent(out) :: artv dAr2/dTV real(kind=pr), intent(out) :: arv2 dAr2/dV2 real(kind=pr), intent(out) :: Arn (size(z)) dAr/dn real(kind=pr), intent(out) :: ArVn (size(z)) dAr2/dVn real(kind=pr), intent(out) :: ArTn (size(z)) dAr2/dTn real(kind=pr), intent(out) :: Arn2 (size(z),size(z)) dAr2/dn2 public subroutine ar_srkpr (z, v, t, ar, arv, artv, arv2, Arn, ArVn, ArTn, Arn2) Wrapper subroutine to the SRK/PR Residula Helmholtz function to\nuse the general interface Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: z (:) Number of moles real(kind=pr), intent(in) :: v Volume [L] real(kind=pr), intent(in) :: t Temperature [K] real(kind=pr), intent(out) :: ar Residual Helmholtz real(kind=pr), intent(out) :: arv dAr/dV real(kind=pr), intent(out) :: artv dAr2/dTV real(kind=pr), intent(out) :: arv2 dAr2/dV2 real(kind=pr), intent(out) :: Arn (size(z)) dAr/dn real(kind=pr), intent(out) :: ArVn (size(z)) dAr2/dVn real(kind=pr), intent(out) :: ArTn (size(z)) dAr2/dTn real(kind=pr), intent(out) :: Arn2 (size(z),size(z)) dAr2/dn2 public subroutine get_Zc_OMa_OMb (del1, Zc, OMa, OMb) Calculate Zc, OMa and OMb from the delta_1 parameter. Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: del1 (:) delta_1 parameter real(kind=pr), intent(out) :: Zc (:) Critical compressibility factor real(kind=pr), intent(out) :: OMa (:) OMa real(kind=pr), intent(out) :: OMb (:) OMb public subroutine setup (n, nmodel, ntdep, ncomb) Setup the basics variables that describe the model. Arguments Type Intent Optional Attributes Name integer, intent(in) :: n Number of components integer, intent(in) :: nmodel Number of model integer, intent(in) :: ntdep Kij dependant of temperature integer, intent(in) :: ncomb Combining rule","tags":"","loc":"module/legacy_ar_models.html"},{"title":"legacy_thermo_properties – yaeos","text":"Uses legacy_ar_models yaeos__constants Subroutines public subroutine PUREFUG_CALC (nc, icomp, T, P, V, phi) Fugacity of a pure component Arguments Type Intent Optional Attributes Name integer, intent(in) :: nc integer, intent(in) :: icomp real(kind=pr), intent(in) :: T real(kind=pr), intent(in) :: P real(kind=pr), intent(in) :: V real(kind=pr), intent(out) :: phi public subroutine TERMO (nc, mtyp, indic, t, p, rn, v, PHILOG, DLPHIP, DLPHIT, FUGN) Arguments Type Intent Optional Attributes Name integer, intent(in) :: nc Number of components integer, intent(in) :: mtyp Type of root desired (-1 vapor, 1 liquid, 0 lower Gr) integer, intent(in) :: indic Desired element, this should be setted with optionals real(kind=pr), intent(in) :: t Temperature [K] real(kind=pr), intent(in) :: p Pressure [bar] real(kind=pr), intent(in) :: rn (nc) Mixture mole numbers real(kind=pr), intent(out) :: v Volume [L] real(kind=pr), intent(out) :: PHILOG (nc) ln(phi*p) vector real(kind=pr), intent(out), optional :: DLPHIP (nc) ln(phi) Presssure derivative real(kind=pr), intent(out), optional :: DLPHIT (nc) ln(phi) Temp derivative real(kind=pr), intent(out), optional :: FUGN (nc,nc) ln(phi) compositional derivative public recursive subroutine VCALC (ITYP, nc, ntemp, rn, T, P, V) ROUTINE FOR CALCULATION OF VOLUME, GIVEN PRESSURE Arguments Type Intent Optional Attributes Name integer, intent(in) :: ITYP TYPE OF ROOT DESIRED (-1 vapor, 1 liquid, 0 lower Gibbs energy phase) integer, intent(in) :: nc NO. OF COMPONENTS integer, intent(in) :: ntemp 1 if T-derivatives are required real(kind=pr), intent(in) :: rn (nc) FEED MOELS real(kind=pr), intent(in) :: T TEMPERATURE real(kind=pr), intent(in) :: P PRESURE real(kind=pr), intent(out) :: V VOLUME public subroutine zTVTERMO (nc, indic, t, rn, v, p, dpv, PHILOG, DLPHIP, DLPHIT, FUGN) Calculation of lnphi P and derivatives\n rn mixture mole numbers (input)\n t temperature (k) (input)\n v volume (L) (input)\n p pressure (bar) (output)\n PHILOG vector of ln(phi(i) P) (output) 0 < INDIC < 5\n DLPHIT t-derivative of ln(phi(i)) (const P, n) (output) 0 < INDIC = 2 or 4\n DLPHIP P-derivative of ln(phi(i)) (const T, n) (output) 0 < INDIC < 5\n FUGN comp-derivative of ln(phi(i)) (const t & P)(output) 2 < INDIC Read more… Arguments Type Intent Optional Attributes Name integer, intent(in) :: nc integer, intent(in) :: indic real(kind=pr), intent(in) :: t real(kind=pr), intent(in) :: rn (nc) real(kind=pr), intent(in) :: v real(kind=pr), intent(out) :: p real(kind=pr), intent(out) :: dpv real(kind=pr), intent(out) :: PHILOG (nc) real(kind=pr), intent(out) :: DLPHIP (nc) real(kind=pr), intent(out) :: DLPHIT (nc) real(kind=pr), intent(out) :: FUGN (nc,nc)","tags":"","loc":"module/legacy_thermo_properties.html"},{"title":"yaeos__models_cubic_mixing_rules_huron_vidal – yaeos","text":"Huron-Vidal (like) mixing rules module This module contains the mixing rules that are based/similar to the \nmixing rules defined by Huron-Vidal Description Huron-Vidal presented a way to link a model with a Cubic EoS\nmixing rule. This makes it possible to make good predictions on \npolar compounds containing mixtures. Examples A basic code example References Uses yaeos__models_ar_genericcubic yaeos__constants yaeos__models_ge yaeos__models_ar_cubic_mixing_base Interfaces public interface MHV private function init (Ge, b, q, lij) result(mixrule) Arguments Type Intent Optional Attributes Name class( GeModel ), intent(in) :: Ge real(kind=pr), intent(in) :: b (:) real(kind=pr), intent(in) :: q real(kind=pr), intent(in), optional :: lij (:,:) Return Value type( MHV ) Derived Types type, public, extends( CubicMixRule ) :: MHV Mixing rule at zero-pressure which allows for the inclusion of an\nexcess-gibbs model. Read more… Components Type Visibility Attributes Name Initial class( GeModel ), public, allocatable :: ge real(kind=pr), public, allocatable :: l (:,:) real(kind=pr), public :: q real(kind=pr), private, allocatable :: B real(kind=pr), private, allocatable :: bi (:) real(kind=pr), private, allocatable :: dBi (:) real(kind=pr), private, allocatable :: dBij (:,:) Constructor private\n\n \n function init (Ge, b, q, lij) Type-Bound Procedures procedure, public :: Bmix => BmixMHV procedure, public :: D1Mix => D1MixMHV procedure, public :: Dmix => DmixMHV Functions private function init (Ge, b, q, lij) result(mixrule) Arguments Type Intent Optional Attributes Name class( GeModel ), intent(in) :: Ge real(kind=pr), intent(in) :: b (:) real(kind=pr), intent(in) :: q real(kind=pr), intent(in), optional :: lij (:,:) Return Value type( MHV ) Subroutines public subroutine DmixMHV (self, n, T, ai, daidt, daidt2, D, dDdT, dDdT2, dDi, dDidT, dDij) Mixing rule at infinite pressure as defined in the book of Michelsen and\nMøllerup. Read more… Arguments Type Intent Optional Attributes Name class( MHV ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: T real(kind=pr), intent(in) :: ai (:) real(kind=pr), intent(in) :: daidt (:) real(kind=pr), intent(in) :: daidt2 (:) real(kind=pr), intent(out) :: D real(kind=pr), intent(out) :: dDdT real(kind=pr), intent(out) :: dDdT2 real(kind=pr), intent(out) :: dDi (:) real(kind=pr), intent(out) :: dDidT (:) real(kind=pr), intent(out) :: dDij (:,:) private subroutine BmixMHV (self, n, bi, B, dBi, dBij) Quadratinc mixing rule for the repulsive parameter, using as a combining rule. Read more… Arguments Type Intent Optional Attributes Name class( MHV ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: bi (:) real(kind=pr), intent(out) :: B real(kind=pr), intent(out) :: dBi (:) real(kind=pr), intent(out) :: dBij (:,:) private subroutine D1MixMHV (self, n, d1i, D1, dD1i, dD1ij) Arguments Type Intent Optional Attributes Name class( MHV ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: d1i (:) real(kind=pr), intent(out) :: D1 real(kind=pr), intent(out) :: dD1i (:) real(kind=pr), intent(out) :: dD1ij (:,:)","tags":"","loc":"module/yaeos__models_cubic_mixing_rules_huron_vidal.html"},{"title":"yaeos__constants – yaeos","text":"Constants used on the whole package Uses iso_fortran_env Variables Type Visibility Attributes Name Initial real(kind=pr), public, parameter :: NOT_IMPLEMENTED = huge(R) real(kind=pr), public, parameter :: R = 0.08314462618_pr Ideal Gas constant character(len=254), public :: database_path = \"database\" Path to find database character(len=1), public :: path_sep = \"/\" File separator (to preprocess on Win or Mac/linux) integer, public, parameter :: pr = real64 Used precision","tags":"","loc":"module/yaeos__constants.html"},{"title":"yaeos__models_solvers – yaeos","text":"models solvers Set of different specialized solvers for different models Description This module holds specialized solvers for different kind of applications\nand models. Volume solving This module holds the routine volume_michelsen which is a solver for\nvolume that takes advantage over a simple newton on the function of\npressure by solving the function of pressure over the covolume instead,\nwhich solution is limited in the range [0, 1]. This solver requires that\nthe EoS uses the method get_v0 to return the covolume. Examples A basic code example References Uses yaeos__constants yaeos__models_ar Subroutines public subroutine volume_michelsen (eos, n, P, T, V, root_type, max_iters, V0) Volume solver at a given pressure. Read more… Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos real(kind=pr), intent(in) :: n (:) Mixture moles real(kind=pr), intent(in) :: P Pressure [bar] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out) :: V Volume [L] character(len=*), intent(in), optional :: root_type Type of root [“vapor” | “liquid” | “stable”] integer, intent(in), optional :: max_iters Maxiumum number of iterations, defaults to 100 real(kind=pr), intent(in), optional :: V0 Specified initial volume","tags":"","loc":"module/yaeos__models_solvers.html"},{"title":"yaeos__equilibria_flash – yaeos","text":"Uses yaeos__constants yaeos__equilibria_equilibrium_state yaeos__solvers_pressure_equality yaeos__equilibria_auxiliar yaeos__equilibria_rachford_rice yaeos__models Functions public function flash (model, z, t, v_spec, p_spec, k0, iters) Flash algorithm using sucessive substitutions. Read more… Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: model Thermodynamic model real(kind=pr), intent(in) :: z (:) Global composition (molar fractions) real(kind=pr), intent(in) :: t Temperature [K] real(kind=pr), intent(in), optional :: v_spec Specified Volume [L/mol] real(kind=pr), intent(in), optional :: p_spec Specified Pressure [bar] real(kind=pr), intent(in), optional :: k0 (:) Initial K factors (y/x) integer, intent(out), optional :: iters Number of iterations Return Value type( EquilibriumState )","tags":"","loc":"module/yaeos__equilibria_flash.html"},{"title":"yaeos__models_ar_cubic_alphas – yaeos","text":"functions defined in the library. Uses yaeos__models_ar_genericcubic yaeos__constants yaeos__substance Derived Types type, public, extends( AlphaFunction ) :: AlphaRKPR RKPR function Components Type Visibility Attributes Name Initial real(kind=pr), public, allocatable :: k (:) parameter. Type-Bound Procedures procedure, public :: alpha => alpha_rkpr type, public, extends( AlphaFunction ) :: AlphaSoave Soave function. Components Type Visibility Attributes Name Initial real(kind=pr), public, allocatable :: k (:) parameter. Type-Bound Procedures procedure, public :: alpha ../../../ Alpha function Subroutines public subroutine alpha (self, Tr, a, dadt, dadt2) Soave function and it’s derivatives. Arguments Type Intent Optional Attributes Name class( AlphaSoave ), intent(in) :: self real(kind=pr), intent(in) :: Tr (:) Reduced temperature real(kind=pr), intent(out) :: a (:) real(kind=pr), intent(out) :: dadt (:) real(kind=pr), intent(out) :: dadt2 (:) public subroutine alpha_rkpr (self, Tr, a, dadt, dadt2) Arguments Type Intent Optional Attributes Name class( AlphaRKPR ), intent(in) :: self real(kind=pr), intent(in) :: Tr (:) Reduced temperature real(kind=pr), intent(out) :: a (:) real(kind=pr), intent(out) :: dadt (:) real(kind=pr), intent(out) :: dadt2 (:)","tags":"","loc":"module/yaeos__models_ar_cubic_alphas.html"},{"title":"yaeos__models_ar_cubic_quadratic_mixing – yaeos","text":"Quadratic Mixing Rules for Cubic EoS. Uses yaeos__models_ar_genericcubic yaeos__constants yaeos__models_ar_cubic_mixing_base yaeos__substance Abstract Interfaces abstract interface public subroutine get_aij(self, T, ai, daidt, daidt2, aij, daijdt, daijdt2) Combining rule for the attractive parameter. From previously calculated attractive parameters calculate the matrix and it’s corresponding derivatives. Arguments Type Intent Optional Attributes Name class( QMR ), intent(in) :: self real(kind=pr), intent(in) :: T real(kind=pr), intent(in) :: ai (:) real(kind=pr), intent(in) :: daidt (:) real(kind=pr), intent(in) :: daidt2 (:) real(kind=pr), intent(out) :: aij (:,:) real(kind=pr), intent(out) :: daijdt (:,:) real(kind=pr), intent(out) :: daijdt2 (:,:) Derived Types type, public, extends( CubicMixRule ) :: QMR Quadratic Mixing Rule (QMR) derived type. Classic Van der Waals mixing\nrules. Read more… Components Type Visibility Attributes Name Initial procedure( get_aij ), public, pointer :: aij => null() Procedure to calculate matrix. Can be overloaded\nby any method that respets the interface get_aij . real(kind=pr), public, allocatable :: k (:,:) Attractive Binary Interatction parameter matrix real(kind=pr), public, allocatable :: l (:,:) Repulsive Binary Interatction parameter matrix Type-Bound Procedures procedure, public :: Bmix ../../../ Repulsive parameter mixing rule procedure, public :: D1mix => D1mix_constant procedure, public :: Dmix ../../../ Attractive parameter mixing rule type, public, extends( QMR ) :: QMR_RKPR Components Type Visibility Attributes Name Initial procedure( get_aij ), public, pointer :: aij => null() Procedure to calculate matrix. Can be overloaded\nby any method that respets the interface get_aij . real(kind=pr), public, allocatable :: k (:,:) Attractive Binary Interatction parameter matrix real(kind=pr), public, allocatable :: l (:,:) Repulsive Binary Interatction parameter matrix Type-Bound Procedures procedure, public :: Bmix ../../../ Repulsive parameter mixing rule procedure, public :: D1Mix => RKPR_D1mix procedure, public :: Dmix ../../../ Attractive parameter mixing rule Subroutines public subroutine Bmix (self, n, bi, B, dBi, dBij) Mixture repulsive parameter. Read more… Arguments Type Intent Optional Attributes Name class( QMR ), intent(in) :: self Mixing rule object. real(kind=pr), intent(in) :: n (:) Moles vector. real(kind=pr), intent(in) :: bi (:) Pure components repulsive parameters. real(kind=pr), intent(out) :: B Mixture repulsive parameter. real(kind=pr), intent(out) :: dBi (:) real(kind=pr), intent(out) :: dBij (:,:) public subroutine D1mix_constant (self, n, d1i, D1, dD1i, dD1ij) Constant parameter. Read more… Arguments Type Intent Optional Attributes Name class( QMR ), intent(in) :: self Mixing rule real(kind=pr), intent(in) :: n (:) Moles vector real(kind=pr), intent(in) :: d1i (:) parameter real(kind=pr), intent(out) :: D1 Mixture’s real(kind=pr), intent(out) :: dD1i (:) real(kind=pr), intent(out) :: dD1ij (:,:) public subroutine Dmix (self, n, T, ai, daidt, daidt2, D, dDdT, dDdT2, dDi, dDidT, dDij) Attractive parameter mixing rule with quadratic mix. Read more… Arguments Type Intent Optional Attributes Name class( QMR ), intent(in) :: self Mixing rule object. real(kind=pr), intent(in) :: n (:) Moles vector [mol] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(in) :: ai (:) Pure components attractive parameters real(kind=pr), intent(in) :: daidt (:) real(kind=pr), intent(in) :: daidt2 (:) real(kind=pr), intent(out) :: D Mixture attractive parameter real(kind=pr), intent(out) :: dDdT real(kind=pr), intent(out) :: dDdT2 real(kind=pr), intent(out) :: dDi (:) real(kind=pr), intent(out) :: dDidT (:) real(kind=pr), intent(out) :: dDij (:,:) public subroutine RKPR_D1mix (self, n, d1i, D1, dD1i, dD1ij) RKPR parameter mixing rule. Read more… Arguments Type Intent Optional Attributes Name class( QMR_RKPR ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: d1i (:) real(kind=pr), intent(out) :: D1 real(kind=pr), intent(out) :: dD1i (:) real(kind=pr), intent(out) :: dD1ij (:,:) public subroutine kij_constant (self, T, a, dadt, dadt2, aij, daijdt, daijdt2) Combining rule that uses constant values. Read more… Arguments Type Intent Optional Attributes Name class( QMR ), intent(in) :: self real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(in) :: a (:) Pure components attractive parameters (\\a_i) real(kind=pr), intent(in) :: dadt (:) real(kind=pr), intent(in) :: dadt2 (:) real(kind=pr), intent(out) :: aij (:,:) Matrix real(kind=pr), intent(out) :: daijdt (:,:) real(kind=pr), intent(out) :: daijdt2 (:,:)","tags":"","loc":"module/yaeos__models_ar_cubic_quadratic_mixing.html"},{"title":"yaeos__models_ar_cubic_implementations – yaeos","text":"Implemented Cubic Equations of State. PengRobinson76 PengRobinson78 SoaveRedlichKwong RKPR Uses yaeos__models_ar_genericcubic yaeos__constants yaeos__substance Functions public function PengRobinson76 (tc, pc, w, kij, lij) result(model) PengRobinson76. Read more… Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: tc (:) Critical Temperatures [K] real(kind=pr), intent(in) :: pc (:) Critical Pressures [bar] real(kind=pr), intent(in) :: w (:) Acentric Factors real(kind=pr), intent(in), optional :: kij (:,:) matrix real(kind=pr), intent(in), optional :: lij (:,:) matrix Return Value type( CubicEoS ) public function PengRobinson78 (tc, pc, w, kij, lij) result(model) PengRobinson78. Read more… Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: tc (:) Critical Temperatures [K] real(kind=pr), intent(in) :: pc (:) Critical Pressures [bar] real(kind=pr), intent(in) :: w (:) Acentric Factors real(kind=pr), intent(in), optional :: kij (:,:) matrix real(kind=pr), intent(in), optional :: lij (:,:) matrix Return Value type( CubicEoS ) public function RKPR (tc, pc, w, zc, kij, lij, delta_1, k) result(model) RKPR Equation of State Read more… Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: tc (:) Critical Temperature [K] real(kind=pr), intent(in) :: pc (:) Critical Pressure [bar] real(kind=pr), intent(in) :: w (:) Acentric Factor real(kind=pr), intent(in) :: zc (:) Critical compressibility real(kind=pr), intent(in), optional :: kij (:,:) k_{ij} matrix real(kind=pr), intent(in), optional :: lij (:,:) l_{ij} matrix real(kind=pr), intent(in), optional :: delta_1 (:) real(kind=pr), intent(in), optional :: k (:) Return Value type( CubicEoS ) public function SoaveRedlichKwong (tc, pc, w, kij, lij) result(model) SoaveRedlichKwong. Read more… Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: tc (:) Critical temperature [K] real(kind=pr), intent(in) :: pc (:) Critical pressure [bar] real(kind=pr), intent(in) :: w (:) Acentric factor real(kind=pr), intent(in), optional :: kij (:,:) matrix real(kind=pr), intent(in), optional :: lij (:,:) matrix Return Value type( CubicEoS ) Subroutines private subroutine get_OMa_OMb (del1, OMa, OMb) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: del1 (:) real(kind=pr), intent(out) :: OMa (size(del1)) real(kind=pr), intent(out) :: OMb (size(del1))","tags":"","loc":"module/yaeos__models_ar_cubic_implementations.html"},{"title":"yaeos__tapenade_ge_api – yaeos","text":"Module that wraps tapenade generated routines to calculate !\nGe and derivatives. Uses yaeos__constants yaeos__models_ge Abstract Interfaces abstract interface private subroutine tapenade_ge(model, n, t, ge) Arguments Type Intent Optional Attributes Name class( GeModelTapenade ) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: t real(kind=pr), intent(out) :: ge abstract interface private subroutine tapenade_ge_b(model, n, nb, t, tb, ge, geb) Arguments Type Intent Optional Attributes Name class( GeModelTapenade ) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr) :: nb (:) real(kind=pr), intent(in) :: t real(kind=pr) :: tb real(kind=pr) :: ge real(kind=pr) :: geb abstract interface private subroutine tapenade_ge_d(model, n, nd, t, td, ge, ged) Arguments Type Intent Optional Attributes Name class( GeModelTapenade ) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: nd (:) real(kind=pr), intent(in) :: t real(kind=pr), intent(in) :: td real(kind=pr), intent(out) :: ge real(kind=pr), intent(out) :: ged abstract interface private subroutine tapenade_ge_d_b(model, n, nb, nd, ndb, t, tb, td, tdb, ge, geb, ged, gedb) Arguments Type Intent Optional Attributes Name class( GeModelTapenade ) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr) :: nb (:) real(kind=pr), intent(in) :: nd (:) real(kind=pr) :: ndb (:) real(kind=pr), intent(in) :: t real(kind=pr) :: tb real(kind=pr), intent(in) :: td real(kind=pr) :: tdb real(kind=pr) :: ge real(kind=pr) :: geb real(kind=pr) :: ged real(kind=pr) :: gedb abstract interface private subroutine tapenade_ge_d_d(model, n, nd, t, td0, td, ge, ged0, ged, gedd) Arguments Type Intent Optional Attributes Name class( GeModelTapenade ) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: nd (:) real(kind=pr), intent(in) :: t real(kind=pr), intent(in) :: td0 real(kind=pr), intent(in) :: td real(kind=pr), intent(out) :: ge real(kind=pr), intent(out) :: ged0 real(kind=pr), intent(out) :: ged real(kind=pr), intent(out) :: gedd Derived Types type, public, abstract, extends( GeModel ) :: GeModelTapenade Components Type Visibility Attributes Name Initial type( Substances ), public :: components Substances contained in the module Type-Bound Procedures procedure, public :: excess_gibbs procedure( tapenade_ge ), public, deferred :: ge procedure( tapenade_ge_b ), public, deferred :: ge_b procedure( tapenade_ge_d ), public, deferred :: ge_d procedure( tapenade_ge_d_b ), public, deferred :: ge_d_b procedure( tapenade_ge_d_d ), public, deferred :: ge_d_d procedure, public :: ln_activity_coefficient Subroutines private subroutine excess_gibbs (self, n, t, Ge, GeT, GeT2, Gen, GeTn, Gen2) Excess Gibbs model generic interface Arguments Type Intent Optional Attributes Name class( GeModelTapenade ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: t real(kind=pr), intent(out), optional :: Ge real(kind=pr), intent(out), optional :: GeT real(kind=pr), intent(out), optional :: GeT2 real(kind=pr), intent(out), optional, dimension(size(n)) :: Gen real(kind=pr), intent(out), optional, dimension(size(n)) :: GeTn real(kind=pr), intent(out), optional :: Gen2 (size(n),size(n))","tags":"","loc":"module/yaeos__tapenade_ge_api.html"},{"title":"yaeos__phase_equilibria_stability – yaeos","text":"Phase Stability module Phase stability related calculations. Description Contains the basics rotuines to make phase stability analysis for\nphase-equilibria detection. tpd(model, z, w, P, T) : reduced Tangent-Plane-Distance min_tpd(model, z, P, T, mintpd, w) : Find minimal tpd for a multicomponent mixture Examples ! Obtain the minimal tpd for a binary mixture at z_1 = 0.13 model = PengRobinson76 ( tc , pc , ac , kij , lij ) z = [ 0.13 , 1 - 0.13 ] w = [ 0.1 , 0.9 ] P = 4 5.6_pr T = 19 0._pr z = z / sum ( z ) ----------------------------------------------- References Thermodynamic Models: Fundamental and Computational Aspects, Michael L.\nMichelsen, Jørgen M. Mollerup. Tie-Line Publications, Denmark (2004) doi Uses yaeos__constants yaeos__models_ar Derived Types type, private :: TMOptimizeData Data structure to hold the data for the min_tpd optimization Components Type Visibility Attributes Name Initial real(kind=pr), public :: P real(kind=pr), public :: T real(kind=pr), public, allocatable :: di (:) class( ArModel ), public, pointer :: model real(kind=pr), public, allocatable :: z (:) Functions public function tm (model, z, w, P, T, d, dtpd) Michelsen’s modified function, . Read more… Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: model Thermodynamic model real(kind=pr), intent(in) :: z (:) Feed composition real(kind=pr), intent(in) :: w (:) Test-phase mole numbers vector real(kind=pr), intent(in) :: P Pressure [bar] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(in), optional :: d (:) vector real(kind=pr), intent(out), optional :: dtpd (:) Return Value real(kind=pr) Subroutines public subroutine min_tpd (model, z, P, T, mintpd, w, all_minima) Arguments Type Intent Optional Attributes Name class( ArModel ), target :: model Thermodynamic model real(kind=pr), intent(in) :: z (:) Feed composition real(kind=pr), intent(in) :: P Pressure [bar] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out) :: mintpd Minimal value of real(kind=pr), intent(out) :: w (:) Trial composition real(kind=pr), intent(out), optional :: all_minima (:,:) All the found minima public subroutine min_tpd_to_optimize (X, F, dF, data) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: X (:) real(kind=pr), intent(out) :: F real(kind=pr), intent(out), optional :: dF (:) class(*), intent(inout), optional :: data","tags":"","loc":"module/yaeos__phase_equilibria_stability.html"},{"title":"ADMM_TAPENADE_INTERFACE – yaeos","text":"Interfaces public interface ADMM_REBASE public subroutine ADMM_REBASE(base) bind(c, name='ADMM_rebase') Arguments Type Intent Optional Attributes Name type(C_PTR) :: base public interface ADMM_REBASESHADOWED public subroutine ADMM_REBASESHADOWED(base, baseb) bind(c, name= 'ADMM_rebaseShadowed') Arguments Type Intent Optional Attributes Name type(C_PTR) :: base type(C_PTR) :: baseb public interface ADMM_REGISTER public subroutine ADMM_REGISTER(base, obase, size, nbelem) bind(c, name= 'ADMM_register') Arguments Type Intent Optional Attributes Name type(C_PTR), VALUE :: base type(C_PTR), VALUE :: obase integer, VALUE :: size integer, VALUE :: nbelem public interface ADMM_REGISTERSHADOWED public subroutine ADMM_REGISTERSHADOWED(base, obase, size, baseb, obaseb, sizeb, nbelem) bind(c, name='ADMM_registerShadowed') Arguments Type Intent Optional Attributes Name type(C_PTR), VALUE :: base type(C_PTR), VALUE :: obase integer, VALUE :: size type(C_PTR), VALUE :: baseb type(C_PTR), VALUE :: obaseb integer, VALUE :: sizeb integer, VALUE :: nbelem public interface ADMM_UNREGISTER public subroutine ADMM_UNREGISTER(base, nbelem) bind(c, name= 'ADMM_unregister') Arguments Type Intent Optional Attributes Name type(C_PTR), VALUE :: base integer :: nbelem public interface ADMM_UNREGISTERSHADOWED public subroutine ADMM_UNREGISTERSHADOWED(base, baseb, nbelem) bind(c, name='ADMM_unregisterShadowed') Arguments Type Intent Optional Attributes Name type(C_PTR), VALUE :: base type(C_PTR), VALUE :: baseb integer :: nbelem public interface POPPOINTER8 public subroutine POPPOINTER8(pp) bind(c, name='popPointer8') Arguments Type Intent Optional Attributes Name type(C_PTR) :: pp public interface PUSHPOINTER8 public subroutine PUSHPOINTER8(pp) bind(c, name='pushPointer8') Arguments Type Intent Optional Attributes Name type(C_PTR), VALUE :: pp","tags":"","loc":"module/admm_tapenade_interface.html"},{"title":"yaeos__models – yaeos","text":"yaeos thermodynamic models On yaeos there are implemented a series of both residual Helmholtz\nenergy ( ) and excess Gibbs energy ( ) models. This module takes all the relevant procedures and derived types\nrelated to them. Residual Helmholtz model base type ArModel base derived type\n that provides the basic structure that a residual Helmholtz model\n should provide. Cubic Equations of state : AlphaFunction type CubicMixRule type CubicEos type that extends ArModel to use a generic\n two-parameter EoS. Implemented models that use this type can be\n seen at yaeos__models_ar_cubic_implementations QMR (Quadratic Mixing Rule) type: extensible derived type that \n defaults to classic vdW mixing rules. MHV (Modified Huron-Vidal) type: Michelsens first order modified\n Huron-Vidal mixing rule. Uses yaeos__models_ar yaeos__models_cubic_mixing_rules_huron_vidal yaeos__models_ge yaeos__models_ar_cubic_implementations yaeos__models_ge_implementations yaeos__models_ar_genericcubic yaeos__models_base yaeos__models_ar_cubic_quadratic_mixing yaeos__models_ar_cubic_alphas","tags":"","loc":"module/yaeos__models.html"},{"title":"yaeos__consistency_gemodel – yaeos","text":"yaeos__consistency_gemodel Consistency checks of Helmholtz free energy models ( GeModel ). Description This module contains tools to validate the analityc derivatives of\nimplmented excess Gibbs free energy models ( GeModel ). Also, allows to\nevaluate the consistency tests described in Thermodynamic Models:\nFundamentals & Computational Aspects 2 ed. by Michelsen and Mollerup\nChapter 5 section 4. Available tools: numeric_ge_derivatives : From an instantiated GeModel evaluate\nall the excess Gibbs free energy derivatives from the central finite\ndifference method. ge_consistency : From an instantiated GeModel evaluate all the\nMichelsen and Mollerup consistency tests References Michelsen, M. L., & Mollerup, J. M. (2007). Thermodynamic models:\nFundamentals & computational aspects (2. ed). Tie-Line Publications. Uses yaeos__constants yaeos__models_ge Subroutines public subroutine ge_consistency (model, n, t, eq58, eq59, eq60, eq61) models consistency tests Read more… Arguments Type Intent Optional Attributes Name class( GeModel ), intent(in) :: model model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: t Temperature [K] real(kind=pr), intent(out), optional :: eq58 MM Eq. 58 real(kind=pr), intent(out), optional :: eq59 (size(n)) MM Eq. 59 real(kind=pr), intent(out), optional :: eq60 (size(n),size(n)) MM Eq. 60 real(kind=pr), intent(out), optional :: eq61 (size(n)) MM Eq. 61 public subroutine numeric_ge_derivatives (model, n, t, d_n, d_t, Ge, GeT, Gen, GeT2, GeTn, Gen2) Numeric model derivatives Read more… Arguments Type Intent Optional Attributes Name class( GeModel ), intent(in) :: model model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: t Temperature [K] real(kind=pr), intent(in) :: d_n Moles finite difference step real(kind=pr), intent(in) :: d_t Temperature finite difference step real(kind=pr), intent(out) :: Ge Residual Helmoltz energy real(kind=pr), intent(out), optional :: GeT real(kind=pr), intent(out), optional :: Gen (size(n)) real(kind=pr), intent(out), optional :: GeT2 real(kind=pr), intent(out), optional :: GeTn (size(n)) real(kind=pr), intent(out), optional :: Gen2 (size(n),size(n))","tags":"","loc":"module/yaeos__consistency_gemodel.html"},{"title":"yaeos__models_ge_group_contribution_model_parameters – yaeos","text":"group contribution model parameters group contribution model parameters module. Description This module contrains the GeGCModelParameters type that allows to store\nthe subgroups ids, maingroups ids, subgroups Rs, subgroups Qs,\nsubgroups maingroups, and maingroups interaction parameters for UNIFAC\nlike models (UNIFAC, LL-UNIFAC, Dortmund UNIFAC, PSRK, etc) Uses yaeos__constants Derived Types type, public :: GeGCModelParameters group contribution model parameters container Read more… Components Type Visibility Attributes Name Initial real(kind=pr), public, allocatable :: maingroups_aij (:,:) Maingroup interaction parameters matrix real(kind=pr), public, allocatable :: maingroups_bij (:,:) Maingroup interaction parameters matrix real(kind=pr), public, allocatable :: maingroups_cij (:,:) Maingroup interaction parameters matrix integer, public, allocatable :: maingroups_ids (:) ID of each model’s maingroup real(kind=pr), public, allocatable :: subgroups_Qs (:) value of each subgroup real(kind=pr), public, allocatable :: subgroups_Rs (:) value of each subgroup integer, public, allocatable :: subgroups_ids (:) ID of each model’s subgroup integer, public, allocatable :: subgroups_maingroups (:) Maingroup of each subgroup Type-Bound Procedures procedure, public :: get_maingroup_index procedure, public :: get_maingroups_aij procedure, public :: get_maingroups_bij procedure, public :: get_maingroups_cij procedure, public :: get_subgroup_Q procedure, public :: get_subgroup_R procedure, public :: get_subgroup_index procedure, public :: get_subgroup_maingroup procedure, public :: get_subgroups_aij procedure, public :: get_subgroups_bij procedure, public :: get_subgroups_cij Functions public function get_maingroup_index (self, maingroup_id) result(maingroup_idx) Get index of the maingoup with id: maingoup_id Read more… Arguments Type Intent Optional Attributes Name class( GeGCModelParameters ) :: self integer, intent(in) :: maingroup_id ID of the subgroup Return Value integer Index of the maingroup on the self%maingroups_ids vector public function get_maingroups_aij (self, maingroup_i_id, maingroup_j_id) result(aij) Get the interaction parameter Read more… Arguments Type Intent Optional Attributes Name class( GeGCModelParameters ) :: self integer, intent(in) :: maingroup_i_id ID of the maingroup i integer, intent(in) :: maingroup_j_id ID of the maingroup j Return Value real(kind=pr) Interaction parameter public function get_maingroups_bij (self, maingroup_i_id, maingroup_j_id) result(bij) Get the interaction parameter Read more… Arguments Type Intent Optional Attributes Name class( GeGCModelParameters ) :: self integer, intent(in) :: maingroup_i_id ID of the maingroup i integer, intent(in) :: maingroup_j_id ID of the maingroup j Return Value real(kind=pr) Interaction parameter public function get_maingroups_cij (self, maingroup_i_id, maingroup_j_id) result(cij) Get the interaction parameter Read more… Arguments Type Intent Optional Attributes Name class( GeGCModelParameters ) :: self integer, intent(in) :: maingroup_i_id ID of the maingroup i integer, intent(in) :: maingroup_j_id ID of the maingroup j Return Value real(kind=pr) Interaction parameter public function get_subgroup_Q (self, subgroup_id) result(subgroup_Q) Get the subgroup’s value Read more… Arguments Type Intent Optional Attributes Name class( GeGCModelParameters ) :: self integer, intent(in) :: subgroup_id ID of the subgroup Return Value real(kind=pr) value of the subgroup public function get_subgroup_R (self, subgroup_id) result(subgroup_R) Get the subgroup’s value Read more… Arguments Type Intent Optional Attributes Name class( GeGCModelParameters ) :: self integer, intent(in) :: subgroup_id ID of the subgroup Return Value real(kind=pr) value of the subgroup public function get_subgroup_index (self, subgroup_id) result(subgroup_idx) Get index of the subgroup with id: subgroup_id Read more… Arguments Type Intent Optional Attributes Name class( GeGCModelParameters ) :: self integer, intent(in) :: subgroup_id ID of the subgroup Return Value integer Index of the subgroup on the self%subgroups_ids vector public function get_subgroup_maingroup (self, subgroup_id) result(subgroup_maingroup) Get the subgroup’s maingroup Read more… Arguments Type Intent Optional Attributes Name class( GeGCModelParameters ) :: self integer, intent(in) :: subgroup_id ID of the subgroup Return Value integer Maingroup of the subgroup public function get_subgroups_aij (self, subgroup_i_id, subgroup_j_id) result(aij) Get the interaction parameter Read more… Arguments Type Intent Optional Attributes Name class( GeGCModelParameters ) :: self integer, intent(in) :: subgroup_i_id ID of the subgroup i integer, intent(in) :: subgroup_j_id ID of the subgroup j Return Value real(kind=pr) Interaction parameter public function get_subgroups_bij (self, subgroup_i_id, subgroup_j_id) result(bij) Get the interaction parameter Read more… Arguments Type Intent Optional Attributes Name class( GeGCModelParameters ) :: self integer, intent(in) :: subgroup_i_id ID of the subgroup i integer, intent(in) :: subgroup_j_id ID of the subgroup j Return Value real(kind=pr) Interaction parameter public function get_subgroups_cij (self, subgroup_i_id, subgroup_j_id) result(cij) Get the interaction parameter Read more… Arguments Type Intent Optional Attributes Name class( GeGCModelParameters ) :: self integer, intent(in) :: subgroup_i_id ID of the subgroup i integer, intent(in) :: subgroup_j_id ID of the subgroup j Return Value real(kind=pr) Interaction parameter","tags":"","loc":"module/yaeos__models_ge_group_contribution_model_parameters.html"},{"title":"yaeos__models_base – yaeos","text":"Basic element of a thermodynamic model. Uses yaeos__substance Derived Types type, public, abstract :: BaseModel Base model type. Read more… Components Type Visibility Attributes Name Initial type( Substances ), public :: components Substances contained in the module","tags":"","loc":"module/yaeos__models_base.html"},{"title":"ar_interface.f90 – yaeos","text":"Source Code module ar_interface !-| Generic interfaces to an ArModel compatible with legacy codes, using ! pointers. use yaeos__constants , only : pr , R use iso_fortran_env , only : error_unit implicit none procedure ( Ares ), pointer :: ar_fun procedure ( initial_volume ), pointer :: vinit abstract interface subroutine Ares ( z , v , t , Ar , ArV , ArTV , ArV2 , Arn , ArVn , ArTn , Arn2 ) !| Residual Helmholtz model interface import pr real ( pr ), intent ( in ) :: z (:) real ( pr ), intent ( in ) :: v , t real ( pr ), intent ( out ) :: Ar , ArV , ArTV , ArV2 real ( pr ), dimension ( size ( z )), intent ( out ) :: Arn , ArVn , ArTn real ( pr ), intent ( out ) :: Arn2 ( size ( z ), size ( z )) end subroutine function initial_volume ( z , p , t ) import pr real ( pr ) :: z (:) real ( pr ) :: p real ( pr ) :: t real ( pr ) :: initial_volume end function end interface end module","tags":"","loc":"sourcefile/ar_interface.f90.html"},{"title":"phase_envelopes_pt.f90 – yaeos","text":"Source Code module yaeos__equilibria_boundaries_phase_envelopes_pt !! Phase boundaries line on the PT plane calculation procedures. use yaeos__constants , only : pr use yaeos__models , only : ArModel use yaeos__equilibria_equilibrium_state , only : EquilibriumState use yaeos__math_continuation , only : & continuation , continuation_solver , continuation_stopper implicit none type :: CriticalPoint !! Critical point real ( pr ) :: T !! Temperature [K] real ( pr ) :: P !! Pressure [bar] end type CriticalPoint type :: PTEnvel2 !! Two-phase isopleth. !! Phase boundary line of a fluid at constant composition. type ( EquilibriumState ), allocatable :: points (:) !! Each point through the line. type ( CriticalPoint ), allocatable :: cps (:) !! Critical points found along the line. contains procedure , pass :: write => write_PTEnvel2 generic , public :: write ( FORMATTED ) => write end type PTEnvel2 ! Saved volume values real ( pr ), private :: Vz real ( pr ), private :: Vy contains function pt_envelope_2ph (& model , z , first_point , & points , iterations , delta_0 , specified_variable_0 , & solver , stop_conditions & ) result ( envelopes ) !! PT two-phase envelope calculation procedure. !! !! Phase envelope calculation using the continuation method. !! Defaults to solving the saturation temperature and continues with !! an increment in it. The variable to specify can be changed by modifying !! `specified_variable_0` with the corresponding variable number. ! ======================================================================== use stdlib_optval , only : optval class ( ArModel ), intent ( in ) :: model !! Thermodyanmic model real ( pr ), intent ( in ) :: z (:) !! Vector of molar fractions type ( EquilibriumState ) :: first_point integer , optional , intent ( in ) :: points !! Maxmimum number of points, defaults to 500 integer , optional , intent ( in ) :: iterations !! Point solver maximum iterations, defaults to 100 real ( pr ), optional , intent ( in ) :: delta_0 !! Initial extrapolation \\Delta integer , optional , intent ( in ) :: specified_variable_0 !! Position of specified variable, since the vector of variables is !! X = [lnK_i, \\dots, lnT, lnP] the values for specification !! will be [1 \\dots nc] for the equilibria constants, nc+1 for !! lnT and nc + 2 for lnT. procedure ( continuation_solver ), optional :: solver !! Specify solver for each point, defaults to a full newton procedure procedure ( continuation_stopper ), optional :: stop_conditions !! Function that returns true if the continuation method should stop type ( PTEnvel2 ) :: envelopes ! ------------------------------------------------------------------------ integer :: nc !! Number of components integer :: ns !! Number of specified variable real ( pr ) :: dS0 !! Initial specification step real ( pr ) :: S0 !! Initial specification value integer :: max_points !! Maximum number of points integer :: max_iterations !! Maximum number of iterations real ( pr ) :: X ( size ( z ) + 2 ) !! Vector of variables used in the continuation method real ( pr ), allocatable :: XS (:, :) !! All the calculated variables that are returned on the continuation !! method procedure (unused since each point is saved on the fly) character ( len = 14 ) :: kind ! ======================================================================== ! Handle input ! ------------------------------------------------------------------------ kind = first_point % kind nc = size ( z ) max_points = optval ( points , 500 ) max_iterations = optval ( iterations , 100 ) ns = optval ( specified_variable_0 , nc + 1 ) dS0 = optval ( delta_0 , 0.1_pr ) ! Correctly define the K-values based on the provided incipient point. select case ( first_point % kind ) case ( \"bubble\" , \"liquid-liquid\" ) X (: nc ) = log ( first_point % y / z ) case ( \"dew\" ) X (: nc ) = log ( first_point % x / z ) end select X ( nc + 1 ) = log ( first_point % T ) X ( nc + 2 ) = log ( first_point % P ) S0 = X ( ns ) allocate ( envelopes % points ( 0 ), envelopes % cps ( 0 )) ! ======================================================================== ! Trace the line using the continuation method. ! ------------------------------------------------------------------------ XS = continuation (& foo , X , ns0 = ns , S0 = S0 , & dS0 = dS0 , max_points = max_points , solver_tol = 1.e-9_pr , & update_specification = update_spec , & solver = solver , stop = stop_conditions & ) contains subroutine foo ( X , ns , S , F , dF , dFdS ) !! Function that needs to be solved at each envelope point real ( pr ), intent ( in ) :: X (:) integer , intent ( in ) :: ns real ( pr ), intent ( in ) :: S real ( pr ), intent ( out ) :: F (:) real ( pr ), intent ( out ) :: dF (:, :) real ( pr ), intent ( out ) :: dFdS (:) character ( len = 14 ) :: kind_z , kind_y real ( pr ) :: y ( nc ) real ( pr ) :: lnPhi_z ( nc ), lnPhi_y ( nc ) real ( pr ) :: dlnphi_dt_z ( nc ), dlnphi_dt_y ( nc ) real ( pr ) :: dlnphi_dp_z ( nc ), dlnphi_dp_y ( nc ) real ( pr ) :: dlnphi_dn_z ( nc , nc ), dlnphi_dn_y ( nc , nc ) real ( pr ) :: T , P , K ( nc ) integer :: i , j F = 0 dF = 0 K = exp ( X (: nc )) T = exp ( X ( nc + 1 )) P = exp ( X ( nc + 2 )) y = K * z select case ( kind ) case ( \"bubble\" ) kind_z = \"liquid\" kind_y = \"vapor\" case ( \"dew\" ) kind_z = \"vapor\" kind_y = \"liquid\" case ( \"liquid-liquid\" ) kind_z = \"liquid\" kind_y = \"liquid\" case default kind_z = \"stable\" kind_y = \"stable\" end select call model % lnphi_pt (& z , P , T , V = Vz , root_type = kind_z , & lnPhi = lnphi_z , dlnPhidt = dlnphi_dt_z , & dlnPhidp = dlnphi_dp_z , dlnphidn = dlnphi_dn_z & ) call model % lnphi_pt (& y , P , T , V = Vy , root_type = kind_y , & lnPhi = lnphi_y , dlnPhidt = dlnphi_dt_y , & dlnPhidp = dlnphi_dp_y , dlnphidn = dlnphi_dn_y & ) F (: nc ) = X (: nc ) + lnPhi_y - lnPhi_z F ( nc + 1 ) = sum ( y - z ) F ( nc + 2 ) = X ( ns ) - S ! Jacobian Matrix do j = 1 , nc df (: nc , j ) = dlnphi_dn_y (:, j ) * y ( j ) df ( j , j ) = dF ( j , j ) + 1 end do df (: nc , nc + 1 ) = T * ( dlnphi_dt_y - dlnphi_dt_z ) df (: nc , nc + 2 ) = P * ( dlnphi_dp_y - dlnphi_dp_z ) df ( nc + 1 , : nc ) = y df ( nc + 2 , :) = 0 df ( nc + 2 , ns ) = 1 dFdS = 0 dFdS ( nc + 2 ) = - 1 end subroutine foo subroutine update_spec ( X , ns , S , dS , dXdS , step_iters ) !! Update the specification during continuation. real ( pr ), intent ( in out ) :: X (:) !! Vector of variables [lnK_i \\dots , lnT, lnP] integer , intent ( in out ) :: ns !! Number of specified variable in the vector real ( pr ), intent ( in out ) :: S !! Variable specification value real ( pr ), intent ( in out ) :: dS !! Step in specification real ( pr ), intent ( in out ) :: dXdS (:) !! Variation of variables with respect to specification integer , intent ( in ) :: step_iters !! Iterations used in the solver real ( pr ) :: maxdS ! ===================================================================== ! Update specification ! - Dont select T or P near critical points ! - Update dS wrt specification units ! - Set step ! --------------------------------------------------------------------- if ( maxval ( abs ( X (: nc ))) < 0.1_pr ) then ns = maxloc ( abs ( dXdS (: nc )), dim = 1 ) maxdS = 0.01_pr else ns = maxloc ( abs ( dXdS ), dim = 1 ) maxdS = 0.05_pr end if dS = dXdS ( ns ) * dS dXdS = dXdS / dXdS ( ns ) dS = sign ( 1.0_pr , dS ) * minval ([ & max ( sqrt ( abs ( X ( ns )) / 1 0._pr ), 0.1_pr ), & abs ( dS ) * 3 / step_iters & ] & ) dS = sign ( 1.0_pr , dS ) * maxval ([ abs ( dS ), maxdS ]) call save_point ( X , step_iters ) call detect_critical ( X , dXdS , ns , S , dS ) end subroutine update_spec subroutine save_point ( X , iters ) !! Save the converged point real ( pr ), intent ( in ) :: X (:) integer , intent ( in ) :: iters type ( EquilibriumState ) :: point real ( pr ) :: y ( nc ), T , P T = exp ( X ( nc + 1 )) P = exp ( X ( nc + 2 )) y = exp ( X (: nc )) * z select case ( kind ) case ( \"bubble\" ) point = EquilibriumState (& kind = \"bubble\" , x = z , Vx = Vz , y = y , Vy = Vy , & T = T , P = P , beta = 0._pr , iters = iters & ) case ( \"dew\" ) point = EquilibriumState (& kind = \"dew\" , x = y , Vx = Vy , y = z , Vy = Vz , & T = T , P = P , beta = 1._pr , iters = iters & ) case default point = EquilibriumState (& kind = kind , x = z , Vx = Vz , y = y , Vy = Vy , & T = T , P = P , beta = 0._pr , iters = iters & ) end select envelopes % points = [ envelopes % points , point ] end subroutine save_point subroutine detect_critical ( X , dXdS , ns , S , dS ) !! # `detect_critical` !! Critical point detection !! !! # Description !! If the values of lnK (X[:nc]) change sign then a critical point !! Has passed, since for this to happen all variables should pass !! through zero. Near critical points (lnK < 0.05) points are harder !! to converge, so more steps in the extrapolation vector are made to !! jump over the critical point. !! If the critical point is detected then the kind of the point is !! changed and the point is saved using an interpolation knowing that !! !! !! X_c = a * X + (1-a)*X_{new} !! !! !! With X_c is the variables at the critical point, X_{new} !! is the new initialization point of the method and a is the !! parameter to interpolate the values. This subroutine finds the !! value of a to obtain X_c. real ( pr ), intent ( in out ) :: X (:) !! Vector of variables real ( pr ), intent ( in out ) :: dXdS (:) !! Variation of variables wrt S integer , intent ( in out ) :: ns !! Number of specified variable real ( pr ), intent ( in out ) :: S !! Specification value real ( pr ), intent ( in out ) :: dS !! Step in specification real ( pr ) :: Xc ( nc + 2 ) !! Value at (near) critical point real ( pr ) :: a !! Parameter for interpolation real ( pr ) :: Xold ( size ( X )) !! Old value of X real ( pr ) :: Xnew ( size ( X )) !! Value of the next initialization Xold = X do while ( maxval ( abs ( X (: nc ))) < 0.01 ) ! If near a critical point, jump over it S = S + dS X = X + dXdS * dS end do Xnew = X + dXdS * dS if ( all ( Xold (: nc ) * ( Xnew (: nc )) < 0 )) then select case ( kind ) case ( \"dew\" ) kind = \"bubble\" case ( \"bubble\" ) kind = \"dew\" case default kind = \"liquid-liquid\" end select ! 0 = a*X(ns) + (1-a)*Xnew(ns) < Interpolation equation to get X(ns) = 0 a = - Xnew ( ns ) / ( X ( ns ) - Xnew ( ns )) Xc = a * X + ( 1 - a ) * Xnew envelopes % cps = [& envelopes % cps , CriticalPoint ( T = exp ( Xc ( nc + 1 )), P = exp ( Xc ( nc + 2 ))) & ] X = Xc + dXdS * dS end if end subroutine detect_critical end function pt_envelope_2ph subroutine write_PTEnvel2 ( pt2 , unit , iotype , v_list , iostat , iomsg ) class ( PTEnvel2 ), intent ( in ) :: pt2 integer , intent ( in ) :: unit character ( * ), intent ( in ) :: iotype integer , intent ( in ) :: v_list (:) integer , intent ( out ) :: iostat character ( * ), intent ( inout ) :: iomsg integer , allocatable :: cps (:) integer :: cp integer :: i , nc if ( size ( pt2 % points ) == 0 ) return allocate ( cps ( 0 )) do i = 1 , size ( pt2 % cps ) cp = minloc (& ( pt2 % points % T - pt2 % cps ( i )% T ) ** 2 & + ( pt2 % points % P - pt2 % cps ( i )% P ) ** 2 , dim = 1 & ) cps = [ cps , cp ] end do write ( unit , \"(A, /, /)\" , iostat = iostat ) \"#PTEnvel2\" write ( unit , \"(A, /)\" ) \"#\" // pt2 % points ( 1 )% kind do i = 1 , size ( pt2 % points ) - 1 ! Change label if passed a critical point if ( any ( cps - i == 0 ) . and . i < size ( pt2 % points )) then write ( unit , \"(/, /)\" ) write ( unit , \"(A, /)\" ) \"#\" // pt2 % points ( i + 1 )% kind end if write ( unit , * ) pt2 % points ( i ) write ( unit , \"(/)\" ) end do write ( unit , \"(/, /, A, /)\" ) \"#Critical\" do cp = 1 , size ( cps ) write ( unit , * ) pt2 % cps ( cp )% T , pt2 % cps ( cp )% P end do end subroutine write_PTEnvel2 end module yaeos__equilibria_boundaries_phase_envelopes_pt","tags":"","loc":"sourcefile/phase_envelopes_pt.f90.html"},{"title":"consistency_armodel.f90 – yaeos","text":"Source Code module yaeos__consistency_armodel !! # yaeos__consistency_armodel !! Consistency checks of Helmholtz free energy models ([[ArModel]]). !! !! # Description !! This module contains tools to validate the analityc derivatives of !! implmented Helmholtz free energy models ([[ArModel]]). Also, allows to !! evaluate the consistency tests described in Thermodynamic Models: !! Fundamentals & Computational Aspects 2 ed. by Michelsen and Mollerup !! Chapter 2 section 3. !! !! Available tools: !! !! - [[numeric_ar_derivatives]]: From an instantiated [[ArModel]] evaluate !! all the Helmholtz free energy derivatives from the central finite !! difference method. !! !! - [[ar_consistency]]: From an instantiated [[ArModel]] evaluate all the !! Michelsen and Mollerup consistency tests. !! !! # References !! 1. Michelsen, M. L., & Mollerup, J. M. (2007). Thermodynamic models: !! Fundamentals & computational aspects (2. ed). Tie-Line Publications. !! use yaeos__constants , only : pr , R use yaeos__models_ar , only : ArModel implicit none contains subroutine ar_consistency (& eos , n , V , T , eq31 , eq33 , eq34 , eq36 , eq37 & ) !! # ar_consistency !! A^r models consistency tests. !! !! # Description !! The evaluated equations are taken from Fundamentals & Computational !! Aspects 2 ed. by Michelsen and Mollerup Chapter 2 section 3. The !! \"eq\" are evaluations of the left hand side of the following !! expressions: !! !! Equation 31: !! !! \\sum_i n_i ln \\hat{\\phi}_i - \\frac{G^r(T,P,n)}{RT} = 0 !! !! Equation 33: !! !! !! \\left(\\frac{\\partial ln \\hat{\\phi}_i}{\\partial n_j} \\right)_{T,P} !! - \\left(\\frac{\\partial ln \\hat{\\phi}_j}{\\partial n_i} \\right)_{T,P} !! = 0 !! !! !! Equation 34: !! !! !! \\sum_i n_i !! \\left(\\frac{\\partial ln \\hat{\\phi}_i}{\\partial n_j} \\right)_{T,P} !! = 0 !! !! !! Equation 36: !! !! !! \\left(\\frac{\\partial}{\\partial P} !! \\sum_i n_i ln \\hat{\\phi}_i \\right)_{T,n} - \\frac{(Z - 1)n}{P} = 0 !! !! !! Equation 37: !! !! !! \\sum_i n_i \\left(\\frac{\\partial ln \\hat{\\phi}_i}{\\partial T} !! \\right)_{P,n} + \\frac{H^r(T,P,n)}{RT^2} = 0 !! !! !! The consistency test could be applied to any instantiated [[ArModel]] !! as shown in the following example. !! !! # Examples !! !! ```fortran !! use yaeos, only: pr, SoaveRedlichKwong, ArModel !! use yaeos__consistency_armodel, only: ar_consistency !! !! class(ArModel), allocatable :: model !! real(pr) :: tc(4), pc(4), w(4) !! !! real(pr) :: n(4), T, V !! !! real(pr) :: eq31, eq33(size(n), size(n)), eq34(size(n)), eq36, eq37 !! !! n = [1.5, 0.2, 0.7, 2.3] !! tc = [190.564, 425.12, 300.11, 320.25] !! pc = [45.99, 37.96, 39.23, 40.21] !! w = [0.0115478, 0.200164, 0.3624, 0.298] !! !! T = 600_pr !! V = 0.5_pr !! !! model = SoaveRedlichKwong(tc, pc, w) !! !! call ar_consistency(& !! model, n, V, T, eq31=eq31, eq33=eq33, eq34=eq34, eq36=eq36, eq37=eq37 & !! ) !! ``` !! All `eqXX` variables should be close to zero. !! !! # References !! 1. Michelsen, M. L., & Mollerup, J. M. (2007). Thermodynamic models: !! Fundamentals & computational aspects (2. ed). Tie-Line Publications. !! class ( ArModel ), intent ( in ) :: eos !! Equation of state real ( pr ), intent ( in ) :: n (:) !! Moles number vector real ( pr ), intent ( in ) :: T !! Temperature [K] real ( pr ), intent ( in ) :: V !! Volume [L] real ( pr ), optional , intent ( out ) :: eq31 !! MM Eq. 31 ! TODO real(pr), optional, intent(out) :: eq32 real ( pr ), optional , intent ( out ) :: eq33 ( size ( n ), size ( n )) !! MM Eq. 33 real ( pr ), optional , intent ( out ) :: eq34 ( size ( n )) !! MM Eq. 34 real ( pr ), optional , intent ( out ) :: eq36 !! MM Eq. 36 real ( pr ), optional , intent ( out ) :: eq37 !! MM Eq. 37 integer i , j ! ======================================================================== ! Previous calculations ! ------------------------------------------------------------------------ real ( pr ) :: Grp , Grv , Hrv , P , dPdn ( size ( n )), ntot , z real ( pr ) :: lnphi ( size ( n )), dlnPhidP ( size ( n )) real ( pr ) :: dlnPhidT ( size ( n )), dlnPhidn ( size ( n ), size ( n )) call eos % pressure ( n , V , T , P , dPdn = dPdn ) call eos % gibbs_residual_vt ( n , V , T , Grv ) call eos % enthalpy_residual_vt ( n , V , T , Hr = Hrv ) call eos % lnphi_vt (& n , V , T , lnPhi = lnPhi , & dlnPhidP = dlnPhidP , dlnPhidT = dlnPhidT , dlnPhidn = dlnPhidn & ) ntot = sum ( n ) z = P * V / ntot / R / T Grp = Grv - ntot * R * T * log ( Z ) ! ======================================================================== ! Equation 31 ! ------------------------------------------------------------------------ if ( present ( eq31 )) eq31 = sum ( n (:) * lnPhi (:)) - Grp / ( R * T ) ! ======================================================================== ! Equation 32 ! ------------------------------------------------------------------------ ! TODO ! ======================================================================== ! Equation 33 ! ------------------------------------------------------------------------ if ( present ( eq33 )) then do i = 1 , size ( n ), 1 do j = 1 , size ( n ), 1 eq33 ( i , j ) = dlnPhidn ( i , j ) - dlnPhidn ( j , i ) end do end do end if ! ======================================================================== ! Equation 34 ! ------------------------------------------------------------------------ if ( present ( eq34 )) then eq34 = 0.0_pr do j = 1 , size ( n ), 1 do i = 1 , size ( n ), 1 eq34 ( j ) = eq34 ( j ) + n ( i ) * dlnPhidn ( i , j ) end do end do end if ! ======================================================================== ! Equation 36 ! ------------------------------------------------------------------------ if ( present ( eq36 )) eq36 = sum ( n (:) * dlnPhidP (:)) - ( z - 1 ) * ntot / P ! ======================================================================== ! Equation 37 ! ------------------------------------------------------------------------ if ( present ( eq37 )) then eq37 = sum ( n (:) * dlnPhidT (:)) + Hrv / ( R * T ** 2 ) end if end subroutine ar_consistency subroutine numeric_ar_derivatives (& eos , n , V , T , d_n , d_v , d_t , & Ar , ArV , ArT , Arn , ArV2 , ArT2 , ArTV , ArVn , ArTn , Arn2 & ) !! # numeric_ar_derivatives !! Evaluate the Helmholtz derivatives with central finite difference. !! !! # Description !! Tool to facilitate the development of new [[ArModel]] by testing !! the implementation of analytic derivatives. !! !! # Examples !! !! ```fortran !! use yaeos, only: pr, SoaveRedlichKwong, ArModel !! use yaeos__consistency_armodel, only: numeric_ar_derivatives !! !! class(ArModel), allocatable :: model !! real(pr) :: tc(4), pc(4), w(4) !! !! real(pr) :: n(4), T, V !! !! real(pr) :: Ar_num, ArV_num, ArT_num, Arn_num(size(n)), ArV2_num, ArT2_num !! real(pr) :: ArTV_num, ArVn_num(size(n)), ArTn_num(size(n)) !! real(pr) :: Arn2_num(size(n), size(n)) !! !! n = [1.5, 0.2, 0.7, 2.3] !! tc = [190.564, 425.12, 300.11, 320.25] !! pc = [45.99, 37.96, 39.23, 40.21] !! w = [0.0115478, 0.200164, 0.3624, 0.298] !! !! T = 600_pr !! V = 0.5_pr !! !! model = SoaveRedlichKwong(tc, pc, w) !! !! call numeric_ar_derivatives(& !! model, n, V, T, d_n = 0.0001_pr, d_v = 0.0001_pr, d_t = 0.01_pr, & !! Ar=Ar_num, ArV=ArV_num, ArT=ArT_num, ArTV=ArTV_num, ArV2=ArV2_num, & !! ArT2=ArT2_num, Arn=Arn_num, ArVn=ArVn_num, ArTn=ArTn_num, & !! Arn2=Arn2_num & !! ) !! ``` !! class ( ArModel ), intent ( in ) :: eos !! Equation of state real ( pr ), intent ( in ) :: n (:) !! Moles number vector real ( pr ), intent ( in ) :: T !! Temperature [K] real ( pr ), intent ( in ) :: V !! Volume [L] real ( pr ), intent ( in ) :: d_n !! Moles finite difference step real ( pr ), intent ( in ) :: d_t !! Temperature finite difference step real ( pr ), intent ( in ) :: d_v !! Volume finite difference step real ( pr ), intent ( out ) :: Ar !! Residual Helmoltz energy real ( pr ), optional , intent ( out ) :: ArV !! \\frac{dAr}{dV} real ( pr ), optional , intent ( out ) :: ArT !! \\frac{dAr}{dT} real ( pr ), optional , intent ( out ) :: Arn ( size ( n )) !! \\frac{dAr}{dn_i} real ( pr ), optional , intent ( out ) :: ArV2 !! \\frac{d^2Ar}{dV^2} real ( pr ), optional , intent ( out ) :: ArT2 !! \\frac{d^2Ar}{dT^2} real ( pr ), optional , intent ( out ) :: ArTV !! \\frac{d^2Ar}{dTdV} real ( pr ), optional , intent ( out ) :: ArVn ( size ( n )) !! \\frac{d^2Ar}{dVdn_i} real ( pr ), optional , intent ( out ) :: ArTn ( size ( n )) !! \\frac{d^2Ar}{dTdn_i} real ( pr ), optional , intent ( out ) :: Arn2 ( size ( n ), size ( n )) !! \\frac{d^2Ar}{dn_{ij}} ! Auxiliary real ( pr ) :: Ar_aux1 , Ar_aux2 , Ar_aux3 , Ar_aux4 real ( pr ) :: dn_aux1 ( size ( n )), dn_aux2 ( size ( n )) integer :: i , j ! ======================================================================== ! Ar valuations ! ------------------------------------------------------------------------ ! on point valuation call eos % residual_helmholtz ( n , V , T , Ar = Ar ) ! ======================================================================== ! Central numeric derivatives ! ------------------------------------------------------------------------ ! Volume if ( present ( ArV ) . or . present ( ArV2 )) then call eos % residual_helmholtz ( n , V + d_v , T , Ar = Ar_aux1 ) call eos % residual_helmholtz ( n , V - d_v , T , Ar = Ar_aux2 ) if ( present ( ArV )) ArV = ( Ar_aux1 - Ar_aux2 ) / ( 2 * d_v ) if ( present ( ArV2 )) ArV2 = ( Ar_aux1 - 2 * Ar + Ar_aux2 ) / d_v ** 2 end if ! Temperature if ( present ( ArT ) . or . present ( ArT2 )) then call eos % residual_helmholtz ( n , V , T + d_t , Ar = Ar_aux1 ) call eos % residual_helmholtz ( n , V , T - d_t , Ar = Ar_aux2 ) if ( present ( ArT )) ArT = ( Ar_aux1 - Ar_aux2 ) / ( 2 * d_t ) if ( present ( ArT2 )) ArT2 = ( Ar_aux1 - 2 * Ar + Ar_aux2 ) / d_t ** 2 end if ! Mole first derivatives if ( present ( Arn )) then Arn = 0.0_pr do i = 1 , size ( n ), 1 dn_aux1 = 0.0_pr dn_aux1 ( i ) = d_n call eos % residual_helmholtz ( n + dn_aux1 , V , T , Ar = Ar_aux1 ) call eos % residual_helmholtz ( n - dn_aux1 , V , T , Ar = Ar_aux2 ) Arn ( i ) = ( Ar_aux1 - Ar_aux2 ) / ( 2 * d_n ) end do end if ! ======================================================================== ! Central cross derivatives ! ------------------------------------------------------------------------ ! Temperature - Volume if ( present ( ArTV )) then call eos % residual_helmholtz ( n , V + d_v , T + d_t , Ar = Ar_aux1 ) call eos % residual_helmholtz ( n , V + d_v , T - d_t , Ar = Ar_aux2 ) call eos % residual_helmholtz ( n , V - d_v , T + d_t , Ar = Ar_aux3 ) call eos % residual_helmholtz ( n , V - d_v , T - d_t , Ar = Ar_aux4 ) ArTV = ( Ar_aux1 - Ar_aux2 - Ar_aux3 + Ar_aux4 ) / ( 4 * d_t * d_v ) end if ! Temperature - Mole if ( present ( ArTn )) then ArTn = 0.0_pr do i = 1 , size ( n ), 1 dn_aux1 = 0.0_pr dn_aux1 ( i ) = d_n call eos % residual_helmholtz ( n + dn_aux1 , V , T + d_t , Ar = Ar_aux1 ) call eos % residual_helmholtz ( n + dn_aux1 , V , T - d_t , Ar = Ar_aux2 ) call eos % residual_helmholtz ( n - dn_aux1 , V , T + d_t , Ar = Ar_aux3 ) call eos % residual_helmholtz ( n - dn_aux1 , V , T - d_t , Ar = Ar_aux4 ) ArTn ( i ) = & ( Ar_aux1 - Ar_aux2 - Ar_aux3 + Ar_aux4 ) / ( 4 * d_t * d_n ) end do end if ! Volume - Mole if ( present ( ArVn )) then ArVn = 0.0_pr do i = 1 , size ( n ), 1 dn_aux1 = 0.0_pr dn_aux1 ( i ) = d_n call eos % residual_helmholtz ( n + dn_aux1 , V + d_v , T , Ar = Ar_aux1 ) call eos % residual_helmholtz ( n + dn_aux1 , V - d_v , T , Ar = Ar_aux2 ) call eos % residual_helmholtz ( n - dn_aux1 , V + d_v , T , Ar = Ar_aux3 ) call eos % residual_helmholtz ( n - dn_aux1 , V - d_v , T , Ar = Ar_aux4 ) ArVn ( i ) = & ( Ar_aux1 - Ar_aux2 - Ar_aux3 + Ar_aux4 ) / ( 4 * d_v * d_n ) end do end if ! Mole second derivatives if ( present ( Arn2 )) then Arn2 = 0.0_pr do i = 1 , size ( n ), 1 do j = 1 , size ( n ), 1 if ( i . eq . j ) then dn_aux1 = 0.0_pr dn_aux1 ( i ) = d_n call eos % residual_helmholtz ( n + dn_aux1 , V , T , Ar = Ar_aux1 ) call eos % residual_helmholtz ( n - dn_aux1 , V , T , Ar = Ar_aux2 ) Arn2 ( i , j ) = ( Ar_aux1 - 2 * Ar + Ar_aux2 ) / d_n ** 2 else dn_aux1 = 0.0_pr dn_aux2 = 0.0_pr dn_aux1 ( i ) = d_n dn_aux2 ( j ) = d_n call eos % residual_helmholtz (& n + dn_aux1 + dn_aux2 , V , T , Ar = Ar_aux1 & ) call eos % residual_helmholtz (& n + dn_aux1 - dn_aux2 , V , T , Ar = Ar_aux2 & ) call eos % residual_helmholtz (& n - dn_aux1 + dn_aux2 , V , T , Ar = Ar_aux3 & ) call eos % residual_helmholtz (& n - dn_aux1 - dn_aux2 , V , T , Ar = Ar_aux4 & ) Arn2 ( i , j ) = & ( Ar_aux1 - Ar_aux2 - Ar_aux3 + Ar_aux4 ) / ( 4 * d_n ** 2 ) end if end do end do end if end subroutine numeric_ar_derivatives end module yaeos__consistency_armodel","tags":"","loc":"sourcefile/consistency_armodel.f90.html"},{"title":"substance.f90 – yaeos","text":"Source Code module yaeos__substance !! yaeos Subtance module. !! !! Module containing pure components properties and parameters. use yaeos__constants , only : pr type :: Substances !! Set of pure components character ( len = 50 ), allocatable :: names (:) !! Composition names. real ( pr ), allocatable :: tc (:) !! Critical Temperature [K] real ( pr ), allocatable :: pc (:) !! Critical Pressure [bar] real ( pr ), allocatable :: w (:) !! Acentric factor end type end module","tags":"","loc":"sourcefile/substance.f90.html"},{"title":"base.f90 – yaeos","text":"Source Code module yaeos__models_ar_cubic_mixing_base !! # Mixing rules core math !! Procedures of the core calculations of CubicEoS mixing rules. !! !! # Description !! This module holds all the basic math to use mixing rules in other codes. !! Keeping it simple and accesible. !! !! # Examples !! !! ```fortran !! bi = [0.2, 0.3] !! lij = reshape([0.0, 0.2, 0.2, 0], [2,2]) !! !! ! Calculate B parameter with Quadratric Mixing Rules. !! call bmix_qmr(n, bi, lij, b, dbi, dbij) !! !! ``` !! !! # References use yaeos__constants , only : pr implicit none contains pure subroutine bmix_linear ( n , bi , b , dbi , dbij ) real ( pr ), intent ( in ) :: n (:) real ( pr ), intent ( in ) :: bi (:) real ( pr ), intent ( out ) :: b , dbi (:), dbij (:, :) b = sum ( n * bi ) dbi = bi dbij = 0 end subroutine pure subroutine bmix_qmr ( n , bi , lij , b , dbi , dbij ) real ( pr ), intent ( in ) :: n (:) real ( pr ), intent ( in ) :: bi (:) real ( pr ), intent ( in ) :: lij (:, :) real ( pr ), intent ( out ) :: b , dbi (:), dbij (:, :) real ( pr ) :: bij ( size ( n ), size ( n )) real ( pr ) :: totn , aux ( size ( n )) integer :: i , j , nc nc = size ( n ) TOTN = sum ( n ) B = 0 dBi = 0 dBij = 0 aux = 0 do i = 1 , nc do j = 1 , nc bij ( i , j ) = 0.5_pr * ( bi ( i ) + bi ( j )) * ( 1.0_pr - lij ( i , j )) aux ( i ) = aux ( i ) + n ( j ) * bij ( i , j ) end do B = B + n ( i ) * aux ( i ) end do B = B / totn do i = 1 , nc dBi ( i ) = ( 2 * aux ( i ) - B ) / totn do j = 1 , i dBij ( i , j ) = ( 2 * bij ( i , j ) - dBi ( i ) - dBi ( j )) / totn dBij ( j , i ) = dBij ( i , j ) end do end do end subroutine pure subroutine d1mix_rkpr ( n , d1i , d1 , dd1i , dd1ij ) !! RKPR \\delta_1 parameter mixing rule. !! !! The RKPR EoS doesn't have a constant \\delta_1 value for each !! component, so a proper mixing rule should be provided. A linear !! combination is used. !! !! !! \\Delta_1 = \\sum_i^N n_i \\delta_{1i} !! !! real ( pr ), intent ( in ) :: n (:) real ( pr ), intent ( in ) :: d1i (:) real ( pr ), intent ( out ) :: D1 real ( pr ), intent ( out ) :: dD1i (:) real ( pr ), intent ( out ) :: dD1ij (:, :) integer :: i , j , nc real ( pr ) :: totn nc = size ( n ) totn = sum ( n ) D1 = sum ( n * d1i ) / totn do i = 1 , nc dD1i ( i ) = ( d1i ( i ) - D1 ) / totn do j = 1 , nc dD1ij ( i , j ) = ( 2 * D1 - d1i ( i ) - d1i ( j )) / totn ** 2 end do end do end subroutine end module","tags":"","loc":"sourcefile/base.f90.html"},{"title":"pressure_equality.f90 – yaeos","text":"Source Code module yaeos__solvers_pressure_equality !! Solve the pressure equality of a use yaeos__constants , only : pr , R use yaeos__models_ar , only : ArModel implicit none contains subroutine pressure_equality_V_beta_xy ( model , T , V , beta , x , y , vx , vy , P ) !! Solve pressure equality between two phases at a given temperature, !! total volume, vapor molar fractions and compositions. use iso_fortran_env , only : error_unit class ( ArModel ), intent ( in ) :: model real ( pr ), intent ( in ) :: T !! Temperature [K] real ( pr ), intent ( in ) :: V !! Total volume [L/mol] real ( pr ), intent ( in ) :: beta !! Molar fraction of light-phase real ( pr ), intent ( in ) :: x (:) !! Molar fractions of heavy-phase real ( pr ), intent ( in ) :: y (:) !! Molar fractions of light-phase real ( pr ), intent ( in out ) :: Vx !! Heavy-phase molar volume [L/mol] real ( pr ), intent ( in out ) :: Vy !! Light-Phase molar volume [L/mol] real ( pr ), intent ( out ) :: P !! Pressure [bar] real ( pr ) :: Bx !! Liquid phase covolume real ( pr ) :: dVydVx !! Derivative of Vy wrt Vx ! Pressure equality newton functions real ( pr ) :: h !! Pressure equality real ( pr ) :: dh !! dh/ real ( pr ) :: stepv real ( pr ) :: dPxdV , dPydV real ( pr ) :: Px , Py integer :: its dVydVx = - ( 1 - beta ) / beta Bx = model % get_v0 ( x , 0.1_pr , T ) ! First evaluation will be with Vx = 1.5*Bx if ( Vx < Bx ) Vx = 1.625_pr * Bx call model % pressure ( x , Vx , T , Px , dpdv = dPxdV ) do while ( Px < 0 . or . dPxdV >= 0 ) Vx = Vx - 0.2 * ( Vx - Bx ) call model % pressure ( x , Vx , T , Px , dpdv = dPxdV ) end do Vy = ( V - ( 1 - beta ) * Vx ) / beta h = 1.0 its = 0 do while ( abs ( h ) > 1.d-4 ) ! Newton for solving P equality, with Vx as independent variable its = its + 1 call model % pressure ( x , Vx , T , Px , dpdv = dPxdV ) call model % pressure ( y , Vy , T , Py , dpdv = dPydV ) h = Py - Px dh = - dPydV * dVydVx - dPxdV stepv = - h / dh if ( its >= 10 ) stepv = stepv / 2 Vx = Vx + stepv do while ( Vx < 1.001 * Bx ) stepv = stepv / 2 Vx = Vx - stepv end do Vy = ( v - ( 1 - beta ) * Vx ) / beta if ( its >= 100 ) then write ( error_unit , * ) \"WARN(FLASH_VT): volume convergence problems\" , Px , Py P = - 1.0 return end if end do call model % pressure ( x , Vx , T , Px ) call model % pressure ( y , Vy , T , Py ) P = ( Px + Py ) * 0.5_pr end subroutine pressure_equality_V_beta_xy end module yaeos__solvers_pressure_equality","tags":"","loc":"sourcefile/pressure_equality.f90.html"},{"title":"saturations_points.f90 – yaeos","text":"Source Code module yaeos__equilibria_saturation_points use yaeos__constants , only : pr use yaeos__models , only : ArModel use yaeos__equilibria_equilibrium_state , only : EquilibriumState use yaeos__equilibria_auxiliar , only : k_wilson real ( pr ) :: tol = 1e-9_pr integer :: max_iterations = 1000 real ( pr ) :: step_tol = 0.1_pr contains type ( EquilibriumState ) function saturation_pressure ( model , n , t , kind , p0 , y0 , max_iters ) !! Saturation pressure calculation function. !! !! Calculates the saturation pressure of a multicomponent mixture with !! a given molar composition `n`. !! It is possible to calculate: !! !! - Bubble point: `kind=\"bubble\"` !! - Dew point: `kind=\"dew\"` !! - Liquid-Liquid point: `kind=\"liquid-liquid\"` use stdlib_optval , only : optval class ( ArModel ), intent ( in ) :: model real ( pr ), intent ( in ) :: n (:) !! Composition vector [moles / molar fraction] real ( pr ), intent ( in ) :: t !! Temperature [K] character ( len =* ), intent ( in ) :: kind !! [bubble|dew|liquid-liquid] real ( pr ), optional , intent ( in ) :: p0 !! Initial pressure [bar] real ( pr ), optional , intent ( in ) :: y0 (:) !! Initial composition integer , optional , intent ( in ) :: max_iters !! Maximum number of iterations real ( pr ) :: p , vy , vz real ( pr ) :: k ( size ( n )), y ( size ( n )), z ( size ( n )), lnk ( size ( n )) real ( pr ) :: lnfug_y ( size ( n )), dlnphi_dp_y ( size ( n )) real ( pr ) :: lnfug_z ( size ( n )), dlnphi_dp_z ( size ( n )) character ( len = 50 ) :: incipient character ( len = 50 ) :: main real ( pr ) :: f , step integer :: its , iterations , i ! ======================================================================= ! Handle arguments ! ----------------------------------------------------------------------- z = n / sum ( n ) if ( present ( p0 )) then p = p0 else call model % pressure ( z , T , 1 0._pr , P = P ) end if if ( present ( y0 )) then y = y0 else y = z * k_wilson ( model , T , P ) end if iterations = optval ( max_iters , max_iterations ) select case ( kind ) case ( \"bubble\" ) k = y / z incipient = \"vapor\" main = \"liquid\" case ( \"dew\" ) k = z / y incipient = \"liquid\" main = \"vapor\" case ( \"liquid-liquid\" ) k = y / z incipient = \"liquid\" main = \"liquid\" end select where ( z == 0 ) k = 0 end where ! ======================================================================== ! ======================================================================== ! Solve point ! ------------------------------------------------------------------------ do its = 1 , iterations y = k * z call model % lnphi_pt ( y , P , T , vy , incipient , lnPhi = lnfug_y , dlnphidp = dlnphi_dp_y ) call model % lnphi_pt ( z , P , T , vz , main , lnPhi = lnfug_z , dlnphidp = dlnphi_dp_z ) k = exp ( lnfug_z - lnfug_y ) if ( all ( k < 1e-9_pr ) . or . all ( abs ( k - 1 ) < tol )) exit f = sum ( z * k ) - 1 step = f / sum ( z * k * ( dlnphi_dp_z - dlnphi_dp_y )) do while ( P - step < 0 . or . abs ( step ) > 0.1 * P ) step = step / 2 end do p = p - step if ( abs ( step ) < tol . and . abs ( f ) < tol ) exit end do ! ======================================================================== select case ( kind ) case ( \"bubble\" ) saturation_pressure = EquilibriumState ( kind = \"bubble\" , & iters = its , y = y , x = z , vx = vz , vy = vy , t = t , p = p , beta = 0._pr & ) case ( \"dew\" ) saturation_pressure = EquilibriumState ( kind = \"dew\" , & iters = its , x = y , y = z , vy = vz , vx = vy , t = t , p = p , beta = 1._pr & ) case ( \"liquid-liquid\" ) saturation_pressure = EquilibriumState ( kind = \"liquid-liquid\" , & iters = its , y = y , x = z , vx = vz , vy = vy , t = t , p = p , beta = 0._pr & ) end select end function saturation_pressure type ( EquilibriumState ) function saturation_temperature ( model , n , p , kind , t0 , y0 , max_iters ) !! Saturation temperature calculation function. !! !! Calculates the saturation pressure of a multicomponent mixture with !! a given molar composition `n`. !! It is possible to calculate: !! !! - Bubble point: `kind=\"bubble\"` !! - Dew point: `kind=\"dew\"` !! - Liquid-Liquid point: `kind=\"liquid-liquid\"` use stdlib_optval , only : optval class ( ArModel ), intent ( in ) :: model real ( pr ), intent ( in ) :: n (:) !! Composition vector [moles / molar fraction] real ( pr ), intent ( in ) :: p !! Pressure [bar] character ( len =* ), intent ( in ) :: kind !! [bubble|dew|liquid-liquid] real ( pr ), optional , intent ( in ) :: t0 !! Initial temperature [K] real ( pr ), optional , intent ( in ) :: y0 (:) !! Initial composition integer , optional , intent ( in ) :: max_iters !! Maximum number of iterations real ( pr ) :: t , vy , vz real ( pr ) :: k ( size ( n )), y ( size ( n )), z ( size ( n )), lnk ( size ( n )) real ( pr ) :: lnfug_y ( size ( n )), dlnphi_dt_y ( size ( n )) real ( pr ) :: lnfug_z ( size ( n )), dlnphi_dt_z ( size ( n )) character ( len = 50 ) :: incipient character ( len = 50 ) :: main real ( pr ) :: f , step integer :: its , iterations logical :: is_incipient ( size ( n )) ! ======================================================================= ! Handle arguments ! ----------------------------------------------------------------------- is_incipient = . true . z = n / sum ( n ) if ( present ( t0 )) then t = t0 else t = 15 0._pr end if if ( present ( y0 )) then y = y0 else y = z * k_wilson ( model , T , P ) end if iterations = optval ( max_iters , max_iterations ) select case ( kind ) case ( \"bubble\" ) k = y / z incipient = \"vapor\" main = \"liquid\" case ( \"dew\" ) k = z / y incipient = \"liquid\" main = \"vapor\" case ( \"liquid-liquid\" ) k = y / z incipient = \"liquid\" main = \"liquid\" end select where ( z == 0 ) k = 0 end where where ( y == 0 ) is_incipient = . false . end where ! ======================================================================== ! ======================================================================== ! Solve point ! ------------------------------------------------------------------------ do its = 1 , iterations y = k * z where (. not . is_incipient ) y = 0 endwhere call model % lnphi_pt ( y , P , T , vy , incipient , lnPhi = lnfug_y , dlnphidt = dlnphi_dt_y ) call model % lnphi_pt ( z , P , T , vz , main , lnPhi = lnfug_z , dlnphidt = dlnphi_dt_z ) k = exp ( lnfug_z - lnfug_y ) f = sum ( z * k ) - 1 step = f / sum ( z * k * ( dlnphi_dt_z - dlnphi_dt_y )) do while ( abs ( step ) > 0.25 * T . or . T - step < 0 ) step = step / 2 end do t = t - step if ( abs ( step ) < tol . and . abs ( f ) < tol ) exit end do ! ======================================================================== select case ( kind ) case ( \"bubble\" ) saturation_temperature = EquilibriumState ( kind = \"bubble\" , & iters = its , y = y , x = z , vx = vz , vy = vy , t = t , p = p , beta = 0._pr & ) case ( \"dew\" ) saturation_temperature = EquilibriumState ( kind = \"dew\" , & iters = its , x = y , y = z , vy = vz , vx = vy , t = t , p = p , beta = 1._pr & ) case ( \"liquid-liquid\" ) saturation_temperature = EquilibriumState ( kind = \"liquid-liquid\" , & iters = its , y = y , x = z , vx = vz , vy = vy , t = t , p = p , beta = 0._pr & ) end select end function saturation_temperature end module yaeos__equilibria_saturation_points","tags":"","loc":"sourcefile/saturations_points.f90.html"},{"title":"phase_envelopes_px.f90 – yaeos","text":"Source Code module yaeos__equilibria_boundaries_phase_envelopes_px !! Phase boundaries line on the P\\alpha plane calculation procedures. use yaeos__constants , only : pr use yaeos__models , only : ArModel use yaeos__equilibria_equilibrium_state , only : EquilibriumState use yaeos__math_continuation , only : & continuation , continuation_solver , continuation_stopper implicit none type :: CriticalPoint !! Critical point real ( pr ) :: alpha !! \\alpha real ( pr ) :: P !! Pressure [bar] end type CriticalPoint type :: PXEnvel2 !! Two-phase PX envelope. !! Phase boundary line of a fluid at constant temperature !! with variation in composition. real ( pr ), allocatable :: alpha (:) !! Second fluid molar fraction real ( pr ), allocatable :: z0 (:) !! Original fluid composition real ( pr ), allocatable :: z_inj (:) !! Second fluid composition type ( EquilibriumState ), allocatable :: points (:) !! Each point through the line. type ( CriticalPoint ), allocatable :: cps (:) !! Critical points found along the line. end type PXEnvel2 ! Private volumes of each phase to share between functions real ( pr ), private :: Vz !! Main phase volume [L/mol] real ( pr ), private :: Vy !! Incipient phase volume [L/mol] contains function px_envelope_2ph (& model , z0 , alpha0 , z_injection , first_point , & points , iterations , delta_0 , specified_variable_0 , & solver , stop_conditions & ) result ( envelopes ) !! PX two-phase envelope calculation procedure. !! !! Phase envelope calculation using the continuation method. !! Defaults to solving the saturation temperature and continues with !! an increment in it. The variable to specify can be changed by modifying !! `specified_variable_0` with the corresponding variable number. ! ======================================================================== use stdlib_optval , only : optval class ( ArModel ), intent ( in ) :: model !! Thermodyanmic model real ( pr ), intent ( in ) :: z0 (:) !! Vector of molar fractions of the global composition (main phase) real ( pr ), intent ( in ) :: alpha0 !! First point of alpha real ( pr ), intent ( in ) :: z_injection (:) !! Vector of molar fractions of the injection fluid type ( EquilibriumState ) :: first_point integer , optional , intent ( in ) :: points !! Maxmimum number of points, defaults to 500 integer , optional , intent ( in ) :: iterations !! Point solver maximum iterations, defaults to 100 real ( pr ), optional , intent ( in ) :: delta_0 !! Initial extrapolation \\Delta integer , optional , intent ( in ) :: specified_variable_0 !! Position of specified variable, since the vector of variables is !! X = [lnK_i, \\dots, lnP, \\alpha] the values for specification !! will be [1 \\dots nc] for the equilibria constants, nc+1 for !! lnP and nc + 2 for \\alpha. procedure ( continuation_solver ), optional :: solver !! Specify solver for each point, defaults to a full newton procedure procedure ( continuation_stopper ), optional :: stop_conditions !! Function that returns true if the continuation method should stop type ( PXEnvel2 ) :: envelopes ! ------------------------------------------------------------------------ integer :: nc !! Number of components integer :: ns !! Number of specified variable real ( pr ) :: dS0 !! Initial specification step real ( pr ) :: S0 !! Initial specification value real ( pr ) :: z ( size ( z0 )) !! Composition at some point integer :: max_points !! Maximum number of points integer :: max_iterations !! Maximum number of iterations real ( pr ) :: X ( size ( z ) + 2 ), T real ( pr ), allocatable :: XS (:, :) character ( len = 14 ) :: kind ! ======================================================================== ! Handle input ! ------------------------------------------------------------------------ call get_z ( alpha0 , z0 , z_injection , z ) kind = first_point % kind nc = size ( z ) max_points = optval ( points , 500 ) max_iterations = optval ( iterations , 100 ) ns = optval ( specified_variable_0 , nc + 2 ) dS0 = optval ( delta_0 , 0.1_pr ) ! Correctly define the K-values based on the provided incipient point. select case ( first_point % kind ) case ( \"bubble\" , \"liquid-liquid\" ) X (: nc ) = log ( first_point % y / z ) case ( \"dew\" ) X (: nc ) = log ( first_point % x / z ) end select T = first_point % T X ( nc + 1 ) = log ( first_point % P ) X ( nc + 2 ) = alpha0 S0 = X ( ns ) allocate ( envelopes % points ( 0 ), envelopes % cps ( 0 ), envelopes % alpha ( 0 )) test_numdiff : block real ( pr ) :: F ( size ( X )), df ( size ( X ), size ( X )), numdiff ( size ( X ), size ( X )) real ( pr ) :: FdX ( size ( X )), dx ( size ( X )), dFdS ( size ( X )) real ( pr ) :: FdX2 ( size ( X )) integer :: i integer :: loc ( 2 ) real ( pr ) :: maxerr do i = 1 , size ( X ) dx = 0 dx ( i ) = 1.e-3_pr * X ( i ) call foo ( X - dx , ns , S0 , FdX , df , dFdS ) call foo ( X + dx , ns , S0 , FdX2 , df , dFdS ) call foo ( X , ns , S0 , F , df , dFdS ) numdiff (:, i ) = ( FdX2 - FdX ) / ( 2 * dx ( i )) end do loc = maxloc ( abs ( numdiff - df )) maxerr = abs (& ( numdiff ( loc ( 1 ), loc ( 2 )) - df ( loc ( 1 ), loc ( 2 ))& ) / numdiff ( loc ( 1 ), loc ( 2 ))) if ( maxerr > 0.01_pr ) then print * , \"ERROR: PXEnvel2 Numerical differentiation failed\" loc = maxloc ( abs ( numdiff - df )) print * , loc print * , df ( loc ( 1 ), loc ( 2 )), numdiff ( loc ( 1 ), loc ( 2 )) ! error stop 1 end if end block test_numdiff ! ======================================================================== ! Trace the line using the continuation method. ! ------------------------------------------------------------------------ XS = continuation (& foo , X , ns0 = ns , S0 = S0 , & dS0 = dS0 , max_points = max_points , solver_tol = 1.e-9_pr , & update_specification = update_spec , & solver = solver , stop = stop_conditions & ) contains recursive subroutine foo ( X , ns , S , F , dF , dFdS ) !! Function that needs to be solved at each envelope point real ( pr ), intent ( in ) :: X (:) integer , intent ( in ) :: ns real ( pr ), intent ( in ) :: S real ( pr ), intent ( out ) :: F (:) real ( pr ), intent ( out ) :: dF (:, :) real ( pr ), intent ( out ) :: dFdS (:) character ( len = 14 ) :: kind_z , kind_y real ( pr ) :: y ( nc ) real ( pr ) :: lnphip_z ( nc ), lnphip_y ( nc ) real ( pr ) :: dlnphi_dt_z ( nc ), dlnphi_dt_y ( nc ) real ( pr ) :: dlnphi_dp_z ( nc ), dlnphi_dp_y ( nc ) real ( pr ) :: dlnphi_dn_z ( nc , nc ), dlnphi_dn_y ( nc , nc ) real ( pr ) :: P , K ( nc ), alpha , dzda ( nc ) integer :: i , j F = 0 dF = 0 K = exp ( X (: nc )) P = exp ( X ( nc + 1 )) alpha = X ( nc + 2 ) call get_z ( alpha , z0 , z_injection , z , dzda ) y = K * z select case ( kind ) case ( \"bubble\" ) kind_z = \"liquid\" kind_y = \"vapor\" case ( \"dew\" ) kind_z = \"vapor\" kind_y = \"liquid\" case default kind_z = \"stable\" kind_y = \"stable\" end select call model % lnphi_pt (& z , P = P , T = T , V = Vz , root_type = kind_z , & lnphi = lnphip_z , dlnPhidt = dlnphi_dt_z , & dlnPhidp = dlnphi_dp_z , dlnphidn = dlnphi_dn_z & ) call model % lnphi_pt (& y , P = P , T = T , V = Vy , root_type = kind_y , & lnphi = lnphip_y , dlnPhidt = dlnphi_dt_y , & dlnPhidp = dlnphi_dp_y , dlnphidn = dlnphi_dn_y & ) F (: nc ) = X (: nc ) + lnphip_y - lnphip_z F ( nc + 1 ) = sum ( y - z ) F ( nc + 2 ) = X ( ns ) - S ! Jacobian Matrix do i = 1 , nc do j = 1 , nc df ( i , j ) = y ( j ) * dlnphi_dn_y ( i , j ) end do df ( i , i ) = df ( i , i ) + 1 df ( i , nc + 2 ) = sum ( K * dlnphi_dn_y ( i , :) * dzda - dlnphi_dn_z ( i , :) * dzda ) end do df (: nc , nc + 1 ) = P * ( dlnphi_dp_y - dlnphi_dp_z ) df ( nc + 1 , : nc ) = y df ( nc + 1 , nc + 2 ) = sum ( dzda * ( K - 1 )) df ( nc + 2 , :) = 0 df ( nc + 2 , ns ) = 1 dFdS = 0 dFdS ( nc + 2 ) = - 1 end subroutine foo subroutine update_spec ( X , ns , S , dS , dXdS , step_iters ) !! Update the specification during continuation. real ( pr ), intent ( in out ) :: X (:) !! Vector of variables [lnK_i \\dots , lnT, lnP] integer , intent ( in out ) :: ns !! Number of specified variable in the vector real ( pr ), intent ( in out ) :: S !! Variable specification value real ( pr ), intent ( in out ) :: dS !! Step in specification real ( pr ), intent ( in out ) :: dXdS (:) !! Variation of variables with respect to specification integer , intent ( in ) :: step_iters !! Iterations used in the solver real ( pr ) :: maxdS ! ===================================================================== ! Update specification ! - Dont select T or P near critical points ! - Update dS wrt specification units ! - Set step ! --------------------------------------------------------------------- write ( 1 , * ) X if ( maxval ( abs ( X (: nc ))) < 0.5_pr ) then ns = maxloc ( abs ( dXdS (: nc )), dim = 1 ) maxdS = 0.01_pr else ns = maxloc ( abs ( dXdS ), dim = 1 ) maxdS = 0.5_pr end if dS = dXdS ( ns ) * dS dXdS = dXdS / dXdS ( ns ) dS = sign ( 1.0_pr , dS ) * minval ([ & max ( sqrt ( abs ( X ( ns )) / 1 0._pr ), 0.1_pr ), & abs ( dS ) * 3 / step_iters & ] & ) dS = sign ( 1.0_pr , dS ) * maxval ([ abs ( dS ), maxdS ]) do while ( abs ( dXdS ( nc + 2 ) * dS ) > 0.1_pr ) dS = dS / 2 end do call save_point ( X , step_iters ) call detect_critical ( X , dXdS , ns , S , dS ) end subroutine update_spec subroutine save_point ( X , iters ) !! Save the converged point real ( pr ), intent ( in ) :: X (:) integer , intent ( in ) :: iters type ( EquilibriumState ) :: point real ( pr ) :: y ( nc ), P , alpha P = exp ( X ( nc + 1 )) alpha = X ( nc + 2 ) y = exp ( X (: nc )) * z select case ( kind ) case ( \"bubble\" ) point = EquilibriumState (& kind = kind , x = z , Vx = Vz , y = y , Vy = Vy , & T = T , P = P , beta = 0._pr , iters = iters & ) case ( \"dew\" ) point = EquilibriumState (& kind = kind , x = y , Vx = Vy , y = z , Vy = Vz , & T = T , P = P , beta = 0._pr , iters = iters & ) case default point = EquilibriumState (& kind = \"saturation\" , x = z , Vx = Vz , y = y , Vy = Vy , & T = T , P = P , beta = 0._pr , iters = iters & ) end select envelopes % alpha = [ envelopes % alpha , alpha ] envelopes % points = [ envelopes % points , point ] end subroutine save_point subroutine detect_critical ( X , dXdS , ns , S , dS ) !! # `detect_critical` !! Critical point detection !! !! # Description !! If the values of lnK (X[:nc]) change sign then a critical point !! Has passed, since for this to happen all variables should pass !! through zero. Near critical points (lnK < 0.05) points are harder !! to converge, so more steps in the extrapolation vector are made to !! jump over the critical point. !! If the critical point is detected then the kind of the point is !! changed and the point is saved using an interpolation knowing that !! !! !! X_c = a * X + (1-a)*X_{new} !! !! !! With X_c is the variables at the critical point, X_{new} !! is the new initialization point of the method and a is the !! parameter to interpolate the values. This subroutine finds the !! value of a to obtain X_c. real ( pr ), intent ( in out ) :: X (:) !! Vector of variables real ( pr ), intent ( in out ) :: dXdS (:) !! Variation of variables wrt S integer , intent ( in out ) :: ns !! Number of specified variable real ( pr ), intent ( in out ) :: S !! Specification value real ( pr ), intent ( in out ) :: dS !! Step in specification real ( pr ) :: Xc ( nc + 2 ) !! Value at (near) critical point real ( pr ) :: a !! Parameter for interpolation real ( pr ) :: Xold ( size ( X )) !! Old value of X real ( pr ) :: Xnew ( size ( X )) !! Value of the next initialization Xold = X do while ( maxval ( abs ( X (: nc ))) < 0.03_pr . and . abs ( Vz - Vy ) < 0.01_pr ) ! If near a critical point, jump over it S = S + dS X = X + dXdS * dS end do Xnew = X + dXdS * dS if ( all ( Xold (: nc ) * ( Xnew (: nc )) < 0 )) then select case ( kind ) case ( \"dew\" ) kind = \"bubble\" case ( \"bubble\" ) kind = \"dew\" case default kind = \"liquid-liquid\" end select ! 0 = a*X(ns) + (1-a)*Xnew(ns) Interpolation equation to get X(ns) = 0 a = - Xnew ( ns ) / ( X ( ns ) - Xnew ( ns )) Xc = a * X + ( 1 - a ) * Xnew envelopes % cps = [& envelopes % cps , & CriticalPoint ( P = exp ( Xc ( nc + 1 )), alpha = Xc ( nc + 2 )) & ] X = Xc + dXdS * dS end if end subroutine detect_critical end function px_envelope_2ph subroutine get_z ( alpha , z_0 , z_inj , z , dzda ) !! Calculate the fluid composition based on an amount of addition !! of second fluid. !! !! The injection can be considered as two kinds of injection: !! - Displacement: z = \\alpha z_i + (1-\\alpha) z_0 !! - Addition: z = \\frac{\\alpha z_i + (1-\\alpha) z_0}{\\sum_{i=1}^N \\alpha z_i + (1-\\alpha) z_0} real ( pr ), intent ( in ) :: alpha !! Addition percentaje \\alpha real ( pr ), intent ( in ) :: z_inj (:) real ( pr ), intent ( in ) :: z_0 (:) real ( pr ), intent ( out ) :: z ( size ( z_0 )) !! New composition real ( pr ), optional , intent ( out ) :: dzda ( size ( z_0 )) !! Derivative wrt \\alpha z = z_inj * alpha + ( 1.0_pr - alpha ) * z_0 if ( present ( dzda )) dzda = z_inj - z_0 end subroutine get_z end module yaeos__equilibria_boundaries_phase_envelopes_px","tags":"","loc":"sourcefile/phase_envelopes_px.f90.html"},{"title":"nrtl.f90 – yaeos","text":"Source Code module yaeos__models_ge_NRTL use yaeos__tapenade_ge_api , only : gemodeltapenade use yaeos__tapenade_interfaces use yaeos__constants , only : pr , R implicit none type , extends ( GeModelTapenade ) :: NRTL !! Non-Random-Two-Liquid model !! !! !! G^E = nRT \\cdot \\sum_i x_i \\frac{\\sum_j x_j \\tau_{ji} G_{ji}}{\\sum_j x_j G_{ji}} !! !! !! with: !! !! \\tau_{ij} = A_{ij} + \\frac{B_{ij}}{T} !! !! G_{ij} = -\\frac{C}{tau_ij} real ( pr ), allocatable :: a (:, :) !! A_{ij} matrix real ( pr ), allocatable :: b (:, :) !! B_{ij} matrix real ( pr ), allocatable :: c (:, :) !! C_{ij} matrix contains procedure :: ge => excess_gibbs procedure :: ge_b => excess_gibbs_b procedure :: ge_d => excess_gibbs_d procedure :: ge_d_b => excess_gibbs_d_b procedure :: ge_d_d => excess_gibbs_d_d end type NRTL interface NRTL module procedure :: init end interface contains type ( NRTL ) function init ( a , b , c ) real ( pr ), intent ( in ) :: a (:, :) real ( pr ), intent ( in ) :: b (:, :) real ( pr ), intent ( in ) :: c (:, :) init % a = a init % b = b init % c = c end function subroutine EXCESS_GIBBS_D_D_D ( model , n , nd , t , td1 , td0 , td , ge , ged1 & & , ged0 , ged0d , ged , gedd0 , gedd , geddd ) implicit none class ( NRTL ) :: model real ( pr ), intent ( IN ) :: n (:) real ( pr ), intent ( IN ) :: nd (:) real ( pr ), intent ( IN ) :: t real ( pr ), intent ( IN ) :: td1 real ( pr ), intent ( IN ) :: td0 real ( pr ), intent ( IN ) :: td real ( pr ), intent ( OUT ) :: ge real ( pr ), intent ( OUT ) :: ged1 real ( pr ), intent ( OUT ) :: ged0 real ( pr ), intent ( OUT ) :: ged0d real ( pr ), intent ( OUT ) :: ged real ( pr ), intent ( OUT ) :: gedd0 real ( pr ), intent ( OUT ) :: gedd real ( pr ), intent ( OUT ) :: geddd real ( pr ) :: x ( size ( n )), g ( size ( n ), size ( n )), tau ( size ( n ), size ( n )) real ( pr ) :: gd1 ( size ( n ), size ( n )), taud1 ( size ( n ), size ( n )) real ( pr ) :: gd0 ( size ( n ), size ( n )), taud0 ( size ( n ), size ( n )) real ( pr ) :: gd0d ( size ( n ), size ( n )), taud0d ( size ( n ), size ( n )) real ( pr ) :: xd ( size ( n )), gd ( size ( n ), size ( n )), taud ( size ( n ), size ( n )) real ( pr ) :: gdd0 ( size ( n ), size ( n )), taudd0 ( size ( n ), size ( n )) real ( pr ) :: gdd ( size ( n ), size ( n )), taudd ( size ( n ), size ( n )) real ( pr ) :: gddd ( size ( n ), size ( n )), tauddd ( size ( n ), size ( n )) real ( pr ) :: a ( size ( n ), size ( n )), b ( size ( n ), size ( n )), c ( size ( n ), size (& & n )) real ( pr ) :: down integer :: i , j intrinsic SUM intrinsic EXP intrinsic SIZE real ( pr ), dimension ( size ( n )) :: arg1 real ( pr ), dimension ( size ( n )) :: arg1d1 real ( pr ), dimension ( size ( n )) :: arg1d0 real ( pr ), dimension ( size ( n )) :: arg1d0d real ( pr ), dimension ( size ( n )) :: arg1d real ( pr ), dimension ( size ( n )) :: arg1dd0 real ( pr ), dimension ( size ( n )) :: arg1dd real ( pr ), dimension ( size ( n )) :: arg1ddd real ( pr ), dimension ( size ( n )) :: arg2 real ( pr ), dimension ( size ( n )) :: arg2d1 real ( pr ), dimension ( size ( n )) :: arg2d0 real ( pr ), dimension ( size ( n )) :: arg2d0d real ( pr ), dimension ( size ( n )) :: arg2d real ( pr ), dimension ( size ( n )) :: arg2dd0 real ( pr ), dimension ( size ( n )) :: arg2dd real ( pr ), dimension ( size ( n )) :: arg2ddd real ( pr ) :: temp real ( pr ) :: tempd0 real ( pr ) :: tempd real ( pr ) :: tempdd real ( pr ) :: temp0 real ( pr ) :: temp0d0 real ( pr ) :: temp0d real ( pr ) :: temp0dd real ( pr ) :: temp1 real ( pr ) :: temp1d0 real ( pr ) :: temp1d real ( pr ) :: temp1dd real ( pr ), dimension ( size ( b , 1 ), size ( b , 2 )) :: temp2 real ( pr ), dimension ( size ( b , 1 ), size ( b , 2 )) :: temp2d real ( pr ), dimension ( size ( n ), size ( n )) :: temp3 real ( pr ), dimension ( size ( n ), size ( n )) :: temp3d real ( pr ), dimension ( size ( n )) :: temp4 real ( pr ), dimension ( size ( n )) :: temp4d real ( pr ) :: temp5 real ( pr ) :: temp5d real ( pr ) :: temp6 real ( pr ) :: temp6d real ( pr ), dimension ( size ( b , 1 ), size ( b , 2 )) :: temp7 real ( pr ), dimension ( size ( n ), size ( n )) :: temp8 real ( pr ), dimension ( size ( n )) :: temp9 real ( pr ) :: temp10 real ( pr ) :: temp11 temp = sum ( n ) xd = ( nd - n * sum ( nd ) / temp ) / temp x = n / temp temp7 = model % b (:, :) * td / ( t * t ) temp2d = - ( temp7 * 2 * td1 / t ) temp2 = temp7 tauddd = td0 * 2 * ( temp2d - temp2 * td1 / t ) / t taudd = temp2 * 2 * td0 / t taudd0 = - temp2d taud = - temp2 temp7 = model % b (:, :) * td0 / ( t * t ) taud0d = temp7 * 2 * td1 / t taud0 = - temp7 taud1 = - ( model % b (:, :) * td1 / t ** 2 ) tau = model % a (:, :) + model % b (:, :) / t temp3d = - ( exp ( - ( model % c * tau )) * model % c * taud1 ) temp3 = exp ( - ( model % c * tau )) temp8 = exp ( - ( model % c * tau )) gddd = - ( model % c * ( taudd * temp3d + temp3 * tauddd - model % c * ( temp8 * ( taud0 * & & taudd0 + taud * taud0d ) - taud * taud0 * exp ( - ( model % c * tau )) * model % c * taud1 ))& & ) gdd = - ( model % c * ( temp3 * taudd - model % c * ( temp8 * ( taud * taud0 )))) gdd0 = - ( model % c * ( taud * temp3d + temp3 * taudd0 )) gd = - ( model % c * ( temp3 * taud )) temp8 = exp ( - ( model % c * tau )) gd0d = - ( model % c * ( temp8 * taud0d - taud0 * exp ( - ( model % c * tau )) * model % c * & & taud1 )) gd0 = - ( model % c * ( temp8 * taud0 )) gd1 = - ( exp ( - ( model % c * tau )) * model % c * taud1 ) g = exp ( - ( model % c * tau )) ge = 0 ged = 0.0_pr gedd = 0.0_pr ged0 = 0.0_pr gedd0 = 0.0_pr geddd = 0.0_pr ged0d = 0.0_pr ged1 = 0.0_pr do i = 1 , size ( n ) temp4d = xd (:) * taud1 (:, i ) + x (:) * taudd0 (:, i ) temp4 = xd (:) * tau (:, i ) + x (:) * taud (:, i ) temp9 = xd (:) * taud0 (:, i ) + x (:) * taudd (:, i ) arg1ddd (:) = gd0 (:, i ) * temp4d + temp4 * gd0d (:, i ) + temp9 * gd1 (:, i )& & + g (:, i ) * ( xd (:) * taud0d (:, i ) + x (:) * tauddd (:, i )) + x (:) * ( taud0 (:& & , i ) * gdd0 (:, i ) + gd (:, i ) * taud0d (:, i ) + gdd (:, i ) * taud1 (:, i ) + tau (& & :, i ) * gddd (:, i )) arg1dd (:) = temp4 * gd0 (:, i ) + g (:, i ) * temp9 + x (:) * ( gd (:, i ) * taud0 & & (:, i ) + tau (:, i ) * gdd (:, i )) arg1dd0 (:) = temp4 * gd1 (:, i ) + g (:, i ) * temp4d + x (:) * ( gd (:, i ) * & & taud1 (:, i ) + tau (:, i ) * gdd0 (:, i )) arg1d (:) = g (:, i ) * temp4 + x (:) * ( tau (:, i ) * gd (:, i )) arg1d0d (:) = x (:) * ( taud0 (:, i ) * gd1 (:, i ) + g (:, i ) * taud0d (:, i ) + gd0 (& & :, i ) * taud1 (:, i ) + tau (:, i ) * gd0d (:, i )) arg1d0 (:) = x (:) * ( g (:, i ) * taud0 (:, i ) + tau (:, i ) * gd0 (:, i )) arg1d1 (:) = x (:) * ( g (:, i ) * taud1 (:, i ) + tau (:, i ) * gd1 (:, i )) arg1 (:) = x (:) * tau (:, i ) * g (:, i ) arg2ddd (:) = xd (:) * gd0d (:, i ) + x (:) * gddd (:, i ) arg2dd (:) = xd (:) * gd0 (:, i ) + x (:) * gdd (:, i ) arg2dd0 (:) = xd (:) * gd1 (:, i ) + x (:) * gdd0 (:, i ) arg2d (:) = g (:, i ) * xd (:) + x (:) * gd (:, i ) arg2d0d (:) = x (:) * gd0d (:, i ) arg2d0 (:) = x (:) * gd0 (:, i ) arg2d1 (:) = x (:) * gd1 (:, i ) arg2 (:) = x (:) * g (:, i ) tempdd = sum ( arg2d0d (:)) tempd = sum ( arg2d0 (:)) tempd0 = sum ( arg2d1 (:)) temp = sum ( arg2 (:)) temp0dd = sum ( arg1d0d (:)) temp0d = sum ( arg1d0 (:)) temp0d0 = sum ( arg1d1 (:)) temp0 = sum ( arg1 (:)) temp10 = temp0 * tempd / temp temp11 = ( temp0d - temp10 ) / temp temp1dd = x ( i ) * ( temp0dd - ( tempd * temp0d0 + temp0 * tempdd - temp10 * tempd0 )& & / temp - temp11 * tempd0 ) / temp temp1d = x ( i ) * temp11 temp1d0 = x ( i ) * ( temp0d0 - temp0 * tempd0 / temp ) / temp temp1 = x ( i ) * temp0 / temp temp5d = sum ( arg2dd0 (:)) temp5 = sum ( arg2d (:)) temp11 = ( xd ( i ) * temp0 + x ( i ) * sum ( arg1d (:)) - temp1 * temp5 ) / temp temp6d = ( xd ( i ) * temp0d0 + x ( i ) * sum ( arg1dd0 (:)) - temp5 * temp1d0 - temp1 * & & temp5d - temp11 * tempd0 ) / temp temp6 = temp11 temp11 = sum ( arg2dd (:)) temp10 = ( xd ( i ) * temp0d + x ( i ) * sum ( arg1dd (:)) - temp5 * temp1d - temp1 * & & temp11 - temp6 * tempd ) / temp geddd = geddd + ( xd ( i ) * temp0dd + x ( i ) * sum ( arg1ddd (:)) - temp1d * temp5d - & & temp5 * temp1dd - temp11 * temp1d0 - temp1 * sum ( arg2ddd (:)) - tempd * temp6d - & & temp6 * tempdd - temp10 * tempd0 ) / temp gedd = gedd + temp10 gedd0 = gedd0 + temp6d ged = ged + temp6 ged0d = ged0d + temp1dd ged0 = ged0 + temp1d ged1 = ged1 + temp1d0 ge = ge + temp1 end do temp1 = sum ( n ) temp6 = sum ( nd ) geddd = r * ( temp6 * ( td0 * ged1 + ged0 * td1 + t * ged0d ) + temp1 * ( td * ged0d + td0 * & & gedd0 + gedd * td1 + t * geddd )) gedd = r * ( temp6 * ( ge * td0 + t * ged0 ) + temp1 * ( td * ged0 + ged * td0 + t * gedd )) gedd0 = r * ( temp6 * ( ge * td1 + t * ged1 ) + temp1 * ( td * ged1 + ged * td1 + t * gedd0 )) ged = r * ( temp6 * ( t * ge ) + temp1 * ( td * ge + t * ged )) ged0d = r * temp1 * ( td0 * ged1 + ged0 * td1 + t * ged0d ) ged0 = r * temp1 * ( ge * td0 + t * ged0 ) ged1 = r * temp1 * ( ge * td1 + t * ged1 ) ge = r * ( temp1 * ( t * ge )) end subroutine EXCESS_GIBBS_D_D_D subroutine EXCESS_GIBBS_D_D ( model , n , nd , t , td0 , td , ge , ged0 , ged , & & gedd ) implicit none class ( NRTL ) :: model real ( pr ), intent ( IN ) :: n (:) real ( pr ), intent ( IN ) :: nd (:) real ( pr ), intent ( IN ) :: t real ( pr ), intent ( IN ) :: td0 real ( pr ), intent ( IN ) :: td real ( pr ), intent ( OUT ) :: ge real ( pr ), intent ( OUT ) :: ged0 real ( pr ), intent ( OUT ) :: ged real ( pr ), intent ( OUT ) :: gedd real ( pr ) :: x ( size ( n )), g ( size ( n ), size ( n )), tau ( size ( n ), size ( n )) real ( pr ) :: gd0 ( size ( n ), size ( n )), taud0 ( size ( n ), size ( n )) real ( pr ) :: xd ( size ( n )), gd ( size ( n ), size ( n )), taud ( size ( n ), size ( n )) real ( pr ) :: gdd ( size ( n ), size ( n )), taudd ( size ( n ), size ( n )) real ( pr ) :: a ( size ( n ), size ( n )), b ( size ( n ), size ( n )), c ( size ( n ), size (& & n )) real ( pr ) :: down integer :: i , j intrinsic SUM intrinsic EXP intrinsic SIZE real ( pr ), dimension ( size ( n )) :: arg1 real ( pr ), dimension ( size ( n )) :: arg1d0 real ( pr ), dimension ( size ( n )) :: arg1d real ( pr ), dimension ( size ( n )) :: arg1dd real ( pr ), dimension ( size ( n )) :: arg2 real ( pr ), dimension ( size ( n )) :: arg2d0 real ( pr ), dimension ( size ( n )) :: arg2d real ( pr ), dimension ( size ( n )) :: arg2dd real ( pr ) :: temp real ( pr ) :: tempd real ( pr ) :: temp0 real ( pr ) :: temp0d real ( pr ) :: temp1 real ( pr ) :: temp1d real ( pr ), dimension ( size ( b , 1 ), size ( b , 2 )) :: temp2 real ( pr ), dimension ( size ( n ), size ( n )) :: temp3 real ( pr ), dimension ( size ( n )) :: temp4 real ( pr ) :: temp5 real ( pr ) :: temp6 temp = sum ( n ) xd = ( nd - n * sum ( nd ) / temp ) / temp x = n / temp temp2 = model % b (:, :) * td / ( t * t ) taudd = temp2 * 2 * td0 / t taud = - temp2 taud0 = - ( model % b (:, :) * td0 / t ** 2 ) tau = model % a (:, :) + model % b (:, :) / t temp3 = exp ( - ( model % c * tau )) gdd = - ( model % c * ( temp3 * taudd - taud * exp ( - ( model % c * tau )) * model % c * taud0 )& & ) gd = - ( model % c * ( temp3 * taud )) gd0 = - ( exp ( - ( model % c * tau )) * model % c * taud0 ) g = exp ( - ( model % c * tau )) ge = 0 ged = 0.0_pr gedd = 0.0_pr ged0 = 0.0_pr do i = 1 , size ( n ) temp4 = xd (:) * tau (:, i ) + x (:) * taud (:, i ) arg1dd (:) = temp4 * gd0 (:, i ) + g (:, i ) * ( xd (:) * taud0 (:, i ) + x (:) * & & taudd (:, i )) + x (:) * ( gd (:, i ) * taud0 (:, i ) + tau (:, i ) * gdd (:, i )) arg1d (:) = g (:, i ) * temp4 + x (:) * ( tau (:, i ) * gd (:, i )) arg1d0 (:) = x (:) * ( g (:, i ) * taud0 (:, i ) + tau (:, i ) * gd0 (:, i )) arg1 (:) = x (:) * tau (:, i ) * g (:, i ) arg2dd (:) = xd (:) * gd0 (:, i ) + x (:) * gdd (:, i ) arg2d (:) = g (:, i ) * xd (:) + x (:) * gd (:, i ) arg2d0 (:) = x (:) * gd0 (:, i ) arg2 (:) = x (:) * g (:, i ) tempd = sum ( arg2d0 (:)) temp = sum ( arg2 (:)) temp0d = sum ( arg1d0 (:)) temp0 = sum ( arg1 (:)) temp1d = x ( i ) * ( temp0d - temp0 * tempd / temp ) / temp temp1 = x ( i ) * temp0 / temp temp5 = sum ( arg2d (:)) temp6 = ( xd ( i ) * temp0 + x ( i ) * sum ( arg1d (:)) - temp1 * temp5 ) / temp gedd = gedd + ( xd ( i ) * temp0d + x ( i ) * sum ( arg1dd (:)) - temp5 * temp1d - temp1 & & * sum ( arg2dd (:)) - temp6 * tempd ) / temp ged = ged + temp6 ged0 = ged0 + temp1d ge = ge + temp1 end do temp1 = sum ( n ) temp6 = sum ( nd ) gedd = r * ( temp6 * ( ge * td0 + t * ged0 ) + temp1 * ( td * ged0 + ged * td0 + t * gedd )) ged = r * ( temp6 * ( t * ge ) + temp1 * ( td * ge + t * ged )) ged0 = r * temp1 * ( ge * td0 + t * ged0 ) ge = r * ( temp1 * ( t * ge )) end subroutine EXCESS_GIBBS_D_D subroutine EXCESS_GIBBS_D_B ( model , n , nb , nd , ndb , t , tb , td , tdb , ge & & , geb , ged , gedb ) implicit none class ( NRTL ) :: model real ( pr ), intent ( IN ) :: n (:) real ( pr ) :: nb (:) real ( pr ), intent ( IN ) :: nd (:) real ( pr ) :: ndb (:) real ( pr ), intent ( IN ) :: t real ( pr ) :: tb real ( pr ), intent ( IN ) :: td real ( pr ) :: tdb real ( pr ) :: ge real ( pr ) :: geb real ( pr ) :: ged real ( pr ) :: gedb real ( pr ) :: x ( size ( n )), g ( size ( n ), size ( n )), tau ( size ( n ), size ( n )) real ( pr ) :: xb ( size ( n )), gb ( size ( n ), size ( n )), taub ( size ( n ), size ( n )) real ( pr ) :: xd ( size ( n )), gd ( size ( n ), size ( n )), taud ( size ( n ), size ( n )) real ( pr ) :: xdb ( size ( n )), gdb ( size ( n ), size ( n )), taudb ( size ( n ), size ( n & & )) real ( pr ) :: a ( size ( n ), size ( n )), b ( size ( n ), size ( n )), c ( size ( n ), size (& & n )) real ( pr ) :: down integer :: i , j intrinsic SUM intrinsic EXP intrinsic SIZE real ( pr ), dimension ( size ( n )) :: arg1 real ( pr ), dimension ( size ( n )) :: arg1b real ( pr ), dimension ( size ( n )) :: arg1d real ( pr ), dimension ( size ( n )) :: arg1db real ( pr ), dimension ( size ( n )) :: arg2 real ( pr ), dimension ( size ( n )) :: arg2b real ( pr ), dimension ( size ( n )) :: arg2d real ( pr ), dimension ( size ( n )) :: arg2db real ( pr ) :: temp real ( pr ) :: tempb real ( pr ) :: temp0 real ( pr ) :: temp0b real ( pr ) :: temp1 real ( pr ) :: temp1b real ( pr ), dimension ( size ( n , 1 )) :: tempb0 real ( pr ), dimension ( size ( n , 1 )) :: temp2 real ( pr ) :: temp3 real ( pr ), dimension ( size ( n , 1 )) :: tempb1 real ( pr ) :: tempb2 real ( pr ), dimension ( size ( n )) :: tempb3 real ( pr ) :: temp4 real ( pr ) :: temp5 real ( pr ) :: tempb4 real ( pr ) :: tempb5 integer :: ad_to integer :: arg10 real ( pr ) :: result1 temp = sum ( n ) xd = ( nd - n * sum ( nd ) / temp ) / temp x = n / temp taud = - ( model % b (:, :) * td / t ** 2 ) tau = model % a (:, :) + model % b (:, :) / t gd = - ( exp ( - ( model % c * tau )) * model % c * taud ) g = exp ( - ( model % c * tau )) ge = 0 ged = 0.0_pr do i = 1 , size ( n ) arg10 = size ( n ) call PUSHREAL8ARRAY ( arg1d , arg10 ) arg1d (:) = g (:, i ) * ( tau (:, i ) * xd (:) + x (:) * taud (:, i )) + x (:) * tau (:& & , i ) * gd (:, i ) arg1 (:) = x (:) * tau (:, i ) * g (:, i ) arg2d (:) = g (:, i ) * xd (:) + x (:) * gd (:, i ) arg2 (:) = x (:) * g (:, i ) call PUSHREAL8 ( temp ) temp = sum ( arg2 (:)) call PUSHREAL8 ( temp0 ) temp0 = sum ( arg1 (:)) temp1 = x ( i ) * temp0 / temp ged = ged + ( temp0 * xd ( i ) + x ( i ) * sum ( arg1d (:)) - temp1 * sum ( arg2d (:))) / & & temp ge = ge + temp1 end do call PUSHINTEGER4 ( i - 1 ) temp1 = sum ( n ) tempb4 = r * geb geb = temp1 * t * tempb4 temp1b = t * ge * tempb4 tb = tb + temp1 * ge * tempb4 tempb4 = r * gedb tempb5 = sum ( nd ) * tempb4 ndb = ndb + t * ge * tempb4 temp1b = temp1b + ( ge * td + t * ged ) * tempb4 tempb2 = temp1 * tempb4 gedb = t * tempb2 geb = geb + td * tempb2 + t * tempb5 tdb = tdb + ge * tempb2 tb = tb + ged * tempb2 + ge * tempb5 nb = nb + temp1b taudb = 0.0_pr taub = 0.0_pr gb = 0.0_pr xdb = 0.0_pr xb = 0.0_pr gdb = 0.0_pr call POPINTEGER4 ( ad_to ) do i = ad_to , 1 , - 1 tempb2 = gedb / temp arg2d (:) = g (:, i ) * xd (:) + x (:) * gd (:, i ) temp5 = sum ( arg2d (:)) temp1 = x ( i ) * temp0 / temp temp1b = geb - temp5 * tempb2 arg1db = 0.0_pr arg2db = 0.0_pr temp4 = sum ( arg1d (:)) temp0b = xd ( i ) * tempb2 xdb ( i ) = xdb ( i ) + temp0 * tempb2 xb ( i ) = xb ( i ) + temp4 * tempb2 + temp0 * temp1b / temp arg1db = x ( i ) * tempb2 arg2db = - ( temp1 * tempb2 ) tempb = - (( temp0 * xd ( i ) + x ( i ) * temp4 - temp1 * temp5 ) * tempb2 / temp ) tempb2 = x ( i ) * temp1b / temp temp0b = temp0b + tempb2 tempb = tempb - temp0 * tempb2 / temp arg1b = 0.0_pr call POPREAL8 ( temp0 ) arg1b = temp0b arg2b = 0.0_pr call POPREAL8 ( temp ) arg2b = tempb gb (:, i ) = gb (:, i ) + x * arg2b + xd * arg2db + x * tau (:, i ) * arg1b + (& & tau (:, i ) * xd + x * taud (:, i )) * arg1db gdb (:, i ) = gdb (:, i ) + x * arg2db + x * tau (:, i ) * arg1db arg10 = size ( n ) call POPREAL8ARRAY ( arg1d , arg10 ) tempb3 = g (:, i ) * arg1db xb = xb + g (:, i ) * arg2b + gd (:, i ) * arg2db + tau (:, i ) * g (:, i ) * & & arg1b + tau (:, i ) * gd (:, i ) * arg1db + taud (:, i ) * tempb3 xdb = xdb + g (:, i ) * arg2db + tau (:, i ) * tempb3 taub (:, i ) = taub (:, i ) + x * g (:, i ) * arg1b + x * gd (:, i ) * arg1db + xd & & * tempb3 taudb (:, i ) = taudb (:, i ) + x * tempb3 end do temp3 = sum ( nd ) tempb0 = xdb / temp tempb1 = - ( temp3 * tempb0 / temp ) temp2 = n / temp result1 = sum (( nd - temp3 * temp2 ) * tempb0 ) tempb = - ( sum ( n * xb ) / temp ** 2 ) - result1 / temp - sum ( temp2 * tempb1 ) taub = taub + model % c ** 2 * exp ( - ( model % c * tau )) * taud * gdb - model % c * exp (& & - ( model % c * tau )) * gb taudb = taudb - exp ( - ( model % c * tau )) * model % c * gdb tempb2 = - ( sum ( model % b * taudb ) / t ** 2 ) tb = tb - sum ( model % b * taub ) / t ** 2 - 2 * td * tempb2 / t tdb = tdb + tempb2 nb = nb + xb / temp + tempb1 + tempb ndb = ndb + tempb0 - sum ( temp2 * tempb0 ) gedb = 0.0_pr geb = 0.0_pr end subroutine EXCESS_GIBBS_D_B subroutine EXCESS_GIBBS_D ( model , n , nd , t , td , ge , ged ) implicit none class ( NRTL ) :: model real ( pr ), intent ( IN ) :: n (:) real ( pr ), intent ( IN ) :: nd (:) real ( pr ), intent ( IN ) :: t real ( pr ), intent ( IN ) :: td real ( pr ), intent ( OUT ) :: ge real ( pr ), intent ( OUT ) :: ged real ( pr ) :: x ( size ( n )), g ( size ( n ), size ( n )), tau ( size ( n ), size ( n )) real ( pr ) :: xd ( size ( n )), gd ( size ( n ), size ( n )), taud ( size ( n ), size ( n )) real ( pr ) :: a ( size ( n ), size ( n )), b ( size ( n ), size ( n )), c ( size ( n ), size (& & n )) real ( pr ) :: down integer :: i , j intrinsic SUM intrinsic EXP intrinsic SIZE real ( pr ), dimension ( size ( n )) :: arg1 real ( pr ), dimension ( size ( n )) :: arg1d real ( pr ), dimension ( size ( n )) :: arg2 real ( pr ), dimension ( size ( n )) :: arg2d real ( pr ) :: temp real ( pr ) :: temp0 real ( pr ) :: temp1 temp = sum ( n ) xd = ( nd - n * sum ( nd ) / temp ) / temp x = n / temp taud = - ( model % b (:, :) * td / t ** 2 ) tau = model % a (:, :) + model % b (:, :) / t gd = - ( exp ( - ( model % c * tau )) * model % c * taud ) g = exp ( - ( model % c * tau )) ge = 0 ged = 0.0_pr do i = 1 , size ( n ) arg1d (:) = g (:, i ) * ( tau (:, i ) * xd (:) + x (:) * taud (:, i )) + x (:) * tau (:& & , i ) * gd (:, i ) arg1 (:) = x (:) * tau (:, i ) * g (:, i ) arg2d (:) = g (:, i ) * xd (:) + x (:) * gd (:, i ) arg2 (:) = x (:) * g (:, i ) temp = sum ( arg2 (:)) temp0 = sum ( arg1 (:)) temp1 = x ( i ) * temp0 / temp ged = ged + ( temp0 * xd ( i ) + x ( i ) * sum ( arg1d (:)) - temp1 * sum ( arg2d (:))) / & & temp ge = ge + temp1 end do temp1 = sum ( n ) ged = r * ( t * ge * sum ( nd ) + temp1 * ( ge * td + t * ged )) ge = r * ( temp1 * ( t * ge )) end subroutine EXCESS_GIBBS_D subroutine EXCESS_GIBBS_B ( model , n , nb , t , tb , ge , geb ) implicit none class ( NRTL ) :: model real ( pr ), intent ( IN ) :: n (:) real ( pr ) :: nb (:) real ( pr ), intent ( IN ) :: t real ( pr ) :: tb real ( pr ) :: ge real ( pr ) :: geb real ( pr ) :: x ( size ( n )), g ( size ( n ), size ( n )), tau ( size ( n ), size ( n )) real ( pr ) :: xb ( size ( n )), gb ( size ( n ), size ( n )), taub ( size ( n ), size ( n )) real ( pr ) :: a ( size ( n ), size ( n )), b ( size ( n ), size ( n )), c ( size ( n ), size (& & n )) real ( pr ) :: down integer :: i , j intrinsic SUM intrinsic EXP intrinsic SIZE real ( pr ), dimension ( size ( n )) :: arg1 real ( pr ), dimension ( size ( n )) :: arg1b real ( pr ), dimension ( size ( n )) :: arg2 real ( pr ), dimension ( size ( n )) :: arg2b real ( pr ) :: temp real ( pr ) :: tempb real ( pr ) :: temp0 real ( pr ) :: tempb0 integer :: ad_to x = n / sum ( n ) tau = model % a (:, :) + model % b (:, :) / t g = exp ( - ( model % c * tau )) ge = 0 do i = 1 , size ( n ) arg1 (:) = x (:) * tau (:, i ) * g (:, i ) arg2 (:) = x (:) * g (:, i ) ge = ge + x ( i ) * sum ( arg1 (:)) / sum ( arg2 (:)) end do call PUSHINTEGER4 ( i - 1 ) nb = 0.0_pr nb = t * ge * r * geb tempb0 = sum ( n ) * r * geb geb = t * tempb0 tb = ge * tempb0 taub = 0.0_pr gb = 0.0_pr xb = 0.0_pr call POPINTEGER4 ( ad_to ) do i = ad_to , 1 , - 1 arg1 (:) = x (:) * tau (:, i ) * g (:, i ) arg2 (:) = x (:) * g (:, i ) arg1b = 0.0_pr arg2b = 0.0_pr temp = sum ( arg2 (:)) temp0 = sum ( arg1 (:)) tempb = geb / temp xb ( i ) = xb ( i ) + temp0 * tempb arg1b = x ( i ) * tempb arg2b = - ( x ( i ) * temp0 * tempb / temp ) xb = xb + g (:, i ) * arg2b + tau (:, i ) * g (:, i ) * arg1b gb (:, i ) = gb (:, i ) + x * arg2b + x * tau (:, i ) * arg1b taub (:, i ) = taub (:, i ) + x * g (:, i ) * arg1b end do taub = taub - model % c * exp ( - ( model % c * tau )) * gb tb = tb - sum ( model % b * taub ) / t ** 2 temp = sum ( n ) nb = nb + xb / temp - sum ( n * xb ) / temp ** 2 geb = 0.0_pr end subroutine EXCESS_GIBBS_B subroutine EXCESS_GIBBS ( model , n , t , ge ) implicit none class ( NRTL ) :: model real ( pr ), intent ( IN ) :: n (:) real ( pr ), intent ( IN ) :: t real ( pr ), intent ( OUT ) :: ge real ( pr ) :: x ( size ( n )), g ( size ( n ), size ( n )), tau ( size ( n ), size ( n )) real ( pr ) :: a ( size ( n ), size ( n )), b ( size ( n ), size ( n )), c ( size ( n ), size (& & n )) real ( pr ) :: down integer :: i , j intrinsic SUM intrinsic EXP intrinsic SIZE real ( pr ), dimension ( size ( n )) :: arg1 real ( pr ), dimension ( size ( n )) :: arg2 x = n / sum ( n ) tau = model % a (:, :) + model % b (:, :) / t g = exp ( - ( model % c * tau )) ge = 0 do i = 1 , size ( n ) arg1 (:) = x (:) * tau (:, i ) * g (:, i ) arg2 (:) = x (:) * g (:, i ) ge = ge + x ( i ) * sum ( arg1 (:)) / sum ( arg2 (:)) end do ge = sum ( n ) * r * t * ge end subroutine EXCESS_GIBBS end module yaeos__models_ge_NRTL","tags":"","loc":"sourcefile/nrtl.f90.html"},{"title":"consistency.f90 – yaeos","text":"Source Code module yaeos__consistency !! # yaeos__consistency !! Subroutine to evaluate the consistency of thermodynamic models. !! !! # Description !! Tools to evaluate the consistency of A^r and G^E models. This !! module also provides subroutines for numerical evaluations of A^r and !! G^E derivatives using central finite differences. The purpose of the !! module is to assist in the development of new models and ensure the !! accuracy of the derivatives implementation. !! !! # Examples !! For detailed explanations and examples of each consistency test, please !! refer to the API documentation of each submodule. !! !! - A^r consistency tests: [[yaeos__consistency_armodel]] !! - G^E consistency tests: [[yaeos__consistency_gemodel]] !! !! # References !! 1. Michelsen, M. L., & Mollerup, J. M. (2007). Thermodynamic models: !! Fundamentals & computational aspects (2. ed). Tie-Line Publications. !! ! Consistency test for ArModels use yaeos__consistency_armodel use yaeos__consistency_gemodel end module yaeos__consistency","tags":"","loc":"sourcefile/consistency.f90.html"},{"title":"autodiff.f90 – yaeos","text":"Source Code module yaeos__autodiff !! This module holds the diferent ways of automatic differentiation use hyperdual_mod use yaeos__adiff_hyperdual_ar_api , only : ArModelAdiff implicit none end module","tags":"","loc":"sourcefile/autodiff.f90.html"},{"title":"linalg.f90 – yaeos","text":"Source Code module yaeos__math_linalg !! Wrapper module around LAPACK's `dgesv` use yaeos__constants , only : pr implicit none contains function solve_system ( a , b ) result ( x ) !! Solve a linear sytem AX = b real ( pr ), intent ( in ) :: b (:) real ( pr ), intent ( in ) :: a ( size ( b ), size ( b )) integer , parameter :: dp = selected_real_kind ( 15 ) real ( pr ) :: x ( size ( b )) real ( dp ) :: a_lapack ( size ( b ), size ( b )), b_lapack ( size ( b )) integer :: n , nrhs , lda , ipiv ( size ( b )), ldb , info interface subroutine dgesv ( n , nrhs , a , lda , ipiv , b , ldb , info ) import dp integer :: n integer :: nrhs real ( dp ) :: a ( n , n ) integer :: lda integer :: ipiv ( n ) real ( dp ) :: b ( n ) integer :: ldb integer :: info end subroutine dgesv end interface n = size ( a , dim = 1 ) nrhs = 1 lda = n ldb = n a_lapack = a b_lapack = b call dgesv ( n , nrhs , a_lapack , lda , ipiv , b_lapack , ldb , info ) if ( info > 0 ) error stop 1 x = b_lapack end function solve_system subroutine cubic_roots ( parameters , real_roots , complex_roots , flag ) use yaeos__auxiliar , only : sort real ( pr ), parameter :: pi = atan ( 1.0_pr ) * 4.0_pr real ( pr ), intent ( in ) :: parameters ( 4 ) real ( pr ), intent ( out ) :: real_roots ( 3 ) complex ( pr ), intent ( out ) :: complex_roots ( 3 ) integer , intent ( out ) :: flag !! flag that identifies which case the solution is !! - `0`: 3 real rotos, one of them repeated (use real_roots(1) and real_roots(2)) !! - `1`: 1 real root, 2 complex roots. !! Use real_roots(1) and complex_roots(1) and complex_roots(2) !! - `-1`: 3 real roots, all different real ( pr ) :: p , q , u , v , nan real ( pr ) :: disc , theta nan = 0 nan = nan / nan associate (& a => parameters ( 1 ), b => parameters ( 2 ), & c => parameters ( 3 ), d => parameters ( 4 )& ) p = c / a - b ** 2 / ( 3 * a ** 2 ) q = d / a - b * c / ( 3 * a ** 2 ) + 2 * b ** 3 / ( 27 * a ** 3 ) disc = q ** 2 + 4 * p ** 3 / 27 real_roots = nan complex_roots = nan if ( abs ( disc ) < 1e-15 ) then flag = 0 real_roots ( 1 ) = 3 * q / p real_roots ( 2 ) = - 3 * q / ( 2 * p ) real_roots ( 3 ) = real_roots ( 2 ) elseif ( disc < 0 ) then flag = - 1 theta = acos ( 0.5_pr * 3 * q / p * sqrt ( - 3 / p )) real_roots ( 1 ) = 2 * sqrt ( - p / 3 ) * cos ( theta / 3 ) real_roots ( 2 ) = 2 * sqrt ( - p / 3 ) * cos (( theta + 2 * pi ) / 3 ) real_roots ( 3 ) = 2 * sqrt ( - p / 3 ) * cos (( theta + 4 * pi ) / 3 ) call sort ( real_roots ) elseif ( disc > 0 ) then flag = 1 u = (( - q + sqrt ( disc )) / 2 ) v = (( - q - sqrt ( disc )) / 2 ) u = sign ( abs ( u ) ** ( 1.0_pr / 3.0_pr ), u ) v = sign ( abs ( v ) ** ( 1.0_pr / 3.0_pr ), v ) real_roots ( 1 ) = u + v endif real_roots = real_roots - b / ( 3 * a ) end associate end subroutine cubic_roots subroutine cubic_roots_rosendo ( parameters , real_roots , complex_roots , flag ) use yaeos__auxiliar , only : sort real ( pr ), parameter :: pi = atan ( 1.0_pr ) * 4.0_pr real ( pr ), intent ( in ) :: parameters ( 4 ) real ( pr ), intent ( out ) :: real_roots ( 3 ) complex ( pr ), intent ( out ) :: complex_roots ( 3 ) integer , intent ( out ) :: flag real ( 16 ) :: d1 , d2 , d3 , Q , R , A , B , theta , alp , bet , gam integer :: i d1 = parameters ( 2 ) / parameters ( 1 ) d2 = parameters ( 3 ) / parameters ( 1 ) d3 = parameters ( 4 ) / parameters ( 1 ) Q = ( d1 ** 2 - 3 * d2 ) / 9.0_1 6 R = ( 2 * d1 ** 3 - 9 * d1 * d2 + 27 * d3 ) / 5 4.0_1 6 if ( R ** 2 <= Q ** 3 ) then theta = acos ( R / sqrt ( Q ** 3 )) real_roots ( 1 ) = - 2 * sqrt ( Q ) * cos ( theta / 3.0_1 6 ) - d1 / 3.0_1 6 real_roots ( 2 ) = - 2 * sqrt ( Q ) * cos (( theta + 2 * pi ) / 3.0_1 6 ) - d1 / 3.0_1 6 real_roots ( 3 ) = - 2 * sqrt ( Q ) * cos (( theta - 2 * pi ) / 3.0_1 6 ) - d1 / 3.0_1 6 ! Correction?? ! do i=1,100 ! real_roots(1) = -d1 - (real_roots(2) + real_roots(3)) ! real_roots(2) = (d2 - real_roots(1) * real_roots(3)) / (real_roots(1) + real_roots(3)) ! real_roots(3) = -d3 / (real_roots(1) * real_roots(2)) ! end do call sort ( real_roots ) flag = - 1 else A = - sign (( abs ( R ) + sqrt ( R ** 2 - Q ** 3 )) ** ( 1.0_1 6 / 3.0_1 6 ), R ) if ( abs ( A ) < 1e-6 ) then A = 0.0_1 6 B = 0.0_1 6 else B = Q / A end if real_roots = ( A + B ) - d1 / 3.0_1 6 flag = 1 end if end subroutine end module yaeos__math_linalg","tags":"","loc":"sourcefile/linalg.f90.html"},{"title":"auxiliar.f90 – yaeos","text":"Source Code module yaeos__auxiliar use yaeos__constants , only : pr implicit none interface optval module procedure optval_integer , optval_real end interface optval contains integer function optval_integer ( val , default ) !! Set a value to a default if it is not defined use stdlib_optval , only : std => optval integer , optional , intent ( in out ) :: val integer , intent ( in ) :: default optval_integer = std ( val , default ) end function optval_integer real ( pr ) function optval_real ( val , default ) !! Set a value to a default if it is not defined use stdlib_optval , only : std => optval real ( pr ), optional , intent ( in out ) :: val real ( pr ), intent ( in ) :: default optval_real = std ( val , default ) end function optval_real subroutine sort ( array , idx ) use stdlib_sorting , only : std => sort !! Sort an array and return the indexes real ( pr ), intent ( in out ) :: array (:) integer , optional , intent ( out ) :: idx (:) call std ( array ) end subroutine sort end module yaeos__auxiliar","tags":"","loc":"sourcefile/auxiliar.f90.html"},{"title":"equilibria.f90 – yaeos","text":"Source Code module yaeos__equilibria ! Equilibrium State definitions use yaeos__equilibria_equilibrium_state , only : EquilibriumState ! Pure component saturation pressure use yaeos__equilibria_pure_psat , only : Psat ! Phase split calculations use yaeos__equilibria_flash , only : flash ! Saturation points use yaeos__equilibria_saturation_points , only :& saturation_pressure , saturation_temperature ! Phase equilibria boundaries use yaeos__equilibria_boundaries_phase_envelopes_pt , only :& PTEnvel2 , pt_envelope_2ph use yaeos__equilibria_boundaries_phase_envelopes_px , only :& PXEnvel2 , px_envelope_2ph ! Extra use yaeos__equilibria_auxiliar , only : k_wilson , p_wilson implicit none end module yaeos__equilibria","tags":"","loc":"sourcefile/equilibria.f90.html"},{"title":"equilibria_state.f90 – yaeos","text":"Source Code module yaeos__equilibria_equilibrium_state use yaeos__constants , only : pr implicit none type :: EquilibriumState !! Description of a two-phase equilibria state. !! !! Contains the relevant information of an equilibrium point obtained !! from some kind of equilibria calculation. character ( len = 14 ) :: kind !! Kind of point [\"bubble\", \"dew\", \"liquid-liquid\", \"split\"] integer :: iters = 0 !! Iterations needed to reach the state real ( pr ), allocatable :: y (:) !! Light-phase molar fractions real ( pr ), allocatable :: x (:) !! Heavy-phase molar fractions real ( pr ) :: Vx !! Heavy-phase volume [L/mol] real ( pr ) :: Vy !! Light-phase volume [L/mol] real ( pr ) :: T !! Temperature [K] real ( pr ) :: P !! Pressure [bar] real ( pr ) :: beta !! Mole fraction of light-phase contains private procedure , pass :: write => write_EquilibriumState generic , public :: write ( FORMATTED ) => write end type EquilibriumState contains subroutine write_EquilibriumState ( eq , unit , iotype , v_list , iostat , iomsg ) class ( EquilibriumState ), intent ( in ) :: eq integer , intent ( in ) :: unit character ( * ), intent ( in ) :: iotype integer , intent ( in ) :: v_list (:) integer , intent ( out ) :: iostat character ( * ), intent ( inout ) :: iomsg character ( * ), parameter :: nl = new_line ( \"G\" ) write ( unit , * ) eq % kind , eq % T , eq % P , eq % beta , eq % x , eq % y end subroutine write_EquilibriumState end module yaeos__equilibria_equilibrium_state","tags":"","loc":"sourcefile/equilibria_state.f90.html"},{"title":"fitting.f90 – yaeos","text":"Source Code module yaeos__fitting use yaeos__constants , only : pr use yaeos__models , only : ArModel use yaeos__equilibria , only : & EquilibriumState , saturation_pressure , saturation_temperature , flash use yaeos__optimizers , only : Optimizer , obj_func implicit none type , abstract :: FittingProblem !! # Fitting problem setting !! !! # Description !! This derived type holds all the relevant information for a parameter !! optimization problem. It keeps the base model structure that will be !! optimized and a procedure `get_model_from_X` that should reconstruct !! the model with the desired parameters to optimize. class ( ArModel ), allocatable :: model !! Residual Helmholtz Model to fit type ( EquilibriumState ), allocatable :: experimental_points (:) !! Experimental points to fit logical :: verbose = . false . !! If true log the fitting process contains procedure ( model_from_X ), deferred :: get_model_from_X end type FittingProblem abstract interface subroutine model_from_X ( problem , X ) !! Function that returns a setted model from the parameters vector import ArModel , FittingProblem , pr class ( FittingProblem ), intent ( in out ) :: problem !! Fitting problem to optimize real ( pr ), intent ( in ) :: X (:) !! Vector of parameters to fit end subroutine model_from_X end interface contains real ( pr ) function optimize ( X , opt , data ) result ( y ) real ( pr ), intent ( in out ) :: X (:) !! Vector of parameters to fit class ( Optimizer ), intent ( in out ) :: opt !! Optimizer object, bsaed on the `Optimizer` class from !! `yaeos__optimizers` class ( FittingProblem ), optional , intent ( in out ) :: data !! Fitting problem to optimize call opt % optimize ( error_function , X , y , data ) end function optimize subroutine error_function ( X , Fobj , dF , func_data ) !! # `error_function` !! Error function for phase-equilibria optimization. Using two-phase !! points and an error function of: !! !! !! FO = \\sum_i (\\frac{P_i^{exp} - P_i^{calc}}{P_i^{exp}})^2 !! + \\sum_i (y_i^{exp} - y_i^{calc})**2 !! + \\sum_i (x_i^{exp} - x_i^{calc})**2 !! use yaeos__math , only : sq_error real ( pr ), intent ( in ) :: X (:) !! Vector of parameters real ( pr ), intent ( out ) :: Fobj !! Objective function real ( pr ), optional , intent ( out ) :: dF (:) !! Gradient of the objective function, only exists to be consistent !! with the `Optimizer` class API class ( * ), optional , intent ( in out ) :: func_data type ( EquilibriumState ) :: model_point !! Each solved point type ( EquilibriumState ) :: exp_point integer :: i if ( present ( dF )) error stop 1 select type ( func_data ) class is ( FittingProblem ) ! Update the problem model to the new vector of parameters call func_data % get_model_from_X ( X ) fobj = 0 associate ( model => func_data % model ) ! Calculate each point and calculate its error. ! if at some point there is a NaN value, assign a big number and ! exit do i = 1 , size ( func_data % experimental_points ) exp_point = func_data % experimental_points ( i ) select case ( exp_point % kind ) case ( \"bubble\" ) model_point = saturation_pressure (& model , exp_point % x , exp_point % t , kind = \"bubble\" , & p0 = exp_point % p , y0 = exp_point % y & ) case ( \"dew\" ) model_point = saturation_pressure (& model , exp_point % y , exp_point % t , kind = \"dew\" , & p0 = exp_point % p , y0 = exp_point % x & ) case ( \"liquid-liquid\" ) model_point = saturation_pressure (& model , exp_point % x , exp_point % t , kind = \"liquid-liquid\" , & p0 = exp_point % p , y0 = exp_point % y & ) end select fobj = fobj + sq_error ( exp_point % p , model_point % p ) fobj = fobj + maxval ( sq_error ( exp_point % y , model_point % y )) fobj = fobj + maxval ( sq_error ( exp_point % x , model_point % x )) write ( 1 , * ) fobj , exp_point , model_point if ( isnan ( fobj )) then fobj = 1e6 exit end if end do end associate end select end subroutine error_function end module yaeos__fitting","tags":"","loc":"sourcefile/fitting.f90.html"},{"title":"generic_cubic.f90 – yaeos","text":"Source Code module yaeos__models_ar_genericcubic use yaeos__constants , only : pr use yaeos__models_ar , only : ArModel use yaeos__substance , only : Substances implicit none type , abstract :: AlphaFunction !! Abstract derived type that describe the required !! procedure for an alpha function. contains procedure ( abs_alpha ), deferred :: alpha end type type , abstract :: CubicMixRule !! Abstract derived type that describe the required !! procedure for a mixing rule on a Cubic EoS contains procedure ( abs_Dmix ), deferred :: Dmix procedure ( abs_Bmix ), deferred :: Bmix procedure ( abs_D1mix ), deferred :: D1mix end type type , extends ( ArModel ) :: CubicEoS !! # Cubic Equation of State. !! !! Generic Cubic Equation of State as defined by Michelsen and Mollerup !! with a \\delta_1 parameter that is not constant, !! and a \\delta_2 parameter that depends on it. In the case of a !! two parameter EoS like PengRobinson the \\delta_1 is the same for !! all components so it can be considered as a constant instead of a !! variable. The expression of the Equation is: !! !! !! P = \\frac{RT}{V-B} !! - \\frac{D(T_r)}{(V+B\\Delta_1)(V+B\\Delta_2)} !! class ( CubicMixRule ), allocatable :: mixrule !! # CubicMixRule derived type. !! Uses the abstract derived type `CubicMixRule` to define the !! mixing rule that the CubicEoS will use. It includes internally !! three methods to calculate the corresponding parameters for the !! Cubic EoS: `Dmix`, `Bmix` and `D1mix`. !! !! # Examples !! ## Calculation of the B parameter. !! ```fortran !! use yaeos, only: CubicEoS, PengRobinson76 !! type(CubicEoS) :: eos !! eos = PengRobinson76(tc, pc, w) !! call eos%mixrule%Bmix(n, eos%b, B, dBi, dBij) !! ``` !! ## Calculation of the D parameter. !! ```fortran !! use yaeos, only: CubicEoS, PengRobinson76 !! type(CubicEoS) :: eos !! eos = PengRobinson76(tc, pc, w) !! !! ! The mixing rule takes the `a` parameters of the components so !! ! they should be calculated externally !! call eos%alpha%alpha(Tr, a, dadt, dadt2) !! a = a * eos%ac !! dadt = dadt * eos%ac / eos%components%Tc !! dadt = dadt * eos%ac / eos%components%Tc**2 !! ! Calculate parameter !! call eos%mixrule%Dmix(n, T, a, dadt, dadt2, D, dDdT, dDdT2, dDi, dDidT, dDij) !! ``` !! ## Calculation of the D1 parameter. !! ```fortran !! use yaeos, only: CubicEoS, PengRobinson76 !! type(CubicEoS) :: eos !! eos = PengRobinson76(tc, pc, w) !! call eos%mixrule%D1mix(n, eos%del1, D1, dD1i, dD1ij) !! ``` class ( AlphaFunction ), allocatable :: alpha !! # AlphaFunction derived type. !! Uses the abstract derived type `AlphaFunction` to define the !! Alpha function that the CubicEoS will use. The Alpha function !! receives the reduced temperature and returns the values of alpha !! and its derivatives, named `a`, `dadt` and `dadt2` respectively. !! !! # Examples !! ## Callign the AlphaFunction of a setted up model. !! ```fortran !! use yaeos, only: CubicEoS, PengRobinson76 !! !! type(CubicEoS) :: eos !! eos = PengRobinson76(tc, pc, w) !! call eos%alpha%alpha(Tr, a, dadt, dadt2) !! ``` real ( pr ), allocatable :: ac (:) !! Attractive critical parameter real ( pr ), allocatable :: b (:) !! Repulsive parameter real ( pr ), allocatable :: del1 (:) !! \\delta_1 paramter real ( pr ), allocatable :: del2 (:) !! \\delta_2 paramter contains procedure :: residual_helmholtz => GenericCubic_Ar procedure :: get_v0 => v0 procedure :: volume => volume end type abstract interface subroutine abs_alpha ( self , Tr , a , dadt , dadt2 ) import AlphaFunction , pr class ( AlphaFunction ), intent ( in ) :: self real ( pr ), intent ( in ) :: Tr (:) real ( pr ), intent ( out ) :: a (:), dadt (:), dadt2 (:) end subroutine subroutine abs_Dmix ( self , n , T , & ai , daidt , daidt2 , & D , dDdT , dDdT2 , dDi , dDidT , dDij & ) import CubicMixRule , pr class ( CubicMixRule ), intent ( in ) :: self real ( pr ), intent ( in ) :: T , n (:) real ( pr ), intent ( in ) :: ai (:), daidt (:), daidt2 (:) real ( pr ), intent ( out ) :: D , dDdT , dDdT2 , dDi (:), dDidT (:), dDij (:, :) end subroutine subroutine abs_Bmix ( self , n , bi , B , dBi , dBij ) import CubicMixRule , pr class ( CubicMixRule ), intent ( in ) :: self real ( pr ), intent ( in ) :: n (:) real ( pr ), intent ( in ) :: bi (:) real ( pr ), intent ( out ) :: B , dBi (:), dBij (:, :) end subroutine subroutine abs_D1mix ( self , n , d1i , D1 , dD1i , dD1ij ) import pr , CubicMixRule class ( CubicMixRule ), intent ( in ) :: self real ( pr ), intent ( in ) :: n (:) real ( pr ), intent ( in ) :: d1i (:) real ( pr ), intent ( out ) :: D1 real ( pr ), intent ( out ) :: dD1i (:) real ( pr ), intent ( out ) :: dD1ij (:, :) end subroutine abs_D1mix end interface contains subroutine GenericCubic_Ar (& self , n , V , T , Ar , ArV , ArT , ArTV , ArV2 , ArT2 , Arn , ArVn , ArTn , Arn2 & ) !! Residual Helmholtz Energy for a generic Cubic Equation of State. !! !! Calculates the residual Helmholtz Energy for a generic Cubic EoS as !! defined by Michelsen and Møllerup: !! !! !! P = \\frac{RT}{V-b} !! - \\frac{a_c\\alpha(T_r)}{(V+b\\delta_1)(V+b\\delta_2)} !! !! !! This routine assumes that the \\delta_1 is not a constant parameter !! (as it uses to be in classical Cubic EoS) to be compatible with the !! three parameter EoS RKPR where delta_1 is not a constant and !! has its own mixing rule. !! use yaeos__constants , only : R class ( CubicEoS ), intent ( in ) :: self real ( pr ), intent ( in ) :: n (:) !! Number of moles real ( pr ), intent ( in ) :: v !! Volume [L] real ( pr ), intent ( in ) :: t !! Temperature [K] real ( pr ), optional , intent ( out ) :: ar !! Residual Helmholtz real ( pr ), optional , intent ( out ) :: arv !! \\frac{dAr}{dV} real ( pr ), optional , intent ( out ) :: ArT !! \\frac{dAr}{dT} real ( pr ), optional , intent ( out ) :: artv !! \\frac{d^2Ar}{dTdV} real ( pr ), optional , intent ( out ) :: arv2 !! \\frac{d^2Ar}{dV^2} real ( pr ), optional , intent ( out ) :: ArT2 !! \\frac{d^2Ar}{dT^2} real ( pr ), optional , intent ( out ) :: Arn ( size ( n )) !! \\frac{dAr}{dn_i} real ( pr ), optional , intent ( out ) :: ArVn ( size ( n )) !! \\frac{d^2Ar}{dVdn_i} real ( pr ), optional , intent ( out ) :: ArTn ( size ( n )) !! \\frac{d^2Ar}{dTdn_i} real ( pr ), optional , intent ( out ) :: Arn2 ( size ( n ), size ( n )) !! \\frac{d^2Ar}{dn_{ij}} real ( pr ) :: Bmix , dBi ( size ( n )), dBij ( size ( n ), size ( n )) real ( pr ) :: D , dDi ( size ( n )), dDij ( size ( n ), size ( n )), dDidT ( size ( n )), dDdT , dDdT2 real ( pr ) :: totn real ( pr ) d1 , dD1i ( size ( n )), dD1ij ( size ( n ), size ( n )) real ( pr ) :: auxD2 , fD1 , fBD1 , fVD1 , fD1D1 real ( pr ) d2 real ( pr ) :: f , g , fv , fB , gv , fv2 , gv2 , AUX , FFB , FFBV , FFBB real ( pr ) :: Tr ( size ( n )), a ( size ( n )), dadt ( size ( n )), dadt2 ( size ( n )) integer :: i , j , nc nc = size ( n ) TOTN = sum ( n ) Tr = T / self % components % Tc ! ======================================================================== ! Attractive parameter and derivatives ! ------------------------------------------------------------------------ call self % alpha % alpha ( Tr , a , dadt , dadt2 ) a = self % ac * a dadt = self % ac * dadt / self % components % Tc dadt2 = self % ac * dadt2 / self % components % Tc ** 2 ! ======================================================================== ! Mixing rules ! ------------------------------------------------------------------------ call self % mixrule % D1mix ( n , self % del1 , D1 , dD1i , dD1ij ) call self % mixrule % Bmix ( n , self % b , Bmix , dBi , dBij ) call self % mixrule % Dmix (& n , T , a , dadt , dadt2 , D , dDdT , dDdT2 , dDi , dDidT , dDij & ) D2 = ( 1._pr - D1 ) / ( 1._pr + D1 ) ! ======================================================================== ! Main functions defined by Møllerup ! The f's and g's used here are for Ar, not F (reduced Ar) ! This requires to multiply by R all g, f ! ------------------------------------------------------------------------ f = log (( V + D1 * Bmix ) / ( V + D2 * Bmix )) / Bmix / ( D1 - D2 ) g = R * log ( 1 - Bmix / V ) fv = - 1 / (( V + D1 * Bmix ) * ( V + D2 * Bmix )) fB = - ( f + V * fv ) / Bmix gv = R * Bmix / ( V * ( V - Bmix )) fv2 = ( - 1 / ( V + D1 * Bmix ) ** 2 + 1 / ( V + D2 * Bmix ) ** 2 ) / Bmix / ( D1 - D2 ) gv2 = R * ( 1 / V ** 2 - 1 / ( V - Bmix ) ** 2 ) ! DERIVATIVES OF f WITH RESPECT TO DELTA1 auxD2 = ( 1 + 2 / ( 1 + D1 ) ** 2 ) fD1 = ( 1 / ( V + D1 * Bmix ) + 2 / ( V + D2 * Bmix ) / ( 1 + D1 ) ** 2 ) - f * auxD2 fD1 = fD1 / ( D1 - D2 ) fBD1 = - ( fB * auxD2 + D1 / ( V + D1 * Bmix ) ** 2 + 2 * D2 / ( V + D2 * Bmix ) ** 2 / ( 1 + D1 ) ** 2 ) fBD1 = fBD1 / ( D1 - D2 ) fVD1 = - ( fV * auxD2 + 1 / ( V + D1 * Bmix ) ** 2 + 2 / ( V + D2 * Bmix ) ** 2 / ( 1 + D1 ) ** 2 ) / ( D1 - D2 ) fD1D1 = 4 * ( f - 1 / ( V + D2 * Bmix )) / ( 1 + D1 ) ** 3 + Bmix * ( - 1 / ( V + D1 * Bmix ) ** 2 & + 4 / ( V + D2 * Bmix ) ** 2 / ( 1 + D1 ) ** 4 ) - 2 * fD1 * ( 1 + 2 / ( 1 + D1 ) ** 2 ) fD1D1 = fD1D1 / ( D1 - D2 ) AUX = R * T / ( V - Bmix ) FFB = TOTN * AUX - D * fB FFBV = - TOTN * AUX / ( V - Bmix ) + D * ( 2 * fv + V * fv2 ) / Bmix FFBB = TOTN * AUX / ( V - Bmix ) - D * ( 2 * f + 4 * V * fv + V ** 2 * fv2 ) / Bmix ** 2 ! ======================================================================== ! Reduced Helmholtz Energy and derivatives ! ------------------------------------------------------------------------ if ( present ( Ar )) Ar = - TOTN * g * T - D * f if ( present ( ArV )) ArV = - TOTN * gv * T - D * fv if ( present ( ArV2 )) ArV2 = - TOTN * gv2 * T - D * fv2 if ( present ( Arn )) Arn (:) = - g * T + FFB * dBi (:) - f * dDi (:) - D * fD1 * dD1i (:) if ( present ( ArVn )) ArVn (:) = - gv * T + FFBV * dBi (:) - fv * dDi (:) - D * fVD1 * dD1i (:) if ( present ( ArTn )) ArTn (:) = - g + ( TOTN * AUX / T - dDdT * fB ) * dBi (:) - f * dDidT (:) - dDdT * fD1 * dD1i (:) if ( present ( Arn2 )) then do i = 1 , nc do j = 1 , i Arn2 ( i , j ) = AUX * ( dBi ( i ) + dBi ( j )) - fB * ( dBi ( i ) * dDi ( j ) + dBi ( j ) * dDi ( i )) & + FFB * dBij ( i , j ) + FFBB * dBi ( i ) * dBi ( j ) - f * dDij ( i , j ) Arn2 ( i , j ) = Arn2 ( i , j ) - D * fBD1 * ( dBi ( i ) * dD1i ( j ) + dBi ( j ) * dD1i ( i )) & - fD1 * ( dDi ( i ) * dD1i ( j ) + dDi ( j ) * dD1i ( i )) & - D * fD1 * dD1ij ( i , j ) - D * fD1D1 * dD1i ( i ) * dD1i ( j ) Arn2 ( j , i ) = Arn2 ( i , j ) end do end do end if ! TEMPERATURE DERIVATIVES if ( present ( ArT )) ArT = - TOTN * g - dDdT * f if ( present ( ArTV )) ArTV = - TOTN * gv - dDdT * fV if ( present ( ArT2 )) ArT2 = - dDdT2 * f end subroutine GenericCubic_Ar function v0 ( self , n , p , t ) !! Cubic EoS volume initializer. !! For a Cubic Equation of State, the covolume calculated with the mixing !! rule is a good estimate for the initial volume solver on the liquid !! region. class ( CubicEoS ), intent ( in ) :: self real ( pr ), intent ( in ) :: n (:), p , t real ( pr ) :: v0 real ( pr ) :: dbi ( size ( n )), dbij ( size ( n ), size ( n )) call self % mixrule % Bmix ( n , self % b , v0 , dbi , dbij ) end function subroutine volume ( eos , n , P , T , V , root_type ) !! # Cubic EoS volume solver !! Volume solver optimized for Cubic Equations of State. !! !! @warn !! This routine intends to use the analyitical solution of the cubic !! equation, but due to errors in the solutions it is not used. And !! the general volume solver by Michelsen is used instead. !! @endwarn !! !! # Description !! Cubic equations can be analytically solved. Using an anallytical !! solution provides the best possible solution in terms of speed and !! precision. This subroutine uses the modified cardano method proposed !! by Rosendo. !! !! # Examples !! !! ```fortran !! use yaeos, only: CubicEoS, PengRobinson !! type(CubicEoS) :: eos !! !! eos = PengRobinson(tc, pc, w) !! ! Possible roots to solve !! call eos%volume(n, P, T, V, \"liquid\") !! call eos%volume(n, P, T, V, \"vapor\") !! call eos%volume(n, P, T, V, \"stable\") !! ``` !! !! # References !! !! - [1] \"Thermodynamic Models: Fundamental and Computational Aspects\", !! Michael L. Michelsen, Jørgen M. Mollerup. !! Tie-Line Publications, Denmark (2004) !! [doi](http://dx.doi.org/10.1016/j.fluid.2005.11.032) !! !! - [2] \"A Note on the Analytical Solution of Cubic Equations of State !! in Process Simulation\", Rosendo Monroy-Loperena !! [doi](https://dx.doi.org/10.1021/ie2023004) use yaeos__constants , only : R use yaeos__math_linalg , only : cubic_roots , cubic_roots_rosendo use yaeos__models_solvers , only : volume_michelsen class ( CubicEoS ), intent ( in ) :: eos real ( pr ), intent ( in ) :: n (:), P , T real ( pr ), intent ( out ) :: V character ( len =* ), intent ( in ) :: root_type real ( pr ) :: z ( size ( n )) real ( pr ) :: cp ( 4 ), rr ( 3 ) complex ( pr ) :: cr ( 3 ) integer :: flag real ( pr ) :: V_liq , V_vap real ( pr ) :: Ar , AT_Liq , AT_Vap real ( pr ) :: Bmix , dBi ( size ( n )), dBij ( size ( n ), size ( n )) real ( pr ) :: D , dDi ( size ( n )), dDij ( size ( n ), size ( n )), dDidT ( size ( n )), dDdT , dDdT2 real ( pr ) :: D1 , D2 , dD1i ( size ( n )), dD1ij ( size ( n ), size ( n )) real ( pr ) :: Tr ( size ( n )) real ( pr ) :: a ( size ( n )), dadt ( size ( n )), dadt2 ( size ( n )) real ( pr ) :: totn call volume_michelsen ( eos , n = n , P = P , T = T , V = V , root_type = root_type ) return totn = sum ( n ) z = n / totn Tr = T / eos % components % Tc ! ======================================================================== ! Attractive parameter and derivatives ! ------------------------------------------------------------------------ call eos % alpha % alpha ( Tr , a , dadt , dadt2 ) a = eos % ac * a dadt = eos % ac * dadt / eos % components % Tc dadt2 = eos % ac * dadt2 / eos % components % Tc ** 2 ! ======================================================================== ! Mixing rules ! ------------------------------------------------------------------------ call eos % mixrule % D1mix ( z , eos % del1 , D1 , dD1i , dD1ij ) call eos % mixrule % Bmix ( z , eos % b , Bmix , dBi , dBij ) call eos % mixrule % Dmix (& z , T , a , dadt , dadt2 , D , dDdT , dDdT2 , dDi , dDidT , dDij & ) D2 = ( 1._pr - D1 ) / ( 1._pr + D1 ) cp ( 1 ) = - P cp ( 2 ) = - P * Bmix * ( D1 + D2 - 1 ) + R * T cp ( 3 ) = - P * ( D1 * D2 * Bmix ** 2 - D1 * Bmix ** 2 - D2 * Bmix ** 2 ) + R * T * Bmix * ( D1 + D2 ) - D cp ( 4 ) = P * D1 * D2 * Bmix ** 3 + R * T * D1 * D2 * Bmix ** 2 + D * Bmix ! call cubic_roots(cp, rr, cr, flag) ! call cubic_roots_rosendo(cp, rr, cr, flag) select case ( flag ) case ( - 1 ) V_liq = rr ( 1 ) V_vap = rr ( 3 ) if ( V_liq < 0 ) V_liq = V_vap case ( 1 ) V_liq = rr ( 1 ) V_vap = rr ( 1 ) end select select case ( root_type ) case ( \"liquid\" ) V = V_liq case ( \"vapor\" ) V = V_vap case ( \"stable\" ) ! AT is something close to Gr(P,T) call eos % residual_helmholtz ( z , V_liq , T , Ar = Ar ) AT_Liq = ( Ar + V_liq * P ) / ( T * R ) - sum ( z ) * log ( V_liq ) call eos % residual_helmholtz ( z , V_vap , T , Ar = Ar ) AT_Vap = ( Ar + V_vap * P ) / ( T * R ) - sum ( z ) * log ( V_vap ) if ( AT_liq <= AT_vap ) then V = V_liq else V = V_vap end if end select V = totn * V end subroutine end module","tags":"","loc":"sourcefile/generic_cubic.f90.html"},{"title":"tapenade_ar_api.f90 – yaeos","text":"Source Code module yaeos__tapenade_ar_api !! Module that wraps tapenade generated routines to calculate ! !! Ar and derivatives. use yaeos__constants , only : pr use yaeos__models_ar , only : ArModel implicit none private public :: ArModelTapenade type , abstract , extends ( ArModel ) :: ArModelTapenade contains procedure ( tapenade_ar ), deferred :: ar procedure ( tapenade_ar_d ), deferred :: ar_d procedure ( tapenade_ar_b ), deferred :: ar_b procedure ( tapenade_ar_d_b ), deferred :: ar_d_b procedure ( tapenade_ar_d_d ), deferred :: ar_d_d procedure ( tapenade_v0 ), deferred :: v0 procedure :: residual_helmholtz => residual_helmholtz procedure :: get_v0 => get_v0 end type abstract interface subroutine tapenade_ar ( model , n , v , t , arval ) import pr , ArModelTapenade class ( ArModelTapenade ), intent ( in ) :: model real ( pr ), intent ( in ) :: n (:), v , t real ( pr ), intent ( out ) :: arval end subroutine subroutine tapenade_ar_d ( model , n , nd , v , vd , t , td , arval , arvald ) import pr , ArModelTapenade class ( ArModelTapenade ), intent ( in ) :: model real ( pr ), intent ( in ) :: n (:), v , t real ( pr ), intent ( in ) :: nd (:), vd , td real ( pr ), intent ( out ) :: arval , arvald end subroutine subroutine tapenade_ar_b ( model , n , nb , v , vb , t , tb , arval , arvalb ) import pr , ArModelTapenade class ( ArModelTapenade ), intent ( in ) :: model real ( pr ), intent ( in ) :: n (:), v , t real ( pr ) :: arvalb real ( pr ) :: nb (:), vb , tb real ( pr ) :: arval end subroutine subroutine tapenade_ar_d_b ( model , & n , nb , nd , ndb , v , vb , vd , vdb , t , tb , td , tdb , & arval , arvalb , arvald , arvaldb ) import pr , ArModelTapenade class ( ArModelTapenade ), intent ( in ) :: model real ( pr ), intent ( in ) :: n (:), v , t real ( pr ) :: arval real ( pr ), intent ( in ) :: nd (:), vd , td real ( pr ) :: arvald real ( pr ) :: nb (:), vb , tb real ( pr ) :: arvalb real ( pr ) :: ndb (:), vdb , tdb real ( pr ) :: arvaldb end subroutine subroutine tapenade_ar_d_d ( model , n , nd , v , vd0 , vd , t , td0 , td , & arval , arvald0 , arvald , arvaldd ) import pr , ArModelTapenade class ( ArModelTapenade ), intent ( in ) :: model real ( pr ), intent ( in ) :: n (:), v , t real ( pr ), intent ( in ) :: vd0 , td0 real ( pr ), intent ( in ) :: nd (:), vd , td real ( pr ), intent ( out ) :: arval , arvald0 , arvald , arvaldd end subroutine pure function tapenade_v0 ( model , n , p , t ) import pr , ArModelTapenade class ( ArModelTapenade ), intent ( in ) :: model real ( pr ), intent ( in ) :: n (:), p , t real ( pr ) :: tapenade_v0 end function end interface contains subroutine residual_helmholtz (& self , n , v , t , Ar , ArV , ArT , ArTV , ArV2 , ArT2 , Arn , ArVn , ArTn , Arn2 & ) !! Residual Helmholtz model generic interface class ( ArModelTapenade ), intent ( in ) :: self real ( pr ), intent ( in ) :: n (:) real ( pr ), intent ( in ) :: v , t real ( pr ), optional , intent ( out ) :: Ar , ArV , ArT , ArT2 , ArTV , ArV2 real ( pr ), optional , dimension ( size ( n )), intent ( out ) :: Arn , ArVn , ArTn real ( pr ), optional , intent ( out ) :: Arn2 ( size ( n ), size ( n )) real ( pr ) :: df ( size ( n ) + 2 ), df2 ( size ( n ) + 2 , size ( n ) + 2 ) real ( pr ) :: nb ( size ( n )), nd ( size ( n )), ndb ( size ( n )) real ( pr ) :: vb , vd , vdb , vd0 real ( pr ) :: tb , td , tdb , td0 real ( pr ) :: arval , arvalb , arvald , arvaldb , arvald0 , arvaldd integer :: i , nc nc = size ( n ) if ( present ( Arn2 )) then do i = 1 , nc call reset_vars arvaldb = 1 if ( i <= nc ) then nd ( i ) = 1 end if call self % ar_d_b (& n , nb , nd , ndb , & v , vb , vd , vdb , & t , tb , td , tdb , & arval , arvalb , arvald , arvaldb & ) Arn2 ( i , :) = nb end do if ( present ( Arn )) Arn = ndb if ( present ( ArV )) ArV = vdb if ( present ( ArT )) ArT = tdb else if ( present ( Arn )) then call reset_vars arvalb = 1 call self % ar_b ( n , nb , v , vb , t , tb , arval , arvalb ) Arn = nb if ( present ( ArT )) ArT = tb if ( present ( ArV )) ArV = vb end if end if if ( present ( ArTn )) ArTn = get_ArnX ( \"T\" ) if ( present ( ArVn )) ArVn = get_ArnX ( \"V\" ) if ( present ( ArTV )) ArTV = get_dArdX2 ( \"TV\" ) if ( present ( ArT2 )) ArT2 = get_dArdX2 ( \"T2\" ) if ( present ( ArV2 )) ArV2 = get_dArdX2 ( \"V2\" ) if ( present ( Ar )) Ar = arval contains subroutine reset_vars nb = 0 nd = 0 ndb = 0 vb = 0 vd = 0 vd0 = 0 vdb = 0 tb = 0 td = 0 td0 = 0 tdb = 0 arval = 0 arvalb = 0 arvald = 0 arvald0 = 0 arvaldb = 0 end subroutine function get_dArdX2 ( var ) character ( len =* ), intent ( in ) :: var real ( pr ) :: get_dArdX2 call reset_vars select case ( var ) case ( \"TV\" ) vd = 1 td0 = 1 case ( \"V2\" ) vd = 1 vd0 = 1 case ( \"T2\" ) td = 1 td0 = 1 end select call self % ar_d_d (& n , nd , v , vd0 , vd , t , td0 , td , & arval , arvald0 , arvald , arvaldd & ) get_dArdX2 = arvaldd end function function get_ArnX ( var ) character ( len =* ), intent ( in ) :: var real ( pr ) :: get_ArnX ( size ( n )) call reset_vars arvaldb = 1 select case ( var ) case ( \"V\" ) vd = 1 case ( \"T\" ) td = 1 end select call self % ar_d_b (& n , nb , nd , ndb , & v , vb , vd , vdb , & t , tb , td , tdb , & arval , arvalb , arvald , arvaldb & ) get_ArnX = nb end function end subroutine function get_v0 ( self , n , p , t ) class ( ArModelTapenade ), intent ( in ) :: self real ( pr ), intent ( in ) :: n (:), p , t real ( pr ) :: get_v0 get_v0 = self % v0 ( n , p , t ) end function end module","tags":"","loc":"sourcefile/tapenade_ar_api.f90.html"},{"title":"ge_models.f90 – yaeos","text":"Source Code module yaeos__models_ge !! Excess Gibbs Models. use yaeos__constants , only : pr , R use yaeos__models_base , only : BaseModel implicit none type , extends ( BaseModel ), abstract :: GeModel !! Excess Gibbs energy model. contains procedure ( excess_gibbs ), deferred :: excess_gibbs procedure :: ln_activity_coefficient => ln_activity_coefficient end type abstract interface subroutine excess_gibbs ( self , n , t , Ge , GeT , GeT2 , Gen , GeTn , Gen2 ) !! Excess Gibbs and derivs procedure import pr , GeModel class ( GeModel ), intent ( in ) :: self !! Model real ( pr ), intent ( in ) :: n (:) !! Moles vector real ( pr ), intent ( in ) :: t !! Temperature [K] real ( pr ), optional , intent ( out ) :: Ge !! Excess Gibbs real ( pr ), optional , intent ( out ) :: GeT !! \\frac{dG^E}{dT} real ( pr ), optional , intent ( out ) :: GeT2 !! \\frac{d^2G^E}{dT^2} real ( pr ), optional , intent ( out ) :: Gen ( size ( n )) real ( pr ), optional , intent ( out ) :: GeTn ( size ( n )) real ( pr ), optional , intent ( out ) :: Gen2 ( size ( n ), size ( n )) end subroutine end interface contains subroutine ln_activity_coefficient ( self , n , T , lngamma ) class ( GeModel ), intent ( in ) :: self real ( pr ), intent ( in ) :: n (:) real ( pr ), intent ( in ) :: T real ( pr ), intent ( out ) :: lngamma (:) real ( pr ) :: ge , dgedn ( size ( n )) call self % excess_gibbs ( n , t , ge = ge , gen = dgedn ) lngamma = dgedn / ( R * T ) end subroutine end module","tags":"","loc":"sourcefile/ge_models.f90.html"},{"title":"optimizers.f90 – yaeos","text":"Source Code module yaeos__optimizers use yaeos__constants , only : pr implicit none type , abstract :: Optimizer logical :: verbose real ( pr ), allocatable :: parameter_step (:) real ( pr ) :: solver_tolerance = 1e-9_pr contains procedure ( abs_optimize ), deferred :: optimize end type abstract interface subroutine obj_func ( X , F , dF , data ) import pr real ( pr ), intent ( in ) :: X (:) real ( pr ), intent ( out ) :: F real ( pr ), optional , intent ( out ) :: dF (:) class ( * ), optional , intent ( in out ) :: data end subroutine end interface abstract interface subroutine abs_optimize ( self , foo , X , F , data ) import pr , obj_func , Optimizer class ( Optimizer ), intent ( in out ) :: self procedure ( obj_func ) :: foo real ( pr ), intent ( in out ) :: X (:) real ( pr ), intent ( out ) :: F class ( * ), optional , target , intent ( in out ) :: data end subroutine end interface end module module yaeos__optimizers_powell_wrap use yaeos__constants , only : pr use yaeos__optimizers , only : Optimizer , obj_func private public :: PowellWrapper type , extends ( Optimizer ) :: PowellWrapper !! Wrapper derived type to optimize with the Powell method contains procedure :: optimize => powell_optimize end type PowellWrapper ! These are private variables that will be used in the wrapper subroutine ! to call the user-defined function and pass the data class ( * ), private , pointer :: priv_data procedure ( obj_func ), private , pointer :: priv_foo contains subroutine powell_optimize ( self , foo , X , F , data ) use newuoa_module , only : newuoa class ( PowellWrapper ), intent ( in out ) :: self class ( * ), optional , target , intent ( in out ) :: data procedure ( obj_func ) :: foo real ( pr ), intent ( in out ) :: X (:) real ( pr ), intent ( out ) :: F real ( pr ) :: dx ( size ( x )) integer :: n , npt n = size ( X ) npt = ( N + 2 + ( N + 1 ) * ( N + 2 ) / 2 ) / 2 if ( allocated ( self % parameter_step )) then dx = self % parameter_step else dx = X * 0.01_pr end if if ( present ( data )) priv_data => data priv_foo => foo call newuoa (& n , npt , x , & maxval ( abs ( dx / 10 )), self % solver_tolerance , 0 , int ( 1e9 ), foo_wrap & ) call foo_wrap ( n , x , F ) end subroutine powell_optimize subroutine foo_wrap ( n , x , f ) integer :: n real ( pr ) :: x ( * ) real ( pr ) :: f real ( pr ) :: xx ( n ) xx = x ( 1 : n ) call priv_foo ( xx , F , data = priv_data ) end subroutine foo_wrap end module","tags":"","loc":"sourcefile/optimizers.f90.html"},{"title":"auxiliar_functions.f90 – yaeos","text":"Source Code module auxiliar_functions use yaeos__constants , only : pr contains elemental function rel_error ( x , y ) real ( pr ), intent ( in ) :: x , y real ( pr ) :: rel_error rel_error = abs ( x - y ) / abs ( x ) end function rel_error function allclose ( x , y , atol ) real ( pr ), intent ( in ) :: x (:) real ( pr ), intent ( in ) :: y (:) real ( pr ), intent ( in ) :: atol logical :: allclose allclose = maxval ( rel_error ( x , y )) < atol end function allclose end module auxiliar_functions","tags":"","loc":"sourcefile/auxiliar_functions.f90.html"},{"title":"unifac.f90 – yaeos","text":"Source Code module yaeos__models_ge_group_contribution_unifac !! # UNIFAC module !! Classic liquid-vapor UNIFAC model implementation module. !! !! # Description !! Classic liquid-vapor UNIFAC model implementation module. The !! implementation is based on the Thermopack library (SINTEF) implementation. !! !! # Examples !! !! ```fortran !! ! Instantiate an UNIFAC model with ethanol-water mix and calculate gammas !! use yaeos, only: pr, Groups, setup_unifac, UNIFAC !! !! type(UNIFAC) :: model !! type(Groups) :: molecules(2) !! real(pr) :: ln_gammas(2) !! !! ! Ethanol definition [CH3, CH2, OH] !! molecules(1)%groups_ids = [1, 2, 14] ! Subgroups ids !! molecules(1)%number_of_groups = [1, 1, 1] ! Subgroups occurrences !! !! ! Water definition [H2O] !! molecules(2)%groups_ids = [16] !! molecules(2)%number_of_groups = [1] !! !! ! Model setup !! model = setup_unifac(molecules) !! !! ! Calculate ln_gammas !! call model%ln_activity_coefficient([0.5_pr, 0.5_pr], 298.0_pr, ln_gammas) !! !! print *, ln_gammas ! result: 0.18534142000449058 0.40331395945417559 !! ``` !! !! # References !! 1. [Dortmund Data Bank Software & Separation Technology](https://www.ddbst !! .com/published-parameters-unifac.html) !! 2. Fredenslund, A., Jones, R. L., & Prausnitz, J. M. (1975). !! Group‐contribution estimation of activity coefficients in nonideal liquid !! mixtures. AIChE Journal, 21(6), 1086–1099. !! [https://doi.org/10.1002/aic.690210607](https://doi.org/10.1002/aic.690210607) !! 3. Skjold-Jorgensen, S., Kolbe, B., Gmehling, J., & Rasmussen, P. (1979). !! Vapor-Liquid Equilibria by UNIFAC Group Contribution. Revision and !! Extension. Industrial & Engineering Chemistry Process Design and !! Development, 18(4), 714–722. !! [https://doi.org/10.1021/i260072a024](https://doi.org/10.1021/i260072a024) !! 4. Gmehling, J., Rasmussen, P., & Fredenslund, A. (1982). Vapor-liquid !! equilibriums by UNIFAC group contribution. Revision and extension. 2. !! Industrial & Engineering Chemistry Process Design and Development, 21(1), !! 118–127. !! [https://doi.org/10.1021/i200016a021](https://doi.org/10.1021/i200016a021) !! 5. Macedo, E. A., Weidlich, U., Gmehling, J., & Rasmussen, P. (1983). !! Vapor-liquid equilibriums by UNIFAC group contribution. Revision and !! extension. 3. Industrial & Engineering Chemistry Process Design and !! Development, 22(4), 676–678. !! [https://doi.org/10.1021/i200023a023](https://doi.org/10.1021/i200023a023) !! 6. Tiegs, D., Rasmussen, P., Gmehling, J., & Fredenslund, A. (1987). !! Vapor-liquid equilibria by UNIFAC group contribution. 4. Revision and !! extension. Industrial & Engineering Chemistry Research, 26(1), 159–161. !! [https://doi.org/10.1021/ie00061a030](https://doi.org/10.1021/ie00061a030) !! 7. Hansen, H. K., Rasmussen, P., Fredenslund, A., Schiller, M., & !! Gmehling, J. (1991). Vapor-liquid equilibria by UNIFAC group !! contribution. 5. Revision and extension. Industrial & Engineering !! Chemistry Research, 30 (10), 2352–2355. !! [https://doi.org/10.1021/ie00058a017](https://doi.org/10.1021/ie00058a017) !! 8. Wittig, R., Lohmann, J., & Gmehling, J. (2003). Vapor−Liquid Equilibria !! by UNIFAC Group Contribution. 6. Revision and Extension. Industrial & !! Engineering Chemistry Research, 42(1), 183–188. !! [https://doi.org/10.1021/ie020506l](https://doi.org/10.1021/ie020506l) !! 9. [SINTEF - Thermopack](https://github.com/thermotools/thermopack) !! use yaeos__constants , only : pr , R use yaeos__models_ge , only : GeModel use yaeos__models_ge_group_contribution_model_parameters , only : GeGCModelParameters use yaeos__models_ge_group_contribution_unifac_parameters , only : UNIFACParameters implicit none type :: Groups !! # Groups !! Derived type used to represent a molecule and its UNIFAC groups. !! !! # Description !! Derived type used to represent a molecule and its UNIFAC groups. Is !! necessary to specify the subgroups ids and the subgroups on each !! molecule as shown in the example. !! !! # Examples !! !! ```fortran !! ! Define toluene molecule groups !! use yaeos, only: Groups !! !! type(Groups) :: toluene !! !! ! Toluene [ACH, ACCH3] !! toluene%groups_ids = [9, 11] ! Subgroups ids !! toluene%number_of_groups = [5, 1] ! Subgroups occurrences !! ``` !! !! # References !! 1. [Dortmund Data Bank Software & Separation Technology](https://www.ddbst !! .com/published-parameters-unifac.html) integer , allocatable :: groups_ids (:) !! Indexes (ids) of each subgroup in the main group matrix integer , allocatable :: number_of_groups (:) !! Occurrences of each subgroup in the molecule real ( pr ) :: surface_area !! Molecule surface area q real ( pr ) :: volume !! Molecule volume r end type Groups type , extends ( GeModel ) :: UNIFAC !! # UNIFAC model !! Classic liquid-vapor UNIFAC model derived type !! !! # Description !! This type holds the needed parameters for using a UNIFAC G^E model !! mainly group areas, volumes and what temperature dependence function !! \\psi(T) to use. !! !! It also holds the individual molecules of a particular system and !! the set of all groups in the system as a \"stew\" of groups instead of !! being them included in particular molecules. !! !! # Examples !! !! ```fortran !! ! UNIFAC model with ethanol-formic acid mix and calculate gammas !! use yaeos, only: pr, Groups, setup_unifac, UNIFAC !! !! type(UNIFAC) :: model !! type(Groups) :: molecules(2) !! real(pr) :: ln_gammas(2) !! !! ! Ethanol definition [CH3, CH2, OH] !! molecules(1)%groups_ids = [1, 2, 14] ! Subgroups ids !! molecules(1)%number_of_groups = [1, 1, 1] ! Subgroups occurrences !! !! ! formic acid definition [HCOOH] !! molecules(2)%groups_ids = [43] !! molecules(2)%number_of_groups = [1] !! !! ! Model setup !! model = setup_unifac(molecules) !! !! ! Calculate ln_gammas !! call model%ln_activity_coefficient([0.5_pr, 0.5_pr], 298.0_pr, ln_gammas) !! !! print *, ln_gammas ! result: 0.10505475697637946 0.28073129552766890 !! ``` !! !! # References !! 1. [Dortmund Data Bank Software & Separation Technology](https://www.ddbst !! .com/published-parameters-unifac.html) !! 2. Fredenslund, A., Jones, R. L., & Prausnitz, J. M. (1975). !! Group‐contribution estimation of activity coefficients in nonideal liquid !! mixtures. AIChE Journal, 21(6), 1086–1099. !! [https://doi.org/10.1002/aic.690210607](https://doi.org/10.1002/aic.690210607) !! 3. Skjold-Jorgensen, S., Kolbe, B., Gmehling, J., & Rasmussen, P. (1979). !! Vapor-Liquid Equilibria by UNIFAC Group Contribution. Revision and !! Extension. Industrial & Engineering Chemistry Process Design and !! Development, 18(4), 714–722. !! [https://doi.org/10.1021/i260072a024](https://doi.org/10.1021/i260072a024) !! 4. Gmehling, J., Rasmussen, P., & Fredenslund, A. (1982). Vapor-liquid !! equilibriums by UNIFAC group contribution. Revision and extension. 2. !! Industrial & Engineering Chemistry Process Design and Development, 21(1), !! 118–127. !! [https://doi.org/10.1021/i200016a021](https://doi.org/10.1021/i200016a021) !! 5. Macedo, E. A., Weidlich, U., Gmehling, J., & Rasmussen, P. (1983). !! Vapor-liquid equilibriums by UNIFAC group contribution. Revision and !! extension. 3. Industrial & Engineering Chemistry Process Design and !! Development, 22(4), 676–678. !! [https://doi.org/10.1021/i200023a023](https://doi.org/10.1021/i200023a023) !! 6. Tiegs, D., Rasmussen, P., Gmehling, J., & Fredenslund, A. (1987). !! Vapor-liquid equilibria by UNIFAC group contribution. 4. Revision and !! extension. Industrial & Engineering Chemistry Research, 26(1), 159–161. !! [https://doi.org/10.1021/ie00061a030](https://doi.org/10.1021/ie00061a030) !! 7. Hansen, H. K., Rasmussen, P., Fredenslund, A., Schiller, M., & !! Gmehling, J. (1991). Vapor-liquid equilibria by UNIFAC group !! contribution. 5. Revision and extension. Industrial & Engineering !! Chemistry Research, 30 (10), 2352–2355. !! [https://doi.org/10.1021/ie00058a017](https://doi.org/10.1021/ie00058a017) !! 8. Wittig, R., Lohmann, J., & Gmehling, J. (2003). Vapor−Liquid Equilibria !! by UNIFAC Group Contribution. 6. Revision and Extension. Industrial & !! Engineering Chemistry Research, 42(1), 183–188. !! [https://doi.org/10.1021/ie020506l](https://doi.org/10.1021/ie020506l) !! 9. [SINTEF - Thermopack](https://github.com/thermotools/thermopack) !! integer :: ngroups !! Total number of individual groups in the mixture integer :: nmolecules !! Total number of molecules in the mixture real ( pr ) :: z = 10 !! Model constant real ( pr ), allocatable :: group_area (:) !! Group areas Q_k real ( pr ), allocatable :: group_volume (:) !! Group volumes R_k real ( pr ), allocatable :: thetas_ij (:, :) !! Area fractions of the groups j on molecules i real ( pr ), allocatable :: vij (:,:) !! Ocurrences of each group j on each molecule i real ( pr ), allocatable :: qk (:) !! Area of each group k class ( PsiFunction ), allocatable :: psi_function !! Temperature dependance function of the model type ( Groups ), allocatable :: molecules (:) !! Substances present in the system type ( Groups ) :: groups_stew !! All the groups present in the system contains procedure :: excess_gibbs end type UNIFAC type , abstract :: PsiFunction !! # \\psi(T) function !! UNIFAC \\psi(T) functions abstract type !! !! # Description !! Abstract derived type for UNIFAC models temperature dependent functions !! contains procedure ( temperature_dependence ), deferred :: psi end type PsiFunction abstract interface subroutine temperature_dependence (& self , systems_groups , T , psi , dpsi_dt , dpsi_dt2 & ) !! # temperature_dependence interface !! Interface subroutine for UNIFAC models temperature dependent !! functions !! import pr , PsiFunction , Groups class ( PsiFunction ) :: self !! PsiFunction type variable class ( Groups ) :: systems_groups !! Groups type variable containig all the system's groups. See the !! `groups_stew` variable on the `UNIFAC` documentation. real ( pr ), intent ( in ) :: T !! Temperature [K] real ( pr ), optional , intent ( out ) :: psi (:, :) !! \\psi(T) real ( pr ), optional , intent ( out ) :: dpsi_dt (:, :) !! \\frac{d \\psi (T)}{dT} real ( pr ), optional , intent ( out ) :: dpsi_dt2 (:, :) !! \\frac{d^2 \\psi (T)}{dT^2} end subroutine temperature_dependence end interface type , extends ( PsiFunction ) :: UNIFACPsi !! # Original UNIFAC \\psi function !! !! \\psi_{ij}(T) = \\exp(-\\frac{A_{ij}}{T}) !! !! !! !! \\frac{d \\psi_{ij}(T)}{dT} = \\frac{A_{ij}}{T^2} !! \\exp(-\\frac{A_{ij}}{T}) !! !! !! !! \\frac{d^2 \\psi_{ij}(T)}{dT^2} = !! \\frac{Aij (Aij - 2T)}{T^4} \\exp(-\\frac{A_{ij}}{T}) !! !! !! # References !! 1. [Dortmund Data Bank Software & Separation Technology](https://www.ddbst !! .com/published-parameters-unifac.html) !! 2. Fredenslund, A., Jones, R. L., & Prausnitz, J. M. (1975). !! Group‐contribution estimation of activity coefficients in nonideal liquid !! mixtures. AIChE Journal, 21(6), 1086–1099. !! [https://doi.org/10.1002/aic.690210607](https://doi.org/10.1002/aic.690210607) !! 3. Skjold-Jorgensen, S., Kolbe, B., Gmehling, J., & Rasmussen, P. (1979). !! Vapor-Liquid Equilibria by UNIFAC Group Contribution. Revision and !! Extension. Industrial & Engineering Chemistry Process Design and !! Development, 18(4), 714–722. !! [https://doi.org/10.1021/i260072a024](https://doi.org/10.1021/i260072a024) !! 4. Gmehling, J., Rasmussen, P., & Fredenslund, A. (1982). Vapor-liquid !! equilibriums by UNIFAC group contribution. Revision and extension. 2. !! Industrial & Engineering Chemistry Process Design and Development, 21(1), !! 118–127. !! [https://doi.org/10.1021/i200016a021](https://doi.org/10.1021/i200016a021) !! 5. Macedo, E. A., Weidlich, U., Gmehling, J., & Rasmussen, P. (1983). !! Vapor-liquid equilibriums by UNIFAC group contribution. Revision and !! extension. 3. Industrial & Engineering Chemistry Process Design and !! Development, 22(4), 676–678. !! [https://doi.org/10.1021/i200023a023](https://doi.org/10.1021/i200023a023) !! 6. Tiegs, D., Rasmussen, P., Gmehling, J., & Fredenslund, A. (1987). !! Vapor-liquid equilibria by UNIFAC group contribution. 4. Revision and !! extension. Industrial & Engineering Chemistry Research, 26(1), 159–161. !! [https://doi.org/10.1021/ie00061a030](https://doi.org/10.1021/ie00061a030) !! 7. Hansen, H. K., Rasmussen, P., Fredenslund, A., Schiller, M., & !! Gmehling, J. (1991). Vapor-liquid equilibria by UNIFAC group !! contribution. 5. Revision and extension. Industrial & Engineering !! Chemistry Research, 30 (10), 2352–2355. !! [https://doi.org/10.1021/ie00058a017](https://doi.org/10.1021/ie00058a017) !! 8. Wittig, R., Lohmann, J., & Gmehling, J. (2003). Vapor−Liquid Equilibria !! by UNIFAC Group Contribution. 6. Revision and Extension. Industrial & !! Engineering Chemistry Research, 42(1), 183–188. !! [https://doi.org/10.1021/ie020506l](https://doi.org/10.1021/ie020506l) !! 9. [SINTEF - Thermopack](https://github.com/thermotools/thermopack) !! real ( pr ), allocatable :: Aij (:, :) contains procedure :: psi => UNIFAC_temperature_dependence end type UNIFACPsi contains subroutine excess_gibbs ( self , n , T , Ge , GeT , GeT2 , Gen , GeTn , Gen2 ) !! # Excess Gibbs energy !! Calculate the Gibbs excess energy of the UNIFAC model !! !! # Description !! Calculate the Gibbs excess energy of the UNIFAC model and its !! derivatives. !! !! # Examples !! !! ```fortran !! ! Gibbs excess of ethane-ethanol-methyl amine mixture. !! use yaeos, only: R, pr, Groups, setup_unifac, UNIFAC !! !! type(UNIFAC) :: model !! !! integer, parameter :: nc = 3, ng = 4 !! !! type(Groups) :: molecules(nc) !! !! real(pr) :: Ge, Gen(nc), GeT, GeT2, GeTn(nc), Gen2(nc, nc) !! !! real(pr) :: n(nc), ln_gammas(nc), T !! !! T = 150.0_pr !! n = [2.0_pr, 7.0_pr, 1.0_pr] !! !! ! Ethane [CH3] !! molecules(1)%groups_ids = [1] !! molecules(1)%number_of_groups = [2] !! !! ! Ethanol [CH3, CH2, OH] !! molecules(2)%groups_ids = [1, 2, 14] !! molecules(2)%number_of_groups = [1, 1, 1] !! !! ! Methylamine [H3C-NH2] !! molecules(3)%groups_ids = [28] !! molecules(3)%number_of_groups = [1] !! !! ! setup UNIFAC model !! model = setup_unifac(molecules) !! !! ! Call all Ge and derivatives !! call model%excess_gibbs(model, n, T, Ge, GeT, GeT2, Gen, GeTn, Gen2) !! !! print *, \"Ge: \", Ge !! print *, \"GeT: \", GeT !! print *, \"GeT2: \", GeT2 !! print *, \"Gen: \", Gen !! print *, \"GeTn: \", GeTn !! print *, \"Gen2:\" !! print *, Gen2(1,:) !! print *, Gen2(2,:) !! print *, Gen2(3,:) !! !! ! If you want the ln_gammas from \"Gen\" derivative: !! print *, \"ln_gammas: \", Gen / R / T !! !! ! Or !! call model%ln_activity_coefficient(n, T, ln_gammas) !! print *, \"ln_gammas: \", ln_gammas !! ``` !! class ( UNIFAC ), intent ( in ) :: self !! UNIFAC model real ( pr ), intent ( in ) :: n (:) !! Moles vector [mol] real ( pr ), intent ( in ) :: T !! Temperature [K] real ( pr ), optional , intent ( out ) :: Ge !! Excess Gibbs energy real ( pr ), optional , intent ( out ) :: GeT !! \\frac{dG^E}{dT} real ( pr ), optional , intent ( out ) :: GeT2 !! \\frac{d^2G^E}{dT^2} real ( pr ), optional , intent ( out ) :: Gen ( size ( n )) !! \\frac{dG^E}{dn} real ( pr ), optional , intent ( out ) :: GeTn ( size ( n )) !! \\frac{d^2G^E}{dTdn} real ( pr ), optional , intent ( out ) :: Gen2 ( size ( n ), size ( n )) !! \\frac{d^2G^E}{dn^2} ! Combinatorial real ( pr ) :: Ge_c real ( pr ) :: dGe_c_dn ( self % nmolecules ) real ( pr ) :: dGe_c_dn2 ( self % nmolecules , self % nmolecules ) ! logical logical :: pge , dn , dn2 ! Residual calling call Ge_residual ( self , n , T , Ge , Gen , Gen2 , GeT , GeT2 , GeTn ) ! Individual combinatorial calling pge = present ( Ge ) dn = present ( Gen ) dn2 = present ( Gen2 ) if ( dn . and . . not . dn2 ) then call Ge_combinatorial ( self , n , T , Ge = Ge_c , dGe_dn = dGe_c_dn ) elseif ( dn2 . and . . not . dn ) then call Ge_combinatorial ( self , n , T , Ge = Ge_c , dGe_dn2 = dGe_c_dn2 ) else call Ge_combinatorial (& self , n , T , Ge = Ge_c , dGe_dn = dGe_c_dn , dGe_dn2 = dGe_c_dn2 & ) end if if ( present ( Ge )) Ge = Ge_c + Ge if ( present ( Gen )) Gen = dGe_c_dn + Gen if ( present ( Gen2 )) Gen2 = dGe_c_dn2 + Gen2 if ( present ( GeT )) GeT = Ge_c / T + GeT if ( present ( GeT2 )) GeT2 = GeT2 if ( present ( GeTn )) GeTn = dGe_c_dn / T + GeTn end subroutine excess_gibbs subroutine Ge_combinatorial ( self , n , T , Ge , dGe_dn , dGe_dn2 ) !! # UNIFAC combinatorial term !! Calculate the UNIFAC combinatorial term of Gibbs excess energy !! !! # Description !! Calculate the UNIFAC combinatorial term of reduced Gibbs excess energy. !! The subroutine uses the Flory-Huggins and Staverman-Guggenheim !! combinatory terms as follows: !! !! ### Flory-Huggins !! !! !! G^{E,FH} = !! RT \\left(\\sum_i^{NC} n_i \\, \\text{ln} \\, r_i !! - n \\, \\text{ln} \\, \\sum_j^{NC} n_j r_j !! + n \\, \\text{ln} \\, n \\right) !! !! !! !! \\frac{dG^{E,FH}}{dn_i} = !! RT \\left(\\text{ln} \\, r_i - \\text{ln} \\, \\sum_j^{NC} n_j r_j !! + \\text{ln} \\, n + 1 - \\frac{n r_i}{\\displaystyle !! \\sum_j^{NC} n_j r_j} \\right) !! !! !! !! \\frac{d^2G^{E,FH}}{dn_i dn_j} = !! RT \\left(- \\frac{r_i + r_j}{\\displaystyle \\sum_l^{NC} n_l r_l} !! + \\frac{1}{n} + \\frac{n r_i r_j}{\\displaystyle \\left(\\sum_l^{NC} !! n_l r_l \\right)^2} \\right) !! !! !! ### Staverman-Guggenheim !! !! !! \\frac{G^{E,SG}}{RT} = !! \\frac{z}{2} \\sum_i^{NC} n_i q_i !! \\left(\\text{ln} \\frac{q_i}{r_i} !! - \\text{ln} \\, \\sum_j^{NC} n_j q_j !! + \\text{ln} \\, \\sum_j^{NC} n_j r_j \\right) !! !! !! !! \\frac{1}{RT}\\frac{dG^{E,SG}}{dn_i} = !! \\frac{z}{2} q_i \\left( !! - \\text{ln} \\, \\left( !! \\frac{r_i \\sum_j^{NC} n_j q_j}{\\displaystyle q_i \\sum_j^{NC} !! n_j r_j} \\right) - 1 + \\frac{\\displaystyle r_i \\sum_j^{NC} n_j !! q_j}{\\displaystyle q_i \\sum_j^{NC} n_j r_j} \\right) !! !! !! !! \\frac{1}{RT}\\frac{d^2G^{E,SG}}{dn_i dn_j} = !! \\frac{z}{2} \\left(- \\frac{q_i q_j}{\\displaystyle \\sum_l^{NC} n_lq_l} !! + \\frac{q_i r_j + q_j r_i}{\\displaystyle \\sum_l^{NC} n_l r_l} !! - \\frac{\\displaystyle r_i r_j \\sum_l^{NC} n_l q_l} !! {\\left(\\displaystyle \\sum_l^{NC} n_l r_l \\right)^2} \\right) !! !! !! ### Fredenslund et al. (UNIFAC) !! !! \\frac{G^{E,\\text{UNIFAC}}}{RT} = !! \\frac{G^{E,FH}}{RT} + \\frac{G^{E,SG}}{RT} !! !! !! # References !! 1. [SINTEF - Thermopack](https://github.com/thermotools/thermopack) class ( UNIFAC ) :: self real ( pr ), intent ( in ) :: n ( self % nmolecules ) !! Moles vector [mol] real ( pr ), intent ( in ) :: T !! Temperature [K] real ( pr ), optional , intent ( out ) :: Ge !! Combinatorial Gibbs excess energy real ( pr ), optional , intent ( out ) :: dGe_dn ( self % nmolecules ) !! \\frac{dGe}{dn} real ( pr ), optional , intent ( out ) :: dGe_dn2 ( self % nmolecules , self % nmolecules ) !! \\frac{d^2Ge}{dn^2} ! Flory-Huggins variables real ( pr ) :: Ge_fh real ( pr ) :: dGe_fh_dn ( self % nmolecules ) real ( pr ) :: dGe_fh_dn2 ( self % nmolecules , self % nmolecules ) ! Staverman-Guggenheim variables real ( pr ) :: Ge_sg real ( pr ) :: dGe_sg_dn ( self % nmolecules ) real ( pr ) :: dGe_sg_dn2 ( self % nmolecules , self % nmolecules ) ! utility real ( pr ) :: nq , nr , n_t integer :: i , j associate (& q => self % molecules % surface_area ,& r => self % molecules % volume ,& z => self % z & ) nr = dot_product ( n , r ) nq = dot_product ( n , q ) n_t = sum ( n ) if ( present ( Ge )) then Ge_fh = sum ( n * log ( r )) - n_t * log ( nr ) + n_t * log ( n_t ) Ge_sg = z / 2 * sum ( n * q * ( log ( q / r ) - log ( nq ) + log ( nr ))) end if if ( present ( dGe_dn )) then dGe_fh_dn = log ( r ) - log ( nr ) + log ( n_t ) + 1.0_pr - n_t * r / nr dGe_sg_dn = z / 2 * q * ( - log (( r * nq ) / ( q * nr )) - 1.0_pr + ( r * nq ) / ( q * nr )) end if if ( present ( dGe_dn2 )) then dGe_fh_dn2 = 0.0_pr dGe_sg_dn2 = 0.0_pr do concurrent ( i = 1 : size ( n ), j = 1 : size ( n )) dGe_fh_dn2 ( i , j ) = - ( r ( i ) + r ( j )) / nr + 1.0_pr / n_t + n_t * r ( i ) * r ( j ) / nr ** 2 dGe_sg_dn2 ( i , j ) = z / 2.0_pr * ( - q ( i ) * q ( j ) / nq + ( q ( i ) * r ( j ) + q ( j ) * r ( i )) / nr - r ( i ) * r ( j ) * nq / nr ** 2 ) end do end if end associate if ( present ( Ge )) Ge = ( Ge_fh + Ge_sg ) * R * T if ( present ( dGe_dn )) dGe_dn = ( dGe_fh_dn + dGe_sg_dn ) * R * T if ( present ( dGe_dn2 )) dGe_dn2 = ( dGe_fh_dn2 + dGe_sg_dn2 ) * R * T end subroutine Ge_combinatorial subroutine Ge_residual ( self , n , T , Ge , dGe_dn , dGe_dn2 , dGe_dT , dGe_dT2 , dGe_dTn ) !! # UNIFAC residual term !! Evaluate the UNIFAC residual therm !! !! # Description !! Evaluate the UNIFAC residual therm. The residual Gibbs excess energy !! and its derivatives are evaluated as: !! !! !! \\frac{G^{E,R}}{RT} = - \\sum_i^{NC} n_i \\sum_k^{NG} v_k^i Q_k !! (\\Lambda_k - \\Lambda_k^i) !! !! !! With: !! !! !! \\Lambda_k = \\text{ln} \\, \\sum_{j}^{NG} \\Theta_j E_{jk} !! !! !! !! \\Lambda_k^i = \\text{ln} \\, \\sum_{j}^{NG} \\Theta_j^i E_{jk} !! !! !! !! E_{jk} = \\text{exp} \\left(- \\frac{U_{jk}}{RT} \\right) !! !! !! !! \\Theta_j = \\frac{Q_j \\displaystyle \\sum_{l}^{NC} n_l v_j^l} !! {\\displaystyle \\sum_{k}^{NC} n_k \\sum_{m}^{NG} v_m^l Q_m} !! !! !! !! \\Theta_j^i = \\frac{Q_j v_j^i}{\\displaystyle \\sum_k^{NG} v_k^i Q_k} !! !! !! In the UNIFAC model, the \\Theta_j^i values are calculated assuming !! that the molecule \"i\" is pure, hence only the subgroups of the molecule !! \"i\" must be considered for the calculation. On the other hand, for the !! \\Theta_j values, all the system's subgroups are considered. !! !! ##### The compositional derivatives: !! !! !! \\frac{1}{R T} \\frac{\\partial G^{E,R}}{\\partial n_\\alpha} = !! - \\sum_k^{\\mathrm{NG}} v_k^\\alpha Q_k \\left(\\Lambda_k - !! \\Lambda_k^\\alpha \\right) - \\sum_i^{\\mathrm{NC}} n_i !! \\sum_k^{\\mathrm{NG}} v_k^i Q_k !! \\frac{\\partial \\Lambda_k}{\\partial n_\\alpha} !! !! !! !! \\frac{1}{R T} \\frac{\\partial^2 G^{E,R}}{\\partial n_ !! \\alpha \\partial n_\\beta} = -\\sum_k^{\\mathrm{NG}} Q_k \\left(v_k^\\alpha !! \\frac{\\partial \\Lambda_k}{\\partial n_\\beta} + v_k^\\beta !! \\frac{\\partial \\Lambda_k}{\\partial n_\\alpha}\\right) !! - \\sum_k^{\\mathrm{NG}} \\left(\\sum_i^{\\mathrm{NC}} n_i v_k^i\\right) Q_k !! \\frac{\\partial^2 \\Lambda_k}{\\partial n_\\alpha \\partial n_\\beta} !! !! !! With: !! !! !! \\frac{\\partial \\Lambda_k}{\\partial n_\\alpha} !! = \\frac{\\sum_j^{\\mathrm{NG}} v_j^\\alpha Q_j E_{j k}} !! {\\sum_l^{\\mathrm{NC}} n_l \\sum_j^{\\mathrm{NG}} v_j^l Q_j !! E_{j k}} - \\frac{\\sum_m^{\\mathrm{NG}} v_m^\\alpha Q_m} !! {\\sum_l^{\\mathrm{NC}} n_l \\sum_m^{\\mathrm{NG}} v_m^l Q_m} !! !! !! !! \\frac{\\partial^2 \\Lambda_k}{\\partial n_\\alpha \\partial n_\\beta} !! = - \\frac{\\left(\\sum_j^{\\mathrm{NG}} v_j^\\alpha Q_j E_{j k}\\right) !! \\left(\\sum_j^{\\mathrm{NG}} v_j^\\beta Q_j E_{j k}\\right)} !! {\\left(\\sum_l^{\\mathrm{NC}} n_l \\sum_j^{\\mathrm{NG}} v_j^l Q_j !! E_{j k}\\right)^2} + \\frac{\\left(\\sum_m^{\\mathrm{NG}} v_m^\\alpha !! Q_m\\right)\\left(\\sum_m^{\\mathrm{NG}} v_m^\\beta Q_m\\right)} !! {\\left(\\sum_l^{\\mathrm{NC}} n_l !! \\sum_m^{\\mathrm{NG}} v_m^l Q_m\\right)^2} !! !! !! ##### The temperature derivatives: !! !! !! \\frac{\\partial\\left(\\frac{G^{E, R}}{R T}\\right)}{\\partial T} = !! -\\sum_i^{\\mathrm{NC}} n_i \\sum_k^{\\mathrm{NG}} v_k^i Q_k !! \\left(\\frac{\\partial \\Lambda_k}{\\partial T} !! -\\frac{\\partial \\Lambda_k^i}{\\partial T}\\right) !! !! !! !! \\frac{\\partial^2\\left(\\frac{G^{E,R}}{R T}\\right)}{\\partial T^2} = !! -\\sum_i^{\\mathrm{NC}} n_i \\sum_k^{\\mathrm{NG}} v_k^i Q_k !! \\left(\\frac{\\partial^2 \\Lambda_k}{\\partial T^2} - !! \\frac{\\partial^2 \\Lambda_k^i}{\\partial T^2}\\right) !! !! !! With: !! !! !! \\frac{\\partial \\Lambda_k}{\\partial T} = !! \\frac{\\sum_{j}^{NG} \\Theta_j \\frac{d E_{jk}}{dT}} !! {\\sum_{j}^{NG} \\Theta_j E_{jk}} !! !! !! !! \\frac{\\partial \\Lambda_k^i}{\\partial T} = !! \\frac{\\sum_{j}^{NG} \\Theta_j^i \\frac{d E_{jk}}{dT}} !! {\\sum_{j}^{NG} \\Theta_j^i E_{jk}} !! !! !! !! \\frac{\\partial^2 \\Lambda_k}{\\partial T^2} = !! \\frac{\\sum_{j}^{NG} \\Theta_j \\frac{d^2 E_{jk}}{dT^2}} !! {\\sum_{j}^{NG} \\Theta_j E_{jk}} !! - \\left(\\frac{\\partial \\Lambda_k}{\\partial T} \\right)^2 !! !! !! !! \\frac{\\partial^2 \\Lambda_k^i}{\\partial T^2} = !! \\frac{\\sum_{j}^{NG} \\Theta_j^i \\frac{d^2 E_{jk}}{dT^2}} !! {\\sum_{j}^{NG} \\Theta_j^i E_{jk}} !! - \\left(\\frac{\\partial \\Lambda_k^i}{\\partial T} \\right)^2 !! !! !! ##### Temperature-compositional cross derivative: !! !! !! \\frac{\\partial \\left(\\frac{G^{E, R}}{R T} \\right)} !! {\\partial n_\\alpha \\partial T}= !! -\\sum_k^{\\mathrm{NG}} v_k^\\alpha Q_k \\left(\\frac{\\partial \\Lambda_k} !! {\\partial T} - \\frac{\\partial \\Lambda_k^\\alpha}{\\partial T}\\right) !! -\\sum_k^{\\mathrm{NG}} \\left(\\sum_i^{\\mathrm{NC}} n_i v_k^i \\right) !! Q_k \\frac{\\partial^2 \\Lambda_k}{\\partial n_\\alpha \\partial T} !! !! !! With: !! !! !! \\frac{\\partial^2 \\Lambda_k}{\\partial n_\\alpha \\partial T} = !! \\frac{\\sum_j^{\\mathrm{NG}} v_j^\\alpha Q_j \\frac{\\partial !! \\tilde{E}_{j k}}{\\partial T}}{\\sum_l^{\\mathrm{NC}} n_l !! \\sum_j^{\\mathrm{NG}} v_j^l Q_j \\tilde{E}_{j k}} - !! \\frac{\\left(\\sum_j^{\\mathrm{NG}} v_j^\\alpha Q_j \\tilde{E}_{j k}\\right) !! \\left(\\sum_l^{\\mathrm{NC}} n_l \\sum_j^{\\mathrm{NG}} v_j^l Q_j !! \\frac{\\partial \\tilde{E}_{j k}}{\\partial T}\\right)} !! {\\left(\\sum_l^{\\mathrm{NC}} n_l !! \\sum_j^{\\mathrm{NG}} v_j^l Q_j \\tilde{E}_{j k}\\right)^2} !! !! !! # References !! 1. [SINTEF - Thermopack](https://github.com/thermotools/thermopack) class ( UNIFAC ) :: self real ( pr ), intent ( in ) :: n ( self % nmolecules ) !! Moles vector real ( pr ), intent ( in ) :: T !! Temperature [K] real ( pr ), optional , intent ( out ) :: Ge !! Residual Gibbs excess energy real ( pr ), optional , intent ( out ) :: dGe_dn ( self % nmolecules ) !! \\frac{\\partial G^{E,R}}{\\partial n} real ( pr ), optional , intent ( out ) :: dGe_dn2 ( self % nmolecules , self % nmolecules ) !! \\frac{\\partial^2 G^{E,R}}{\\partial n^2} real ( pr ), optional , intent ( out ) :: dGe_dT !! \\frac{\\partial G^{E,R}}{\\partial T} real ( pr ), optional , intent ( out ) :: dGe_dT2 !! \\frac{\\partial^2 G^{E,R}}{\\partial T^2} real ( pr ), optional , intent ( out ) :: dGe_dTn ( self % nmolecules ) !! \\frac{\\partial^2 G^{E,R}}{\\partial n \\partial T} ! Thetas variables real ( pr ) :: theta_j ( self % ngroups ) ! Ejk variables real ( pr ) :: Ejk ( self % ngroups , self % ngroups ) real ( pr ) :: dEjk_dt ( self % ngroups , self % ngroups ) real ( pr ) :: dEjk_dt2 ( self % ngroups , self % ngroups ) ! Lambdas variables real ( pr ) :: lambda_k ( self % ngroups ) real ( pr ) :: dlambda_k_dT ( self % ngroups ) real ( pr ) :: dlambda_k_dT2 ( self % ngroups ) real ( pr ) :: dlambda_k_dn ( self % nmolecules , self % ngroups ) real ( pr ) :: dlambda_k_dn2 ( self % nmolecules , self % nmolecules , self % ngroups ) real ( pr ) :: dlambda_k_dndT ( self % nmolecules , self % ngroups ) real ( pr ) :: lambda_ik ( self % nmolecules , self % ngroups ) real ( pr ) :: dlambda_ik_dT ( self % nmolecules , self % ngroups ) real ( pr ) :: dlambda_ik_dT2 ( self % nmolecules , self % ngroups ) ! Auxiliars real ( pr ) :: Ge_aux , dGe_dT_aux , dGe_dn_aux ( self % nmolecules ) real ( pr ) :: sum_vij_Qj_Ejk ( self % nmolecules , self % ngroups ) real ( pr ) :: sum_ni_vij_Qj_Ejk ( self % ngroups ) real ( pr ) :: sum_vik_Qk ( self % nmolecules ) real ( pr ) :: sum_vQ_Lambda ( self % nmolecules ) real ( pr ) :: sum_nl_vlj ( self % ngroups ) real ( pr ) :: sum_ni_vik_Qk real ( pr ) :: aux_sum ( self % nmolecules ) real ( pr ) :: sum_Q_v_dlambda_k_dn ( self % nmolecules , self % nmolecules ) real ( pr ) :: aux_sum2 real ( pr ) :: sum_vij_Qj_dEjk_dT ( self % nmolecules , self % ngroups ) real ( pr ) :: sum_vij_Qj_dEjk_dT2 ( self % nmolecules , self % ngroups ) real ( pr ) :: sum_ni_vij_Qj_dEjk_dT ( self % ngroups ) real ( pr ) :: sum_vij_Qj_dlambdas_dT ( self % nmolecules ) real ( pr ) :: sum_vij_Qj_dlambdas_dT2 ( self % nmolecules ) ! Indexes used for groups integer :: j , k ! Indexes used for components integer :: i , l ! logicals logical :: pge , dn , dn2 , dt , dt2 , dtn pge = present ( Ge ) dn = present ( dGe_dn ) dn2 = present ( dGe_dn2 ) dt = present ( dGe_dT ) dt2 = present ( dGe_dT2 ) dtn = present ( dGe_dTn ) ! ======================================================================== ! Ejk ! ------------------------------------------------------------------------ if (( dt . or . dtn ) . and . . not . dt2 ) then call self % psi_function % psi (& self % groups_stew , T , psi = Ejk , dpsi_dt = dEjk_dt & ) elseif ( dt2 . and . . not . ( dt . or . dtn )) then call self % psi_function % psi (& self % groups_stew , T , psi = Ejk , dpsi_dt2 = dEjk_dt2 & ) else call self % psi_function % psi (& self % groups_stew , T , psi = Ejk , dpsi_dt = dEjk_dt , dpsi_dt2 = dEjk_dt2 & ) end if ! ======================================================================== ! Auxiliars ! ------------------------------------------------------------------------ do i = 1 , self % nmolecules sum_vik_Qk ( i ) = sum ( self % vij ( i ,:) * self % qk ) end do sum_ni_vik_Qk = sum ( n * sum_vik_Qk ) if ( dtn . or . dt2 . or . dt ) then do concurrent ( i = 1 : self % nmolecules , k = 1 : self % ngroups ) sum_vij_Qj_dEjk_dT ( i , k ) = sum ( self % vij ( i ,:) * self % qk * dEjk_dT (:, k )) sum_vij_Qj_dEjk_dT2 ( i , k ) = sum ( self % vij ( i ,:) * self % qk * dEjk_dT2 (:, k )) end do end if ! ======================================================================== ! Thetas ! ------------------------------------------------------------------------ do j = 1 , self % ngroups sum_nl_vlj ( j ) = sum ( n * self % vij (:, j )) theta_j ( j ) = sum_nl_vlj ( j ) * self % qk ( j ) / sum_ni_vik_Qk end do ! ======================================================================== ! Lambda_k ! ------------------------------------------------------------------------ ! Lambda_k if ( pge . or . dn . or . dt . or . dtn ) then do k = 1 , self % ngroups lambda_k ( k ) = log ( sum ( theta_j * Ejk (:, k ))) end do end if ! Lambda_k first compositional derivatives if ( dn . or . dt . or . dt2 . or . dtn . or . dn2 ) then do concurrent ( i = 1 : self % nmolecules , k = 1 : self % ngroups ) sum_vij_Qj_Ejk ( i , k ) = sum ( self % vij ( i ,:) * self % qk * Ejk (:, k )) end do do k = 1 , self % ngroups sum_ni_vij_Qj_Ejk ( k ) = sum ( n * sum_vij_Qj_Ejk (:, k )) end do do i = 1 , self % nmolecules dlambda_k_dn ( i ,:) = sum_vij_Qj_Ejk ( i ,:) / sum_ni_vij_Qj_Ejk - sum_vik_Qk ( i ) / sum_ni_vik_Qk end do end if ! Lambda_k second compositional derivatives if ( dn2 ) then do concurrent ( i = 1 : self % nmolecules , l = 1 : self % nmolecules ) sum_Q_v_dlambda_k_dn ( i , l ) = sum ( self % qk * self % vij ( l ,:) * dlambda_k_dn ( i ,:)) dlambda_k_dn2 ( i , l ,:) = (& - sum_vij_Qj_Ejk ( i ,:) * sum_vij_Qj_Ejk ( l ,:) / sum_ni_vij_Qj_Ejk ** 2 & + sum_vik_Qk ( i ) * sum_vik_Qk ( l ) / sum_ni_vik_Qk ** 2 & ) end do end if ! Temperature derivatives if ( dt . or . dtn . or . dt2 ) then do k = 1 , self % ngroups sum_ni_vij_Qj_dEjk_dT ( k ) = sum ( n * sum_vij_Qj_dEjk_dT (:, k )) dlambda_k_dT ( k ) = sum ( theta_j * dEjk_dt (:, k )) / sum ( theta_j * Ejk (:, k )) dlambda_k_dT2 ( k ) = sum ( n * sum_vij_Qj_dEjk_dT2 (:, k )) / sum_ni_vij_Qj_Ejk ( k ) - dlambda_k_dT ( k ) ** 2 end do end if if ( dtn ) then do i = 1 , self % nmolecules dlambda_k_dndT ( i ,:) = (& sum_vij_Qj_dEjk_dT ( i ,:) / sum_ni_vij_Qj_Ejk & - sum_vij_Qj_Ejk ( i ,:) * sum_ni_vij_Qj_dEjk_dT / sum_ni_vij_Qj_Ejk ** 2 & ) end do end if ! ======================================================================== ! Lambda_ik ! ------------------------------------------------------------------------ if ( pge . or . dn . or . dt . or . dtn ) then lambda_ik = 0.0_pr do concurrent ( i = 1 : self % nmolecules , k = 1 : self % ngroups ) if ( self % vij ( i , k ) /= 0 ) then lambda_ik ( i , k ) = log ( sum ( self % thetas_ij ( i , :) * Ejk (:, k ))) end if end do end if ! Temperature derivatives if ( dt . or . dt2 . or . dtn ) then dlambda_ik_dT = 0.0_pr do concurrent ( i = 1 : self % nmolecules , k = 1 : self % ngroups ) if ( self % vij ( i , k ) /= 0 ) then dlambda_ik_dT ( i , k ) = sum ( self % thetas_ij ( i ,:) * dEjk_dt (:, k )) / sum ( self % thetas_ij ( i ,:) * Ejk (:, k )) end if end do if ( dt2 ) dlambda_ik_dT2 = sum_vij_Qj_dEjk_dT2 / sum_vij_Qj_Ejk - dlambda_ik_dT * dlambda_ik_dT end if ! ======================================================================== ! Ge ! ------------------------------------------------------------------------ if ( pge . or . dn . or . dt . or . dtn ) then do i = 1 , self % nmolecules sum_vQ_Lambda ( i ) = sum ( self % vij ( i ,:) * self % qk * ( lambda_k - lambda_ik ( i ,:))) end do Ge_aux = - sum ( n * sum_vQ_Lambda ) end if ! ======================================================================== ! dGe_dn ! ------------------------------------------------------------------------ if ( dn . or . dtn ) then do i = 1 , self % nmolecules aux_sum ( i ) = sum ( sum_nl_vlj * self % qk * dlambda_k_dn ( i ,:)) end do dGe_dn_aux = - sum_vQ_Lambda - aux_sum end if ! ======================================================================== ! dGe_dn2 ! ------------------------------------------------------------------------ if ( dn2 ) then do concurrent ( i = 1 : self % nmolecules , l = 1 : self % nmolecules ) aux_sum2 = sum ( sum_nl_vlj * dlambda_k_dn2 ( i , l ,:) * self % qk ) dGe_dn2 ( i , l ) = - ( sum_Q_v_dlambda_k_dn ( i , l ) + sum_Q_v_dlambda_k_dn ( l , i )) - aux_sum2 end do end if ! ======================================================================== ! dGe_dT, dGe_dT2, dGE_dnT ! ------------------------------------------------------------------------ if ( dt . or . dt2 . or . dtn ) then do i = 1 , self % nmolecules sum_vij_Qj_dlambdas_dT ( i ) = sum ( self % vij ( i ,:) * self % qk * ( dlambda_k_dT - dlambda_ik_dT ( i ,:))) end do dGe_dT_aux = - sum ( n * sum_vij_Qj_dlambdas_dT ) end if if ( dt2 ) then do i = 1 , self % nmolecules sum_vij_Qj_dlambdas_dT2 ( i ) = sum ( self % vij ( i ,:) * self % qk * ( dlambda_k_dT2 - dlambda_ik_dT2 ( i ,:))) end do dGe_dT2 = - sum ( n * sum_vij_Qj_dlambdas_dT2 ) end if if ( dtn ) then do i = 1 , self % nmolecules aux_sum ( i ) = sum ( sum_nl_vlj * self % qk * dlambda_k_dndT ( i ,:)) end do dGe_dTn = - sum_vij_Qj_dLambdas_dT - aux_sum end if ! ======================================================================== ! From reduced Ge to Ge ! ------------------------------------------------------------------------ if ( present ( Ge )) then Ge = Ge_aux * R * T end if if ( present ( dGe_dT )) then dGe_dT = R * ( Ge_aux + dGe_dT_aux * T ) end if if ( present ( dGe_dT2 )) then dGe_dT2 = R * ( 2.0 * dGe_dT_aux + T * dGe_dT2 ) end if if ( present ( dGe_dTn )) then dGe_dTn = R * ( dGe_dn_aux + dGe_dTn * T ) end if if ( present ( dGe_dn )) then dGe_dn = dGe_dn_aux * R * T end if if ( present ( dGe_dn2 )) then dGe_dn2 = dGe_dn2 * R * T end if end subroutine Ge_residual subroutine UNIFAC_temperature_dependence (& self , systems_groups , T , psi , dpsi_dt , dpsi_dt2 & ) !! # UNIFAC temperature dependence !! Implementation of the \\psi(T) function of the UNIFAC model. !! !! !! \\psi_{ij}(T) = \\exp(-\\frac{A_{ij}}{T}) !! !! !! !! \\frac{d \\psi_{ij}(T)}{dT} = \\frac{A_{ij}}{T^2} !! \\exp(-\\frac{A_{ij}}{T}) !! !! !! !! \\frac{d^2 \\psi_{ij}(T)}{dT^2} = !! \\frac{Aij (Aij - 2T)}{T^4} \\exp(-\\frac{A_{ij}}{T}) !! !! !! # References !! 1. [Dortmund Data Bank Software & Separation Technology](https://www.ddbst !! .com/published-parameters-unifac.html) !! 2. Fredenslund, A., Jones, R. L., & Prausnitz, J. M. (1975). !! Group‐contribution estimation of activity coefficients in nonideal liquid !! mixtures. AIChE Journal, 21(6), 1086–1099. !! [https://doi.org/10.1002/aic.690210607](https://doi.org/10.1002/aic.690210607) !! 3. Skjold-Jorgensen, S., Kolbe, B., Gmehling, J., & Rasmussen, P. (1979). !! Vapor-Liquid Equilibria by UNIFAC Group Contribution. Revision and !! Extension. Industrial & Engineering Chemistry Process Design and !! Development, 18(4), 714–722. !! [https://doi.org/10.1021/i260072a024](https://doi.org/10.1021/i260072a024) !! 4. Gmehling, J., Rasmussen, P., & Fredenslund, A. (1982). Vapor-liquid !! equilibriums by UNIFAC group contribution. Revision and extension. 2. !! Industrial & Engineering Chemistry Process Design and Development, 21(1), !! 118–127. !! [https://doi.org/10.1021/i200016a021](https://doi.org/10.1021/i200016a021) !! 5. Macedo, E. A., Weidlich, U., Gmehling, J., & Rasmussen, P. (1983). !! Vapor-liquid equilibriums by UNIFAC group contribution. Revision and !! extension. 3. Industrial & Engineering Chemistry Process Design and !! Development, 22(4), 676–678. !! [https://doi.org/10.1021/i200023a023](https://doi.org/10.1021/i200023a023) !! 6. Tiegs, D., Rasmussen, P., Gmehling, J., & Fredenslund, A. (1987). !! Vapor-liquid equilibria by UNIFAC group contribution. 4. Revision and !! extension. Industrial & Engineering Chemistry Research, 26(1), 159–161. !! [https://doi.org/10.1021/ie00061a030](https://doi.org/10.1021/ie00061a030) !! 7. Hansen, H. K., Rasmussen, P., Fredenslund, A., Schiller, M., & !! Gmehling, J. (1991). Vapor-liquid equilibria by UNIFAC group !! contribution. 5. Revision and extension. Industrial & Engineering !! Chemistry Research, 30 (10), 2352–2355. !! [https://doi.org/10.1021/ie00058a017](https://doi.org/10.1021/ie00058a017) !! 8. Wittig, R., Lohmann, J., & Gmehling, J. (2003). Vapor−Liquid Equilibria !! by UNIFAC Group Contribution. 6. Revision and Extension. Industrial & !! Engineering Chemistry Research, 42(1), 183–188. !! [https://doi.org/10.1021/ie020506l](https://doi.org/10.1021/ie020506l) !! 9. [SINTEF - Thermopack](https://github.com/thermotools/thermopack) !! class ( UNIFACPsi ) :: self !! \\psi function class ( Groups ) :: systems_groups !! Groups in the system real ( pr ), intent ( in ) :: T !! Temperature [K] real ( pr ), optional , intent ( out ) :: psi (:, :) !! \\psi real ( pr ), optional , intent ( out ) :: dpsi_dt (:, :) !! \\frac{d \\psi}{dT} real ( pr ), optional , intent ( out ) :: dpsi_dt2 (:, :) !! \\frac{d^2 \\psi}{dT^2} integer :: i , j integer :: ngroups real ( pr ) :: Aij real ( pr ) :: Eij ngroups = size ( systems_groups % groups_ids ) do concurrent ( i = 1 : ngroups , j = 1 : ngroups ) Aij = self % Aij ( i , j ) Eij = exp ( - Aij / T ) if ( present ( psi )) & psi ( i , j ) = Eij if ( present ( dpsi_dt )) & dpsi_dt ( i , j ) = Aij * Eij / T ** 2 if ( present ( dpsi_dt2 )) & dpsi_dt2 ( i , j ) = Aij * ( Aij - 2_pr * T ) * Eij / T ** 4 end do end subroutine UNIFAC_temperature_dependence function thetas_i ( nm , ng , parameters , stew , molecules ) result ( thetas_ij ) !! # \\Theta_i calculation !! Calculate the area fraciton of each froup on each molecule. !! !! # Description !! Calculate the area fraciton of each froup on each molecule. The values !! are obtained on the setup_unifac function and stored on the UNIFAC !! type, since the values can be reused (no compositional or temperature !! dependence) !! !! # References !! 1. [SINTEF - Thermopack](https://github.com/thermotools/thermopack) integer , intent ( in ) :: nm !! Number of molecules integer , intent ( in ) :: ng !! Number of groups type ( GeGCModelParameters ), intent ( in ) :: parameters !! UNIFAC parameters type ( Groups ), intent ( in ) :: stew !! All the groups present in the system type ( Groups ), intent ( in ) :: molecules (:) !! Molecules real ( pr ) :: thetas_ij ( nm , ng ) !! Group j area fraction on molecule i real ( pr ) :: total_area_i ( nm ) real ( pr ) :: qki_contribution integer :: gi integer :: i , j , k thetas_ij = 0.0_pr total_area_i = 0.0_pr ! Obtain the total area of each molecule do i = 1 , size ( molecules ) do k = 1 , size ( molecules ( i )% number_of_groups ) gi = molecules ( i )% groups_ids ( k ) ! Contribution of the group k to the molecule i area. qki_contribution = (& parameters % get_subgroup_Q ( gi ) * molecules ( i )% number_of_groups ( k )& ) ! Adding to the total area of each molecule total_area_i ( i ) = total_area_i ( i ) + qki_contribution end do end do ! Calculate the fraction of each group on each molecule thetas_ij = 0.0_pr do i = 1 , size ( molecules ) do k = 1 , size ( molecules ( i )% number_of_groups ) gi = molecules ( i )% groups_ids ( k ) j = findloc ( stew % groups_ids , gi , dim = 1 ) thetas_ij ( i , j ) = (& parameters % get_subgroup_Q ( gi ) & * molecules ( i )% number_of_groups ( k ) & / total_area_i ( i ) & ) end do end do end function thetas_i type ( UNIFAC ) function setup_unifac ( molecules , parameters ) !! # Setup UNIFAC !! Instantiate a UNIFAC model !! !! # Description !! Subroutine used to instantiate a UNIFAC model. !! !! # Examples !! !! ```fortran !! ! Instantiate an UNIFAC model with ethanol-water mix and calculate gammas !! use yaeos, only: pr, Groups, setup_unifac, UNIFAC !! !! type(UNIFAC) :: model !! type(Groups) :: molecules(2) !! real(pr) :: ln_gammas(2) !! !! ! Ethanol definition [CH3, CH2, OH] !! molecules(1)%groups_ids = [1, 2, 14] ! Subgroups ids !! molecules(1)%number_of_groups = [1, 1, 1] ! Subgroups occurrences !! !! ! Water definition [H2O] !! molecules(2)%groups_ids = [16] !! molecules(2)%number_of_groups = [1] !! !! ! Model setup !! model = setup_unifac(molecules) !! !! ! Calculate ln_gammas !! call model%ln_activity_coefficient([0.5_pr, 0.5_pr], 298.0_pr, ln_gammas) !! !! print *, ln_gammas ! result: 0.18534142000449058 0.40331395945417559 !! ``` !! !! # References !! 1. [Dortmund Data Bank Software & Separation Technology](https://www.ddbst !! .com/published-parameters-unifac.html) !! type ( Groups ), intent ( in ) :: molecules (:) !! Molecules (Group type) objects type ( GeGCModelParameters ), optional , intent ( in ) :: parameters !! UNIFAC parameters type ( Groups ) :: soup type ( UNIFACPsi ) :: psi_function ! UNIFAC parameters type ( GeGCModelParameters ) :: params ! Usefull matrixes to store integer , allocatable :: vij (:, :) real ( pr ), allocatable :: qks (:), Aij (:, :) integer :: gi , i , j , k setup_unifac % molecules = molecules allocate ( soup % groups_ids ( 0 )) allocate ( soup % number_of_groups ( 0 )) ! ======================================================================== ! Load default UNIFAC parameters if not provided ! ------------------------------------------------------------------------ if (. not . present ( parameters )) then params = UNIFACParameters () else params = parameters end if ! ======================================================================== ! Count all the individual groups and each molecule volume and area ! ------------------------------------------------------------------------ associate (& r => setup_unifac % molecules % volume , & q => setup_unifac % molecules % surface_area & ) ! Get all the groups indexes and counts into a single stew of groups. do i = 1 , size ( molecules ) r ( i ) = 0 q ( i ) = 0 do j = 1 , size ( molecules ( i )% groups_ids ) gi = molecules ( i )% groups_ids ( j ) ! Calculate molecule i volume and area r ( i ) = r ( i ) + molecules ( i )% number_of_groups ( j ) * params % get_subgroup_R ( gi ) q ( i ) = q ( i ) + molecules ( i )% number_of_groups ( j ) * params % get_subgroup_Q ( gi ) if ( all ( soup % groups_ids - gi /= 0 )) then ! Add group if it wasn't included yet soup % groups_ids = [ soup % groups_ids , gi ] soup % number_of_groups = [ soup % number_of_groups , 0 ] end if ! Find where is the group located in the main soup of ! groups. gi = findloc ( soup % groups_ids - gi , 0 , dim = 1 ) soup % number_of_groups ( gi ) = soup % number_of_groups ( gi ) & + molecules ( i )% number_of_groups ( j ) end do end do end associate ! ======================================================================== ! Build vij matrix (occurrence of each group of the soup on each molecule) ! ------------------------------------------------------------------------ allocate ( vij ( size ( molecules ), size ( soup % number_of_groups ))) vij = 0 do i = 1 , size ( molecules ) do k = 1 , size ( molecules ( i )% number_of_groups ) gi = molecules ( i )% groups_ids ( k ) ! Index of group for Area j = findloc ( soup % groups_ids , gi , dim = 1 ) vij ( i , j ) = molecules ( i )% number_of_groups ( k ) end do end do ! ======================================================================== ! Build qk vector (area of each group in the soup) ! ------------------------------------------------------------------------ allocate ( qks ( size ( soup % number_of_groups ))) qks = 0.0_pr do k = 1 , size ( soup % groups_ids ) qks ( k ) = params % get_subgroup_Q ( soup % groups_ids ( k )) end do ! ======================================================================== ! Build Aij matrix (interaction of the soup's subgroups) ! ------------------------------------------------------------------------ allocate ( Aij ( size ( soup % groups_ids ), size ( soup % groups_ids ))) Aij = 0.0_pr do i = 1 , size ( soup % groups_ids ) do j = 1 , size ( soup % groups_ids ) Aij ( i , j ) = params % get_subgroups_aij (& soup % groups_ids ( i ), soup % groups_ids ( j ) & ) end do end do ! ======================================================================== psi_function % Aij = Aij setup_unifac % groups_stew = soup setup_unifac % ngroups = size ( soup % number_of_groups ) setup_unifac % nmolecules = size ( molecules ) setup_unifac % psi_function = psi_function setup_unifac % group_area = params % subgroups_Qs setup_unifac % group_volume = params % subgroups_Rs setup_unifac % thetas_ij = thetas_i (& size ( molecules ), size ( soup % number_of_groups ), params , soup , molecules ) setup_unifac % vij = vij setup_unifac % qk = qks end function setup_unifac end module yaeos__models_ge_group_contribution_unifac","tags":"","loc":"sourcefile/unifac.f90.html"},{"title":"continuation.f90 – yaeos","text":"Source Code module yaeos__math_continuation !! Implementation of Algower's numerical continuation method. use yaeos__constants , only : pr use yaeos__math_linalg , only : solve_system implicit none type :: ContinuationVariable real ( pr ), allocatable :: X (:) integer :: ns real ( pr ) :: S real ( pr ) :: dS end type abstract interface subroutine continuation_function ( X , ns , S , F , dF , dFdS ) import pr real ( pr ), intent ( in ) :: X (:) integer , intent ( in ) :: ns real ( pr ), intent ( in ) :: S real ( pr ), intent ( out ) :: F (:) real ( pr ), intent ( out ) :: dF (:, :) real ( pr ), intent ( out ) :: dFdS (:) end subroutine continuation_function end interface abstract interface subroutine process ( X , ns , S , dS , dXdS , iterations ) !! Subroutine to make variation in the method after a point converged import pr real ( pr ), intent ( in out ) :: X (:) !! Vector of variables X integer , intent ( in out ) :: ns !! Position of specified variable real ( pr ), intent ( in out ) :: S !! Specification variable value real ( pr ), intent ( in out ) :: dS !! Step of specification in the method real ( pr ), intent ( in out ) :: dXdS (:) !! \\frac{dX}{dS} integer , intent ( in ) :: iterations !! Iterations needed to converge point end subroutine process logical function continuation_stopper ( X , ns , S , dS , dXdS , iterations ) !! Function that returns true if the method should stop import pr real ( pr ), intent ( in out ) :: X (:) !! Vector of variables X integer , intent ( in out ) :: ns !! Position of specified variable real ( pr ), intent ( in out ) :: S !! Specification variable value real ( pr ), intent ( in out ) :: dS !! Step of specification in the method real ( pr ), intent ( in out ) :: dXdS (:) !! \\frac{dX}{dS} integer , intent ( in ) :: iterations !! Iterations needed to converge point end function continuation_stopper end interface abstract interface subroutine continuation_solver (& fun , iters , X , ns , S , dS , dXdS , point , max_iters , F , dF , dFdS , tol & ) !! Solver to solve a point during numerical contination. import pr , continuation_function procedure ( continuation_function ) :: fun !! Function to solve integer , intent ( out ) :: iters !! Number of iterations needed real ( pr ), intent ( in out ) :: X (:) !! Variables vector integer , intent ( in ) :: ns !! Specification number real ( pr ), intent ( in ) :: S !! Specification value real ( pr ), intent ( in ) :: dS !! Delta spec real ( pr ), intent ( in ) :: dXdS (:) !! integer , intent ( in ) :: point !! Point number integer , intent ( in ) :: max_iters !! Maximum iterations real ( pr ), intent ( out ) :: F (:) !! Function values at solved point real ( pr ), intent ( out ) :: df (:, :) !! Jacobian values real ( pr ), intent ( out ) :: dfds (:) !! dFdS real ( pr ), intent ( in ) :: tol !! Solver tolerance end subroutine continuation_solver end interface contains function continuation (& f , X0 , ns0 , S0 , dS0 , max_points , solver_tol , & update_specification , postprocess , solver , stop & ) result ( XS ) !! Numerical continuation of a function. !! !! Uses Algower method of numerical continuation to trace a line that !! solves a system of the kind: !! !! F(X,S) = 0 !! !! Where X is the variables vector and S)\\ is the value of the !! specification. !! The method works with by providing a good set of initial points to !! solve the system of equations with an extrapolation using the previous !! solved point information. procedure ( continuation_function ) :: f !! Function to trace real ( pr ), intent ( in ) :: X0 (:) !! Initial point integer , intent ( in ) :: ns0 !! Initial specification real ( pr ), intent ( in ) :: S0 !! Initial specification value real ( pr ), intent ( in ) :: dS0 !! Initial \\deltaS integer , intent ( in ) :: max_points !! Maximum number of points to trace real ( pr ), intent ( in ) :: solver_tol !! Point solver tolerance procedure ( process ), optional :: update_specification !! Procedure to select the new specification and define the next step !! \\DeltaS)\\, defaults to: !! !! ```fortran !! ns = maxloc(abs(dXdS), dim=1) !! dS = dXdS(ns)*dS !! dXdS = dXdS/dXdS(ns) !! dS = sign(minval(abs([0.05_pr, dS])), dS) !! ``` procedure ( process ), optional :: postprocess !! Any kind of postprocess that could be done after defining the !! next step procedure ( continuation_solver ), optional :: solver !! Solver procedures, uses Newton-Raphson by default procedure ( continuation_stopper ), optional :: stop !! Stopping procedure real ( pr ) :: XS ( max_points , size ( X0 )) real ( pr ) :: X ( size ( X0 )), S , fval ( size ( X0 )), dF ( size ( X0 ), size ( X0 )), dFdS ( size ( X0 )) real ( pr ) :: dXdS ( size ( X0 )) integer :: ns real ( pr ) :: dS integer :: i , newton_its integer :: max_iters = 500 X = X0 ns = ns0 dS = dS0 S = S0 XS = 0 do i = 1 , max_points if ( present ( solver )) then call solver (& f , newton_its , X , ns , S , dS , dXdS , i , max_iters , & fval , dF , dFdS , solver_tol & ) else call full_newton (& f , newton_its , X , ns , S , dS , dXdS , i , max_iters , & fval , dF , dFdS , solver_tol & ) end if if ( newton_its >= max_iters ) exit XS ( i , :) = X dXdS = solve_system ( dF , - dFdS ) if ( present ( update_specification )) then call update_specification ( X , ns , S , dS , dXdS , newton_its ) else ns = maxloc ( abs ( dXdS ), dim = 1 ) dS = dXdS ( ns ) * dS dXdS = dXdS / dXdS ( ns ) dS = sign ( minval ( abs ([ 0.05_pr , dS ])), dS ) end if if ( present ( postprocess )) then call postprocess ( X , ns , S , dS , dXdS , newton_its ) end if if ( present ( stop )) then if ( stop ( X , ns , S , dS , dXdS , newton_its )) exit end if X = X + dXdS * dS S = X ( ns ) end do end function continuation subroutine full_newton (& fun , iters , X , ns , S , dS , dXdS , point , max_iters , F , dF , dFdS , tol & ) !! Subroutine to solve a point. !! !! Procedure that solves a point with the Newton-Raphson method. use stdlib_optval , only : optval use yaeos__math_linalg , only : solve_system procedure ( continuation_function ) :: fun !! Function to solve integer , intent ( out ) :: iters !! Number of iterations needed real ( pr ), intent ( in out ) :: X (:) !! Variables vector integer , intent ( in ) :: ns real ( pr ), intent ( in ) :: S real ( pr ), intent ( in ) :: dS real ( pr ), intent ( in ) :: dXdS (:) integer , intent ( in ) :: point integer , intent ( in ) :: max_iters !! Maximum iterations real ( pr ), intent ( out ) :: F (:) !! Function values at solved point real ( pr ), intent ( out ) :: df (:, :) !! Jacobian values real ( pr ), intent ( out ) :: dfds (:) !! dFdS real ( pr ), intent ( in ) :: tol real ( pr ) :: X0 ( size ( X )) real ( pr ) :: dX ( size ( X )), solve_tol solve_tol = tol dX = 20 F = 500 X0 = X newton : do iters = 1 , max_iters ! Converged point if ( maxval ( abs ( dx )) < tol . or . maxval ( abs ( F )) < 1e-7 ) exit newton call fun ( X , ns , S , F , dF , dFdS ) if ( maxval ( abs ( F )) < tol ) exit dX = solve_system ( dF , - F ) ! Fix the step do while ( maxval ( abs ( dx )) > 0.1 ) dX = dX / 2 end do X = X + dX end do newton end subroutine full_newton ! subroutine levenberg_marquardt(& ! fun, iters, X, ns, S, dS, dXdS, point, max_iters, F, dF, dFdS, tol & ! ) ! use minpack_module, only: lmdif1 ! use stdlib_optval, only: optval ! use yaeos__math_linalg, only: solve_system ! procedure(continuation_function) :: fun !! Function to solve ! integer, intent(out) :: iters !! Number of iterations needed ! real(pr), intent(in out) :: X(:) !! Variables vector ! integer, intent(in) :: ns ! real(pr), intent(in) :: S ! real(pr), intent(in) :: dS ! real(pr), intent(in) :: dXdS(:) ! integer, intent(in) :: point ! integer, intent(in) :: max_iters !! Maximum iterations ! real(pr), intent(out) :: F(:) !! Function values at solved point ! real(pr), intent(out) :: df(:, :) !! Jacobian values ! real(pr), intent(out) :: dfds(:) !! dFdS ! real(pr), intent(in) :: tol ! integer :: m, n, info, iwa(size(x)) ! integer :: lwa ! real(pr) :: wa(size(F) * size(x) + 5*size(x) + size(f)) ! m = size(F) ! n = size(x) ! lwa = size(F) * size(x)+5*size(x)+size(f) ! call lmdif1(fcn, m, n, x, F, tol, Info, Iwa, Wa, Lwa) ! contains ! subroutine fcn(m, n, xx, fvec, iflag) ! integer, intent(in) :: m, n ! real(pr), intent(in) :: xx(n) ! real(pr), intent(out) :: fvec(m) ! integer, intent(in out) :: iflag ! call fun(xx, ns, S, fvec, dF, dFdS) ! end subroutine ! end subroutine end module yaeos__math_continuation","tags":"","loc":"sourcefile/continuation.f90.html"},{"title":"auxiliar.f90 – yaeos","text":"Source Code module yaeos__equilibria_auxiliar !! Auxiliar functions used for phase-equilibria calculation. use yaeos__constants , only : pr use yaeos__models_base , only : BaseModel implicit none contains function k_wilson ( model , T , P ) result ( K ) !! K-factors regressión done by Wilson, used for initialization. class ( BaseModel ), intent ( in ) :: model real ( pr ), intent ( in ) :: T real ( pr ), intent ( in ) :: P real ( pr ) :: K ( size ( model % components % pc )) K = ( model % components % Pc / P ) & * exp ( 5.373_pr * ( 1 + model % components % w )& * ( 1 - model % components % Tc / T )) end function k_wilson real ( pr ) function P_wilson ( model , z , T ) result ( P ) class ( BaseModel ), intent ( in ) :: model real ( pr ), intent ( in ) :: z (:) real ( pr ), intent ( in ) :: T P = 1.0_pr / sum (& z * model % components % Pc & * exp ( 5.373_pr & * ( 1 + model % components % w ) * ( 1 - model % components % Tc / T ))) end function P_wilson end module yaeos__equilibria_auxiliar","tags":"","loc":"sourcefile/auxiliar.f90~2.html"},{"title":"interfaces.f90 – yaeos","text":"Source Code module yaeos__tapenade_interfaces use yaeos__constants , only : pr implicit none interface subroutine pushinteger4 ( i ) integer :: i end subroutine subroutine popinteger4 ( i ) integer :: i end subroutine subroutine pushreal8array ( a , n ) import pr real ( pr ), dimension ( n ) :: a integer :: n end subroutine subroutine pushreal8 ( a ) import pr real ( pr ) :: a end subroutine subroutine POPREAL8 ( a ) import pr real ( pr ) :: a end subroutine subroutine POPREAL8ARRAY ( a , n ) import pr real ( pr ), dimension ( n ) :: a integer :: n end subroutine end interface end module","tags":"","loc":"sourcefile/interfaces.f90.html"},{"title":"implementations.f90 – yaeos","text":"Source Code module yaeos__models_ge_implementations use yaeos__models_ge_NRTL , only : NRTL use yaeos__models_ge_group_contribution_unifac , only : & Groups , setup_unifac , UNIFAC , excess_gibbs implicit none end module yaeos__models_ge_implementations","tags":"","loc":"sourcefile/implementations.f90.html"},{"title":"math.f90 – yaeos","text":"Source Code module yaeos__math !! # Mathematical methods for `yaeos` !! !! # Description !! This module provides all the relevant mathematical functions used in this !! library. Most important ones are: !! !! - newton: Newton solving method !! - solve_system: Solving linear system Ax = b !! - continuation: Continuation method for line tracing !! !! # Examples !! !! ## Squared error calculation !! ```fortran !! use yaeos__math, only: sq_error !! real(pr) :: x = 2.5, y = 3.0, error !! print *, sq_error(2.5, 3.0) !! ------------------------------------ !! ``` !! !! ```fortran !! use yaeos__math, only: sq_error !! real(pr) :: x = [2.5, 5.0], y = [3.0, 4.5], error !! ! It also works with arrays !! print *, sq_error(x, y) !! ``` use yaeos__math_continuation , only : continuation use yaeos__math_linalg , only : solve_system , cubic_roots use yaeos__constants , only : pr implicit none abstract interface subroutine f_1d ( x , f , df ) import pr real ( pr ), intent ( in ) :: x real ( pr ), intent ( out ) :: f real ( pr ), intent ( out ) :: df end subroutine f_1d end interface interface newton module procedure :: newton_1d end interface newton contains elemental real ( pr ) function sq_error ( exp , pred ) !! # Squared error between two values. !! !! # Description !! ... !! !! # Examples !! !! ```fortran !! error = sq_error(true_value, model_value) !! ``` use yaeos__constants , only : pr real ( pr ), intent ( in ) :: exp real ( pr ), intent ( in ) :: pred sq_error = (( exp - pred ) / exp ) ** 2 end function sq_error function dx_to_dn ( x , dx ) result ( dn ) !! # dx_to_dn !! !! # Description !! Convert the mole fraction derivatives of a quantity (calculated !! so they do not sum to 1) to mole number derivatives (where the mole !! fractions do sum to one). Requires the derivatives and the mole fractions !! of the mixture. !! From [https://chemicals.readthedocs.io/chemicals.utils.html?highlight=dxs_to_dns#chemicals.utils.dxs_to_dns](Chemicals (Python)) use yaeos__constants , only : pr real ( pr ), intent ( in ) :: x (:) real ( pr ), intent ( in ) :: dx (:) real ( pr ) :: dn ( size ( x )) real ( pr ) :: sum_xdx dn = 0 sum_xdx = sum ( x * dx ) dn = dx - sum_xdx end function dx_to_dn subroutine newton_1d ( f , x , tol , max_iters ) procedure ( f_1d ) :: f real ( pr ), intent ( in out ) :: x real ( pr ), intent ( in ) :: tol integer , intent ( in ) :: max_iters integer :: i real ( pr ) :: fval , df , step fval = 10 step = 10 do i = 1 , max_iters if ( abs ( fval ) < tol . or . abs ( step ) < tol ) exit call f ( x , fval , df ) step = fval / df do while ( abs ( step ) > 0.5 * abs ( x )) step = step / 2 end do x = x - step end do end subroutine newton_1d end module yaeos__math","tags":"","loc":"sourcefile/math.f90.html"},{"title":"armodel_adiff_api.f90 – yaeos","text":"Source Code module yaeos__adiff_hyperdual_ar_api !! Module that contains the automatic differentiation logic for an Ar model. !! !! All that is needed to define an Ar model that uses automatic !! differentiation with hyperdual numbers is to define a new derived type !! that overloads the method to the Ar function that you want to use. !! A minimal example follows: !! !! ```fortran !! module newmodel !! use yaeos__adiff_hyperdual_ar_api, only: ArModelAdiff !! !! type, extends(ArModelAdiff) :: YourNewModel !! type(Substances) :: composition !! real(8) :: parameters(:) !! contains !! procedure :: Ar => arfun !! procedure :: get_v0 => v0 !! end type !! contains !! subroutine arfun(self, n, v, t, Ar) !! class(YourNewModel), intent(in) :: self !! type(hyperdual), intent(in) :: n(:) ! Number of moles !! type(hyperdual), intent(in) :: v ! Volume [L] !! type(hyperdual), intent(in) :: t ! Temperature [K] !! type(hyperdual), intent(out) :: ar_value ! Residual Helmholtz Energy !! !! ! A very complicated residual helmholtz function of a mixture !! Ar = sum(n) * v * t !! end subroutine !! !! function v0(self, n, p, t) !! class(YourNewModel), intent(in) :: self !! real(pr), intent(in) :: n(:) ! Number of moles !! real(pr), intent(in) :: p ! Pressure [bar] !! real(pr), intent(in) :: t ! Temperature [K] !! real(pr) :: v0 !! !! v0 = self%parameters(3) !! end function !! ``` !! !! A complete implementation of the PR76 Equation of State can me found in !! `example/adiff/adiff_pr76.f90` !! use yaeos__constants , only : pr use yaeos__models_ar , only : ArModel use hyperdual_mod implicit none type , abstract , extends ( ArModel ) :: ArModelAdiff contains procedure ( hyperdual_ar ), deferred :: Ar procedure :: residual_helmholtz => residual_helmholtz end type abstract interface type ( hyperdual ) function hyperdual_Ar ( self , n , v , t ) import hyperdual , ArModelAdiff class ( ArModelAdiff ) :: self type ( hyperdual ), intent ( in ) :: n (:) type ( hyperdual ), intent ( in ) :: v type ( hyperdual ), intent ( in ) :: t end function end interface contains subroutine residual_helmholtz (& self , n , v , t , Ar , ArV , ArT , ArTV , ArV2 , ArT2 , Arn , ArVn , ArTn , Arn2 & ) class ( ArModelAdiff ), intent ( in ) :: self real ( pr ), intent ( in ) :: n (:) real ( pr ), intent ( in ) :: v , t real ( pr ), optional , intent ( out ) :: Ar , ArV , ArT , ArT2 , ArTV , ArV2 real ( pr ), optional , dimension ( size ( n )), intent ( out ) :: Arn , ArVn , ArTn real ( pr ), optional , intent ( out ) :: Arn2 ( size ( n ), size ( n )) type ( hyperdual ) :: d_v , d_t , d_n ( size ( n )) type ( hyperdual ) :: d_Ar if ( present ( ArV )) then if ( present ( ArV2 )) call get_dardv2 if ( present ( ArVn )) call get_dardvn if ( present ( ArTV )) call get_dardvt if (. not . ( present ( ArV2 ) . and . present ( ArVn ) . and . present ( ArTV ))) & call get_dardv end if if ( present ( ArT )) then if ( present ( ArT2 )) call get_dardt2 if ( present ( ArTn )) call get_dardtn if (. not . ( present ( ArT2 ) . and . present ( ArTn ))) call get_dardt end if if ( present ( Arn )) then if ( present ( Arn2 )) then call get_dardn2 else call get_dardn end if end if if ( present ( Ar )) Ar = d_Ar % f0 contains subroutine get_dardn () integer :: i , j do i = 2 , size ( n ), 2 call reset_vars d_n ( i - 1 )% f1 = 1 d_n ( i )% f2 = 1 d_Ar = self % Ar ( d_n , d_v , d_t ) Arn ( i - 1 ) = d_Ar % f1 Arn ( i ) = d_Ar % f2 end do if ( mod ( size ( n ), 2 ) /= 0 ) then call reset_vars d_n ( size ( n ))% f1 = 1 d_Ar = self % Ar ( d_n , d_v , d_t ) Arn ( size ( n )) = d_Ar % f1 end if end subroutine subroutine get_dardn2 () integer :: i , j do i = 1 , size ( n ) do j = i , size ( n ) call reset_vars d_n ( i )% f1 = 1 d_n ( j )% f2 = 1 d_Ar = self % Ar ( d_n , d_v , d_t ) Arn ( i ) = d_Ar % f1 Arn2 ( i , j ) = d_Ar % f12 Arn2 ( j , i ) = d_Ar % f12 end do end do end subroutine subroutine get_dardvn () integer :: i do i = 1 , size ( n ) call reset_vars d_n ( i )% f1 = 1 d_v % f2 = 1 d_Ar = self % Ar ( d_n , d_v , d_t ) Arn ( i ) = d_Ar % f1 ArV = d_Ar % f2 ArVn ( i ) = d_Ar % f12 end do end subroutine subroutine get_dardtn () integer :: i do i = 1 , size ( n ) call reset_vars d_n ( i )% f1 = 1 d_t % f2 = 1 d_Ar = self % Ar ( d_n , d_v , d_t ) Arn ( i ) = d_Ar % f1 ArT = d_Ar % f2 ArTn ( i ) = d_Ar % f12 end do end subroutine subroutine get_dardv () call reset_vars d_v % f1 = 1 d_Ar = self % Ar ( d_n , d_v , d_t ) ArV = d_Ar % f1 end subroutine subroutine get_dardt () call reset_vars d_t % f1 = 1 d_Ar = self % Ar ( d_n , d_v , d_t ) ArT = d_Ar % f1 end subroutine subroutine get_dardt2 () call reset_vars d_t % f1 = 1 d_t % f2 = 1 d_Ar = self % Ar ( d_n , d_v , d_t ) ArT = d_Ar % f1 ArT2 = d_Ar % f12 end subroutine subroutine get_dardv2 () call reset_vars d_v % f1 = 1 d_v % f2 = 1 d_Ar = self % Ar ( d_n , d_v , d_t ) ArV = d_Ar % f1 ArV2 = d_Ar % f12 end subroutine subroutine get_dardvt () call reset_vars d_v % f1 = 1 d_t % f2 = 1 d_Ar = self % Ar ( d_n , d_v , d_t ) ArV = d_Ar % f1 ArTV = d_Ar % f12 end subroutine subroutine reset_vars () d_n = n d_v = v d_t = t end subroutine end subroutine end module","tags":"","loc":"sourcefile/armodel_adiff_api.f90.html"},{"title":"yaeos.f90 – yaeos","text":"Source Code module yaeos !! Yet Another Equation-Of-State (library) !! !! Library to use EoS-based calculations. This main module imports all the !! relevant constants, procedures and objects to have better access to them !! The main submodules that it uses are: !! !! - [[yaeos__constants(module)]]: All the relevant costants and also the used precision (default=double precision). !! - [[yaeos__consistency(module)]]: Tools to evalaute the consistency of Ar and Ge models. !! - [[yaeos__substance(module)]]: Derived type that holds the important data (for example, critical constants) from a mixture. !! - [[yaeos__models(module)]]: All the implemented models, also their base types for making extensions. !! - [[yaeos__equilibria(module)]]: Phase equilibria related procedures. use yaeos__constants use yaeos__consistency use yaeos__substance use yaeos__models use yaeos__equilibria character ( len =* ), parameter :: version = \"1.0.0\" !! This version. end module","tags":"","loc":"sourcefile/yaeos.f90.html"},{"title":"pure_psat.f90 – yaeos","text":"Source Code module yaeos__equilibria_pure_psat !! Module used to calculate the saturation pressure of pure components at !! a given temperature. use yaeos__constants , only : pr use yaeos__models , only : ArModel , size contains real ( pr ) function Psat ( eos , ncomp , T ) !! Calculation of saturation pressure of a pure component using the !! secant method. class ( ArModel ), intent ( in ) :: eos !! Model that will be used integer , intent ( in ) :: ncomp !! Number of component in the mixture from which the saturation pressure !! will be calculated real ( pr ), intent ( in ) :: T !! Temperature [K] real ( pr ) :: P1 , P2 real ( pr ) :: f1 , f2 real ( pr ) :: n ( size ( eos )) n = 0 n ( ncomp ) = 1 P1 = 0.5 P2 = 1 do while ( abs ( diff ( P2 )) > 1e-5 ) f1 = diff ( P1 ) f2 = diff ( P2 ) Psat = ( P1 * f2 - P2 * f1 ) / ( f2 - f1 ) P1 = P2 P2 = Psat end do contains real ( pr ) function diff ( P ) real ( pr ), intent ( in ) :: P real ( pr ) :: V_l , V_v real ( pr ) :: phi_v ( size ( eos )), phi_l ( size ( eos )) call eos % lnphi_pt ( n , P , T , V = V_v , lnPhi = phi_v , root_type = \"vapor\" ) call eos % lnphi_pt ( n , P , T , V = V_l , lnPhi = phi_l , root_type = \"liquid\" ) diff = phi_v ( ncomp ) - phi_l ( ncomp ) end function end function Psat end module","tags":"","loc":"sourcefile/pure_psat.f90.html"},{"title":"ar_models.f90 – yaeos","text":"Source Code module yaeos__models_ar !! # Module that defines the basics of a residual Helmholtz energy. !! !! All the residual properties that are calculated in this library are !! based on residual Helmholtz Equations of State. Following the book by !! Michelsen and Mollerup. !! !! In this library up to second derivatives of residual Helmholtz energy !! are used. Because they're the fundamentals for phase equilibria !! calculation. !! !! @note !! Later on, third derivative with respect to volume will be included !! since it's importance on calculation of critical points. !! @endnote !! !! # Properties !! !! ## Available properties: !! !! - pressure(n, V, T) !! - fugacity(n, V, T) !! - fugacity(n, P, T, root=[vapor, liquid, stable]) !! - volume !! !! Calculate thermodynamic properties using Helmholtz energy as a basis. !! All the routines in this module work with the logic: !! !! ```fortran !! call foo(x, V, T, [dfoodv, dfoodT, ...]) !! ``` !! Where the user can call the routine of the desired property. And include !! as optional values the desired derivatives of said properties. use yaeos__constants , only : pr , R use yaeos__models_base , only : BaseModel implicit none type , abstract , extends ( BaseModel ) :: ArModel !! Abstract residual Helmholtz model. !! !! This derived type defines the basics needed for the calculation !! of residual properties. !! The basics of a residual Helmholtz model is a routine that calculates !! all the needed derivatives of Ar `residual_helmholtz` and !! a volume initializer function, that is used to initialize a Newton !! solver of volume when specifying pressure. character ( len = :), allocatable :: name !! Name of the model contains procedure ( abs_residual_helmholtz ), deferred :: residual_helmholtz procedure ( abs_volume_initializer ), deferred :: get_v0 procedure :: lnphi_vt => fugacity_vt procedure :: lnphi_pt => fugacity_pt procedure :: pressure procedure :: volume procedure :: enthalpy_residual_vt procedure :: gibbs_residual_vt procedure :: entropy_residual_vt procedure :: Cv_residual_vt procedure :: Cp_residual_vt end type ArModel interface size module procedure :: size_ar_model end interface size abstract interface subroutine abs_residual_helmholtz (& self , n , v , t , Ar , ArV , ArT , ArTV , ArV2 , ArT2 , Arn , ArVn , ArTn , Arn2 & ) !! Residual Helmholtz model generic interface. !! !! This interface represents how an Ar model should be implemented. !! By our standard, a Resiudal Helmholtz model takes as input: !! !! - The mixture's number of moles vector. !! - Volume, by default in liters. !! - Temperature, by default in Kelvin. !! !! All the output arguments are optional. While this keeps a long !! signature for the implementation, this is done this way to take !! advantage of any inner optimizations to calculate derivatives !! inside the procedure. !! !! Once the model is implemented, the signature can be short like !! `model%residual_helmholtz(n, v, t, ArT2=dArdT2)` import ArModel , pr class ( ArModel ), intent ( in ) :: self !! ArModel real ( pr ), intent ( in ) :: n (:) !! Moles vector real ( pr ), intent ( in ) :: v !! Volume [L] real ( pr ), intent ( in ) :: t !! Temperature [K] real ( pr ), optional , intent ( out ) :: Ar !! Residual Helmoltz energy real ( pr ), optional , intent ( out ) :: ArV !! \\frac{dAr}{dV} real ( pr ), optional , intent ( out ) :: ArT !! \\frac{dAr}{dT} real ( pr ), optional , intent ( out ) :: ArT2 !! \\frac{d^2Ar}{dT^2} real ( pr ), optional , intent ( out ) :: ArTV !! \\frac{d^2Ar}{dTV} real ( pr ), optional , intent ( out ) :: ArV2 !! \\frac{d^2Ar}{dV^2} real ( pr ), optional , intent ( out ) :: Arn ( size ( n )) !! \\frac{dAr}{dn_i} real ( pr ), optional , intent ( out ) :: ArVn ( size ( n )) !! \\frac{d^2Ar}{dVn_i} real ( pr ), optional , intent ( out ) :: ArTn ( size ( n )) !! \\frac{d^2Ar}{dTn_i} real ( pr ), optional , intent ( out ) :: Arn2 ( size ( n ), size ( n )) !! \\frac{d^2Ar}{dn_{ij}} end subroutine abs_residual_helmholtz function abs_volume_initializer ( self , n , p , t ) !! Function that provides an initializer value for the liquid-root !! of newton solver of volume. In the case the model will use the !! `volume_michelsen` routine this value should provide the co-volume !! of the model. import ArModel , pr class ( ArModel ), intent ( in ) :: self !! Ar Model real ( pr ), intent ( in ) :: n (:) !! Moles vector real ( pr ), intent ( in ) :: p !! Pressure [bar] real ( pr ), intent ( in ) :: t !! Temperature [K] real ( pr ) :: abs_volume_initializer !! Initial volume [L] end function abs_volume_initializer end interface contains integer pure function size_ar_model ( eos ) !! Get the size of the model. class ( ArModel ), intent ( in ) :: eos size_ar_model = size ( eos % components % pc ) end function size_ar_model subroutine volume ( eos , n , P , T , V , root_type ) !! # Volume solver routine for residual Helmholtz models. !! Solves volume roots using newton method. Given pressure and temperature. !! !! # Description !! This subroutine solves the volume using a newton method. The variable !! `root_type` !! !! # Examples !! !! ```fortran !! class(ArModel) :: eos !! call eos%volume(n, P, T, V, root_type=\"liquid\") !! call eos%volume(n, P, T, V, root_type=\"vapor\") !! call eos%volume(n, P, T, V, root_type=\"stable\") !! ``` use yaeos__constants , only : pr , R use yaeos__math , only : newton class ( ArModel ), intent ( in ) :: eos real ( pr ), intent ( in ) :: n (:) !! Moles number vector real ( pr ), intent ( in ) :: P !! Pressure [bar] real ( pr ), intent ( in ) :: T !! Temperature [K] real ( pr ), intent ( out ) :: V !! Volume [L] character ( len =* ), intent ( in ) :: root_type !! Desired root-type to solve. Options are: !! `[\"liquid\", \"vapor\", \"stable\"]` integer :: max_iters = 30 real ( pr ) :: tol = 1e-7 real ( pr ) :: totnRT , GrL , GrV , Gr real ( pr ) :: Vliq , Vvap GrL = HUGE ( GrL ) GrV = HUGE ( GrV ) totnRT = sum ( n ) * R * T select case ( root_type ) case ( \"liquid\" ) Vliq = eos % get_v0 ( n , P , T ) * 1.001_pr call newton ( foo , Vliq , tol = tol , max_iters = max_iters ) GrL = Gr case ( \"vapor\" ) Vvap = R * T / P call newton ( foo , Vvap , tol = tol , max_iters = max_iters ) GrV = Gr case ( \"stable\" ) Vliq = eos % get_v0 ( n , P , T ) * 1.00001_pr call newton ( foo , Vliq , tol = tol , max_iters = max_iters ) GrL = Gr Vvap = R * T / P call newton ( foo , Vvap , tol = tol , max_iters = max_iters ) GrV = Gr end select if ( GrL < GrV ) then V = Vliq else V = Vvap end if contains subroutine foo ( x , f , df ) real ( pr ), intent ( in ) :: x real ( pr ), intent ( out ) :: f , df real ( pr ) :: Ar , ArV , ArV2 , Pcalc , dPcalcdV , Vin Vin = x call eos % residual_helmholtz ( n , Vin , T , Ar = Ar , ArV = ArV , ArV2 = ArV2 ) Pcalc = totnRT / Vin - ArV dPcalcdV = - totnRT / Vin ** 2 - ArV2 f = Pcalc - p df = dPcalcdV Gr = Ar + P * Vin - totnRT - totnRT * log ( P * Vin / ( R * T )) end subroutine foo end subroutine volume subroutine pressure ( eos , n , V , T , P , dPdV , dPdT , dPdn ) !! Pressure calculation. !! !! Calculate pressure using residual helmholtz models. !! !! # Examples !! ```fortran !! class(ArModel), allocatable :: eos !! real(pr) :: n(2), t, v, p, dPdV, dPdT, dPdn(2) !! eos = PengRobinson(Tc, Pc, w) !! n = [1.0_pr, 1.0_pr] !! t = 300.0_pr !! v = 1.0_pr !! call eos%pressure(n, V, T, P, dPdV=dPdV, dPdT=dPdT, dPdn=dPdn) !! ``` class ( ArModel ), intent ( in ) :: eos !! Model real ( pr ), intent ( in ) :: n (:) !! Moles number vector real ( pr ), intent ( in ) :: t !! Temperature [K] real ( pr ), intent ( in ) :: v !! Volume [L] real ( pr ), intent ( out ) :: p !! Pressure [bar] real ( pr ), optional , intent ( out ) :: dPdV !! \\frac{dP}}{dV} real ( pr ), optional , intent ( out ) :: dPdT !! \\frac{dP}}{dT} real ( pr ), optional , intent ( out ) :: dPdn (:) !! \\frac{dP}}{dn_i} real ( pr ) :: totn real ( pr ) :: Ar , ArV , ArV2 , ArTV , ArVn ( size ( eos )) integer :: nc logical :: dn totn = sum ( n ) nc = size ( n ) if ( present ( dPdn )) then call eos % residual_helmholtz (& n , v , t , Ar = Ar , ArV = ArV , ArV2 = ArV2 , ArTV = ArTV , ArVn = ArVn & ) else call eos % residual_helmholtz (& n , v , t , Ar = Ar , ArV = ArV , ArV2 = ArV2 , ArTV = ArTV & ) end if P = totn * R * T / V - ArV if ( present ( dPdV )) dPdV = - ArV2 - R * T * totn / V ** 2 if ( present ( dPdT )) dPdT = - ArTV + totn * R / V if ( present ( dPdn )) dPdn (:) = R * T / V - ArVn (:) end subroutine pressure subroutine fugacity_pt ( eos , & n , P , T , V , root_type , lnPhi , dlnPhidP , dlnPhidT , dlnPhidn , dPdV , dPdT , dPdn & ) !! Calculate logarithm of fugacity, given pressure and temperature. !! !! This routine will obtain the desired volume root at the specified !! pressure and calculate fugacity at that point. use iso_fortran_env , only : error_unit class ( ArModel ), intent ( in ) :: eos !! Model real ( pr ), intent ( in ) :: n (:) !! Mixture mole numbers character ( len =* ), intent ( in ) :: root_type !! Type of root desired [\"liquid\", \"vapor\", \"stable\"] real ( pr ), intent ( in ) :: P !! Pressure [bar] real ( pr ), intent ( in ) :: T !! Temperature [K] real ( pr ), optional , intent ( out ) :: lnPhi ( size ( n )) !! \\ln(phi) vector real ( pr ), optional , intent ( out ) :: V !! Volume [L] real ( pr ), optional , intent ( out ) :: dlnPhidT ( size ( n )) !! ln(phi) Temp derivative real ( pr ), optional , intent ( out ) :: dlnPhidP ( size ( n )) !! ln(phi) Presssure derivative real ( pr ), optional , intent ( out ) :: dlnPhidn ( size ( n ), size ( n )) !! ln(phi) compositional derivative real ( pr ), optional , intent ( out ) :: dPdV !! \\frac{dP}{dV} real ( pr ), optional , intent ( out ) :: dPdT !! \\frac{dP}{dT} real ( pr ), optional , intent ( out ) :: dPdn ( size ( n )) !! \\frac{dP}{dn_i} real ( pr ) :: V_in , P_in call eos % volume ( n , P = P , T = T , V = V_in , root_type = root_type ) call eos % lnphi_vt (& n , V = V_in , T = T , & P = P_in , lnPhi = lnPhi , & dlnPhidP = dlnPhidP , dlnPhidT = dlnPhidT , dlnPhidn = dlnPhidn , & dPdV = dPdV , dPdT = dPdT , dPdn = dPdn & ) if ( present ( V )) V = V_in ! Check if the calculated pressure is the same as the input pressure. if ( abs ( P_in - P ) > 1e-2 ) then write ( error_unit , * ) \"WARN: possible bad root solving: \" , P_in , P end if end subroutine fugacity_pt subroutine fugacity_vt ( eos , & n , V , T , P , lnPhi , dlnPhidP , dlnPhidT , dlnPhidn , dPdV , dPdT , dPdn & ) !! Calculate fugacity coefficent given volume and temperature. !! !!@note !!While the natural output variable is ln \\phi_i P. The calculated !!derivatives will be the derivatives of the fugacity coefficient !!ln \\phi_i !!@endnote !! class ( ArModel ) :: eos !! Model real ( pr ), intent ( in ) :: n (:) !! Mixture mole numbers real ( pr ), intent ( in ) :: V !! Volume [L] real ( pr ), intent ( in ) :: T !! Temperature [K] real ( pr ), optional , intent ( out ) :: P !! Pressure [bar] real ( pr ), optional , intent ( out ) :: lnPhi ( size ( n )) !! \\ln(\\phi_i*P) vector real ( pr ), optional , intent ( out ) :: dlnPhidT ( size ( n )) !! ln(phi_i) Temp derivative real ( pr ), optional , intent ( out ) :: dlnPhidP ( size ( n )) !! ln(phi_i) Presssure derivative real ( pr ), optional , intent ( out ) :: dlnPhidn ( size ( n ), size ( n )) !! ln(phi_i) compositional derivative real ( pr ), optional , intent ( out ) :: dPdV !! \\frac{dP}{dV} real ( pr ), optional , intent ( out ) :: dPdT !! \\frac{dP}{dT} real ( pr ), optional , intent ( out ) :: dPdn (:) !! \\frac{dP}{dn_i} real ( pr ) :: Ar , ArTV , ArV , ArV2 real ( pr ), dimension ( size ( n )) :: Arn , ArVn , ArTn real ( pr ) :: Arn2 ( size ( n ), size ( n )) real ( pr ) :: dPdV_in , dPdT_in , dPdn_in ( size ( n )) real ( pr ) :: P_in real ( pr ) :: RT , Z real ( pr ) :: totn integer :: nc , i , j totn = sum ( n ) nc = size ( n ) RT = R * T if ( present ( lnPhi ) . and . . not . (& present ( dlnPhidn ) & . or . present ( dlnPhidP ) & . or . present ( dlnPhidT ) & )) then call eos % residual_helmholtz ( n , v , t , Arn = Arn , ArV = ArV ) P_in = totn * RT / V - ArV Z = P_in * V / ( totn * RT ) lnPhi (:) = Arn (:) / RT - log ( Z ) return else if ( present ( dlnPhidn )) then call eos % residual_helmholtz (& n , V , T , Ar = Ar , ArV = ArV , ArV2 = ArV2 , ArTV = ArTV , & Arn = Arn , ArVn = ArVn , ArTn = ArTn , Arn2 = Arn2 & ) else call eos % residual_helmholtz (& n , V , T , Ar = Ar , ArV = ArV , ArV2 = ArV2 , ArTV = ArTV , & Arn = Arn , ArVn = ArVn , ArTn = ArTn & ) end if P_in = totn * RT / V - ArV Z = P_in * V / ( totn * RT ) if ( present ( P )) P = P_in dPdV_in = - ArV2 - RT * totn / V ** 2 dPdT_in = - ArTV + totn * R / V dPdn_in = RT / V - ArVn if ( present ( lnPhi )) lnPhi = Arn (:) / RT - log ( Z ) if ( present ( dlnPhidP )) then dlnPhidP (:) = - dPdn_in (:) / dPdV_in / RT - 1._pr / P_in end if if ( present ( dlnPhidT )) then dlnPhidT (:) = ( ArTn (:) - Arn (:) / T ) / RT + dPdn_in (:) * dPdT_in / dPdV_in / RT + 1._pr / T end if if ( present ( dlnPhidn )) then do i = 1 , nc do j = i , nc dlnPhidn ( i , j ) = 1._pr / totn + ( Arn2 ( i , j ) + dPdn_in ( i ) * dPdn_in ( j ) / dPdV_in ) / RT dlnPhidn ( j , i ) = dlnPhidn ( i , j ) end do end do end if if ( present ( dPdV )) dPdV = dPdV_in if ( present ( dPdT )) dPdT = dPdT_in if ( present ( dPdn )) dPdn = dPdn_in end subroutine fugacity_vt subroutine enthalpy_residual_vt ( eos , n , V , T , Hr , HrT , HrV , Hrn ) !! Calculate residual enthalpy given volume and temperature. class ( ArModel ), intent ( in ) :: eos !! Model real ( pr ), intent ( in ) :: n (:) !! Moles number vector real ( pr ), intent ( in ) :: t !! Temperature [K] real ( pr ), intent ( in ) :: v !! Volume [L] real ( pr ), intent ( out ) :: Hr !! Residual enthalpy [bar L / mol] real ( pr ), optional , intent ( out ) :: HrT !! \\frac{dH^r}}{dT} real ( pr ), optional , intent ( out ) :: HrV !! \\frac{dH^r}}{dV} real ( pr ), optional , intent ( out ) :: Hrn ( size ( n )) !! \\frac{dH^r}}{dn} real ( pr ) :: Ar , ArV , ArT , Arn ( size ( n )) real ( pr ) :: ArV2 , ArT2 , ArTV , ArVn ( size ( n )), ArTn ( size ( n )) call eos % residual_helmholtz (& n , v , t , Ar = Ar , ArV = ArV , ArT = ArT , ArTV = ArTV , ArV2 = ArV2 , ArT2 = ArT2 , Arn = Arn , ArVn = ArVn , ArTn = ArTn & ) Hr = Ar - t * ArT - v * ArV if ( present ( HrT )) HrT = - t * ArT2 - v * ArTV if ( present ( HrV )) HrV = - t * ArTV - v * ArV2 if ( present ( HrN )) HrN (:) = Arn (:) - t * ArTn (:) - v * ArVn (:) end subroutine enthalpy_residual_vt subroutine gibbs_residual_VT ( eos , n , V , T , Gr , GrT , GrV , Grn ) !! Calculate residual Gibbs energy given volume and temperature. use yaeos__constants , only : R class ( ArModel ), intent ( in ) :: eos !! Model real ( pr ), intent ( in ) :: n (:) !! Moles number vector real ( pr ), intent ( in ) :: V !! Volume [L] real ( pr ), intent ( in ) :: T !! Temperature [K] real ( pr ), intent ( out ) :: Gr !! Gibbs energy [bar L / mol] real ( pr ), optional , intent ( out ) :: GrT !! \\frac{dG^r}}{dT} real ( pr ), optional , intent ( out ) :: GrV !! \\frac{dG^r}}{dV} real ( pr ), optional , intent ( out ) :: Grn ( size ( n )) !! \\frac{dG^r}}{dn} real ( pr ) :: Ar , ArV , ArT , Arn ( size ( n )) real ( pr ) :: p , dPdV , dPdT , dPdn ( size ( n )), z , totn totn = sum ( n ) call pressure ( eos , n , V , T , P , dPdV = dPdV , dPdT = dPdT , dPdn = dPdn ) z = P * V / ( totn * R * T ) call eos % residual_helmholtz ( n , v , t , Ar = Ar , ArV = ArV , ArT = ArT , Arn = Arn ) Gr = Ar + P * V - totn * R * T if ( present ( GrT )) GrT = ArT + V * dPdT - totn * R if ( present ( GrV )) GrV = ArV + V * dPdV + P if ( present ( GrN )) GrN (:) = Arn (:) + V * dPdn (:) - R * T end subroutine gibbs_residual_VT subroutine entropy_residual_vt ( eos , n , V , T , Sr , SrT , SrV , Srn ) !! Calculate residual entropy given volume and temperature. class ( ArModel ), intent ( in ) :: eos !! Model real ( pr ), intent ( in ) :: n (:) !! Moles number vector real ( pr ), intent ( in ) :: V !! Volume [L] real ( pr ), intent ( in ) :: T !! Temperature [K] real ( pr ), intent ( out ) :: Sr !! Entropy [bar L / K / mol] real ( pr ), optional , intent ( out ) :: SrT !! \\frac{dS^r}}{dT} real ( pr ), optional , intent ( out ) :: SrV !! \\frac{dS^r}}{dV} real ( pr ), optional , intent ( out ) :: Srn ( size ( n )) !! \\frac{dS^r}}{dn} real ( pr ) :: Ar , ArT , ArT2 , ArTV , ArTn ( size ( n )) call eos % residual_helmholtz (& n , v , t , Ar = Ar , ArT = ArT , ArTV = ArTV , ArT2 = ArT2 , ArTn = ArTn & ) Sr = - ArT if ( present ( SrT )) SrT = - ArT2 if ( present ( SrV )) SrV = - ArTV if ( present ( SrN )) SrN = - ArTn end subroutine entropy_residual_vt subroutine Cv_residual_vt ( eos , n , V , T , Cv ) !! Calculate residual heat capacity volume constant given v and t. class ( ArModel ), intent ( in ) :: eos !! Model real ( pr ), intent ( in ) :: n (:) !! Moles number vector real ( pr ), intent ( in ) :: T !! Temperature [K] real ( pr ), intent ( in ) :: V !! Volume [L] real ( pr ), intent ( out ) :: Cv !! heat capacity v constant [bar L / K / mol] real ( pr ) :: Ar , ArT2 call eos % residual_helmholtz ( n , V , T , Ar = Ar , ArT2 = ArT2 ) Cv = - T * ArT2 end subroutine Cv_residual_vt subroutine Cp_residual_vt ( eos , n , V , T , Cp ) !! Calculate residual heat capacity pressure constant given v and t. use yaeos__constants , only : R class ( ArModel ), intent ( in ) :: eos !! Model real ( pr ), intent ( in ) :: n (:) !! Moles number vector real ( pr ), intent ( in ) :: V !! Volume [L] real ( pr ), intent ( in ) :: T !! Temperature [K] real ( pr ), intent ( out ) :: Cp !! heat capacity p constant [bar L / K / mol] real ( pr ) :: Ar , ArT2 , Cv , p , dPdT , dPdV , totn totn = sum ( n ) call eos % residual_helmholtz ( n , V , T , Ar = Ar , ArT2 = ArT2 ) call Cv_residual_vt ( eos , n , V , T , Cv ) call pressure ( eos , n , V , T , P , dPdV = dPdV , dPdT = dPdT ) Cp = Cv - T * dPdT ** 2 / dPdV - totn * R end subroutine Cp_residual_vt end module yaeos__models_ar","tags":"","loc":"sourcefile/ar_models.f90.html"},{"title":"hyperdual.f90 – yaeos","text":"Source Code module hyperdual_mod !> Hyperdual number definition & type declaration ! ! Original code provided by Philipp Rehner and Gernot Bauer, ! Institute of Thermodynamics and Thermal Process Engineering (ITT), ! University of Stuttgart, Stuttgart, Germany ! ! #### Hypderdual numbers ! ! Hypderdual numbers extend the idea of additional, non-real ! components from one non-real component (complex numbers) to four ! non-real components: \\f$\\varepsilon_1\\f$, \\f$\\varepsilon_2\\f$ and ! \\f$\\varepsilon_1 \\varepsilon_2\\f$. ! Hyperdual numbers require: \\f$(\\varepsilon_1)^2 = 0\\f$, ! \\f$(\\varepsilon_2)^2 = 0\\f$ and ! \\f$(\\varepsilon_1\\varepsilon_2)^2 = 0\\f$ ! This leads to the fact, that the Taylor series of a function with ! hyperdual arguments can be truncated _exactly_ after the second ! derivative term: ! ! \\f[ ! f(\\mathbf{x} + h_1 \\varepsilon_1 + h_2 \\varepsilon_2 ! + h_1 h_2 \\varepsilon_1 \\varepsilon_2) ! = f(\\mathbf{x}) + h_1 f'(\\mathbf{x}) \\varepsilon_1 ! + h_2 f'(\\mathbf{x}) \\varepsilon_2 ! + h_1 h_2 f''(\\mathbf{x}) \\varepsilon_1 \\varepsilon_2 ! \\f] ! ! Because there is _no truncation error_, all first and second order ! derivatives can be obtained _exactly_, regardless of the step size '' ! \\f$h_1\\f$ and \\f$h_2\\f$. ! The derivatives can be obtained for a function \\f$ f(\\mathbf{x}) \\f$ ! with multiple variables \\f$ \\mathbf{x} \\in \\mathbb{R}^n \\f$ via ! \\f{eqnarray*}{ ! \\frac{\\partial f(\\mathbf{x})}{\\partial x_i} &=& \\frac{ ! \\varepsilon_{1, \\mathrm{part}} \\Big\\{ ! f(\\mathbf{x} + h_1 \\varepsilon_1 \\mathbf{e}_i ! + h_2 \\varepsilon_2 \\mathbf{e}_j + h_1 h_2 \\mathbf{0})\\Big\\}} ! {h_1}\\\\ ! \\frac{\\partial f(\\mathbf{x})}{\\partial x_i} &=& \\frac{ ! \\varepsilon_{2, \\mathrm{part}} \\Big\\{ ! f(\\mathbf{x} + h_1 \\varepsilon_1 \\mathbf{e}_i ! + h_2 \\varepsilon_2 \\mathbf{e}_j + h_1 h_2 \\mathbf{0})\\Big\\}} ! {h_2}\\\\ ! \\frac{\\partial^2 f(\\mathbf{x})}{\\partial x_i \\partial x_j} &=& ! \\frac{(\\varepsilon_1 \\varepsilon_2)_\\mathrm{part} \\Big\\{ ! f(\\mathbf{x} + h_1 \\varepsilon_1 \\mathbf{e}_i ! + h_2 \\varepsilon_2 \\mathbf{e}_j + h_1 h_2 \\mathbf{0})\\Big\\}} ! {h_1 h_2} \\\\ ! \\f} ! where \\f$\\mathbf{e}_i\\f$ and \\f$\\mathbf{e}_j\\f$ are unit vectors, ! which are all zero except for the \\f$i\\f$-th and \\f$j\\f$-th ! component, respectively. ! ! #### Computation principles for hypderdual numbers ! ! Hyperdual numbers \\f$\\mathbf{x} \\in \\mathbb{HD}\\f$ can be expressed ! as tuples: \\f$\\mathbf{x} = [x_0, x_1, x_2, x_{12}] = x_0 ! + x_1 \\varepsilon_1 + x_2 \\varepsilon_2 ! + x_{12} \\varepsilon_1\\varepsilon_2\\f$. ! By using the Taylor expansion of the function \\f$f(\\mathbf{x})\\f$ ! one gets computation priniple for functions with hyperdual ! arguments from ! ! \\f[ ! f(\\mathbf{x}) = f(x_0) + x_1 f'(x_0) \\varepsilon_1 ! + x_2 f'(x_0) \\varepsilon_2 + \\big( x_{12} f'(x_0) ! + x_1 x_2 f''(x_0) \\big) \\varepsilon_1 \\varepsilon_2 ! \\f] ! ! A hyperdual number derived type is provided by: \\ref hyperdual. ! ! #### References ! ! [[1]](https://doi.org/10.2514/6.2011-886) ! Fike, Alonso: **The Development of Hyper-Dual Numbers for Exact ! Second-Derivative Calculations.** ! _49th AIAA Aerospace Sciences Meeting including the New ! Horizons Forum and Aerospace Exposition_ (2011) \\n ! [[2]](https://doi.org/10.3389/fceng.2021.758090) ! Rehner, P. and Bauer, G.: **Application of Generalized ! (Hyper-) Dual Numbers in Equation ! of State Modeling.** ! Frontiers in Chemical Engineering_ (2021) \\n ! use yaeos__constants , only : pr implicit none type , bind ( c ) :: hyperdual !-| Derived type for hyperdual numbers ! ! Hyperdual numbers are represented by the tuple \\f$\\mathbf{f} = ! [f_0, f_1, f_2, f_{12}] = f_0 + f_1 \\varepsilon_1 ! + f_2 \\varepsilon_2 + f_{12} \\varepsilon_1 \\varepsilon_2 \\f$. ! Calculations specificaions are defined in module hyperdual_mod. ! sequence real ( pr ) :: f0 = 0 !! real part of the hyperdual number real ( pr ) :: f1 = 0 !! \\f$\\varepsilon_1\\f$-part of the hyperdual number real ( pr ) :: f2 = 0 !! \\f$\\varepsilon_2\\f$-part of the hyperdual number real ( pr ) :: f12 = 0 !! \\f$\\varepsilon_1\\varepsilon_2\\f$-part of the end type hyperdual !--------------------------------------------------------------------- !--- Operator interfaces --------------------------------------------- !--------------------------------------------------------------------- ! Equal assignment interface assignment ( = ) procedure EqualHyperDualHyperDual procedure EqualHyperDualReal end interface ! Unary operator + interface operator ( + ) procedure PlusHyperDualHyperDual end interface ! Addition operator interface operator ( + ) procedure AddHyperDualHyperDual procedure AddHyperDualReal procedure AddRealHyperDual end interface ! Unary operator - interface operator ( - ) procedure MinusHyperDualHyperDual end interface ! Subtraction operator interface operator ( - ) procedure SubtractHyperDualHyperDual procedure SubtractHyperDualReal procedure SubtractRealHyperDual end interface ! Multiplication operator interface operator ( * ) procedure MultiplyHyperDualHyperDual procedure MultiplyHyperDualReal procedure MultiplyRealHyperDual procedure MultiplyHyperDualInt procedure MultiplyIntHyperDual end interface ! Division operator interface operator ( / ) procedure DivideHyperDualHyperDual procedure DivideHyperDualReal procedure DivideRealHyperDual end interface ! Power operator interface operator ( ** ) procedure PowerHyperDualInt procedure PowerHyperDualHyperDual procedure PowerHyperDualReal end interface !--------------------------------------------------------------------- !--- Summation interface --------------------------------------------- !--------------------------------------------------------------------- interface sum module procedure SumHyperDual module procedure SumHyperDual2 end interface sum !--------------------------------------------------------------------- !--- Logical operator interfaces ------------------------------------- !--------------------------------------------------------------------- ! Equal operator. interface operator (. eq .) ! or (==) procedure eq_dd procedure eq_dr procedure eq_rd procedure eq_di procedure eq_id end interface ! Not equal operator. interface operator (. ne .) ! or (/=) procedure ne_dd procedure ne_dr procedure ne_rd procedure ne_di procedure ne_id end interface ! Less than operator. interface operator (. lt .) ! or (<) procedure lt_dd procedure lt_dr procedure lt_rd procedure lt_di procedure lt_id end interface ! Less than or equal operator. interface operator (. le .) ! or (<=) procedure le_dd procedure le_dr procedure le_rd procedure le_di procedure le_id end interface ! Greater than operator. interface operator (. gt .) ! or (>) procedure gt_dd procedure gt_dr procedure gt_rd procedure gt_di procedure gt_id end interface ! Greater than or equal operator. interface operator (. ge .) ! or (>=) procedure ge_dd procedure ge_dr procedure ge_rd procedure ge_di procedure ge_id end interface !--------------------------------------------------------------------- !--- Math function interfaces ---------------------------------------- !--------------------------------------------------------------------- ! Absolute value function interface abs module procedure absHyperDual end interface ! Integer function interface int module procedure intHyperDual end interface ! Nearest integer function interface nint module procedure nintHyperDual end interface ! Real function interface real module procedure realHyperDual end interface ! Sign function interface sign module procedure sign_dd module procedure sign_dr module procedure sign_rd end interface ! Sine function interface sin module procedure sinHyperDual end interface ! Cosine function interface cos module procedure cosHyperDual end interface ! Tangent function interface tan module procedure tanHyperDual end interface ! Sqrt function interface sqrt module procedure sqrtHyperDual end interface ! Log function interface log module procedure logHyperDual end interface ! Log10 function interface log10 module procedure log10HyperDual end interface ! Exp function interface exp module procedure expHyperDual end interface ! Sinh function interface sinh module procedure sinhHyperDual end interface ! Cosh function interface cosh module procedure coshHyperDual end interface ! Tanh function interface tanh module procedure tanhHyperDual end interface ! Acos function interface acos module procedure acosHyperDual end interface ! Asin function interface asin module procedure asinHyperDual end interface ! Atan function interface atan module procedure atanHyperDual end interface ! Atan2 function interface atan2 module procedure atan2HyperDual end interface ! Max function (limited to combinations below, but that ! can be extended) interface max module procedure max_dd module procedure max_ddd module procedure max_dr module procedure max_rd end interface ! Min function (limited for now to 2 arguments, but that ! can be extended) interface min module procedure min_dd module procedure min_dr module procedure min_rd end interface !===================================================================== contains !------------------------------------------------------------------- !--- Functions for the equal assignment. --------------------------- !------------------------------------------------------------------- elemental subroutine EqualHyperDualHyperDual ( res , inp ) implicit none type ( hyperdual ), intent ( out ) :: res type ( hyperdual ), intent ( in ) :: inp res % f0 = inp % f0 res % f1 = inp % f1 res % f2 = inp % f2 res % f12 = inp % f12 end subroutine EqualHyperDualHyperDual elemental subroutine EqualHyperDualReal ( res , inp ) implicit none type ( hyperdual ), intent ( out ) :: res real ( pr ), intent ( in ) :: inp res % f0 = inp res % f1 = 0.0_pr res % f2 = 0.0_pr res % f12 = 0.0_pr end subroutine EqualHyperDualReal !------------------------------------------------------------------- !--- Function for the unary operator +. ---------------------------- !------------------------------------------------------------------- elemental function PlusHyperDualHyperDual ( v1 ) result ( v2 ) type ( hyperdual ), intent ( in ) :: v1 type ( hyperdual ) :: v2 v2 % f0 = v1 % f0 v2 % f1 = v1 % f1 v2 % f2 = v1 % f2 v2 % f12 = v1 % f12 end function PlusHyperDualHyperDual !------------------------------------------------------------------- !--- Functions for the addition operator. -------------------------- !------------------------------------------------------------------- elemental function AddHyperDualHyperDual ( v1 , v2 ) result ( v3 ) type ( hyperdual ), intent ( in ) :: v1 , v2 type ( hyperdual ) :: v3 v3 % f0 = v1 % f0 + v2 % f0 v3 % f1 = v1 % f1 + v2 % f1 v3 % f2 = v1 % f2 + v2 % f2 v3 % f12 = v1 % f12 + v2 % f12 end function AddHyperDualHyperDual elemental function AddHyperDualReal ( v1 , v2 ) result ( v3 ) type ( hyperdual ), intent ( in ) :: v1 real ( pr ), intent ( in ) :: v2 type ( hyperdual ) :: v3 v3 % f0 = v1 % f0 + v2 v3 % f1 = v1 % f1 v3 % f2 = v1 % f2 v3 % f12 = v1 % f12 end function AddHyperDualReal elemental function AddRealHyperDual ( v1 , v2 ) result ( v3 ) real ( pr ), intent ( in ) :: v1 type ( hyperdual ), intent ( in ) :: v2 type ( hyperdual ) :: v3 v3 % f0 = v1 + v2 % f0 v3 % f1 = v2 % f1 v3 % f2 = v2 % f2 v3 % f12 = v2 % f12 end function AddRealHyperDual !------------------------------------------------------------------- !--- Function for the unary operator -. ---------------------------- !------------------------------------------------------------------- elemental function MinusHyperDualHyperDual ( v1 ) result ( v2 ) type ( hyperdual ), intent ( in ) :: v1 type ( hyperdual ) :: v2 v2 % f0 = - v1 % f0 v2 % f1 = - v1 % f1 v2 % f2 = - v1 % f2 v2 % f12 = - v1 % f12 end function MinusHyperDualHyperDual !------------------------------------------------------------------- !--- Functions for the subtraction operator. ----------------------- !------------------------------------------------------------------- elemental function SubtractHyperDualHyperDual ( v1 , v2 ) result ( v3 ) type ( hyperdual ), intent ( in ) :: v1 , v2 type ( hyperdual ) :: v3 v3 % f0 = v1 % f0 - v2 % f0 v3 % f1 = v1 % f1 - v2 % f1 v3 % f2 = v1 % f2 - v2 % f2 v3 % f12 = v1 % f12 - v2 % f12 end function SubtractHyperDualHyperDual elemental function SubtractHyperDualReal ( v1 , v2 ) result ( v3 ) type ( hyperdual ), intent ( in ) :: v1 real ( pr ), intent ( in ) :: v2 type ( hyperdual ) :: v3 v3 % f0 = v1 % f0 - v2 v3 % f1 = v1 % f1 v3 % f2 = v1 % f2 v3 % f12 = v1 % f12 end function SubtractHyperDualReal elemental function SubtractRealHyperDual ( v1 , v2 ) result ( v3 ) real ( pr ), intent ( in ) :: v1 type ( hyperdual ), intent ( in ) :: v2 type ( hyperdual ) :: v3 v3 % f0 = v1 - v2 % f0 v3 % f1 = - v2 % f1 v3 % f2 = - v2 % f2 v3 % f12 = - v2 % f12 end function SubtractRealHyperDual !------------------------------------------------------------------- !--- Functions for the multiplication operator. -------------------- !------------------------------------------------------------------- elemental function MultiplyHyperDualHyperDual ( v1 , v2 ) result ( v3 ) type ( hyperdual ), intent ( in ) :: v1 , v2 type ( hyperdual ) :: v3 v3 % f0 = v1 % f0 * v2 % f0 v3 % f1 = v1 % f0 * v2 % f1 + v1 % f1 * v2 % f0 v3 % f2 = v1 % f0 * v2 % f2 + v1 % f2 * v2 % f0 v3 % f12 = v1 % f0 * v2 % f12 + v1 % f1 * v2 % f2 + v1 % f2 * v2 % f1 + v1 % f12 * v2 % f0 end function MultiplyHyperDualHyperDual elemental function MultiplyHyperDualReal ( v1 , v2 ) result ( v3 ) type ( hyperdual ), intent ( in ) :: v1 real ( pr ), intent ( in ) :: v2 type ( hyperdual ) :: v3 v3 % f0 = v1 % f0 * v2 v3 % f1 = v1 % f1 * v2 v3 % f2 = v1 % f2 * v2 v3 % f12 = v1 % f12 * v2 end function MultiplyHyperDualReal elemental function MultiplyRealHyperDual ( v1 , v2 ) result ( v3 ) real ( pr ), intent ( in ) :: v1 type ( hyperdual ), intent ( in ) :: v2 type ( hyperdual ) :: v3 v3 % f0 = v1 * v2 % f0 v3 % f1 = v1 * v2 % f1 v3 % f2 = v1 * v2 % f2 v3 % f12 = v1 * v2 % f12 end function MultiplyRealHyperDual elemental function MultiplyHyperDualInt ( v1 , v2 ) result ( v3 ) type ( hyperdual ), intent ( in ) :: v1 integer , intent ( in ) :: v2 type ( hyperdual ) :: v3 v3 % f0 = v1 % f0 * v2 v3 % f1 = v1 % f1 * v2 v3 % f2 = v1 % f2 * v2 v3 % f12 = v1 % f12 * v2 end function MultiplyHyperDualInt elemental function MultiplyIntHyperDual ( v1 , v2 ) result ( v3 ) integer , intent ( in ) :: v1 type ( hyperdual ), intent ( in ) :: v2 type ( hyperdual ) :: v3 v3 % f0 = v1 * v2 % f0 v3 % f1 = v1 * v2 % f1 v3 % f2 = v1 * v2 % f2 v3 % f12 = v1 * v2 % f12 end function MultiplyIntHyperDual !------------------------------------------------------------------- !--- Functions for the division operator. -------------------------- !------------------------------------------------------------------- elemental function DivideHyperDualHyperDual ( v1 , v2 ) result ( v3 ) type ( hyperdual ), intent ( in ) :: v1 , v2 type ( hyperdual ) :: v3 v3 = v1 * v2 ** ( - 1 ) end function DivideHyperDualHyperDual elemental function DivideHyperDualReal ( v1 , v2 ) result ( v3 ) type ( hyperdual ), intent ( in ) :: v1 real ( pr ), intent ( in ) :: v2 type ( hyperdual ) :: v3 real ( pr ) :: invV2 invV2 = 1.0_pr / v2 v3 = v1 * invV2 end function DivideHyperDualReal elemental function DivideRealHyperDual ( v1 , v2 ) result ( v3 ) real ( pr ), intent ( in ) :: v1 type ( hyperdual ), intent ( in ) :: v2 type ( hyperdual ) :: invV2 , v3 invV2 = 1.0_pr * v2 ** ( - 1.0_pr ) v3 = v1 * invV2 end function DivideRealHyperDual !------------------------------------------------------------------- !--- Functions for the power operator. ----------------------------- !------------------------------------------------------------------- elemental function PowerHyperDualInt ( v1 , v2 ) result ( v3 ) type ( hyperdual ), intent ( in ) :: v1 integer , intent ( in ) :: v2 integer :: i , vv2 type ( hyperdual ) :: v3 v3 = 1.0_pr vv2 = abs ( v2 ) do i = 1 , vv2 v3 = v3 * v1 enddo if ( v2 < 0 ) v3 = 1.0_pr / v3 end function PowerHyperDualInt elemental function PowerHyperDualHyperDual ( v1 , v2 ) result ( v3 ) type ( hyperdual ), intent ( in ) :: v1 , v2 type ( hyperdual ) :: v3 , v4 v4 = logHyperDual ( v1 ) v3 = expHyperDual ( v2 * v4 ) end function PowerHyperDualHyperDual elemental function PowerHyperDualReal ( v1 , v2 ) result ( v3 ) type ( hyperdual ), intent ( in ) :: v1 real ( pr ), intent ( in ) :: v2 type ( hyperdual ) :: v3 real ( pr ), parameter :: tol = 1.0e-15_pr real ( pr ) :: xval , deriv xval = v1 % f0 if ( abs ( xval ) < tol ) then if ( xval >= 0.0_pr ) then xval = tol else xval = - tol endif endif deriv = v2 * ( xval ** ( v2 - 1.0_pr )) v3 % f0 = ( v1 % f0 ) ** v2 v3 % f1 = v1 % f1 * deriv v3 % f2 = v1 % f2 * deriv v3 % f12 = v1 % f12 * deriv & & + v2 * ( v2 - 1.0_pr ) * v1 % f1 * v1 % f2 * xval ** ( v2 - 2.0_pr ) end function PowerHyperDualReal !------------------------------------------------------------------- !--- Sum ----------------------------------------------------------- !------------------------------------------------------------------- pure type ( hyperdual ) function SumHyperDual ( v1 , mask ) type ( hyperdual ), intent ( in ) :: v1 (:) logical , intent ( in ), optional :: mask (:) integer :: i SumHyperDual = hyperdual ( 0.0_pr , 0.0_pr , 0.0_pr , 0.0_pr ) if ( present ( mask )) then do i = 1 , size ( v1 ) if ( mask ( i )) SumHyperDual = SumHyperDual + v1 ( i ) end do else do i = 1 , size ( v1 ) SumHyperDual = SumHyperDual + v1 ( i ) end do end if end function SumHyperDual pure function SumHyperDual2 ( v1 , dim ) type ( hyperdual ), intent ( in ) :: v1 (:,:) integer , intent ( in ) :: dim type ( hyperdual ), allocatable :: SumHyperDual2 (:) integer :: i allocate ( SumHyperDual2 ( size ( v1 ) / size ( v1 , dim ))) SumHyperDual2 = hyperdual ( 0.0_pr , 0.0_pr , 0.0_pr , 0.0_pr ) do i = 1 , size ( v1 , dim ) if ( dim == 1 ) then SumHyperDual2 = SumHyperDual2 + v1 ( i ,:) else SumHyperDual2 = SumHyperDual2 + v1 (:, i ) end if end do end function SumHyperDual2 !------------------------------------------------------------------- !--- Functions for the equal operator. ----------------------------- !------------------------------------------------------------------- logical function eq_dd ( lhs , rhs ) type ( hyperdual ), intent ( in ) :: lhs , rhs eq_dd = lhs % f0 == rhs % f0 end function eq_dd elemental logical function eq_dr ( lhs , rhs ) type ( hyperdual ), intent ( in ) :: lhs real ( pr ), intent ( in ) :: rhs eq_dr = lhs % f0 == rhs end function eq_dr elemental logical function eq_rd ( lhs , rhs ) real ( pr ), intent ( in ) :: lhs type ( hyperdual ), intent ( in ) :: rhs eq_rd = lhs == rhs % f0 end function eq_rd logical function eq_di ( lhs , rhs ) type ( hyperdual ), intent ( in ) :: lhs integer , intent ( in ) :: rhs eq_di = lhs % f0 == rhs end function eq_di logical function eq_id ( lhs , rhs ) integer , intent ( in ) :: lhs type ( hyperdual ), intent ( in ) :: rhs eq_id = lhs == rhs % f0 end function eq_id !------------------------------------------------------------------- !--- Functions for the not equal operator. ------------------------- !------------------------------------------------------------------- logical function ne_dd ( lhs , rhs ) type ( hyperdual ), intent ( in ) :: lhs , rhs ne_dd = lhs % f0 /= rhs % f0 end function ne_dd logical function ne_dr ( lhs , rhs ) type ( hyperdual ), intent ( in ) :: lhs real ( pr ), intent ( in ) :: rhs ne_dr = lhs % f0 /= rhs end function ne_dr logical function ne_rd ( lhs , rhs ) real ( pr ), intent ( in ) :: lhs type ( hyperdual ), intent ( in ) :: rhs ne_rd = lhs /= rhs % f0 end function ne_rd logical function ne_di ( lhs , rhs ) type ( hyperdual ), intent ( in ) :: lhs integer , intent ( in ) :: rhs ne_di = lhs % f0 /= rhs end function ne_di logical function ne_id ( lhs , rhs ) integer , intent ( in ) :: lhs type ( hyperdual ), intent ( in ) :: rhs ne_id = lhs /= rhs % f0 end function ne_id !------------------------------------------------------------------- !--- Functions for the less than operator. ------------------------- !------------------------------------------------------------------- logical function lt_dd ( lhs , rhs ) type ( hyperdual ), intent ( in ) :: lhs , rhs lt_dd = lhs % f0 < rhs % f0 end function lt_dd logical function lt_dr ( lhs , rhs ) type ( hyperdual ), intent ( in ) :: lhs real ( pr ), intent ( in ) :: rhs lt_dr = lhs % f0 < rhs end function lt_dr logical function lt_rd ( lhs , rhs ) real ( pr ), intent ( in ) :: lhs type ( hyperdual ), intent ( in ) :: rhs lt_rd = lhs < rhs % f0 end function lt_rd logical function lt_di ( lhs , rhs ) type ( hyperdual ), intent ( in ) :: lhs integer , intent ( in ) :: rhs lt_di = lhs % f0 < rhs end function lt_di logical function lt_id ( lhs , rhs ) integer , intent ( in ) :: lhs type ( hyperdual ), intent ( in ) :: rhs lt_id = lhs < rhs % f0 end function lt_id !------------------------------------------------------------------- !--- Functions for the less than or equal operator. ---------------- !------------------------------------------------------------------- logical function le_dd ( lhs , rhs ) type ( hyperdual ), intent ( in ) :: lhs , rhs le_dd = lhs % f0 <= rhs % f0 end function le_dd logical function le_dr ( lhs , rhs ) type ( hyperdual ), intent ( in ) :: lhs real ( pr ), intent ( in ) :: rhs le_dr = lhs % f0 <= rhs end function le_dr logical function le_rd ( lhs , rhs ) real ( pr ), intent ( in ) :: lhs type ( hyperdual ), intent ( in ) :: rhs le_rd = lhs <= rhs % f0 end function le_rd logical function le_di ( lhs , rhs ) type ( hyperdual ), intent ( in ) :: lhs integer , intent ( in ) :: rhs le_di = lhs % f0 <= rhs end function le_di logical function le_id ( lhs , rhs ) integer , intent ( in ) :: lhs type ( hyperdual ), intent ( in ) :: rhs le_id = lhs <= rhs % f0 end function le_id !------------------------------------------------------------------- !--- Functions for the greater than operator. ---------------------- !------------------------------------------------------------------- logical function gt_dd ( lhs , rhs ) type ( hyperdual ), intent ( in ) :: lhs , rhs gt_dd = lhs % f0 > rhs % f0 end function gt_dd logical function gt_dr ( lhs , rhs ) type ( hyperdual ), intent ( in ) :: lhs real ( pr ), intent ( in ) :: rhs gt_dr = lhs % f0 > rhs end function gt_dr logical function gt_rd ( lhs , rhs ) real ( pr ), intent ( in ) :: lhs type ( hyperdual ), intent ( in ) :: rhs gt_rd = lhs > rhs % f0 end function gt_rd logical function gt_di ( lhs , rhs ) type ( hyperdual ), intent ( in ) :: lhs integer , intent ( in ) :: rhs gt_di = lhs % f0 > rhs end function gt_di logical function gt_id ( lhs , rhs ) integer , intent ( in ) :: lhs type ( hyperdual ), intent ( in ) :: rhs gt_id = lhs > rhs % f0 end function gt_id !------------------------------------------------------------------- !--- Functions for the greater than or equal operator. ------------- !------------------------------------------------------------------- logical function ge_dd ( lhs , rhs ) type ( hyperdual ), intent ( in ) :: lhs , rhs ge_dd = lhs % f0 >= rhs % f0 end function ge_dd logical function ge_dr ( lhs , rhs ) type ( hyperdual ), intent ( in ) :: lhs real ( pr ), intent ( in ) :: rhs ge_dr = lhs % f0 >= rhs end function ge_dr logical function ge_rd ( lhs , rhs ) real ( pr ), intent ( in ) :: lhs type ( hyperdual ), intent ( in ) :: rhs ge_rd = lhs >= rhs % f0 end function ge_rd logical function ge_di ( lhs , rhs ) type ( hyperdual ), intent ( in ) :: lhs integer , intent ( in ) :: rhs ge_di = lhs % f0 >= rhs end function ge_di logical function ge_id ( lhs , rhs ) integer , intent ( in ) :: lhs type ( hyperdual ), intent ( in ) :: rhs ge_id = lhs >= rhs % f0 end function ge_id !------------------------------------------------------------------- !--- Math functions. ----------------------------------------------- !------------------------------------------------------------------- ! Absolute value function. elemental function absHyperDual ( v1 ) result ( v2 ) type ( hyperdual ), intent ( in ) :: v1 type ( hyperdual ) :: v2 if ( v1 % f0 >= 0.0 ) then v2 % f0 = v1 % f0 v2 % f1 = v1 % f1 v2 % f2 = v1 % f2 v2 % f12 = v1 % f12 else v2 % f0 = - v1 % f0 v2 % f1 = - v1 % f1 v2 % f2 = - v1 % f2 v2 % f12 = - v1 % f12 endif end function absHyperDual ! Integer function. elemental function intHyperDual ( v1 ) result ( v2 ) type ( hyperdual ), intent ( in ) :: v1 integer :: v2 v2 = int ( v1 % f0 ) end function intHyperDual ! Nearest integer function. elemental function nintHyperDual ( v1 ) result ( v2 ) type ( hyperdual ), intent ( in ) :: v1 integer :: v2 v2 = nint ( v1 % f0 ) end function nintHyperDual ! Real function. elemental function realHyperDual ( v1 ) result ( v2 ) type ( hyperdual ), intent ( in ) :: v1 real ( pr ) :: v2 v2 = v1 % f0 end function realHyperDual ! Functions for the sign function. elemental function sign_dd ( v1 , v2 ) result ( v3 ) type ( hyperdual ), intent ( in ) :: v1 , v2 type ( hyperdual ) :: v3 real ( pr ) :: ssign if ( v2 % f0 < 0.0 ) then ssign = - 1.0 else ssign = 1.0 endif v3 = ssign * v1 end function sign_dd elemental function sign_dr ( v1 , v2 ) result ( v3 ) type ( hyperdual ), intent ( in ) :: v1 real ( pr ), intent ( in ) :: v2 type ( hyperdual ) :: v3 real ( pr ) :: ssign if ( v2 < 0.0 ) then ssign = - 1.0 else ssign = 1.0 endif v3 = ssign * v1 end function sign_dr elemental function sign_rd ( v1 , v2 ) result ( v3 ) real ( pr ), intent ( in ) :: v1 type ( hyperdual ), intent ( in ) :: v2 type ( hyperdual ) :: v3 real ( pr ) :: ssign if ( v2 % f0 < 0.0 ) then ssign = - 1.0 else ssign = 1.0 endif v3 = ssign * v1 end function sign_rd ! Sine function. elemental function sinHyperDual ( v1 ) result ( v2 ) type ( hyperdual ), intent ( in ) :: v1 type ( hyperdual ) :: v2 real ( pr ) :: f , dx f = sin ( v1 % f0 ) dx = cos ( v1 % f0 ) v2 % f0 = f v2 % f1 = dx * v1 % f1 v2 % f2 = dx * v1 % f2 v2 % f12 = dx * v1 % f12 - f * v1 % f1 * v1 % f2 end function sinHyperDual ! Cosine function. elemental function cosHyperDual ( v1 ) result ( v2 ) type ( hyperdual ), intent ( in ) :: v1 type ( hyperdual ) :: v2 real ( pr ) :: f , dx f = cos ( v1 % f0 ) dx = - sin ( v1 % f0 ) v2 % f0 = f v2 % f1 = dx * v1 % f1 v2 % f2 = dx * v1 % f2 v2 % f12 = dx * v1 % f12 - f * v1 % f1 * v1 % f2 end function cosHyperDual ! Tangent function. elemental function tanHyperDual ( v1 ) result ( v2 ) type ( hyperdual ), intent ( in ) :: v1 type ( hyperdual ) :: v2 real ( pr ) :: f , dx f = tan ( v1 % f0 ) dx = f * f + 1.0_pr v2 % f0 = f v2 % f1 = dx * v1 % f1 v2 % f2 = dx * v1 % f2 v2 % f12 = dx * v1 % f12 + v1 % f1 * v1 % f2 * 2.0_pr * f * dx end function tanHyperDual ! Sqrt function elemental function sqrtHyperDual ( v1 ) result ( v2 ) type ( hyperdual ), intent ( in ) :: v1 type ( hyperdual ) :: v2 real ( pr ), parameter :: expo = 3.0_pr / 2.0_pr real ( pr ) :: square square = sqrt ( v1 % f0 ) v2 % f0 = square v2 % f1 = 0.5_pr / square * v1 % f1 v2 % f2 = 0.5_pr / square * v1 % f2 v2 % f12 = 0.5_pr * v1 % f12 / square - 0.25_pr * v1 % f1 * v1 % f2 / ( v1 % f0 ** expo ) end function sqrtHyperDual ! Log function elemental function logHyperDual ( v1 ) result ( v2 ) type ( hyperdual ), intent ( in ) :: v1 type ( hyperdual ) :: v2 real ( pr ) :: dx1 , dx2 dx1 = v1 % f1 / v1 % f0 dx2 = v1 % f2 / v1 % f0 v2 % f0 = log ( v1 % f0 ) v2 % f1 = dx1 v2 % f2 = dx2 v2 % f12 = v1 % f12 / v1 % f0 - ( dx1 * dx2 ) end function logHyperDual ! Log10 function elemental function log10HyperDual ( v1 ) result ( v2 ) type ( hyperdual ), intent ( in ) :: v1 type ( hyperdual ) :: v2 v2 = log ( v1 ) / log ( 1 0.0_pr ) end function log10HyperDual ! Exp function elemental function expHyperDual ( v1 ) result ( v2 ) type ( hyperdual ), intent ( in ) :: v1 type ( hyperdual ) :: v2 real ( pr ) :: dx dx = exp ( v1 % f0 ) v2 % f0 = dx v2 % f1 = dx * v1 % f1 v2 % f2 = dx * v1 % f2 v2 % f12 = dx * ( v1 % f12 + v1 % f1 * v1 % f2 ) end function expHyperDual ! Sinh function elemental function sinhHyperDual ( v1 ) result ( v2 ) type ( hyperdual ), intent ( in ) :: v1 type ( hyperdual ) :: t1 , t2 , v2 t1 = exp ( v1 ) t2 = exp ( - v1 ) v2 = 0.5_pr * ( t1 - t2 ) end function sinhHyperDual ! Cosh function elemental function coshHyperDual ( v1 ) result ( v2 ) type ( hyperdual ), intent ( in ) :: v1 type ( hyperdual ) :: t1 , t2 , v2 t1 = exp ( v1 ) t2 = exp ( - v1 ) v2 = 0.5_pr * ( t1 + t2 ) end function coshHyperDual ! Tanh function elemental function tanhHyperDual ( v1 ) result ( v2 ) type ( hyperdual ), intent ( in ) :: v1 type ( hyperdual ) :: t1 , t2 , v2 t1 = exp ( v1 ) t2 = exp ( - v1 ) v2 = ( t1 - t2 ) / ( t1 + t2 ) end function tanhHyperDual ! Acos function elemental function acosHyperDual ( v1 ) result ( v2 ) type ( hyperdual ), intent ( in ) :: v1 type ( hyperdual ) :: v2 real ( pr ) :: deriv , deriv1 deriv1 = 1.0_pr - v1 % f0 * v1 % f0 deriv = - 1.0_pr / sqrt ( deriv1 ) v2 % f0 = acos ( v1 % f0 ) v2 % f1 = deriv * v1 % f1 v2 % f2 = deriv * v1 % f2 v2 % f12 = deriv * v1 % f12 & & + v1 % f1 * v1 % f2 * ( - v1 % f0 * deriv1 ** ( - 1.5_pr )) end function acosHyperDual ! Asin function elemental function asinHyperDual ( v1 ) result ( v2 ) type ( hyperdual ), intent ( in ) :: v1 type ( hyperdual ) :: v2 real ( pr ) :: deriv , deriv1 deriv1 = 1.0_pr - v1 % f0 * v1 % f0 deriv = 1.0_pr / sqrt ( deriv1 ) v2 % f0 = asin ( v1 % f0 ) v2 % f1 = deriv * v1 % f1 v2 % f2 = deriv * v1 % f2 v2 % f12 = deriv * v1 % f12 & & + v1 % f1 * v1 % f2 * ( v1 % f0 * deriv1 ** ( - 1.5_pr )) end function asinHyperDual ! Atan function elemental function atanHyperDual ( v1 ) result ( v2 ) type ( hyperdual ), intent ( in ) :: v1 type ( hyperdual ) :: v2 real ( pr ) :: deriv , deriv1 deriv1 = 1.0_pr + v1 % f0 * v1 % f0 deriv = 1.0_pr / deriv1 v2 % f0 = atan ( v1 % f0 ) v2 % f1 = deriv * v1 % f1 v2 % f2 = deriv * v1 % f2 v2 % f12 = deriv * v1 % f12 & & + v1 % f1 * v1 % f2 * ( - 2.0_pr * v1 % f0 / ( deriv1 * deriv1 )) end function atanHyperDual ! Atan2 function elemental function atan2HyperDual ( v1 , v2 ) result ( v3 ) type ( hyperdual ), intent ( in ) :: v1 , v2 type ( hyperdual ) :: v3 real ( pr ) :: a , b , c , d a = v1 % f0 b = v1 % f1 c = v2 % f0 d = v2 % f1 v3 % f0 = atan2 ( a , c ) v3 % f1 = ( c * b - a * d ) / ( a * a + c * c ) end function atan2HyperDual ! Max functions elemental function max_dd ( v1 , v2 ) result ( v3 ) type ( hyperdual ), intent ( in ) :: v1 , v2 type ( hyperdual ) :: v3 if ( v1 % f0 > v2 % f0 ) then v3 = v1 else v3 = v2 endif end function max_dd elemental function max_ddd ( v1 , v2 , v3 ) result ( v4 ) type ( hyperdual ), intent ( in ) :: v1 , v2 , v3 type ( hyperdual ) :: v4 if ( v1 % f0 > v2 % f0 ) then v4 = v1 else v4 = v2 endif if ( v3 % f0 > v4 % f0 ) v4 = v3 end function max_ddd elemental function max_dr ( v1 , v2 ) result ( v3 ) type ( hyperdual ), intent ( in ) :: v1 real ( pr ), intent ( in ) :: v2 type ( hyperdual ) :: v3 if ( v1 % f0 > v2 ) then v3 = v1 else v3 = v2 endif end function max_dr elemental function max_rd ( v1 , v2 ) result ( v3 ) real ( pr ), intent ( in ) :: v1 type ( hyperdual ), intent ( in ) :: v2 type ( hyperdual ) :: v3 if ( v1 > v2 % f0 ) then v3 = v1 else v3 = v2 endif end function max_rd ! Min functions elemental function min_dd ( v1 , v2 ) result ( v3 ) type ( hyperdual ), intent ( in ) :: v1 , v2 type ( hyperdual ) :: v3 if ( v1 % f0 < v2 % f0 ) then v3 = v1 else v3 = v2 endif end function min_dd elemental function min_dr ( v1 , v2 ) result ( v3 ) type ( hyperdual ), intent ( in ) :: v1 real ( pr ), intent ( in ) :: v2 type ( hyperdual ) :: v3 if ( v1 % f0 < v2 ) then v3 = v1 else v3 = v2 endif end function min_dr elemental function min_rd ( v1 , v2 ) result ( v3 ) real ( pr ), intent ( in ) :: v1 type ( hyperdual ), intent ( in ) :: v2 type ( hyperdual ) :: v3 if ( v1 < v2 % f0 ) then v3 = v1 else v3 = v2 endif end function min_rd end module","tags":"","loc":"sourcefile/hyperdual.f90.html"},{"title":"unifac_parameters.f90 – yaeos","text":"Source Code module yaeos__models_ge_group_contribution_unifac_parameters !! # UNIFAC parameters !! UNIFAC parameters module !! !! # Description !! Instances of the yaeos GeGCModelParameters with the classic liquid-vapor !! UNIFAC parameters. !! !! # Examples !! !! ```fortran !! use yaeos__models_ge_group_contribution_unifac_parameters, only: UNIFACParameters !! use yaeos__models_ge_group_contribution_model_parameters, only: GeGCModelParameters !! !! type(GeGCModelParameters) :: parameters !! !! parameters = UNIFACParameters() !! !! ! Get the maingroups i:1, j:7 interaction parameter aij (CH2-H2O) !! print *, parameters%get_maingroups_aij(1, 7) ! prints: 1318.0000 !! ``` !! !! # References !! 1. [Dortmund Data Bank Software & Separation Technology](https://www.ddbst !! .com/published-parameters-unifac.html) !! 2. Fredenslund, A., Jones, R. L., & Prausnitz, J. M. (1975). !! Group‐contribution estimation of activity coefficients in nonideal liquid !! mixtures. AIChE Journal, 21(6), 1086–1099. !! [https://doi.org/10.1002/aic.690210607](https://doi.org/10.1002/aic.690210607) !! 3. Skjold-Jorgensen, S., Kolbe, B., Gmehling, J., & Rasmussen, P. (1979). !! Vapor-Liquid Equilibria by UNIFAC Group Contribution. Revision and !! Extension. Industrial & Engineering Chemistry Process Design and !! Development, 18(4), 714–722. !! [https://doi.org/10.1021/i260072a024](https://doi.org/10.1021/i260072a024) !! 4. Gmehling, J., Rasmussen, P., & Fredenslund, A. (1982). Vapor-liquid !! equilibriums by UNIFAC group contribution. Revision and extension. 2. !! Industrial & Engineering Chemistry Process Design and Development, 21(1), !! 118–127. !! [https://doi.org/10.1021/i200016a021](https://doi.org/10.1021/i200016a021) !! 5. Macedo, E. A., Weidlich, U., Gmehling, J., & Rasmussen, P. (1983). !! Vapor-liquid equilibriums by UNIFAC group contribution. Revision and !! extension. 3. Industrial & Engineering Chemistry Process Design and !! Development, 22(4), 676–678. !! [https://doi.org/10.1021/i200023a023](https://doi.org/10.1021/i200023a023) !! 6. Tiegs, D., Rasmussen, P., Gmehling, J., & Fredenslund, A. (1987). !! Vapor-liquid equilibria by UNIFAC group contribution. 4. Revision and !! extension. Industrial & Engineering Chemistry Research, 26(1), 159–161. !! [https://doi.org/10.1021/ie00061a030](https://doi.org/10.1021/ie00061a030) !! 7. Hansen, H. K., Rasmussen, P., Fredenslund, A., Schiller, M., & !! Gmehling, J. (1991). Vapor-liquid equilibria by UNIFAC group !! contribution. 5. Revision and extension. Industrial & Engineering !! Chemistry Research, 30 (10), 2352–2355. !! [https://doi.org/10.1021/ie00058a017](https://doi.org/10.1021/ie00058a017) !! 8. Wittig, R., Lohmann, J., & Gmehling, J. (2003). Vapor−Liquid Equilibria !! by UNIFAC Group Contribution. 6. Revision and Extension. Industrial & !! Engineering Chemistry Research, 42(1), 183–188. !! [https://doi.org/10.1021/ie020506l](https://doi.org/10.1021/ie020506l) !! use yaeos__constants , only : pr use yaeos__models_ge_group_contribution_model_parameters , only : GeGCModelParameters implicit none contains type ( GeGCModelParameters ) function UNIFACParameters () !! # UNIFACParameters !! UNIFAC parameters !! !! # Description !! Create a Instance of the yaeos GeGCModelParameters with the classic !! liquid-vapor UNIFAC parameters. !! !! # Examples !! !! ```fortran !! ! Instantiate an UNIFAC model with ethanol-water mix and calculate gammas !! use yaeos, only: pr, Groups, setup_unifac, UNIFAC !! use yaeos__models_ge_group_contribution_unifac_parameters, only: UNIFACParameters !! use yaeos__models_ge_group_contribution_model_parameters, only: GeGCModelParameters !! !! type(UNIFAC) :: model !! type(Groups) :: molecules(2) !! real(pr) :: ln_gammas(2) !! !! type(GeGCModelParameters) :: parameters !! !! ! Ethanol definition [CH3, CH2, OH] !! molecules(1)%groups_ids = [1, 2, 14] ! Subgroups ids !! molecules(1)%number_of_groups = [1, 1, 1] ! Subgroups occurrences !! !! ! Water definition [H2O] !! molecules(2)%groups_ids = [16] !! molecules(2)%number_of_groups = [1] !! !! parameters = UNIFACParameters() !! !! ! Model setup !! ! Disclaimer: the default parameters object can be ommited in the !! ! setup_unifac call, because if the parameters argument is not !! ! provided, the return of the constructor UNIFACParameters() will be !! ! used either way. This is just a demostration. !! model = setup_unifac(molecules, parameters) !! !! ! Calculate ln_gammas !! call model%ln_activity_coefficient([0.5_pr, 0.5_pr], 298.0_pr, ln_gammas) !! !! print *, ln_gammas ! result: 0.18534142000449058 0.40331395945417559 !! ``` !! !! # References !! 1. [Dortmund Data Bank Software & Separation Technology](https://www.ddbst !! .com/published-parameters-unifac.html) !! 2. Fredenslund, A., Jones, R. L., & Prausnitz, J. M. (1975). !! Group‐contribution estimation of activity coefficients in nonideal liquid !! mixtures. AIChE Journal, 21(6), 1086–1099. !! [https://doi.org/10.1002/aic.690210607](https://doi.org/10.1002/aic.690210607) !! 3. Skjold-Jorgensen, S., Kolbe, B., Gmehling, J., & Rasmussen, P. (1979). !! Vapor-Liquid Equilibria by UNIFAC Group Contribution. Revision and !! Extension. Industrial & Engineering Chemistry Process Design and !! Development, 18(4), 714–722. !! [https://doi.org/10.1021/i260072a024](https://doi.org/10.1021/i260072a024) !! 4. Gmehling, J., Rasmussen, P., & Fredenslund, A. (1982). Vapor-liquid !! equilibriums by UNIFAC group contribution. Revision and extension. 2. !! Industrial & Engineering Chemistry Process Design and Development, 21(1), !! 118–127. !! [https://doi.org/10.1021/i200016a021](https://doi.org/10.1021/i200016a021) !! 5. Macedo, E. A., Weidlich, U., Gmehling, J., & Rasmussen, P. (1983). !! Vapor-liquid equilibriums by UNIFAC group contribution. Revision and !! extension. 3. Industrial & Engineering Chemistry Process Design and !! Development, 22(4), 676–678. !! [https://doi.org/10.1021/i200023a023](https://doi.org/10.1021/i200023a023) !! 6. Tiegs, D., Rasmussen, P., Gmehling, J., & Fredenslund, A. (1987). !! Vapor-liquid equilibria by UNIFAC group contribution. 4. Revision and !! extension. Industrial & Engineering Chemistry Research, 26(1), 159–161. !! [https://doi.org/10.1021/ie00061a030](https://doi.org/10.1021/ie00061a030) !! 7. Hansen, H. K., Rasmussen, P., Fredenslund, A., Schiller, M., & !! Gmehling, J. (1991). Vapor-liquid equilibria by UNIFAC group !! contribution. 5. Revision and extension. Industrial & Engineering !! Chemistry Research, 30 (10), 2352–2355. !! [https://doi.org/10.1021/ie00058a017](https://doi.org/10.1021/ie00058a017) !! 8. Wittig, R., Lohmann, J., & Gmehling, J. (2003). Vapor−Liquid Equilibria !! by UNIFAC Group Contribution. 6. Revision and Extension. Industrial & !! Engineering Chemistry Research, 42(1), 183–188. !! [https://doi.org/10.1021/ie020506l](https://doi.org/10.1021/ie020506l) !! ! ======================================================================== ! UNIFAC subgroups ids definition ! ------------------------------------------------------------------------ UNIFACParameters % subgroups_ids = [& 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , & 13 , 14 , 15 , 16 , 17 , 18 , 19 , 20 , 21 , 22 , 23 , 24 , & 25 , 26 , 27 , 28 , 29 , 30 , 31 , 32 , 33 , 34 , 35 , 36 , & 37 , 38 , 39 , 40 , 41 , 42 , 43 , 44 , 45 , 46 , 47 , 48 , & 49 , 50 , 51 , 52 , 53 , 54 , 55 , 56 , 57 , 58 , 59 , 60 , & 61 , 62 , 63 , 64 , 65 , 66 , 67 , 68 , 69 , 70 , 71 , 72 , & 73 , 74 , 75 , 76 , 77 , 78 , 79 , 80 , 81 , 82 , 83 , 84 , & 85 , 86 , 87 , 88 , 89 , 90 , 91 , 92 , 93 , 94 , 95 , 96 , & 97 , 98 , 99 , 100 , 101 , 102 , 103 , 104 , 105 , 106 , 107 , 108 , & 109 , 118 , 119 , 178 , 179 & ] ! ======================================================================== ! UNIFAC maingroups ids definition ! ------------------------------------------------------------------------ UNIFACParameters % maingroups_ids = [& 1 , 2 , 3 , 4 , 5 , 6 , & 7 , 8 , 9 , 10 , 11 , 12 , & 13 , 14 , 15 , 16 , 17 , 18 , & 19 , 20 , 21 , 22 , 23 , 24 , & 25 , 26 , 27 , 28 , 29 , 30 , & 31 , 32 , 33 , 34 , 35 , 36 , & 37 , 38 , 39 , 40 , 41 , 42 , & 43 , 44 , 45 , 46 , 47 , 48 , & 49 , 50 , 51 , 55 , 84 , 85 & ] ! ======================================================================== ! UNIFAC subgroups maingroups ! ------------------------------------------------------------------------ UNIFACParameters % subgroups_maingroups = [& 1 , 1 , 1 , 1 , 2 , 2 , 2 , 2 , 3 , 3 , 4 , 4 , & 4 , 5 , 6 , 7 , 8 , 9 , 9 , 10 , 11 , 11 , 12 , 13 , & 13 , 13 , 13 , 14 , 14 , 14 , 15 , 15 , 15 , 16 , 16 , 17 , & 18 , 18 , 18 , 19 , 19 , 20 , 20 , 21 , 21 , 21 , 22 , 22 , & 22 , 23 , 23 , 24 , 25 , 26 , 26 , 26 , 27 , 28 , 29 , 29 , & 30 , 31 , 32 , 33 , 34 , 34 , 35 , 36 , 37 , 2 , 38 , 39 , & 39 , 40 , 40 , 40 , 41 , 42 , 42 , 42 , 42 , 43 , 43 , 43 , & 44 , 45 , 45 , 45 , 45 , 45 , 45 , 45 , 45 , 46 , 46 , 46 , & 46 , 46 , 46 , 47 , 47 , 48 , 48 , 48 , 49 , 50 , 50 , 50 , & 51 , 55 , 55 , 84 , 85 & ] ! ======================================================================== ! UNIFAC subgroups Rs ! ------------------------------------------------------------------------ UNIFACParameters % subgroups_Rs = [& 0.90110_pr , 0.67440_pr , 0.44690_pr , 0.21950_pr , 1.34540_pr , & 1.11670_pr , 1.11730_pr , 0.88860_pr , 0.53130_pr , 0.36520_pr , & 1.26630_pr , 1.03960_pr , 0.81210_pr , 1.00000_pr , 1.43110_pr , & 0.92000_pr , 0.89520_pr , 1.67240_pr , 1.44570_pr , 0.99800_pr , & 1.90310_pr , 1.67640_pr , 1.24200_pr , 1.14500_pr , 0.91830_pr , & 0.69080_pr , 0.91830_pr , 1.59590_pr , 1.36920_pr , 1.14170_pr , & 1.43370_pr , 1.20700_pr , 0.97950_pr , 1.18650_pr , 0.95970_pr , & 1.06000_pr , 2.99930_pr , 2.83320_pr , 2.66700_pr , 1.87010_pr , & 1.64340_pr , 1.30130_pr , 1.52800_pr , 1.46540_pr , 1.23800_pr , & 1.01060_pr , 2.25640_pr , 2.06060_pr , 1.80160_pr , 2.87000_pr , & 2.64010_pr , 3.39000_pr , 1.15620_pr , 2.00860_pr , 1.78180_pr , & 1.55440_pr , 1.41990_pr , 2.05700_pr , 1.87700_pr , 1.65100_pr , & 3.16800_pr , 2.40880_pr , 1.26400_pr , 0.94920_pr , 1.29200_pr , & 1.06130_pr , 2.82660_pr , 2.31440_pr , 0.79100_pr , 0.66050_pr , & 0.69480_pr , 3.08560_pr , 2.63220_pr , 1.40600_pr , 1.01050_pr , & 0.61500_pr , 1.38000_pr , 1.60350_pr , 1.44430_pr , 1.28530_pr , & 1.04700_pr , 1.48380_pr , 1.30300_pr , 1.10440_pr , 3.98100_pr , & 3.03560_pr , 2.22870_pr , 2.40600_pr , 1.64930_pr , 1.81740_pr , & 1.96700_pr , 2.17210_pr , 2.62430_pr , 1.45150_pr , 2.19050_pr , & 1.96370_pr , 2.85890_pr , 2.63220_pr , 2.40540_pr , 2.12260_pr , & 1.89520_pr , 1.61300_pr , 1.38630_pr , 1.15890_pr , 3.47400_pr , & 2.85690_pr , 2.69080_pr , 2.52470_pr , 1.05670_pr , 2.68690_pr , & 2.45950_pr , 2.02600_pr , 5.77400_pr & ] ! ======================================================================== ! UNIFAC subgroups Qs ! ------------------------------------------------------------------------ UNIFACParameters % subgroups_Qs = [& 0.84800_pr , 0.54000_pr , 0.22800_pr , 0.00000_pr , 1.17600_pr , & 0.86700_pr , 0.98800_pr , 0.67600_pr , 0.40000_pr , 0.12000_pr , & 0.96800_pr , 0.66000_pr , 0.34800_pr , 1.20000_pr , 1.43200_pr , & 1.40000_pr , 0.68000_pr , 1.48800_pr , 1.18000_pr , 0.94800_pr , & 1.72800_pr , 1.42000_pr , 1.18800_pr , 1.08800_pr , 0.78000_pr , & 0.46800_pr , 1.10000_pr , 1.54400_pr , 1.23600_pr , 0.92400_pr , & 1.24400_pr , 0.93600_pr , 0.62400_pr , 0.94000_pr , 0.63200_pr , & 0.81600_pr , 2.11300_pr , 1.83300_pr , 1.55300_pr , 1.72400_pr , & 1.41600_pr , 1.22400_pr , 1.53200_pr , 1.26400_pr , 0.95200_pr , & 0.72400_pr , 1.98800_pr , 1.68400_pr , 1.44800_pr , 2.41000_pr , & 2.18400_pr , 2.91000_pr , 0.84400_pr , 1.86800_pr , 1.56000_pr , & 1.24800_pr , 1.10400_pr , 1.65000_pr , 1.67600_pr , 1.36800_pr , & 2.48400_pr , 2.24800_pr , 0.99200_pr , 0.83200_pr , 1.08800_pr , & 0.78400_pr , 2.47200_pr , 2.05200_pr , 0.72400_pr , 0.48500_pr , & 0.52400_pr , 2.73600_pr , 2.12000_pr , 1.38000_pr , 0.92000_pr , & 0.46000_pr , 1.20000_pr , 1.26320_pr , 1.00630_pr , 0.74940_pr , & 0.40990_pr , 1.06210_pr , 0.76390_pr , 0.46570_pr , 3.20000_pr , & 2.64400_pr , 1.91600_pr , 2.11600_pr , 1.41600_pr , 1.64800_pr , & 1.82800_pr , 2.10000_pr , 2.37600_pr , 1.24800_pr , 1.79600_pr , & 1.48800_pr , 2.42800_pr , 2.12000_pr , 1.81200_pr , 1.90400_pr , & 1.59200_pr , 1.36800_pr , 1.06000_pr , 0.74800_pr , 2.79600_pr , & 2.14000_pr , 1.86000_pr , 1.58000_pr , 0.73200_pr , 2.12000_pr , & 1.80800_pr , 0.86800_pr , 4.93200_pr & ] ! ======================================================================== ! UNIFAC aij ! ------------------------------------------------------------------------ UNIFACParameters % maingroups_aij = reshape ([& 0.00000_pr , - 3 5.36000_pr , - 1 1.12000_pr , - 6 9.70000_pr , 15 6.40000_pr , & 1 6.51000_pr , 30 0.00000_pr , 27 5.80000_pr , 2 6.76000_pr , 50 5.70000_pr , & 11 4.80000_pr , 32 9.30000_pr , 8 3.36000_pr , - 3 0.48000_pr , 6 5.33000_pr , & - 8 3.98000_pr , 113 9.00000_pr , - 10 1.56000_pr , 2 4.82000_pr , 31 5.30000_pr , & 9 1.46000_pr , 3 4.01000_pr , 3 6.70000_pr , - 7 8.45000_pr , 10 6.80000_pr , & - 3 2.69000_pr , 554 1.00000_pr , - 5 2.65000_pr , - 7.48100_pr , - 2 5.31000_pr , & 13 9.93000_pr , 12 8.00000_pr , - 3 1.52000_pr , - 7 2.88000_pr , 5 0.49000_pr , & - 16 5.90000_pr , 4 7.41000_pr , - 5.13200_pr , - 3 1.95000_pr , 14 7.30000_pr , & 52 9.00000_pr , - 3 4.36000_pr , 11 0.20000_pr , 1 3.89000_pr , 3 0.74000_pr , & 2 7.97000_pr , - 1 1.92000_pr , 3 9.93000_pr , - 2 3.61000_pr , - 8.47900_pr , & 45 6.19000_pr , 24 5.21000_pr , 12 5.36000_pr , 22 1.56000_pr , 8 6.02000_pr , & 0.00000_pr , 3.44600_pr , - 11 3.60000_pr , 45 7.00000_pr , - 1 2.52000_pr , & 49 6.10000_pr , 21 7.50000_pr , 4 2.92000_pr , 5 6.30000_pr , 13 2.10000_pr , & 11 0.40000_pr , 2 6.51000_pr , 1.16300_pr , - 2 8.70000_pr , - 2 5.38000_pr , & 200 0.00000_pr , - 4 7.63000_pr , - 4 0.62000_pr , 126 4.00000_pr , 4 0.25000_pr , & - 2 3.50000_pr , 5 1.06000_pr , 16 0.90000_pr , 7 0.32000_pr , - 1.99600_pr , & 0.00000_pr , 1 6.62300_pr , 0.00000_pr , 8 2.64000_pr , 0.00000_pr , & 0.00000_pr , 17 4.60000_pr , 4 1.38000_pr , 6 4.07000_pr , 57 3.00000_pr , & 12 4.20000_pr , - 13 1.70000_pr , 24 9.00000_pr , 6 2.40000_pr , 139 7.00000_pr , & 0.00000_pr , 0.00000_pr , - 1 6.11000_pr , 0.00000_pr , 9.75500_pr , & 13 2.40000_pr , 54 3.60000_pr , 16 1.10000_pr , 0.00000_pr , 0.00000_pr , & 38 4.45000_pr , - 39 1.81000_pr , 62 9.96000_pr , 6 1.13000_pr , 3 8.81000_pr , & 0.00000_pr , - 14 6.80000_pr , 8 9.60000_pr , - 5 0.00000_pr , 36 2.30000_pr , & 2 5.34000_pr , 14 0.10000_pr , 2 3.39000_pr , 8 5.84000_pr , 1 8.12000_pr , & 5 2.13000_pr , - 4 4.85000_pr , - 2 2.31000_pr , - 22 3.90000_pr , 24 7.50000_pr , & 3 1.87000_pr , - 2 2.97000_pr , 6 2.32000_pr , 4.68000_pr , 12 1.30000_pr , & 28 8.50000_pr , - 4.70000_pr , - 9 7.27000_pr , 1 0.38000_pr , 182 4.00000_pr , & 2 1.49700_pr , 2 8.41000_pr , 15 7.29000_pr , 22 1.40000_pr , 5 8.68000_pr , & - 15 4.20000_pr , - 10 1.12000_pr , - 2.50400_pr , - 12 3.60000_pr , 39 5.80000_pr , & - 23 7.20000_pr , - 13 3.90000_pr , 14 0.60000_pr , 31 7.60000_pr , 78 7.90000_pr , & 23 4.40000_pr , - 2 3.88000_pr , 16 7.90000_pr , 0.00000_pr , - 8 6.88000_pr , & 0.00000_pr , 14 2.90000_pr , 2 3.93000_pr , 0.00000_pr , 4 7.05000_pr , & 0.00000_pr , 0.00000_pr , 7 6.50000_pr , 7 4.15000_pr , 16 7.00000_pr , & 0.00000_pr , 2 5.82000_pr , - 4 4.50000_pr , 37 7.60000_pr , 24 4.20000_pr , & 36 5.80000_pr , 10 6.00000_pr , - 17 0.00000_pr , 42 8.00000_pr , 6 5.69000_pr , & 29 6.40000_pr , 22 3.00000_pr , 10 9.90000_pr , 76 2.80000_pr , 4 9.80000_pr , & - 13 8.40000_pr , 8 9.86000_pr , 12 2.91000_pr , 14 0.78000_pr , 6 9.90000_pr , & 13 4.70000_pr , 40 2.50000_pr , - 9 7.05000_pr , - 12 7.80000_pr , 4 0.67500_pr , & 1 9.56000_pr , 12 8.80000_pr , 15 0.64000_pr , 2 6.41000_pr , 111 2.00000_pr , & 61 4.52000_pr , - 14 3.20000_pr , 39 7.40000_pr , 41 9.10000_pr , - 15 7.30000_pr , & - 24 0.20000_pr , 83 9.83000_pr , 61 5.80000_pr , 0.00000_pr , 0.00000_pr , & 6.21400_pr , 0.00000_pr , 0.00000_pr , - 1 9.45000_pr , 0.00000_pr , & 27 4.10000_pr , 2.84500_pr , 0.00000_pr , 34 7.13000_pr , 0.00000_pr , & 0.00000_pr , 98 6.50000_pr , 52 4.10000_pr , 63 6.10000_pr , 80 3.20000_pr , & 0.00000_pr , 24 9.10000_pr , - 22 9.10000_pr , - 45 1.60000_pr , 16 4.50000_pr , & 52 9.00000_pr , 24 5.40000_pr , 13 9.40000_pr , 23 7.70000_pr , - 24 2.80000_pr , & - 15 0.00000_pr , 2 8.60000_pr , - 1 7.40000_pr , - 13 2.30000_pr , 18 5.40000_pr , & - 15 1.00000_pr , 56 2.20000_pr , 52 7.60000_pr , 74 2.10000_pr , 85 6.30000_pr , & 32 5.70000_pr , 26 1.60000_pr , 56 1.60000_pr , 60 9.80000_pr , 46 1.60000_pr , & 52 1.63000_pr , 26 7.60000_pr , 50 1.30000_pr , 52 4.90000_pr , 6 8.95000_pr , & - 2 5.87000_pr , 38 9.30000_pr , 73 8.90000_pr , 64 9.70000_pr , 6 4.16000_pr , & 0.00000_pr , 8 8.63000_pr , 191 3.00000_pr , 43 0.06000_pr , 79 6.90000_pr , & 79 4.40000_pr , 39 4.80000_pr , 51 7.50000_pr , 0.00000_pr , - 6 1.20000_pr , & 68 2.50000_pr , 0.00000_pr , 7 2.19000_pr , 11 1.65000_pr , 12 2.19000_pr , & 69 7.20000_pr , 78 7.60000_pr , 63 7.35000_pr , 60 3.25000_pr , - 13 7.10000_pr , & 0.00000_pr , 28 9.60000_pr , - 26 5.20000_pr , 10 8.65000_pr , - 34 0.18000_pr , & 24 9.63000_pr , 22 7.80000_pr , 23 8.40000_pr , - 48 1.65000_pr , - 37 0.30000_pr , & - 40 6.80000_pr , - 11 8.10000_pr , - 37 8.24000_pr , 16 2.60000_pr , 33 9.80000_pr , & 52 9.00000_pr , 66 9.90000_pr , 64 9.10000_pr , 70 9.60000_pr , 61 2.80000_pr , & 25 2.56000_pr , 51 1.29000_pr , 91 4.20000_pr , 44 8.60000_pr , 28 7.00000_pr , & 24 0.80000_pr , 43 1.30000_pr , 49 4.70000_pr , 96 7.71000_pr , 69 5.00000_pr , & 21 8.80000_pr , 52 8.00000_pr , 64 5.90000_pr , 17 2.20000_pr , 0.00000_pr , & 17 1.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 76 2.70000_pr , & 0.00000_pr , 0.00000_pr , 42 0.00000_pr , - 8 9.24000_pr , 59 7.80000_pr , & 0.00000_pr , 26 5.75000_pr , 0.00000_pr , 0.00000_pr , 131 8.00000_pr , & 27 0.60000_pr , 90 3.80000_pr , 569 5.00000_pr , 35 3.50000_pr , - 18 0.95000_pr , & 0.00000_pr , - 60 1.80000_pr , 47 2.50000_pr , 48 0.80000_pr , 20 0.80000_pr , & 12 4.63000_pr , - 31 4.70000_pr , - 33 0.40000_pr , - 44 8.20000_pr , - 59 8.80000_pr , & - 34 1.60000_pr , - 33 2.90000_pr , 24 2.80000_pr , - 6 6.17000_pr , 69 8.24000_pr , & 70 8.69000_pr , 82 6.76000_pr , 120 1.00000_pr , - 27 4.50000_pr , 41 7.90000_pr , & 36 0.70000_pr , 108 1.00000_pr , 0.00000_pr , 2 3.48400_pr , - 13 7.40000_pr , & 0.00000_pr , 7 9.18000_pr , 0.00000_pr , - 24 0.00000_pr , 38 6.60000_pr , & 0.00000_pr , 0.00000_pr , - 28 7.10000_pr , 0.00000_pr , 28 4.40000_pr , & 18 0.20000_pr , 0.00000_pr , 83 2.20000_pr , 0.00000_pr , - 50 9.30000_pr , & - 20 5.70000_pr , 0.00000_pr , - 38 4.30000_pr , 0.00000_pr , 0.00000_pr , & 62 7.39000_pr , 0.00000_pr , 0.00000_pr , 133 3.00000_pr , 52 6.10000_pr , & 132 9.00000_pr , 88 4.90000_pr , - 25 9.70000_pr , - 10 1.70000_pr , 32 4.50000_pr , & 0.00000_pr , - 13 3.10000_pr , - 15 5.60000_pr , - 3 6.72000_pr , - 23 4.25000_pr , & - 17 8.54610_pr , - 87 0.80000_pr , 0.00000_pr , 0.00000_pr , - 25 3.10000_pr , & - 34 1.60000_pr , 0.00000_pr , - 1 1.00000_pr , 0.00000_pr , 163 3.50000_pr , & 0.00000_pr , 1000 0.00000_pr , 62 2.30000_pr , 0.00000_pr , 81 5.12000_pr , & 142 1.30000_pr , 0.00000_pr , 0.00000_pr , 83 8.40000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , - 16 7.30000_pr , 0.00000_pr , & 0.00000_pr , - 23 4.70000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 81 0.50000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 47 6.40000_pr , 18 2.60000_pr , 2 5.77000_pr , & - 5 2.10000_pr , 8 4.00000_pr , 2 3.39000_pr , - 19 5.40000_pr , - 35 6.10000_pr , & 0.00000_pr , 12 8.00000_pr , 37 2.20000_pr , 38 5.40000_pr , 19 1.10000_pr , & 0.00000_pr , 39 4.60000_pr , 22 5.30000_pr , - 45 0.30000_pr , 2 9.10000_pr , & - 28 7.50000_pr , - 29 7.80000_pr , 28 6.28000_pr , 8 2.86000_pr , 55 2.10000_pr , & 37 2.00000_pr , 51 8.40000_pr , - 14 2.61000_pr , - 10 1.50000_pr , 30 3.65700_pr , & 16 0.60000_pr , 31 7.50000_pr , 13 5.40000_pr , 13 8.00000_pr , - 14 2.60000_pr , & 44 3.61500_pr , 11 0.40000_pr , 11 4.55000_pr , - 4 0.90000_pr , 0.00000_pr , & 9 7.04000_pr , 0.00000_pr , 12 3.40000_pr , 99 2.40000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 15 6.40000_pr , 0.00000_pr , & 0.00000_pr , 27 8.80000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 67 7.00000_pr , 44 8.75000_pr , 34 7.30000_pr , 58 6.80000_pr , & - 20 3.60000_pr , 30 6.42000_pr , - 11 6.00000_pr , - 27 1.10000_pr , - 3 7.36000_pr , & 0.00000_pr , 18 5.10000_pr , - 23 6.50000_pr , - 7.83800_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 22 4.66000_pr , & - 16 5.50000_pr , - 4 7.51000_pr , 19 0.60000_pr , 24 2.80000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 24 5.90000_pr , 0.00000_pr , - 5 5.87000_pr , & 0.00000_pr , 35 4.00000_pr , 18 3.80000_pr , 0.00000_pr , 1 3.89000_pr , & 0.00000_pr , 57 7.50000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 23 2.10000_pr , 3 7.85000_pr , 5.99400_pr , 568 8.00000_pr , 10 1.10000_pr , & - 1 0.72000_pr , 7 2.87000_pr , - 44 9.40000_pr , - 21 3.70000_pr , - 11 0.30000_pr , & 0.00000_pr , 116 7.00000_pr , 46 1.30000_pr , 0.00000_pr , 13 6.00000_pr , & 288 8.60010_pr , - 29 4.80000_pr , 8.87000_pr , - 26 6.60000_pr , - 25 6.30000_pr , & 3 5.38000_pr , - 13 2.95000_pr , 17 6.45000_pr , 12 9.49000_pr , - 17 1.10000_pr , & 12 9.30000_pr , 0.00000_pr , 24 3.77500_pr , 0.00000_pr , - 14 6.31000_pr , & 15 2.00000_pr , 2 1.92000_pr , 2 4.37000_pr , - 11 1.45000_pr , 4 1.57000_pr , & 17 5.53000_pr , 61 1.30000_pr , 0.00000_pr , - 8 2.12000_pr , 0.00000_pr , & - 23 4.90000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , - 3.44400_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 50 7.00000_pr , & 33 3.50000_pr , 28 7.10000_pr , 19 7.80000_pr , 26 7.80000_pr , 17 9.70000_pr , & 23 3.87000_pr , - 3 2.52000_pr , - 19 0.40000_pr , 76 6.00000_pr , - 24 1.80000_pr , & 0.00000_pr , 45 7.30000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 55 4.40000_pr , 9 9.37000_pr , 19 3.90000_pr , 0.00000_pr , & 8 0.99000_pr , 23 5.60000_pr , 35 1.90000_pr , 38 3.30000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 20 1.50000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , - 9 2.26000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 13 4.50000_pr , 0.00000_pr , - 11 6.70000_pr , 0.00000_pr , 14 5.40000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 25 1.50000_pr , 21 4.50000_pr , & 3 2.14000_pr , 21 3.10000_pr , 2 8.06000_pr , - 12 8.60000_pr , 54 0.50000_pr , & - 16 2.87420_pr , - 10 3.60000_pr , 30 4.10000_pr , - 23 5.70000_pr , - 23 4.00000_pr , & 0.00000_pr , 22 2.10000_pr , - 5 6.08000_pr , - 19 4.10000_pr , 28 5.36000_pr , & - 15 6.10000_pr , 3 8.81000_pr , - 33 8.50000_pr , 22 5.39000_pr , - 19 7.71000_pr , & - 2 0.93000_pr , 11 3.90000_pr , - 2 5.15000_pr , - 9 4.49000_pr , 22 0.66000_pr , & 11 2.38200_pr , 6 3.71000_pr , - 8 7.31000_pr , 9.20700_pr , 47 6.60000_pr , & 73 6.40000_pr , 17 3.77000_pr , - 9 3.51000_pr , 0.00000_pr , - 21 7.90000_pr , & 16 7.30000_pr , - 15 8.20000_pr , 27 8.15000_pr , - 24 7.80000_pr , 44 8.50000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 39 1.50000_pr , 24 0.90000_pr , 16 1.70000_pr , & 1 9.02000_pr , 8.64200_pr , 35 9.30000_pr , 4 8.89000_pr , - 83 2.97000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , - 7 8.36000_pr , & 0.00000_pr , 12 7.40000_pr , 3 8.89000_pr , - 1 5.07000_pr , 0.00000_pr , & - 15 7.30000_pr , 0.00000_pr , 13 1.20000_pr , 0.00000_pr , 0.00000_pr , & 26 1.10000_pr , 10 8.50000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 10 6.70000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , - 36 6.51000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 4 9.70000_pr , 0.00000_pr , 0.00000_pr , 96 1.80000_pr , - 12 5.20000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 25 5.70000_pr , 16 3.90000_pr , 12 2.80000_pr , - 4 9.29000_pr , & 4 2.70000_pr , - 2 0.98000_pr , 16 8.00000_pr , 0.00000_pr , - 17 4.20000_pr , & 0.00000_pr , - 7 3.50000_pr , 0.00000_pr , 25 1.50000_pr , - 10 7.20000_pr , & 0.00000_pr , 86 5.90000_pr , 6 4.30000_pr , - 20 7.66000_pr , - 10 8.50000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 9 1.13000_pr , & 10 2.20000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , - 21 3.74000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , - 19 8.80000_pr , 1 0.03000_pr , & 0.00000_pr , 28 4.50000_pr , 146 4.20000_pr , 160 3.80000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 20 6.60000_pr , 6 1.11000_pr , 9 0.49000_pr , 2 3.50000_pr , - 32 3.00000_pr , & 5 3.90000_pr , 30 4.00000_pr , 0.00000_pr , - 16 9.00000_pr , 0.00000_pr , & - 19 6.70000_pr , 0.00000_pr , 542 2.29980_pr , - 4 1.11000_pr , - 18 9.20000_pr , & 0.00000_pr , - 2 4.46000_pr , 0.00000_pr , - 44 6.86000_pr , 0.00000_pr , & 15 1.38000_pr , - 14 1.40000_pr , - 29 3.70000_pr , 31 6.90000_pr , 295 1.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , - 25 7.20000_pr , & 0.00000_pr , 0.00000_pr , 11 6.47800_pr , - 18 5.20000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 92 0.70000_pr , & 74 9.30000_pr , 64 8.20000_pr , 66 4.20000_pr , - 5 2.39000_pr , 48 9.70000_pr , & 24 3.20000_pr , 11 9.90000_pr , 620 1.00000_pr , 0.00000_pr , 47 5.50000_pr , & 0.00000_pr , - 4 6.39000_pr , - 20 0.70000_pr , 13 8.54000_pr , 28 7.43000_pr , & 0.00000_pr , 11 7.40000_pr , 77 7.40000_pr , 49 3.80000_pr , 42 9.70000_pr , & 14 0.80000_pr , 0.00000_pr , 89 8.20000_pr , 33 4.90000_pr , 0.00000_pr , & 13 4.90000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 19 2.30000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 34 3.70000_pr , 0.00000_pr , - 2 2.10000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 28 7.77000_pr , 28 0.50000_pr , & - 4.44900_pr , 5 2.80000_pr , 17 0.02900_pr , 58 0.48000_pr , 45 9.00000_pr , & - 30 5.50000_pr , 7.34100_pr , 0.00000_pr , - 0.13000_pr , - 23 3.40000_pr , & 21 3.20000_pr , 0.00000_pr , 43 1.49000_pr , 0.00000_pr , 8 9.70000_pr , & 0.00000_pr , 13 4.28000_pr , - 31 3.50000_pr , 0.00000_pr , 58 7.30000_pr , & 1 8.98000_pr , 36 8.50000_pr , 2 0.18000_pr , 0.00000_pr , 247 5.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & - 4 2.71000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 28 1.60000_pr , & 15 9.80000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 22 1.40000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 59 7.00000_pr , 33 6.90000_pr , 21 2.50000_pr , & 609 6.00000_pr , 6.71200_pr , 5 3.28000_pr , 11 2.60000_pr , 0.00000_pr , & 48 1.70000_pr , - 10 6.40000_pr , 49 4.60000_pr , - 4 7.25000_pr , - 1 8.51000_pr , & 35 8.90000_pr , 14 7.10000_pr , 125 5.10000_pr , - 28 1.60000_pr , - 16 9.67000_pr , & 0.00000_pr , 9 2.07000_pr , 5 4.32000_pr , 25 8.60000_pr , 7 4.04000_pr , & 49 1.95000_pr , 36 3.50000_pr , 0.28300_pr , 0.00000_pr , 33 5.74300_pr , & 16 1.00000_pr , 0.00000_pr , 16 9.60000_pr , 0.00000_pr , 13 6.90000_pr , & 32 9.12000_pr , 0.00000_pr , - 4 2.31000_pr , 33 5.20000_pr , 0.00000_pr , & 15 0.60000_pr , 0.00000_pr , - 6 1.60000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 11 9.20000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 66 3.50000_pr , 31 8.90000_pr , 53 7.40000_pr , 87 2.30000_pr , & 19 9.00000_pr , - 20 2.00000_pr , - 1 4.09000_pr , 40 8.90000_pr , 66 9.40000_pr , & 49 7.50000_pr , 66 0.20000_pr , - 26 8.10000_pr , 66 4.60000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , - 39 6.00000_pr , - 15 3.70000_pr , 20 5.27000_pr , & 0.00000_pr , 51 9.10000_pr , 54 3.30000_pr , 50 4.20000_pr , 63 1.00000_pr , & 99 3.40000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 57 0.60000_pr , 0.00000_pr , 61 6.60000_pr , 525 6.00000_pr , 0.00000_pr , & - 18 0.20000_pr , 0.00000_pr , 89 8.20000_pr , 0.00000_pr , - 9 7.77000_pr , & 0.00000_pr , 117 9.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , - 7 0.25000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 3 5.93000_pr , - 3 6.87000_pr , - 1 8.81000_pr , - 11 4.14000_pr , 7 5.62000_pr , & - 3 8.32000_pr , 32 5.44000_pr , 0.00000_pr , - 19 1.69000_pr , 75 1.90000_pr , & - 3 4.74000_pr , 0.00000_pr , 30 1.14000_pr , - 8 2.92000_pr , 0.00000_pr , & - 18 2.91000_pr , 28 7.00000_pr , 0.00000_pr , 4.93300_pr , 1 3.41000_pr , & 0.00000_pr , - 8 4.53000_pr , - 15 7.10000_pr , 1 1.80000_pr , - 12 9.70000_pr , & 11 3.00000_pr , 197 1.00000_pr , - 7 3.09200_pr , - 2 7.94000_pr , - 3 9.46000_pr , & 0.00000_pr , 17 9.25000_pr , - 26 2.30000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 38 3.20000_pr , 0.00000_pr , - 5 5.21000_pr , 0.00000_pr , & 18 2.20000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 5 3.76000_pr , & 5 8.55000_pr , - 14 4.40000_pr , - 11 1.00000_pr , 6 5.28000_pr , - 10 2.54000_pr , & 37 0.40000_pr , 51 7.27000_pr , - 13 0.30000_pr , 6 7.52000_pr , 10 8.85000_pr , & 3 1.00000_pr , 13 7.77000_pr , 0.00000_pr , 0.00000_pr , - 7 3.85000_pr , & - 11 1.00000_pr , - 35 1.60000_pr , - 15 2.70000_pr , - 4 4.70000_pr , 10 8.31000_pr , & 0.00000_pr , 0.00000_pr , 1 7.97000_pr , - 8.30900_pr , - 9.63900_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , - 11 6.21000_pr , 0.00000_pr , & - 4 0.82000_pr , - 17 4.50000_pr , 0.00000_pr , - 21 5.00000_pr , 0.00000_pr , & 30 1.90000_pr , 0.00000_pr , 39 7.24000_pr , 0.00000_pr , 30 5.40000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & - 19 4.70000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 2 4.90000_pr , - 1 3.99000_pr , & - 23 1.90000_pr , - 8 0.25000_pr , - 9 8.12000_pr , - 13 9.35000_pr , 35 3.68000_pr , & 0.00000_pr , - 35 4.55000_pr , - 48 3.70000_pr , - 20 9.66000_pr , - 12 6.20000_pr , & - 15 4.30000_pr , 0.00000_pr , 0.00000_pr , - 35 2.90000_pr , 0.00000_pr , & - 11 4.73000_pr , - 1 5.62000_pr , 3 9.63000_pr , 24 9.15000_pr , 0.00000_pr , & 0.00000_pr , 5 1.90000_pr , - 0.22660_pr , 0.00000_pr , 0.00000_pr , & - 2 6.05800_pr , 0.00000_pr , 4 8.48400_pr , 0.00000_pr , 2 1.76000_pr , & - 4 6.80000_pr , 0.00000_pr , - 34 3.60000_pr , 0.00000_pr , - 14 9.80000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , - 19 3.00000_pr , 0.00000_pr , & 0.00000_pr , - 19 6.20000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & - 36 3.10000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 10 4.30000_pr , - 10 9.70000_pr , 3.00000_pr , & - 14 1.30000_pr , 14 3.10000_pr , - 4 4.76000_pr , 49 7.54000_pr , 182 7.00000_pr , & - 3 9.20000_pr , 0.00000_pr , 5 4.57000_pr , 17 9.70000_pr , 4 7.67000_pr , & - 9 9.81000_pr , 7 1.23000_pr , - 26 2.00000_pr , 88 2.00000_pr , - 20 5.30000_pr , & - 5 4.86000_pr , 18 3.40000_pr , 6 2.42000_pr , 5 6.33000_pr , - 3 0.10000_pr , & 0.00000_pr , 24 8.40000_pr , - 3 4.68000_pr , 51 4.60000_pr , - 6 0.71000_pr , & 0.00000_pr , - 13 3.16000_pr , 0.00000_pr , 4 8.49000_pr , 7 7.55000_pr , & 0.00000_pr , - 5 8.43000_pr , - 8 5.14800_pr , - 13 4.20000_pr , - 12 4.60000_pr , & - 18 6.70000_pr , 0.00000_pr , 33 5.70000_pr , 0.00000_pr , 7 0.81000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 3.16300_pr , - 1 1.30000_pr , & 0.00000_pr , - 7 9.34000_pr , 0.00000_pr , 7 5.04000_pr , 0.00000_pr , & 0.00000_pr , 1 1.44000_pr , 10 0.10000_pr , 18 7.00000_pr , - 21 1.00000_pr , & 12 3.50000_pr , - 2 8.25000_pr , 13 3.90000_pr , 691 5.00000_pr , - 11 9.80000_pr , & 0.00000_pr , 44 2.40000_pr , 2 4.28000_pr , 13 4.80000_pr , 3 0.05000_pr , & - 1 8.93000_pr , - 18 1.90000_pr , 61 7.50000_pr , - 2.17000_pr , - 4.62400_pr , & - 7 9.08000_pr , 15 3.00000_pr , 22 3.10000_pr , 19 2.10000_pr , - 7 5.97000_pr , & 0.00000_pr , 13 2.90000_pr , - 12 3.10000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , - 18 5.30000_pr , 0.00000_pr , & - 33 4.12000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , - 37 4.16000_pr , & 3 3.95000_pr , 95 6.10000_pr , 0.00000_pr , 0.00000_pr , 16 1.50000_pr , & 0.00000_pr , 0.00000_pr , 7.08200_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 66 1.50000_pr , 35 7.50000_pr , 16 8.04000_pr , 362 9.00000_pr , 25 6.50000_pr , & 7 5.14000_pr , 22 0.60000_pr , 0.00000_pr , 13 7.50000_pr , 0.00000_pr , & - 8 1.13000_pr , 0.00000_pr , 9 5.18000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , - 0.51500_pr , 0.00000_pr , & 3 2.73000_pr , 10 8.90000_pr , 0.00000_pr , 49 0.88000_pr , 13 2.70000_pr , & 0.00000_pr , - 8 5.12000_pr , 27 7.80000_pr , 0.00000_pr , 0.00000_pr , & 48 1.34800_pr , 6 4.28000_pr , 12 5.30000_pr , 17 4.43300_pr , 0.00000_pr , & 0.00000_pr , 37 9.40000_pr , 0.00000_pr , 22 3.60000_pr , 0.00000_pr , & - 12 4.70000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 84 4.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 17 6.30000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 54 3.00000_pr , & 0.00000_pr , 19 4.90000_pr , 444 8.00000_pr , 15 7.10000_pr , 45 7.88000_pr , & 39 9.50000_pr , - 41 3.48000_pr , 54 8.50000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 15 5.11000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & - 13 9.30000_pr , 284 5.00000_pr , 0.00000_pr , 0.00000_pr , 8 6.20000_pr , & 0.00000_pr , 0.00000_pr , 53 4.70000_pr , 221 3.00000_pr , 53 3.20000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 244 8.00000_pr , 428 8.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 15 3.60000_pr , 7 6.30000_pr , & 5 2.06800_pr , - 9.45100_pr , 48 8.90000_pr , - 3 1.09000_pr , 88 7.10000_pr , & 848 3.50000_pr , 21 6.13800_pr , 0.00000_pr , 18 3.04600_pr , 0.00000_pr , & 14 0.89600_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 23 0.85200_pr , 0.00000_pr , 45 0.08800_pr , 0.00000_pr , & 11 6.61200_pr , 13 2.20000_pr , 0.00000_pr , 32 0.20000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , - 2 7.45000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 16 7.90000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 88 5.50000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 18 4.40000_pr , 0.00000_pr , - 1 0.43000_pr , & 39 3.60000_pr , 14 7.50000_pr , 1 7.50000_pr , 0.00000_pr , 0.00000_pr , & - 4 6.28000_pr , 0.00000_pr , 0.00000_pr , 10 3.90000_pr , - 8.53800_pr , & - 7 0.14000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.46040_pr , 0.00000_pr , 5 9.02000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 8 5.70000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & - 7 1.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & - 27 4.10000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 6.97100_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 35 4.55000_pr , 26 2.90000_pr , - 6 4.69000_pr , 4 8.49000_pr , & - 12 0.46000_pr , - 6 1.76000_pr , 18 8.02600_pr , 0.00000_pr , - 16 3.70000_pr , & 0.00000_pr , 20 2.25000_pr , 0.00000_pr , 17 0.10000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & - 20 8.90000_pr , 6 5.56000_pr , 14 9.56000_pr , - 6 4.38000_pr , 54 6.68000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , - 6 4.28000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 302 5.00000_pr , 0.00000_pr , 21 0.36600_pr , 497 5.00000_pr , - 31 8.93000_pr , & - 11 9.20000_pr , 1 2.72000_pr , - 68 7.10000_pr , 7 1.46000_pr , 0.00000_pr , & - 10 1.70000_pr , 0.00000_pr , - 2 0.11000_pr , 0.00000_pr , 93 9.07000_pr , & 0.00000_pr , 0.10040_pr , 0.00000_pr , 17 7.50000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 13 9.82200_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 53 5.80000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , - 19 1.70000_pr , 0.00000_pr , & - 26 4.30000_pr , 0.00000_pr , 0.00000_pr , 26 2.00000_pr , 0.00000_pr , & 0.00000_pr , 51 5.80000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 33 5.80000_pr , & 0.00000_pr , 11 3.30000_pr , 25 9.00000_pr , 31 3.50000_pr , 21 2.10000_pr , & 0.00000_pr , 0.00000_pr , 5 3.59000_pr , 11 7.00000_pr , 14 8.30000_pr , & 0.00000_pr , - 14 9.50000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 22 8.40000_pr , 2.22000_pr , & 17 7.60000_pr , 8 6.40000_pr , 24 7.80000_pr , 0.00000_pr , 30 4.30000_pr , & 299 0.00000_pr , 29 2.70000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 3 7.10000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 28 8.10000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 47 9.50000_pr , 18 3.80000_pr , & 26 1.30000_pr , 21 0.00000_pr , 20 2.10000_pr , 10 6.30000_pr , 77 7.10000_pr , & 0.00000_pr , 24 5.20000_pr , 0.00000_pr , 1 8.88000_pr , 29 8.13000_pr , & - 20 2.30000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & - 6 0.78000_pr , - 6 2.17000_pr , - 9 5.00000_pr , 34 4.40000_pr , 31 5.90000_pr , & 16 8.80000_pr , 14 6.60000_pr , 59 3.40000_pr , 1 0.17000_pr , - 12 4.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 6.37000_pr , & 0.00000_pr , 0.00000_pr , - 11 1.20000_pr , 0.00000_pr , 32 2.42000_pr , & 0.00000_pr , - 17 6.26000_pr , 0.00000_pr , 62 7.70000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 29 8.90000_pr , 3 1.14000_pr , 15 4.26000_pr , & - 15 2.55000_pr , 72 7.80000_pr , - 11 9.10000_pr , 0.00000_pr , 0.00000_pr , & - 24 6.60000_pr , 2.21000_pr , 7 1.48000_pr , 0.00000_pr , - 15 6.57000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & - 20 3.02000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , - 2 7.70100_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 63 1.50000_pr , 0.00000_pr , & 6.69900_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 52 6.50000_pr , 17 9.00000_pr , 16 9.90000_pr , 428 4.00000_pr , & - 20 2.10000_pr , - 39 9.30000_pr , - 13 9.00000_pr , 0.00000_pr , - 4 4.58000_pr , & 0.00000_pr , 5 2.08000_pr , 0.00000_pr , 12 8.80000_pr , 87 4.19000_pr , & 0.00000_pr , 24 3.10000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & - 46 3.60000_pr , 0.00000_pr , 21 5.00000_pr , 36 3.70000_pr , 33 7.70000_pr , & 133 7.37000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 3 1.66000_pr , & 0.00000_pr , - 41 7.20000_pr , 0.00000_pr , 3 2.90000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 13 6.60000_pr , & 0.00000_pr , - 2 9.34000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 68 9.00000_pr , - 5 2.87000_pr , 38 3.90000_pr , - 11 9.20000_pr , 7 4.27000_pr , & - 5.22400_pr , 16 0.80000_pr , 0.00000_pr , - 6 3.50000_pr , - 33 9.20000_pr , & - 2 8.61000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 8 1.57000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 36 9.49000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 83 7.20000_pr , 0.00000_pr , 5.15000_pr , 0.00000_pr , & - 5 3.91000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , - 4.18900_pr , & - 6 6.46000_pr , - 25 9.10000_pr , - 28 2.50000_pr , 22 5.80000_pr , 3 3.47000_pr , & 0.00000_pr , 0.00000_pr , - 3 4.57000_pr , 17 2.40000_pr , - 27 5.20000_pr , & - 1 1.40000_pr , 24 0.20000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 16 0.70000_pr , - 5 5.77000_pr , - 1 1.16000_pr , - 16 8.20000_pr , & - 9 1.80000_pr , 11 1.20000_pr , 18 7.10000_pr , 0.00000_pr , 1 0.76000_pr , & 0.00000_pr , - 4 7.37000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , - 4 8.33000_pr , 207 3.20000_pr , 0.00000_pr , - 20 8.80000_pr , & 0.00000_pr , 0.00000_pr , - 13 7.70000_pr , 0.00000_pr , - 19 8.00000_pr , & 0.00000_pr , 0.00000_pr , - 6 6.31000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 14 8.90000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 12 5.80000_pr , 35 9.30000_pr , & 38 9.30000_pr , 10 1.40000_pr , 4 4.78000_pr , - 4 8.25000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & - 27 3.95000_pr , 0.00000_pr , 57 0.90000_pr , - 19 6.31200_pr , 0.00000_pr , & - 15 8.80000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 21 5.20000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 5 0.06000_pr , 18 5.60000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 48 5.30000_pr , - 7 0.45000_pr , 24 5.60000_pr , & 562 9.00000_pr , - 14 3.90000_pr , - 17 2.40000_pr , 31 9.00000_pr , 0.00000_pr , & - 6 1.70000_pr , - 26 8.80000_pr , 8 5.33000_pr , 30 8.90000_pr , 25 4.80000_pr , & - 16 4.00000_pr , - 25 5.22000_pr , 2 2.05000_pr , - 33 4.40000_pr , 0.00000_pr , & - 15 1.50000_pr , - 22 8.00000_pr , 6.57000_pr , - 16 0.28000_pr , 0.00000_pr , & 49 8.60000_pr , 514 3.14010_pr , - 22 3.10000_pr , 0.00000_pr , 0.00000_pr , & 7 8.92000_pr , 0.00000_pr , 30 2.20000_pr , 0.00000_pr , 33 6.25000_pr , & - 11 9.80000_pr , - 9 7.71000_pr , - 8.80400_pr , 25 5.00000_pr , - 11 0.65000_pr , & 0.00000_pr , 5 5.80000_pr , - 2 8.65000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , - 2.85900_pr , 44 9.40000_pr , 2 2.67000_pr , - 24 5.39000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , - 17 2.51000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 30 9.58000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , - 11 7.17000_pr , - 5.57900_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & - 3 2.17000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 38 7.10000_pr , 4 8.33000_pr , 10 3.50000_pr , 6 9.26000_pr , 19 0.30000_pr , & 16 5.70000_pr , - 19 7.50000_pr , - 49 4.20000_pr , - 1 8.80000_pr , - 27 5.50000_pr , & 56 0.20000_pr , - 12 2.30000_pr , 41 7.00000_pr , 0.00000_pr , - 3 8.77000_pr , & 0.00000_pr , - 8 9.42000_pr , 0.00000_pr , 12 0.30000_pr , - 33 7.00000_pr , & 6 3.67000_pr , - 9 6.87000_pr , 25 5.80000_pr , 25 6.50000_pr , - 7 1.18000_pr , & 24 8.40000_pr , 0.00000_pr , 46 9.80000_pr , 0.00000_pr , 4 3.37000_pr , & 34 7.80000_pr , 6 8.55000_pr , - 19 5.10000_pr , 0.00000_pr , 15 3.70000_pr , & 42 3.40000_pr , 73 0.80000_pr , 0.00000_pr , 7 2.31000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 10 1.20000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , - 45 0.40000_pr , & 0.00000_pr , - 43 2.30000_pr , 0.00000_pr , - 81 7.70000_pr , 0.00000_pr , & - 36 3.80000_pr , 0.00000_pr , - 58 8.90000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 133 8.00000_pr , - 66 4.40000_pr , 44 8.10000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 74 5.30000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 25 2.70000_pr , 0.00000_pr , & 23 8.90000_pr , 0.00000_pr , - 171 2.80000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 27 5.90000_pr , - 132 7.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 23 3.10000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , - 216 6.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 22 0.30000_pr , 8 6.46000_pr , 3 0.04000_pr , & 4 6.38000_pr , - 50 4.20000_pr , 0.00000_pr , - 45 2.20000_pr , - 65 9.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , - 3 5.68000_pr , & 0.00000_pr , - 20 9.70000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 100 4.20000_pr , 0.00000_pr , - 26 2.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 2 6.35000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , - 5.86900_pr , 0.00000_pr , - 8 8.11000_pr , 0.00000_pr , & 7 2.96000_pr , - 5 2.10000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , - 21 8.90000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 11 1.80000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 39 0.90000_pr , 20 0.20000_pr , 0.00000_pr , 0.00000_pr , - 38 2.70000_pr , & 0.00000_pr , 83 5.60000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , - 32 2.30000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 55 3.30000_pr , & 26 8.10000_pr , 33 3.30000_pr , 42 1.90000_pr , - 24 8.30000_pr , 0.00000_pr , & 13 9.60000_pr , 0.00000_pr , 3 7.54000_pr , 0.00000_pr , 15 1.80000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 1 6.23000_pr , 0.00000_pr , 0.00000_pr , & 36 1.10000_pr , 0.00000_pr , 42 3.10000_pr , 43 4.10000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , - 35 3.50000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 12 2.40000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 18 7.00000_pr , - 61 7.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 3 7.63000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 56 5.90000_pr , 6 3.95000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , - 1 8.27000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 242 9.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 21 6.10000_pr , 6 2.56000_pr , - 5 9.58000_pr , & - 20 3.60000_pr , 10 4.70000_pr , - 5 9.40000_pr , 40 7.90000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 9 2.99000_pr , 0.00000_pr , - 3 9.16000_pr , 18 4.90000_pr , & 5 7.65000_pr , - 4 6.01000_pr , 0.00000_pr , 100 5.00000_pr , - 16 2.60000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , - 13 6.60000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 10 8.50000_pr , & 0.00000_pr , - 4.56500_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 69 9.13000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 80 8.59000_pr , & 20 0.94000_pr , 36 0.82000_pr , 23 3.51000_pr , 21 5.81000_pr , 15 0.02000_pr , & - 25 5.63000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 58 5.19000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , - 124 3.00000_pr , - 86 1.46000_pr , & 0.00000_pr , 0.00000_pr , - 184 0.80000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , - 186 9.90000_pr , 63 7.65000_pr , 42 4.93000_pr , 0.00000_pr , & 0.00000_pr , 5 6.29800_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 151 7.50000_pr , & 0.00000_pr ], [ 54 , 54 ]) ! ======================================================================== ! UNIFAC bij ! ------------------------------------------------------------------------ allocate ( UNIFACParameters % maingroups_bij ( 54 , 54 )) UNIFACParameters % maingroups_bij = 0.0_pr ! ======================================================================== ! UNIFAC cij ! ------------------------------------------------------------------------ allocate ( UNIFACParameters % maingroups_cij ( 54 , 54 )) UNIFACParameters % maingroups_cij = 0.0_pr end function UNIFACParameters end module yaeos__models_ge_group_contribution_unifac_parameters","tags":"","loc":"sourcefile/unifac_parameters.f90.html"},{"title":"fit_nrtl_mhv.f90 – yaeos","text":"Source Code module yaeos__fitting_fit_nrtl_mhv use yaeos__constants , only : pr use yaeos__fitting , only : FittingProblem use yaeos__models , only : ArModel , NRTL , CubicEoS , MHV use forsus , only : Substance implicit none integer , parameter :: nc = 2 type , extends ( FittingProblem ) :: FitMHVNRTL logical :: fit_nrtl = . false . logical :: fit_lij = . false . contains procedure :: get_model_from_X => model_from_X end type FitMHVNRTL contains subroutine model_from_X ( problem , X ) use yaeos , only : R , RKPR , PengRobinson78 , ArModel , QMR , CubicEoS use yaeos__models_ar_cubic_quadratic_mixing , only : RKPR_D1mix class ( FitMHVNRTL ), intent ( in out ) :: problem real ( pr ), intent ( in ) :: X (:) type ( NRTL ) :: ge real ( pr ) :: a ( nc , nc ), b ( nc , nc ), c ( nc , nc ) a = 0 ; b = 0 ; c = 0 a ( 1 , 2 ) = x ( 1 ) a ( 2 , 1 ) = x ( 2 ) b ( 1 , 2 ) = x ( 3 ) b ( 2 , 1 ) = x ( 4 ) c ( 1 , 2 ) = x ( 5 ) c ( 2 , 1 ) = x ( 6 ) ge = NRTL ( a , b , c ) associate ( model => problem % model ) select type ( model ) class is ( CubicEoS ) associate ( mr => model % mixrule ) select type ( mr ) class is ( MHV ) if ( problem % fit_lij ) mr % l ( 1 , 2 ) = x ( 7 ) if ( problem % fit_lij ) mr % l ( 2 , 1 ) = x ( 7 ) if ( problem % fit_nrtl ) mr % ge = ge end select end associate end select end associate end subroutine model_from_X end module yaeos__fitting_fit_nrtl_mhv","tags":"","loc":"sourcefile/fit_nrtl_mhv.f90.html"},{"title":"rachford_rice.f90 – yaeos","text":"Source Code module yaeos__equilibria_rachford_rice use yaeos__constants , only : pr implicit none contains subroutine betato01 ( z , K ) !! Modify K-factor values to assure that \\beta lies between (0,1) implicit none real ( pr ), intent ( in ) :: z (:) !! Molar fractions of the system real ( pr ) :: K (:) !! K factors \\frac{y_i}{x_i} real ( pr ) :: g0 , g1 ! function g valuated at beta=0 and 1, based on K factors g1 = 1.0 do while ( g0 < 0 . or . g1 > 0 ) if (& any ( isnan ([ g0 , g1 ])) & . or . all ( K == 0 ) & . or . maxval ( abs ( K - 1 )) < 0.01_pr ) exit g0 = sum ( z * K ) - 1._pr g1 = 1._pr - sum ( z / K ) if ( g0 < 0 ) then ! Increased volatiliy will bring the solution from ! subcooled liquid into VLE K = 1.1_pr * K else if ( g1 > 0 ) then ! Decreased volatiliy will bring the solution from ! superheated vapor into VLE K = 0.9_pr * K end if end do end subroutine betato01 subroutine betalimits ( z , K , bmin , bmax ) !! Define beta limits to avoid overshooting when solving the Rachford-Rice !! equation. !! !! This is based on the assumtion that either y_i < 1 and x_i < 1. real ( pr ), intent ( in ) :: z (:) !! Molar fractions vector real ( pr ), intent ( in ) :: K (:) !! K-factors real ( pr ), intent ( out ) :: bmin !! Minimum beta value real ( pr ), intent ( out ) :: bmax !! Maximum beta value real ( pr ), dimension ( size ( z )) :: vmin , vmax vmin = 0.d0 ! max=1.001d0 ! modified 3/3/15 (not to generate false separations with beta 0.9999...) vmax = 1.00001_pr ! modified 28/6/15 (to prevent overshooting in the Newton for solving RR eq.) where ( K * z > 1 ) vmin = ( K * z - 1._pr ) / ( K - 1._pr ) elsewhere ( K < z ) vmax = ( 1 - z ) / ( 1 - K ) end where bmin = maxval ( vmin ) bmax = minval ( vmax ) end subroutine betalimits subroutine rachford_rice ( z , K , beta , rr , drrdb ) !! Rachford-Rice equation for a two phase system real ( pr ), intent ( in ) :: z (:) real ( pr ), intent ( in ) :: K (:) real ( pr ), intent ( in ) :: beta real ( pr ), intent ( out ) :: rr real ( pr ), intent ( out ) :: drrdb real ( pr ) :: denom ( size ( z )) denom = 1 + beta * ( K - 1._pr ) rr = sum ( z * ( K - 1._pr ) / denom ) drrdb = - sum ( z * ( K - 1._pr ) ** 2 / denom ** 2 ) end subroutine rachford_rice subroutine solve_rr ( z , K , beta , beta_min , beta_max ) !! Solve the Rachford-Rice Equation. real ( pr ), intent ( in ) :: z (:) !! Mole fractions vector real ( pr ), intent ( in ) :: K (:) !! K-factors real ( pr ), intent ( out ) :: beta_min !! Lower limit for \\beta real ( pr ), intent ( out ) :: beta_max !! Upper limit for \\beta real ( pr ), intent ( out ) :: beta !! \\beta value real ( pr ) :: g , dgdb real ( pr ) :: step g = 1.0 step = 1.0 call betalimits ( z , k , beta_min , beta_max ) do while ( abs ( g ) > 1.d-5 . and . abs ( step ) > 1.d-10 ) call rachford_rice ( z , k , beta , g , dgdb ) step = - g / dgdb beta = beta + step do while (( beta < beta_min . or . beta_max < beta ) . and . abs ( step ) > 1e-10 ) step = step / 2 beta = beta - step end do end do end subroutine solve_rr end module yaeos__equilibria_rachford_rice","tags":"","loc":"sourcefile/rachford_rice.f90.html"},{"title":"fit_kij_lij.f90 – yaeos","text":"Source Code module yaeos__fitting_fit_kij_lij !! Binary interaction parameters fitting problem. use yaeos__fitting , only : pr , FittingProblem , ArModel implicit none integer , parameter :: nc = 2 type , extends ( FittingProblem ) :: FitKijLij !! # Binary Interaction Parameters of Cubic EoS fitting problem !! Fit the binary interaction parameters of a mixtures. !! !! # Description !! Fitting setup for quadratic combining rules, it is possible to select !! which parameters will be optimized with the `fit_lij` and `fit_kij` !! attributes. !! !! # Examples !! !! ## Fit the kij BIP !! !! ```fortran !! type(CubicEoS) :: model ! Model to fit !! type(FitKijLij) :: fitting_problem ! Fitting problem specification !! type(EquilibriumState) :: exp_data(3) !! real(pr) :: X(2) ! parameter variables !! real(pr) :: error !! !! ! !! !! model = PengRobinson76(tc, pc, w) ! Model to fit !! !! fitting_problem%exp_data = exp_data !! fitting_problem%model = model !! fitting_problem%fit_kij = .true. !! !! X = 0 ! initial values == 0 !! err = optimize(X, fitting_problem) !! ``` !! !! # References !! logical :: fit_lij = . false . !! Fit the l_{ij} parameter logical :: fit_kij = . false . !! Fit the k_{ij} parameter contains procedure :: get_model_from_X => model_from_X end type FitKijLij contains subroutine model_from_X ( problem , X ) use yaeos , only : R , RKPR , PengRobinson78 , ArModel , QMR , CubicEoS real ( pr ), intent ( in ) :: X (:) class ( FitKijLij ), intent ( in out ) :: problem real ( pr ) :: kij ( nc , nc ), lij ( nc , nc ) if ( size ( X ) /= 2 ) error stop 1 kij = 0 kij ( 1 , 2 ) = X ( 1 ) kij ( 2 , 1 ) = kij ( 1 , 2 ) lij = 0 lij ( 1 , 2 ) = X ( 2 ) lij ( 2 , 1 ) = X ( 2 ) associate ( model => problem % model ) select type ( model ) class is ( CubicEoS ) associate ( mr => model % mixrule ) select type ( mr ) class is ( QMR ) if ( problem % fit_kij ) mr % k = kij if ( problem % fit_lij ) mr % l = lij end select end associate end select end associate end subroutine end module yaeos__fitting_fit_kij_lij","tags":"","loc":"sourcefile/fit_kij_lij.f90.html"},{"title":"legacy.f90 – yaeos","text":"Source Code module legacy_ar_models !! Legacy Thermodynamic routines !! Module for a cubic eos system, made with the intention to keep !! compatiblity with legacy codes but with a better structure. !! this should be later adapted into a simple oop system where an eos object !! stores the relevant parameters (or some functional oriented approach) use yaeos__constants , only : pr , R use ar_interface , only : ar_fun , vinit implicit none ! Model settings integer :: thermo_model !! Which thermodynamic model to use integer :: tdep !! Temperature dependance of kij integer :: mixing_rule !! What mixing rule to use integer :: nc !! Number of components ! Mole fractions real ( pr ), allocatable :: z (:) !! Mole fractions vector ! ========================================================================== ! Cubic EoS Possible parameters ! -------------------------------------------------------------------------- ! Critical constants real ( pr ), allocatable :: tc (:) !! Critical temperature [K] real ( pr ), allocatable :: pc (:) !! Critical pressure [bar] real ( pr ), allocatable :: dc (:) !! Critical density [mol/L] real ( pr ), allocatable :: w (:) !! Acentric factor ! Model parameters real ( pr ), allocatable :: ac (:) !! Critical attractive parameter [bar (L/mol)^2] real ( pr ), allocatable :: b (:) !! repulsive parameter [L] real ( pr ), allocatable :: del1 (:) !! \\delta_1 parameter real ( pr ), allocatable :: k (:) !! Attractive parameter constant ! Classic VdW mixing rules parameters real ( pr ), allocatable :: kij (:, :) !! Attractive BIP real ( pr ), allocatable :: lij (:, :) !! Repulsive BIP real ( pr ), allocatable :: bij (:, :) ! T dependant mixing rule parameters real ( pr ), allocatable :: kij0 (:, :), kinf (:, :), tstar (:, :) ! ========================================================================== contains ! ========================================================================== ! Initializer routines ! -------------------------------------------------------------------------- subroutine setup ( n , nmodel , ntdep , ncomb ) !! Setup the basics variables that describe the model. ! TODO: With a more integrated legacy code maybe this can be ! avoided or at least better set up integer , intent ( in ) :: n !! Number of components integer , intent ( in ) :: nmodel !! Number of model integer , intent ( in ) :: ntdep !! Kij dependant of temperature integer , intent ( in ) :: ncomb !! Combining rule thermo_model = nmodel tdep = ntdep mixing_rule = ncomb nc = n if ( allocated ( tc )) deallocate ( tc ) if ( allocated ( pc )) deallocate ( pc ) if ( allocated ( dc )) deallocate ( dc ) if ( allocated ( w )) deallocate ( w ) if ( allocated ( ac )) deallocate ( ac ) if ( allocated ( b )) deallocate ( b ) if ( allocated ( del1 )) deallocate ( del1 ) if ( allocated ( k )) deallocate ( k ) if ( allocated ( kij )) deallocate ( kij ) if ( allocated ( lij )) deallocate ( lij ) if ( allocated ( kinf )) deallocate ( kinf ) if ( allocated ( tstar )) deallocate ( tstar ) if ( allocated ( bij )) deallocate ( bij ) allocate ( tc ( n )) allocate ( pc ( n )) allocate ( dc ( n )) allocate ( w ( n )) allocate ( ac ( n )) allocate ( b ( n )) allocate ( del1 ( n )) allocate ( k ( n )) allocate ( kij ( n , n )) allocate ( lij ( n , n )) allocate ( kinf ( n , n )) allocate ( tstar ( n , n )) allocate ( bij ( n , n )) end subroutine setup subroutine PR78_factory ( moles_in , ac_in , b_in , tc_in , pc_in , w_in , k_in ) !! PengRobinson 78 factory !! !! Takes either the critical parameters or the fitted model parameters !! and gets ones in base of the others real ( pr ), intent ( in ) :: moles_in ( nc ) real ( pr ), optional , intent ( in ) :: ac_in ( nc ) real ( pr ), optional , intent ( in ) :: b_in ( nc ) real ( pr ), optional , intent ( in ) :: tc_in ( nc ) real ( pr ), optional , intent ( in ) :: pc_in ( nc ) real ( pr ), optional , intent ( in ) :: w_in ( nc ) real ( pr ), optional , intent ( in ) :: k_in ( nc ) integer :: i logical :: params_spec , critical_spec real ( pr ) :: zc ( nc ), oma ( nc ), omb ( nc ) real ( pr ) :: vceos ( nc ), al , be , ga ( nc ) real ( pr ) :: RTc ( nc ) ar_fun => ar_srkpr vinit => cubic_v0 del1 = 1 + sqrt ( 2.0_pr ) z = moles_in params_spec = ( present ( ac_in ) . and . present ( b_in ) . and . present ( k_in )) critical_spec = ( present ( tc_in ) . and . present ( pc_in ) . and . present ( w_in )) if ( params_spec ) then ac = ac_in b = b_in k = k_in call get_Zc_OMa_OMb ( del1 , zc , oma , omb ) Tc = OMb * ac / ( OMa * R * b ) RTc = R * Tc Pc = OMb * RTc / b Vceos = Zc * RTc / Pc al = - 0.26992 be = 1.54226 ga = 0.37464 - k w = 0.5 * ( - be + sqrt ( be ** 2 - 4 * al * ga )) / al else if ( critical_spec ) then tc = tc_in pc = pc_in w = w_in RTc = R * Tc call get_Zc_OMa_OMb ( del1 , Zc , OMa , OMb ) ac = OMa * RTc ** 2 / Pc b = OMb * RTc / Pc Vceos = Zc * RTc / Pc ! k (or m) constant to calculate attractive parameter depending on temperature do i = 1 , nc if ( w ( i ) <= 0.491 ) then ! m from PR k ( i ) = 0.37464 + 1.54226 * w ( i ) - 0.26992 * w ( i ) ** 2 else ! PR78 k ( i ) = 0.379642 + 1.48503 * w ( i ) - 0.164423 * w ( i ) ** 2 + 0.016666 * w ( i ) ** 3 end if end do end if end subroutine subroutine PR76_factory ( moles_in , ac_in , b_in , tc_in , pc_in , w_in , k_in ) !! PengRobinson 76 factory !! !! Takes either the critical parameters or the fitted model parameters !! and gets ones in base of the others real ( pr ), intent ( in ) :: moles_in ( nc ) real ( pr ), optional , intent ( in ) :: ac_in ( nc ) real ( pr ), optional , intent ( in ) :: b_in ( nc ) real ( pr ), optional , intent ( in ) :: tc_in ( nc ) real ( pr ), optional , intent ( in ) :: pc_in ( nc ) real ( pr ), optional , intent ( in ) :: w_in ( nc ) real ( pr ), optional , intent ( in ) :: k_in ( nc ) integer :: i logical :: params_spec , critical_spec real ( pr ) :: zc ( nc ), oma ( nc ), omb ( nc ) real ( pr ) :: vceos ( nc ), al , be , ga ( nc ) real ( pr ) :: RTc ( nc ) ar_fun => ar_srkpr vinit => cubic_v0 del1 = 1 + sqrt ( 2.0_pr ) z = moles_in params_spec = ( present ( ac_in ) . and . present ( b_in ) . and . present ( k_in )) critical_spec = ( present ( tc_in ) . and . present ( pc_in ) . and . present ( w_in )) if ( params_spec ) then ac = ac_in b = b_in k = k_in call get_Zc_OMa_OMb ( del1 , zc , oma , omb ) Tc = OMb * ac / ( OMa * R * b ) RTc = R * Tc Pc = OMb * RTc / b Vceos = Zc * RTc / Pc al = - 0.26992 be = 1.54226 ga = 0.37464 - k w = 0.5 * ( - be + sqrt ( be ** 2 - 4 * al * ga )) / al else if ( critical_spec ) then tc = tc_in pc = pc_in w = w_in RTc = R * Tc call get_Zc_OMa_OMb ( del1 , Zc , OMa , OMb ) ac = OMa * RTc ** 2 / Pc b = OMb * RTc / Pc Vceos = Zc * RTc / Pc ! k (or m) constant to calculate attractive parameter depending on temperature do i = 1 , nc k ( i ) = 0.37464 + 1.54226 * w ( i ) - 0.26992 * w ( i ) ** 2 end do end if ! ac = 0.45723553_pr * R**2 * tc**2 / pc ! b = 0.07779607_pr * R * tc/pc ! k = 0.37464_pr + 1.54226_pr * w - 0.26993_pr * w**2 end subroutine subroutine SRK_factory ( moles_in , ac_in , b_in , tc_in , pc_in , w_in , k_in ) !! SoaveRedlichKwong factory !! !! Takes either the critical parameters or the fitted model parameters !! and gets ones in base of the others real ( pr ), intent ( in ) :: moles_in ( nc ) real ( pr ), optional , intent ( in ) :: ac_in ( nc ) real ( pr ), optional , intent ( in ) :: b_in ( nc ) real ( pr ), optional , intent ( in ) :: tc_in ( nc ) real ( pr ), optional , intent ( in ) :: pc_in ( nc ) real ( pr ), optional , intent ( in ) :: w_in ( nc ) real ( pr ), optional , intent ( in ) :: k_in ( nc ) logical :: params_spec , critical_spec real ( pr ) :: zc ( nc ), oma ( nc ), omb ( nc ) real ( pr ) :: vceos ( nc ), al , be , ga ( nc ) real ( pr ) :: RTc ( nc ) integer :: i , j ar_fun => ar_srkpr vinit => cubic_v0 del1 = 1 z = moles_in params_spec = ( present ( ac_in ) . and . present ( b_in ) . and . present ( k_in )) critical_spec = ( present ( tc_in ) . and . present ( pc_in ) . and . present ( w_in )) if ( params_spec ) then ac = ac_in b = b_in k = k_in call get_Zc_OMa_OMb ( del1 , zc , oma , omb ) Tc = OMb * ac / ( OMa * R * b ) RTc = R * Tc Pc = OMb * RTc / b Vceos = Zc * RTc / Pc dc = 1 / vceos al = - 0.26992 be = 1.54226 ga = 0.37464 - k w = 0.5 * ( - be + sqrt ( be ** 2 - 4 * al * ga )) / al else if ( critical_spec ) then tc = tc_in pc = pc_in w = w_in RTc = R * Tc call get_Zc_OMa_OMb ( del1 , Zc , OMa , OMb ) ac = OMa * RTc ** 2 / Pc b = OMb * RTc / Pc Vceos = Zc * RTc / Pc k = 0.48 + 1.574 * w - 0.175 * w ** 2 end if end subroutine subroutine get_Zc_OMa_OMb ( del1 , Zc , OMa , OMb ) !! Calculate Zc, OMa and OMb from the delta_1 parameter. real ( pr ), intent ( in ) :: del1 (:) !! delta_1 parameter real ( pr ), intent ( out ) :: Zc (:) !! Critical compressibility factor real ( pr ), intent ( out ) :: OMa (:) !! OMa real ( pr ), intent ( out ) :: OMb (:) !! OMb real ( pr ) :: d1 ( size ( del1 )), y ( size ( del1 )) d1 = ( 1._pr + del1 ** 2._pr ) / ( 1._pr + del1 ) y = 1._pr + ( 2._pr * ( 1._pr + del1 )) ** ( 1.0_pr / 3._pr ) + ( 4._pr / ( 1._pr + del1 )) ** ( 1.0_pr / 3 ) OMa = ( 3._pr * y * y + 3._pr * y * d1 + d1 ** 2._pr + d1 - 1.0_pr ) / ( 3._pr * y + d1 - 1.0_pr ) ** 2._pr OMb = 1._pr / ( 3._pr * y + d1 - 1.0_pr ) Zc = y / ( 3._pr * y + d1 - 1.0_pr ) end subroutine get_Zc_OMa_OMb ! ========================================================================== ! ========================================================================== ! Ar Functions ! -------------------------------------------------------------------------- subroutine ar_srkpr ( z , V , T , Ar , ArV , ArTV , ArV2 , Arn , ArVn , ArTn , Arn2 ) !! Wrapper subroutine to the SRK/PR Residula Helmholtz function to !! use the general interface real ( pr ), intent ( in ) :: z (:) !! Number of moles real ( pr ), intent ( in ) :: v !! Volume [L] real ( pr ), intent ( in ) :: t !! Temperature [K] real ( pr ), intent ( out ) :: ar !! Residual Helmholtz real ( pr ), intent ( out ) :: arv !! dAr/dV real ( pr ), intent ( out ) :: artv !! dAr2/dTV real ( pr ), intent ( out ) :: arv2 !! dAr2/dV2 real ( pr ), intent ( out ) :: Arn ( size ( z )) !! dAr/dn real ( pr ), intent ( out ) :: ArVn ( size ( z )) !! dAr2/dVn real ( pr ), intent ( out ) :: ArTn ( size ( z )) !! dAr2/dTn real ( pr ), intent ( out ) :: Arn2 ( size ( z ), size ( z )) !! dAr2/dn2 integer :: nd !! Compositional derivatives integer :: nt !! Temperature derivatives nd = 2 nt = 1 call HelmSRKPR ( size ( z ), nd , nt , z , V , T , Ar , ArV , ArTV , ArV2 , Arn , ArVn , ArTn , Arn2 ) end subroutine subroutine ar_rkpr ( z , V , T , Ar , ArV , ArTV , ArV2 , Arn , ArVn , ArTn , Arn2 ) real ( pr ), intent ( in ) :: z (:) !! Number of moles real ( pr ), intent ( in ) :: v !! Volume [L] real ( pr ), intent ( in ) :: t !! Temperature [K] real ( pr ), intent ( out ) :: ar !! Residual Helmholtz real ( pr ), intent ( out ) :: arv !! dAr/dV real ( pr ), intent ( out ) :: artv !! dAr2/dTV real ( pr ), intent ( out ) :: arv2 !! dAr2/dV2 real ( pr ), intent ( out ) :: Arn ( size ( z )) !! dAr/dn real ( pr ), intent ( out ) :: ArVn ( size ( z )) !! dAr2/dVn real ( pr ), intent ( out ) :: ArTn ( size ( z )) !! dAr2/dTn real ( pr ), intent ( out ) :: Arn2 ( size ( z ), size ( z )) !! dAr2/dn2 integer :: nd !! Compositional derivatives integer :: nt !! Temperature derivatives nd = 2 nt = 1 call HelmRKPR ( size ( z ), nd , nt , z , V , T , Ar , ArV , ArTV , ArV2 , Arn , ArVn , ArTn , Arn2 ) end subroutine subroutine HelmSRKPR ( nc , ND , NT , rn , V , T , Ar , ArV , ArTV , ArV2 , Arn , ArVn , ArTn , Arn2 ) integer , intent ( in ) :: nc !! Number of components integer , intent ( in ) :: nd !! Compositional derivatives integer , intent ( in ) :: nt !! Temperature derivatives real ( pr ), intent ( in ) :: v !! Volume [L] real ( pr ), intent ( in ) :: t !! Temperature [K] real ( pr ), intent ( in ) :: rn ( nc ) !! Number of moles real ( pr ), intent ( out ) :: ar !! Residual Helmholtz real ( pr ), intent ( out ) :: arv !! dAr/dV real ( pr ), intent ( out ) :: artv !! dAr2/dTV real ( pr ), intent ( out ) :: arv2 !! dAr2/dV2 real ( pr ), intent ( out ) :: Arn ( nc ) !! dAr/dn real ( pr ), intent ( out ) :: ArVn ( nc ) !! dAr2/dVn real ( pr ), intent ( out ) :: ArTn ( nc ) !! dAr2/dTn real ( pr ), intent ( out ) :: Arn2 ( nc , nc ) !! dAr2/dn2 real ( pr ) :: ArT , ArTT real ( pr ) :: Bmix , dBi ( nc ), dBij ( nc , nc ) real ( pr ) :: D , dDi ( nc ), dDij ( nc , nc ), dDiT ( nc ), dDdT , dDdT2 real ( pr ) :: totn , d1 , d2 real ( pr ) :: f , g , fv , fB , gv , fv2 , gv2 , AUX , FFB , FFBV , FFBB integer :: i , j real ( pr ) :: b_v , a TOTN = sum ( rn ) D1 = del1 ( 1 ) D2 = ( 1._pr - D1 ) / ( 1._pr + D1 ) if ( mixing_rule . lt . 2 ) then call Bnder ( nc , rn , Bmix , dBi , dBij ) call DandTnder ( NT , nc , T , rn , D , dDi , dDiT , dDij , dDdT , dDdT2 ) end if ! The f's and g's used here are for Ar, not F (reduced Ar) ! This requires to multiply by R all g, f and its derivatives as defined by Mollerup f = log (( V + D1 * Bmix ) / ( V + D2 * Bmix )) / Bmix / ( D1 - D2 ) g = R * log ( 1 - Bmix / V ) fv = - 1 / (( V + D1 * Bmix ) * ( V + D2 * Bmix )) fB = - ( f + V * fv ) / Bmix gv = R * Bmix / ( V * ( V - Bmix )) fv2 = ( - 1 / ( V + D1 * Bmix ) ** 2 + 1 / ( V + D2 * Bmix ) ** 2 ) / Bmix / ( D1 - D2 ) gv2 = R * ( 1 / V ** 2 - 1 / ( V - Bmix ) ** 2 ) ! Reduced Helmholtz Energy and derivatives Ar = - TOTN * g * T - D * f ArV = - TOTN * gv * T - D * fv ArV2 = - TOTN * gv2 * T - D * fv2 AUX = R * T / ( V - Bmix ) FFB = TOTN * AUX - D * fB FFBV = - TOTN * AUX / ( V - Bmix ) + D * ( 2 * fv + V * fv2 ) / Bmix FFBB = TOTN * AUX / ( V - Bmix ) - D * ( 2 * f + 4 * V * fv + V ** 2 * fv2 ) / Bmix ** 2 do i = 1 , nc Arn ( i ) = - g * T + FFB * dBi ( i ) - f * dDi ( i ) ArVn ( i ) = - gv * T + FFBV * dBi ( i ) - fv * dDi ( i ) if ( ND . eq . 2 ) then do j = 1 , i Arn2 ( i , j ) = AUX * ( dBi ( i ) + dBi ( j )) - fB * ( dBi ( i ) * dDi ( j ) + dBi ( j ) * dDi ( i )) & + FFB * dBij ( i , j ) + FFBB * dBi ( i ) * dBi ( j ) - f * dDij ( i , j ) Arn2 ( j , i ) = Arn2 ( i , j ) end do end if end do ! TEMPERATURE DERIVATIVES if ( NT . eq . 1 ) then ArT = - TOTN * g - dDdT * f ArTV = - TOTN * gv - dDdT * fV ArTT = - dDdT2 * f do i = 1 , nc ArTn ( i ) = - g + ( TOTN * AUX / T - dDdT * fB ) * dBi ( i ) - f * dDiT ( i ) end do end if end subroutine HelmSRKPR subroutine HelmRKPR ( nco , NDE , NTD , rn , V , T , Ar , ArV , ArTV , ArV2 , Arn , ArVn , ArTn , Arn2 ) !! Calculate the reduced residual Helmholtz Energy and it's derivatives with the RKPR EOS integer , intent ( in ) :: nco integer , intent ( in ) :: NDE integer , intent ( in ) :: NTD real ( pr ), intent ( in ) :: rn ( nco ) real ( pr ), intent ( in ) :: V real ( pr ), intent ( in ) :: T real ( pr ), intent ( out ) :: Ar , ArV , ArTV , ArV2 real ( pr ), intent ( out ) :: Arn ( nco ), ArVn ( nco ), ArTn ( nco ), Arn2 ( nco , nco ) real ( pr ) :: totn real ( pr ) :: Bmix , dBi ( nco ), dBij ( nco , nco ), dD1i ( nco ), dD1ij ( nco , nco ) real ( pr ) :: D , dDi ( nco ), dDij ( nco , nco ), dDiT ( nco ), dDdT , dDdT2 real ( pr ) :: D1 , D2 ! Auxiliar functions for Ar real ( pr ) :: f , g , fv , fB , gv , fv2 , gv2 , AUX , FFB , FFBV , FFBB ! Extra auxiliar functions for RKPR real ( pr ) :: auxD2 , fD1 , fBD1 , fVD1 , fD1D1 real ( pr ) :: ArT , ArTT integer :: i , j nc = nco TOTN = sum ( rn ) call DELTAnder ( nc , rn , D1 , dD1i , dD1ij ) D2 = ( 1 - D1 ) / ( 1 + D1 ) if ( mixing_rule . lt . 2 ) then call Bnder ( nc , rn , Bmix , dBi , dBij ) call DandTnder ( NTD , nc , T , rn , D , dDi , dDiT , dDij , dDdT , dDdT2 ) else ! call Bcubicnder(nc,rn,Bmix,dBi,dBij) ! call DCubicandTnder(NTD,nc,T,rn,D,dDi,dDiT,dDij,dDdT,dDdT2) end if ! The f's and g's used here are for Ar, not F (reduced Ar) ! This requires to multiply by R all g, f and its derivatives as defined by Mollerup f = log (( V + D1 * Bmix ) / ( V + D2 * Bmix )) / Bmix / ( D1 - D2 ) g = R * log ( 1 - Bmix / V ) fv = - 1 / (( V + D1 * Bmix ) * ( V + D2 * Bmix )) fB = - ( f + V * fv ) / Bmix gv = R * Bmix / ( V * ( V - Bmix )) fv2 = ( - 1 / ( V + D1 * Bmix ) ** 2 + 1 / ( V + D2 * Bmix ) ** 2 ) / Bmix / ( D1 - D2 ) gv2 = R * ( 1 / V ** 2 - 1 / ( V - Bmix ) ** 2 ) ! DERIVATIVES OF f WITH RESPECT TO DELTA1 auxD2 = ( 1 + 2 / ( 1 + D1 ) ** 2 ) fD1 = ( 1 / ( V + D1 * Bmix ) + 2 / ( V + D2 * Bmix ) / ( 1 + D1 ) ** 2 ) - f * auxD2 fD1 = fD1 / ( D1 - D2 ) fBD1 = - ( fB * auxD2 + D1 / ( V + D1 * Bmix ) ** 2 + 2 * D2 / ( V + D2 * Bmix ) ** 2 / ( 1 + D1 ) ** 2 ) fBD1 = fBD1 / ( D1 - D2 ) fVD1 = - ( fV * auxD2 + 1 / ( V + D1 * Bmix ) ** 2 + 2 / ( V + D2 * Bmix ) ** 2 / ( 1 + D1 ) ** 2 ) / ( D1 - D2 ) fD1D1 = 4 * ( f - 1 / ( V + D2 * Bmix )) / ( 1 + D1 ) ** 3 + Bmix * ( - 1 / ( V + D1 * Bmix ) ** 2 & + 4 / ( V + D2 * Bmix ) ** 2 / ( 1 + D1 ) ** 4 ) - 2 * fD1 * ( 1 + 2 / ( 1 + D1 ) ** 2 ) fD1D1 = fD1D1 / ( D1 - D2 ) ! Reduced Helmholtz Energy and derivatives Ar = - TOTN * g * T - D * f ArV = - TOTN * gv * T - D * fv ArV2 = - TOTN * gv2 * T - D * fv2 AUX = R * T / ( V - Bmix ) FFB = TOTN * AUX - D * fB FFBV = - TOTN * AUX / ( V - Bmix ) + D * ( 2 * fv + V * fv2 ) / Bmix FFBB = TOTN * AUX / ( V - Bmix ) - D * ( 2 * f + 4 * V * fv + V ** 2 * fv2 ) / Bmix ** 2 do i = 1 , nc Arn ( i ) = - g * T + FFB * dBi ( i ) - f * dDi ( i ) - D * fD1 * dD1i ( i ) ArVn ( i ) = - gv * T + FFBV * dBi ( i ) - fv * dDi ( i ) - D * fVD1 * dD1i ( i ) if ( NDE . eq . 2 ) then do j = 1 , i Arn2 ( i , j ) = AUX * ( dBi ( i ) + dBi ( j )) - fB * ( dBi ( i ) * dDi ( j ) + dBi ( j ) * dDi ( i )) & + FFB * dBij ( i , j ) + FFBB * dBi ( i ) * dBi ( j ) - f * dDij ( i , j ) Arn2 ( i , j ) = Arn2 ( i , j ) - D * fBD1 * ( dBi ( i ) * dD1i ( j ) + dBi ( j ) * dD1i ( i )) & - fD1 * ( dDi ( i ) * dD1i ( j ) + dDi ( j ) * dD1i ( i )) & - D * fD1 * dD1ij ( i , j ) - D * fD1D1 * dD1i ( i ) * dD1i ( j ) Arn2 ( j , i ) = Arn2 ( i , j ) end do end if end do ! TEMPERATURE DERIVATIVES if ( NTD . eq . 1 ) then ArT = - TOTN * g - dDdT * f ArTV = - TOTN * gv - dDdT * fV ArTT = - dDdT2 * f do i = 1 , nc ArTn ( i ) = - g + ( TOTN * AUX / T - dDdT * fB ) * dBi ( i ) - f * dDiT ( i ) - dDdT * fD1 * dD1i ( i ) end do end if end subroutine HelmRKPR subroutine ArVnder ( nc , NDER , NTEMP , z , V , T , Ar , ArV , ArTV , ArV2 , Arn , ArVn , ArTn , Arn2 ) integer , intent ( in ) :: nc integer , intent ( in ) :: nder ! Get compositional derivatives integer , intent ( in ) :: ntemp ! Get temperature derivatives real ( pr ), intent ( in ) :: z ( nc ) real ( pr ), intent ( in ) :: V real ( pr ), intent ( in ) :: T real ( pr ), intent ( out ) :: ar , arv , artv , arv2 real ( pr ), dimension ( size ( z )), intent ( out ) :: Arn , ArVn , ArTn real ( pr ), intent ( out ) :: Arn2 ( size ( z ), size ( z )) vinit => cubic_v0 call ar_fun ( z , v , t , Ar , ArV , ArTV , ArV2 , Arn , ArVn , ArTn , Arn2 ) end subroutine ArVnder ! ========================================================================== ! ========================================================================== ! Attractive parameter routines ! -------------------------------------------------------------------------- subroutine aTder ( ac , Tc , k , T , a , dadT , dadT2 ) ! Given ac,Tc and the k parameter of the RKPR correlation, as well as the actual T, ! this subroutine calculates a(T) and its first and second derivatives with T. real ( pr ), intent ( in ) :: ac real ( pr ), intent ( in ) :: Tc real ( pr ), intent ( in ) :: k real ( pr ), intent ( in ) :: T real ( pr ), intent ( out ) :: a real ( pr ), intent ( out ) :: dadT real ( pr ), intent ( out ) :: dadT2 real ( pr ) :: Tr Tr = T / Tc if ( thermo_model . le . 3 ) then a = ac * ( 1 + k * ( 1 - sqrt ( Tr ))) ** 2 dadT = ac * k * ( k - ( k + 1 ) / sqrt ( Tr )) / Tc dadT2 = ac * k * ( k + 1 ) / ( 2 * Tc ** 2 * Tr ** 1.5D0 ) else if ( thermo_model == 4 ) then a = ac * ( 3 / ( 2 + Tr )) ** k dadT = - k * a / Tc / ( 2 + Tr ) dadT2 = - ( k + 1 ) * dadT / Tc / ( 2 + Tr ) end if end subroutine aTder subroutine aijTder ( NTD , nc , T , aij , daijdT , daijdT2 ) integer , intent ( in ) :: ntd integer , intent ( in ) :: nc real ( pr ), intent ( in ) :: T real ( pr ), intent ( out ) :: aij ( nc , nc ), daijdT ( nc , nc ), daijdT2 ( nc , nc ) real ( pr ) :: ai ( nc ), daidT ( nc ), daidT2 ( nc ) real ( pr ) :: aux ( nc , nc ), ratK ( nc , nc ) integer :: i , j if ( tdep . ge . 1 ) then Kij = 0.0D0 do i = 1 , nc Kij (: i - 1 , i ) = Kinf (: i - 1 , i ) + Kij0 (: i - 1 , i ) * exp ( - T / Tstar (: i - 1 , i )) end do end if do i = 1 , nc call aTder ( ac ( i ), Tc ( i ), k ( i ), T , ai ( i ), daidT ( i ), daidT2 ( i )) aij ( i , i ) = ai ( i ) daijdT ( i , i ) = daidT ( i ) daijdT2 ( i , i ) = daidT2 ( i ) if ( i . gt . 1 ) then do j = 1 , i - 1 aij ( j , i ) = sqrt ( ai ( i ) * ai ( j )) * ( 1 - Kij ( j , i )) aij ( i , j ) = aij ( j , i ) if ( NTD . eq . 1 ) then daijdT ( j , i ) = ( 1 - Kij ( j , i )) * ( sqrt ( ai ( i ) / ai ( j )) * daidT ( j ) & + sqrt ( ai ( j ) / ai ( i )) * daidT ( i )) / 2 daijdT2 ( j , i ) = ( 1 - Kij ( j , i )) * ( daidT ( j ) * daidT ( i ) / sqrt ( ai ( i ) * ai ( j )) & + sqrt ( ai ( i ) / ai ( j )) * ( daidT2 ( j ) - daidT ( j ) ** 2 / ( 2 * ai ( j ))) & + sqrt ( ai ( j ) / ai ( i )) * ( daidT2 ( i ) - daidT ( i ) ** 2 / ( 2 * ai ( i )))) / 2 daijdT ( i , j ) = daijdT ( j , i ) daijdT2 ( i , j ) = daijdT2 ( j , i ) end if end do end if end do end subroutine aijTder subroutine DandTnder ( NTD , nc , T , rn , D , dDi , dDiT , dDij , dDdT , dDdT2 ) integer , intent ( in ) :: ntd integer , intent ( in ) :: nc real ( pr ), intent ( in ) :: T real ( pr ), intent ( in ) :: rn ( nc ) real ( pr ), intent ( out ) :: D real ( pr ), intent ( out ) :: dDiT ( nc ) real ( pr ), intent ( out ) :: dDdT real ( pr ), intent ( out ) :: dDdT2 real ( pr ), intent ( out ) :: dDi ( nc ) real ( pr ), intent ( out ) :: dDij ( nc , nc ) real ( pr ) :: aij ( nc , nc ), daijdT ( nc , nc ), daijdT2 ( nc , nc ) real ( pr ) :: aux , aux2 integer :: i , j call aijTder ( NTD , nc , T , aij , daijdT , daijdT2 ) D = 0 dDdT = 0 dDdT2 = 0 do i = 1 , nc aux = 0 aux2 = 0 dDi ( i ) = 0 dDiT ( i ) = 0 do j = 1 , nc dDi ( i ) = dDi ( i ) + 2 * rn ( j ) * aij ( i , j ) if ( NTD . eq . 1 ) then dDiT ( i ) = dDiT ( i ) + 2 * rn ( j ) * daijdT ( i , j ) aux2 = aux2 + rn ( j ) * daijdT2 ( i , j ) end if dDij ( i , j ) = 2 * aij ( i , j ) aux = aux + rn ( j ) * aij ( i , j ) end do D = D + rn ( i ) * aux if ( NTD . eq . 1 ) then dDdT = dDdT + rn ( i ) * dDiT ( i ) / 2 dDdT2 = dDdT2 + rn ( i ) * aux2 end if end do end subroutine DandTnder ! ========================================================================== subroutine DELTAnder ( nc , rn , D1m , dD1i , dD1ij ) integer , intent ( in ) :: nc real ( pr ), intent ( in ) :: rn ( nc ) real ( pr ), intent ( out ) :: D1m , dD1i ( nc ), dD1ij ( nc , nc ) real ( pr ) :: totn integer :: i , j D1m = 0.0_pr do i = 1 , nc D1m = D1m + rn ( i ) * del1 ( i ) end do TOTN = sum ( rn ) D1m = D1m / totn do i = 1 , nc dD1i ( i ) = ( del1 ( i ) - D1m ) / totn do j = 1 , nc dD1ij ( i , j ) = ( 2.0_pr * D1m - del1 ( i ) - del1 ( j )) / totn ** 2 end do end do end subroutine DELTAnder ! ========================================================================== ! Repulsive parameter routines ! -------------------------------------------------------------------------- subroutine Bnder ( nc , rn , Bmix , dBi , dBij ) integer , intent ( in ) :: nc real ( pr ), intent ( in ) :: rn ( nc ) real ( pr ), intent ( out ) :: Bmix , dBi ( nc ), dBij ( nc , nc ) real ( pr ) :: totn , aux ( nc ) integer :: i , j TOTN = sum ( rn ) Bmix = 0.0_pr aux = 0.0_pr do i = 1 , nc do j = 1 , nc bij ( i , j ) = ( b ( i ) + b ( j )) * 0.5_pr * ( 1.0_pr - lij ( i , j )) aux ( i ) = aux ( i ) + rn ( j ) * bij ( i , j ) end do Bmix = Bmix + rn ( i ) * aux ( i ) end do Bmix = Bmix / totn do i = 1 , nc dBi ( i ) = ( 2 * aux ( i ) - Bmix ) / totn do j = 1 , i dBij ( i , j ) = ( 2 * bij ( i , j ) - dBi ( i ) - dBi ( j )) / totn dBij ( j , i ) = dBij ( i , j ) end do end do end subroutine Bnder ! ========================================================================== ! ========================================================================== ! Properties ! -------------------------------------------------------------------------- function cubic_v0 ( z , p , t ) real ( pr ) :: z (:) real ( pr ) :: p real ( pr ) :: t real ( pr ) :: cubic_v0 real ( pr ) :: dbi ( nc ), dbij ( nc , nc ) call bnder ( nc , z , cubic_v0 , dBi , dBij ) end function end module module legacy_thermo_properties use yaeos__constants , only : R , pr use legacy_ar_models , only : ArVnder , vinit implicit none contains subroutine TERMO ( nc , MTYP , INDIC , T , P , rn , V , PHILOG , DLPHIP , DLPHIT , FUGN ) ! MTYP TYPE OF ROOT DESIRED (-1 vapor, 1 liquid, 0 lower Gibbs energy phase) ! rn mixture mole numbers (input) ! t temperature (k) (input)x, y ! p pressure (bar) (input) ! v volume (L) (output) ! PHILOG vector of ln(phi(i)*P) (output) INDIC < 5 ! DLPHIT t-derivative of ln(phi(i)) (const P, n) (output) INDIC = 2 or 4 ! DLPHIP P-derivative of ln(phi(i)) (const T, n) (output) INDIC < 5 ! FUGN comp-derivative of ln(phi(i)) (const t & P)(output) INDIC > 2 ! ------------------------------------------------------------------------- integer , intent ( in ) :: nc !! Number of components integer , intent ( in ) :: indic !! Desired element, this should be setted with optionals integer , intent ( in ) :: mtyp !! Type of root desired (-1 vapor, 1 liquid, 0 lower Gr) real ( pr ), intent ( in ) :: t !! Temperature [K] real ( pr ), intent ( in ) :: p !! Pressure [bar] real ( pr ), intent ( in ) :: rn ( nc ) !! Mixture mole numbers real ( pr ), intent ( out ) :: v !! Volume [L] real ( pr ), intent ( out ) :: PHILOG ( nc ) !! ln(phi*p) vector real ( pr ), optional , intent ( out ) :: DLPHIT ( nc ) !! ln(phi) Temp derivative real ( pr ), optional , intent ( out ) :: DLPHIP ( nc ) !! ln(phi) Presssure derivative real ( pr ), optional , intent ( out ) :: FUGN ( nc , nc ) !! ln(phi) compositional derivative real ( pr ) :: ar , arv , artv , arv2 real ( pr ) :: RT , Z , dpv , dpdt real ( pr ) :: Arn ( nc ) real ( pr ) :: ArVn ( nc ) real ( pr ) :: ArTn ( nc ) real ( pr ) :: Arn2 ( nc , nc ) real ( pr ) :: DPDN ( nc ) real ( pr ) :: totn integer :: ntemp , igz , nder , i , k ! The output PHILOG is actually the vector ln(phi(i)*P) NTEMP = 0 IGZ = 0 NDER = 1 if ( INDIC . gt . 2 ) NDER = 2 if ( INDIC . eq . 2 . or . INDIC . eq . 4 ) NTEMP = 1 TOTN = sum ( rn ) ! if (P .le. 0.0d0) MTYP = 1 call VCALC ( MTYP , NC , NTEMP , rn , T , P , V ) RT = R * T Z = V / ( TOTN * RT ) ! this is Z/P call ArVnder ( nc , NDER , NTEMP , rn , V , T , Ar , ArV , ArTV , ArV2 , Arn , ArVn , ArTn , Arn2 ) DPV = - ArV2 - RT * TOTN / V ** 2 DPDT = - ArTV + TOTN * R / V do I = 1 , NC PHILOG ( I ) = - log ( Z ) + Arn ( I ) / RT DPDN ( I ) = RT / V - ArVn ( I ) if ( present ( dlphip )) DLPHIP ( I ) = - DPDN ( I ) / DPV / RT - 1.D0 / P if ( NTEMP . ne . 0 ) then if ( present ( dlphit )) then DLPHIT ( I ) = ( ArTn ( I ) - Arn ( I ) / T ) / RT + DPDN ( I ) * DPDT / DPV / RT + 1.D0 / T end if end if end do if ( present ( fugn )) then do I = 1 , NC do K = I , NC FUGN ( I , K ) = 1.D0 / TOTN + ( Arn2 ( I , K ) + DPDN ( I ) * DPDN ( K ) / DPV ) / RT FUGN ( K , I ) = FUGN ( I , K ) end do end do end if end subroutine TERMO subroutine zTVTERMO ( nc , INDIC , T , rn , V , P , DPV , PHILOG , DLPHIP , DLPHIT , FUGN ) !! Calculation of lnphi*P and derivatives !! rn mixture mole numbers (input) !! t temperature (k) (input) !! v volume (L) (input) !! p pressure (bar) (output) !! PHILOG vector of ln(phi(i)*P) (output) 0 < INDIC < 5 !! DLPHIT t-derivative of ln(phi(i)) (const P, n) (output) 0 < INDIC = 2 or 4 !! DLPHIP P-derivative of ln(phi(i)) (const T, n) (output) 0 < INDIC < 5 !! FUGN comp-derivative of ln(phi(i)) (const t & P)(output) 2 < INDIC !! ------------------------------------------------------------------------- implicit none integer , intent ( in ) :: nc , indic real ( pr ), intent ( in ) :: t , rn ( nc ), v real ( pr ), intent ( out ) :: p , dpv real ( pr ), intent ( out ) :: PHILOG ( nc ), DLPHIT ( nc ), DLPHIP ( nc ) real ( pr ), intent ( out ) :: FUGN ( nc , nc ) real ( pr ) :: Arn ( nc ), ArVn ( nc ), ArTn ( nc ), Arn2 ( nc , nc ), DPDN ( nc ), totn real ( pr ) :: ar , arv , artv , arv2 , RT , Z , dpdt integer :: ntemp , igz , nder , i , k NTEMP = 0 IGZ = 0 NDER = 1 if ( INDIC . gt . 2 ) NDER = 2 if ( INDIC . eq . 2 . or . INDIC . eq . 4 ) NTEMP = 1 TOTN = sum ( rn ) RT = R * T Z = V / ( TOTN * RT ) ! this is Z/P call ArVnder ( nc , NDER , NTEMP , rn , V , T , Ar , ArV , ArTV , ArV2 , Arn , ArVn , ArTn , Arn2 ) P = TOTN * RT / V - ArV DPV = - ArV2 - RT * TOTN / V ** 2 DPDT = - ArTV + TOTN * R / V if ( INDIC > 0 ) then do I = 1 , NC PHILOG ( I ) = - log ( Z ) + Arn ( I ) / RT DPDN ( I ) = RT / V - ArVn ( I ) DLPHIP ( I ) = - DPDN ( I ) / DPV / RT - 1.D0 / P if ( NTEMP . ne . 0 ) then DLPHIT ( I ) = ( ArTn ( I ) - Arn ( I ) / T ) / RT + DPDN ( I ) * DPDT / DPV / RT + 1.D0 / T end if end do end if if ( NDER . ge . 2 ) then do I = 1 , NC do K = I , NC FUGN ( I , K ) = 1.D0 / TOTN + ( Arn2 ( I , K ) + DPDN ( I ) * DPDN ( K ) / DPV ) / RT FUGN ( K , I ) = FUGN ( I , K ) end do end do end if end subroutine zTVTERMO subroutine PUREFUG_CALC ( nc , icomp , T , P , V , phi ) !! Fugacity of a pure component integer , intent ( in ) :: nc integer , intent ( in ) :: icomp real ( pr ), intent ( in ) :: T , P , V real ( pr ), intent ( out ) :: phi real ( pr ) :: rn ( nc ), Ar , Arv , ArTV , ArV2 , Arn ( nc ), ArVn ( nc ), ArTn ( nc ), Arn2 ( nc , nc ) real ( pr ) :: RT , Z , philog rn = 0.0 rn ( icomp ) = 1.0 RT = R * T Z = P * V / RT call ArVnder ( nc , 0 , 0 , rn , V , T , Ar , ArV , ArTV , ArV2 , Arn , ArVn , ArTn , Arn2 ) PHILOG = - log ( Z ) + Arn ( icomp ) / RT phi = exp ( PHILOG ) end subroutine purefug_calc recursive subroutine VCALC ( ITYP , nc , NTEMP , rn , T , P , V ) !! ROUTINE FOR CALCULATION OF VOLUME, GIVEN PRESSURE integer , intent ( in ) :: ITYP !! TYPE OF ROOT DESIRED (-1 vapor, 1 liquid, 0 lower Gibbs energy phase) integer , intent ( in ) :: nc !! NO. OF COMPONENTS integer , intent ( in ) :: ntemp !! 1 if T-derivatives are required real ( pr ), intent ( in ) :: rn ( nc ) !! FEED MOELS real ( pr ), intent ( in ) :: T !! TEMPERATURE real ( pr ), intent ( in ) :: P !! PRESURE real ( pr ), intent ( out ) :: V !! VOLUME real ( pr ) :: Ar , ArV , ArTV , ArV2 , Arn ( nc ), ArVn ( nc ), ArTn ( nc ), Arn2 ( nc , nc ) logical :: FIRST_RUN integer :: nder real ( pr ) :: totn real ( pr ) :: B , CPV , S3R real ( pr ) :: ZETMIN , ZETA , ZETMAX real ( pr ) :: del , pcalc , der , AT , AVAP , VVAP integer :: iter NDER = 0 FIRST_RUN = . true . TOTN = sum ( rn ) CPV = vinit ( rn , p , t ) B = CPV S3R = 1.D0 / CPV ITER = 0 ZETMIN = 0.D0 !ZETMAX = 1.D0-0.01*T/5000 !.99D0 This is flexible for low T (V very close to B) ZETMAX = 1.D0 - 0.01 * T / ( 10000 * B ) ! improvement for cases with heavy components if ( ITYP . gt . 0 ) then ZETA = . 5 D0 else ! IDEAL GAS ESTIMATE ZETA = min (. 5 D0 , CPV * P / ( TOTN * R * T )) end if 100 continue DEL = 1 pcalc = 2 * p do while ( abs ( DEL ) > 1 d - 10 . and . iter < 100 ) V = CPV / ZETA ITER = ITER + 1 call ArVnder (& nc , NDER , NTEMP , rn , V , T , Ar , ArV , ArTV , ArV2 , Arn , ArVn , ArTn , Arn2 & ) PCALC = TOTN * R * T / V - ArV if ( PCALC . gt . P ) then ZETMAX = ZETA else ZETMIN = ZETA end if AT = ( Ar + V * P ) / ( T * R ) - TOTN * log ( V ) ! AT is something close to Gr(P,T) DER = ( ArV2 * V ** 2 + TOTN * R * T ) * S3R ! this is dPdrho/B DEL = - ( PCALC - P ) / DER ZETA = ZETA + max ( min ( DEL , 0.1D0 ), - . 1 D0 ) if ( ZETA . gt . ZETMAX . or . ZETA . lt . ZETMIN ) & ZETA = . 5 D0 * ( ZETMAX + ZETMIN ) end do if ( ITYP . eq . 0 ) then ! FIRST RUN WAS VAPOUR; RERUN FOR LIQUID if ( FIRST_RUN ) then VVAP = V AVAP = AT FIRST_RUN = . false . ZETA = 0.5D0 ZETMAX = 1.D0 - 0.01 * T / 500 goto 100 else if ( AT . gt . AVAP ) V = VVAP end if end if end subroutine vcalc ! ========================================================================== end module","tags":"","loc":"sourcefile/legacy.f90.html"},{"title":"huron_vidal.f90 – yaeos","text":"Source Code module yaeos__models_cubic_mixing_rules_huron_vidal !! # Huron-Vidal (like) mixing rules module !! This module contains the mixing rules that are based/similar to the !! mixing rules defined by Huron-Vidal !! !! # Description !! Huron-Vidal presented a way to link a G^E model with a Cubic EoS !! mixing rule. This makes it possible to make good predictions on !! polar compounds containing mixtures. !! !! # Examples !! !! ```fortran !! A basic code example !! ``` !! !! # References !! use yaeos__constants , only : pr , R use yaeos__models_ar_genericcubic , only : CubicMixRule use yaeos__models_ar_cubic_mixing_base , only : bmix_qmr use yaeos__models_ge , only : GeModel implicit none private public :: MHV public :: DmixMHV type , extends ( CubicMixRule ) :: MHV !! # Michelsen's modified Huron-Vidal mixing rule !! Mixing rule at zero-pressure which allows for the inclusion of an !! excess-gibbs model. !! !! # Description !! This mixing rule is based on the aproximate zero-pressure limit !! of a cubic equation of state. At the aproximate zero-pressure limit the !! attractive parameter can be expressed as: !! !! !! \\frac{D}{RTB}(n, T) = \\sum_i n_i \\frac{a_i(T)}{b_i} + \\frac{1}{q} !! \\left(\\frac{G^E(n, T)}{RT} + \\sum_i n_i \\ln \\frac{B}{nb_i} \\right) !! !! Where q is a weak function of temperature. In the case of `MHV` !! and simplicity it is considered that depends on the model used. !! !! # Examples !! To use the modified Huron-Vidal mixing rule it is necessary to define !! a `CubicEoS` and replace its original mixing rule with the one generated !! by the user. !! ```fortran !! type(MHV) :: mixrule !! type(NRTL) :: ge_model !! type(CubicEoS) :: model !! !! ! Define the Ge model to be used and the CubicEoS !! ge_model = NRTL(a, b, c) !! model = SoaveRedlichKwong(tc, pc, w) !! !! ! Use the initialization function to setup !! mixrule = MHV(ge=ge_model, q=-0.593_pr, bi=model%b) !! !! ! Replace the original mixrule on the previously defined model !! model%mixrule = mixrule !! !! ! Ready to do calculations !! call pressure(model, n, v, T) !! ``` !! !! # References !! real ( pr ), allocatable :: l (:, :) real ( pr ), private , allocatable :: bi (:) real ( pr ), private , allocatable :: B , dBi (:), dBij (:, :) class ( GeModel ), allocatable :: ge real ( pr ) :: q contains procedure :: Bmix => BmixMHV procedure :: D1Mix => D1MixMHV procedure :: Dmix => DmixMHV end type interface MHV module procedure :: init end interface contains type ( MHV ) function init ( ge , b , q , lij ) result ( mixrule ) class ( GeModel ), intent ( in ) :: Ge real ( pr ), intent ( in ) :: b (:) real ( pr ), intent ( in ) :: q real ( pr ), optional , intent ( in ) :: lij (:, :) integer :: i , nc nc = size ( b ) mixrule % q = q mixrule % bi = b mixrule % Ge = ge if ( present ( lij )) then mixrule % l = lij else mixrule % l = reshape ([( 0 , i = 1 , nc ** 2 )], [ nc , nc ]) end if end function subroutine BmixMHV ( self , n , bi , B , dBi , dBij ) !! # Repulsive parameter B mixing rule !! Quadratinc mixing rule for the repulsive parameter, using !! b_{ij} = \\frac{b_i + b_j}{2} (1 - l_{ij}) as a combining rule. !! !! # Description !! Michelsen's modified Huron-Vidal mixing rule assumes a linear mix of !! the repulsive parameter. !! !! B = \\sum_i n_i b_i !! !! In this implementation the most known crossed combining rule is used: !! nB = \\sum_i \\sum_j \\frac{b_i + b_j}{2} (1 - l_{ij}) !! to provide versatility to the used model. !! !! @warning !! This mixing rule is intended to use only with a linear combining !! rule, using l_{ij} could negatively affect the thermodynamic !! consistency of the model. !! @endwarning !! !! # Examples !! !! ```fortran !! A basic code example !! ``` !! !! # References !! use yaeos__models_ar_cubic_mixing_base , only : bmix_linear class ( MHV ), intent ( in ) :: self real ( pr ), intent ( in ) :: n (:) real ( pr ), intent ( in ) :: bi (:) real ( pr ), intent ( out ) :: B , dBi (:), dBij (:, :) call bmix_qmr ( n , bi , self % l , b , dbi , dbij ) ! call bmix_linear(n, bi, b, dbi, dbij) end subroutine subroutine DmixMHV ( self , n , T , & ai , daidt , daidt2 , & D , dDdT , dDdT2 , dDi , dDidT , dDij & ) !! # Michelsen Modified Huron-Vidal mixing rule. !! Mixing rule at infinite pressure as defined in the book of Michelsen and !! Møllerup. !! !! # Description !! At the infinite pressure limit of a cubic equation of state it is possible to !! relate teh mixing rule for the attractive term with a excess Gibbs energy !! model like NRTL with the expression: !! !! !! \\frac{D}{RTB}(n, T) = \\sum_i n_i \\frac{a_i(T)}{b_i} + \\frac{1}{q} !! \\left(\\frac{G^E(n, T)}{RT} + \\sum_i n_i \\ln \\frac{B}{nb_i} \\right) !! !! !! # Examples !! !! ```fortran !! type(CubicEoS) !! ``` !! !! # References !! class ( MHV ), intent ( in ) :: self real ( pr ), intent ( in ) :: T , n (:) real ( pr ), intent ( in ) :: ai (:), daidt (:), daidt2 (:) real ( pr ), intent ( out ) :: D , dDdT , dDdT2 , dDi (:), dDidT (:), dDij (:, :) real ( pr ) :: f , fdt , fdt2 , fdi ( size ( n )), fdit ( size ( n )), fdij ( size ( n ), size ( n )) real ( pr ) :: b , bi ( size ( n )), dbi ( size ( n )), dbij ( size ( n ), size ( n )) real ( pr ) :: Ge , GeT , GeT2 , Gen ( size ( n )), GeTn ( size ( n )), Gen2 ( size ( n ), size ( n )) real ( pr ) :: totn !! Total number of moles real ( pr ) :: dot_n_logB_nbi real ( pr ) :: logB_nbi ( size ( n )) !! \\ln \\frac{B}{n b_i} real ( pr ) :: dlogBi_nbi ( size ( n )) real ( pr ) :: d2logBi_nbi ( size ( n ), size ( n )) integer :: i , j , l , nc real ( pr ) :: q nc = size ( n ) totn = sum ( n ) q = self % q bi = self % bi call self % ge % excess_gibbs ( & n , T , Ge = Ge , GeT = GeT , GeT2 = GeT2 , Gen = Gen , GeTn = GeTn , Gen2 = Gen2 & ) call self % Bmix ( n , bi , B , dBi , dBij ) logb_nbi = log ( B / ( totn * bi )) dot_n_logB_nbi = dot_product ( n , logB_nbi ) do i = 1 , nc dlogBi_nbi ( i ) = logB_nbi ( i ) + sum ( n * dBi ( i )) / B - 1 end do do i = 1 , nc do j = 1 , nc !TODO: Need to figure out this derivative d2logBi_nbi ( i , j ) = dlogBi_nbi ( j ) & + ( sum ( n * dBij ( i , j )) + dBi ( i )) / B & - totn * dBi ( i ) * dBi ( j ) / B ** 2 end do end do autodiff : block !! Autodiff injection until we can decipher this derivative use hyperdual_mod type ( hyperdual ) :: hB type ( hyperdual ) :: hdot_ln_B_nbi type ( hyperdual ) :: hn ( nc ) integer :: ii , jj hn = n do i = 1 , nc do j = i , nc hn = n hn ( i )% f1 = 1 hn ( j )% f2 = 1 hB = 0._pr do ii = 1 , nc do jj = 1 , nc hB = hB & + ( hn ( ii ) * hn ( jj )) & * 0.5_pr * ( bi ( ii ) + bi ( jj )) * ( 1._pr - self % l ( ii , jj )) end do end do hB = hB / sum ( hn ) hdot_ln_B_nbi = sum ( hn * log ( hB / ( sum ( hn ) * bi ))) d2logBi_nbi ( i , j ) = hdot_ln_B_nbi % f12 d2logBi_nbi ( j , i ) = hdot_ln_B_nbi % f12 end do end do end block autodiff f = sum ( n * ai / bi ) + ( Ge + R * T * dot_n_logB_nbi ) / q fdt = sum ( n * daidt / bi ) + ( GeT + R * dot_n_logB_nbi ) / q fdt2 = sum ( n * daidt2 / bi ) + ( GeT2 ) / q fdi = ai / bi + ( 1._pr / q ) * ( GeN + R * T * ( dlogBi_nbi )) fdit = daidt / bi + ( 1._pr / q ) * ( GeTn + R * ( dlogBi_nbi )) do i = 1 , nc do j = 1 , nc fdij ( i , j ) = R * T * ( d2logBi_nbi ( i , j )) fdij ( i , j ) = 1 / q * ( fdij ( i , j ) + GeN2 ( i , j )) fdij ( i , j ) = & dBi ( j ) * fdi ( i ) + B * fdij ( i , j ) + fdi ( j ) * dBi ( i ) + f * dBij ( i , j ) end do end do dDi = B * fdi + f * dBi dDidT = B * fdiT + fdT * dBi D = f * B dDdT = fdT * B dDdT2 = fdT2 * B dDij = fdij end subroutine subroutine D1MixMHV ( self , n , d1i , D1 , dD1i , dD1ij ) use yaeos__models_ar_cubic_mixing_base , only : d1mix_rkpr class ( MHV ), intent ( in ) :: self real ( pr ), intent ( in ) :: n (:) real ( pr ), intent ( in ) :: d1i (:) real ( pr ), intent ( out ) :: D1 real ( pr ), intent ( out ) :: dD1i (:) real ( pr ), intent ( out ) :: dD1ij (:, :) call d1mix_rkpr ( n , d1i , D1 , dD1i , dD1ij ) end subroutine D1MixMHV end module yaeos__models_cubic_mixing_rules_huron_vidal","tags":"","loc":"sourcefile/huron_vidal.f90.html"},{"title":"constants.f90 – yaeos","text":"Source Code module yaeos__constants !! Constants used on the whole package use iso_fortran_env , only : real32 , real64 , real128 implicit none integer , parameter :: pr = real64 !! Used precision real ( pr ), parameter :: R = 0.08314462618_pr !! Ideal Gas constant character ( len = 254 ) :: database_path = \"database\" !! Path to find database character ( len = 1 ) :: path_sep = \"/\" !! File separator (to preprocess on Win or Mac/linux) real ( pr ), parameter :: NOT_IMPLEMENTED = huge ( R ) end module","tags":"","loc":"sourcefile/constants.f90.html"},{"title":"volume.f90 – yaeos","text":"Source Code module yaeos__models_solvers !! # `models solvers` !! Set of different specialized solvers for different models !! !! # Description !! This module holds specialized solvers for different kind of applications !! and models. !! !! ## Volume solving !! This module holds the routine `volume_michelsen` which is a solver for !! volume that takes advantage over a simple newton on the function of !! pressure by solving the function of pressure over the covolume instead, !! which solution is limited in the range [0, 1]. This solver requires that !! the EoS uses the method `get_v0` to return the covolume. !! !! # Examples !! !! ```fortran !! A basic code example !! ``` !! !! # References !! use yaeos__constants , only : pr , R use yaeos__models_ar , only : ArModel implicit none contains subroutine volume_michelsen ( eos , n , P , T , V , root_type , max_iters , V0 ) !! Volume solver at a given pressure. !! !! Obtain the volume using the method described by Michelsen and Møllerup. !! While P(V, T) can be obtained with a simple Newton method, a better !! approach is solving P(B/V, T) where B is the EoS covolume. !! This method is easier to solve because: !! !! V(P, T) \\in [0, \\infty) !! !! and !! !! \\frac{B}{V}(P, T) \\in [0, 1] !! !! !! At chapter 3 page 94 of Michelsen and Møllerup's book a more complete !! explanation can be seen use iso_fortran_env , only : error_unit use stdlib_optval , only : optval class ( ArModel ), intent ( in ) :: eos real ( pr ), intent ( in ) :: n (:) !! Mixture moles real ( pr ), intent ( in ) :: T !! Temperature [K] real ( pr ), intent ( in ) :: P !! Pressure [bar] real ( pr ), intent ( out ) :: V !! Volume [L] character ( len =* ), optional , intent ( in ) :: root_type !! Type of root [\"vapor\" | \"liquid\" | \"stable\"] integer , optional , intent ( in ) :: max_iters !! Maxiumum number of iterations, defaults to 100 real ( pr ), optional , intent ( in ) :: V0 !! Specified initial volume character ( len = 10 ) :: root real ( pr ) :: Ar , ArV , ArV2 real ( pr ) :: totn real ( pr ) :: B !! Covolume real ( pr ) :: ZETMIN , ZETA , ZETMAX real ( pr ) :: pcalc , AT , AVAP , VVAP integer :: iter , maximum_iterations maximum_iterations = optval ( max_iters , 100 ) root = optval ( root_type , \"stable\" ) TOTN = sum ( n ) B = eos % get_v0 ( n , p , t ) ITER = 0 ! Limits ZETMIN = 0._pr ZETMAX = 1._pr if ( present ( V0 )) then zeta = B / V0 else select case ( root_type ) case ( \"liquid\" ) ZETA = 0.5_pr call solve_point ( P , V , Pcalc , AT , iter ) case ( \"vapor\" , \"stable\" ) ZETA = min ( 0.5_pr , B * P / ( TOTN * R * T )) call solve_point ( P , V , Pcalc , AT , iter ) if ( root_type == \"stable\" ) then ! Run first for vapor and then for liquid VVAP = V AVAP = AT ZETA = 0.5_pr ZETMAX = 1._pr call solve_point ( P , V , Pcalc , AT , iter ) if ( AT . gt . AVAP ) V = VVAP end if case default write ( error_unit , * ) \"ERROR [VCALC]: Wrong specification\" error stop 1 end select end if contains subroutine solve_point ( P , V , Pcalc , AT , iter ) real ( pr ), intent ( in ) :: P !! Objective pressure [bar] real ( pr ), intent ( out ) :: V !! Obtained volume [L] real ( pr ), intent ( out ) :: Pcalc !! Calculated pressure at V [bar] real ( pr ), intent ( out ) :: AT !! integer , intent ( out ) :: iter real ( pr ) :: del , der iter = 0 DEL = 1 pcalc = 2 * p do while ( abs ( DEL ) > 1.e-10_pr . and . iter < maximum_iterations ) V = B / ZETA iter = iter + 1 call eos % residual_helmholtz ( n , V , T , Ar = Ar , ArV = ArV , ArV2 = ArV2 ) Pcalc = TOTN * R * T / V - ArV if ( Pcalc . gt . P ) then ZETMAX = ZETA else ZETMIN = ZETA end if ! AT is something close to Gr(P,T) AT = ( Ar + V * P ) / ( T * R ) - TOTN * log ( V ) DER = ( ArV2 * V ** 2 + TOTN * R * T ) / B ! this is dPdrho/B DEL = - ( Pcalc - P ) / DER ZETA = ZETA + max ( min ( DEL , 0.1_pr ), - . 1_pr ) if ( ZETA . gt . ZETMAX . or . ZETA . lt . ZETMIN ) then ZETA = 0.5_pr * ( ZETMAX + ZETMIN ) end if end do if ( iter >= maximum_iterations ) write ( error_unit , * ) & \"WARN: Volume solver exceeded maximum number of iterations\" end subroutine solve_point end subroutine volume_michelsen end module","tags":"","loc":"sourcefile/volume.f90.html"},{"title":"flash.f90 – yaeos","text":"Source Code module yaeos__equilibria_flash use yaeos__constants , only : pr use yaeos__models , only : ArModel use yaeos__equilibria_equilibrium_state , only : EquilibriumState use yaeos__equilibria_rachford_rice , only : betato01 , betalimits , rachford_rice , solve_rr use yaeos__equilibria_auxiliar , only : k_wilson use yaeos__solvers_pressure_equality , only : pressure_equality_V_beta_xy implicit none contains type ( EquilibriumState ) function flash ( model , z , t , v_spec , p_spec , k0 , iters ) !! Flash algorithm using sucessive substitutions. !! !! Available specifications: !! !! - TP (with T and P_spec variables) !! - TV (with T and V_spec variables) !! !! This algorithm assumes that the specified T and P/V correspond to !! vapor-liquid separation predicted by the provided model (00 and g1<0 and therefore 0 1.e-6_pr ) iters = iters + 1 call betato01 ( z , K ) call solve_rr ( z , K , beta , bmin , bmax ) y = z * K / ( 1 + beta * ( K - 1._pr )) x = y / K ! Calculate fugacities for each kind of specification select case ( spec ) case ( \"TV\" ) ! find Vy,Vx (vV and vL) from V balance and P equality equations call pressure_equality_V_beta_xy ( model , T , V , beta , x , y , Vx , Vy , P ) call model % lnphi_pt ( y , P , T , V = Vy , root_type = \"stable\" , lnPhi = lnfug_y ) call model % lnphi_pt ( x , P , T , V = Vx , root_type = \"liquid\" , lnPhi = lnfug_x ) case ( \"TP\" ) call model % lnphi_pt ( y , P , T , V = Vy , root_type = \"stable\" , lnPhi = lnfug_y ) call model % lnphi_pt ( x , P , T , V = Vx , root_type = \"liquid\" , lnPhi = lnfug_x ) end select dKold = dK lnKold = lnK lnK = lnfug_x - lnfug_y dK = lnK - lnKold K = exp ( lnK ) if ( iters > 10 . and . abs ( sum ( dK + dKold )) < 0.05_pr ) then ! oscilation behavior detected (27/06/15) lnK = ( lnK + lnKold ) / 2 end if ! Assure that beta is between the limits call betalimits ( z , K , bmin , bmax ) ! 26/06/15 if (( beta < bmin ) . or . ( bmax < beta )) then beta = ( bmin + bmax ) / 2 end if ! Step is too big, go back if ( maxval ( abs ( dK )) > 1.10_pr ) then ! 26/11/2014 g0 = sum ( z * K ) - 1._pr g1 = 1._pr - sum ( z / K ) if ( g0 < 0 . or . g1 > 0 ) then ! bring beta back to range, by touching K call betato01 ( z , K ) call betalimits ( z , K , bmin , bmax ) beta = ( bmin + bmax ) / 2 ! new guess for beta end if end if if ( iters > 500 ) then p = - 1 exit end if end do ! ======================================================================== ! Format results ! ------------------------------------------------------------------------ if ( spec == 'TP' ) V = beta * Vy + ( 1 - beta ) * Vx if ( maxval ( K ) < 1.001_pr . and . minval ( K ) > 0.999_pr . or . P < 0 ) then ! trivial solution flash % kind = \"failed\" P = - 1.0 flash % x = x / x flash % y = y / y flash % iters = iters flash % P = P flash % T = T return end if flash % kind = \"split\" flash % iters = iters flash % P = P flash % T = T flash % x = x flash % y = y flash % Vx = Vx flash % Vy = Vy flash % beta = beta end function flash end module yaeos__equilibria_flash","tags":"","loc":"sourcefile/flash.f90.html"},{"title":"alphas.f90 – yaeos","text":"Source Code module yaeos__models_ar_cubic_alphas !! \\alpha functions defined in the library. use yaeos__constants , only : pr use yaeos__substance , only : substances use yaeos__models_ar_genericcubic , only : CubicEoS , AlphaFunction implicit none type , extends ( AlphaFunction ) :: AlphaSoave !! Soave \\alpha function. !! \\alpha(T_r) = (1 + k (1 - \\sqrt{Tr}))^2 real ( pr ), allocatable :: k (:) !! k parameter. contains procedure :: alpha !! Alpha function end type type , extends ( AlphaFunction ) :: AlphaRKPR !! RKPR \\alpha function !! !! \\alpha(T_r) = \\left(\\frac{3}{2 + T_r}\\right)^k !! real ( pr ), allocatable :: k (:) !! k parameter. contains procedure :: alpha => alpha_rkpr end type contains subroutine alpha ( self , Tr , a , dadt , dadt2 ) !! Soave \\alpha function and it's derivatives. class ( AlphaSoave ), intent ( in ) :: self real ( pr ), intent ( in ) :: Tr (:) !! Reduced temperature real ( pr ), intent ( out ) :: a (:) !! \\alpha real ( pr ), intent ( out ) :: dadt (:) !! \\frac{d\\alpha}{dT} real ( pr ), intent ( out ) :: dadt2 (:) !! \\frac{d^2\\alpha}{dT^2} associate ( k => self % k ) a = ( 1 + k * ( 1 - sqrt ( Tr ))) ** 2 dadT = k * ( k * ( sqrt ( Tr ) - 1 ) - 1 ) / sqrt ( Tr ) dadT2 = ( 1.0_pr / 2.0_pr ) * k * ( k + 1 ) / Tr ** ( 1.5_pr ) end associate end subroutine subroutine alpha_rkpr ( self , Tr , a , dadt , dadt2 ) class ( AlphaRKPR ), intent ( in ) :: self real ( pr ), intent ( in ) :: Tr (:) !! Reduced temperature real ( pr ), intent ( out ) :: a (:) !! \\alpha real ( pr ), intent ( out ) :: dadt (:) !! \\frac{d\\alpha}{dT} real ( pr ), intent ( out ) :: dadt2 (:) !! \\frac{d^2\\alpha}{dT^2} associate ( k => self % k ) a = ( 3 / ( 2 + Tr )) ** k dadT = - k * a / ( 2 + Tr ) dadT2 = - ( k + 1 ) * dadT / ( 2 + Tr ) end associate end subroutine end module","tags":"","loc":"sourcefile/alphas.f90.html"},{"title":"quadratic_mixing.f90 – yaeos","text":"Source Code module yaeos__models_ar_cubic_quadratic_mixing !! Quadratic Mixing Rules for Cubic EoS. use yaeos__constants , only : pr use yaeos__substance , only : substances use yaeos__models_ar_genericcubic , only : CubicMixRule use yaeos__models_ar_cubic_mixing_base , only : bmix_qmr implicit none type , extends ( CubicMixRule ) :: QMR !! Quadratic Mixing Rule (QMR) derived type. Classic Van der Waals mixing !! rules. !! !! QMR depends on binary interaction parameters, on a Cubic EoS !! the mixture is obtained by the combination of an attractive and !! repulsive parameter matrices. !! !! By default the attractive parameter matrix is calculated with: !! a_{ij} = \\sqrt{a_i a_j}(1 - k_{ij}) !! generating the a_{ij} matrix, but this procedure can be overriden !! replacing the `aij` pointer procedure. real ( pr ), allocatable :: k (:, :) !! Attractive Binary Interatction parameter matrix real ( pr ), allocatable :: l (:, :) !! Repulsive Binary Interatction parameter matrix procedure ( get_aij ), pointer :: aij => null () !! Procedure to calculate a_{ij} matrix. Can be overloaded !! by any method that respets the interface [[get_aij(interface)]]. contains procedure :: Dmix !! Attractive parameter mixing rule procedure :: Bmix !! Repulsive parameter mixing rule procedure :: D1mix => D1mix_constant end type QMR type , extends ( QMR ) :: QMR_RKPR contains procedure :: D1Mix => RKPR_D1mix end type QMR_RKPR abstract interface subroutine get_aij ( self , T , ai , daidt , daidt2 , aij , daijdt , daijdt2 ) !! Combining rule for the attractive parameter. !! !! From previously calculated attractive parameters calculate the !! a_{ij} matrix and it's corresponding derivatives. import pr , QMR class ( QMR ), intent ( in ) :: self real ( pr ), intent ( in ) :: T real ( pr ), intent ( in ) :: ai (:), daidt (:), daidt2 (:) real ( pr ), intent ( out ) :: aij (:, :), daijdt (:, :), daijdt2 (:, :) end subroutine get_aij end interface contains subroutine Dmix ( self , n , T , & ai , daidt , daidt2 , & D , dDdT , dDdT2 , dDi , dDidT , dDij ) !! Attractive parameter mixing rule with quadratic mix. !! !! Takes the all the pure components attractive parameters and their !! derivatives with respect to temperature and mix them with the !! Van der Waals quadratic mixing rule: !! !! !! D = \\sum_i \\sum_j n_i n_j a_{ij} = n^2 a_{mix} !! !! !! Inside the routine the a_{ij} matrix is calculated using the !! procedure contained in the `QMR` object, this procedures defaults !! to the common combining rule: a_{ij} = \\sqrt{a_i a_j} (1 - k_{ij}) !! !! The procedure can be overloaded by a common one that respects the !! interface [[get_aij(interface)]] !! !! ```fortran !! type(QMR) :: my_mixing_rule !! my_mixing_rule%aij => new_aij_procedure !! ``` class ( QMR ), intent ( in ) :: self !! Mixing rule object. real ( pr ), intent ( in ) :: T !! Temperature [K] real ( pr ), intent ( in ) :: n (:) !! Moles vector [mol] real ( pr ), intent ( in ) :: ai (:) !! Pure components attractive parameters a_i real ( pr ), intent ( in ) :: daidt (:) !! \\frac{da_i}{dT} real ( pr ), intent ( in ) :: daidt2 (:) !! \\frac{d^2a_i}{dT^2} real ( pr ), intent ( out ) :: D !! Mixture attractive parameter n^2a_{mix} real ( pr ), intent ( out ) :: dDdT !! \\frac{dD}{dT} real ( pr ), intent ( out ) :: dDdT2 !! \\frac{d^2D}{dT^2} real ( pr ), intent ( out ) :: dDi (:) !! \\frac{dD}{dn_i} real ( pr ), intent ( out ) :: dDidT (:) !! \\frac{d^2D}{dTn_i} real ( pr ), intent ( out ) :: dDij (:, :) !! \\frac{d^2D}{dn_{ij}} integer :: i , j , nc real ( pr ) :: aux , aux2 real ( pr ) :: aij ( size ( ai ), size ( ai )) real ( pr ) :: daijdt ( size ( ai ), size ( ai )) real ( pr ) :: daijdt2 ( size ( ai ), size ( ai )) nc = size ( ai ) if ( associated ( self % aij )) then call self % aij ( T , ai , daidt , daidt2 , aij , daijdt , daijdt2 ) else call kij_constant ( self , T , ai , daidt , daidt2 , aij , daijdt , daijdt2 ) end if D = 0 dDdT = 0 dDdT2 = 0 do i = 1 , nc aux = 0 aux2 = 0 dDi ( i ) = 0 dDidT ( i ) = 0 do j = 1 , nc dDi ( i ) = dDi ( i ) + 2 * n ( j ) * aij ( i , j ) dDidT ( i ) = dDidT ( i ) + 2 * n ( j ) * daijdT ( i , j ) aux2 = aux2 + n ( j ) * daijdT2 ( i , j ) dDij ( i , j ) = 2 * aij ( i , j ) aux = aux + n ( j ) * aij ( i , j ) end do D = D + n ( i ) * aux dDdT = dDdT + n ( i ) * dDidT ( i ) * 0.5_pr dDdT2 = dDdT2 + n ( i ) * aux2 end do end subroutine Dmix subroutine Bmix ( self , n , bi , B , dBi , dBij ) !! Mixture repulsive parameter. !! !! Calculate the mixture's repulsive parameter and it's derivatives !! with respect to composition: !! !! !! nB = \\sum_i \\sum_j n_i n_j \\frac{b_i + b_j}{2} (1 - l_{ij}) !! !! class ( QMR ), intent ( in ) :: self !! Mixing rule object. real ( pr ), intent ( in ) :: n (:) !! Moles vector. real ( pr ), intent ( in ) :: bi (:) !! Pure components repulsive parameters. real ( pr ), intent ( out ) :: B !! Mixture repulsive parameter. real ( pr ), intent ( out ) :: dBi (:) !! \\frac{dB}{dn_i} real ( pr ), intent ( out ) :: dBij (:, :) !!\\frac{d^2B}{dn_{ij}} call bmix_qmr ( n , bi , self % l , b , dbi , dbij ) end subroutine Bmix subroutine D1mix_constant ( self , n , d1i , D1 , dD1i , dD1ij ) !! Constant \\delta_1 parameter. !! !! Most Cubic EoS keep a constant value for their \\delta_1 parameter. !! This procedure assumes that all the components have the same delta_1 !! and takes the first value as the one of the mixture. use yaeos__models_ar_cubic_mixing_base , only : d1mix_rkpr class ( QMR ), intent ( in ) :: self !! Mixing rule real ( pr ), intent ( in ) :: n (:) !! Moles vector real ( pr ), intent ( in ) :: d1i (:) !! \\delta_1 parameter real ( pr ), intent ( out ) :: D1 !! Mixture's \\Delta_1 real ( pr ), intent ( out ) :: dD1i (:) !! \\frac{dDelta_1}{dn_i} = 0 real ( pr ), intent ( out ) :: dD1ij (:, :) !! \\frac{d^2Delta_1}{dn_{ij}} = 0 D1 = d1i ( 1 ) dD1i = 0 dD1ij = 0 end subroutine D1mix_constant subroutine RKPR_D1mix ( self , n , d1i , D1 , dD1i , dD1ij ) use yaeos__models_ar_cubic_mixing_base , only : d1mix_rkpr !! RKPR \\delta_1 parameter mixing rule. !! !! The RKPR EoS doesn't have a constant \\delta_1 value for each !! component, so a proper mixing rule should be provided. A linear !! combination is used. !! !! !! \\Delta_1 = \\sum_i^N n_i \\delta_{1i} !! !! class ( QMR_RKPR ), intent ( in ) :: self real ( pr ), intent ( in ) :: n (:) real ( pr ), intent ( in ) :: d1i (:) real ( pr ), intent ( out ) :: D1 real ( pr ), intent ( out ) :: dD1i (:) real ( pr ), intent ( out ) :: dD1ij (:, :) call d1mix_rkpr ( n , d1i , d1 , dd1i , dd1ij ) end subroutine RKPR_D1mix subroutine kij_constant (& self , T , a , dadt , dadt2 , & aij , daijdt , daijdt2 & ) !! Combining rule that uses constant k_{ij} values. !! !! !! a_{ij} = \\sqrt{a_i a_j} (1 - k_{ij}) !! ] class ( QMR ), intent ( in ) :: self real ( pr ), intent ( in ) :: T !! Temperature [K] real ( pr ), intent ( in ) :: a (:) !! Pure components attractive parameters (\\a_i real ( pr ), intent ( in ) :: dadt (:) !! \\frac{da_i}{dT} real ( pr ), intent ( in ) :: dadt2 (:) !! \\frac{d^2a_i}{dT^2} real ( pr ), intent ( out ) :: aij (:, :) !! a_{ij} Matrix real ( pr ), intent ( out ) :: daijdt (:, :) !! \\frac{da_{ij}{dT} real ( pr ), intent ( out ) :: daijdt2 (:, :) !! \\frac{d^2a_{ij}{dT^2} integer :: i , j real ( pr ) :: sqrt_aii_ajj real ( pr ) :: inner_sum real ( pr ) :: aij_daidt do i = 1 , size ( a ) aij ( i , i ) = a ( i ) daijdt ( i , i ) = dadt ( i ) daijdt2 ( i , i ) = dadt2 ( i ) do j = i + 1 , size ( a ) sqrt_aii_ajj = sqrt ( a ( i ) * a ( j )) aij ( i , j ) = sqrt_aii_ajj * ( 1 - self % k ( i , j )) inner_sum = a ( i ) * dadt ( j ) + a ( j ) * dadt ( i ) daijdt ( i , j ) = 0.5_pr * aij ( i , j ) * ( inner_sum ) / ( a ( i ) * a ( j )) daijdt2 ( i , j ) = & ( 1 - self % k ( i , j )) * ( dadT ( j ) * dadT ( i ) / sqrt ( a ( i ) * a ( j )) & + sqrt ( a ( i ) / a ( j )) * ( dadT2 ( j ) - dadT ( j ) ** 2 / ( 2 * a ( j ))) & + sqrt ( a ( j ) / a ( i )) * ( dadT2 ( i ) - dadT ( i ) ** 2 / ( 2 * a ( i )))) / 2 aij ( j , i ) = aij ( i , j ) daijdt ( j , i ) = daijdt ( i , j ) daijdt2 ( j , i ) = daijdt2 ( i , j ) end do end do end subroutine kij_constant end module yaeos__models_ar_cubic_quadratic_mixing","tags":"","loc":"sourcefile/quadratic_mixing.f90.html"},{"title":"implementations.f90 – yaeos","text":"Source Code module yaeos__models_ar_cubic_implementations use yaeos__constants , only : pr , R use yaeos__models_ar_genericcubic , only : CubicEoS use yaeos__substance , only : Substances !! Implemented Cubic Equations of State. !! !! - PengRobinson76 !! - PengRobinson78 !! - SoaveRedlichKwong !! - RKPR private public :: PengRobinson76 public :: PengRobinson78 public :: SoaveRedlichKwong public :: RKPR contains type ( CubicEoS ) function PengRobinson76 ( tc , pc , w , kij , lij ) result ( model ) !! PengRobinson76. !! !! Using the critical constants setup the parameters to use the !! PengRobinson Equation of State !! !! - \\alpha(T_r) = (1 + k (1 - \\sqrt{T_r}))^2 !! - k = 0.37464 + 1.54226 * \\omega - 0.26993 \\omega^2 !! - a_c = 0.45723553 R^2 T_c^2 / P_c !! - b = 0.07779607r R T_c/P_c !! - \\delta_1 = 1 + \\sqrt{2} !! - \\delta_2 = 1 - \\sqrt{2} !! !! There is also the optional posibility to include the k_{ij} and !! l_{ij} matrices. Using by default Classic Van der Waals mixing !! rules. !! !! After setting up the model, it is possible to redefine either the !! mixing rule or the alpha function using a different derived type !! defined outside the function. use yaeos__constants , only : pr , R use yaeos__substance , only : Substances use yaeos__models_ar_genericcubic , only : CubicEoS use yaeos__models_ar_cubic_alphas , only : AlphaSoave use yaeos__models_ar_cubic_quadratic_mixing , only : QMR real ( pr ), intent ( in ) :: tc (:) !! Critical Temperatures [K] real ( pr ), intent ( in ) :: pc (:) !! Critical Pressures [bar] real ( pr ), intent ( in ) :: w (:) !! Acentric Factors real ( pr ), optional , intent ( in ) :: kij (:, :) !! k_{ij} matrix real ( pr ), optional , intent ( in ) :: lij (:, :) !! l_{ij} matrix type ( Substances ) :: composition type ( QMR ) :: mixrule type ( AlphaSoave ) :: alpha integer :: nc integer :: i nc = size ( tc ) composition % tc = tc composition % pc = pc composition % w = w alpha % k = 0.37464_pr & + 1.54226_pr * composition % w & - 0.26993_pr * composition % w ** 2 if ( present ( kij )) then mixrule % k = kij else mixrule % k = reshape ([( 0 , i = 1 , nc ** 2 )], [ nc , nc ]) endif if ( present ( lij )) then mixrule % l = lij else mixrule % l = reshape ([( 0 , i = 1 , nc ** 2 )], [ nc , nc ]) endif model % components = composition model % ac = 0.45723553_pr * R ** 2 * composition % tc ** 2 / composition % pc model % b = 0.07779607_pr * R * composition % tc / composition % pc model % del1 = [( 1 + sqrt ( 2.0_pr ), i = 1 , nc )] model % del2 = [( 1 - sqrt ( 2.0_pr ), i = 1 , nc )] model % alpha = alpha model % mixrule = mixrule model % name = \"PR76\" end function type ( CubicEoS ) function PengRobinson78 ( tc , pc , w , kij , lij ) result ( model ) !! PengRobinson78. !! !! Using the critical constants setup the parameters to use the !! PengRobinson Equation of State !! !! - \\alpha(T_r) = (1 + k (1 - \\sqrt{T_r}))^2 !! - k = 0.37464 + 1.54226 \\omega - 0.26992 \\omega^2 \\text{ where } \\omega <=0.491 !! - k = 0.37464 + 1.48503 \\omega - 0.16442 \\omega^2 + 0.016666 \\omega^3 \\text{ where } \\omega > 0.491 !! - a_c = 0.45723553 R^2 T_c^2 / P_c !! - b = 0.07779607r R T_c/P_c !! - \\delta_1 = 1 + \\sqrt{2} !! - \\delta_2 = 1 - \\sqrt{2} !! !! There is also the optional posibility to include the k_{ij} and !! l_{ij} matrices. Using by default Classic Van der Waals mixing !! rules. !! !! After setting up the model, it is possible to redefine either the !! mixing rule or the alpha function using a different derived type !! defined outside the function. use yaeos__constants , only : pr , R use yaeos__substance , only : Substances use yaeos__models_ar_genericcubic , only : CubicEoS use yaeos__models_ar_cubic_alphas , only : AlphaSoave use yaeos__models_ar_cubic_quadratic_mixing , only : QMR real ( pr ), intent ( in ) :: tc (:) !! Critical Temperatures [K] real ( pr ), intent ( in ) :: pc (:) !! Critical Pressures [bar] real ( pr ), intent ( in ) :: w (:) !! Acentric Factors real ( pr ), optional , intent ( in ) :: kij (:, :) !! k_{ij} matrix real ( pr ), optional , intent ( in ) :: lij (:, :) !! l_{ij} matrix type ( Substances ) :: composition type ( QMR ) :: mixrule type ( AlphaSoave ) :: alpha integer :: nc integer :: i nc = size ( tc ) composition % tc = tc composition % pc = pc composition % w = w allocate ( alpha % k ( nc )) where ( composition % w <= 0.491 ) alpha % k = 0.37464 + 1.54226 * composition % w - 0.26992 * composition % w ** 2 elsewhere alpha % k = 0.379642 + 1.48503 * composition % w - 0.164423 * composition % w ** 2 + 0.016666 * composition % w ** 3 end where if ( present ( kij )) then mixrule % k = kij else mixrule % k = reshape ([( 0 , i = 1 , nc ** 2 )], [ nc , nc ]) endif if ( present ( lij )) then mixrule % l = lij else mixrule % l = reshape ([( 0 , i = 1 , nc ** 2 )], [ nc , nc ]) endif model % components = composition model % ac = 0.45723553_pr * R ** 2 * composition % tc ** 2 / composition % pc model % b = 0.07779607_pr * R * composition % tc / composition % pc model % del1 = [( 1 + sqrt ( 2.0_pr ), i = 1 , nc )] model % del2 = [( 1 - sqrt ( 2.0_pr ), i = 1 , nc )] model % alpha = alpha model % mixrule = mixrule model % name = \"PR78\" end function type ( CubicEoS ) function SoaveRedlichKwong ( tc , pc , w , kij , lij ) result ( model ) !! SoaveRedlichKwong. !! !! Using the critical constants setup the parameters to use the !! SoaveRedlichKwong Equation of State !! !! - \\alpha(T_r) = (1 + k (1 - \\sqrt{T_r}))^2 !! - k = 0.48 + 1.574 \\omega - 0.175 \\omega^2 !! - a_c = 0.427480 R^2 * T_c^2/P_c !! - b = 0.086640 R T_c/P_c !! - \\delta_1 = 1 !! - \\delta_2 = 0 !! !! There is also the optional posibility to include the k_{ij} and l_{ij} !! matrices. Using by default Classic Van der Waals mixing rules. !! !! After setting up the model, it is possible to redefine either the !! mixing rule or the alpha function using a different derived type !! defined outside the function. use yaeos__models_ar_genericcubic , only : CubicEoS use yaeos__models_ar_cubic_alphas , only : AlphaSoave use yaeos__models_ar_cubic_quadratic_mixing , only : QMR real ( pr ), intent ( in ) :: tc (:) !! Critical temperature [K] real ( pr ), intent ( in ) :: pc (:) !! Critical pressure [bar] real ( pr ), intent ( in ) :: w (:) !! Acentric factor real ( pr ), optional , intent ( in ) :: kij (:, :) !! k_{ij} matrix real ( pr ), optional , intent ( in ) :: lij (:, :) !! l_{ij} matrix type ( Substances ) :: composition type ( QMR ) :: mixrule type ( AlphaSoave ) :: alpha integer :: nc integer :: i nc = size ( tc ) composition % tc = tc composition % pc = pc composition % w = w alpha % k = 0.48_pr + 1.574_pr * composition % w - 0.175_pr * composition % w ** 2 if ( present ( kij )) then mixrule % k = kij else mixrule % k = reshape ([( 0 , i = 1 , nc ** 2 )], [ nc , nc ]) endif if ( present ( lij )) then mixrule % l = lij else mixrule % l = reshape ([( 0 , i = 1 , nc ** 2 )], [ nc , nc ]) endif model % components = composition model % ac = 0.427480_pr * R ** 2 * composition % tc ** 2 / composition % pc model % b = 0.086640_pr * R * composition % tc / composition % pc model % del1 = [( 1 , i = 1 , nc )] model % del2 = [( 0 , i = 1 , nc )] model % alpha = alpha model % mixrule = mixrule model % name = \"SRK\" end function type ( CubicEoS ) function RKPR ( tc , pc , w , zc , kij , lij , delta_1 , k ) result ( model ) !! RKPR Equation of State !! !! The RKPR EoS extends the classical formulation of Cubic Equations !! of State by freeing the parameter \\delta_1. This extra degree !! provides extra ways of implementing the equation in comparison !! of other Cubic EoS (like PR and SRK) which are limited to definition !! of their critical constants. !! !! Besides that extra parameter, the RKRR includes another \\alpha !! function: !! !! \\alpha(T_r) = \\left(\\frac{3}{2+T_r}\\right)^k !! !! !! In this implementation we take the simplest form which correlates !! the extra parameter to the critical compressibility factor Z_c and !! the k parameter of the \\alpha function to Z_c and \\omega: !! !! \\delta_1 = d_1 + d_2 (d_3 - Z_c)^d_4 + d_5 (d_3 - Z_c) ^ d_6 !! k = (A_1 Z_c + A_0)\\omega^2 + (B_1 Z_c + B_0)\\omega + (C_1 Z_c + C_0) use yaeos__models_ar_cubic_quadratic_mixing , only : QMR_RKPR use yaeos__models_ar_cubic_alphas , only : AlphaRKPR real ( pr ), intent ( in ) :: tc (:) !! Critical Temperature [K] real ( pr ), intent ( in ) :: pc (:) !! Critical Pressure [bar] real ( pr ), intent ( in ) :: w (:) !! Acentric Factor real ( pr ), intent ( in ) :: zc (:) !! Critical compressibility real ( pr ), optional , intent ( in ) :: kij (:, :) !! k_{ij} matrix real ( pr ), optional , intent ( in ) :: lij (:, :) !! l_{ij} matrix real ( pr ), optional , intent ( in ) :: delta_1 (:) real ( pr ), optional , intent ( in ) :: k (:) type ( AlphaRKPR ) :: alpha type ( QMR_RKPR ) :: mixrule type ( Substances ) :: composition integer :: i , nc real ( pr ), parameter :: d1 = 0.428364 , & d2 = 1 8.496215 , & d3 = 0.338426 , & d4 = 0.66 , & d5 = 78 9.723105 , & d6 = 2.512392 real ( pr ), parameter :: A1 = - 2.4407 real ( pr ), parameter :: A0 = 0.0017 real ( pr ), parameter :: B1 = 7.4513 real ( pr ), parameter :: B0 = 1.9681 real ( pr ), parameter :: C1 = 1 2.504 real ( pr ), parameter :: C0 =- 2.6238 real ( pr ) :: OMa ( size ( pc )), OMb ( size ( pc )) real ( pr ) :: Zc_eos ( size ( pc )) nc = size ( tc ) composition % pc = pc composition % tc = tc composition % w = w Zc_eos = 1.168 * Zc if ( present ( k )) then alpha % k = k else alpha % k = ( A1 * zc + A0 ) * w ** 2 + ( B1 * zc + B0 ) * w + ( C1 * Zc + C0 ) end if if ( present ( kij )) then mixrule % k = kij else mixrule % k = reshape ([( 0 , i = 1 , nc ** 2 )], [ nc , nc ]) end if if ( present ( lij )) then mixrule % l = lij else mixrule % l = reshape ([( 0 , i = 1 , nc ** 2 )], [ nc , nc ]) end if model % components = composition if ( present ( delta_1 )) then model % del1 = delta_1 else model % del1 = d1 + d2 * ( d3 - zc ) ** d4 + d5 * ( d3 - zc ) ** d6 end if model % del2 = ( 1._pr - model % del1 ) / ( 1._pr + model % del1 ) model % alpha = alpha call get_OMa_OMb ( model % del1 , oma , omb ) model % ac = OMa * ( R * Tc ) ** 2 / Pc model % b = OMb * ( R * Tc ) / Pc model % mixrule = mixrule model % name = \"RKPR 2005\" end function subroutine get_OMa_OMb ( del1 , OMa , OMb ) real ( pr ), intent ( in ) :: del1 (:) real ( pr ), intent ( out ) :: OMa ( size ( del1 )) real ( pr ), intent ( out ) :: OMb ( size ( del1 )) real ( pr ) :: d1 ( size ( del1 )), y ( size ( del1 )) d1 = ( 1._pr + del1 ** 2._pr ) / ( 1._pr + del1 ) y = 1._pr + ( 2._pr * ( 1._pr + del1 )) ** ( 1.0_pr / 3._pr ) + ( 4._pr / ( 1._pr + del1 )) ** ( 1.0_pr / 3 ) OMa = ( 3._pr * y * y + 3._pr * y * d1 + d1 ** 2._pr + d1 - 1.0_pr ) / ( 3._pr * y + d1 - 1.0_pr ) ** 2._pr OMb = 1._pr / ( 3._pr * y + d1 - 1.0_pr ) end subroutine end module","tags":"","loc":"sourcefile/implementations.f90~2.html"},{"title":"tapenade_ge_api.f90 – yaeos","text":"Source Code module yaeos__tapenade_ge_api !! Module that wraps tapenade generated routines to calculate ! !! Ge and derivatives. use yaeos__constants , only : pr , R use yaeos__models_ge , only : GeModel implicit none private public :: GeModelTapenade type , abstract , extends ( GeModel ) :: GeModelTapenade contains procedure ( tapenade_ge ), deferred :: ge procedure ( tapenade_ge_d ), deferred :: ge_d procedure ( tapenade_ge_b ), deferred :: ge_b procedure ( tapenade_ge_d_b ), deferred :: ge_d_b procedure ( tapenade_ge_d_d ), deferred :: ge_d_d procedure :: excess_gibbs => excess_gibbs end type abstract interface subroutine tapenade_ge ( model , n , t , ge ) import GeModelTapenade , pr class ( GeModelTapenade ) :: model real ( pr ), intent ( in ) :: n (:), t real ( pr ), intent ( out ) :: ge end subroutine subroutine tapenade_ge_d ( model , n , nd , t , td , ge , ged ) import pr , GeModelTapenade class ( GeModelTapenade ) :: model real ( pr ), intent ( in ) :: n (:), t real ( pr ), intent ( in ) :: nd (:), td real ( pr ), intent ( out ) :: ge , ged end subroutine subroutine tapenade_ge_b ( model , n , nb , t , tb , ge , geb ) import pr , GeModelTapenade class ( GeModelTapenade ) :: model real ( pr ), intent ( in ) :: n (:), t real ( pr ) :: geb real ( pr ) :: nb (:), tb real ( pr ) :: ge end subroutine subroutine tapenade_ge_d_b ( model , & n , nb , nd , ndb , t , tb , td , tdb , & ge , geb , ged , gedb ) import pr , GeModelTapenade class ( GeModelTapenade ) :: model real ( pr ), intent ( in ) :: n (:), t real ( pr ) :: ge real ( pr ), intent ( in ) :: nd (:), td real ( pr ) :: ged real ( pr ) :: nb (:), tb real ( pr ) :: geb real ( pr ) :: ndb (:), tdb real ( pr ) :: gedb end subroutine subroutine tapenade_ge_d_d ( model , n , nd , t , td0 , td , ge , ged0 , ged , gedd ) import pr , GeModelTapenade class ( GeModelTapenade ) :: model real ( pr ), intent ( in ) :: n (:), t real ( pr ), intent ( in ) :: td0 real ( pr ), intent ( in ) :: nd (:), td real ( pr ), intent ( out ) :: ge , ged0 , ged , gedd end subroutine end interface contains subroutine excess_gibbs (& self , n , t , Ge , GeT , GeT2 , Gen , GeTn , Gen2 & ) !! Excess Gibbs model generic interface class ( GeModelTapenade ), intent ( in ) :: self real ( pr ), intent ( in ) :: n (:) real ( pr ), intent ( in ) :: t real ( pr ), optional , intent ( out ) :: Ge , GeT , GeT2 real ( pr ), optional , dimension ( size ( n )), intent ( out ) :: Gen , GeTn real ( pr ), optional , intent ( out ) :: Gen2 ( size ( n ), size ( n )) real ( pr ) :: nb ( size ( n )), nd ( size ( n )), ndb ( size ( n )) real ( pr ) :: tb , td , tdb , td0 real ( pr ) :: geb , ged , gedb , ged0 , gedd integer :: i , nc nc = size ( n ) if ( present ( Gen2 )) then do i = 1 , nc call reset_vars gedb = 1 if ( i <= nc ) then nd ( i ) = 1 end if call self % ge_d_b (& n , nb , nd , ndb , & t , tb , td , tdb , & ge , geb , ged , gedb & ) Gen2 ( i , :) = nb end do if ( present ( Gen )) Gen = ndb if ( present ( GeT )) GeT = tdb else if ( present ( Gen )) then call reset_vars geb = 1 call self % ge_b ( n , nb , t , tb , ge , geb ) Gen = nb if ( present ( GeT )) GeT = tb else end if if ( present ( GeTn )) GeTn = get_GenT () if ( present ( GeT2 )) GeT2 = get_dGedT2 () call reset_vars if ( present ( Ge )) call self % ge ( n , t , ge ) contains subroutine reset_vars nb = 0 nd = 0 ndb = 0 tb = 0 td = 0 td0 = 0 tdb = 0 ge = 0 geb = 0 ged = 0 ged0 = 0 gedb = 0 end subroutine function get_dGedT2 () real ( pr ) :: get_dGedT2 call reset_vars td = 1 td0 = 1 call self % ge_d_d (& n , nd , t , td0 , td , & ge , ged0 , ged , gedd & ) get_dGedT2 = gedd end function function get_GenT () real ( pr ) :: get_GenT ( size ( n )) call reset_vars gedb = 1 td = 1 call self % ge_d_b (& n , nb , nd , ndb , & t , tb , td , tdb , & ge , geb , ged , gedb & ) get_GenT = nb end function end subroutine end module","tags":"","loc":"sourcefile/tapenade_ge_api.f90.html"},{"title":"stability.f90 – yaeos","text":"Source Code module yaeos__phase_equilibria_stability !! # Phase Stability module !! Phase stability related calculations. !! !! # Description !! Contains the basics rotuines to make phase stability analysis for !! phase-equilibria detection. !! !! - `tpd(model, z, w, P, T)`: reduced Tangent-Plane-Distance !! - `min_tpd(model, z, P, T, mintpd, w)`: Find minimal tpd for a multicomponent mixture !! !! # Examples !! !! ```fortran !! ! Obtain the minimal tpd for a binary mixture at z_1 = 0.13 !! model = PengRobinson76(tc, pc, ac, kij, lij) !! !! z = [0.13, 1-0.13] !! w = [0.1, 0.9] !! !! P = 45.6_pr !! T = 190._pr !! !! z = z/sum(z) !! ----------------------------------------------- !! ``` !! !! # References !! 1. Thermodynamic Models: Fundamental and Computational Aspects, Michael L. !! Michelsen, Jørgen M. Mollerup. Tie-Line Publications, Denmark (2004) !! [doi](http://dx.doi.org/10.1016/j.fluid.2005.11.032) use yaeos__constants , only : pr , r use yaeos__models_ar , only : ArModel implicit none type , private :: TMOptimizeData !! Data structure to hold the data for the `min_tpd` optimization class ( ArModel ), pointer :: model real ( pr ), allocatable :: z (:) real ( pr ), allocatable :: di (:) real ( pr ) :: P , T end type contains real ( pr ) function tm ( model , z , w , P , T , d , dtpd ) !! # Alternative formulation of tangent-plane-distance !! Michelsen's modified tpd function, tm. !! !! # Description !! Alternative formulation of the reduced tangent plane tpd function, !! where the test phase is defined in moles, which enables for unconstrained !! minimization. !! !! tm(W) = 1 + \\sum_i W_i (\\ln W_i + \\ln \\phi_i(W) - d_i - 1) !! !! !! # Examples !! !! ## Calculation of `tm` !! ```fortran !! tm = tpd(model, z, w, P, T) !! --------------------------- !! ``` !! !! ## Using precalculated trial-phase data !! It is possible to calculate externaly the `d_i` vector and use it for !! later calculations. !! ```fortran !! call fugacity_tp(& !! model, z, T=T, P=P, V=Vz, root_type=\"stable\", lnphip=lnphi_z& !! ) !! lnphi_z = lnphi_z - log(P) !! di = log(z) + lnphi_z !! tm = tpd(model, z, w, P, T, d=di) !! --------------------------- !! ``` !! !! # References !! 1. Thermodynamic Models: Fundamental and Computational Aspects, Michael L. !! Michelsen, Jørgen M. Mollerup. Tie-Line Publications, Denmark (2004) !! [doi](http://dx.doi.org/10.1016/j.fluid.2005.11.032) class ( ArModel ), intent ( in ) :: model !! Thermodynamic model real ( pr ), intent ( in ) :: z (:) !! Feed composition real ( pr ), intent ( in ) :: w (:) !! Test-phase mole numbers vector real ( pr ), intent ( in ) :: P !! Pressure [bar] real ( pr ), intent ( in ) :: T !! Temperature [K] real ( pr ), optional , intent ( in ) :: d (:) !! d_i vector real ( pr ), optional , intent ( out ) :: dtpd (:) real ( pr ) :: di ( size ( z )), vz , vw real ( pr ) :: lnphi_z ( size ( z )), lnphi_w ( size ( z )) call model % lnphi_pt (& w , T = T , P = P , V = Vw , root_type = \"stable\" , lnPhi = lnPhi_w & ) if (. not . present ( d )) then call model % lnphi_pt (& z , T = T , P = P , V = Vz , root_type = \"stable\" , lnPhi = lnPhi_z & ) di = log ( z ) + lnphi_z else di = d end if ! tpd = sum(w * (log(w) + lnphi_w - di)) tm = 1 + sum ( w * ( log ( w ) + lnPhi_w - di - 1 )) if ( present ( dtpd )) then dtpd = log ( w ) + lnPhi_w - di end if end function tm subroutine min_tpd ( model , z , P , T , mintpd , w , all_minima ) use yaeos__optimizers_powell_wrap , only : PowellWrapper class ( ArModel ), target :: model !! Thermodynamic model real ( pr ), intent ( in ) :: z (:) !! Feed composition real ( pr ), intent ( in ) :: P !! Pressure [bar] real ( pr ), intent ( in ) :: T !! Temperature [K] real ( pr ), intent ( out ) :: w (:) !! Trial composition real ( pr ), intent ( out ) :: mintpd !! Minimal value of tm real ( pr ), optional , intent ( out ) :: all_minima (:, :) !! All the found minima type ( PowellWrapper ) :: opt type ( TMOptimizeData ) :: data real ( pr ) :: dx ( size ( w )) real ( pr ) :: lnphi_z ( size ( z )), di ( size ( z )) real ( pr ) :: mins ( size ( w )), ws ( size ( w ), size ( w )), V integer :: i integer :: stat dx = 0.001_pr ! Calculate feed di call model % lnphi_pt ( z , T = T , P = P , V = V , root_type = \"stable\" , lnPhi = lnPhi_z ) di = log ( z ) + lnphi_z ! ============================================================== ! Minimize for each component using each quasi-pure component ! as initialization. ! -------------------------------------------------------------- data % model => model data % di = di data % P = P data % T = T data % z = z opt % parameter_step = dx !$OMP PARALLEL DO PRIVATE(i, w, mintpd, stat) SHARED(opt, ws, mins) do i = 1 , size ( w ) w = 0.001_pr w ( i ) = 0.999_pr call opt % optimize ( min_tpd_to_optimize , w , mintpd , data = data ) mins ( i ) = mintpd ws ( i , :) = w end do !$OMP END PARALLEL DO i = minloc ( mins , dim = 1 ) mintpd = mins ( i ) w = ws ( i , :) if ( present ( all_minima )) all_minima = ws end subroutine min_tpd subroutine min_tpd_to_optimize ( X , F , dF , data ) real ( pr ), intent ( in ) :: X (:) real ( pr ), intent ( out ) :: F real ( pr ), optional , intent ( out ) :: dF (:) class ( * ), optional , intent ( in out ) :: data select type ( data ) type is ( TMOptimizeData ) F = tm ( data % model , data % z , X , data % P , data % T , d = data % di ) end select end subroutine end module yaeos__phase_equilibria_stability","tags":"","loc":"sourcefile/stability.f90.html"},{"title":"admm_tapenade_interface.f90 – yaeos","text":"Source Code MODULE ADMM_TAPENADE_INTERFACE IMPLICIT NONE INTERFACE PUSHPOINTER8 SUBROUTINE PUSHPOINTER8 ( pp ) BIND ( c , name = 'pushPointer8' ) USE ISO_C_BINDING TYPE ( C_PTR ), VALUE :: pp END SUBROUTINE PUSHPOINTER8 END INTERFACE PUSHPOINTER8 INTERFACE POPPOINTER8 SUBROUTINE POPPOINTER8 ( pp ) BIND ( c , name = 'popPointer8' ) USE ISO_C_BINDING TYPE ( C_PTR ) :: pp END SUBROUTINE POPPOINTER8 END INTERFACE POPPOINTER8 INTERFACE ADMM_REGISTERSHADOWED SUBROUTINE ADMM_REGISTERSHADOWED ( base , obase , size , baseb , obaseb & & , sizeb , nbelem ) BIND ( c , name = 'ADMM_registerShadowed' ) USE ISO_C_BINDING TYPE ( C_PTR ), VALUE :: base , obase TYPE ( C_PTR ), VALUE :: baseb , obaseb INTEGER , VALUE :: size , sizeb INTEGER , VALUE :: nbelem END SUBROUTINE ADMM_REGISTERSHADOWED END INTERFACE ADMM_REGISTERSHADOWED INTERFACE ADMM_REGISTER SUBROUTINE ADMM_REGISTER ( base , obase , size , nbelem ) BIND ( c , name = & & 'ADMM_register' ) USE ISO_C_BINDING TYPE ( C_PTR ), VALUE :: base , obase INTEGER , VALUE :: size INTEGER , VALUE :: nbelem END SUBROUTINE ADMM_REGISTER END INTERFACE ADMM_REGISTER INTERFACE ADMM_UNREGISTERSHADOWED SUBROUTINE ADMM_UNREGISTERSHADOWED ( base , baseb , nbelem ) BIND ( c , & & name = 'ADMM_unregisterShadowed' ) USE ISO_C_BINDING TYPE ( C_PTR ), VALUE :: base , baseb INTEGER :: nbelem END SUBROUTINE ADMM_UNREGISTERSHADOWED END INTERFACE ADMM_UNREGISTERSHADOWED INTERFACE ADMM_UNREGISTER SUBROUTINE ADMM_UNREGISTER ( base , nbelem ) BIND ( c , name = & & 'ADMM_unregister' ) USE ISO_C_BINDING TYPE ( C_PTR ), VALUE :: base INTEGER :: nbelem END SUBROUTINE ADMM_UNREGISTER END INTERFACE ADMM_UNREGISTER INTERFACE ADMM_REBASESHADOWED SUBROUTINE ADMM_REBASESHADOWED ( base , baseb ) BIND ( c , name = & & 'ADMM_rebaseShadowed' ) USE ISO_C_BINDING TYPE ( C_PTR ) :: base , baseb END SUBROUTINE ADMM_REBASESHADOWED END INTERFACE ADMM_REBASESHADOWED INTERFACE ADMM_REBASE SUBROUTINE ADMM_REBASE ( base ) BIND ( c , name = 'ADMM_rebase' ) USE ISO_C_BINDING TYPE ( C_PTR ) :: base END SUBROUTINE ADMM_REBASE END INTERFACE ADMM_REBASE END MODULE ADMM_TAPENADE_INTERFACE","tags":"","loc":"sourcefile/admm_tapenade_interface.f90.html"},{"title":"models.f90 – yaeos","text":"Source Code module yaeos__models !! `yaeos` thermodynamic models !! !! On `yaeos` there are implemented a series of both residual Helmholtz !! energy (A_r) and excess Gibbs energy (G^E) models. !! !! This module takes all the relevant procedures and derived types !! related to them. !! !! - Residual Helmholtz model base type `ArModel` base derived type !! that provides the basic structure that a residual Helmholtz model !! should provide. !! - **Cubic Equations of state**: !! - `AlphaFunction` type !! - `CubicMixRule` type !! - `CubicEos` type that extends `ArModel` to use a generic !! two-parameter EoS. Implemented models that use this type can be !! seen at [[yaeos__models_ar_cubic_implementations(module)]] !! - `QMR` (Quadratic Mixing Rule) type: extensible derived type that !! defaults to classic vdW mixing rules. !! - `MHV` (Modified Huron-Vidal) type: Michelsens first order modified !! Huron-Vidal mixing rule. ! Base model structure use yaeos__models_base , only : BaseModel ! Residual Helmholtz Models use yaeos__models_ar , only : ArModel , size ! Cubic EoS models use yaeos__models_ar_genericcubic , only : & CubicEoS , GenericCubic_Ar , AlphaFunction , CubicMixRule ! Alpha functions use yaeos__models_ar_cubic_alphas ! Mixing Rules use yaeos__models_ar_cubic_quadratic_mixing use yaeos__models_cubic_mixing_rules_huron_vidal ! Implemented models use yaeos__models_ar_cubic_implementations ! Ge Models use yaeos__models_ge , only : GeModel ! Implemented models use yaeos__models_ge_implementations end module","tags":"","loc":"sourcefile/models.f90.html"},{"title":"consistency_gemodel.f90 – yaeos","text":"Source Code module yaeos__consistency_gemodel !! # yaeos__consistency_gemodel !! Consistency checks of Helmholtz free energy models ([[GeModel]]). !! !! # Description !! This module contains tools to validate the analityc derivatives of !! implmented excess Gibbs free energy models ([[GeModel]]). Also, allows to !! evaluate the consistency tests described in Thermodynamic Models: !! Fundamentals & Computational Aspects 2 ed. by Michelsen and Mollerup !! Chapter 5 section 4. !! !! Available tools: !! !! - [[numeric_ge_derivatives]]: From an instantiated [[GeModel]] evaluate !! all the excess Gibbs free energy derivatives from the central finite !! difference method. !! !! - [[ge_consistency]]: From an instantiated GeModel evaluate all the !! Michelsen and Mollerup consistency tests !! !! # References !! 1. Michelsen, M. L., & Mollerup, J. M. (2007). Thermodynamic models: !! Fundamentals & computational aspects (2. ed). Tie-Line Publications. !! use yaeos__constants , only : pr , R use yaeos__models_ge , only : GeModel implicit none contains subroutine ge_consistency ( model , n , t , eq58 , eq59 , eq60 , eq61 ) !! # ge_consistency !! G^E models consistency tests !! !! # Description !! Evaluate the G^E models consistency tests described in !! Thermodynamic Models: Fundamentals & Computational Aspects 2 ed. by !! Michelsen and Mollerup (MM) Chapter 5 section 4. The \"eq\" are !! evaluations of the left hand side of the following expressions: !! !! Equation 58 !! !! !! \\sum_i^{NC} n_i \\text{ln} \\gamma_i - \\frac{G^E}{RT} = 0 !! !! !! Equation 59 !! !! !! \\text{ln} \\gamma_i - \\frac{1}{RT} !! \\frac{\\partial G^E}{\\partial n_i} = 0 !! !! !! Equation 60 !! !! !! \\frac{\\partial \\text{ln} \\gamma_i}{\\partial n_j} - !! \\frac{\\partial \\text{ln} \\gamma_j}{\\partial n_i} = 0 !! !! !! Equation 61 !! !! !! \\sum_i^{NC} n_i !! \\frac{\\partial \\text{ln} \\gamma_i}{\\partial n_j} = 0 !! !! !! # Examples !! !! ```fortran !! use yaeos, only: pr !! use yaeos, only: Groups, setup_unifac, UNIFAC !! use yaeos__consistency_gemodel, only: ge_consistency !! !! type(UNIFAC) :: model !! !! integer, parameter :: nc = 4, ng = 4 !! !! type(Groups) :: molecules(nc) !! !! real(pr) :: n(nc), T !! real(pr) :: dt, dn !! !! real(pr) :: eq58, eq59(nc), eq60(nc,nc), eq61(nc) !! !! T = 303.15 !! n = [400.0, 100.0, 300.0, 200.0] !! !! ! Hexane [CH3, CH2] !! molecules(1)%groups_ids = [1, 2] !! molecules(1)%number_of_groups = [2, 4] !! !! ! Ethanol [CH3, CH2, OH] !! molecules(2)%groups_ids = [1, 2, 14] !! molecules(2)%number_of_groups = [1, 1, 1] !! !! ! Toluene [ACH, ACCH3] !! molecules(3)%groups_ids = [9, 11] !! molecules(3)%number_of_groups = [5, 1] !! !! ! Cyclohexane [CH2] !! molecules(4)%groups_ids = [2] !! molecules(4)%number_of_groups = [6] !! !! model = setup_unifac(molecules) !! !! ! ==================================================================== !! ! Consistency tests !! ! -------------------------------------------------------------------- !! call ge_consistency(model, n, t, eq58, eq59, eq60, eq61) !! ``` !! !! # References !! 1. Michelsen, M. L., & Mollerup, J. M. (2007). Thermodynamic models: !! Fundamentals & computational aspects (2. ed). Tie-Line Publications. !! class ( GeModel ), intent ( in ) :: model !! G^E model real ( pr ), intent ( in ) :: n (:) !! Moles number vector real ( pr ), intent ( in ) :: t !! Temperature [K] real ( pr ), optional , intent ( out ) :: eq58 !! MM Eq. 58 real ( pr ), optional , intent ( out ) :: eq59 ( size ( n )) !! MM Eq. 59 real ( pr ), optional , intent ( out ) :: eq60 ( size ( n ), size ( n )) !! MM Eq. 60 real ( pr ), optional , intent ( out ) :: eq61 ( size ( n )) !! MM Eq. 61 real ( pr ) :: Ge , Gen ( size ( n )), Gen2 ( size ( n ), size ( n )) real ( pr ) :: ln_gammas ( size ( n )) integer i , j call model % excess_gibbs ( n , t , Ge = Ge , Gen = Gen , Gen2 = Gen2 ) call model % ln_activity_coefficient ( n , t , ln_gammas ) ! ======================================================================== ! Equation 58 ! ------------------------------------------------------------------------ if ( present ( eq58 )) then eq58 = sum ( n * ln_gammas ) - Ge / R / T end if ! ======================================================================== ! Equation 59 ! ------------------------------------------------------------------------ if ( present ( eq59 )) then eq59 = Gen / R / T - ln_gammas end if ! ======================================================================== ! Equation 60 ! ------------------------------------------------------------------------ if ( present ( eq60 )) then eq60 = 0.0_pr do i = 1 , size ( n ) do j = 1 , size ( n ) eq60 ( i , j ) = Gen2 ( i , j ) / R / T - Gen2 ( j , i ) / R / T end do end do end if ! ======================================================================== ! Equation 61 ! ------------------------------------------------------------------------ if ( present ( eq61 )) then eq61 = 0.0_pr do j = 1 , size ( n ) eq61 ( j ) = sum ( n * Gen2 (:, j ) / R / T ) end do end if end subroutine ge_consistency subroutine numeric_ge_derivatives (& model , n , t , d_n , d_t , Ge , GeT , Gen , GeT2 , GeTn , Gen2 & ) !! # numeric_ge_derivatives !! Numeric G^E model derivatives !! !! # Description !! Tool to facilitate the development of new [[GeModel]] by testing !! the implementation of analytic derivatives. !! !! # Examples !! !! ```fortran !! use yaeos, only: Groups, setup_unifac, UNIFAC !! use yaeos__consistency_gemodel, only: numeric_ge_derivatives !! !! type(UNIFAC) :: model !! !! integer, parameter :: nc = 4, ng = 4 !! !! type(Groups) :: molecules(nc) !! !! real(pr) :: Ge, Gen(nc), GeT, GeT2, GeTn(nc), Gen2(nc, nc) !! real(pr) :: Ge_n, Gen_n(nc), GeT_n, GeT2_n, GeTn_n(nc), Gen2_n(nc, nc) !! real(pr) :: ln_gammas(nc) !! !! real(pr) :: n(nc), T !! real(pr) :: dt, dn !! !! T = 303.15 !! n = [400.0, 100.0, 300.0, 200.0] ! always test with sum(n) > 1 !! !! dt = 0.1_pr !! dn = 0.1_pr !! !! ! Hexane [CH3, CH2] !! molecules(1)%groups_ids = [1, 2] !! molecules(1)%number_of_groups = [2, 4] !! !! ! Ethanol [CH3, CH2, OH] !! molecules(2)%groups_ids = [1, 2, 14] !! molecules(2)%number_of_groups = [1, 1, 1] !! !! ! Toluene [ACH, ACCH3] !! molecules(3)%groups_ids = [9, 11] !! molecules(3)%number_of_groups = [5, 1] !! !! ! Cyclohexane [CH2] !! molecules(4)%groups_ids = [2] !! molecules(4)%number_of_groups = [6] !! !! model = setup_unifac(molecules) !! !! ! ===================================================================== !! ! Call analytic derivatives !! ! --------------------------------------------------------------------- !! call model%excess_gibbs(n, T, Ge, GeT, GeT2, Gen, GeTn, Gen2) !! !! ! ===================================================================== !! ! Call numeric derivatives !! ! --------------------------------------------------------------------- !! call numeric_ge_derivatives(model, n, T, dn, dt, Ge=Ge_n, GeT=GeT_n) !! call numeric_ge_derivatives(model, n, T, dn, dt, Ge=Ge_n, Gen=Gen_n) !! call numeric_ge_derivatives(model, n, T, dn, dt, Ge=Ge_n, GeT2=GeT2_n) !! call numeric_ge_derivatives(model, n, T, dn, dt, Ge=Ge_n, GeTn=GeTn_n) !! call numeric_ge_derivatives(model, n, T, dn, dt, Ge=Ge_n, Gen2=Gen2_n) !! ``` !! class ( GeModel ), intent ( in ) :: model !! G^E model real ( pr ), intent ( in ) :: n (:) !! Moles number vector real ( pr ), intent ( in ) :: t !! Temperature [K] real ( pr ), intent ( in ) :: d_n !! Moles finite difference step real ( pr ), intent ( in ) :: d_t !! Temperature finite difference step real ( pr ), intent ( out ) :: Ge !! Residual Helmoltz energy real ( pr ), optional , intent ( out ) :: GeT !! \\frac{dGe}{dT} real ( pr ), optional , intent ( out ) :: Gen ( size ( n )) !! \\frac{dGe}{dn_i} real ( pr ), optional , intent ( out ) :: GeT2 !! \\frac{d^2Ge}{dT^2} real ( pr ), optional , intent ( out ) :: GeTn ( size ( n )) !! \\frac{d^2Ge}{dTdn_i} real ( pr ), optional , intent ( out ) :: Gen2 ( size ( n ), size ( n )) !! \\frac{d^2Ge}{dn_{ij}} ! Auxiliary real ( pr ) :: Ge_aux1 , Ge_aux2 , Ge_aux3 , Ge_aux4 real ( pr ) :: dn_aux1 ( size ( n )), dn_aux2 ( size ( n )) integer :: i , j ! ======================================================================== ! Ar valuations ! ------------------------------------------------------------------------ ! on point valuation call model % excess_gibbs ( n , t , Ge = Ge ) ! ======================================================================== ! Central numeric derivatives ! ------------------------------------------------------------------------ ! Temperature if ( present ( GeT ) . or . present ( GeT2 )) then call model % excess_gibbs ( n , t + d_t , Ge = Ge_aux1 ) call model % excess_gibbs ( n , t - d_t , Ge = Ge_aux2 ) if ( present ( GeT )) GeT = ( Ge_aux1 - Ge_aux2 ) / ( 2 * d_t ) if ( present ( GeT2 )) GeT2 = ( Ge_aux1 - 2 * Ge + Ge_aux2 ) / d_t ** 2 end if ! Mole first derivatives if ( present ( Gen )) then Gen = 0.0_pr do i = 1 , size ( n ), 1 dn_aux1 = 0.0_pr dn_aux1 ( i ) = d_n call model % excess_gibbs ( n + dn_aux1 , t , Ge = Ge_aux1 ) call model % excess_gibbs ( n - dn_aux1 , t , Ge = Ge_aux2 ) Gen ( i ) = ( Ge_aux1 - Ge_aux2 ) / ( 2 * d_n ) end do end if ! ======================================================================== ! Central cross derivatives ! ------------------------------------------------------------------------ ! Temperature - Mole if ( present ( GeTn )) then GeTn = 0.0_pr do i = 1 , size ( n ), 1 dn_aux1 = 0.0_pr dn_aux1 ( i ) = d_n call model % excess_gibbs ( n + dn_aux1 , t + d_t , Ge = Ge_aux1 ) call model % excess_gibbs ( n + dn_aux1 , t - d_t , Ge = Ge_aux2 ) call model % excess_gibbs ( n - dn_aux1 , t + d_t , Ge = Ge_aux3 ) call model % excess_gibbs ( n - dn_aux1 , t - d_t , Ge = Ge_aux4 ) GeTn ( i ) = & ( Ge_aux1 - Ge_aux2 - Ge_aux3 + Ge_aux4 ) / ( 4 * d_t * d_n ) end do end if ! Mole second derivatives if ( present ( Gen2 )) then Gen2 = 0.0_pr do i = 1 , size ( n ), 1 do j = 1 , size ( n ), 1 if ( i . eq . j ) then dn_aux1 = 0.0_pr dn_aux1 ( i ) = d_n call model % excess_gibbs ( n + dn_aux1 , t , Ge = Ge_aux1 ) call model % excess_gibbs ( n - dn_aux1 , t , Ge = Ge_aux2 ) Gen2 ( i , j ) = ( Ge_aux1 - 2 * Ge + Ge_aux2 ) / d_n ** 2 else dn_aux1 = 0.0_pr dn_aux2 = 0.0_pr dn_aux1 ( i ) = d_n dn_aux2 ( j ) = d_n call model % excess_gibbs ( n + dn_aux1 + dn_aux2 , t , Ge = Ge_aux1 ) call model % excess_gibbs ( n + dn_aux1 - dn_aux2 , t , Ge = Ge_aux2 ) call model % excess_gibbs ( n - dn_aux1 + dn_aux2 , t , Ge = Ge_aux3 ) call model % excess_gibbs ( n - dn_aux1 - dn_aux2 , t , Ge = Ge_aux4 ) Gen2 ( i , j ) = & ( Ge_aux1 - Ge_aux2 - Ge_aux3 + Ge_aux4 ) / ( 4 * d_n ** 2 ) end if end do end do end if end subroutine numeric_ge_derivatives end module yaeos__consistency_gemodel","tags":"","loc":"sourcefile/consistency_gemodel.f90.html"},{"title":"model_parameters.f90 – yaeos","text":"Source Code module yaeos__models_ge_group_contribution_model_parameters !! # G^E group contribution model parameters !! G^E group contribution model parameters module. !! !! # Description !! This module contrains the GeGCModelParameters type that allows to store !! the subgroups ids, maingroups ids, subgroups Rs, subgroups Qs, !! subgroups maingroups, and maingroups interaction parameters for UNIFAC !! like models (UNIFAC, LL-UNIFAC, Dortmund UNIFAC, PSRK, etc) !! use yaeos__constants , only : pr implicit none type :: GeGCModelParameters !! # GeGCModelParameters !! G^E group contribution model parameters container !! !! # Description !! Type to represent a UNIFAC like models parameters. The type must be !! provided with the subgroups ids, maingroups ids, subgroups Rs, !! subgroups Qs, subgroups maingroups, and maingroups interaction !! parameters. Specifically, the type requires a_{ij}, b_{ij}, and !! c_{ij} for the maingroups interaction parameters. In the case of !! the classic UNIFAC model that only requires a_{ij} parameters, the !! b_{ij} and c_{ij} must be set as null matrixes. !! The documentation and source code of `yaeos` [[UNIFACParameters]] !! function could be consulted to understand how to instantiate a !! [[GeGCModelParameters]] object with the classic liquid-vapor UNIFAC !! parameters defined in DDBST. !! !! # References !! 1. [Dortmund Data Bank Software & Separation Technology](https://www.dd !! bst.com/published-parameters-unifac.html) !! integer , allocatable :: subgroups_ids (:) !! ID of each model's subgroup integer , allocatable :: maingroups_ids (:) !! ID of each model's maingroup integer , allocatable :: subgroups_maingroups (:) !! Maingroup of each subgroup real ( pr ), allocatable :: subgroups_Rs (:) !! R value of each subgroup real ( pr ), allocatable :: subgroups_Qs (:) !! Q value of each subgroup real ( pr ), allocatable :: maingroups_aij (:,:) !! Maingroup a_{ij} interaction parameters matrix real ( pr ), allocatable :: maingroups_bij (:,:) !! Maingroup b_{ij} interaction parameters matrix real ( pr ), allocatable :: maingroups_cij (:,:) !! Maingroup c_{ij} interaction parameters matrix contains procedure :: get_subgroup_index => get_subgroup_index procedure :: get_maingroup_index => get_maingroup_index procedure :: get_subgroup_maingroup => get_subgroup_maingroup procedure :: get_subgroup_R => get_subgroup_R procedure :: get_subgroup_Q => get_subgroup_Q procedure :: get_maingroups_aij => get_maingroups_aij procedure :: get_maingroups_bij => get_maingroups_bij procedure :: get_maingroups_cij => get_maingroups_cij procedure :: get_subgroups_aij => get_subgroups_aij procedure :: get_subgroups_bij => get_subgroups_bij procedure :: get_subgroups_cij => get_subgroups_cij end type GeGCModelParameters contains function get_subgroup_index ( self , subgroup_id ) result ( subgroup_idx ) !! # get_subgroup_index !! Get index of the subgroup with id: `subgroup_id` !! !! # Description !! Get index of the subgroup with id: `subgroup_id`. Gets the index of the !! subgroup in the `self%subgroups_ids` vector. !! !! # Examples !! !! ```fortran !! use yaeos__models_ge_group_contribution_unifac_parameters, only: UNIFACParameters !! use yaeos__models_ge_group_contribution_model_parameters, only: GeGCModelParameters !! !! type(GeGCModelParameters) :: parameters !! !! ! Default parameters of UNIFAC (ddbst) !! parameters = UNIFACParameters() !! !! ! Get index of the subgroup with id 178 (IMIDAZOL) !! print *, parameters%get_subgroup_index(178) ! Will print: 112 !! ``` !! !! # References !! 1. [Dortmund Data Bank Software & Separation Technology](https://www.dd !! bst.com/published-parameters-unifac.html) !! class ( GeGCModelParameters ) :: self integer , intent ( in ) :: subgroup_id !! ID of the subgroup integer :: subgroup_idx !! Index of the subgroup on the `self%subgroups_ids` vector subgroup_idx = findloc ( self % subgroups_ids , subgroup_id , dim = 1 ) end function get_subgroup_index function get_maingroup_index ( self , maingroup_id ) result ( maingroup_idx ) !! # get_maingroup_index !! Get index of the maingoup with id: `maingoup_id` !! !! # Description !! Get index of the maingoup with id: `maingoup_id`. Gets the index of the !! maingoup in the `self%maingoups_ids` vector. !! !! # Examples !! !! ```fortran !! use yaeos__models_ge_group_contribution_unifac_parameters, only: UNIFACParameters !! use yaeos__models_ge_group_contribution_model_parameters, only: GeGCModelParameters !! !! type(GeGCModelParameters) :: parameters !! !! parameters = UNIFACParameters() !! !! ! Get index of the maingroup with id 55 (Sulfones: [118](CH2)2SU [119]CH2CHSU) !! print *, parameters%get_maingroup_index(55) ! Will print: 52 !! ``` !! !! # References !! 1. [Dortmund Data Bank Software & Separation Technology](https://www.dd !! bst.com/published-parameters-unifac.html) !! class ( GeGCModelParameters ) :: self integer , intent ( in ) :: maingroup_id !! ID of the subgroup integer :: maingroup_idx !! Index of the maingroup on the `self%maingroups_ids` vector maingroup_idx = findloc ( self % maingroups_ids , maingroup_id , dim = 1 ) end function get_maingroup_index function get_subgroup_maingroup ( self , subgroup_id ) result ( subgroup_maingroup ) !! # get_subgroup_maingroup !! Get the subgroup's maingroup !! !! # Description !! Uses the `self%subgroups_maingroups` attribute to locate the maingroup !! where the subgroup with id `subgroup_id` belongs !! !! # Examples !! !! ```fortran !! use yaeos__models_ge_group_contribution_unifac_parameters, only: UNIFACParameters !! use yaeos__models_ge_group_contribution_model_parameters, only: GeGCModelParameters !! !! type(GeGCModelParameters) :: parameters !! !! parameters = UNIFACParameters() !! !! ! Get the maingroup of the subgroup with id 16 (H2O) !! print *, parameters%get_subgroup_maingroup(16) ! Will print: 7 !! ``` !! !! # References !! 1. [Dortmund Data Bank Software & Separation Technology](https://www.dd !! bst.com/published-parameters-unifac.html) !! class ( GeGCModelParameters ) :: self integer , intent ( in ) :: subgroup_id !! ID of the subgroup integer :: subgroup_maingroup !! Maingroup of the subgroup integer :: subgroup_idx subgroup_idx = self % get_subgroup_index ( subgroup_id ) subgroup_maingroup = self % subgroups_maingroups ( subgroup_idx ) end function get_subgroup_maingroup function get_subgroup_R ( self , subgroup_id ) result ( subgroup_R ) !! # get_subgroup_R !! Get the subgroup's R value !! !! # Description !! Uses the `self%subgroups_Rs` attribute to locate the subgroup R !! value. !! !! # Examples !! !! ```fortran !! use yaeos__models_ge_group_contribution_unifac_parameters, only: UNIFACParameters !! use yaeos__models_ge_group_contribution_model_parameters, only: GeGCModelParameters !! !! type(GeGCModelParameters) :: parameters !! !! parameters = UNIFACParameters() !! !! ! Get the subgroup, with id 1 (CH3), R value !! print *, parameters%get_subgroup_R(1) ! Will print: 0.9011 !! ``` !! !! # References !! 1. [Dortmund Data Bank Software & Separation Technology](https://www.dd !! bst.com/published-parameters-unifac.html) !! class ( GeGCModelParameters ) :: self integer , intent ( in ) :: subgroup_id !! ID of the subgroup real ( pr ) :: subgroup_R !! R value of the subgroup integer :: subgroup_idx subgroup_idx = self % get_subgroup_index ( subgroup_id ) subgroup_R = self % subgroups_Rs ( subgroup_idx ) end function get_subgroup_R function get_subgroup_Q ( self , subgroup_id ) result ( subgroup_Q ) !! # get_subgroup_Q !! Get the subgroup's Q value !! !! # Description !! Uses the `self%subgroups_Qs` attribute to locate the subgroup Q !! value. !! !! # Examples !! !! ```fortran !! use yaeos__models_ge_group_contribution_unifac_parameters, only: UNIFACParameters !! use yaeos__models_ge_group_contribution_model_parameters, only: GeGCModelParameters !! !! type(GeGCModelParameters) :: parameters !! !! parameters = UNIFACParameters() !! !! ! Get the subgroup, with id 1 (CH3), Q value !! print *, parameters%get_subgroup_Q(1) ! Will print: 0.8480 !! ``` !! !! # References !! 1. [Dortmund Data Bank Software & Separation Technology](https://www.dd !! bst.com/published-parameters-unifac.html) !! class ( GeGCModelParameters ) :: self integer , intent ( in ) :: subgroup_id !! ID of the subgroup real ( pr ) :: subgroup_Q !! Q value of the subgroup integer :: subgroup_idx subgroup_idx = self % get_subgroup_index ( subgroup_id ) subgroup_Q = self % subgroups_Qs ( subgroup_idx ) end function get_subgroup_Q function get_maingroups_aij ( self , maingroup_i_id , maingroup_j_id ) result ( aij ) !! # get_maingroups_aij !! Get the interaction parameter a_{ij} !! !! # Description !! Get the interaction parameter a_{ij} of the maingroups `i` and `j` !! ids. !! !! # Examples !! !! ```fortran !! use yaeos__models_ge_group_contribution_unifac_parameters, only: UNIFACParameters !! use yaeos__models_ge_group_contribution_model_parameters, only: GeGCModelParameters !! !! type(GeGCModelParameters) :: parameters !! !! parameters = UNIFACParameters() !! !! ! Get the maingroups i:1, j:7 interaction parameter aij (CH2-H2O) !! print *, parameters%get_maingroups_aij(1, 7) ! prints: 1318.0000 !! ``` !! !! # References !! 1. [Dortmund Data Bank Software & Separation Technology](https://www.dd !! bst.com/published-parameters-unifac.html) !! class ( GeGCModelParameters ) :: self integer , intent ( in ) :: maingroup_i_id !! ID of the maingroup `i` integer , intent ( in ) :: maingroup_j_id !! ID of the maingroup `j` real ( pr ) :: aij !! Interaction parameter a_{ij} integer :: i , j i = self % get_maingroup_index ( maingroup_i_id ) j = self % get_maingroup_index ( maingroup_j_id ) aij = self % maingroups_aij ( i , j ) end function get_maingroups_aij function get_maingroups_bij ( self , maingroup_i_id , maingroup_j_id ) result ( bij ) !! # get_maingroups_bij !! Get the interaction parameter b_{ij} !! !! # Description !! Get the interaction parameter b_{ij} of the maingroups `i` and `j` !! ids. !! !! # Examples !! !! ```fortran !! use yaeos__models_ge_group_contribution_unifac_parameters, only: UNIFACParameters !! use yaeos__models_ge_group_contribution_model_parameters, only: GeGCModelParameters !! !! type(GeGCModelParameters) :: parameters !! !! parameters = UNIFACParameters() !! !! ! Get the maingroups i:1, j:7 interaction parameter bij (CH2-H2O) !! print *, parameters%get_maingroups_bij(1, 7) ! prints: 0.0 !! ``` !! !! In the example we obtain 0.0 because UNIFAC only have a_{ij} !! parameters !! !! # References !! 1. [Dortmund Data Bank Software & Separation Technology](https://www.dd !! bst.com/published-parameters-unifac.html) !! class ( GeGCModelParameters ) :: self integer , intent ( in ) :: maingroup_i_id !! ID of the maingroup `i` integer , intent ( in ) :: maingroup_j_id !! ID of the maingroup `j` real ( pr ) :: bij !! Interaction parameter b_{ij} integer :: i , j i = self % get_maingroup_index ( maingroup_i_id ) j = self % get_maingroup_index ( maingroup_j_id ) bij = self % maingroups_bij ( i , j ) end function get_maingroups_bij function get_maingroups_cij ( self , maingroup_i_id , maingroup_j_id ) result ( cij ) !! # get_maingroups_cij !! Get the interaction parameter c_{ij} !! !! # Description !! Get the interaction parameter c_{ij} of the maingroups `i` and `j` !! ids. !! !! # Examples !! !! ```fortran !! use yaeos__models_ge_group_contribution_unifac_parameters, only: UNIFACParameters !! use yaeos__models_ge_group_contribution_model_parameters, only: GeGCModelParameters !! !! type(GeGCModelParameters) :: parameters !! !! parameters = UNIFACParameters() !! !! ! Get the maingroups i:1, j:7 interaction parameter cij (CH2-H2O) !! print *, parameters%get_maingroups_cij(1, 7) ! prints: 0.0 !! ``` !! !! In the example we obtain 0.0 because UNIFAC only have a_{ij} !! parameters !! !! # References !! 1. [Dortmund Data Bank Software & Separation Technology](https://www.dd !! bst.com/published-parameters-unifac.html) !! class ( GeGCModelParameters ) :: self integer , intent ( in ) :: maingroup_i_id !! ID of the maingroup `i` integer , intent ( in ) :: maingroup_j_id !! ID of the maingroup `j` real ( pr ) :: cij !! Interaction parameter c_{ij} integer :: i , j i = self % get_maingroup_index ( maingroup_i_id ) j = self % get_maingroup_index ( maingroup_j_id ) cij = self % maingroups_cij ( i , j ) end function get_maingroups_cij function get_subgroups_aij ( self , subgroup_i_id , subgroup_j_id ) result ( aij ) !! # get_subgroups_aij !! Get the interaction parameter a_{ij} !! !! # Description !! Get the interaction parameter a_{ij} of the subgroups `i` and `j` !! ids. !! !! # Examples !! !! ```fortran !! use yaeos__models_ge_group_contribution_unifac_parameters, only: UNIFACParameters !! use yaeos__models_ge_group_contribution_model_parameters, only: GeGCModelParameters !! !! type(GeGCModelParameters) :: parameters !! !! parameters = UNIFACParameters() !! !! ! Get the subgroups i:1, j:16 interaction parameter aij (CH3-H2O) !! ! with maingroups 1 and 7 respectively. !! print *, parameters%get_subgroups_aij(1, 16) ! prints: 1318.0000 !! ``` !! !! # References !! 1. [Dortmund Data Bank Software & Separation Technology](https://www.dd !! bst.com/published-parameters-unifac.html) !! class ( GeGCModelParameters ) :: self integer , intent ( in ) :: subgroup_i_id !! ID of the subgroup `i` integer , intent ( in ) :: subgroup_j_id !! ID of the subgroup `j` real ( pr ) :: aij !! Interaction parameter a_{ij} integer :: mi_id , mj_id , i , j mi_id = self % get_subgroup_maingroup ( subgroup_i_id ) mj_id = self % get_subgroup_maingroup ( subgroup_j_id ) i = self % get_maingroup_index ( mi_id ) j = self % get_maingroup_index ( mj_id ) aij = self % maingroups_aij ( i , j ) end function get_subgroups_aij function get_subgroups_bij ( self , subgroup_i_id , subgroup_j_id ) result ( bij ) !! # get_subgroups_bij !! Get the interaction parameter b_{ij} !! !! # Description !! Get the interaction parameter b_{ij} of the subgroups `i` and `j` !! ids. !! !! # Examples !! !! ```fortran !! use yaeos__models_ge_group_contribution_unifac_parameters, only: UNIFACParameters !! use yaeos__models_ge_group_contribution_model_parameters, only: GeGCModelParameters !! !! type(GeGCModelParameters) :: parameters !! !! parameters = UNIFACParameters() !! !! ! Get the subgroups i:1, j:16 interaction parameter bij (CH3-H2O) !! ! with maingroups 1 and 7 respectively. !! print *, parameters%get_subgroups_bij(1, 16) ! prints: 0.0000 !! ``` !! !! In the example we obtain 0.0 because UNIFAC only have a_{ij} !! parameters !! !! # References !! 1. [Dortmund Data Bank Software & Separation Technology](https://www.dd !! bst.com/published-parameters-unifac.html) !! class ( GeGCModelParameters ) :: self integer , intent ( in ) :: subgroup_i_id !! ID of the subgroup `i` integer , intent ( in ) :: subgroup_j_id !! ID of the subgroup `j` real ( pr ) :: bij !! Interaction parameter b_{ij} integer :: mi_id , mj_id , i , j mi_id = self % get_subgroup_maingroup ( subgroup_i_id ) mj_id = self % get_subgroup_maingroup ( subgroup_j_id ) i = self % get_maingroup_index ( mi_id ) j = self % get_maingroup_index ( mj_id ) bij = self % maingroups_bij ( i , j ) end function get_subgroups_bij function get_subgroups_cij ( self , subgroup_i_id , subgroup_j_id ) result ( cij ) !! # get_subgroups_cij !! Get the interaction parameter c_{ij} !! !! # Description !! Get the interaction parameter c_{ij} of the subgroups `i` and `j` !! ids. !! !! # Examples !! !! ```fortran !! use yaeos__models_ge_group_contribution_unifac_parameters, only: UNIFACParameters !! use yaeos__models_ge_group_contribution_model_parameters, only: GeGCModelParameters !! !! type(GeGCModelParameters) :: parameters !! !! parameters = UNIFACParameters() !! !! ! Get the subgroups i:1, j:16 interaction parameter cij (CH3-H2O) !! ! with maingroups 1 and 7 respectively. !! print *, parameters%get_subgroups_cij(1, 16) ! prints: 0.0000 !! ``` !! !! In the example we obtain 0.0 because UNIFAC only have a_{ij} !! parameters !! !! # References !! 1. [Dortmund Data Bank Software & Separation Technology](https://www.dd !! bst.com/published-parameters-unifac.html) !! class ( GeGCModelParameters ) :: self integer , intent ( in ) :: subgroup_i_id !! ID of the subgroup `i` integer , intent ( in ) :: subgroup_j_id !! ID of the subgroup `j` real ( pr ) :: cij !! Interaction parameter c_{ij} integer :: mi_id , mj_id , i , j mi_id = self % get_subgroup_maingroup ( subgroup_i_id ) mj_id = self % get_subgroup_maingroup ( subgroup_j_id ) i = self % get_maingroup_index ( mi_id ) j = self % get_maingroup_index ( mj_id ) cij = self % maingroups_cij ( i , j ) end function get_subgroups_cij end module yaeos__models_ge_group_contribution_model_parameters","tags":"","loc":"sourcefile/model_parameters.f90.html"},{"title":"base.f90 – yaeos","text":"Source Code module yaeos__models_base !! Basic element of a thermodynamic model. use yaeos__substance , only : Substances implicit none type , abstract :: BaseModel !! Base model type. !! !! Contains the important parts of most models and other procedures. type ( Substances ) :: components !! Substances contained in the module end type end module","tags":"","loc":"sourcefile/base.f90~2.html"},{"title":"User documentation – yaeos","text":"Welcome to yaeos user documentation yaeos is a Fortran library that handles thermodynamic Equations of State-based\ncalculations, mostly phase-equilibria related ones and properties estimation\nones. This is a work-in-progress library (and documentation) so don’t hesisate to\nreport any problem/requirement as an issue in our GitHub\npage . Basic usage The base object that represents most of yaeos functionality is the ArModel object, which holds the basic interface of how a $A_r$ model behaves. Since all the properties that yaeos calculates are based on residual Helmholtz\nenergy, once the object is set-up all the library functionality is available. use yaeos class ( ArModel ), allocatable :: model ! Variable that holds the model ! A setup function that returns a setted model model = setup_model ( < the properties that define a model > ) ! Once the model is set up, the user has access to the properties call pressure ( model , V , T , P , dPdN = dPdN )","tags":"","loc":"page/index.html"},{"title":"Using yaeos – yaeos","text":"Getting started Fortran Getting yaeos Setting up a model Calculating thermodynamic properties Phase equilibria Getting started Fortran Maybe you’ve heard of Fortran as that old and cryptic language that everyone is\nafraid of. Well, not anymore! Fortran is really easy to understand and has been\nupdated a lot in the recent decades. There is a fairly direct guide on the fortran-lang site Getting yaeos yaeos is a Fortran library intended to be used as a fpm package, fpm can be easily easily obtained with\nthe Python package manager pip with a simple: pip install --user fpm With fpm installed you can create a new Fortran project by running: fpm new your_project_name A new directory with the name of your project will be created. You include yaeos in your fpm project by adding it as a dependency on your fpm.toml file by adding this: [dependencies] stdlib = \"*\" yaeos = { git = \"https://github.com/ipqa-research/yaeos\" } Or maybe you want a specific version: [dependencies] stdlib = \"*\" yaeos = { git = \"https://github.com/ipqa-research/yaeos\" , tag = \"0.1.0b2\" } Setting up a model On yaeos there is a series of models implemented, right now we include\nResidual Helmholtz energy models (like Cubic Equations of State), but plan on\nextening to a broader variety. In this example we’ll show how a model in yaeos can be used. We’ll take\nthe Peng-Robinson equation of state as an example, but all the implemented\nmodels can be seen at yaeos__models . Inside\nyour app/main.f90 file use program main use yaeos ! Set the variable `model` as a generic `ArModel` class ( ArModel ), allocatable :: model ! Set the the variables that we're going to use ! as variable lenght arrays real ( pr ), allocatable :: n (:), tc (:), pc (:), w (:) n = [ 0.3 , 0.7 ] ! Number of moles of each component tc = [ 190 , 310 ] ! Critical temperatures pc = [ 14 , 30 ] ! Critical pressures w = [ 0.001 , 0.03 ] ! Acentric factors ! Now we set our model as the PengRobinson76 ! Equation of state. model = PengRobinson76 ( tc , pc , w ) end program And then it’s all set, now we’ve set the model variable to use in our\ncalculations Calculating thermodynamic properties Some thermodynamic properties can be calculated with yaeos models, and we’re\nadding more! In this example we’ll calculate a PV isotherm from our previously\ndefined model. For the sake of simplicity all the next code blocks are assumed\nto be extensions of the previous one, before the end program sentence. pv_isotherm : block real ( pr ) :: v , t , p ! Thermodynamic variables real ( pr ) :: v0 , vf , dv ! End and start volumes integer :: i , n_points ! iteration variable and how many points to calc v0 = 0.001 vf = 10 dv = ( vf - v0 ) / n_points do i = 1 , n_points v = v0 + i * dv ! Set new volume point call pressure ( model , n , v , t , p ) ! Calculate pressure print * , v , p end do end block pv_isotherm Also some useful derivatives are available when calculating each property, they\ncan be easily accessed as optional arguments of the routine. For example, to \nobtain the derivative of pressure with respect to volume the line that\ncalculates pressure should be changed to: call pressure ( model , n , v , t , p , dpdv = dpdv ) ! Calculate pressure and dPdV The available thermodynamic properties to calculate can be seen at the yaeos__thermoprops module. Phase equilibria","tags":"","loc":"page/usage/index.html"},{"title":"Equations of State – yaeos","text":"yaeos is a library based on Equation-of-State calculations.","tags":"","loc":"page/usage/eos/index.html"},{"title":"Cubics – yaeos","text":"** Table of contents**\n[TOC] SoaveRedlichKwong PengRobinson76 PengRobinson78 RKPR","tags":"","loc":"page/usage/eos/cubics/index.html"},{"title":"Alpha functions – yaeos","text":"","tags":"","loc":"page/usage/eos/cubics/alpha.html"},{"title":"Mixing Rules – yaeos","text":"Cubic Mixing Rules All CubicEoS in yaeos include a CubicMixRule derived type, which \nhandles how the and parameters in the CubicEoS are calculated. Quadratic Mixing Rules (QMR) Quadratic mixing rules are the ussually most used mixing rules for cubic \nequations of state. QMR are handled by the QMR derived type. Which can be used like: use yaeos , only : pr , QMR type ( QMR ) :: mixrule real ( pr ) :: kij ( 2 , 2 ), lij ( 2 , 2 ) kij ( 1 , :) = [ 0.0 , 0.1 ] kij ( 2 , :) = [ 0.1 , 0.0 ] lij ( 1 , :) = [ 0.0 , 0.01 ] lij ( 2 , :) = [ 0.01 , 0.0 ] mixrule = QMR ( k = kij , l = lij ) By default the matrix will be calculated with a constant value (as shown below). But this functionality can be modified by replacing\nthe get_aij procedure use yaeos , only : pr , QMR type ( QMR ) :: mixrule real ( pr ) :: kij ( 2 , 2 ), lij ( 2 , 2 ) kij ( 1 , :) = [ 0.0 , 0.1 ] kij ( 2 , :) = [ 0.1 , 0.0 ] lij ( 1 , :) = [ 0.0 , 0.01 ] lij ( 2 , :) = [ 0.01 , 0.0 ] mixrule = QMR ( k = kij , l = lij ) mixrule % get_aij => my_aij_implementation subroutine my_aij_implementation ( self , ai , daidt , daidt2 , aij , daijdt , daijdt2 ) class ( QMR ) :: self real ( pr ), intent ( in ) :: ai (:), daidt (:), daidt2 (:) real ( pr ), intent ( out ) :: aij (:, :), daijdt (:, .), daijdt2 (:, :) ! Implementation here end subroutine Constant Models Mixing Rules Michelsen’s Modified Huron-Vidal Mixing Rules","tags":"","loc":"page/usage/eos/cubics/mixing.html"},{"title":"Gibbs Excess Models – yaeos","text":"Explain thermoprops of Ge models here","tags":"","loc":"page/usage/excessmodels/index.html"},{"title":"NRTL – yaeos","text":"","tags":"","loc":"page/usage/excessmodels/nrtl.html"},{"title":"UNIFAC-LV – yaeos","text":"UNIFAC UNIFAC (UNIQUAC Functional-group Activity Coefficients) is an Excess Gibbs\nfree energy model used to estimate activity coefficients in non-ideal mixtures.\nIt is particularly useful for predicting the phase behavior of chemical\nmixtures, including liquid-liquid equilibrium (LLE) and vapor-liquid\nequilibrium (VLE). In this model the Excess Gibbs free energy is calculated\nfrom the contribution of a combinatorial term and a residual term. Being: Combinatorial: Accounts for the size and shape of the molecules. The involved\nequations can be checked in the API documentation: Ge_combinatorial Residual: Accounts for the energy interactions between different functional\ngroups. The involved equations can be checked in the API documentation: Ge_residual Each substance of a mixture modeled with UNIFAC must be represented by a\nlist a functional groups and other list with the ocurrence of each functional\ngroup on the substance. The list of the functional groups culd be accesed on\nthe DDBST web page: https://www.ddbst.com/published-parameters-unifac.html Examples Calculating activity coefficients We can instantiate a UNIFAC model with a mixture ethanol-water and\nevaluate the logarithm of activity coefficients of the model for a 0.5 mole\nfraction of each, and a temperature of 298.0 K. use yaeos__constants , only : pr use yaeos__models_ge_group_contribution_unifac , only : Groups , UNIFAC , setup_unifac ! Variables declarations type ( UNIFAC ) :: model type ( Groups ) :: molecules ( 2 ) real ( pr ) :: ln_gammas ( 2 ) ! Variables instances ! Ethanol definition [CH3, CH2, OH] molecules ( 1 )% groups_ids = [ 1 , 2 , 14 ] ! Subgroups ids molecules ( 1 )% number_of_groups = [ 1 , 1 , 1 ] ! Subgroups occurrences ! Water definition [H2O] molecules ( 2 )% groups_ids = [ 16 ] molecules ( 2 )% number_of_groups = [ 1 ] ! Model setup model = setup_unifac ( molecules ) ! Calculate ln_gammas call model % ln_activity_coefficient ([ 0.5_pr , 0.5_pr ], 29 8.0_pr , ln_gammas ) print * , ln_gammas You will obtain: >>> 0.18534142000449058 0.40331395945417559 References Dortmund Data Bank Software & Separation Technology Fredenslund, A., Jones, R. L., & Prausnitz, J. M. (1975). Group‐contribution\nestimation of activity coefficients in nonideal liquid mixtures. AIChE Journal,\n21(6), 1086–1099. https://doi.org/10.1002/aic.690210607 Skjold-Jorgensen, S., Kolbe, B., Gmehling, J., & Rasmussen, P. (1979).\nVapor-Liquid Equilibria by UNIFAC Group Contribution. Revision and Extension.\nIndustrial & Engineering Chemistry Process Design and Development, 18(4),\n714–722. https://doi.org/10.1021/i260072a024 Gmehling, J., Rasmussen, P., & Fredenslund, A. (1982). Vapor-liquid\nequilibriums by UNIFAC group contribution. Revision and extension. 2.\nIndustrial & Engineering Chemistry Process Design and Development, 21(1),\n118–127. https://doi.org/10.1021/i200016a021 Macedo, E. A., Weidlich, U., Gmehling, J., & Rasmussen, P. (1983).\nVapor-liquid equilibriums by UNIFAC group contribution. Revision and extension. Industrial & Engineering Chemistry Process Design and Development, 22(4),\n676–678. https://doi.org/10.1021/i200023a023 Tiegs, D., Rasmussen, P., Gmehling, J., & Fredenslund, A. (1987).\nVapor-liquid equilibria by UNIFAC group contribution. 4. Revision and\nextension. Industrial & Engineering Chemistry Research, 26(1), 159–161. https://doi.org/10.1021/ie00061a030 Hansen, H. K., Rasmussen, P., Fredenslund, A., Schiller, M., & Gmehling, J.\n(1991). Vapor-liquid equilibria by UNIFAC group contribution. 5. Revision and\nextension. Industrial & Engineering Chemistry Research, 30 (10), 2352–2355. https://doi.org/10.1021/ie00058a017 Wittig, R., Lohmann, J., & Gmehling, J. (2003). Vapor−Liquid Equilibria by\nUNIFAC Group Contribution. 6. Revision and Extension. Industrial & Engineering\nChemistry Research, 42(1), 183–188. https://doi.org/10.1021/ie020506l SINTEF - Thermopack","tags":"","loc":"page/usage/excessmodels/unifaclv.html"},{"title":"Phase Equilibrium – yaeos","text":"Phase Equilibria calculations are fundamental for the majority of EoS based\nmodelling either for processes or when studying phase-behaviour. In yaeos most of phase-equilibria procedures return the EquilibriaState type EquilibriaState , which holds all the relevant information of an\nequilibria point. The implemented methods, and their usage are: Flash calculations Saturation points Phase envelopes Flash calculations Flash calcuations are one of the most used phase-equilibria calculations during\nmodelling of processes. In yaeos it is possible to make Flash calculations either specifying: type ( EquilibriaState ) :: result ! zPT flash result = flash ( model , z , p_spec = P , T = T ) ! zVT flash result = flash ( model , z , v_spec = P , T = T ) ! It is possible to provide initialization compositions in terms of the ! K-factors. Where k0=y/x result = flash ( model , z , v_spec = P , T = T , k0 = k0 ) Saturation points Single saturation point calculations are included with the procedures saturation_pressure and saturation_temperature . Both procedures solve\nthe equation With a newton procedure with respect to the desired variable (either or . type ( EquilibriaState ) :: sat_point sat = saturation_pressure ( model , z , T = T , kind = \"bubble\" ) sat = saturation_pressure ( model , z , T = T , kind = \"dew\" ) sat = saturation_temperature ( model , z , P = P , kind = \"bubble\" ) sat = saturation_temperature ( model , z , P = P , kind = \"dew\" ) Phase envelopes Phase envelopes are the conection of all the saturation points of a system.\nWhen the interest is in calculating a whole phase diagram instead of a single\npoint, or the point is hard to converge. It is better to use a robust\nmathematical algorithm that eases the calcuation providing an easy-to-converge\npoint and using its information to initialize a next one and continue along the\nwhole phase-boundary. This can be done with the procedure pt_envelope_2ph type ( PTEnvel2 ) :: env sat = saturation_pressure ( model , z , T = 15 0._pr , kind = \"bubble\" ) env = pt_envelope_2ph ( model , z , sat )","tags":"","loc":"page/usage/phase_equilibrium/index.html"},{"title":"Phase envelopes – yaeos","text":"Two-phase envelopes Two-phase envelopes show all the saturation points of a mixture, they can\nbe seen as the boundary line of transition between monophasic regions to \ntwo-phase equilibria regions. In yaeos it is possible to calculate two-phase of different kinds. Isoplets Isoplets Isoplets are the phase boundaries at constant composition \n(the global composition) of the system. Here is a simple example with\ncommentaries on how a phase boundary can be calculated: program phase_diagram !! Program for calculation of phase diagrams. use forsus , only : Substance , forsus_dir , forsus_default_dir use yaeos , only : pr , & SoaveRedlichKwong , PengRobinson76 , PengRobinson78 , RKPR , & EquilibriaState , ArModel , PTEnvel2 , & pt_envelope_2ph , saturation_pressure , saturation_temperature use yaeos__phase_equilibria_auxiliar , only : k_wilson implicit none ! =========================================================================== ! Variables definition ! --------------------------------------------------------------------------- integer , parameter :: nc = 2 class ( ArModel ), allocatable :: model ! Thermodynamic model to be used type ( EquilibriaState ) :: sat_point ! Init type ( PTEnvel2 ) :: envelope ! PT Phase envelope real ( pr ) :: tc ( nc ), pc ( nc ), w ( nc ) ! Component's critical constants real ( pr ) :: n ( nc ) ! Termodynamic variables type ( Substance ) :: sus ( nc ) ! Substances to use ! =========================================================================== ! forsus database directory forsus_dir = \"build/dependencies/forsus/\" // forsus_default_dir ! Find the selected substances on the database and extract their ! critical constants sus ( 1 ) = Substance ( \"methane\" ) sus ( 2 ) = Substance ( \"n-hexane\" ) call get_critical_constants ( sus , tc , pc , w ) ! Model definition model = PengRobinson76 ( tc , pc , w ) ! Composition vector n = [ 0.9_pr , 0.1_pr ] ! Calculate a dew point at low pressure to later ! initialize the phase envelope sat_point = saturation_temperature ( model , n , P = 1._pr , kind = \"dew\" , t0 = 15 0._pr ) ! Calculate phase envelope envelope = pt_envelope_2ph ( model , n , sat_point ) ! Write the phase envelope to screen write ( * , * ) envelope contains subroutine get_critical_constants ( subs , tc_in , pc_in , w_in ) type ( Substance ) :: subs (:) real ( pr ), intent ( out ) :: tc_in (:), pc_in (:), w_in (:) tc_in = subs % critical % critical_temperature % value pc_in = subs % critical % critical_pressure % value / 1e5 w_in = subs % critical % acentric_factor % value end subroutine end program phase_diagram The output of the write command will be pre-formatted. Showing in tabular\ndata with this # PTEnvel2\n\n# kind of sat point\nkind T P [liquid-phase composition vector] [gas-phase composition vector]\n\n# other kind of sat point\nkind T P [liquid-phase composition vector] [gas-phase composition vector]\n\n# Critical\nT P Which when plotted with gnuplot with: plot \"outfile\" \\ index \"dew\" u 2 : 3 w l title \"Dew\" , \\ \"\" index \"bubble\" u 2 : 3 w l t \"Bubble\" , \\ \"\" index \"Critical\" u 1 : 2 w p pt 7 lc rgb \"black\" t \"CP\" Gives the following plot:","tags":"","loc":"page/usage/phase_equilibrium/envelopes.html"},{"title":"Flash calculations – yaeos","text":"","tags":"","loc":"page/usage/phase_equilibrium/flash.html"},{"title":"Saturation Points – yaeos","text":"","tags":"","loc":"page/usage/phase_equilibrium/saturation_points.html"},{"title":"Adding your own models – yaeos","text":"Most of thermodynamic properties calculated in yaeos heavily depend on\ndifferent kind of models and their respective derivatives. Since obtaining the\nderivatives of complex models can be a tedious and error-prone task. We provide\ntwo different ways of getting them automatically (in some cases with some\nperformance-cost), but there is also the possibility of using analytical\nobtained expressions instead. The calculation of thermodynamic properties heavily depends on On yaeos there are three different ways of adding your own model:W Residual Helmholtz models Residual Helmholtz models Residual Helmholtz models are the basis to obtain the residual properties. The main basis in yaeos to define a new object that extends the abstract\ntype called` ArModel . Which enforces the expected functionality of this\nkind of models. use yaeos , only : ArModel type , extends ( ArModel ) :: MyNewModel end type The definition of an ArModel expects that two procedures are defined: abs_residual_helmholtz : Procedure to calculate residual\n Helmholtz energy and it’s derivatives abs_volume_initializer : Volume initializer to find a liquid\n root, given a pressure and temperature. use yaeos , only : ArModel type , extends ( ArModel ) :: MyNewModel contains procedure :: residual_helmholtz => an_Ar_implementation procedure :: volume_initializer => an_v0_implementation end type Satisfying those requirements, our model will be ready to make calculations! use yaeos , only : pressure use my_model , only : MyNewModel type ( MyNewModel ) :: model ! Assuming model parameters are set-up call pressure ( model , n , V , T , P )","tags":"","loc":"page/usage/newmodels/index.html"},{"title":"Analytical derivatives – yaeos","text":"","tags":"","loc":"page/usage/newmodels/analtical.html"},{"title":"Automatic differentiation – yaeos","text":"Autodiff The implementation of new models and all their required derivatives can be\nan endeavours and error-prone task. A tool that helps with this, at a small\nperformance cost, can be automatic differentiation. Automatic differentiation can be implemented in two ways: Forward Differentiation Backward Differentiation With can be combined to obtain higher order derivatives. In yaeos it is possible to add new models via two different kind of\nimplementations. Operator overloading with hyperdual numbers and\nsource-to-source automatic differentiation with tapenade . @warn\nRemember to use the R constant from yaeos__constants , and all models\nshould have a type(Substances) attribute!\n@endwarn Hyperdual autodiff ArModel Automatic differentiation with hyperdual numbers can be done with the ArModelAdiff derived type. This implementation requires just to extend\nthat derived type with your own implementation and a volume initializer. module hyperdual_pr76 use yaeos__constants , only : pr , R use yaeos__ar_models_hyperdual use yaeos__substance , only : Substances implicit none type , extends ( ArModelAdiff ) :: PR76 !! PengRobinson 76 EoS ! Composition type ( Substances ) :: composition ! Mixing rule Parameters real ( pr ), allocatable :: kij (:, :), lij (:, :) ! EoS parameters real ( pr ), allocatable :: ac (:), b (:), k (:) real ( pr ), allocatable :: tc (:), pc (:), w (:) contains procedure :: Ar => arfun procedure :: get_v0 => v0 end type real ( pr ), parameter :: del1 = 1._pr + sqrt ( 2._pr ) real ( pr ), parameter :: del2 = 1._pr - sqrt ( 2._pr ) contains type ( PR76 ) function setup ( tc , pc , w , kij , lij ) result ( self ) !! Function to obtain a defined PR76 model with setted up parameters !! as function of Tc, Pc, and w real ( pr ) :: tc (:) real ( pr ) :: pc (:) real ( pr ) :: w (:) real ( pr ) :: kij (:, :) real ( pr ) :: lij (:, :) self % composition % tc = tc self % composition % pc = pc self % composition % w = w self % ac = 0.45723553_pr * R ** 2 * tc ** 2 / pc self % b = 0.07779607_pr * R * tc_in / pc_in self % k = 0.37464_pr + 1.54226_pr * w - 0.26993_pr * w ** 2 self % kij = kij self % lij = lij end function function arfun ( self , n , v , t ) result ( ar ) !! Residual Helmholtz calculation for a generic cubic with !! quadratic mixing rules. class ( PR76 ) :: self type ( hyperdual ), intent ( in ) :: n (:), v , t type ( hyperdual ) :: ar type ( hyperdual ) :: amix , a ( size ( n )), ai ( size ( n )), n2 ( size ( n )) type ( hyperdual ) :: bmix type ( hyperdual ) :: b_v , nij integer :: i , j associate (& pc => self % composition % pc , ac => self % ac , b => self % b , k => self % k ,& kij => self % kij , lij => self % lij , tc => self % compostion % tc & ) ! Soave alpha function a = 1.0_pr + k * ( 1.0_pr - sqrt ( t / tc )) a = ac * a ** 2 ai = sqrt ( a ) ! Quadratic Mixing Rule amix = 0.0_pr bmix = 0.0_pr do i = 1 , size ( n ) - 1 do j = i + 1 , size ( n ) nij = n ( i ) * n ( j ) amix = amix + 2 * nij * ( ai ( i ) * ai ( j )) * ( 1 - kij ( i , j )) bmix = bmix + nij * ( b ( i ) + b ( j )) * ( 1 - lij ( i , j )) end do end do amix = amix + sum ( n ** 2 * a ) bmix = bmix + sum ( n ** 2 * b ) bmix = bmix / sum ( n ) b_v = bmix / v ! Generic Cubic Ar function ar = (& - sum ( n ) * log ( 1.0_pr - b_v ) & - amix / ( R * T * bmix ) * 1.0_pr / ( del1 - del2 ) & * log (( 1.0_pr + del1 * b_v ) / ( 1.0_pr + del2 * b_v )) & ) * ( R * T ) end associate end function function v0 ( self , n , p , t ) !! Initialization of liquid volume solving with covolume class ( PR76 ), intent ( in ) :: self real ( pr ), intent ( in ) :: n (:) real ( pr ), intent ( in ) :: p real ( pr ), intent ( in ) :: t real ( pr ) :: v0 v0 = sum ( n * self % b ) / sum ( n ) end function end module Tapenade Adiff And alternative to hyperdual that takes a bit more work, but can end in a more\nperformant model, is doing tapenade source-to-source differentiation. For\nthis tapenade must be installed and accessible from a terminal donwload link . tapenade diff Tapenade is an automatic differentiation tool developed by researchers at INRIA (the French National\nInstitute for Research in Computer Science and Automation). Tapenade is designed to automatically generate derivative code for numerical\nsimulation programs written in Fortran or C. It enables the computation of\ngradients, Hessians, and other derivatives efficiently, which is particularly\nuseful in fields such as optimization, sensitivity analysis, and scientific\ncomputing. By analyzing the source code of the original program, Tapenade generates code\nthat computes the derivatives of the program’s outputs with respect to its\ninputs. This capability is crucial in many scientific and engineering\napplications where the ability to efficiently compute derivatives is essential. Overall, Tapenade simplifies the process of incorporating automatic\ndifferentiation into existing numerical simulation codes, making it a valuable\ntool for researchers and developers working in computational science and\nengineering. How we use it In yaeos we developed a wrapper object that receives a set of routines from\na differentiated module and uses and internal logic to get the desired $A_r$ \nderivatives. Obtain a tapenade differentiated EoS Getting a usable $A_r$ equation of state with tapenade is fairly easy. Install tapenade and assure that you have the tapenade executable in\n your PATH . Setup your new model following the template file .\n a full implementation of the PengRobinson EoS can be seen at pr.f90 as an example. Run the script gen_tapemodel.sh , providing your file as an argument: bash\n bash gen_tapemodel.sh This will generate a new folder tapeout , with your differentiated model\n inside. Some little post-process must be done due to some details in the tapenade implementation. These are described in the base template but can also\n be checked on the differentiated PR76 result after fixing the last details To add your new tapenade model just include the file in your src folder and\nuse it with use yaeos , only : ArModel , pressure use your_module_name , only : setup_model class ( ArModel ), allocatable :: model model = setup_model ( < your parameters > ) call pressure ( model , n , v , t )","tags":"","loc":"page/usage/newmodels/autodiff.html"},{"title":"Contributing – yaeos","text":"Contributing to yaeos First off, thanks for your interesnt and taking the time to contribute! All types of contributions are encouraged and valued. \nSee the Table of Contents for different ways to help and\ndetails about how this project handles them. Please make sure to read the\nrelevant section before making your contribution. It will make it a lot easier\nfor us maintainers and smooth out the experience for all involved. The\ncommunity looks forward to your contributions. 🎉 And if you like the project, but just don’t have time to contribute, that’s\nfine. There are other easy ways to support the project and show your\nappreciation, which we would also be very happy about:\n- Star the project\n- Tweet about it\n- Refer this project in your project’s readme\n- Mention the project at local meetups and tell your friends/colleagues Table of Contents I Have a Question I Want To Contribute Reporting Bugs Suggesting Enhancements Your First Code Contribution Improving The Documentation Styleguides Commit Messages Join The Project Team I Have a Question If you want to ask a question, we assume that you have read the available Documentation . Before you ask a question, it is best to search for existing Issues that might help you. In\ncase you have found a suitable issue and still need clarification, you can\nwrite your question in this issue. It is also advisable to search the internet\nfor answers first. If you then still feel the need to ask a question and need clarification, we\nrecommend the following: Open an Issue . Provide as much context as you can about what you’re running into. Provide project and platform versions, depending on what seems relevant. We will then take care of the issue as soon as possible. I Want To Contribute Legal Notice When contributing to this project, you must agree that you have authored 100%\nof the content, that you have the necessary rights to the content and that\nthe content you contribute may be provided under the project license. Reporting Bugs Before Submitting a Bug Report A good bug report shouldn’t leave others needing to chase you up for more information. Therefore, we ask you to investigate carefully, collect information and describe the issue in detail in your report. Please complete the following steps in advance to help us fix any potential bug as fast as possible. Make sure that you are using the latest version. Determine if your bug is really a bug and not an error on your side e.g. using incompatible environment components/versions (Make sure that you have read the documentation . If you are looking for support, you might want to check this section ). To see if other users have experienced (and potentially already solved) the same issue you are having, check if there is not already a bug report existing for your bug or error in the bug tracker . Also make sure to search the internet (including Stack Overflow) to see if users outside of the GitHub community have discussed the issue. Collect information about the bug: Stack trace (Traceback) OS, Platform and Version (Windows, Linux, macOS, x86, ARM) Version of the interpreter, compiler, SDK, runtime environment, package manager, depending on what seems relevant. Possibly your input and the output Can you reliably reproduce the issue? And can you also reproduce it with older versions? How Do I Submit a Good Bug Report? You must never report security related issues, vulnerabilities or bugs including sensitive information to the issue tracker, or elsewhere in public. Instead sensitive bugs must be sent by email to <>. We use GitHub issues to track bugs and errors. If you run into an issue with the project: Open an Issue . (Since we can’t be sure at this point whether it is a bug or not, we ask you not to talk about a bug yet and not to label the issue.) Explain the behavior you would expect and the actual behavior. Please provide as much context as possible and describe the reproduction steps that someone else can follow to recreate the issue on their own. This usually includes your code. For good bug reports you should isolate the problem and create a reduced test case. Provide the information you collected in the previous section. Once it’s filed: The project team will label the issue accordingly. A team member will try to reproduce the issue with your provided steps. If there are no reproduction steps or no obvious way to reproduce the issue, the team will ask you for those steps and mark the issue as needs-repro . Bugs with the needs-repro tag will not be addressed until they are reproduced. If the team is able to reproduce the issue, it will be marked needs-fix , as well as possibly other tags (such as critical ), and the issue will be left to be implemented by someone . Suggesting Enhancements This section guides you through submitting an enhancement suggestion for yaeos, including completely new features and minor improvements to existing\nfunctionality . Following these guidelines will help maintainers and the\ncommunity to understand your suggestion and find related suggestions. Before Submitting an Enhancement Make sure that you are using the latest version. Read the documentation carefully and find out if the functionality is already covered, maybe by an individual configuration. Perform a search to see if the enhancement has already been suggested. If it has, add a comment to the existing issue instead of opening a new one. Find out whether your idea fits with the scope and aims of the project. It’s up to you to make a strong case to convince the project’s developers of the merits of this feature. Keep in mind that we want features that will be useful to the majority of our users and not just a small subset. If you’re just targeting a minority of users, consider writing an add-on/plugin library. How Do I Submit a Good Enhancement Suggestion? Enhancement suggestions are tracked as GitHub issues . Use a clear and descriptive title for the issue to identify the suggestion. Provide a step-by-step description of the suggested enhancement in as many details as possible. Describe the current behavior and explain which behavior you expected to see instead and why. At this point you can also tell which alternatives do not work for you. You may want to include screenshots and animated GIFs which help you demonstrate the steps or point out the part which the suggestion is related to. You can use this tool to record GIFs on macOS and Windows, and this tool or this tool on Linux. Explain why this enhancement would be useful to most yaeos users. You may also want to point out the other projects that solved it better and which could serve as inspiration. Your First Code Contribution Improving The Documentation Styleguides Our code style can be read at Style Guide Commit Messages We encourage the use of commitizen styling on commit\nmessages. Join The Project Team mail me","tags":"","loc":"page/contributing/index.html"},{"title":"Style guide – yaeos","text":"yaeos Style Guide Adopting a consistent style can improve code legibility through the choice of good naming conventions.\nIn addition, style checks will be run during CI to flag any severe non-conformance.\nThis allows code review discussions to focus on semantics and substance rather than pedantry.\nConsistent whitespace usage, and not polluting line endings with trailing white space makes git diff s considerably more legible.\nThis style guide is a living document and proposed changes may be adopted after discussing them and coming to a consensus. Use (modern) standard Fortran Do not use obsolescent or deleted language features\n E.g., common , pause , entry , arithmetic if and computed goto Do not use vendor extensions in the form of non-standard syntax and vendor supplied intrinsic procedures\n E.g., real*8 or etime() , use real(pr) Naming of variables and constructs Variable and procedure names, as well as Fortran keywords, should be written in lowercase All constants (like the R gas constant) should be upper case All variables should be in lowercase unless they are represented in uppercase in the bibliography.\n for example, the molar volume would be v and the total volume would be V . In the case of derivatives, for general properties they should be written as dXdy for first derivatives and dXdyz or dXdy2 for second order derivatives. The only exception is with energetic properties, like Ar , where derivatives are written like ArV , ArVn , etc. All thermodynamic variables that are input of a subroutine/function should\n have the order: n, V, T n, P, T Variable and procedure names should be made up of one or more full words separated by an underscore,\n for example has_failed is preferred over hasfailed Where conventional and appropriate shortening of a word is used then the underscore may be omitted,\n for example linspace is preferred over lin_space For derived types use CamelCase, like ArModel File naming conventions Source files should contain at most one program , module , or submodule The filename should match the program or module name and have the file extension .f90 or .F90 if preprocessing is required module names should include it’s subdirectory, using yaeos__ for the parent src directory. For example the module in src/phase_equilibria/flash.f90 should be named yaeos__phase_equilibria_flash . If the interface and implementation is split using submodules the implementation submodule file should have the same name as the\n interface (parent) module but end in _implementation E.g., string_class.f90 and string_class_implementation.f90 Tests should be added in the test subdirectory and have the same name as the module they are testing with the test_ prefix\n added E.g., string_class.f90 and test/test_string_class.f90 Indentation & whitespace By setting and following a convention for indentation and whitespace, code\nreviews and git-diffs can focus on the semantics of the proposed changes rather\nthan style and formatting. We recommend ~~enforce~~ the use of findent to format your files. The body of every Fortran construct should be indented by three (3) spaces Line length should be limited to 80 characters and must not exceed 132 Do not use Tab characters for indentation Remove trailing white space before committing code Attributes Always specify intent for dummy arguments. Don’t use dimension attribute to declare arrays because it is more verbose.\n Use this: real, allocatable :: a(:), b(:,:) instead of: real, dimension(:), allocatable :: a real, dimension(:,:), allocatable :: b When defining many arrays of the same dimension, dimension can be used as an exception if it makes the code less verbose. If the optional attribute is used to declare a dummy argument, it should follow the intent attribute. End block closing statements Fortran allows certain block constructs or scopes to include the name of the program unit in the end statement.\nThe convention adopted herein is to include procedure names, module names and program names in the end statement,\nunless the closing statement can reasonably be expected to be on the same screen or page, within about 25 lines. Document public API code with FORD Documentation strings should be provided for all public and protected entities and their arguments or parameters.\nThis is currently accomplished using the FORD tool .\nFor help writing FORD style documentation please see the FORD wiki .\nThe following two sections are most relevant for contributing new code: Writing Documentation Documentation Meta Data Limitations To write the “spec” (specification) for a new proposal, please place it in the FORD “pages” directory at doc/specs/ .\nTo get help please see the “Writing Pages” and “Writing Documentation” pages\non the FORD wiki .","tags":"","loc":"page/contributing/styleguide.html"},{"title":"Python-API – yaeos","text":"Python API documentation. Dummy file to make sure the Python API documentation\nindex.html is generated, then is replaces with the index.html from the Python\ndocumentation generated with Sphinx.","tags":"","loc":"page/python-api/index.html"}]} \ No newline at end of file +var tipuesearch = {"pages":[{"title":" yaeos ","text":"yaeos Available models Available properties A little taste of yaeos How to install/run it Dependencies Debian/Ubuntu-like Installing yaeos Developing with vscode Available examples Including new models with Automatic Differentiation. Hyperdual Numbers autodiff Tapenade-based autodiff Documentation There are multiple open source equations of state libraries, like: Clapeyron julia FeOs rust with Python bindings teqp C++ with Python bindings thermo python thermopack Fortran with Python bindings CoolProp C++ with Python bindings Here we are presenting yet another (still in development) one, that tackles the\nsame problem just, in another way. Mostly exploiting the readability and\nextensibility of Modern Fortran for scientists to have an easy way to implement\nnew thermodynamic models without dealing with lower-level languages but still\ngetting decent performance.\nAnd also this framework provides the possibility of using analytically obtained\nderivatives so both options are easily available. This is an experimental work in progress and we recommend the before\nmentioned libraries if you are intending to use some of this in real work.\nBig part of the code comes from a refactoring process of older codes so\nnot all parts are easily readable, yet. We focus mainly on that the addition of a new thermodynamic model as easily as\npossible. Also providing our models too! Available models CubicEoS SoaveRedlichKwong PengRobinson76 PengRobinson78 ExcessGibbs models NRTL UNIFAC VLE Available properties Bulk Properties Volume(n, P, T) Pressure(n, V, T) Residual Properties H^R(n, V, T) S^R(n, V, T) G^R(n, V, T) Cv^R(n, V, T) Cp^R(n, V, T) Phase-Equilibria FlashPT, FlashVT Saturation points (bubble, dew and liquid-liquid) Phase Envelope PT (isopleths) A little taste of yaeos A lot of users get the bad picture of Fortran being old and archaic since most\nof the codes they’ve seen are written in ancient F77 . use yaeos , only : PengRobinson76 , ArModel integer , parameter :: n = 2 ! Number of components real ( 8 ) :: V , T , P , dPdN ( n ) ! variables to calculate class ( ArModel ), allocatable :: model ! Model real ( pr ) :: z ( n ), tc ( n ), pc ( n ), w ( n ), kij ( n , n ), lij ( n , n ) z = [ 0.3 , 0.7 ] tc = [ 19 0. , 31 0. ] pc = [ 1 4. , 3 0. ] w = [ 0.001 , 0.03 ] kij = reshape ([ 0. , 0.1 , 0.1 , 0. ], [ n , n ]) lij = kij / 2 model = PengRobinson76 ( tc , pc , w , kij , lij ) V = 1 T = 150 call model % pressure ( z , V , T , P ) print * , P ! Obtain derivatives adding them as optional arguments! call model % pressure ( model , z , V , T , P , dPdN = dPdN ) print * , dPdN Examples of code with simple applications showing the capabilities of yaeos can be found at example/tutorials . Each example can be run\nwith: fpm run --example Not providing any example will show all the possible examples that can be run. How to install/run it Dependencies yaeos needs to have both lapack and nlopt libraries on your system. Debian/Ubuntu-like sudo apt install libnlopt-dev libblas-dev liblapack-dev Installing yaeos yaeos is intended to use as a fpm package. fpm is the Fortran Package Manager, which automates the compilation and running\nprocess of Fortran libraries/programs. You can either: Generate a new project that uses yaeos as a dependency with: bash\nfpm new my_project In the fpm.toml file add: toml\n[dependencies]\nyaeos = {git=\"https://github.com/ipqa-research/yaeos\"} Clone this repository and just modify the executables in the app directory bash\ngit clone https://github.com/ipqa-research/yaeos\ncd yaeos\nfpm run Developing with vscode If your intention is either to develop for yaeos or to explore in more detail\nthe library with debugging. We provide some predefined defuaults to work with vscode . You can add them to the cloned repository by running: git clone https://github.com/ipqa-research/vscode-fortran .vscode From the project main directory Available examples In this repository we provide a series of examples of the different things that\ncan be calculated with yaeos . The source codes for the examples can be seen\nat the example/tutorials directory. All the examples can be run with fpm run --example Including new models with Automatic Differentiation. Hyperdual Numbers autodiff We are using the hyperdual module developed by Philipp Rehner and Gernot Bauer The automatic differentiation API isn’t fully optimized yet so performance is\nmuch slower than it should be. A complete implementation of the PR76 Equation of State can me found in example/adiff/adiff_pr76.f90 . Or in the documentation pages. Tapenade-based autodiff It is also possible to differentiate with tapenade . Examples can be seen\nin the documentation pages or in The tools directory Documentation The latest API documentation for the main branch can be found here . This was generated from the source\ncode using FORD . We’re\nworking in extending it more. Developer Info Federico Benelli PhD student with focus on reservoir PVT simulation.","tags":"home","loc":"index.html"},{"title":"GeModel – yaeos ","text":"type, public, abstract, extends( BaseModel ) :: GeModel Excess Gibbs energy model. Components Type Visibility Attributes Name Initial type( Substances ), public :: components Substances contained in the module Type-Bound Procedures procedure( excess_gibbs ), public, deferred :: excess_gibbs subroutine excess_gibbs(self, n, t, Ge, GeT, GeT2, Gen, GeTn, Gen2) Prototype Excess Gibbs and derivs procedure Arguments Type Intent Optional Attributes Name class( GeModel ), intent(in) :: self Model real(kind=pr), intent(in) :: n (:) Moles vector real(kind=pr), intent(in) :: t Temperature [K] real(kind=pr), intent(out), optional :: Ge Excess Gibbs real(kind=pr), intent(out), optional :: GeT real(kind=pr), intent(out), optional :: GeT2 real(kind=pr), intent(out), optional :: Gen (size(n)) real(kind=pr), intent(out), optional :: GeTn (size(n)) real(kind=pr), intent(out), optional :: Gen2 (size(n),size(n)) procedure, public :: ln_activity_coefficient public subroutine ln_activity_coefficient (self, n, T, lngamma) Arguments Type Intent Optional Attributes Name class( GeModel ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: T real(kind=pr), intent(out) :: lngamma (:)","tags":"","loc":"type/gemodel.html"},{"title":"QMR – yaeos ","text":"type, public, extends( CubicMixRule ) :: QMR Quadratic Mixing Rule (QMR) derived type. Classic Van der Waals mixing\nrules. QMR depends on binary interaction parameters, on a Cubic EoS\nthe mixture is obtained by the combination of an attractive and\nrepulsive parameter matrices. By default the attractive parameter matrix is calculated with: generating the matrix, but this procedure can be overriden\nreplacing the aij pointer procedure. Components Type Visibility Attributes Name Initial procedure( get_aij ), public, pointer :: aij => null() Procedure to calculate matrix. Can be overloaded\nby any method that respets the interface get_aij . real(kind=pr), public, allocatable :: k (:,:) Attractive Binary Interatction parameter matrix real(kind=pr), public, allocatable :: l (:,:) Repulsive Binary Interatction parameter matrix Type-Bound Procedures procedure, public :: Bmix Repulsive parameter mixing rule public subroutine Bmix (self, n, bi, B, dBi, dBij) Mixture repulsive parameter. Read more… Arguments Type Intent Optional Attributes Name class( QMR ), intent(in) :: self Mixing rule object. real(kind=pr), intent(in) :: n (:) Moles vector. real(kind=pr), intent(in) :: bi (:) Pure components repulsive parameters. real(kind=pr), intent(out) :: B Mixture repulsive parameter. real(kind=pr), intent(out) :: dBi (:) real(kind=pr), intent(out) :: dBij (:,:) procedure, public :: D1mix => D1mix_constant public subroutine D1mix_constant (self, n, d1i, D1, dD1i, dD1ij) Constant parameter. Read more… Arguments Type Intent Optional Attributes Name class( QMR ), intent(in) :: self Mixing rule real(kind=pr), intent(in) :: n (:) Moles vector real(kind=pr), intent(in) :: d1i (:) parameter real(kind=pr), intent(out) :: D1 Mixture’s real(kind=pr), intent(out) :: dD1i (:) real(kind=pr), intent(out) :: dD1ij (:,:) procedure, public :: Dmix Attractive parameter mixing rule public subroutine Dmix (self, n, T, ai, daidt, daidt2, D, dDdT, dDdT2, dDi, dDidT, dDij) Attractive parameter mixing rule with quadratic mix. Read more… Arguments Type Intent Optional Attributes Name class( QMR ), intent(in) :: self Mixing rule object. real(kind=pr), intent(in) :: n (:) Moles vector [mol] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(in) :: ai (:) Pure components attractive parameters real(kind=pr), intent(in) :: daidt (:) real(kind=pr), intent(in) :: daidt2 (:) real(kind=pr), intent(out) :: D Mixture attractive parameter real(kind=pr), intent(out) :: dDdT real(kind=pr), intent(out) :: dDdT2 real(kind=pr), intent(out) :: dDi (:) real(kind=pr), intent(out) :: dDidT (:) real(kind=pr), intent(out) :: dDij (:,:)","tags":"","loc":"type/qmr.html"},{"title":"QMR_RKPR – yaeos ","text":"type, public, extends( QMR ) :: QMR_RKPR Components Type Visibility Attributes Name Initial procedure( get_aij ), public, pointer :: aij => null() Procedure to calculate matrix. Can be overloaded\nby any method that respets the interface get_aij . real(kind=pr), public, allocatable :: k (:,:) Attractive Binary Interatction parameter matrix real(kind=pr), public, allocatable :: l (:,:) Repulsive Binary Interatction parameter matrix Type-Bound Procedures procedure, public :: Bmix Repulsive parameter mixing rule public subroutine Bmix (self, n, bi, B, dBi, dBij) Mixture repulsive parameter. Read more… Arguments Type Intent Optional Attributes Name class( QMR ), intent(in) :: self Mixing rule object. real(kind=pr), intent(in) :: n (:) Moles vector. real(kind=pr), intent(in) :: bi (:) Pure components repulsive parameters. real(kind=pr), intent(out) :: B Mixture repulsive parameter. real(kind=pr), intent(out) :: dBi (:) real(kind=pr), intent(out) :: dBij (:,:) procedure, public :: D1Mix => RKPR_D1mix public subroutine RKPR_D1mix (self, n, d1i, D1, dD1i, dD1ij) RKPR parameter mixing rule. Read more… Arguments Type Intent Optional Attributes Name class( QMR_RKPR ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: d1i (:) real(kind=pr), intent(out) :: D1 real(kind=pr), intent(out) :: dD1i (:) real(kind=pr), intent(out) :: dD1ij (:,:) procedure, public :: Dmix Attractive parameter mixing rule public subroutine Dmix (self, n, T, ai, daidt, daidt2, D, dDdT, dDdT2, dDi, dDidT, dDij) Attractive parameter mixing rule with quadratic mix. Read more… Arguments Type Intent Optional Attributes Name class( QMR ), intent(in) :: self Mixing rule object. real(kind=pr), intent(in) :: n (:) Moles vector [mol] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(in) :: ai (:) Pure components attractive parameters real(kind=pr), intent(in) :: daidt (:) real(kind=pr), intent(in) :: daidt2 (:) real(kind=pr), intent(out) :: D Mixture attractive parameter real(kind=pr), intent(out) :: dDdT real(kind=pr), intent(out) :: dDdT2 real(kind=pr), intent(out) :: dDi (:) real(kind=pr), intent(out) :: dDidT (:) real(kind=pr), intent(out) :: dDij (:,:)","tags":"","loc":"type/qmr_rkpr.html"},{"title":"BaseModel – yaeos ","text":"type, public, abstract :: BaseModel Base model type. Contains the important parts of most models and other procedures. Components Type Visibility Attributes Name Initial type( Substances ), public :: components Substances contained in the module","tags":"","loc":"type/basemodel.html"},{"title":"Substances – yaeos ","text":"type, public :: Substances Set of pure components Components Type Visibility Attributes Name Initial character(len=50), public, allocatable :: names (:) Composition names. real(kind=pr), public, allocatable :: pc (:) Critical Pressure [bar] real(kind=pr), public, allocatable :: tc (:) Critical Temperature [K] real(kind=pr), public, allocatable :: w (:) Acentric factor","tags":"","loc":"type/substances.html"},{"title":"ArModel – yaeos ","text":"type, public, abstract, extends( BaseModel ) :: ArModel Abstract residual Helmholtz model. This derived type defines the basics needed for the calculation\nof residual properties.\nThe basics of a residual Helmholtz model is a routine that calculates\nall the needed derivatives of residual_helmholtz and\na volume initializer function, that is used to initialize a Newton\nsolver of volume when specifying pressure. Components Type Visibility Attributes Name Initial type( Substances ), public :: components Substances contained in the module character(len=:), public, allocatable :: name Name of the model Type-Bound Procedures procedure, public :: Cp_residual_vt public subroutine Cp_residual_vt (eos, n, V, T, Cp) Calculate residual heat capacity pressure constant given v and t. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: V Volume [L] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out) :: Cp heat capacity p constant [bar L / K / mol] procedure, public :: Cv_residual_vt public subroutine Cv_residual_vt (eos, n, V, T, Cv) Calculate residual heat capacity volume constant given v and t. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: V Volume [L] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out) :: Cv heat capacity v constant [bar L / K / mol] procedure, public :: enthalpy_residual_vt public subroutine enthalpy_residual_vt (eos, n, v, t, Hr, HrT, HrV, Hrn) Calculate residual enthalpy given volume and temperature. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: v Volume [L] real(kind=pr), intent(in) :: t Temperature [K] real(kind=pr), intent(out) :: Hr Residual enthalpy [bar L / mol] real(kind=pr), intent(out), optional :: HrT real(kind=pr), intent(out), optional :: HrV real(kind=pr), intent(out), optional :: Hrn (size(n)) procedure, public :: entropy_residual_vt public subroutine entropy_residual_vt (eos, n, V, T, Sr, SrT, SrV, Srn) Calculate residual entropy given volume and temperature. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: V Volume [L] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out) :: Sr Entropy [bar L / K / mol] real(kind=pr), intent(out), optional :: SrT real(kind=pr), intent(out), optional :: SrV real(kind=pr), intent(out), optional :: Srn (size(n)) procedure( abs_volume_initializer ), public, deferred :: get_v0 function abs_volume_initializer(self, n, p, t) Prototype Function that provides an initializer value for the liquid-root\nof newton solver of volume. In the case the model will use the volume_michelsen routine this value should provide the co-volume\nof the model. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: self Ar Model real(kind=pr), intent(in) :: n (:) Moles vector real(kind=pr), intent(in) :: p Pressure [bar] real(kind=pr), intent(in) :: t Temperature [K] Return Value real(kind=pr) Initial volume [L] procedure, public :: gibbs_residual_vt => gibbs_residual_VT public subroutine gibbs_residual_VT (eos, n, V, T, Gr, GrT, GrV, Grn) Calculate residual Gibbs energy given volume and temperature. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: V Volume [L] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out) :: Gr Gibbs energy [bar L / mol] real(kind=pr), intent(out), optional :: GrT real(kind=pr), intent(out), optional :: GrV real(kind=pr), intent(out), optional :: Grn (size(n)) procedure, public :: lnphi_pt => fugacity_pt public subroutine fugacity_pt (eos, n, P, T, V, root_type, lnPhi, dlnPhidP, dlnPhidT, dlnPhidn, dPdV, dPdT, dPdn) Calculate logarithm of fugacity, given pressure and temperature. Read more… Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Mixture mole numbers real(kind=pr), intent(in) :: P Pressure [bar] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out), optional :: V Volume [L] character(len=*), intent(in) :: root_type Type of root desired [“liquid”, “vapor”, “stable”] real(kind=pr), intent(out), optional :: lnPhi (size(n)) vector real(kind=pr), intent(out), optional :: dlnPhidP (size(n)) ln(phi) Presssure derivative real(kind=pr), intent(out), optional :: dlnPhidT (size(n)) ln(phi) Temp derivative real(kind=pr), intent(out), optional :: dlnPhidn (size(n),size(n)) ln(phi) compositional derivative real(kind=pr), intent(out), optional :: dPdV real(kind=pr), intent(out), optional :: dPdT real(kind=pr), intent(out), optional :: dPdn (size(n)) procedure, public :: lnphi_vt => fugacity_vt public subroutine fugacity_vt (eos, n, V, T, P, lnPhi, dlnPhidP, dlnPhidT, dlnPhidn, dPdV, dPdT, dPdn) Calculate fugacity coefficent given volume and temperature. Read more… Arguments Type Intent Optional Attributes Name class( ArModel ) :: eos Model real(kind=pr), intent(in) :: n (:) Mixture mole numbers real(kind=pr), intent(in) :: V Volume [L] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out), optional :: P Pressure [bar] real(kind=pr), intent(out), optional :: lnPhi (size(n)) vector real(kind=pr), intent(out), optional :: dlnPhidP (size(n)) Presssure derivative real(kind=pr), intent(out), optional :: dlnPhidT (size(n)) Temp derivative real(kind=pr), intent(out), optional :: dlnPhidn (size(n),size(n)) compositional derivative real(kind=pr), intent(out), optional :: dPdV real(kind=pr), intent(out), optional :: dPdT real(kind=pr), intent(out), optional :: dPdn (:) procedure, public :: pressure public subroutine pressure (eos, n, v, t, p, dPdV, dPdT, dPdn) Pressure calculation. Read more… Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: v Volume [L] real(kind=pr), intent(in) :: t Temperature [K] real(kind=pr), intent(out) :: p Pressure [bar] real(kind=pr), intent(out), optional :: dPdV real(kind=pr), intent(out), optional :: dPdT real(kind=pr), intent(out), optional :: dPdn (:) procedure( abs_residual_helmholtz ), public, deferred :: residual_helmholtz subroutine abs_residual_helmholtz(self, n, v, t, Ar, ArV, ArT, ArTV, ArV2, ArT2, Arn, ArVn, ArTn, Arn2) Prototype Residual Helmholtz model generic interface. This interface represents how an Ar model should be implemented.\nBy our standard, a Resiudal Helmholtz model takes as input: The mixture’s number of moles vector. Volume, by default in liters. Temperature, by default in Kelvin. All the output arguments are optional. While this keeps a long\nsignature for the implementation, this is done this way to take\nadvantage of any inner optimizations to calculate derivatives\ninside the procedure. Once the model is implemented, the signature can be short like model%residual_helmholtz(n, v, t, ArT2=dArdT2) Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: self ArModel real(kind=pr), intent(in) :: n (:) Moles vector real(kind=pr), intent(in) :: v Volume [L] real(kind=pr), intent(in) :: t Temperature [K] real(kind=pr), intent(out), optional :: Ar Residual Helmoltz energy real(kind=pr), intent(out), optional :: ArV real(kind=pr), intent(out), optional :: ArT real(kind=pr), intent(out), optional :: ArTV real(kind=pr), intent(out), optional :: ArV2 real(kind=pr), intent(out), optional :: ArT2 real(kind=pr), intent(out), optional :: Arn (size(n)) real(kind=pr), intent(out), optional :: ArVn (size(n)) real(kind=pr), intent(out), optional :: ArTn (size(n)) real(kind=pr), intent(out), optional :: Arn2 (size(n),size(n)) procedure, public :: volume public subroutine volume (eos, n, P, T, V, root_type) Solves volume roots using newton method. Given pressure and temperature. Read more… Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: P Pressure [bar] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out) :: V Volume [L] character(len=*), intent(in) :: root_type Desired root-type to solve. Options are: [\"liquid\", \"vapor\", \"stable\"]","tags":"","loc":"type/armodel.html"},{"title":"Optimizer – yaeos ","text":"type, public, abstract :: Optimizer Components Type Visibility Attributes Name Initial real(kind=pr), public, allocatable :: parameter_step (:) real(kind=pr), public :: solver_tolerance = 1e-9_pr logical, public :: verbose Type-Bound Procedures procedure( abs_optimize ), public, deferred :: optimize subroutine abs_optimize(self, foo, X, F, data) Prototype Arguments Type Intent Optional Attributes Name class( Optimizer ), intent(inout) :: self procedure( obj_func ) :: foo real(kind=pr), intent(inout) :: X (:) real(kind=pr), intent(out) :: F class(*), intent(inout), optional, target :: data","tags":"","loc":"type/optimizer.html"},{"title":"PowellWrapper – yaeos ","text":"type, public, extends( Optimizer ) :: PowellWrapper Wrapper derived type to optimize with the Powell method Components Type Visibility Attributes Name Initial real(kind=pr), public, allocatable :: parameter_step (:) real(kind=pr), public :: solver_tolerance = 1e-9_pr logical, public :: verbose Type-Bound Procedures procedure, public :: optimize => powell_optimize private subroutine powell_optimize (self, foo, X, F, data) Arguments Type Intent Optional Attributes Name class( PowellWrapper ), intent(inout) :: self procedure( obj_func ) :: foo real(kind=pr), intent(inout) :: X (:) real(kind=pr), intent(out) :: F class(*), intent(inout), optional, target :: data","tags":"","loc":"type/powellwrapper.html"},{"title":"AlphaRKPR – yaeos ","text":"type, public, extends( AlphaFunction ) :: AlphaRKPR RKPR function Components Type Visibility Attributes Name Initial real(kind=pr), public, allocatable :: k (:) parameter. Type-Bound Procedures procedure, public :: alpha => alpha_rkpr public subroutine alpha_rkpr (self, Tr, a, dadt, dadt2) Arguments Type Intent Optional Attributes Name class( AlphaRKPR ), intent(in) :: self real(kind=pr), intent(in) :: Tr (:) Reduced temperature real(kind=pr), intent(out) :: a (:) real(kind=pr), intent(out) :: dadt (:) real(kind=pr), intent(out) :: dadt2 (:)","tags":"","loc":"type/alpharkpr.html"},{"title":"AlphaSoave – yaeos ","text":"type, public, extends( AlphaFunction ) :: AlphaSoave Soave function. Components Type Visibility Attributes Name Initial real(kind=pr), public, allocatable :: k (:) parameter. Type-Bound Procedures procedure, public :: alpha Alpha function public subroutine alpha (self, Tr, a, dadt, dadt2) Soave function and it’s derivatives. Arguments Type Intent Optional Attributes Name class( AlphaSoave ), intent(in) :: self real(kind=pr), intent(in) :: Tr (:) Reduced temperature real(kind=pr), intent(out) :: a (:) real(kind=pr), intent(out) :: dadt (:) real(kind=pr), intent(out) :: dadt2 (:)","tags":"","loc":"type/alphasoave.html"},{"title":"GeModelTapenade – yaeos ","text":"type, public, abstract, extends( GeModel ) :: GeModelTapenade Components Type Visibility Attributes Name Initial type( Substances ), public :: components Substances contained in the module Type-Bound Procedures procedure, public :: excess_gibbs private subroutine excess_gibbs (self, n, t, Ge, GeT, GeT2, Gen, GeTn, Gen2) Excess Gibbs model generic interface Arguments Type Intent Optional Attributes Name class( GeModelTapenade ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: t real(kind=pr), intent(out), optional :: Ge real(kind=pr), intent(out), optional :: GeT real(kind=pr), intent(out), optional :: GeT2 real(kind=pr), intent(out), optional, dimension(size(n)) :: Gen real(kind=pr), intent(out), optional, dimension(size(n)) :: GeTn real(kind=pr), intent(out), optional :: Gen2 (size(n),size(n)) procedure( tapenade_ge ), public, deferred :: ge subroutine tapenade_ge(model, n, t, ge) Prototype Arguments Type Intent Optional Attributes Name class( GeModelTapenade ) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: t real(kind=pr), intent(out) :: ge procedure( tapenade_ge_b ), public, deferred :: ge_b subroutine tapenade_ge_b(model, n, nb, t, tb, ge, geb) Prototype Arguments Type Intent Optional Attributes Name class( GeModelTapenade ) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr) :: nb (:) real(kind=pr), intent(in) :: t real(kind=pr) :: tb real(kind=pr) :: ge real(kind=pr) :: geb procedure( tapenade_ge_d ), public, deferred :: ge_d subroutine tapenade_ge_d(model, n, nd, t, td, ge, ged) Prototype Arguments Type Intent Optional Attributes Name class( GeModelTapenade ) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: nd (:) real(kind=pr), intent(in) :: t real(kind=pr), intent(in) :: td real(kind=pr), intent(out) :: ge real(kind=pr), intent(out) :: ged procedure( tapenade_ge_d_b ), public, deferred :: ge_d_b subroutine tapenade_ge_d_b(model, n, nb, nd, ndb, t, tb, td, tdb, ge, geb, ged, gedb) Prototype Arguments Type Intent Optional Attributes Name class( GeModelTapenade ) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr) :: nb (:) real(kind=pr), intent(in) :: nd (:) real(kind=pr) :: ndb (:) real(kind=pr), intent(in) :: t real(kind=pr) :: tb real(kind=pr), intent(in) :: td real(kind=pr) :: tdb real(kind=pr) :: ge real(kind=pr) :: geb real(kind=pr) :: ged real(kind=pr) :: gedb procedure( tapenade_ge_d_d ), public, deferred :: ge_d_d subroutine tapenade_ge_d_d(model, n, nd, t, td0, td, ge, ged0, ged, gedd) Prototype Arguments Type Intent Optional Attributes Name class( GeModelTapenade ) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: nd (:) real(kind=pr), intent(in) :: t real(kind=pr), intent(in) :: td0 real(kind=pr), intent(in) :: td real(kind=pr), intent(out) :: ge real(kind=pr), intent(out) :: ged0 real(kind=pr), intent(out) :: ged real(kind=pr), intent(out) :: gedd procedure, public :: ln_activity_coefficient public subroutine ln_activity_coefficient (self, n, T, lngamma) Arguments Type Intent Optional Attributes Name class( GeModel ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: T real(kind=pr), intent(out) :: lngamma (:)","tags":"","loc":"type/gemodeltapenade.html"},{"title":"FitKijLij – yaeos ","text":"type, public, extends( FittingProblem ) :: FitKijLij Binary Interaction Parameters of Cubic EoS fitting problem Fit the binary interaction parameters of a mixtures. Description Fitting setup for quadratic combining rules, it is possible to select\nwhich parameters will be optimized with the fit_lij and fit_kij attributes. Examples Fit the kij BIP type ( CubicEoS ) :: model ! Model to fit type ( FitKijLij ) :: fitting_problem ! Fitting problem specification type ( EquilibriumState ) :: exp_data ( 3 ) real ( pr ) :: X ( 2 ) ! parameter variables real ( pr ) :: error ! model = PengRobinson76 ( tc , pc , w ) ! Model to fit fitting_problem % exp_data = exp_data fitting_problem % model = model fitting_problem % fit_kij = . true . X = 0 ! initial values == 0 err = optimize ( X , fitting_problem ) References Components Type Visibility Attributes Name Initial type( EquilibriumState ), public, allocatable :: experimental_points (:) Experimental points to fit logical, public :: fit_kij = .false. Fit the parameter logical, public :: fit_lij = .false. Fit the parameter class( ArModel ), public, allocatable :: model Residual Helmholtz Model to fit logical, public :: verbose = .false. If true log the fitting process Type-Bound Procedures procedure, public :: get_model_from_X => model_from_X public subroutine model_from_X (problem, X) Arguments Type Intent Optional Attributes Name class( FitKijLij ), intent(inout) :: problem real(kind=pr), intent(in) :: X (:)","tags":"","loc":"type/fitkijlij.html"},{"title":"CriticalPoint – yaeos ","text":"type, public :: CriticalPoint Critical point Components Type Visibility Attributes Name Initial real(kind=pr), public :: P Pressure [bar] real(kind=pr), public :: T Temperature [K]","tags":"","loc":"type/criticalpoint.html"},{"title":"PTEnvel2 – yaeos ","text":"type, public :: PTEnvel2 Two-phase isopleth.\nPhase boundary line of a fluid at constant composition. Components Type Visibility Attributes Name Initial type( CriticalPoint ), public, allocatable :: cps (:) Critical points found along the line. type( EquilibriumState ), public, allocatable :: points (:) Each point through the line. Type-Bound Procedures procedure, public, pass :: write => write_PTEnvel2 public subroutine write_PTEnvel2 (pt2, unit, iotype, v_list, iostat, iomsg) Arguments Type Intent Optional Attributes Name class( PTEnvel2 ), intent(in) :: pt2 integer, intent(in) :: unit character(len=*), intent(in) :: iotype integer, intent(in) :: v_list (:) integer, intent(out) :: iostat character(len=*), intent(inout) :: iomsg generic, public :: write (FORMATTED) => write public subroutine write_PTEnvel2 (pt2, unit, iotype, v_list, iostat, iomsg) Arguments Type Intent Optional Attributes Name class( PTEnvel2 ), intent(in) :: pt2 integer, intent(in) :: unit character(len=*), intent(in) :: iotype integer, intent(in) :: v_list (:) integer, intent(out) :: iostat character(len=*), intent(inout) :: iomsg","tags":"","loc":"type/ptenvel2.html"},{"title":"ArModelAdiff – yaeos ","text":"type, public, abstract, extends( ArModel ) :: ArModelAdiff Components Type Visibility Attributes Name Initial type( Substances ), public :: components Substances contained in the module character(len=:), public, allocatable :: name Name of the model Type-Bound Procedures procedure( hyperdual_Ar ), public, deferred :: Ar function hyperdual_Ar(self, n, v, t) Prototype Arguments Type Intent Optional Attributes Name class( ArModelAdiff ) :: self type( hyperdual ), intent(in) :: n (:) type( hyperdual ), intent(in) :: v type( hyperdual ), intent(in) :: t Return Value type( hyperdual ) procedure, public :: Cp_residual_vt public subroutine Cp_residual_vt (eos, n, V, T, Cp) Calculate residual heat capacity pressure constant given v and t. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: V Volume [L] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out) :: Cp heat capacity p constant [bar L / K / mol] procedure, public :: Cv_residual_vt public subroutine Cv_residual_vt (eos, n, V, T, Cv) Calculate residual heat capacity volume constant given v and t. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: V Volume [L] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out) :: Cv heat capacity v constant [bar L / K / mol] procedure, public :: enthalpy_residual_vt public subroutine enthalpy_residual_vt (eos, n, v, t, Hr, HrT, HrV, Hrn) Calculate residual enthalpy given volume and temperature. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: v Volume [L] real(kind=pr), intent(in) :: t Temperature [K] real(kind=pr), intent(out) :: Hr Residual enthalpy [bar L / mol] real(kind=pr), intent(out), optional :: HrT real(kind=pr), intent(out), optional :: HrV real(kind=pr), intent(out), optional :: Hrn (size(n)) procedure, public :: entropy_residual_vt public subroutine entropy_residual_vt (eos, n, V, T, Sr, SrT, SrV, Srn) Calculate residual entropy given volume and temperature. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: V Volume [L] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out) :: Sr Entropy [bar L / K / mol] real(kind=pr), intent(out), optional :: SrT real(kind=pr), intent(out), optional :: SrV real(kind=pr), intent(out), optional :: Srn (size(n)) procedure( abs_volume_initializer ), public, deferred :: get_v0 function abs_volume_initializer(self, n, p, t) Prototype Function that provides an initializer value for the liquid-root\nof newton solver of volume. In the case the model will use the volume_michelsen routine this value should provide the co-volume\nof the model. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: self Ar Model real(kind=pr), intent(in) :: n (:) Moles vector real(kind=pr), intent(in) :: p Pressure [bar] real(kind=pr), intent(in) :: t Temperature [K] Return Value real(kind=pr) Initial volume [L] procedure, public :: gibbs_residual_vt => gibbs_residual_VT public subroutine gibbs_residual_VT (eos, n, V, T, Gr, GrT, GrV, Grn) Calculate residual Gibbs energy given volume and temperature. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: V Volume [L] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out) :: Gr Gibbs energy [bar L / mol] real(kind=pr), intent(out), optional :: GrT real(kind=pr), intent(out), optional :: GrV real(kind=pr), intent(out), optional :: Grn (size(n)) procedure, public :: lnphi_pt => fugacity_pt public subroutine fugacity_pt (eos, n, P, T, V, root_type, lnPhi, dlnPhidP, dlnPhidT, dlnPhidn, dPdV, dPdT, dPdn) Calculate logarithm of fugacity, given pressure and temperature. Read more… Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Mixture mole numbers real(kind=pr), intent(in) :: P Pressure [bar] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out), optional :: V Volume [L] character(len=*), intent(in) :: root_type Type of root desired [“liquid”, “vapor”, “stable”] real(kind=pr), intent(out), optional :: lnPhi (size(n)) vector real(kind=pr), intent(out), optional :: dlnPhidP (size(n)) ln(phi) Presssure derivative real(kind=pr), intent(out), optional :: dlnPhidT (size(n)) ln(phi) Temp derivative real(kind=pr), intent(out), optional :: dlnPhidn (size(n),size(n)) ln(phi) compositional derivative real(kind=pr), intent(out), optional :: dPdV real(kind=pr), intent(out), optional :: dPdT real(kind=pr), intent(out), optional :: dPdn (size(n)) procedure, public :: lnphi_vt => fugacity_vt public subroutine fugacity_vt (eos, n, V, T, P, lnPhi, dlnPhidP, dlnPhidT, dlnPhidn, dPdV, dPdT, dPdn) Calculate fugacity coefficent given volume and temperature. Read more… Arguments Type Intent Optional Attributes Name class( ArModel ) :: eos Model real(kind=pr), intent(in) :: n (:) Mixture mole numbers real(kind=pr), intent(in) :: V Volume [L] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out), optional :: P Pressure [bar] real(kind=pr), intent(out), optional :: lnPhi (size(n)) vector real(kind=pr), intent(out), optional :: dlnPhidP (size(n)) Presssure derivative real(kind=pr), intent(out), optional :: dlnPhidT (size(n)) Temp derivative real(kind=pr), intent(out), optional :: dlnPhidn (size(n),size(n)) compositional derivative real(kind=pr), intent(out), optional :: dPdV real(kind=pr), intent(out), optional :: dPdT real(kind=pr), intent(out), optional :: dPdn (:) procedure, public :: pressure public subroutine pressure (eos, n, v, t, p, dPdV, dPdT, dPdn) Pressure calculation. Read more… Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: v Volume [L] real(kind=pr), intent(in) :: t Temperature [K] real(kind=pr), intent(out) :: p Pressure [bar] real(kind=pr), intent(out), optional :: dPdV real(kind=pr), intent(out), optional :: dPdT real(kind=pr), intent(out), optional :: dPdn (:) procedure, public :: residual_helmholtz public subroutine residual_helmholtz (self, n, v, t, Ar, ArV, ArT, ArTV, ArV2, ArT2, Arn, ArVn, ArTn, Arn2) Arguments Type Intent Optional Attributes Name class( ArModelAdiff ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: v real(kind=pr), intent(in) :: t real(kind=pr), intent(out), optional :: Ar real(kind=pr), intent(out), optional :: ArV real(kind=pr), intent(out), optional :: ArT real(kind=pr), intent(out), optional :: ArTV real(kind=pr), intent(out), optional :: ArV2 real(kind=pr), intent(out), optional :: ArT2 real(kind=pr), intent(out), optional, dimension(size(n)) :: Arn real(kind=pr), intent(out), optional, dimension(size(n)) :: ArVn real(kind=pr), intent(out), optional, dimension(size(n)) :: ArTn real(kind=pr), intent(out), optional :: Arn2 (size(n),size(n)) procedure, public :: volume public subroutine volume (eos, n, P, T, V, root_type) Solves volume roots using newton method. Given pressure and temperature. Read more… Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: P Pressure [bar] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out) :: V Volume [L] character(len=*), intent(in) :: root_type Desired root-type to solve. Options are: [\"liquid\", \"vapor\", \"stable\"]","tags":"","loc":"type/armodeladiff.html"},{"title":"GeGCModelParameters – yaeos ","text":"type, public :: GeGCModelParameters GeGCModelParameters group contribution model parameters container Description Type to represent a UNIFAC like models parameters. The type must be\nprovided with the subgroups ids, maingroups ids, subgroups Rs,\nsubgroups Qs, subgroups maingroups, and maingroups interaction\nparameters. Specifically, the type requires , , and for the maingroups interaction parameters. In the case of\nthe classic UNIFAC model that only requires parameters, the and must be set as null matrixes.\nThe documentation and source code of yaeos UNIFACParameters function could be consulted to understand how to instantiate a GeGCModelParameters object with the classic liquid-vapor UNIFAC\nparameters defined in DDBST. References Dortmund Data Bank Software & Separation Technology Components Type Visibility Attributes Name Initial real(kind=pr), public, allocatable :: maingroups_aij (:,:) Maingroup interaction parameters matrix real(kind=pr), public, allocatable :: maingroups_bij (:,:) Maingroup interaction parameters matrix real(kind=pr), public, allocatable :: maingroups_cij (:,:) Maingroup interaction parameters matrix integer, public, allocatable :: maingroups_ids (:) ID of each model’s maingroup real(kind=pr), public, allocatable :: subgroups_Qs (:) value of each subgroup real(kind=pr), public, allocatable :: subgroups_Rs (:) value of each subgroup integer, public, allocatable :: subgroups_ids (:) ID of each model’s subgroup integer, public, allocatable :: subgroups_maingroups (:) Maingroup of each subgroup Type-Bound Procedures procedure, public :: get_maingroup_index public function get_maingroup_index (self, maingroup_id) result(maingroup_idx) Get index of the maingoup with id: maingoup_id Read more… Arguments Type Intent Optional Attributes Name class( GeGCModelParameters ) :: self integer, intent(in) :: maingroup_id ID of the subgroup Return Value integer Index of the maingroup on the self%maingroups_ids vector procedure, public :: get_maingroups_aij public function get_maingroups_aij (self, maingroup_i_id, maingroup_j_id) result(aij) Get the interaction parameter Read more… Arguments Type Intent Optional Attributes Name class( GeGCModelParameters ) :: self integer, intent(in) :: maingroup_i_id ID of the maingroup i integer, intent(in) :: maingroup_j_id ID of the maingroup j Return Value real(kind=pr) Interaction parameter procedure, public :: get_maingroups_bij public function get_maingroups_bij (self, maingroup_i_id, maingroup_j_id) result(bij) Get the interaction parameter Read more… Arguments Type Intent Optional Attributes Name class( GeGCModelParameters ) :: self integer, intent(in) :: maingroup_i_id ID of the maingroup i integer, intent(in) :: maingroup_j_id ID of the maingroup j Return Value real(kind=pr) Interaction parameter procedure, public :: get_maingroups_cij public function get_maingroups_cij (self, maingroup_i_id, maingroup_j_id) result(cij) Get the interaction parameter Read more… Arguments Type Intent Optional Attributes Name class( GeGCModelParameters ) :: self integer, intent(in) :: maingroup_i_id ID of the maingroup i integer, intent(in) :: maingroup_j_id ID of the maingroup j Return Value real(kind=pr) Interaction parameter procedure, public :: get_subgroup_Q public function get_subgroup_Q (self, subgroup_id) result(subgroup_Q) Get the subgroup’s value Read more… Arguments Type Intent Optional Attributes Name class( GeGCModelParameters ) :: self integer, intent(in) :: subgroup_id ID of the subgroup Return Value real(kind=pr) value of the subgroup procedure, public :: get_subgroup_R public function get_subgroup_R (self, subgroup_id) result(subgroup_R) Get the subgroup’s value Read more… Arguments Type Intent Optional Attributes Name class( GeGCModelParameters ) :: self integer, intent(in) :: subgroup_id ID of the subgroup Return Value real(kind=pr) value of the subgroup procedure, public :: get_subgroup_index public function get_subgroup_index (self, subgroup_id) result(subgroup_idx) Get index of the subgroup with id: subgroup_id Read more… Arguments Type Intent Optional Attributes Name class( GeGCModelParameters ) :: self integer, intent(in) :: subgroup_id ID of the subgroup Return Value integer Index of the subgroup on the self%subgroups_ids vector procedure, public :: get_subgroup_maingroup public function get_subgroup_maingroup (self, subgroup_id) result(subgroup_maingroup) Get the subgroup’s maingroup Read more… Arguments Type Intent Optional Attributes Name class( GeGCModelParameters ) :: self integer, intent(in) :: subgroup_id ID of the subgroup Return Value integer Maingroup of the subgroup procedure, public :: get_subgroups_aij public function get_subgroups_aij (self, subgroup_i_id, subgroup_j_id) result(aij) Get the interaction parameter Read more… Arguments Type Intent Optional Attributes Name class( GeGCModelParameters ) :: self integer, intent(in) :: subgroup_i_id ID of the subgroup i integer, intent(in) :: subgroup_j_id ID of the subgroup j Return Value real(kind=pr) Interaction parameter procedure, public :: get_subgroups_bij public function get_subgroups_bij (self, subgroup_i_id, subgroup_j_id) result(bij) Get the interaction parameter Read more… Arguments Type Intent Optional Attributes Name class( GeGCModelParameters ) :: self integer, intent(in) :: subgroup_i_id ID of the subgroup i integer, intent(in) :: subgroup_j_id ID of the subgroup j Return Value real(kind=pr) Interaction parameter procedure, public :: get_subgroups_cij public function get_subgroups_cij (self, subgroup_i_id, subgroup_j_id) result(cij) Get the interaction parameter Read more… Arguments Type Intent Optional Attributes Name class( GeGCModelParameters ) :: self integer, intent(in) :: subgroup_i_id ID of the subgroup i integer, intent(in) :: subgroup_j_id ID of the subgroup j Return Value real(kind=pr) Interaction parameter","tags":"","loc":"type/gegcmodelparameters.html"},{"title":"MHV – yaeos ","text":"type, public, extends( CubicMixRule ) :: MHV Michelsen’s modified Huron-Vidal mixing rule Mixing rule at zero-pressure which allows for the inclusion of an\nexcess-gibbs model. Description This mixing rule is based on the aproximate zero-pressure limit \n of a cubic equation of state. At the aproximate zero-pressure limit the\nattractive parameter can be expressed as: Where is a weak function of temperature. In the case of MHV and simplicity it is considered that depends on the model used. Examples To use the modified Huron-Vidal mixing rule it is necessary to define\na CubicEoS and replace its original mixing rule with the one generated\nby the user. type ( MHV ) :: mixrule type ( NRTL ) :: ge_model type ( CubicEoS ) :: model ! Define the Ge model to be used and the CubicEoS ge_model = NRTL ( a , b , c ) model = SoaveRedlichKwong ( tc , pc , w ) ! Use the initialization function to setup mixrule = MHV ( ge = ge_model , q =- 0.593_pr , bi = model % b ) ! Replace the original mixrule on the previously defined model model % mixrule = mixrule ! Ready to do calculations call pressure ( model , n , v , T ) References Components Type Visibility Attributes Name Initial class( GeModel ), public, allocatable :: ge real(kind=pr), public, allocatable :: l (:,:) real(kind=pr), public :: q real(kind=pr), private, allocatable :: B real(kind=pr), private, allocatable :: bi (:) real(kind=pr), private, allocatable :: dBi (:) real(kind=pr), private, allocatable :: dBij (:,:) Constructor public interface MHV private function init (Ge, b, q, lij) result(mixrule) Arguments Type Intent Optional Attributes Name class( GeModel ), intent(in) :: Ge real(kind=pr), intent(in) :: b (:) real(kind=pr), intent(in) :: q real(kind=pr), intent(in), optional :: lij (:,:) Return Value type( MHV ) Type-Bound Procedures procedure, public :: Bmix => BmixMHV private subroutine BmixMHV (self, n, bi, B, dBi, dBij) Quadratinc mixing rule for the repulsive parameter, using as a combining rule. Read more… Arguments Type Intent Optional Attributes Name class( MHV ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: bi (:) real(kind=pr), intent(out) :: B real(kind=pr), intent(out) :: dBi (:) real(kind=pr), intent(out) :: dBij (:,:) procedure, public :: D1Mix => D1MixMHV private subroutine D1MixMHV (self, n, d1i, D1, dD1i, dD1ij) Arguments Type Intent Optional Attributes Name class( MHV ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: d1i (:) real(kind=pr), intent(out) :: D1 real(kind=pr), intent(out) :: dD1i (:) real(kind=pr), intent(out) :: dD1ij (:,:) procedure, public :: Dmix => DmixMHV public subroutine DmixMHV (self, n, T, ai, daidt, daidt2, D, dDdT, dDdT2, dDi, dDidT, dDij) Mixing rule at infinite pressure as defined in the book of Michelsen and\nMøllerup. Read more… Arguments Type Intent Optional Attributes Name class( MHV ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: T real(kind=pr), intent(in) :: ai (:) real(kind=pr), intent(in) :: daidt (:) real(kind=pr), intent(in) :: daidt2 (:) real(kind=pr), intent(out) :: D real(kind=pr), intent(out) :: dDdT real(kind=pr), intent(out) :: dDdT2 real(kind=pr), intent(out) :: dDi (:) real(kind=pr), intent(out) :: dDidT (:) real(kind=pr), intent(out) :: dDij (:,:)","tags":"","loc":"type/mhv.html"},{"title":"FitMHVNRTL – yaeos ","text":"type, public, extends( FittingProblem ) :: FitMHVNRTL Components Type Visibility Attributes Name Initial type( EquilibriumState ), public, allocatable :: experimental_points (:) Experimental points to fit logical, public :: fit_lij = .false. logical, public :: fit_nrtl = .false. class( ArModel ), public, allocatable :: model Residual Helmholtz Model to fit logical, public :: verbose = .false. If true log the fitting process Type-Bound Procedures procedure, public :: get_model_from_X => model_from_X public subroutine model_from_X (problem, X) Arguments Type Intent Optional Attributes Name class( FitMHVNRTL ), intent(inout) :: problem real(kind=pr), intent(in) :: X (:)","tags":"","loc":"type/fitmhvnrtl.html"},{"title":"AlphaFunction – yaeos ","text":"type, public, abstract :: AlphaFunction Abstract derived type that describe the required\nprocedure for an alpha function. Type-Bound Procedures procedure( abs_alpha ), public, deferred :: alpha subroutine abs_alpha(self, Tr, a, dadt, dadt2) Prototype Arguments Type Intent Optional Attributes Name class( AlphaFunction ), intent(in) :: self real(kind=pr), intent(in) :: Tr (:) real(kind=pr), intent(out) :: a (:) real(kind=pr), intent(out) :: dadt (:) real(kind=pr), intent(out) :: dadt2 (:)","tags":"","loc":"type/alphafunction.html"},{"title":"CubicEoS – yaeos ","text":"type, public, extends( ArModel ) :: CubicEoS Cubic Equation of State. Generic Cubic Equation of State as defined by Michelsen and Mollerup\nwith a parameter that is not constant, \nand a parameter that depends on it. In the case of a \ntwo parameter EoS like PengRobinson the is the same for\nall components so it can be considered as a constant instead of a \nvariable. The expression of the Equation is: Components Type Visibility Attributes Name Initial real(kind=pr), public, allocatable :: ac (:) Attractive critical parameter class( AlphaFunction ), public, allocatable :: alpha AlphaFunction derived type. Uses the abstract derived type AlphaFunction to define the\nAlpha function that the CubicEoS will use. The Alpha function\nreceives the reduced temperature and returns the values of alpha\nand its derivatives, named a , dadt and dadt2 respectively. Examples Callign the AlphaFunction of a setted up model. use yaeos , only : CubicEoS , PengRobinson76 type ( CubicEoS ) :: eos eos = PengRobinson76 ( tc , pc , w ) call eos % alpha % alpha ( Tr , a , dadt , dadt2 ) real(kind=pr), public, allocatable :: b (:) Repulsive parameter type( Substances ), public :: components Substances contained in the module real(kind=pr), public, allocatable :: del1 (:) paramter real(kind=pr), public, allocatable :: del2 (:) paramter class( CubicMixRule ), public, allocatable :: mixrule CubicMixRule derived type. Uses the abstract derived type CubicMixRule to define the\nmixing rule that the CubicEoS will use. It includes internally\nthree methods to calculate the corresponding parameters for the\nCubic EoS: Dmix , Bmix and D1mix . Examples Calculation of the B parameter. use yaeos , only : CubicEoS , PengRobinson76 type ( CubicEoS ) :: eos eos = PengRobinson76 ( tc , pc , w ) call eos % mixrule % Bmix ( n , eos % b , B , dBi , dBij ) Calculation of the D parameter. use yaeos , only : CubicEoS , PengRobinson76 type ( CubicEoS ) :: eos eos = PengRobinson76 ( tc , pc , w ) ! The mixing rule takes the `a` parameters of the components so ! they should be calculated externally call eos % alpha % alpha ( Tr , a , dadt , dadt2 ) a = a * eos % ac dadt = dadt * eos % ac / eos % components % Tc dadt = dadt * eos % ac / eos % components % Tc ** 2 ! Calculate parameter call eos % mixrule % Dmix ( n , T , a , dadt , dadt2 , D , dDdT , dDdT2 , dDi , dDidT , dDij ) Calculation of the D1 parameter. use yaeos , only : CubicEoS , PengRobinson76 type ( CubicEoS ) :: eos eos = PengRobinson76 ( tc , pc , w ) call eos % mixrule % D1mix ( n , eos % del1 , D1 , dD1i , dD1ij ) character(len=:), public, allocatable :: name Name of the model Type-Bound Procedures procedure, public :: Cp_residual_vt public subroutine Cp_residual_vt (eos, n, V, T, Cp) Calculate residual heat capacity pressure constant given v and t. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: V Volume [L] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out) :: Cp heat capacity p constant [bar L / K / mol] procedure, public :: Cv_residual_vt public subroutine Cv_residual_vt (eos, n, V, T, Cv) Calculate residual heat capacity volume constant given v and t. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: V Volume [L] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out) :: Cv heat capacity v constant [bar L / K / mol] procedure, public :: enthalpy_residual_vt public subroutine enthalpy_residual_vt (eos, n, v, t, Hr, HrT, HrV, Hrn) Calculate residual enthalpy given volume and temperature. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: v Volume [L] real(kind=pr), intent(in) :: t Temperature [K] real(kind=pr), intent(out) :: Hr Residual enthalpy [bar L / mol] real(kind=pr), intent(out), optional :: HrT real(kind=pr), intent(out), optional :: HrV real(kind=pr), intent(out), optional :: Hrn (size(n)) procedure, public :: entropy_residual_vt public subroutine entropy_residual_vt (eos, n, V, T, Sr, SrT, SrV, Srn) Calculate residual entropy given volume and temperature. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: V Volume [L] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out) :: Sr Entropy [bar L / K / mol] real(kind=pr), intent(out), optional :: SrT real(kind=pr), intent(out), optional :: SrV real(kind=pr), intent(out), optional :: Srn (size(n)) procedure, public :: get_v0 => v0 public function v0 (self, n, p, t) Cubic EoS volume initializer.\nFor a Cubic Equation of State, the covolume calculated with the mixing\nrule is a good estimate for the initial volume solver on the liquid\nregion. Arguments Type Intent Optional Attributes Name class( CubicEoS ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: p real(kind=pr), intent(in) :: t Return Value real(kind=pr) procedure, public :: gibbs_residual_vt => gibbs_residual_VT public subroutine gibbs_residual_VT (eos, n, V, T, Gr, GrT, GrV, Grn) Calculate residual Gibbs energy given volume and temperature. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: V Volume [L] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out) :: Gr Gibbs energy [bar L / mol] real(kind=pr), intent(out), optional :: GrT real(kind=pr), intent(out), optional :: GrV real(kind=pr), intent(out), optional :: Grn (size(n)) procedure, public :: lnphi_pt => fugacity_pt public subroutine fugacity_pt (eos, n, P, T, V, root_type, lnPhi, dlnPhidP, dlnPhidT, dlnPhidn, dPdV, dPdT, dPdn) Calculate logarithm of fugacity, given pressure and temperature. Read more… Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Mixture mole numbers real(kind=pr), intent(in) :: P Pressure [bar] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out), optional :: V Volume [L] character(len=*), intent(in) :: root_type Type of root desired [“liquid”, “vapor”, “stable”] real(kind=pr), intent(out), optional :: lnPhi (size(n)) vector real(kind=pr), intent(out), optional :: dlnPhidP (size(n)) ln(phi) Presssure derivative real(kind=pr), intent(out), optional :: dlnPhidT (size(n)) ln(phi) Temp derivative real(kind=pr), intent(out), optional :: dlnPhidn (size(n),size(n)) ln(phi) compositional derivative real(kind=pr), intent(out), optional :: dPdV real(kind=pr), intent(out), optional :: dPdT real(kind=pr), intent(out), optional :: dPdn (size(n)) procedure, public :: lnphi_vt => fugacity_vt public subroutine fugacity_vt (eos, n, V, T, P, lnPhi, dlnPhidP, dlnPhidT, dlnPhidn, dPdV, dPdT, dPdn) Calculate fugacity coefficent given volume and temperature. Read more… Arguments Type Intent Optional Attributes Name class( ArModel ) :: eos Model real(kind=pr), intent(in) :: n (:) Mixture mole numbers real(kind=pr), intent(in) :: V Volume [L] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out), optional :: P Pressure [bar] real(kind=pr), intent(out), optional :: lnPhi (size(n)) vector real(kind=pr), intent(out), optional :: dlnPhidP (size(n)) Presssure derivative real(kind=pr), intent(out), optional :: dlnPhidT (size(n)) Temp derivative real(kind=pr), intent(out), optional :: dlnPhidn (size(n),size(n)) compositional derivative real(kind=pr), intent(out), optional :: dPdV real(kind=pr), intent(out), optional :: dPdT real(kind=pr), intent(out), optional :: dPdn (:) procedure, public :: pressure public subroutine pressure (eos, n, v, t, p, dPdV, dPdT, dPdn) Pressure calculation. Read more… Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: v Volume [L] real(kind=pr), intent(in) :: t Temperature [K] real(kind=pr), intent(out) :: p Pressure [bar] real(kind=pr), intent(out), optional :: dPdV real(kind=pr), intent(out), optional :: dPdT real(kind=pr), intent(out), optional :: dPdn (:) procedure, public :: residual_helmholtz => GenericCubic_Ar public subroutine GenericCubic_Ar (self, n, v, t, ar, arv, ArT, artv, arv2, ArT2, Arn, ArVn, ArTn, Arn2) Residual Helmholtz Energy for a generic Cubic Equation of State. Read more… Arguments Type Intent Optional Attributes Name class( CubicEoS ), intent(in) :: self real(kind=pr), intent(in) :: n (:) Number of moles real(kind=pr), intent(in) :: v Volume [L] real(kind=pr), intent(in) :: t Temperature [K] real(kind=pr), intent(out), optional :: ar Residual Helmholtz real(kind=pr), intent(out), optional :: arv real(kind=pr), intent(out), optional :: ArT real(kind=pr), intent(out), optional :: artv real(kind=pr), intent(out), optional :: arv2 real(kind=pr), intent(out), optional :: ArT2 real(kind=pr), intent(out), optional :: Arn (size(n)) real(kind=pr), intent(out), optional :: ArVn (size(n)) real(kind=pr), intent(out), optional :: ArTn (size(n)) real(kind=pr), intent(out), optional :: Arn2 (size(n),size(n)) procedure, public :: volume public subroutine volume (eos, n, P, T, V, root_type) Volume solver optimized for Cubic Equations of State. Read more… Arguments Type Intent Optional Attributes Name class( CubicEoS ), intent(in) :: eos real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: P real(kind=pr), intent(in) :: T real(kind=pr), intent(out) :: V character(len=*), intent(in) :: root_type","tags":"","loc":"type/cubiceos.html"},{"title":"CubicMixRule – yaeos ","text":"type, public, abstract :: CubicMixRule Abstract derived type that describe the required\nprocedure for a mixing rule on a Cubic EoS Type-Bound Procedures procedure( abs_Bmix ), public, deferred :: Bmix subroutine abs_Bmix(self, n, bi, B, dBi, dBij) Prototype Arguments Type Intent Optional Attributes Name class( CubicMixRule ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: bi (:) real(kind=pr), intent(out) :: B real(kind=pr), intent(out) :: dBi (:) real(kind=pr), intent(out) :: dBij (:,:) procedure( abs_D1mix ), public, deferred :: D1mix subroutine abs_D1mix(self, n, d1i, D1, dD1i, dD1ij) Prototype Arguments Type Intent Optional Attributes Name class( CubicMixRule ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: d1i (:) real(kind=pr), intent(out) :: D1 real(kind=pr), intent(out) :: dD1i (:) real(kind=pr), intent(out) :: dD1ij (:,:) procedure( abs_Dmix ), public, deferred :: Dmix subroutine abs_Dmix(self, n, T, ai, daidt, daidt2, D, dDdT, dDdT2, dDi, dDidT, dDij) Prototype Arguments Type Intent Optional Attributes Name class( CubicMixRule ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: T real(kind=pr), intent(in) :: ai (:) real(kind=pr), intent(in) :: daidt (:) real(kind=pr), intent(in) :: daidt2 (:) real(kind=pr), intent(out) :: D real(kind=pr), intent(out) :: dDdT real(kind=pr), intent(out) :: dDdT2 real(kind=pr), intent(out) :: dDi (:) real(kind=pr), intent(out) :: dDidT (:) real(kind=pr), intent(out) :: dDij (:,:)","tags":"","loc":"type/cubicmixrule.html"},{"title":"Groups – yaeos ","text":"type, public :: Groups Groups Derived type used to represent a molecule and its UNIFAC groups. Description Derived type used to represent a molecule and its UNIFAC groups. Is\nnecessary to specify the subgroups ids and the subgroups on each\nmolecule as shown in the example. Examples ! Define toluene molecule groups use yaeos , only : Groups type ( Groups ) :: toluene ! Toluene [ACH, ACCH3] toluene % groups_ids = [ 9 , 11 ] ! Subgroups ids toluene % number_of_groups = [ 5 , 1 ] ! Subgroups occurrences References Dortmund Data Bank Software & Separation Technology Components Type Visibility Attributes Name Initial integer, public, allocatable :: groups_ids (:) Indexes (ids) of each subgroup in the main group matrix integer, public, allocatable :: number_of_groups (:) Occurrences of each subgroup in the molecule real(kind=pr), public :: surface_area Molecule surface area real(kind=pr), public :: volume Molecule volume","tags":"","loc":"type/groups.html"},{"title":"PsiFunction – yaeos ","text":"type, public, abstract :: PsiFunction function UNIFAC functions abstract type Description Abstract derived type for UNIFAC models temperature dependent functions Type-Bound Procedures procedure( temperature_dependence ), public, deferred :: psi subroutine temperature_dependence(self, systems_groups, T, psi, dpsi_dt, dpsi_dt2) Prototype temperature_dependence interface Interface subroutine for UNIFAC models temperature dependent\nfunctions Arguments Type Intent Optional Attributes Name class( PsiFunction ) :: self PsiFunction type variable class( Groups ) :: systems_groups Groups type variable containig all the system’s groups. See the groups_stew variable on the UNIFAC documentation. real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out), optional :: psi (:,:) real(kind=pr), intent(out), optional :: dpsi_dt (:,:) real(kind=pr), intent(out), optional :: dpsi_dt2 (:,:)","tags":"","loc":"type/psifunction.html"},{"title":"UNIFAC – yaeos ","text":"type, public, extends( GeModel ) :: UNIFAC UNIFAC model Classic liquid-vapor UNIFAC model derived type Description This type holds the needed parameters for using a UNIFAC model\nmainly group areas, volumes and what temperature dependence function to use. It also holds the individual molecules of a particular system and\nthe set of all groups in the system as a “stew” of groups instead of\nbeing them included in particular molecules. Examples ! UNIFAC model with ethanol-formic acid mix and calculate gammas use yaeos , only : pr , Groups , setup_unifac , UNIFAC type ( UNIFAC ) :: model type ( Groups ) :: molecules ( 2 ) real ( pr ) :: ln_gammas ( 2 ) ! Ethanol definition [CH3, CH2, OH] molecules ( 1 )% groups_ids = [ 1 , 2 , 14 ] ! Subgroups ids molecules ( 1 )% number_of_groups = [ 1 , 1 , 1 ] ! Subgroups occurrences ! formic acid definition [HCOOH] molecules ( 2 )% groups_ids = [ 43 ] molecules ( 2 )% number_of_groups = [ 1 ] ! Model setup model = setup_unifac ( molecules ) ! Calculate ln_gammas call model % ln_activity_coefficient ([ 0.5_pr , 0.5_pr ], 29 8.0_pr , ln_gammas ) print * , ln_gammas ! result: 0.10505475697637946 0.28073129552766890 References Dortmund Data Bank Software & Separation Technology Fredenslund, A., Jones, R. L., & Prausnitz, J. M. (1975).\nGroup‐contribution estimation of activity coefficients in nonideal liquid\nmixtures. AIChE Journal, 21(6), 1086–1099. https://doi.org/10.1002/aic.690210607 Skjold-Jorgensen, S., Kolbe, B., Gmehling, J., & Rasmussen, P. (1979).\nVapor-Liquid Equilibria by UNIFAC Group Contribution. Revision and\nExtension. Industrial & Engineering Chemistry Process Design and\nDevelopment, 18(4), 714–722. https://doi.org/10.1021/i260072a024 Gmehling, J., Rasmussen, P., & Fredenslund, A. (1982). Vapor-liquid\nequilibriums by UNIFAC group contribution. Revision and extension. 2.\nIndustrial & Engineering Chemistry Process Design and Development, 21(1),\n118–127. https://doi.org/10.1021/i200016a021 Macedo, E. A., Weidlich, U., Gmehling, J., & Rasmussen, P. (1983).\nVapor-liquid equilibriums by UNIFAC group contribution. Revision and\nextension. 3. Industrial & Engineering Chemistry Process Design and\nDevelopment, 22(4), 676–678. https://doi.org/10.1021/i200023a023 Tiegs, D., Rasmussen, P., Gmehling, J., & Fredenslund, A. (1987).\nVapor-liquid equilibria by UNIFAC group contribution. 4. Revision and\nextension. Industrial & Engineering Chemistry Research, 26(1), 159–161. https://doi.org/10.1021/ie00061a030 Hansen, H. K., Rasmussen, P., Fredenslund, A., Schiller, M., &\nGmehling, J. (1991). Vapor-liquid equilibria by UNIFAC group\ncontribution. 5. Revision and extension. Industrial & Engineering\nChemistry Research, 30 (10), 2352–2355. https://doi.org/10.1021/ie00058a017 Wittig, R., Lohmann, J., & Gmehling, J. (2003). Vapor−Liquid Equilibria\nby UNIFAC Group Contribution. 6. Revision and Extension. Industrial &\nEngineering Chemistry Research, 42(1), 183–188. https://doi.org/10.1021/ie020506l SINTEF - Thermopack Components Type Visibility Attributes Name Initial type( Substances ), public :: components Substances contained in the module real(kind=pr), public, allocatable :: group_area (:) Group areas real(kind=pr), public, allocatable :: group_volume (:) Group volumes type( Groups ), public :: groups_stew All the groups present in the system type( Groups ), public, allocatable :: molecules (:) Substances present in the system integer, public :: ngroups Total number of individual groups in the mixture integer, public :: nmolecules Total number of molecules in the mixture class( PsiFunction ), public, allocatable :: psi_function Temperature dependance function of the model real(kind=pr), public, allocatable :: qk (:) Area of each group k real(kind=pr), public, allocatable :: thetas_ij (:,:) Area fractions of the groups j on molecules i real(kind=pr), public, allocatable :: vij (:,:) Ocurrences of each group j on each molecule i real(kind=pr), public :: z = 10 Model constant Type-Bound Procedures procedure, public :: excess_gibbs public subroutine excess_gibbs (self, n, T, Ge, GeT, GeT2, Gen, GeTn, Gen2) Calculate the Gibbs excess energy of the UNIFAC model Read more… Arguments Type Intent Optional Attributes Name class( UNIFAC ), intent(in) :: self UNIFAC model real(kind=pr), intent(in) :: n (:) Moles vector [mol] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out), optional :: Ge Excess Gibbs energy real(kind=pr), intent(out), optional :: GeT real(kind=pr), intent(out), optional :: GeT2 real(kind=pr), intent(out), optional :: Gen (size(n)) real(kind=pr), intent(out), optional :: GeTn (size(n)) real(kind=pr), intent(out), optional :: Gen2 (size(n),size(n)) procedure, public :: ln_activity_coefficient public subroutine ln_activity_coefficient (self, n, T, lngamma) Arguments Type Intent Optional Attributes Name class( GeModel ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: T real(kind=pr), intent(out) :: lngamma (:)","tags":"","loc":"type/unifac.html"},{"title":"UNIFACPsi – yaeos ","text":"type, public, extends( PsiFunction ) :: UNIFACPsi Original UNIFAC function References Dortmund Data Bank Software & Separation Technology Fredenslund, A., Jones, R. L., & Prausnitz, J. M. (1975).\nGroup‐contribution estimation of activity coefficients in nonideal liquid\nmixtures. AIChE Journal, 21(6), 1086–1099. https://doi.org/10.1002/aic.690210607 Skjold-Jorgensen, S., Kolbe, B., Gmehling, J., & Rasmussen, P. (1979).\nVapor-Liquid Equilibria by UNIFAC Group Contribution. Revision and\nExtension. Industrial & Engineering Chemistry Process Design and\nDevelopment, 18(4), 714–722. https://doi.org/10.1021/i260072a024 Gmehling, J., Rasmussen, P., & Fredenslund, A. (1982). Vapor-liquid\nequilibriums by UNIFAC group contribution. Revision and extension. 2.\nIndustrial & Engineering Chemistry Process Design and Development, 21(1),\n118–127. https://doi.org/10.1021/i200016a021 Macedo, E. A., Weidlich, U., Gmehling, J., & Rasmussen, P. (1983).\nVapor-liquid equilibriums by UNIFAC group contribution. Revision and\nextension. 3. Industrial & Engineering Chemistry Process Design and\nDevelopment, 22(4), 676–678. https://doi.org/10.1021/i200023a023 Tiegs, D., Rasmussen, P., Gmehling, J., & Fredenslund, A. (1987).\nVapor-liquid equilibria by UNIFAC group contribution. 4. Revision and\nextension. Industrial & Engineering Chemistry Research, 26(1), 159–161. https://doi.org/10.1021/ie00061a030 Hansen, H. K., Rasmussen, P., Fredenslund, A., Schiller, M., &\nGmehling, J. (1991). Vapor-liquid equilibria by UNIFAC group\ncontribution. 5. Revision and extension. Industrial & Engineering\nChemistry Research, 30 (10), 2352–2355. https://doi.org/10.1021/ie00058a017 Wittig, R., Lohmann, J., & Gmehling, J. (2003). Vapor−Liquid Equilibria\nby UNIFAC Group Contribution. 6. Revision and Extension. Industrial &\nEngineering Chemistry Research, 42(1), 183–188. https://doi.org/10.1021/ie020506l SINTEF - Thermopack Components Type Visibility Attributes Name Initial real(kind=pr), public, allocatable :: Aij (:,:) Type-Bound Procedures procedure, public :: psi => UNIFAC_temperature_dependence public subroutine UNIFAC_temperature_dependence (self, systems_groups, T, psi, dpsi_dt, dpsi_dt2) Implementation of the function of the UNIFAC model. Read more… Arguments Type Intent Optional Attributes Name class( UNIFACPsi ) :: self function class( Groups ) :: systems_groups Groups in the system real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out), optional :: psi (:,:) real(kind=pr), intent(out), optional :: dpsi_dt (:,:) real(kind=pr), intent(out), optional :: dpsi_dt2 (:,:)","tags":"","loc":"type/unifacpsi.html"},{"title":"FittingProblem – yaeos ","text":"type, public, abstract :: FittingProblem Fitting problem setting Description This derived type holds all the relevant information for a parameter\noptimization problem. It keeps the base model structure that will be\noptimized and a procedure get_model_from_X that should reconstruct\nthe model with the desired parameters to optimize. Components Type Visibility Attributes Name Initial type( EquilibriumState ), public, allocatable :: experimental_points (:) Experimental points to fit class( ArModel ), public, allocatable :: model Residual Helmholtz Model to fit logical, public :: verbose = .false. If true log the fitting process Type-Bound Procedures procedure( model_from_X ), public, deferred :: get_model_from_X subroutine model_from_X(problem, X) Prototype Function that returns a setted model from the parameters vector Arguments Type Intent Optional Attributes Name class( FittingProblem ), intent(inout) :: problem Fitting problem to optimize real(kind=pr), intent(in) :: X (:) Vector of parameters to fit","tags":"","loc":"type/fittingproblem.html"},{"title":"hyperdual – yaeos ","text":"type, public, bind(c) :: hyperdual Components Type Visibility Attributes Name Initial real(kind=pr), public :: f0 = 0 real part of the hyperdual number real(kind=pr), public :: f1 = 0 \\f$\\varepsilon_1\\f$-part of the hyperdual number real(kind=pr), public :: f12 = 0 \\f$\\varepsilon_1\\varepsilon_2\\f$-part of the real(kind=pr), public :: f2 = 0 \\f$\\varepsilon_2\\f$-part of the hyperdual number","tags":"","loc":"type/hyperdual.html"},{"title":"EquilibriumState – yaeos ","text":"type, public :: EquilibriumState Description of a two-phase equilibria state. Contains the relevant information of an equilibrium point obtained\nfrom some kind of equilibria calculation. Components Type Visibility Attributes Name Initial real(kind=pr), public :: P Pressure [bar] real(kind=pr), public :: T Temperature [K] real(kind=pr), public :: Vx Heavy-phase volume [L/mol] real(kind=pr), public :: Vy Light-phase volume [L/mol] real(kind=pr), public :: beta Mole fraction of light-phase integer, public :: iters = 0 Iterations needed to reach the state character(len=14), public :: kind Kind of point [“bubble”, “dew”, “liquid-liquid”, “split”] real(kind=pr), public, allocatable :: x (:) Heavy-phase molar fractions real(kind=pr), public, allocatable :: y (:) Light-phase molar fractions Type-Bound Procedures generic, public :: write (FORMATTED) => write public subroutine write_EquilibriumState (eq, unit, iotype, v_list, iostat, iomsg) Arguments Type Intent Optional Attributes Name class( EquilibriumState ), intent(in) :: eq integer, intent(in) :: unit character(len=*), intent(in) :: iotype integer, intent(in) :: v_list (:) integer, intent(out) :: iostat character(len=*), intent(inout) :: iomsg procedure, private, pass :: write => write_EquilibriumState public subroutine write_EquilibriumState (eq, unit, iotype, v_list, iostat, iomsg) Arguments Type Intent Optional Attributes Name class( EquilibriumState ), intent(in) :: eq integer, intent(in) :: unit character(len=*), intent(in) :: iotype integer, intent(in) :: v_list (:) integer, intent(out) :: iostat character(len=*), intent(inout) :: iomsg","tags":"","loc":"type/equilibriumstate.html"},{"title":"ArModelTapenade – yaeos ","text":"type, public, abstract, extends( ArModel ) :: ArModelTapenade Components Type Visibility Attributes Name Initial type( Substances ), public :: components Substances contained in the module character(len=:), public, allocatable :: name Name of the model Type-Bound Procedures procedure, public :: Cp_residual_vt public subroutine Cp_residual_vt (eos, n, V, T, Cp) Calculate residual heat capacity pressure constant given v and t. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: V Volume [L] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out) :: Cp heat capacity p constant [bar L / K / mol] procedure, public :: Cv_residual_vt public subroutine Cv_residual_vt (eos, n, V, T, Cv) Calculate residual heat capacity volume constant given v and t. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: V Volume [L] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out) :: Cv heat capacity v constant [bar L / K / mol] procedure( tapenade_ar ), public, deferred :: ar subroutine tapenade_ar(model, n, v, t, arval) Prototype Arguments Type Intent Optional Attributes Name class( ArModelTapenade ), intent(in) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: v real(kind=pr), intent(in) :: t real(kind=pr), intent(out) :: arval procedure( tapenade_ar_b ), public, deferred :: ar_b subroutine tapenade_ar_b(model, n, nb, v, vb, t, tb, arval, arvalb) Prototype Arguments Type Intent Optional Attributes Name class( ArModelTapenade ), intent(in) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr) :: nb (:) real(kind=pr), intent(in) :: v real(kind=pr) :: vb real(kind=pr), intent(in) :: t real(kind=pr) :: tb real(kind=pr) :: arval real(kind=pr) :: arvalb procedure( tapenade_ar_d ), public, deferred :: ar_d subroutine tapenade_ar_d(model, n, nd, v, vd, t, td, arval, arvald) Prototype Arguments Type Intent Optional Attributes Name class( ArModelTapenade ), intent(in) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: nd (:) real(kind=pr), intent(in) :: v real(kind=pr), intent(in) :: vd real(kind=pr), intent(in) :: t real(kind=pr), intent(in) :: td real(kind=pr), intent(out) :: arval real(kind=pr), intent(out) :: arvald procedure( tapenade_ar_d_b ), public, deferred :: ar_d_b subroutine tapenade_ar_d_b(model, n, nb, nd, ndb, v, vb, vd, vdb, t, tb, td, tdb, arval, arvalb, arvald, arvaldb) Prototype Arguments Type Intent Optional Attributes Name class( ArModelTapenade ), intent(in) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr) :: nb (:) real(kind=pr), intent(in) :: nd (:) real(kind=pr) :: ndb (:) real(kind=pr), intent(in) :: v real(kind=pr) :: vb real(kind=pr), intent(in) :: vd real(kind=pr) :: vdb real(kind=pr), intent(in) :: t real(kind=pr) :: tb real(kind=pr), intent(in) :: td real(kind=pr) :: tdb real(kind=pr) :: arval real(kind=pr) :: arvalb real(kind=pr) :: arvald real(kind=pr) :: arvaldb procedure( tapenade_ar_d_d ), public, deferred :: ar_d_d subroutine tapenade_ar_d_d(model, n, nd, v, vd0, vd, t, td0, td, arval, arvald0, arvald, arvaldd) Prototype Arguments Type Intent Optional Attributes Name class( ArModelTapenade ), intent(in) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: nd (:) real(kind=pr), intent(in) :: v real(kind=pr), intent(in) :: vd0 real(kind=pr), intent(in) :: vd real(kind=pr), intent(in) :: t real(kind=pr), intent(in) :: td0 real(kind=pr), intent(in) :: td real(kind=pr), intent(out) :: arval real(kind=pr), intent(out) :: arvald0 real(kind=pr), intent(out) :: arvald real(kind=pr), intent(out) :: arvaldd procedure, public :: enthalpy_residual_vt public subroutine enthalpy_residual_vt (eos, n, v, t, Hr, HrT, HrV, Hrn) Calculate residual enthalpy given volume and temperature. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: v Volume [L] real(kind=pr), intent(in) :: t Temperature [K] real(kind=pr), intent(out) :: Hr Residual enthalpy [bar L / mol] real(kind=pr), intent(out), optional :: HrT real(kind=pr), intent(out), optional :: HrV real(kind=pr), intent(out), optional :: Hrn (size(n)) procedure, public :: entropy_residual_vt public subroutine entropy_residual_vt (eos, n, V, T, Sr, SrT, SrV, Srn) Calculate residual entropy given volume and temperature. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: V Volume [L] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out) :: Sr Entropy [bar L / K / mol] real(kind=pr), intent(out), optional :: SrT real(kind=pr), intent(out), optional :: SrV real(kind=pr), intent(out), optional :: Srn (size(n)) procedure, public :: get_v0 private function get_v0 (self, n, p, t) Arguments Type Intent Optional Attributes Name class( ArModelTapenade ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: p real(kind=pr), intent(in) :: t Return Value real(kind=pr) procedure, public :: gibbs_residual_vt => gibbs_residual_VT public subroutine gibbs_residual_VT (eos, n, V, T, Gr, GrT, GrV, Grn) Calculate residual Gibbs energy given volume and temperature. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: V Volume [L] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out) :: Gr Gibbs energy [bar L / mol] real(kind=pr), intent(out), optional :: GrT real(kind=pr), intent(out), optional :: GrV real(kind=pr), intent(out), optional :: Grn (size(n)) procedure, public :: lnphi_pt => fugacity_pt public subroutine fugacity_pt (eos, n, P, T, V, root_type, lnPhi, dlnPhidP, dlnPhidT, dlnPhidn, dPdV, dPdT, dPdn) Calculate logarithm of fugacity, given pressure and temperature. Read more… Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Mixture mole numbers real(kind=pr), intent(in) :: P Pressure [bar] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out), optional :: V Volume [L] character(len=*), intent(in) :: root_type Type of root desired [“liquid”, “vapor”, “stable”] real(kind=pr), intent(out), optional :: lnPhi (size(n)) vector real(kind=pr), intent(out), optional :: dlnPhidP (size(n)) ln(phi) Presssure derivative real(kind=pr), intent(out), optional :: dlnPhidT (size(n)) ln(phi) Temp derivative real(kind=pr), intent(out), optional :: dlnPhidn (size(n),size(n)) ln(phi) compositional derivative real(kind=pr), intent(out), optional :: dPdV real(kind=pr), intent(out), optional :: dPdT real(kind=pr), intent(out), optional :: dPdn (size(n)) procedure, public :: lnphi_vt => fugacity_vt public subroutine fugacity_vt (eos, n, V, T, P, lnPhi, dlnPhidP, dlnPhidT, dlnPhidn, dPdV, dPdT, dPdn) Calculate fugacity coefficent given volume and temperature. Read more… Arguments Type Intent Optional Attributes Name class( ArModel ) :: eos Model real(kind=pr), intent(in) :: n (:) Mixture mole numbers real(kind=pr), intent(in) :: V Volume [L] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out), optional :: P Pressure [bar] real(kind=pr), intent(out), optional :: lnPhi (size(n)) vector real(kind=pr), intent(out), optional :: dlnPhidP (size(n)) Presssure derivative real(kind=pr), intent(out), optional :: dlnPhidT (size(n)) Temp derivative real(kind=pr), intent(out), optional :: dlnPhidn (size(n),size(n)) compositional derivative real(kind=pr), intent(out), optional :: dPdV real(kind=pr), intent(out), optional :: dPdT real(kind=pr), intent(out), optional :: dPdn (:) procedure, public :: pressure public subroutine pressure (eos, n, v, t, p, dPdV, dPdT, dPdn) Pressure calculation. Read more… Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: v Volume [L] real(kind=pr), intent(in) :: t Temperature [K] real(kind=pr), intent(out) :: p Pressure [bar] real(kind=pr), intent(out), optional :: dPdV real(kind=pr), intent(out), optional :: dPdT real(kind=pr), intent(out), optional :: dPdn (:) procedure, public :: residual_helmholtz private subroutine residual_helmholtz (self, n, v, t, Ar, ArV, ArT, ArTV, ArV2, ArT2, Arn, ArVn, ArTn, Arn2) Residual Helmholtz model generic interface Arguments Type Intent Optional Attributes Name class( ArModelTapenade ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: v real(kind=pr), intent(in) :: t real(kind=pr), intent(out), optional :: Ar real(kind=pr), intent(out), optional :: ArV real(kind=pr), intent(out), optional :: ArT real(kind=pr), intent(out), optional :: ArTV real(kind=pr), intent(out), optional :: ArV2 real(kind=pr), intent(out), optional :: ArT2 real(kind=pr), intent(out), optional, dimension(size(n)) :: Arn real(kind=pr), intent(out), optional, dimension(size(n)) :: ArVn real(kind=pr), intent(out), optional, dimension(size(n)) :: ArTn real(kind=pr), intent(out), optional :: Arn2 (size(n),size(n)) procedure( tapenade_v0 ), public, deferred :: v0 pure function tapenade_v0(model, n, p, t) Prototype Arguments Type Intent Optional Attributes Name class( ArModelTapenade ), intent(in) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: p real(kind=pr), intent(in) :: t Return Value real(kind=pr) procedure, public :: volume public subroutine volume (eos, n, P, T, V, root_type) Solves volume roots using newton method. Given pressure and temperature. Read more… Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: P Pressure [bar] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out) :: V Volume [L] character(len=*), intent(in) :: root_type Desired root-type to solve. Options are: [\"liquid\", \"vapor\", \"stable\"]","tags":"","loc":"type/armodeltapenade.html"},{"title":"ContinuationVariable – yaeos ","text":"type, public :: ContinuationVariable Components Type Visibility Attributes Name Initial real(kind=pr), public :: S real(kind=pr), public, allocatable :: X (:) real(kind=pr), public :: dS integer, public :: ns","tags":"","loc":"type/continuationvariable.html"},{"title":"NRTL – yaeos ","text":"type, public, extends( GeModelTapenade ) :: NRTL Non-Random-Two-Liquid model with: Components Type Visibility Attributes Name Initial real(kind=pr), public, allocatable :: a (:,:) A_{ij} matrix real(kind=pr), public, allocatable :: b (:,:) B_{ij} matrix real(kind=pr), public, allocatable :: c (:,:) C_{ij} matrix type( Substances ), public :: components Substances contained in the module Constructor public interface NRTL public function init (a, b, c) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: a (:,:) real(kind=pr), intent(in) :: b (:,:) real(kind=pr), intent(in) :: c (:,:) Return Value type( NRTL ) Type-Bound Procedures procedure, public :: excess_gibbs private subroutine excess_gibbs (self, n, t, Ge, GeT, GeT2, Gen, GeTn, Gen2) Excess Gibbs model generic interface Arguments Type Intent Optional Attributes Name class( GeModelTapenade ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: t real(kind=pr), intent(out), optional :: Ge real(kind=pr), intent(out), optional :: GeT real(kind=pr), intent(out), optional :: GeT2 real(kind=pr), intent(out), optional, dimension(size(n)) :: Gen real(kind=pr), intent(out), optional, dimension(size(n)) :: GeTn real(kind=pr), intent(out), optional :: Gen2 (size(n),size(n)) procedure, public :: ge => EXCESS_GIBBS public subroutine EXCESS_GIBBS (model, n, t, ge) Arguments Type Intent Optional Attributes Name class( NRTL ) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: t real(kind=pr), intent(out) :: ge procedure, public :: ge_b => EXCESS_GIBBS_B public subroutine EXCESS_GIBBS_B (model, n, nb, t, tb, ge, geb) Arguments Type Intent Optional Attributes Name class( NRTL ) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr) :: nb (:) real(kind=pr), intent(in) :: t real(kind=pr) :: tb real(kind=pr) :: ge real(kind=pr) :: geb procedure, public :: ge_d => EXCESS_GIBBS_D public subroutine EXCESS_GIBBS_D (model, n, nd, t, td, ge, ged) Arguments Type Intent Optional Attributes Name class( NRTL ) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: nd (:) real(kind=pr), intent(in) :: t real(kind=pr), intent(in) :: td real(kind=pr), intent(out) :: ge real(kind=pr), intent(out) :: ged procedure, public :: ge_d_b => EXCESS_GIBBS_D_B public subroutine EXCESS_GIBBS_D_B (model, n, nb, nd, ndb, t, tb, td, tdb, ge, geb, ged, gedb) Arguments Type Intent Optional Attributes Name class( NRTL ) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr) :: nb (:) real(kind=pr), intent(in) :: nd (:) real(kind=pr) :: ndb (:) real(kind=pr), intent(in) :: t real(kind=pr) :: tb real(kind=pr), intent(in) :: td real(kind=pr) :: tdb real(kind=pr) :: ge real(kind=pr) :: geb real(kind=pr) :: ged real(kind=pr) :: gedb procedure, public :: ge_d_d => EXCESS_GIBBS_D_D public subroutine EXCESS_GIBBS_D_D (model, n, nd, t, td0, td, ge, ged0, ged, gedd) Arguments Type Intent Optional Attributes Name class( NRTL ) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: nd (:) real(kind=pr), intent(in) :: t real(kind=pr), intent(in) :: td0 real(kind=pr), intent(in) :: td real(kind=pr), intent(out) :: ge real(kind=pr), intent(out) :: ged0 real(kind=pr), intent(out) :: ged real(kind=pr), intent(out) :: gedd procedure, public :: ln_activity_coefficient public subroutine ln_activity_coefficient (self, n, T, lngamma) Arguments Type Intent Optional Attributes Name class( GeModel ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: T real(kind=pr), intent(out) :: lngamma (:)","tags":"","loc":"type/nrtl.html"},{"title":"TMOptimizeData – yaeos ","text":"type, private :: TMOptimizeData Data structure to hold the data for the min_tpd optimization Components Type Visibility Attributes Name Initial real(kind=pr), public :: P real(kind=pr), public :: T real(kind=pr), public, allocatable :: di (:) class( ArModel ), public, pointer :: model real(kind=pr), public, allocatable :: z (:)","tags":"","loc":"type/tmoptimizedata.html"},{"title":"CriticalPoint – yaeos ","text":"type, public :: CriticalPoint Critical point Components Type Visibility Attributes Name Initial real(kind=pr), public :: P Pressure [bar] real(kind=pr), public :: alpha","tags":"","loc":"type/criticalpoint~2.html"},{"title":"PXEnvel2 – yaeos ","text":"type, public :: PXEnvel2 Two-phase PX envelope.\nPhase boundary line of a fluid at constant temperature\nwith variation in composition. Components Type Visibility Attributes Name Initial real(kind=pr), public, allocatable :: alpha (:) Second fluid molar fraction type( CriticalPoint ), public, allocatable :: cps (:) Critical points found along the line. type( EquilibriumState ), public, allocatable :: points (:) Each point through the line. real(kind=pr), public, allocatable :: z0 (:) Original fluid composition real(kind=pr), public, allocatable :: z_inj (:) Second fluid composition","tags":"","loc":"type/pxenvel2.html"},{"title":"excess_gibbs – yaeos","text":"interface public subroutine excess_gibbs(self, n, t, Ge, GeT, GeT2, Gen, GeTn, Gen2) Arguments Type Intent Optional Attributes Name class( GeModel ), intent(in) :: self Model real(kind=pr), intent(in) :: n (:) Moles vector real(kind=pr), intent(in) :: t Temperature [K] real(kind=pr), intent(out), optional :: Ge Excess Gibbs real(kind=pr), intent(out), optional :: GeT real(kind=pr), intent(out), optional :: GeT2 real(kind=pr), intent(out), optional :: Gen (size(n)) real(kind=pr), intent(out), optional :: GeTn (size(n)) real(kind=pr), intent(out), optional :: Gen2 (size(n),size(n)) Description Excess Gibbs and derivs procedure","tags":"","loc":"interface/excess_gibbs.html"},{"title":"get_aij – yaeos","text":"interface public subroutine get_aij(self, T, ai, daidt, daidt2, aij, daijdt, daijdt2) Arguments Type Intent Optional Attributes Name class( QMR ), intent(in) :: self real(kind=pr), intent(in) :: T real(kind=pr), intent(in) :: ai (:) real(kind=pr), intent(in) :: daidt (:) real(kind=pr), intent(in) :: daidt2 (:) real(kind=pr), intent(out) :: aij (:,:) real(kind=pr), intent(out) :: daijdt (:,:) real(kind=pr), intent(out) :: daijdt2 (:,:) Description Combining rule for the attractive parameter. From previously calculated attractive parameters calculate the matrix and it’s corresponding derivatives.","tags":"","loc":"interface/get_aij.html"},{"title":"abs_residual_helmholtz – yaeos","text":"interface public subroutine abs_residual_helmholtz(self, n, v, t, Ar, ArV, ArT, ArTV, ArV2, ArT2, Arn, ArVn, ArTn, Arn2) Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: self ArModel real(kind=pr), intent(in) :: n (:) Moles vector real(kind=pr), intent(in) :: v Volume [L] real(kind=pr), intent(in) :: t Temperature [K] real(kind=pr), intent(out), optional :: Ar Residual Helmoltz energy real(kind=pr), intent(out), optional :: ArV real(kind=pr), intent(out), optional :: ArT real(kind=pr), intent(out), optional :: ArTV real(kind=pr), intent(out), optional :: ArV2 real(kind=pr), intent(out), optional :: ArT2 real(kind=pr), intent(out), optional :: Arn (size(n)) real(kind=pr), intent(out), optional :: ArVn (size(n)) real(kind=pr), intent(out), optional :: ArTn (size(n)) real(kind=pr), intent(out), optional :: Arn2 (size(n),size(n)) Description Residual Helmholtz model generic interface. This interface represents how an Ar model should be implemented.\nBy our standard, a Resiudal Helmholtz model takes as input: The mixture’s number of moles vector. Volume, by default in liters. Temperature, by default in Kelvin. All the output arguments are optional. While this keeps a long\nsignature for the implementation, this is done this way to take\nadvantage of any inner optimizations to calculate derivatives\ninside the procedure. Once the model is implemented, the signature can be short like model%residual_helmholtz(n, v, t, ArT2=dArdT2)","tags":"","loc":"interface/abs_residual_helmholtz.html"},{"title":"abs_volume_initializer – yaeos","text":"interface public function abs_volume_initializer(self, n, p, t) Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: self Ar Model real(kind=pr), intent(in) :: n (:) Moles vector real(kind=pr), intent(in) :: p Pressure [bar] real(kind=pr), intent(in) :: t Temperature [K] Return Value real(kind=pr) Initial volume [L] Description Function that provides an initializer value for the liquid-root\nof newton solver of volume. In the case the model will use the volume_michelsen routine this value should provide the co-volume\nof the model.","tags":"","loc":"interface/abs_volume_initializer.html"},{"title":"abs_optimize – yaeos","text":"interface public subroutine abs_optimize(self, foo, X, F, data) Arguments Type Intent Optional Attributes Name class( Optimizer ), intent(inout) :: self procedure( obj_func ) :: foo real(kind=pr), intent(inout) :: X (:) real(kind=pr), intent(out) :: F class(*), intent(inout), optional, target :: data","tags":"","loc":"interface/abs_optimize.html"},{"title":"obj_func – yaeos","text":"interface public subroutine obj_func(X, F, dF, data) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: X (:) real(kind=pr), intent(out) :: F real(kind=pr), intent(out), optional :: dF (:) class(*), intent(inout), optional :: data","tags":"","loc":"interface/obj_func.html"},{"title":"tapenade_ge – yaeos","text":"interface private subroutine tapenade_ge(model, n, t, ge) Arguments Type Intent Optional Attributes Name class( GeModelTapenade ) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: t real(kind=pr), intent(out) :: ge","tags":"","loc":"interface/tapenade_ge.html"},{"title":"tapenade_ge_b – yaeos","text":"interface private subroutine tapenade_ge_b(model, n, nb, t, tb, ge, geb) Arguments Type Intent Optional Attributes Name class( GeModelTapenade ) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr) :: nb (:) real(kind=pr), intent(in) :: t real(kind=pr) :: tb real(kind=pr) :: ge real(kind=pr) :: geb","tags":"","loc":"interface/tapenade_ge_b.html"},{"title":"tapenade_ge_d – yaeos","text":"interface private subroutine tapenade_ge_d(model, n, nd, t, td, ge, ged) Arguments Type Intent Optional Attributes Name class( GeModelTapenade ) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: nd (:) real(kind=pr), intent(in) :: t real(kind=pr), intent(in) :: td real(kind=pr), intent(out) :: ge real(kind=pr), intent(out) :: ged","tags":"","loc":"interface/tapenade_ge_d.html"},{"title":"tapenade_ge_d_b – yaeos","text":"interface private subroutine tapenade_ge_d_b(model, n, nb, nd, ndb, t, tb, td, tdb, ge, geb, ged, gedb) Arguments Type Intent Optional Attributes Name class( GeModelTapenade ) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr) :: nb (:) real(kind=pr), intent(in) :: nd (:) real(kind=pr) :: ndb (:) real(kind=pr), intent(in) :: t real(kind=pr) :: tb real(kind=pr), intent(in) :: td real(kind=pr) :: tdb real(kind=pr) :: ge real(kind=pr) :: geb real(kind=pr) :: ged real(kind=pr) :: gedb","tags":"","loc":"interface/tapenade_ge_d_b.html"},{"title":"tapenade_ge_d_d – yaeos","text":"interface private subroutine tapenade_ge_d_d(model, n, nd, t, td0, td, ge, ged0, ged, gedd) Arguments Type Intent Optional Attributes Name class( GeModelTapenade ) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: nd (:) real(kind=pr), intent(in) :: t real(kind=pr), intent(in) :: td0 real(kind=pr), intent(in) :: td real(kind=pr), intent(out) :: ge real(kind=pr), intent(out) :: ged0 real(kind=pr), intent(out) :: ged real(kind=pr), intent(out) :: gedd","tags":"","loc":"interface/tapenade_ge_d_d.html"},{"title":"hyperdual_Ar – yaeos","text":"interface public function hyperdual_Ar(self, n, v, t) Arguments Type Intent Optional Attributes Name class( ArModelAdiff ) :: self type( hyperdual ), intent(in) :: n (:) type( hyperdual ), intent(in) :: v type( hyperdual ), intent(in) :: t Return Value type( hyperdual )","tags":"","loc":"interface/hyperdual_ar.html"},{"title":"abs_Bmix – yaeos","text":"interface public subroutine abs_Bmix(self, n, bi, B, dBi, dBij) Arguments Type Intent Optional Attributes Name class( CubicMixRule ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: bi (:) real(kind=pr), intent(out) :: B real(kind=pr), intent(out) :: dBi (:) real(kind=pr), intent(out) :: dBij (:,:)","tags":"","loc":"interface/abs_bmix.html"},{"title":"abs_D1mix – yaeos","text":"interface public subroutine abs_D1mix(self, n, d1i, D1, dD1i, dD1ij) Arguments Type Intent Optional Attributes Name class( CubicMixRule ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: d1i (:) real(kind=pr), intent(out) :: D1 real(kind=pr), intent(out) :: dD1i (:) real(kind=pr), intent(out) :: dD1ij (:,:)","tags":"","loc":"interface/abs_d1mix.html"},{"title":"abs_Dmix – yaeos","text":"interface public subroutine abs_Dmix(self, n, T, ai, daidt, daidt2, D, dDdT, dDdT2, dDi, dDidT, dDij) Arguments Type Intent Optional Attributes Name class( CubicMixRule ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: T real(kind=pr), intent(in) :: ai (:) real(kind=pr), intent(in) :: daidt (:) real(kind=pr), intent(in) :: daidt2 (:) real(kind=pr), intent(out) :: D real(kind=pr), intent(out) :: dDdT real(kind=pr), intent(out) :: dDdT2 real(kind=pr), intent(out) :: dDi (:) real(kind=pr), intent(out) :: dDidT (:) real(kind=pr), intent(out) :: dDij (:,:)","tags":"","loc":"interface/abs_dmix.html"},{"title":"abs_alpha – yaeos","text":"interface public subroutine abs_alpha(self, Tr, a, dadt, dadt2) Arguments Type Intent Optional Attributes Name class( AlphaFunction ), intent(in) :: self real(kind=pr), intent(in) :: Tr (:) real(kind=pr), intent(out) :: a (:) real(kind=pr), intent(out) :: dadt (:) real(kind=pr), intent(out) :: dadt2 (:)","tags":"","loc":"interface/abs_alpha.html"},{"title":"Ares – yaeos","text":"interface public subroutine Ares(z, v, t, Ar, ArV, ArTV, ArV2, Arn, ArVn, ArTn, Arn2) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: z (:) real(kind=pr), intent(in) :: v real(kind=pr), intent(in) :: t real(kind=pr), intent(out) :: Ar real(kind=pr), intent(out) :: ArV real(kind=pr), intent(out) :: ArTV real(kind=pr), intent(out) :: ArV2 real(kind=pr), intent(out), dimension(size(z)) :: Arn real(kind=pr), intent(out), dimension(size(z)) :: ArVn real(kind=pr), intent(out), dimension(size(z)) :: ArTn real(kind=pr), intent(out) :: Arn2 (size(z),size(z))","tags":"","loc":"interface/ares.html"},{"title":"initial_volume – yaeos","text":"interface public function initial_volume(z, p, t) Arguments Type Intent Optional Attributes Name real(kind=pr) :: z (:) real(kind=pr) :: p real(kind=pr) :: t Return Value real(kind=pr)","tags":"","loc":"interface/initial_volume.html"},{"title":"temperature_dependence – yaeos","text":"interface public subroutine temperature_dependence(self, systems_groups, T, psi, dpsi_dt, dpsi_dt2) Arguments Type Intent Optional Attributes Name class( PsiFunction ) :: self PsiFunction type variable class( Groups ) :: systems_groups Groups type variable containig all the system’s groups. See the groups_stew variable on the UNIFAC documentation. real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out), optional :: psi (:,:) real(kind=pr), intent(out), optional :: dpsi_dt (:,:) real(kind=pr), intent(out), optional :: dpsi_dt2 (:,:) Description temperature_dependence interface Interface subroutine for UNIFAC models temperature dependent\nfunctions","tags":"","loc":"interface/temperature_dependence.html"},{"title":"model_from_X – yaeos","text":"interface public subroutine model_from_X(problem, X) Arguments Type Intent Optional Attributes Name class( FittingProblem ), intent(inout) :: problem Fitting problem to optimize real(kind=pr), intent(in) :: X (:) Vector of parameters to fit Description Function that returns a setted model from the parameters vector","tags":"","loc":"interface/model_from_x.html"},{"title":"tapenade_ar – yaeos","text":"interface private subroutine tapenade_ar(model, n, v, t, arval) Arguments Type Intent Optional Attributes Name class( ArModelTapenade ), intent(in) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: v real(kind=pr), intent(in) :: t real(kind=pr), intent(out) :: arval","tags":"","loc":"interface/tapenade_ar.html"},{"title":"tapenade_ar_b – yaeos","text":"interface private subroutine tapenade_ar_b(model, n, nb, v, vb, t, tb, arval, arvalb) Arguments Type Intent Optional Attributes Name class( ArModelTapenade ), intent(in) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr) :: nb (:) real(kind=pr), intent(in) :: v real(kind=pr) :: vb real(kind=pr), intent(in) :: t real(kind=pr) :: tb real(kind=pr) :: arval real(kind=pr) :: arvalb","tags":"","loc":"interface/tapenade_ar_b.html"},{"title":"tapenade_ar_d – yaeos","text":"interface private subroutine tapenade_ar_d(model, n, nd, v, vd, t, td, arval, arvald) Arguments Type Intent Optional Attributes Name class( ArModelTapenade ), intent(in) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: nd (:) real(kind=pr), intent(in) :: v real(kind=pr), intent(in) :: vd real(kind=pr), intent(in) :: t real(kind=pr), intent(in) :: td real(kind=pr), intent(out) :: arval real(kind=pr), intent(out) :: arvald","tags":"","loc":"interface/tapenade_ar_d.html"},{"title":"tapenade_ar_d_b – yaeos","text":"interface private subroutine tapenade_ar_d_b(model, n, nb, nd, ndb, v, vb, vd, vdb, t, tb, td, tdb, arval, arvalb, arvald, arvaldb) Arguments Type Intent Optional Attributes Name class( ArModelTapenade ), intent(in) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr) :: nb (:) real(kind=pr), intent(in) :: nd (:) real(kind=pr) :: ndb (:) real(kind=pr), intent(in) :: v real(kind=pr) :: vb real(kind=pr), intent(in) :: vd real(kind=pr) :: vdb real(kind=pr), intent(in) :: t real(kind=pr) :: tb real(kind=pr), intent(in) :: td real(kind=pr) :: tdb real(kind=pr) :: arval real(kind=pr) :: arvalb real(kind=pr) :: arvald real(kind=pr) :: arvaldb","tags":"","loc":"interface/tapenade_ar_d_b.html"},{"title":"tapenade_ar_d_d – yaeos","text":"interface private subroutine tapenade_ar_d_d(model, n, nd, v, vd0, vd, t, td0, td, arval, arvald0, arvald, arvaldd) Arguments Type Intent Optional Attributes Name class( ArModelTapenade ), intent(in) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: nd (:) real(kind=pr), intent(in) :: v real(kind=pr), intent(in) :: vd0 real(kind=pr), intent(in) :: vd real(kind=pr), intent(in) :: t real(kind=pr), intent(in) :: td0 real(kind=pr), intent(in) :: td real(kind=pr), intent(out) :: arval real(kind=pr), intent(out) :: arvald0 real(kind=pr), intent(out) :: arvald real(kind=pr), intent(out) :: arvaldd","tags":"","loc":"interface/tapenade_ar_d_d.html"},{"title":"tapenade_v0 – yaeos","text":"interface private pure function tapenade_v0(model, n, p, t) Arguments Type Intent Optional Attributes Name class( ArModelTapenade ), intent(in) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: p real(kind=pr), intent(in) :: t Return Value real(kind=pr)","tags":"","loc":"interface/tapenade_v0.html"},{"title":"continuation_function – yaeos","text":"interface public subroutine continuation_function(X, ns, S, F, dF, dFdS) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: X (:) integer, intent(in) :: ns real(kind=pr), intent(in) :: S real(kind=pr), intent(out) :: F (:) real(kind=pr), intent(out) :: dF (:,:) real(kind=pr), intent(out) :: dFdS (:)","tags":"","loc":"interface/continuation_function.html"},{"title":"continuation_solver – yaeos","text":"interface public subroutine continuation_solver(fun, iters, X, ns, S, dS, dXdS, point, max_iters, F, df, dfds, tol) Arguments Type Intent Optional Attributes Name procedure( continuation_function ) :: fun Function to solve integer, intent(out) :: iters Number of iterations needed real(kind=pr), intent(inout) :: X (:) Variables vector integer, intent(in) :: ns Specification number real(kind=pr), intent(in) :: S Specification value real(kind=pr), intent(in) :: dS Delta spec real(kind=pr), intent(in) :: dXdS (:) integer, intent(in) :: point Point number integer, intent(in) :: max_iters Maximum iterations real(kind=pr), intent(out) :: F (:) Function values at solved point real(kind=pr), intent(out) :: df (:,:) Jacobian values real(kind=pr), intent(out) :: dfds (:) dFdS real(kind=pr), intent(in) :: tol Solver tolerance Description Solver to solve a point during numerical contination.","tags":"","loc":"interface/continuation_solver.html"},{"title":"continuation_stopper – yaeos","text":"interface public function continuation_stopper(X, ns, S, dS, dXdS, iterations) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(inout) :: X (:) Vector of variables integer, intent(inout) :: ns Position of specified variable real(kind=pr), intent(inout) :: S Specification variable value real(kind=pr), intent(inout) :: dS Step of specification in the method real(kind=pr), intent(inout) :: dXdS (:) integer, intent(in) :: iterations Iterations needed to converge point Return Value logical Description Function that returns true if the method should stop","tags":"","loc":"interface/continuation_stopper.html"},{"title":"process – yaeos","text":"interface public subroutine process(X, ns, S, dS, dXdS, iterations) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(inout) :: X (:) Vector of variables integer, intent(inout) :: ns Position of specified variable real(kind=pr), intent(inout) :: S Specification variable value real(kind=pr), intent(inout) :: dS Step of specification in the method real(kind=pr), intent(inout) :: dXdS (:) integer, intent(in) :: iterations Iterations needed to converge point Description Subroutine to make variation in the method after a point converged","tags":"","loc":"interface/process.html"},{"title":"f_1d – yaeos","text":"interface public subroutine f_1d(x, f, df) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: x real(kind=pr), intent(out) :: f real(kind=pr), intent(out) :: df","tags":"","loc":"interface/f_1d.html"},{"title":"ln_activity_coefficient – yaeos","text":"public subroutine ln_activity_coefficient(self, n, T, lngamma) Type Bound GeModel Arguments Type Intent Optional Attributes Name class( GeModel ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: T real(kind=pr), intent(out) :: lngamma (:) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: dgedn (size(n)) real(kind=pr), public :: ge","tags":"","loc":"proc/ln_activity_coefficient.html"},{"title":"POPREAL8 – yaeos","text":"interface public subroutine POPREAL8(a) Arguments Type Intent Optional Attributes Name real(kind=pr) :: a","tags":"","loc":"interface/popreal8.html"},{"title":"POPREAL8ARRAY – yaeos","text":"interface public subroutine POPREAL8ARRAY(a, n) Arguments Type Intent Optional Attributes Name real(kind=pr), dimension(n) :: a integer :: n","tags":"","loc":"interface/popreal8array.html"},{"title":"popinteger4 – yaeos","text":"interface public subroutine popinteger4(i) Arguments Type Intent Optional Attributes Name integer :: i","tags":"","loc":"interface/popinteger4.html"},{"title":"pushinteger4 – yaeos","text":"interface public subroutine pushinteger4(i) Arguments Type Intent Optional Attributes Name integer :: i","tags":"","loc":"interface/pushinteger4.html"},{"title":"pushreal8 – yaeos","text":"interface public subroutine pushreal8(a) Arguments Type Intent Optional Attributes Name real(kind=pr) :: a","tags":"","loc":"interface/pushreal8.html"},{"title":"pushreal8array – yaeos","text":"interface public subroutine pushreal8array(a, n) Arguments Type Intent Optional Attributes Name real(kind=pr), dimension(n) :: a integer :: n","tags":"","loc":"interface/pushreal8array.html"},{"title":"Bmix – yaeos","text":"public subroutine Bmix(self, n, bi, B, dBi, dBij) Mixture repulsive parameter. Calculate the mixture’s repulsive parameter and it’s derivatives\nwith respect to composition: Type Bound QMR Arguments Type Intent Optional Attributes Name class( QMR ), intent(in) :: self Mixing rule object. real(kind=pr), intent(in) :: n (:) Moles vector. real(kind=pr), intent(in) :: bi (:) Pure components repulsive parameters. real(kind=pr), intent(out) :: B Mixture repulsive parameter. real(kind=pr), intent(out) :: dBi (:) real(kind=pr), intent(out) :: dBij (:,:)","tags":"","loc":"proc/bmix.html"},{"title":"D1mix_constant – yaeos","text":"public subroutine D1mix_constant(self, n, d1i, D1, dD1i, dD1ij) Uses yaeos__models_ar_cubic_mixing_base Constant parameter. Most Cubic EoS keep a constant value for their parameter.\nThis procedure assumes that all the components have the same and takes the first value as the one of the mixture. Type Bound QMR Arguments Type Intent Optional Attributes Name class( QMR ), intent(in) :: self Mixing rule real(kind=pr), intent(in) :: n (:) Moles vector real(kind=pr), intent(in) :: d1i (:) parameter real(kind=pr), intent(out) :: D1 Mixture’s real(kind=pr), intent(out) :: dD1i (:) real(kind=pr), intent(out) :: dD1ij (:,:)","tags":"","loc":"proc/d1mix_constant.html"},{"title":"Dmix – yaeos","text":"public subroutine Dmix(self, n, T, ai, daidt, daidt2, D, dDdT, dDdT2, dDi, dDidT, dDij) Attractive parameter mixing rule with quadratic mix. Takes the all the pure components attractive parameters and their\nderivatives with respect to temperature and mix them with the\nVan der Waals quadratic mixing rule: Inside the routine the matrix is calculated using the\nprocedure contained in the QMR object, this procedures defaults\nto the common combining rule: The procedure can be overloaded by a common one that respects the\ninterface get_aij type ( QMR ) :: my_mixing_rule my_mixing_rule % aij => new_aij_procedure Type Bound QMR Arguments Type Intent Optional Attributes Name class( QMR ), intent(in) :: self Mixing rule object. real(kind=pr), intent(in) :: n (:) Moles vector [mol] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(in) :: ai (:) Pure components attractive parameters real(kind=pr), intent(in) :: daidt (:) real(kind=pr), intent(in) :: daidt2 (:) real(kind=pr), intent(out) :: D Mixture attractive parameter real(kind=pr), intent(out) :: dDdT real(kind=pr), intent(out) :: dDdT2 real(kind=pr), intent(out) :: dDi (:) real(kind=pr), intent(out) :: dDidT (:) real(kind=pr), intent(out) :: dDij (:,:) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: aij (size(ai),size(ai)) real(kind=pr), public :: aux real(kind=pr), public :: aux2 real(kind=pr), public :: daijdt (size(ai),size(ai)) real(kind=pr), public :: daijdt2 (size(ai),size(ai)) integer, public :: i integer, public :: j integer, public :: nc","tags":"","loc":"proc/dmix.html"},{"title":"RKPR_D1mix – yaeos","text":"public subroutine RKPR_D1mix(self, n, d1i, D1, dD1i, dD1ij) Uses yaeos__models_ar_cubic_mixing_base RKPR parameter mixing rule. The RKPR EoS doesn’t have a constant value for each \ncomponent, so a proper mixing rule should be provided. A linear\ncombination is used. Type Bound QMR_RKPR Arguments Type Intent Optional Attributes Name class( QMR_RKPR ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: d1i (:) real(kind=pr), intent(out) :: D1 real(kind=pr), intent(out) :: dD1i (:) real(kind=pr), intent(out) :: dD1ij (:,:)","tags":"","loc":"proc/rkpr_d1mix.html"},{"title":"kij_constant – yaeos","text":"public subroutine kij_constant(self, T, a, dadt, dadt2, aij, daijdt, daijdt2) Combining rule that uses constant values. [\n a_{ij} = \\sqrt{a_i a_j} (1 - k_{ij})\n] Arguments Type Intent Optional Attributes Name class( QMR ), intent(in) :: self real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(in) :: a (:) Pure components attractive parameters (\\a_i) real(kind=pr), intent(in) :: dadt (:) real(kind=pr), intent(in) :: dadt2 (:) real(kind=pr), intent(out) :: aij (:,:) Matrix real(kind=pr), intent(out) :: daijdt (:,:) real(kind=pr), intent(out) :: daijdt2 (:,:) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: aij_daidt integer, public :: i real(kind=pr), public :: inner_sum integer, public :: j real(kind=pr), public :: sqrt_aii_ajj","tags":"","loc":"proc/kij_constant.html"},{"title":"size_ar_model – yaeos","text":"public pure function size_ar_model(eos) Get the size of the model. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Return Value integer","tags":"","loc":"proc/size_ar_model.html"},{"title":"Cp_residual_vt – yaeos","text":"public subroutine Cp_residual_vt(eos, n, V, T, Cp) Uses yaeos__constants Calculate residual heat capacity pressure constant given v and t. Type Bound ArModel Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: V Volume [L] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out) :: Cp heat capacity p constant [bar L / K / mol] Variables Type Visibility Attributes Name Initial real(kind=pr), public :: Ar real(kind=pr), public :: ArT2 real(kind=pr), public :: Cv real(kind=pr), public :: dPdT real(kind=pr), public :: dPdV real(kind=pr), public :: p real(kind=pr), public :: totn","tags":"","loc":"proc/cp_residual_vt.html"},{"title":"Cv_residual_vt – yaeos","text":"public subroutine Cv_residual_vt(eos, n, V, T, Cv) Calculate residual heat capacity volume constant given v and t. Type Bound ArModel Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: V Volume [L] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out) :: Cv heat capacity v constant [bar L / K / mol] Variables Type Visibility Attributes Name Initial real(kind=pr), public :: Ar real(kind=pr), public :: ArT2","tags":"","loc":"proc/cv_residual_vt.html"},{"title":"enthalpy_residual_vt – yaeos","text":"public subroutine enthalpy_residual_vt(eos, n, v, t, Hr, HrT, HrV, Hrn) Calculate residual enthalpy given volume and temperature. Type Bound ArModel Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: v Volume [L] real(kind=pr), intent(in) :: t Temperature [K] real(kind=pr), intent(out) :: Hr Residual enthalpy [bar L / mol] real(kind=pr), intent(out), optional :: HrT real(kind=pr), intent(out), optional :: HrV real(kind=pr), intent(out), optional :: Hrn (size(n)) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: Ar real(kind=pr), public :: ArT real(kind=pr), public :: ArT2 real(kind=pr), public :: ArTV real(kind=pr), public :: ArTn (size(n)) real(kind=pr), public :: ArV real(kind=pr), public :: ArV2 real(kind=pr), public :: ArVn (size(n)) real(kind=pr), public :: Arn (size(n))","tags":"","loc":"proc/enthalpy_residual_vt.html"},{"title":"entropy_residual_vt – yaeos","text":"public subroutine entropy_residual_vt(eos, n, V, T, Sr, SrT, SrV, Srn) Calculate residual entropy given volume and temperature. Type Bound ArModel Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: V Volume [L] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out) :: Sr Entropy [bar L / K / mol] real(kind=pr), intent(out), optional :: SrT real(kind=pr), intent(out), optional :: SrV real(kind=pr), intent(out), optional :: Srn (size(n)) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: Ar real(kind=pr), public :: ArT real(kind=pr), public :: ArT2 real(kind=pr), public :: ArTV real(kind=pr), public :: ArTn (size(n))","tags":"","loc":"proc/entropy_residual_vt.html"},{"title":"fugacity_pt – yaeos","text":"public subroutine fugacity_pt(eos, n, P, T, V, root_type, lnPhi, dlnPhidP, dlnPhidT, dlnPhidn, dPdV, dPdT, dPdn) Uses iso_fortran_env Calculate logarithm of fugacity, given pressure and temperature. This routine will obtain the desired volume root at the specified\npressure and calculate fugacity at that point. Type Bound ArModel Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Mixture mole numbers real(kind=pr), intent(in) :: P Pressure [bar] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out), optional :: V Volume [L] character(len=*), intent(in) :: root_type Type of root desired [“liquid”, “vapor”, “stable”] real(kind=pr), intent(out), optional :: lnPhi (size(n)) vector real(kind=pr), intent(out), optional :: dlnPhidP (size(n)) ln(phi) Presssure derivative real(kind=pr), intent(out), optional :: dlnPhidT (size(n)) ln(phi) Temp derivative real(kind=pr), intent(out), optional :: dlnPhidn (size(n),size(n)) ln(phi) compositional derivative real(kind=pr), intent(out), optional :: dPdV real(kind=pr), intent(out), optional :: dPdT real(kind=pr), intent(out), optional :: dPdn (size(n)) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: P_in real(kind=pr), public :: V_in","tags":"","loc":"proc/fugacity_pt.html"},{"title":"fugacity_vt – yaeos","text":"public subroutine fugacity_vt(eos, n, V, T, P, lnPhi, dlnPhidP, dlnPhidT, dlnPhidn, dPdV, dPdT, dPdn) Calculate fugacity coefficent given volume and temperature. Note While the natural output variable is . The calculated\nderivatives will be the derivatives of the fugacity coefficient Type Bound ArModel Arguments Type Intent Optional Attributes Name class( ArModel ) :: eos Model real(kind=pr), intent(in) :: n (:) Mixture mole numbers real(kind=pr), intent(in) :: V Volume [L] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out), optional :: P Pressure [bar] real(kind=pr), intent(out), optional :: lnPhi (size(n)) vector real(kind=pr), intent(out), optional :: dlnPhidP (size(n)) Presssure derivative real(kind=pr), intent(out), optional :: dlnPhidT (size(n)) Temp derivative real(kind=pr), intent(out), optional :: dlnPhidn (size(n),size(n)) compositional derivative real(kind=pr), intent(out), optional :: dPdV real(kind=pr), intent(out), optional :: dPdT real(kind=pr), intent(out), optional :: dPdn (:) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: Ar real(kind=pr), public :: ArTV real(kind=pr), public, dimension(size(n)) :: ArTn real(kind=pr), public :: ArV real(kind=pr), public :: ArV2 real(kind=pr), public, dimension(size(n)) :: ArVn real(kind=pr), public, dimension(size(n)) :: Arn real(kind=pr), public :: Arn2 (size(n),size(n)) real(kind=pr), public :: P_in real(kind=pr), public :: RT real(kind=pr), public :: Z real(kind=pr), public :: dPdT_in real(kind=pr), public :: dPdV_in real(kind=pr), public :: dPdn_in (size(n)) integer, public :: i integer, public :: j integer, public :: nc real(kind=pr), public :: totn","tags":"","loc":"proc/fugacity_vt.html"},{"title":"gibbs_residual_VT – yaeos","text":"public subroutine gibbs_residual_VT(eos, n, V, T, Gr, GrT, GrV, Grn) Uses yaeos__constants Calculate residual Gibbs energy given volume and temperature. Type Bound ArModel Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: V Volume [L] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out) :: Gr Gibbs energy [bar L / mol] real(kind=pr), intent(out), optional :: GrT real(kind=pr), intent(out), optional :: GrV real(kind=pr), intent(out), optional :: Grn (size(n)) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: Ar real(kind=pr), public :: ArT real(kind=pr), public :: ArV real(kind=pr), public :: Arn (size(n)) real(kind=pr), public :: dPdT real(kind=pr), public :: dPdV real(kind=pr), public :: dPdn (size(n)) real(kind=pr), public :: p real(kind=pr), public :: totn real(kind=pr), public :: z","tags":"","loc":"proc/gibbs_residual_vt.html"},{"title":"pressure – yaeos","text":"public subroutine pressure(eos, n, v, t, p, dPdV, dPdT, dPdn) Pressure calculation. Calculate pressure using residual helmholtz models. Examples class ( ArModel ), allocatable :: eos real ( pr ) :: n ( 2 ), t , v , p , dPdV , dPdT , dPdn ( 2 ) eos = PengRobinson ( Tc , Pc , w ) n = [ 1.0_pr , 1.0_pr ] t = 30 0.0_pr v = 1.0_pr call eos % pressure ( n , V , T , P , dPdV = dPdV , dPdT = dPdT , dPdn = dPdn ) Type Bound ArModel Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: v Volume [L] real(kind=pr), intent(in) :: t Temperature [K] real(kind=pr), intent(out) :: p Pressure [bar] real(kind=pr), intent(out), optional :: dPdV real(kind=pr), intent(out), optional :: dPdT real(kind=pr), intent(out), optional :: dPdn (:) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: Ar real(kind=pr), public :: ArTV real(kind=pr), public :: ArV real(kind=pr), public :: ArV2 real(kind=pr), public :: ArVn (size(eos)) logical, public :: dn integer, public :: nc real(kind=pr), public :: totn","tags":"","loc":"proc/pressure.html"},{"title":"volume – yaeos","text":"public subroutine volume(eos, n, P, T, V, root_type) Uses yaeos__constants yaeos__math Volume solver routine for residual Helmholtz models. Solves volume roots using newton method. Given pressure and temperature. Description This subroutine solves the volume using a newton method. The variable root_type Examples class ( ArModel ) :: eos call eos % volume ( n , P , T , V , root_type = \"liquid\" ) call eos % volume ( n , P , T , V , root_type = \"vapor\" ) call eos % volume ( n , P , T , V , root_type = \"stable\" ) Type Bound ArModel Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: P Pressure [bar] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out) :: V Volume [L] character(len=*), intent(in) :: root_type Desired root-type to solve. Options are: [\"liquid\", \"vapor\", \"stable\"] Variables Type Visibility Attributes Name Initial real(kind=pr), public :: Gr real(kind=pr), public :: GrL real(kind=pr), public :: GrV real(kind=pr), public :: Vliq real(kind=pr), public :: Vvap integer, public :: max_iters = 30 real(kind=pr), public :: tol = 1e-7 real(kind=pr), public :: totnRT Subroutines subroutine foo (x, f, df) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: x real(kind=pr), intent(out) :: f real(kind=pr), intent(out) :: df","tags":"","loc":"proc/volume.html"},{"title":"size – yaeos","text":"public interface size Module Procedures public pure function size_ar_model (eos) Get the size of the model. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Return Value integer","tags":"","loc":"interface/size.html"},{"title":"solve_system – yaeos","text":"public function solve_system(a, b) result(x) Solve a linear sytem AX = b Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: a (size(b),size(b)) real(kind=pr), intent(in) :: b (:) Return Value real(kind=pr), (size(b)) Variables Type Visibility Attributes Name Initial real(kind=dp), public :: a_lapack (size(b),size(b)) real(kind=dp), public :: b_lapack (size(b)) integer, public, parameter :: dp = selected_real_kind(15) integer, public :: info integer, public :: ipiv (size(b)) integer, public :: lda integer, public :: ldb integer, public :: n integer, public :: nrhs Interfaces interface subroutine dgesv(n, nrhs, a, lda, ipiv, b, ldb, info) Arguments Type Intent Optional Attributes Name integer :: n integer :: nrhs real(kind=dp) :: a (n,n) integer :: lda integer :: ipiv (n) real(kind=dp) :: b (n) integer :: ldb integer :: info","tags":"","loc":"proc/solve_system.html"},{"title":"cubic_roots – yaeos","text":"public subroutine cubic_roots(parameters, real_roots, complex_roots, flag) Uses yaeos__auxiliar Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: parameters (4) real(kind=pr), intent(out) :: real_roots (3) complex(kind=pr), intent(out) :: complex_roots (3) integer, intent(out) :: flag flag that identifies which case the solution is\n- 0 : 3 real rotos, one of them repeated (use real_roots(1) and real_roots(2))\n- 1 : 1 real root, 2 complex roots.\n Use real_roots(1) and complex_roots(1) and complex_roots(2)\n- -1 : 3 real roots, all different Variables Type Visibility Attributes Name Initial real(kind=pr), public :: disc real(kind=pr), public :: nan real(kind=pr), public :: p real(kind=pr), public, parameter :: pi = atan(1.0_pr)*4.0_pr real(kind=pr), public :: q real(kind=pr), public :: theta real(kind=pr), public :: u real(kind=pr), public :: v","tags":"","loc":"proc/cubic_roots.html"},{"title":"cubic_roots_rosendo – yaeos","text":"public subroutine cubic_roots_rosendo(parameters, real_roots, complex_roots, flag) Uses yaeos__auxiliar Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: parameters (4) real(kind=pr), intent(out) :: real_roots (3) complex(kind=pr), intent(out) :: complex_roots (3) integer, intent(out) :: flag Variables Type Visibility Attributes Name Initial real(kind=16), public :: A real(kind=16), public :: B real(kind=16), public :: Q real(kind=16), public :: R real(kind=16), public :: alp real(kind=16), public :: bet real(kind=16), public :: d1 real(kind=16), public :: d2 real(kind=16), public :: d3 real(kind=16), public :: gam integer, public :: i real(kind=pr), public, parameter :: pi = atan(1.0_pr)*4.0_pr real(kind=16), public :: theta","tags":"","loc":"proc/cubic_roots_rosendo.html"},{"title":"bmix_linear – yaeos","text":"public pure subroutine bmix_linear(n, bi, b, dbi, dbij) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: bi (:) real(kind=pr), intent(out) :: b real(kind=pr), intent(out) :: dbi (:) real(kind=pr), intent(out) :: dbij (:,:)","tags":"","loc":"proc/bmix_linear.html"},{"title":"bmix_qmr – yaeos","text":"public pure subroutine bmix_qmr(n, bi, lij, b, dbi, dbij) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: bi (:) real(kind=pr), intent(in) :: lij (:,:) real(kind=pr), intent(out) :: b real(kind=pr), intent(out) :: dbi (:) real(kind=pr), intent(out) :: dbij (:,:) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: aux (size(n)) real(kind=pr), public :: bij (size(n),size(n)) integer, public :: i integer, public :: j integer, public :: nc real(kind=pr), public :: totn","tags":"","loc":"proc/bmix_qmr.html"},{"title":"d1mix_rkpr – yaeos","text":"public pure subroutine d1mix_rkpr(n, d1i, D1, dD1i, dD1ij) RKPR parameter mixing rule. The RKPR EoS doesn’t have a constant value for each \ncomponent, so a proper mixing rule should be provided. A linear\ncombination is used. Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: d1i (:) real(kind=pr), intent(out) :: D1 real(kind=pr), intent(out) :: dD1i (:) real(kind=pr), intent(out) :: dD1ij (:,:) Variables Type Visibility Attributes Name Initial integer, public :: i integer, public :: j integer, public :: nc real(kind=pr), public :: totn","tags":"","loc":"proc/d1mix_rkpr.html"},{"title":"P_wilson – yaeos","text":"public function P_wilson(model, z, T) result(P) Arguments Type Intent Optional Attributes Name class( BaseModel ), intent(in) :: model real(kind=pr), intent(in) :: z (:) real(kind=pr), intent(in) :: T Return Value real(kind=pr)","tags":"","loc":"proc/p_wilson.html"},{"title":"k_wilson – yaeos","text":"public function k_wilson(model, T, P) result(K) K-factors regressión done by Wilson, used for initialization. Arguments Type Intent Optional Attributes Name class( BaseModel ), intent(in) :: model real(kind=pr), intent(in) :: T real(kind=pr), intent(in) :: P Return Value real(kind=pr), (size(model%components%pc))","tags":"","loc":"proc/k_wilson.html"},{"title":"foo_wrap – yaeos","text":"private subroutine foo_wrap(n, x, f) Arguments Type Intent Optional Attributes Name integer :: n real(kind=pr) :: x (*) real(kind=pr) :: f Variables Type Visibility Attributes Name Initial real(kind=pr), private :: xx (n)","tags":"","loc":"proc/foo_wrap.html"},{"title":"powell_optimize – yaeos","text":"private subroutine powell_optimize(self, foo, X, F, data) Uses newuoa_module Type Bound PowellWrapper Arguments Type Intent Optional Attributes Name class( PowellWrapper ), intent(inout) :: self procedure( obj_func ) :: foo real(kind=pr), intent(inout) :: X (:) real(kind=pr), intent(out) :: F class(*), intent(inout), optional, target :: data Variables Type Visibility Attributes Name Initial real(kind=pr), private :: dx (size(x)) integer, private :: n integer, private :: npt","tags":"","loc":"proc/powell_optimize.html"},{"title":"alpha – yaeos","text":"public subroutine alpha(self, Tr, a, dadt, dadt2) Soave function and it’s derivatives. Type Bound AlphaSoave Arguments Type Intent Optional Attributes Name class( AlphaSoave ), intent(in) :: self real(kind=pr), intent(in) :: Tr (:) Reduced temperature real(kind=pr), intent(out) :: a (:) real(kind=pr), intent(out) :: dadt (:) real(kind=pr), intent(out) :: dadt2 (:)","tags":"","loc":"proc/alpha.html"},{"title":"alpha_rkpr – yaeos","text":"public subroutine alpha_rkpr(self, Tr, a, dadt, dadt2) Type Bound AlphaRKPR Arguments Type Intent Optional Attributes Name class( AlphaRKPR ), intent(in) :: self real(kind=pr), intent(in) :: Tr (:) Reduced temperature real(kind=pr), intent(out) :: a (:) real(kind=pr), intent(out) :: dadt (:) real(kind=pr), intent(out) :: dadt2 (:)","tags":"","loc":"proc/alpha_rkpr.html"},{"title":"excess_gibbs – yaeos","text":"private subroutine excess_gibbs(self, n, t, Ge, GeT, GeT2, Gen, GeTn, Gen2) Excess Gibbs model generic interface Type Bound GeModelTapenade Arguments Type Intent Optional Attributes Name class( GeModelTapenade ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: t real(kind=pr), intent(out), optional :: Ge real(kind=pr), intent(out), optional :: GeT real(kind=pr), intent(out), optional :: GeT2 real(kind=pr), intent(out), optional, dimension(size(n)) :: Gen real(kind=pr), intent(out), optional, dimension(size(n)) :: GeTn real(kind=pr), intent(out), optional :: Gen2 (size(n),size(n)) Variables Type Visibility Attributes Name Initial real(kind=pr), private :: geb real(kind=pr), private :: ged real(kind=pr), private :: ged0 real(kind=pr), private :: gedb real(kind=pr), private :: gedd integer, private :: i real(kind=pr), private :: nb (size(n)) integer, private :: nc real(kind=pr), private :: nd (size(n)) real(kind=pr), private :: ndb (size(n)) real(kind=pr), private :: tb real(kind=pr), private :: td real(kind=pr), private :: td0 real(kind=pr), private :: tdb Functions function get_GenT () Arguments None Return Value real(kind=pr), (size(n)) function get_dGedT2 () Arguments None Return Value real(kind=pr) Subroutines subroutine reset_vars () Arguments None","tags":"","loc":"proc/excess_gibbs.html"},{"title":"model_from_X – yaeos","text":"public subroutine model_from_X(problem, X) Uses yaeos Type Bound FitKijLij Arguments Type Intent Optional Attributes Name class( FitKijLij ), intent(inout) :: problem real(kind=pr), intent(in) :: X (:) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: kij (nc,nc) real(kind=pr), public :: lij (nc,nc)","tags":"","loc":"proc/model_from_x.html"},{"title":"pt_envelope_2ph – yaeos","text":"public function pt_envelope_2ph(model, z, first_point, points, iterations, delta_0, specified_variable_0, solver, stop_conditions) result(envelopes) Uses stdlib_optval PT two-phase envelope calculation procedure. Phase envelope calculation using the continuation method.\nDefaults to solving the saturation temperature and continues with\nan increment in it. The variable to specify can be changed by modifying specified_variable_0 with the corresponding variable number. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: model Thermodyanmic model real(kind=pr), intent(in) :: z (:) Vector of molar fractions type( EquilibriumState ) :: first_point integer, intent(in), optional :: points Maxmimum number of points, defaults to 500 integer, intent(in), optional :: iterations Point solver maximum iterations, defaults to 100 real(kind=pr), intent(in), optional :: delta_0 Initial extrapolation integer, intent(in), optional :: specified_variable_0 Position of specified variable, since the vector of variables is the values for specification\nwill be for the equilibria constants, for and for . procedure( continuation_solver ), optional :: solver Specify solver for each point, defaults to a full newton procedure procedure( continuation_stopper ), optional :: stop_conditions Function that returns true if the continuation method should stop Return Value type( PTEnvel2 ) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: S0 Initial specification value real(kind=pr), public :: X (size(z)+2) Vector of variables used in the continuation method real(kind=pr), public, allocatable :: XS (:,:) All the calculated variables that are returned on the continuation\nmethod procedure (unused since each point is saved on the fly) real(kind=pr), public :: dS0 Initial specification step character(len=14), public :: kind integer, public :: max_iterations Maximum number of iterations integer, public :: max_points Maximum number of points integer, public :: nc Number of components integer, public :: ns Number of specified variable Subroutines subroutine detect_critical (X, dXdS, ns, S, dS) Critical point detection Read more… Arguments Type Intent Optional Attributes Name real(kind=pr), intent(inout) :: X (:) Vector of variables real(kind=pr), intent(inout) :: dXdS (:) Variation of variables wrt S integer, intent(inout) :: ns Number of specified variable real(kind=pr), intent(inout) :: S Specification value real(kind=pr), intent(inout) :: dS Step in specification subroutine foo (X, ns, S, F, dF, dFdS) Function that needs to be solved at each envelope point Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: X (:) integer, intent(in) :: ns real(kind=pr), intent(in) :: S real(kind=pr), intent(out) :: F (:) real(kind=pr), intent(out) :: dF (:,:) real(kind=pr), intent(out) :: dFdS (:) subroutine save_point (X, iters) Save the converged point Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: X (:) integer, intent(in) :: iters subroutine update_spec (X, ns, S, dS, dXdS, step_iters) Update the specification during continuation. Arguments Type Intent Optional Attributes Name real(kind=pr), intent(inout) :: X (:) Vector of variables integer, intent(inout) :: ns Number of specified variable in the vector real(kind=pr), intent(inout) :: S Variable specification value real(kind=pr), intent(inout) :: dS Step in specification real(kind=pr), intent(inout) :: dXdS (:) Variation of variables with respect to specification integer, intent(in) :: step_iters Iterations used in the solver","tags":"","loc":"proc/pt_envelope_2ph.html"},{"title":"write_PTEnvel2 – yaeos","text":"public subroutine write_PTEnvel2(pt2, unit, iotype, v_list, iostat, iomsg) Type Bound PTEnvel2 Arguments Type Intent Optional Attributes Name class( PTEnvel2 ), intent(in) :: pt2 integer, intent(in) :: unit character(len=*), intent(in) :: iotype integer, intent(in) :: v_list (:) integer, intent(out) :: iostat character(len=*), intent(inout) :: iomsg Variables Type Visibility Attributes Name Initial integer, public :: cp integer, public, allocatable :: cps (:) integer, public :: i integer, public :: nc","tags":"","loc":"proc/write_ptenvel2.html"},{"title":"residual_helmholtz – yaeos","text":"public subroutine residual_helmholtz(self, n, v, t, Ar, ArV, ArT, ArTV, ArV2, ArT2, Arn, ArVn, ArTn, Arn2) Type Bound ArModelAdiff Arguments Type Intent Optional Attributes Name class( ArModelAdiff ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: v real(kind=pr), intent(in) :: t real(kind=pr), intent(out), optional :: Ar real(kind=pr), intent(out), optional :: ArV real(kind=pr), intent(out), optional :: ArT real(kind=pr), intent(out), optional :: ArTV real(kind=pr), intent(out), optional :: ArV2 real(kind=pr), intent(out), optional :: ArT2 real(kind=pr), intent(out), optional, dimension(size(n)) :: Arn real(kind=pr), intent(out), optional, dimension(size(n)) :: ArVn real(kind=pr), intent(out), optional, dimension(size(n)) :: ArTn real(kind=pr), intent(out), optional :: Arn2 (size(n),size(n)) Variables Type Visibility Attributes Name Initial type( hyperdual ), public :: d_Ar type( hyperdual ), public :: d_n (size(n)) type( hyperdual ), public :: d_t type( hyperdual ), public :: d_v Subroutines subroutine get_dardn () Arguments None subroutine get_dardn2 () Arguments None subroutine get_dardt () Arguments None subroutine get_dardt2 () Arguments None subroutine get_dardtn () Arguments None subroutine get_dardv () Arguments None subroutine get_dardv2 () Arguments None subroutine get_dardvn () Arguments None subroutine get_dardvt () Arguments None subroutine reset_vars () Arguments None","tags":"","loc":"proc/residual_helmholtz.html"},{"title":"get_maingroup_index – yaeos","text":"public function get_maingroup_index(self, maingroup_id) result(maingroup_idx) get_maingroup_index Get index of the maingoup with id: maingoup_id Description Get index of the maingoup with id: maingoup_id . Gets the index of the\nmaingoup in the self%maingoups_ids vector. Examples use yaeos__models_ge_group_contribution_unifac_parameters , only : UNIFACParameters use yaeos__models_ge_group_contribution_model_parameters , only : GeGCModelParameters type ( GeGCModelParameters ) :: parameters parameters = UNIFACParameters () ! Get index of the maingroup with id 55 (Sulfones: [118](CH2)2SU [119]CH2CHSU) print * , parameters % get_maingroup_index ( 55 ) ! Will print: 52 References Dortmund Data Bank Software & Separation Technology Type Bound GeGCModelParameters Arguments Type Intent Optional Attributes Name class( GeGCModelParameters ) :: self integer, intent(in) :: maingroup_id ID of the subgroup Return Value integer Index of the maingroup on the self%maingroups_ids vector","tags":"","loc":"proc/get_maingroup_index.html"},{"title":"get_maingroups_aij – yaeos","text":"public function get_maingroups_aij(self, maingroup_i_id, maingroup_j_id) result(aij) get_maingroups_aij Get the interaction parameter Description Get the interaction parameter of the maingroups i and j ids. Examples use yaeos__models_ge_group_contribution_unifac_parameters , only : UNIFACParameters use yaeos__models_ge_group_contribution_model_parameters , only : GeGCModelParameters type ( GeGCModelParameters ) :: parameters parameters = UNIFACParameters () ! Get the maingroups i:1, j:7 interaction parameter aij (CH2-H2O) print * , parameters % get_maingroups_aij ( 1 , 7 ) ! prints: 1318.0000 References Dortmund Data Bank Software & Separation Technology Type Bound GeGCModelParameters Arguments Type Intent Optional Attributes Name class( GeGCModelParameters ) :: self integer, intent(in) :: maingroup_i_id ID of the maingroup i integer, intent(in) :: maingroup_j_id ID of the maingroup j Return Value real(kind=pr) Interaction parameter Variables Type Visibility Attributes Name Initial integer, public :: i integer, public :: j","tags":"","loc":"proc/get_maingroups_aij.html"},{"title":"get_maingroups_bij – yaeos","text":"public function get_maingroups_bij(self, maingroup_i_id, maingroup_j_id) result(bij) get_maingroups_bij Get the interaction parameter Description Get the interaction parameter of the maingroups i and j ids. Examples use yaeos__models_ge_group_contribution_unifac_parameters , only : UNIFACParameters use yaeos__models_ge_group_contribution_model_parameters , only : GeGCModelParameters type ( GeGCModelParameters ) :: parameters parameters = UNIFACParameters () ! Get the maingroups i:1, j:7 interaction parameter bij (CH2-H2O) print * , parameters % get_maingroups_bij ( 1 , 7 ) ! prints: 0.0 In the example we obtain 0.0 because UNIFAC only have parameters References Dortmund Data Bank Software & Separation Technology Type Bound GeGCModelParameters Arguments Type Intent Optional Attributes Name class( GeGCModelParameters ) :: self integer, intent(in) :: maingroup_i_id ID of the maingroup i integer, intent(in) :: maingroup_j_id ID of the maingroup j Return Value real(kind=pr) Interaction parameter Variables Type Visibility Attributes Name Initial integer, public :: i integer, public :: j","tags":"","loc":"proc/get_maingroups_bij.html"},{"title":"get_maingroups_cij – yaeos","text":"public function get_maingroups_cij(self, maingroup_i_id, maingroup_j_id) result(cij) get_maingroups_cij Get the interaction parameter Description Get the interaction parameter of the maingroups i and j ids. Examples use yaeos__models_ge_group_contribution_unifac_parameters , only : UNIFACParameters use yaeos__models_ge_group_contribution_model_parameters , only : GeGCModelParameters type ( GeGCModelParameters ) :: parameters parameters = UNIFACParameters () ! Get the maingroups i:1, j:7 interaction parameter cij (CH2-H2O) print * , parameters % get_maingroups_cij ( 1 , 7 ) ! prints: 0.0 In the example we obtain 0.0 because UNIFAC only have parameters References Dortmund Data Bank Software & Separation Technology Type Bound GeGCModelParameters Arguments Type Intent Optional Attributes Name class( GeGCModelParameters ) :: self integer, intent(in) :: maingroup_i_id ID of the maingroup i integer, intent(in) :: maingroup_j_id ID of the maingroup j Return Value real(kind=pr) Interaction parameter Variables Type Visibility Attributes Name Initial integer, public :: i integer, public :: j","tags":"","loc":"proc/get_maingroups_cij.html"},{"title":"get_subgroup_Q – yaeos","text":"public function get_subgroup_Q(self, subgroup_id) result(subgroup_Q) get_subgroup_Q Get the subgroup’s value Description Uses the self%subgroups_Qs attribute to locate the subgroup value. Examples use yaeos__models_ge_group_contribution_unifac_parameters , only : UNIFACParameters use yaeos__models_ge_group_contribution_model_parameters , only : GeGCModelParameters type ( GeGCModelParameters ) :: parameters parameters = UNIFACParameters () ! Get the subgroup, with id 1 (CH3), Q value print * , parameters % get_subgroup_Q ( 1 ) ! Will print: 0.8480 References Dortmund Data Bank Software & Separation Technology Type Bound GeGCModelParameters Arguments Type Intent Optional Attributes Name class( GeGCModelParameters ) :: self integer, intent(in) :: subgroup_id ID of the subgroup Return Value real(kind=pr) value of the subgroup Variables Type Visibility Attributes Name Initial integer, public :: subgroup_idx","tags":"","loc":"proc/get_subgroup_q.html"},{"title":"get_subgroup_R – yaeos","text":"public function get_subgroup_R(self, subgroup_id) result(subgroup_R) get_subgroup_R Get the subgroup’s value Description Uses the self%subgroups_Rs attribute to locate the subgroup value. Examples use yaeos__models_ge_group_contribution_unifac_parameters , only : UNIFACParameters use yaeos__models_ge_group_contribution_model_parameters , only : GeGCModelParameters type ( GeGCModelParameters ) :: parameters parameters = UNIFACParameters () ! Get the subgroup, with id 1 (CH3), R value print * , parameters % get_subgroup_R ( 1 ) ! Will print: 0.9011 References Dortmund Data Bank Software & Separation Technology Type Bound GeGCModelParameters Arguments Type Intent Optional Attributes Name class( GeGCModelParameters ) :: self integer, intent(in) :: subgroup_id ID of the subgroup Return Value real(kind=pr) value of the subgroup Variables Type Visibility Attributes Name Initial integer, public :: subgroup_idx","tags":"","loc":"proc/get_subgroup_r.html"},{"title":"get_subgroup_index – yaeos","text":"public function get_subgroup_index(self, subgroup_id) result(subgroup_idx) get_subgroup_index Get index of the subgroup with id: subgroup_id Description Get index of the subgroup with id: subgroup_id . Gets the index of the\nsubgroup in the self%subgroups_ids vector. Examples use yaeos__models_ge_group_contribution_unifac_parameters , only : UNIFACParameters use yaeos__models_ge_group_contribution_model_parameters , only : GeGCModelParameters type ( GeGCModelParameters ) :: parameters ! Default parameters of UNIFAC (ddbst) parameters = UNIFACParameters () ! Get index of the subgroup with id 178 (IMIDAZOL) print * , parameters % get_subgroup_index ( 178 ) ! Will print: 112 References Dortmund Data Bank Software & Separation Technology Type Bound GeGCModelParameters Arguments Type Intent Optional Attributes Name class( GeGCModelParameters ) :: self integer, intent(in) :: subgroup_id ID of the subgroup Return Value integer Index of the subgroup on the self%subgroups_ids vector","tags":"","loc":"proc/get_subgroup_index.html"},{"title":"get_subgroup_maingroup – yaeos","text":"public function get_subgroup_maingroup(self, subgroup_id) result(subgroup_maingroup) get_subgroup_maingroup Get the subgroup’s maingroup Description Uses the self%subgroups_maingroups attribute to locate the maingroup\nwhere the subgroup with id subgroup_id belongs Examples use yaeos__models_ge_group_contribution_unifac_parameters , only : UNIFACParameters use yaeos__models_ge_group_contribution_model_parameters , only : GeGCModelParameters type ( GeGCModelParameters ) :: parameters parameters = UNIFACParameters () ! Get the maingroup of the subgroup with id 16 (H2O) print * , parameters % get_subgroup_maingroup ( 16 ) ! Will print: 7 References Dortmund Data Bank Software & Separation Technology Type Bound GeGCModelParameters Arguments Type Intent Optional Attributes Name class( GeGCModelParameters ) :: self integer, intent(in) :: subgroup_id ID of the subgroup Return Value integer Maingroup of the subgroup Variables Type Visibility Attributes Name Initial integer, public :: subgroup_idx","tags":"","loc":"proc/get_subgroup_maingroup.html"},{"title":"get_subgroups_aij – yaeos","text":"public function get_subgroups_aij(self, subgroup_i_id, subgroup_j_id) result(aij) get_subgroups_aij Get the interaction parameter Description Get the interaction parameter of the subgroups i and j ids. Examples use yaeos__models_ge_group_contribution_unifac_parameters , only : UNIFACParameters use yaeos__models_ge_group_contribution_model_parameters , only : GeGCModelParameters type ( GeGCModelParameters ) :: parameters parameters = UNIFACParameters () ! Get the subgroups i:1, j:16 interaction parameter aij (CH3-H2O) ! with maingroups 1 and 7 respectively. print * , parameters % get_subgroups_aij ( 1 , 16 ) ! prints: 1318.0000 References Dortmund Data Bank Software & Separation Technology Type Bound GeGCModelParameters Arguments Type Intent Optional Attributes Name class( GeGCModelParameters ) :: self integer, intent(in) :: subgroup_i_id ID of the subgroup i integer, intent(in) :: subgroup_j_id ID of the subgroup j Return Value real(kind=pr) Interaction parameter Variables Type Visibility Attributes Name Initial integer, public :: i integer, public :: j integer, public :: mi_id integer, public :: mj_id","tags":"","loc":"proc/get_subgroups_aij.html"},{"title":"get_subgroups_bij – yaeos","text":"public function get_subgroups_bij(self, subgroup_i_id, subgroup_j_id) result(bij) get_subgroups_bij Get the interaction parameter Description Get the interaction parameter of the subgroups i and j ids. Examples use yaeos__models_ge_group_contribution_unifac_parameters , only : UNIFACParameters use yaeos__models_ge_group_contribution_model_parameters , only : GeGCModelParameters type ( GeGCModelParameters ) :: parameters parameters = UNIFACParameters () ! Get the subgroups i:1, j:16 interaction parameter bij (CH3-H2O) ! with maingroups 1 and 7 respectively. print * , parameters % get_subgroups_bij ( 1 , 16 ) ! prints: 0.0000 In the example we obtain 0.0 because UNIFAC only have parameters References Dortmund Data Bank Software & Separation Technology Type Bound GeGCModelParameters Arguments Type Intent Optional Attributes Name class( GeGCModelParameters ) :: self integer, intent(in) :: subgroup_i_id ID of the subgroup i integer, intent(in) :: subgroup_j_id ID of the subgroup j Return Value real(kind=pr) Interaction parameter Variables Type Visibility Attributes Name Initial integer, public :: i integer, public :: j integer, public :: mi_id integer, public :: mj_id","tags":"","loc":"proc/get_subgroups_bij.html"},{"title":"get_subgroups_cij – yaeos","text":"public function get_subgroups_cij(self, subgroup_i_id, subgroup_j_id) result(cij) get_subgroups_cij Get the interaction parameter Description Get the interaction parameter of the subgroups i and j ids. Examples use yaeos__models_ge_group_contribution_unifac_parameters , only : UNIFACParameters use yaeos__models_ge_group_contribution_model_parameters , only : GeGCModelParameters type ( GeGCModelParameters ) :: parameters parameters = UNIFACParameters () ! Get the subgroups i:1, j:16 interaction parameter cij (CH3-H2O) ! with maingroups 1 and 7 respectively. print * , parameters % get_subgroups_cij ( 1 , 16 ) ! prints: 0.0000 In the example we obtain 0.0 because UNIFAC only have parameters References Dortmund Data Bank Software & Separation Technology Type Bound GeGCModelParameters Arguments Type Intent Optional Attributes Name class( GeGCModelParameters ) :: self integer, intent(in) :: subgroup_i_id ID of the subgroup i integer, intent(in) :: subgroup_j_id ID of the subgroup j Return Value real(kind=pr) Interaction parameter Variables Type Visibility Attributes Name Initial integer, public :: i integer, public :: j integer, public :: mi_id integer, public :: mj_id","tags":"","loc":"proc/get_subgroups_cij.html"},{"title":"init – yaeos","text":"private function init(Ge, b, q, lij) result(mixrule) Arguments Type Intent Optional Attributes Name class( GeModel ), intent(in) :: Ge real(kind=pr), intent(in) :: b (:) real(kind=pr), intent(in) :: q real(kind=pr), intent(in), optional :: lij (:,:) Return Value type( MHV ) Variables Type Visibility Attributes Name Initial integer, private :: i integer, private :: nc","tags":"","loc":"proc/init.html"},{"title":"DmixMHV – yaeos","text":"public subroutine DmixMHV(self, n, T, ai, daidt, daidt2, D, dDdT, dDdT2, dDi, dDidT, dDij) Uses hyperdual_mod Michelsen Modified Huron-Vidal mixing rule. Mixing rule at infinite pressure as defined in the book of Michelsen and\nMøllerup. Description At the infinite pressure limit of a cubic equation of state it is possible to\nrelate teh mixing rule for the attractive term with a excess Gibbs energy\nmodel like NRTL with the expression: Examples type ( CubicEoS ) References Autodiff injection until we can decipher this derivative Type Bound MHV Arguments Type Intent Optional Attributes Name class( MHV ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: T real(kind=pr), intent(in) :: ai (:) real(kind=pr), intent(in) :: daidt (:) real(kind=pr), intent(in) :: daidt2 (:) real(kind=pr), intent(out) :: D real(kind=pr), intent(out) :: dDdT real(kind=pr), intent(out) :: dDdT2 real(kind=pr), intent(out) :: dDi (:) real(kind=pr), intent(out) :: dDidT (:) real(kind=pr), intent(out) :: dDij (:,:) Variables Type Visibility Attributes Name Initial real(kind=pr), private :: Ge real(kind=pr), private :: GeT real(kind=pr), private :: GeT2 real(kind=pr), private :: GeTn (size(n)) real(kind=pr), private :: Gen (size(n)) real(kind=pr), private :: Gen2 (size(n),size(n)) real(kind=pr), private :: b real(kind=pr), private :: bi (size(n)) real(kind=pr), private :: d2logBi_nbi (size(n),size(n)) real(kind=pr), private :: dbi (size(n)) real(kind=pr), private :: dbij (size(n),size(n)) real(kind=pr), private :: dlogBi_nbi (size(n)) real(kind=pr), private :: dot_n_logB_nbi real(kind=pr), private :: f real(kind=pr), private :: fdi (size(n)) real(kind=pr), private :: fdij (size(n),size(n)) real(kind=pr), private :: fdit (size(n)) real(kind=pr), private :: fdt real(kind=pr), private :: fdt2 integer, private :: i integer, private :: j integer, private :: l real(kind=pr), private :: logB_nbi (size(n)) integer, private :: nc real(kind=pr), private :: q real(kind=pr), private :: totn Total number of moles","tags":"","loc":"proc/dmixmhv.html"},{"title":"BmixMHV – yaeos","text":"private subroutine BmixMHV(self, n, bi, B, dBi, dBij) Uses yaeos__models_ar_cubic_mixing_base Repulsive parameter mixing rule Quadratinc mixing rule for the repulsive parameter, using as a combining rule. Description Michelsen’s modified Huron-Vidal mixing rule assumes a linear mix of\nthe repulsive parameter. In this implementation the most known crossed combining rule is used: to provide versatility to the used model. Warning This mixing rule is intended to use only with a linear combining\nrule, using could negatively affect the thermodynamic\nconsistency of the model. Examples A basic code example References Type Bound MHV Arguments Type Intent Optional Attributes Name class( MHV ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: bi (:) real(kind=pr), intent(out) :: B real(kind=pr), intent(out) :: dBi (:) real(kind=pr), intent(out) :: dBij (:,:)","tags":"","loc":"proc/bmixmhv.html"},{"title":"D1MixMHV – yaeos","text":"private subroutine D1MixMHV(self, n, d1i, D1, dD1i, dD1ij) Uses yaeos__models_ar_cubic_mixing_base Type Bound MHV Arguments Type Intent Optional Attributes Name class( MHV ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: d1i (:) real(kind=pr), intent(out) :: D1 real(kind=pr), intent(out) :: dD1i (:) real(kind=pr), intent(out) :: dD1ij (:,:)","tags":"","loc":"proc/d1mixmhv.html"},{"title":"MHV – yaeos","text":"public interface MHV Module Procedures private function init (Ge, b, q, lij) result(mixrule) Arguments Type Intent Optional Attributes Name class( GeModel ), intent(in) :: Ge real(kind=pr), intent(in) :: b (:) real(kind=pr), intent(in) :: q real(kind=pr), intent(in), optional :: lij (:,:) Return Value type( MHV )","tags":"","loc":"interface/mhv.html"},{"title":"optval_integer – yaeos","text":"public function optval_integer(val, default) Uses stdlib_optval Set a value to a default if it is not defined Arguments Type Intent Optional Attributes Name integer, intent(inout), optional :: val integer, intent(in) :: default Return Value integer","tags":"","loc":"proc/optval_integer.html"},{"title":"optval_real – yaeos","text":"public function optval_real(val, default) Uses stdlib_optval Set a value to a default if it is not defined Arguments Type Intent Optional Attributes Name real(kind=pr), intent(inout), optional :: val real(kind=pr), intent(in) :: default Return Value real(kind=pr)","tags":"","loc":"proc/optval_real.html"},{"title":"sort – yaeos","text":"public subroutine sort(array, idx) Uses stdlib_sorting Sort an array and return the indexes Arguments Type Intent Optional Attributes Name real(kind=pr), intent(inout) :: array (:) integer, intent(out), optional :: idx (:)","tags":"","loc":"proc/sort.html"},{"title":"optval – yaeos","text":"public interface optval Module Procedures public function optval_integer (val, default) Set a value to a default if it is not defined Arguments Type Intent Optional Attributes Name integer, intent(inout), optional :: val integer, intent(in) :: default Return Value integer public function optval_real (val, default) Set a value to a default if it is not defined Arguments Type Intent Optional Attributes Name real(kind=pr), intent(inout), optional :: val real(kind=pr), intent(in) :: default Return Value real(kind=pr)","tags":"","loc":"interface/optval.html"},{"title":"model_from_X – yaeos","text":"public subroutine model_from_X(problem, X) Uses yaeos yaeos__models_ar_cubic_quadratic_mixing Type Bound FitMHVNRTL Arguments Type Intent Optional Attributes Name class( FitMHVNRTL ), intent(inout) :: problem real(kind=pr), intent(in) :: X (:) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: a (nc,nc) real(kind=pr), public :: b (nc,nc) real(kind=pr), public :: c (nc,nc) type( NRTL ), public :: ge","tags":"","loc":"proc/model_from_x~2.html"},{"title":"v0 – yaeos","text":"public function v0(self, n, p, t) Cubic EoS volume initializer.\nFor a Cubic Equation of State, the covolume calculated with the mixing\nrule is a good estimate for the initial volume solver on the liquid\nregion. Type Bound CubicEoS Arguments Type Intent Optional Attributes Name class( CubicEoS ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: p real(kind=pr), intent(in) :: t Return Value real(kind=pr) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: dbi (size(n)) real(kind=pr), public :: dbij (size(n),size(n))","tags":"","loc":"proc/v0.html"},{"title":"GenericCubic_Ar – yaeos","text":"public subroutine GenericCubic_Ar(self, n, v, t, ar, arv, ArT, artv, arv2, ArT2, Arn, ArVn, ArTn, Arn2) Uses yaeos__constants Residual Helmholtz Energy for a generic Cubic Equation of State. Calculates the residual Helmholtz Energy for a generic Cubic EoS as\ndefined by Michelsen and Møllerup: This routine assumes that the is not a constant parameter\n(as it uses to be in classical Cubic EoS) to be compatible with the\nthree parameter EoS RKPR where is not a constant and\nhas its own mixing rule. Type Bound CubicEoS Arguments Type Intent Optional Attributes Name class( CubicEoS ), intent(in) :: self real(kind=pr), intent(in) :: n (:) Number of moles real(kind=pr), intent(in) :: v Volume [L] real(kind=pr), intent(in) :: t Temperature [K] real(kind=pr), intent(out), optional :: ar Residual Helmholtz real(kind=pr), intent(out), optional :: arv real(kind=pr), intent(out), optional :: ArT real(kind=pr), intent(out), optional :: artv real(kind=pr), intent(out), optional :: arv2 real(kind=pr), intent(out), optional :: ArT2 real(kind=pr), intent(out), optional :: Arn (size(n)) real(kind=pr), intent(out), optional :: ArVn (size(n)) real(kind=pr), intent(out), optional :: ArTn (size(n)) real(kind=pr), intent(out), optional :: Arn2 (size(n),size(n)) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: AUX real(kind=pr), public :: Bmix real(kind=pr), public :: D real(kind=pr), public :: FFB real(kind=pr), public :: FFBB real(kind=pr), public :: FFBV real(kind=pr), public :: Tr (size(n)) real(kind=pr), public :: a (size(n)) real(kind=pr), public :: auxD2 real(kind=pr), public :: d1 real(kind=pr), public :: d2 real(kind=pr), public :: dBi (size(n)) real(kind=pr), public :: dBij (size(n),size(n)) real(kind=pr), public :: dD1i (size(n)) real(kind=pr), public :: dD1ij (size(n),size(n)) real(kind=pr), public :: dDdT real(kind=pr), public :: dDdT2 real(kind=pr), public :: dDi (size(n)) real(kind=pr), public :: dDidT (size(n)) real(kind=pr), public :: dDij (size(n),size(n)) real(kind=pr), public :: dadt (size(n)) real(kind=pr), public :: dadt2 (size(n)) real(kind=pr), public :: f real(kind=pr), public :: fB real(kind=pr), public :: fBD1 real(kind=pr), public :: fD1 real(kind=pr), public :: fD1D1 real(kind=pr), public :: fVD1 real(kind=pr), public :: fv real(kind=pr), public :: fv2 real(kind=pr), public :: g real(kind=pr), public :: gv real(kind=pr), public :: gv2 integer, public :: i integer, public :: j integer, public :: nc real(kind=pr), public :: totn","tags":"","loc":"proc/genericcubic_ar.html"},{"title":"volume – yaeos","text":"public subroutine volume(eos, n, P, T, V, root_type) Uses yaeos__models_solvers yaeos__math_linalg yaeos__constants Cubic EoS volume solver Volume solver optimized for Cubic Equations of State. @warn\nThis routine intends to use the analyitical solution of the cubic\nequation, but due to errors in the solutions it is not used. And\nthe general volume solver by Michelsen is used instead.\n@endwarn Description Cubic equations can be analytically solved. Using an anallytical\nsolution provides the best possible solution in terms of speed and\nprecision. This subroutine uses the modified cardano method proposed\nby Rosendo. Examples use yaeos , only : CubicEoS , PengRobinson type ( CubicEoS ) :: eos eos = PengRobinson ( tc , pc , w ) ! Possible roots to solve call eos % volume ( n , P , T , V , \"liquid\" ) call eos % volume ( n , P , T , V , \"vapor\" ) call eos % volume ( n , P , T , V , \"stable\" ) References [1] “Thermodynamic Models: Fundamental and Computational Aspects”,\n Michael L. Michelsen, Jørgen M. Mollerup. \n Tie-Line Publications, Denmark (2004) doi [2] “A Note on the Analytical Solution of Cubic Equations of State \nin Process Simulation”, Rosendo Monroy-Loperena doi Type Bound CubicEoS Arguments Type Intent Optional Attributes Name class( CubicEoS ), intent(in) :: eos real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: P real(kind=pr), intent(in) :: T real(kind=pr), intent(out) :: V character(len=*), intent(in) :: root_type Variables Type Visibility Attributes Name Initial real(kind=pr), public :: AT_Liq real(kind=pr), public :: AT_Vap real(kind=pr), public :: Ar real(kind=pr), public :: Bmix real(kind=pr), public :: D real(kind=pr), public :: D1 real(kind=pr), public :: D2 real(kind=pr), public :: Tr (size(n)) real(kind=pr), public :: V_liq real(kind=pr), public :: V_vap real(kind=pr), public :: a (size(n)) real(kind=pr), public :: cp (4) complex(kind=pr), public :: cr (3) real(kind=pr), public :: dBi (size(n)) real(kind=pr), public :: dBij (size(n),size(n)) real(kind=pr), public :: dD1i (size(n)) real(kind=pr), public :: dD1ij (size(n),size(n)) real(kind=pr), public :: dDdT real(kind=pr), public :: dDdT2 real(kind=pr), public :: dDi (size(n)) real(kind=pr), public :: dDidT (size(n)) real(kind=pr), public :: dDij (size(n),size(n)) real(kind=pr), public :: dadt (size(n)) real(kind=pr), public :: dadt2 (size(n)) integer, public :: flag real(kind=pr), public :: rr (3) real(kind=pr), public :: totn real(kind=pr), public :: z (size(n))","tags":"","loc":"proc/volume~2.html"},{"title":"ADMM_REBASE – yaeos","text":"public interface ADMM_REBASE Subroutines public subroutine ADMM_REBASE(base) bind(c, name='ADMM_rebase') Arguments Type Intent Optional Attributes Name type(C_PTR) :: base","tags":"","loc":"interface/admm_rebase.html"},{"title":"ADMM_REBASESHADOWED – yaeos","text":"public interface ADMM_REBASESHADOWED Subroutines public subroutine ADMM_REBASESHADOWED(base, baseb) bind(c, name= 'ADMM_rebaseShadowed') Arguments Type Intent Optional Attributes Name type(C_PTR) :: base type(C_PTR) :: baseb","tags":"","loc":"interface/admm_rebaseshadowed.html"},{"title":"ADMM_REGISTER – yaeos","text":"public interface ADMM_REGISTER Subroutines public subroutine ADMM_REGISTER(base, obase, size, nbelem) bind(c, name= 'ADMM_register') Arguments Type Intent Optional Attributes Name type(C_PTR), VALUE :: base type(C_PTR), VALUE :: obase integer, VALUE :: size integer, VALUE :: nbelem","tags":"","loc":"interface/admm_register.html"},{"title":"ADMM_REGISTERSHADOWED – yaeos","text":"public interface ADMM_REGISTERSHADOWED Subroutines public subroutine ADMM_REGISTERSHADOWED(base, obase, size, baseb, obaseb, sizeb, nbelem) bind(c, name='ADMM_registerShadowed') Arguments Type Intent Optional Attributes Name type(C_PTR), VALUE :: base type(C_PTR), VALUE :: obase integer, VALUE :: size type(C_PTR), VALUE :: baseb type(C_PTR), VALUE :: obaseb integer, VALUE :: sizeb integer, VALUE :: nbelem","tags":"","loc":"interface/admm_registershadowed.html"},{"title":"ADMM_UNREGISTER – yaeos","text":"public interface ADMM_UNREGISTER Subroutines public subroutine ADMM_UNREGISTER(base, nbelem) bind(c, name= 'ADMM_unregister') Arguments Type Intent Optional Attributes Name type(C_PTR), VALUE :: base integer :: nbelem","tags":"","loc":"interface/admm_unregister.html"},{"title":"ADMM_UNREGISTERSHADOWED – yaeos","text":"public interface ADMM_UNREGISTERSHADOWED Subroutines public subroutine ADMM_UNREGISTERSHADOWED(base, baseb, nbelem) bind(c, name='ADMM_unregisterShadowed') Arguments Type Intent Optional Attributes Name type(C_PTR), VALUE :: base type(C_PTR), VALUE :: baseb integer :: nbelem","tags":"","loc":"interface/admm_unregistershadowed.html"},{"title":"POPPOINTER8 – yaeos","text":"public interface POPPOINTER8 Subroutines public subroutine POPPOINTER8(pp) bind(c, name='popPointer8') Arguments Type Intent Optional Attributes Name type(C_PTR) :: pp","tags":"","loc":"interface/poppointer8.html"},{"title":"PUSHPOINTER8 – yaeos","text":"public interface PUSHPOINTER8 Subroutines public subroutine PUSHPOINTER8(pp) bind(c, name='pushPointer8') Arguments Type Intent Optional Attributes Name type(C_PTR), VALUE :: pp","tags":"","loc":"interface/pushpointer8.html"},{"title":"UNIFACParameters – yaeos","text":"public function UNIFACParameters() UNIFACParameters UNIFAC parameters Description Create a Instance of the yaeos GeGCModelParameters with the classic\nliquid-vapor UNIFAC parameters. Examples ! Instantiate an UNIFAC model with ethanol-water mix and calculate gammas use yaeos , only : pr , Groups , setup_unifac , UNIFAC use yaeos__models_ge_group_contribution_unifac_parameters , only : UNIFACParameters use yaeos__models_ge_group_contribution_model_parameters , only : GeGCModelParameters type ( UNIFAC ) :: model type ( Groups ) :: molecules ( 2 ) real ( pr ) :: ln_gammas ( 2 ) type ( GeGCModelParameters ) :: parameters ! Ethanol definition [CH3, CH2, OH] molecules ( 1 )% groups_ids = [ 1 , 2 , 14 ] ! Subgroups ids molecules ( 1 )% number_of_groups = [ 1 , 1 , 1 ] ! Subgroups occurrences ! Water definition [H2O] molecules ( 2 )% groups_ids = [ 16 ] molecules ( 2 )% number_of_groups = [ 1 ] parameters = UNIFACParameters () ! Model setup ! Disclaimer: the default parameters object can be ommited in the ! setup_unifac call, because if the parameters argument is not ! provided, the return of the constructor UNIFACParameters() will be ! used either way. This is just a demostration. model = setup_unifac ( molecules , parameters ) ! Calculate ln_gammas call model % ln_activity_coefficient ([ 0.5_pr , 0.5_pr ], 29 8.0_pr , ln_gammas ) print * , ln_gammas ! result: 0.18534142000449058 0.40331395945417559 References Dortmund Data Bank Software & Separation Technology Fredenslund, A., Jones, R. L., & Prausnitz, J. M. (1975).\nGroup‐contribution estimation of activity coefficients in nonideal liquid\nmixtures. AIChE Journal, 21(6), 1086–1099. https://doi.org/10.1002/aic.690210607 Skjold-Jorgensen, S., Kolbe, B., Gmehling, J., & Rasmussen, P. (1979).\nVapor-Liquid Equilibria by UNIFAC Group Contribution. Revision and\nExtension. Industrial & Engineering Chemistry Process Design and\nDevelopment, 18(4), 714–722. https://doi.org/10.1021/i260072a024 Gmehling, J., Rasmussen, P., & Fredenslund, A. (1982). Vapor-liquid\nequilibriums by UNIFAC group contribution. Revision and extension. 2.\nIndustrial & Engineering Chemistry Process Design and Development, 21(1),\n118–127. https://doi.org/10.1021/i200016a021 Macedo, E. A., Weidlich, U., Gmehling, J., & Rasmussen, P. (1983).\nVapor-liquid equilibriums by UNIFAC group contribution. Revision and\nextension. 3. Industrial & Engineering Chemistry Process Design and\nDevelopment, 22(4), 676–678. https://doi.org/10.1021/i200023a023 Tiegs, D., Rasmussen, P., Gmehling, J., & Fredenslund, A. (1987).\nVapor-liquid equilibria by UNIFAC group contribution. 4. Revision and\nextension. Industrial & Engineering Chemistry Research, 26(1), 159–161. https://doi.org/10.1021/ie00061a030 Hansen, H. K., Rasmussen, P., Fredenslund, A., Schiller, M., &\nGmehling, J. (1991). Vapor-liquid equilibria by UNIFAC group\ncontribution. 5. Revision and extension. Industrial & Engineering\nChemistry Research, 30 (10), 2352–2355. https://doi.org/10.1021/ie00058a017 Wittig, R., Lohmann, J., & Gmehling, J. (2003). Vapor−Liquid Equilibria\nby UNIFAC Group Contribution. 6. Revision and Extension. Industrial &\nEngineering Chemistry Research, 42(1), 183–188. https://doi.org/10.1021/ie020506l Arguments None Return Value type( GeGCModelParameters )","tags":"","loc":"proc/unifacparameters.html"},{"title":"setup_unifac – yaeos","text":"public function setup_unifac(molecules, parameters) Setup UNIFAC Instantiate a UNIFAC model Description Subroutine used to instantiate a UNIFAC model. Examples ! Instantiate an UNIFAC model with ethanol-water mix and calculate gammas use yaeos , only : pr , Groups , setup_unifac , UNIFAC type ( UNIFAC ) :: model type ( Groups ) :: molecules ( 2 ) real ( pr ) :: ln_gammas ( 2 ) ! Ethanol definition [CH3, CH2, OH] molecules ( 1 )% groups_ids = [ 1 , 2 , 14 ] ! Subgroups ids molecules ( 1 )% number_of_groups = [ 1 , 1 , 1 ] ! Subgroups occurrences ! Water definition [H2O] molecules ( 2 )% groups_ids = [ 16 ] molecules ( 2 )% number_of_groups = [ 1 ] ! Model setup model = setup_unifac ( molecules ) ! Calculate ln_gammas call model % ln_activity_coefficient ([ 0.5_pr , 0.5_pr ], 29 8.0_pr , ln_gammas ) print * , ln_gammas ! result: 0.18534142000449058 0.40331395945417559 References Dortmund Data Bank Software & Separation Technology Arguments Type Intent Optional Attributes Name type( Groups ), intent(in) :: molecules (:) Molecules (Group type) objects type( GeGCModelParameters ), intent(in), optional :: parameters UNIFAC parameters Return Value type( UNIFAC ) Variables Type Visibility Attributes Name Initial real(kind=pr), public, allocatable :: Aij (:,:) integer, public :: gi integer, public :: i integer, public :: j integer, public :: k type( GeGCModelParameters ), public :: params type( UNIFACPsi ), public :: psi_function real(kind=pr), public, allocatable :: qks (:) type( Groups ), public :: soup integer, public, allocatable :: vij (:,:)","tags":"","loc":"proc/setup_unifac.html"},{"title":"thetas_i – yaeos","text":"public function thetas_i(nm, ng, parameters, stew, molecules) result(thetas_ij) calculation Calculate the area fraciton of each froup on each molecule. Description Calculate the area fraciton of each froup on each molecule. The values\nare obtained on the setup_unifac function and stored on the UNIFAC\ntype, since the values can be reused (no compositional or temperature\ndependence) References SINTEF - Thermopack Arguments Type Intent Optional Attributes Name integer, intent(in) :: nm Number of molecules integer, intent(in) :: ng Number of groups type( GeGCModelParameters ), intent(in) :: parameters UNIFAC parameters type( Groups ), intent(in) :: stew All the groups present in the system type( Groups ), intent(in) :: molecules (:) Molecules Return Value real(kind=pr), (nm,ng) Group j area fraction on molecule i Variables Type Visibility Attributes Name Initial integer, public :: gi integer, public :: i integer, public :: j integer, public :: k real(kind=pr), public :: qki_contribution real(kind=pr), public :: total_area_i (nm)","tags":"","loc":"proc/thetas_i.html"},{"title":"Ge_combinatorial – yaeos","text":"public subroutine Ge_combinatorial(self, n, T, Ge, dGe_dn, dGe_dn2) UNIFAC combinatorial term Calculate the UNIFAC combinatorial term of Gibbs excess energy Description Calculate the UNIFAC combinatorial term of reduced Gibbs excess energy.\nThe subroutine uses the Flory-Huggins and Staverman-Guggenheim\ncombinatory terms as follows: Flory-Huggins Staverman-Guggenheim Fredenslund et al. (UNIFAC) References SINTEF - Thermopack Arguments Type Intent Optional Attributes Name class( UNIFAC ) :: self real(kind=pr), intent(in) :: n (self%nmolecules) Moles vector [mol] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out), optional :: Ge Combinatorial Gibbs excess energy real(kind=pr), intent(out), optional :: dGe_dn (self%nmolecules) real(kind=pr), intent(out), optional :: dGe_dn2 (self%nmolecules,self%nmolecules) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: Ge_fh real(kind=pr), public :: Ge_sg real(kind=pr), public :: dGe_fh_dn (self%nmolecules) real(kind=pr), public :: dGe_fh_dn2 (self%nmolecules,self%nmolecules) real(kind=pr), public :: dGe_sg_dn (self%nmolecules) real(kind=pr), public :: dGe_sg_dn2 (self%nmolecules,self%nmolecules) integer, public :: i integer, public :: j real(kind=pr), public :: n_t real(kind=pr), public :: nq real(kind=pr), public :: nr","tags":"","loc":"proc/ge_combinatorial.html"},{"title":"Ge_residual – yaeos","text":"public subroutine Ge_residual(self, n, T, Ge, dGe_dn, dGe_dn2, dGe_dT, dGe_dT2, dGe_dTn) UNIFAC residual term Evaluate the UNIFAC residual therm Description Evaluate the UNIFAC residual therm. The residual Gibbs excess energy\nand its derivatives are evaluated as: With: In the UNIFAC model, the values are calculated assuming\nthat the molecule “i” is pure, hence only the subgroups of the molecule\n“i” must be considered for the calculation. On the other hand, for the values, all the system’s subgroups are considered. The compositional derivatives: With: The temperature derivatives: With: Temperature-compositional cross derivative: With: References SINTEF - Thermopack Arguments Type Intent Optional Attributes Name class( UNIFAC ) :: self real(kind=pr), intent(in) :: n (self%nmolecules) Moles vector real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out), optional :: Ge Residual Gibbs excess energy real(kind=pr), intent(out), optional :: dGe_dn (self%nmolecules) real(kind=pr), intent(out), optional :: dGe_dn2 (self%nmolecules,self%nmolecules) real(kind=pr), intent(out), optional :: dGe_dT real(kind=pr), intent(out), optional :: dGe_dT2 real(kind=pr), intent(out), optional :: dGe_dTn (self%nmolecules) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: Ejk (self%ngroups,self%ngroups) real(kind=pr), public :: Ge_aux real(kind=pr), public :: aux_sum (self%nmolecules) real(kind=pr), public :: aux_sum2 real(kind=pr), public :: dEjk_dt (self%ngroups,self%ngroups) real(kind=pr), public :: dEjk_dt2 (self%ngroups,self%ngroups) real(kind=pr), public :: dGe_dT_aux real(kind=pr), public :: dGe_dn_aux (self%nmolecules) real(kind=pr), public :: dlambda_ik_dT (self%nmolecules,self%ngroups) real(kind=pr), public :: dlambda_ik_dT2 (self%nmolecules,self%ngroups) real(kind=pr), public :: dlambda_k_dT (self%ngroups) real(kind=pr), public :: dlambda_k_dT2 (self%ngroups) real(kind=pr), public :: dlambda_k_dn (self%nmolecules,self%ngroups) real(kind=pr), public :: dlambda_k_dn2 (self%nmolecules,self%nmolecules,self%ngroups) real(kind=pr), public :: dlambda_k_dndT (self%nmolecules,self%ngroups) logical, public :: dn logical, public :: dn2 logical, public :: dt logical, public :: dt2 logical, public :: dtn integer, public :: i integer, public :: j integer, public :: k integer, public :: l real(kind=pr), public :: lambda_ik (self%nmolecules,self%ngroups) real(kind=pr), public :: lambda_k (self%ngroups) logical, public :: pge real(kind=pr), public :: sum_Q_v_dlambda_k_dn (self%nmolecules,self%nmolecules) real(kind=pr), public :: sum_ni_vij_Qj_Ejk (self%ngroups) real(kind=pr), public :: sum_ni_vij_Qj_dEjk_dT (self%ngroups) real(kind=pr), public :: sum_ni_vik_Qk real(kind=pr), public :: sum_nl_vlj (self%ngroups) real(kind=pr), public :: sum_vQ_Lambda (self%nmolecules) real(kind=pr), public :: sum_vij_Qj_Ejk (self%nmolecules,self%ngroups) real(kind=pr), public :: sum_vij_Qj_dEjk_dT (self%nmolecules,self%ngroups) real(kind=pr), public :: sum_vij_Qj_dEjk_dT2 (self%nmolecules,self%ngroups) real(kind=pr), public :: sum_vij_Qj_dlambdas_dT (self%nmolecules) real(kind=pr), public :: sum_vij_Qj_dlambdas_dT2 (self%nmolecules) real(kind=pr), public :: sum_vik_Qk (self%nmolecules) real(kind=pr), public :: theta_j (self%ngroups)","tags":"","loc":"proc/ge_residual.html"},{"title":"UNIFAC_temperature_dependence – yaeos","text":"public subroutine UNIFAC_temperature_dependence(self, systems_groups, T, psi, dpsi_dt, dpsi_dt2) UNIFAC temperature dependence Implementation of the function of the UNIFAC model. References Dortmund Data Bank Software & Separation Technology Fredenslund, A., Jones, R. L., & Prausnitz, J. M. (1975).\nGroup‐contribution estimation of activity coefficients in nonideal liquid\nmixtures. AIChE Journal, 21(6), 1086–1099. https://doi.org/10.1002/aic.690210607 Skjold-Jorgensen, S., Kolbe, B., Gmehling, J., & Rasmussen, P. (1979).\nVapor-Liquid Equilibria by UNIFAC Group Contribution. Revision and\nExtension. Industrial & Engineering Chemistry Process Design and\nDevelopment, 18(4), 714–722. https://doi.org/10.1021/i260072a024 Gmehling, J., Rasmussen, P., & Fredenslund, A. (1982). Vapor-liquid\nequilibriums by UNIFAC group contribution. Revision and extension. 2.\nIndustrial & Engineering Chemistry Process Design and Development, 21(1),\n118–127. https://doi.org/10.1021/i200016a021 Macedo, E. A., Weidlich, U., Gmehling, J., & Rasmussen, P. (1983).\nVapor-liquid equilibriums by UNIFAC group contribution. Revision and\nextension. 3. Industrial & Engineering Chemistry Process Design and\nDevelopment, 22(4), 676–678. https://doi.org/10.1021/i200023a023 Tiegs, D., Rasmussen, P., Gmehling, J., & Fredenslund, A. (1987).\nVapor-liquid equilibria by UNIFAC group contribution. 4. Revision and\nextension. Industrial & Engineering Chemistry Research, 26(1), 159–161. https://doi.org/10.1021/ie00061a030 Hansen, H. K., Rasmussen, P., Fredenslund, A., Schiller, M., &\nGmehling, J. (1991). Vapor-liquid equilibria by UNIFAC group\ncontribution. 5. Revision and extension. Industrial & Engineering\nChemistry Research, 30 (10), 2352–2355. https://doi.org/10.1021/ie00058a017 Wittig, R., Lohmann, J., & Gmehling, J. (2003). Vapor−Liquid Equilibria\nby UNIFAC Group Contribution. 6. Revision and Extension. Industrial &\nEngineering Chemistry Research, 42(1), 183–188. https://doi.org/10.1021/ie020506l SINTEF - Thermopack Type Bound UNIFACPsi Arguments Type Intent Optional Attributes Name class( UNIFACPsi ) :: self function class( Groups ) :: systems_groups Groups in the system real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out), optional :: psi (:,:) real(kind=pr), intent(out), optional :: dpsi_dt (:,:) real(kind=pr), intent(out), optional :: dpsi_dt2 (:,:) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: Aij real(kind=pr), public :: Eij integer, public :: i integer, public :: j integer, public :: ngroups","tags":"","loc":"proc/unifac_temperature_dependence.html"},{"title":"excess_gibbs – yaeos","text":"public subroutine excess_gibbs(self, n, T, Ge, GeT, GeT2, Gen, GeTn, Gen2) Excess Gibbs energy Calculate the Gibbs excess energy of the UNIFAC model Description Calculate the Gibbs excess energy of the UNIFAC model and its\nderivatives. Examples ! Gibbs excess of ethane-ethanol-methyl amine mixture. use yaeos , only : R , pr , Groups , setup_unifac , UNIFAC type ( UNIFAC ) :: model integer , parameter :: nc = 3 , ng = 4 type ( Groups ) :: molecules ( nc ) real ( pr ) :: Ge , Gen ( nc ), GeT , GeT2 , GeTn ( nc ), Gen2 ( nc , nc ) real ( pr ) :: n ( nc ), ln_gammas ( nc ), T T = 15 0.0_pr n = [ 2.0_pr , 7.0_pr , 1.0_pr ] ! Ethane [CH3] molecules ( 1 )% groups_ids = [ 1 ] molecules ( 1 )% number_of_groups = [ 2 ] ! Ethanol [CH3, CH2, OH] molecules ( 2 )% groups_ids = [ 1 , 2 , 14 ] molecules ( 2 )% number_of_groups = [ 1 , 1 , 1 ] ! Methylamine [H3C-NH2] molecules ( 3 )% groups_ids = [ 28 ] molecules ( 3 )% number_of_groups = [ 1 ] ! setup UNIFAC model model = setup_unifac ( molecules ) ! Call all Ge and derivatives call model % excess_gibbs ( model , n , T , Ge , GeT , GeT2 , Gen , GeTn , Gen2 ) print * , \"Ge: \" , Ge print * , \"GeT: \" , GeT print * , \"GeT2: \" , GeT2 print * , \"Gen: \" , Gen print * , \"GeTn: \" , GeTn print * , \"Gen2:\" print * , Gen2 ( 1 ,:) print * , Gen2 ( 2 ,:) print * , Gen2 ( 3 ,:) ! If you want the ln_gammas from \"Gen\" derivative: print * , \"ln_gammas: \" , Gen / R / T ! Or call model % ln_activity_coefficient ( n , T , ln_gammas ) print * , \"ln_gammas: \" , ln_gammas Type Bound UNIFAC Arguments Type Intent Optional Attributes Name class( UNIFAC ), intent(in) :: self UNIFAC model real(kind=pr), intent(in) :: n (:) Moles vector [mol] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out), optional :: Ge Excess Gibbs energy real(kind=pr), intent(out), optional :: GeT real(kind=pr), intent(out), optional :: GeT2 real(kind=pr), intent(out), optional :: Gen (size(n)) real(kind=pr), intent(out), optional :: GeTn (size(n)) real(kind=pr), intent(out), optional :: Gen2 (size(n),size(n)) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: Ge_c real(kind=pr), public :: dGe_c_dn (self%nmolecules) real(kind=pr), public :: dGe_c_dn2 (self%nmolecules,self%nmolecules) logical, public :: dn logical, public :: dn2 logical, public :: pge","tags":"","loc":"proc/excess_gibbs~2.html"},{"title":"ge_consistency – yaeos","text":"public subroutine ge_consistency(model, n, t, eq58, eq59, eq60, eq61) ge_consistency models consistency tests Description Evaluate the models consistency tests described in\nThermodynamic Models: Fundamentals & Computational Aspects 2 ed. by\nMichelsen and Mollerup (MM) Chapter 5 section 4. The “eq” are\nevaluations of the left hand side of the following expressions: Equation 58 Equation 59 Equation 60 Equation 61 Examples use yaeos , only : pr use yaeos , only : Groups , setup_unifac , UNIFAC use yaeos__consistency_gemodel , only : ge_consistency type ( UNIFAC ) :: model integer , parameter :: nc = 4 , ng = 4 type ( Groups ) :: molecules ( nc ) real ( pr ) :: n ( nc ), T real ( pr ) :: dt , dn real ( pr ) :: eq58 , eq59 ( nc ), eq60 ( nc , nc ), eq61 ( nc ) T = 30 3.15 n = [ 40 0.0 , 10 0.0 , 30 0.0 , 20 0.0 ] ! Hexane [CH3, CH2] molecules ( 1 )% groups_ids = [ 1 , 2 ] molecules ( 1 )% number_of_groups = [ 2 , 4 ] ! Ethanol [CH3, CH2, OH] molecules ( 2 )% groups_ids = [ 1 , 2 , 14 ] molecules ( 2 )% number_of_groups = [ 1 , 1 , 1 ] ! Toluene [ACH, ACCH3] molecules ( 3 )% groups_ids = [ 9 , 11 ] molecules ( 3 )% number_of_groups = [ 5 , 1 ] ! Cyclohexane [CH2] molecules ( 4 )% groups_ids = [ 2 ] molecules ( 4 )% number_of_groups = [ 6 ] model = setup_unifac ( molecules ) ! ==================================================================== ! Consistency tests ! -------------------------------------------------------------------- call ge_consistency ( model , n , t , eq58 , eq59 , eq60 , eq61 ) References Michelsen, M. L., & Mollerup, J. M. (2007). Thermodynamic models:\nFundamentals & computational aspects (2. ed). Tie-Line Publications. Arguments Type Intent Optional Attributes Name class( GeModel ), intent(in) :: model model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: t Temperature [K] real(kind=pr), intent(out), optional :: eq58 MM Eq. 58 real(kind=pr), intent(out), optional :: eq59 (size(n)) MM Eq. 59 real(kind=pr), intent(out), optional :: eq60 (size(n),size(n)) MM Eq. 60 real(kind=pr), intent(out), optional :: eq61 (size(n)) MM Eq. 61 Variables Type Visibility Attributes Name Initial real(kind=pr), public :: Ge real(kind=pr), public :: Gen (size(n)) real(kind=pr), public :: Gen2 (size(n),size(n)) integer, public :: i integer, public :: j real(kind=pr), public :: ln_gammas (size(n))","tags":"","loc":"proc/ge_consistency.html"},{"title":"numeric_ge_derivatives – yaeos","text":"public subroutine numeric_ge_derivatives(model, n, t, d_n, d_t, Ge, GeT, Gen, GeT2, GeTn, Gen2) numeric_ge_derivatives Numeric model derivatives Description Tool to facilitate the development of new GeModel by testing\nthe implementation of analytic derivatives. Examples use yaeos , only : Groups , setup_unifac , UNIFAC use yaeos__consistency_gemodel , only : numeric_ge_derivatives type ( UNIFAC ) :: model integer , parameter :: nc = 4 , ng = 4 type ( Groups ) :: molecules ( nc ) real ( pr ) :: Ge , Gen ( nc ), GeT , GeT2 , GeTn ( nc ), Gen2 ( nc , nc ) real ( pr ) :: Ge_n , Gen_n ( nc ), GeT_n , GeT2_n , GeTn_n ( nc ), Gen2_n ( nc , nc ) real ( pr ) :: ln_gammas ( nc ) real ( pr ) :: n ( nc ), T real ( pr ) :: dt , dn T = 30 3.15 n = [ 40 0.0 , 10 0.0 , 30 0.0 , 20 0.0 ] ! always test with sum(n) > 1 dt = 0.1_pr dn = 0.1_pr ! Hexane [CH3, CH2] molecules ( 1 )% groups_ids = [ 1 , 2 ] molecules ( 1 )% number_of_groups = [ 2 , 4 ] ! Ethanol [CH3, CH2, OH] molecules ( 2 )% groups_ids = [ 1 , 2 , 14 ] molecules ( 2 )% number_of_groups = [ 1 , 1 , 1 ] ! Toluene [ACH, ACCH3] molecules ( 3 )% groups_ids = [ 9 , 11 ] molecules ( 3 )% number_of_groups = [ 5 , 1 ] ! Cyclohexane [CH2] molecules ( 4 )% groups_ids = [ 2 ] molecules ( 4 )% number_of_groups = [ 6 ] model = setup_unifac ( molecules ) ! ===================================================================== ! Call analytic derivatives ! --------------------------------------------------------------------- call model % excess_gibbs ( n , T , Ge , GeT , GeT2 , Gen , GeTn , Gen2 ) ! ===================================================================== ! Call numeric derivatives ! --------------------------------------------------------------------- call numeric_ge_derivatives ( model , n , T , dn , dt , Ge = Ge_n , GeT = GeT_n ) call numeric_ge_derivatives ( model , n , T , dn , dt , Ge = Ge_n , Gen = Gen_n ) call numeric_ge_derivatives ( model , n , T , dn , dt , Ge = Ge_n , GeT2 = GeT2_n ) call numeric_ge_derivatives ( model , n , T , dn , dt , Ge = Ge_n , GeTn = GeTn_n ) call numeric_ge_derivatives ( model , n , T , dn , dt , Ge = Ge_n , Gen2 = Gen2_n ) Arguments Type Intent Optional Attributes Name class( GeModel ), intent(in) :: model model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: t Temperature [K] real(kind=pr), intent(in) :: d_n Moles finite difference step real(kind=pr), intent(in) :: d_t Temperature finite difference step real(kind=pr), intent(out) :: Ge Residual Helmoltz energy real(kind=pr), intent(out), optional :: GeT real(kind=pr), intent(out), optional :: Gen (size(n)) real(kind=pr), intent(out), optional :: GeT2 real(kind=pr), intent(out), optional :: GeTn (size(n)) real(kind=pr), intent(out), optional :: Gen2 (size(n),size(n)) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: Ge_aux1 real(kind=pr), public :: Ge_aux2 real(kind=pr), public :: Ge_aux3 real(kind=pr), public :: Ge_aux4 real(kind=pr), public :: dn_aux1 (size(n)) real(kind=pr), public :: dn_aux2 (size(n)) integer, public :: i integer, public :: j","tags":"","loc":"proc/numeric_ge_derivatives.html"},{"title":"betalimits – yaeos","text":"public subroutine betalimits(z, K, bmin, bmax) Define beta limits to avoid overshooting when solving the Rachford-Rice\nequation. This is based on the assumtion that either and . Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: z (:) Molar fractions vector real(kind=pr), intent(in) :: K (:) K-factors real(kind=pr), intent(out) :: bmin Minimum beta value real(kind=pr), intent(out) :: bmax Maximum beta value Variables Type Visibility Attributes Name Initial real(kind=pr), public, dimension(size(z)) :: vmax real(kind=pr), public, dimension(size(z)) :: vmin","tags":"","loc":"proc/betalimits.html"},{"title":"betato01 – yaeos","text":"public subroutine betato01(z, K) Modify K-factor values to assure that lies between (0,1) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: z (:) Molar fractions of the system real(kind=pr) :: K (:) K factors Variables Type Visibility Attributes Name Initial real(kind=pr), public :: g0 real(kind=pr), public :: g1","tags":"","loc":"proc/betato01.html"},{"title":"rachford_rice – yaeos","text":"public subroutine rachford_rice(z, K, beta, rr, drrdb) Rachford-Rice equation for a two phase system Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: z (:) real(kind=pr), intent(in) :: K (:) real(kind=pr), intent(in) :: beta real(kind=pr), intent(out) :: rr real(kind=pr), intent(out) :: drrdb Variables Type Visibility Attributes Name Initial real(kind=pr), public :: denom (size(z))","tags":"","loc":"proc/rachford_rice.html"},{"title":"solve_rr – yaeos","text":"public subroutine solve_rr(z, K, beta, beta_min, beta_max) Solve the Rachford-Rice Equation. Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: z (:) Mole fractions vector real(kind=pr), intent(in) :: K (:) K-factors real(kind=pr), intent(out) :: beta value real(kind=pr), intent(out) :: beta_min Lower limit for real(kind=pr), intent(out) :: beta_max Upper limit for Variables Type Visibility Attributes Name Initial real(kind=pr), public :: dgdb real(kind=pr), public :: g real(kind=pr), public :: step","tags":"","loc":"proc/solve_rr.html"},{"title":"cubic_v0 – yaeos","text":"public function cubic_v0(z, p, t) Arguments Type Intent Optional Attributes Name real(kind=pr) :: z (:) real(kind=pr) :: p real(kind=pr) :: t Return Value real(kind=pr) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: dbi (nc) real(kind=pr), public :: dbij (nc,nc)","tags":"","loc":"proc/cubic_v0.html"},{"title":"ArVnder – yaeos","text":"public subroutine ArVnder(nc, nder, ntemp, z, V, T, ar, arv, artv, arv2, Arn, ArVn, ArTn, Arn2) Arguments Type Intent Optional Attributes Name integer, intent(in) :: nc integer, intent(in) :: nder integer, intent(in) :: ntemp real(kind=pr), intent(in) :: z (nc) real(kind=pr), intent(in) :: V real(kind=pr), intent(in) :: T real(kind=pr), intent(out) :: ar real(kind=pr), intent(out) :: arv real(kind=pr), intent(out) :: artv real(kind=pr), intent(out) :: arv2 real(kind=pr), intent(out), dimension(size(z)) :: Arn real(kind=pr), intent(out), dimension(size(z)) :: ArVn real(kind=pr), intent(out), dimension(size(z)) :: ArTn real(kind=pr), intent(out) :: Arn2 (size(z),size(z))","tags":"","loc":"proc/arvnder.html"},{"title":"Bnder – yaeos","text":"public subroutine Bnder(nc, rn, Bmix, dBi, dBij) Arguments Type Intent Optional Attributes Name integer, intent(in) :: nc real(kind=pr), intent(in) :: rn (nc) real(kind=pr), intent(out) :: Bmix real(kind=pr), intent(out) :: dBi (nc) real(kind=pr), intent(out) :: dBij (nc,nc) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: aux (nc) integer, public :: i integer, public :: j real(kind=pr), public :: totn","tags":"","loc":"proc/bnder.html"},{"title":"DELTAnder – yaeos","text":"public subroutine DELTAnder(nc, rn, D1m, dD1i, dD1ij) Arguments Type Intent Optional Attributes Name integer, intent(in) :: nc real(kind=pr), intent(in) :: rn (nc) real(kind=pr), intent(out) :: D1m real(kind=pr), intent(out) :: dD1i (nc) real(kind=pr), intent(out) :: dD1ij (nc,nc) Variables Type Visibility Attributes Name Initial integer, public :: i integer, public :: j real(kind=pr), public :: totn","tags":"","loc":"proc/deltander.html"},{"title":"DandTnder – yaeos","text":"public subroutine DandTnder(ntd, nc, T, rn, D, dDi, dDiT, dDij, dDdT, dDdT2) Arguments Type Intent Optional Attributes Name integer, intent(in) :: ntd integer, intent(in) :: nc real(kind=pr), intent(in) :: T real(kind=pr), intent(in) :: rn (nc) real(kind=pr), intent(out) :: D real(kind=pr), intent(out) :: dDi (nc) real(kind=pr), intent(out) :: dDiT (nc) real(kind=pr), intent(out) :: dDij (nc,nc) real(kind=pr), intent(out) :: dDdT real(kind=pr), intent(out) :: dDdT2 Variables Type Visibility Attributes Name Initial real(kind=pr), public :: aij (nc,nc) real(kind=pr), public :: aux real(kind=pr), public :: aux2 real(kind=pr), public :: daijdT (nc,nc) real(kind=pr), public :: daijdT2 (nc,nc) integer, public :: i integer, public :: j","tags":"","loc":"proc/dandtnder.html"},{"title":"HelmRKPR – yaeos","text":"public subroutine HelmRKPR(nco, NDE, NTD, rn, V, T, Ar, ArV, ArTV, ArV2, Arn, ArVn, ArTn, Arn2) Calculate the reduced residual Helmholtz Energy and it’s derivatives with the RKPR EOS Arguments Type Intent Optional Attributes Name integer, intent(in) :: nco integer, intent(in) :: NDE integer, intent(in) :: NTD real(kind=pr), intent(in) :: rn (nco) real(kind=pr), intent(in) :: V real(kind=pr), intent(in) :: T real(kind=pr), intent(out) :: Ar real(kind=pr), intent(out) :: ArV real(kind=pr), intent(out) :: ArTV real(kind=pr), intent(out) :: ArV2 real(kind=pr), intent(out) :: Arn (nco) real(kind=pr), intent(out) :: ArVn (nco) real(kind=pr), intent(out) :: ArTn (nco) real(kind=pr), intent(out) :: Arn2 (nco,nco) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: AUX real(kind=pr), public :: ArT real(kind=pr), public :: ArTT real(kind=pr), public :: Bmix real(kind=pr), public :: D real(kind=pr), public :: D1 real(kind=pr), public :: D2 real(kind=pr), public :: FFB real(kind=pr), public :: FFBB real(kind=pr), public :: FFBV real(kind=pr), public :: auxD2 real(kind=pr), public :: dBi (nco) real(kind=pr), public :: dBij (nco,nco) real(kind=pr), public :: dD1i (nco) real(kind=pr), public :: dD1ij (nco,nco) real(kind=pr), public :: dDdT real(kind=pr), public :: dDdT2 real(kind=pr), public :: dDi (nco) real(kind=pr), public :: dDiT (nco) real(kind=pr), public :: dDij (nco,nco) real(kind=pr), public :: f real(kind=pr), public :: fB real(kind=pr), public :: fBD1 real(kind=pr), public :: fD1 real(kind=pr), public :: fD1D1 real(kind=pr), public :: fVD1 real(kind=pr), public :: fv real(kind=pr), public :: fv2 real(kind=pr), public :: g real(kind=pr), public :: gv real(kind=pr), public :: gv2 integer, public :: i integer, public :: j real(kind=pr), public :: totn","tags":"","loc":"proc/helmrkpr.html"},{"title":"HelmSRKPR – yaeos","text":"public subroutine HelmSRKPR(nc, nd, nt, rn, v, t, ar, arv, artv, arv2, Arn, ArVn, ArTn, Arn2) Arguments Type Intent Optional Attributes Name integer, intent(in) :: nc Number of components integer, intent(in) :: nd Compositional derivatives integer, intent(in) :: nt Temperature derivatives real(kind=pr), intent(in) :: rn (nc) Number of moles real(kind=pr), intent(in) :: v Volume [L] real(kind=pr), intent(in) :: t Temperature [K] real(kind=pr), intent(out) :: ar Residual Helmholtz real(kind=pr), intent(out) :: arv dAr/dV real(kind=pr), intent(out) :: artv dAr2/dTV real(kind=pr), intent(out) :: arv2 dAr2/dV2 real(kind=pr), intent(out) :: Arn (nc) dAr/dn real(kind=pr), intent(out) :: ArVn (nc) dAr2/dVn real(kind=pr), intent(out) :: ArTn (nc) dAr2/dTn real(kind=pr), intent(out) :: Arn2 (nc,nc) dAr2/dn2 Variables Type Visibility Attributes Name Initial real(kind=pr), public :: AUX real(kind=pr), public :: ArT real(kind=pr), public :: ArTT real(kind=pr), public :: Bmix real(kind=pr), public :: D real(kind=pr), public :: FFB real(kind=pr), public :: FFBB real(kind=pr), public :: FFBV real(kind=pr), public :: a real(kind=pr), public :: b_v real(kind=pr), public :: d1 real(kind=pr), public :: d2 real(kind=pr), public :: dBi (nc) real(kind=pr), public :: dBij (nc,nc) real(kind=pr), public :: dDdT real(kind=pr), public :: dDdT2 real(kind=pr), public :: dDi (nc) real(kind=pr), public :: dDiT (nc) real(kind=pr), public :: dDij (nc,nc) real(kind=pr), public :: f real(kind=pr), public :: fB real(kind=pr), public :: fv real(kind=pr), public :: fv2 real(kind=pr), public :: g real(kind=pr), public :: gv real(kind=pr), public :: gv2 integer, public :: i integer, public :: j real(kind=pr), public :: totn","tags":"","loc":"proc/helmsrkpr.html"},{"title":"PR76_factory – yaeos","text":"public subroutine PR76_factory(moles_in, ac_in, b_in, tc_in, pc_in, w_in, k_in) PengRobinson 76 factory Takes either the critical parameters or the fitted model parameters\nand gets ones in base of the others Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: moles_in (nc) real(kind=pr), intent(in), optional :: ac_in (nc) real(kind=pr), intent(in), optional :: b_in (nc) real(kind=pr), intent(in), optional :: tc_in (nc) real(kind=pr), intent(in), optional :: pc_in (nc) real(kind=pr), intent(in), optional :: w_in (nc) real(kind=pr), intent(in), optional :: k_in (nc) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: RTc (nc) real(kind=pr), public :: al real(kind=pr), public :: be logical, public :: critical_spec real(kind=pr), public :: ga (nc) integer, public :: i real(kind=pr), public :: oma (nc) real(kind=pr), public :: omb (nc) logical, public :: params_spec real(kind=pr), public :: vceos (nc) real(kind=pr), public :: zc (nc)","tags":"","loc":"proc/pr76_factory.html"},{"title":"PR78_factory – yaeos","text":"public subroutine PR78_factory(moles_in, ac_in, b_in, tc_in, pc_in, w_in, k_in) PengRobinson 78 factory Takes either the critical parameters or the fitted model parameters\nand gets ones in base of the others Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: moles_in (nc) real(kind=pr), intent(in), optional :: ac_in (nc) real(kind=pr), intent(in), optional :: b_in (nc) real(kind=pr), intent(in), optional :: tc_in (nc) real(kind=pr), intent(in), optional :: pc_in (nc) real(kind=pr), intent(in), optional :: w_in (nc) real(kind=pr), intent(in), optional :: k_in (nc) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: RTc (nc) real(kind=pr), public :: al real(kind=pr), public :: be logical, public :: critical_spec real(kind=pr), public :: ga (nc) integer, public :: i real(kind=pr), public :: oma (nc) real(kind=pr), public :: omb (nc) logical, public :: params_spec real(kind=pr), public :: vceos (nc) real(kind=pr), public :: zc (nc)","tags":"","loc":"proc/pr78_factory.html"},{"title":"SRK_factory – yaeos","text":"public subroutine SRK_factory(moles_in, ac_in, b_in, tc_in, pc_in, w_in, k_in) SoaveRedlichKwong factory Takes either the critical parameters or the fitted model parameters\nand gets ones in base of the others Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: moles_in (nc) real(kind=pr), intent(in), optional :: ac_in (nc) real(kind=pr), intent(in), optional :: b_in (nc) real(kind=pr), intent(in), optional :: tc_in (nc) real(kind=pr), intent(in), optional :: pc_in (nc) real(kind=pr), intent(in), optional :: w_in (nc) real(kind=pr), intent(in), optional :: k_in (nc) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: RTc (nc) real(kind=pr), public :: al real(kind=pr), public :: be logical, public :: critical_spec real(kind=pr), public :: ga (nc) integer, public :: i integer, public :: j real(kind=pr), public :: oma (nc) real(kind=pr), public :: omb (nc) logical, public :: params_spec real(kind=pr), public :: vceos (nc) real(kind=pr), public :: zc (nc)","tags":"","loc":"proc/srk_factory.html"},{"title":"aTder – yaeos","text":"public subroutine aTder(ac, Tc, k, T, a, dadT, dadT2) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: ac real(kind=pr), intent(in) :: Tc real(kind=pr), intent(in) :: k real(kind=pr), intent(in) :: T real(kind=pr), intent(out) :: a real(kind=pr), intent(out) :: dadT real(kind=pr), intent(out) :: dadT2 Variables Type Visibility Attributes Name Initial real(kind=pr), public :: Tr","tags":"","loc":"proc/atder.html"},{"title":"aijTder – yaeos","text":"public subroutine aijTder(ntd, nc, T, aij, daijdT, daijdT2) Arguments Type Intent Optional Attributes Name integer, intent(in) :: ntd integer, intent(in) :: nc real(kind=pr), intent(in) :: T real(kind=pr), intent(out) :: aij (nc,nc) real(kind=pr), intent(out) :: daijdT (nc,nc) real(kind=pr), intent(out) :: daijdT2 (nc,nc) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: ai (nc) real(kind=pr), public :: aux (nc,nc) real(kind=pr), public :: daidT (nc) real(kind=pr), public :: daidT2 (nc) integer, public :: i integer, public :: j real(kind=pr), public :: ratK (nc,nc)","tags":"","loc":"proc/aijtder.html"},{"title":"ar_rkpr – yaeos","text":"public subroutine ar_rkpr(z, v, t, ar, arv, artv, arv2, Arn, ArVn, ArTn, Arn2) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: z (:) Number of moles real(kind=pr), intent(in) :: v Volume [L] real(kind=pr), intent(in) :: t Temperature [K] real(kind=pr), intent(out) :: ar Residual Helmholtz real(kind=pr), intent(out) :: arv dAr/dV real(kind=pr), intent(out) :: artv dAr2/dTV real(kind=pr), intent(out) :: arv2 dAr2/dV2 real(kind=pr), intent(out) :: Arn (size(z)) dAr/dn real(kind=pr), intent(out) :: ArVn (size(z)) dAr2/dVn real(kind=pr), intent(out) :: ArTn (size(z)) dAr2/dTn real(kind=pr), intent(out) :: Arn2 (size(z),size(z)) dAr2/dn2 Variables Type Visibility Attributes Name Initial integer, public :: nd Compositional derivatives integer, public :: nt Temperature derivatives","tags":"","loc":"proc/ar_rkpr.html"},{"title":"ar_srkpr – yaeos","text":"public subroutine ar_srkpr(z, v, t, ar, arv, artv, arv2, Arn, ArVn, ArTn, Arn2) Wrapper subroutine to the SRK/PR Residula Helmholtz function to\nuse the general interface Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: z (:) Number of moles real(kind=pr), intent(in) :: v Volume [L] real(kind=pr), intent(in) :: t Temperature [K] real(kind=pr), intent(out) :: ar Residual Helmholtz real(kind=pr), intent(out) :: arv dAr/dV real(kind=pr), intent(out) :: artv dAr2/dTV real(kind=pr), intent(out) :: arv2 dAr2/dV2 real(kind=pr), intent(out) :: Arn (size(z)) dAr/dn real(kind=pr), intent(out) :: ArVn (size(z)) dAr2/dVn real(kind=pr), intent(out) :: ArTn (size(z)) dAr2/dTn real(kind=pr), intent(out) :: Arn2 (size(z),size(z)) dAr2/dn2 Variables Type Visibility Attributes Name Initial integer, public :: nd Compositional derivatives integer, public :: nt Temperature derivatives","tags":"","loc":"proc/ar_srkpr.html"},{"title":"get_Zc_OMa_OMb – yaeos","text":"public subroutine get_Zc_OMa_OMb(del1, Zc, OMa, OMb) Calculate Zc, OMa and OMb from the delta_1 parameter. Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: del1 (:) delta_1 parameter real(kind=pr), intent(out) :: Zc (:) Critical compressibility factor real(kind=pr), intent(out) :: OMa (:) OMa real(kind=pr), intent(out) :: OMb (:) OMb Variables Type Visibility Attributes Name Initial real(kind=pr), public :: d1 (size(del1)) real(kind=pr), public :: y (size(del1))","tags":"","loc":"proc/get_zc_oma_omb.html"},{"title":"setup – yaeos","text":"public subroutine setup(n, nmodel, ntdep, ncomb) Setup the basics variables that describe the model. Arguments Type Intent Optional Attributes Name integer, intent(in) :: n Number of components integer, intent(in) :: nmodel Number of model integer, intent(in) :: ntdep Kij dependant of temperature integer, intent(in) :: ncomb Combining rule","tags":"","loc":"proc/setup.html"},{"title":"PUREFUG_CALC – yaeos","text":"public subroutine PUREFUG_CALC(nc, icomp, T, P, V, phi) Fugacity of a pure component Arguments Type Intent Optional Attributes Name integer, intent(in) :: nc integer, intent(in) :: icomp real(kind=pr), intent(in) :: T real(kind=pr), intent(in) :: P real(kind=pr), intent(in) :: V real(kind=pr), intent(out) :: phi Variables Type Visibility Attributes Name Initial real(kind=pr), public :: Ar real(kind=pr), public :: ArTV real(kind=pr), public :: ArTn (nc) real(kind=pr), public :: ArV2 real(kind=pr), public :: ArVn (nc) real(kind=pr), public :: Arn (nc) real(kind=pr), public :: Arn2 (nc,nc) real(kind=pr), public :: Arv real(kind=pr), public :: RT real(kind=pr), public :: Z real(kind=pr), public :: philog real(kind=pr), public :: rn (nc)","tags":"","loc":"proc/purefug_calc.html"},{"title":"TERMO – yaeos","text":"public subroutine TERMO(nc, mtyp, indic, t, p, rn, v, PHILOG, DLPHIP, DLPHIT, FUGN) Arguments Type Intent Optional Attributes Name integer, intent(in) :: nc Number of components integer, intent(in) :: mtyp Type of root desired (-1 vapor, 1 liquid, 0 lower Gr) integer, intent(in) :: indic Desired element, this should be setted with optionals real(kind=pr), intent(in) :: t Temperature [K] real(kind=pr), intent(in) :: p Pressure [bar] real(kind=pr), intent(in) :: rn (nc) Mixture mole numbers real(kind=pr), intent(out) :: v Volume [L] real(kind=pr), intent(out) :: PHILOG (nc) ln(phi*p) vector real(kind=pr), intent(out), optional :: DLPHIP (nc) ln(phi) Presssure derivative real(kind=pr), intent(out), optional :: DLPHIT (nc) ln(phi) Temp derivative real(kind=pr), intent(out), optional :: FUGN (nc,nc) ln(phi) compositional derivative Variables Type Visibility Attributes Name Initial real(kind=pr), public :: ArTn (nc) real(kind=pr), public :: ArVn (nc) real(kind=pr), public :: Arn (nc) real(kind=pr), public :: Arn2 (nc,nc) real(kind=pr), public :: DPDN (nc) real(kind=pr), public :: RT real(kind=pr), public :: Z real(kind=pr), public :: ar real(kind=pr), public :: artv real(kind=pr), public :: arv real(kind=pr), public :: arv2 real(kind=pr), public :: dpdt real(kind=pr), public :: dpv integer, public :: i integer, public :: igz integer, public :: k integer, public :: nder integer, public :: ntemp real(kind=pr), public :: totn","tags":"","loc":"proc/termo.html"},{"title":"VCALC – yaeos","text":"public recursive subroutine VCALC(ITYP, nc, ntemp, rn, T, P, V) ROUTINE FOR CALCULATION OF VOLUME, GIVEN PRESSURE Arguments Type Intent Optional Attributes Name integer, intent(in) :: ITYP TYPE OF ROOT DESIRED (-1 vapor, 1 liquid, 0 lower Gibbs energy phase) integer, intent(in) :: nc NO. OF COMPONENTS integer, intent(in) :: ntemp 1 if T-derivatives are required real(kind=pr), intent(in) :: rn (nc) FEED MOELS real(kind=pr), intent(in) :: T TEMPERATURE real(kind=pr), intent(in) :: P PRESURE real(kind=pr), intent(out) :: V VOLUME Variables Type Visibility Attributes Name Initial real(kind=pr), public :: AT real(kind=pr), public :: AVAP real(kind=pr), public :: Ar real(kind=pr), public :: ArTV real(kind=pr), public :: ArTn (nc) real(kind=pr), public :: ArV real(kind=pr), public :: ArV2 real(kind=pr), public :: ArVn (nc) real(kind=pr), public :: Arn (nc) real(kind=pr), public :: Arn2 (nc,nc) real(kind=pr), public :: B real(kind=pr), public :: CPV logical, public :: FIRST_RUN real(kind=pr), public :: S3R real(kind=pr), public :: VVAP real(kind=pr), public :: ZETA real(kind=pr), public :: ZETMAX real(kind=pr), public :: ZETMIN real(kind=pr), public :: del real(kind=pr), public :: der integer, public :: iter integer, public :: nder real(kind=pr), public :: pcalc real(kind=pr), public :: totn","tags":"","loc":"proc/vcalc.html"},{"title":"zTVTERMO – yaeos","text":"public subroutine zTVTERMO(nc, indic, t, rn, v, p, dpv, PHILOG, DLPHIP, DLPHIT, FUGN) Calculation of lnphi P and derivatives\n rn mixture mole numbers (input)\n t temperature (k) (input)\n v volume (L) (input)\n p pressure (bar) (output)\n PHILOG vector of ln(phi(i) P) (output) 0 < INDIC < 5\n DLPHIT t-derivative of ln(phi(i)) (const P, n) (output) 0 < INDIC = 2 or 4\n DLPHIP P-derivative of ln(phi(i)) (const T, n) (output) 0 < INDIC < 5\n FUGN comp-derivative of ln(phi(i)) (const t & P)(output) 2 < INDIC Arguments Type Intent Optional Attributes Name integer, intent(in) :: nc integer, intent(in) :: indic real(kind=pr), intent(in) :: t real(kind=pr), intent(in) :: rn (nc) real(kind=pr), intent(in) :: v real(kind=pr), intent(out) :: p real(kind=pr), intent(out) :: dpv real(kind=pr), intent(out) :: PHILOG (nc) real(kind=pr), intent(out) :: DLPHIP (nc) real(kind=pr), intent(out) :: DLPHIT (nc) real(kind=pr), intent(out) :: FUGN (nc,nc) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: ArTn (nc) real(kind=pr), public :: ArVn (nc) real(kind=pr), public :: Arn (nc) real(kind=pr), public :: Arn2 (nc,nc) real(kind=pr), public :: DPDN (nc) real(kind=pr), public :: RT real(kind=pr), public :: Z real(kind=pr), public :: ar real(kind=pr), public :: artv real(kind=pr), public :: arv real(kind=pr), public :: arv2 real(kind=pr), public :: dpdt integer, public :: i integer, public :: igz integer, public :: k integer, public :: nder integer, public :: ntemp real(kind=pr), public :: totn","tags":"","loc":"proc/ztvtermo.html"},{"title":"PengRobinson76 – yaeos","text":"public function PengRobinson76(tc, pc, w, kij, lij) result(model) Uses yaeos__models_ar_genericcubic yaeos__substance yaeos__models_ar_cubic_quadratic_mixing yaeos__models_ar_cubic_alphas yaeos__constants PengRobinson76. Using the critical constants setup the parameters to use the \nPengRobinson Equation of State There is also the optional posibility to include the and matrices. Using by default Classic Van der Waals mixing\nrules. After setting up the model, it is possible to redefine either the\nmixing rule or the alpha function using a different derived type\ndefined outside the function. Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: tc (:) Critical Temperatures [K] real(kind=pr), intent(in) :: pc (:) Critical Pressures [bar] real(kind=pr), intent(in) :: w (:) Acentric Factors real(kind=pr), intent(in), optional :: kij (:,:) matrix real(kind=pr), intent(in), optional :: lij (:,:) matrix Return Value type( CubicEoS ) Variables Type Visibility Attributes Name Initial type( AlphaSoave ), private :: alpha type( Substances ), private :: composition integer, private :: i type( QMR ), private :: mixrule integer, private :: nc","tags":"","loc":"proc/pengrobinson76.html"},{"title":"PengRobinson78 – yaeos","text":"public function PengRobinson78(tc, pc, w, kij, lij) result(model) Uses yaeos__models_ar_genericcubic yaeos__substance yaeos__models_ar_cubic_quadratic_mixing yaeos__models_ar_cubic_alphas yaeos__constants PengRobinson78. Using the critical constants setup the parameters to use the \nPengRobinson Equation of State There is also the optional posibility to include the and matrices. Using by default Classic Van der Waals mixing\nrules. After setting up the model, it is possible to redefine either the\nmixing rule or the alpha function using a different derived type\ndefined outside the function. Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: tc (:) Critical Temperatures [K] real(kind=pr), intent(in) :: pc (:) Critical Pressures [bar] real(kind=pr), intent(in) :: w (:) Acentric Factors real(kind=pr), intent(in), optional :: kij (:,:) matrix real(kind=pr), intent(in), optional :: lij (:,:) matrix Return Value type( CubicEoS ) Variables Type Visibility Attributes Name Initial type( AlphaSoave ), private :: alpha type( Substances ), private :: composition integer, private :: i type( QMR ), private :: mixrule integer, private :: nc","tags":"","loc":"proc/pengrobinson78.html"},{"title":"RKPR – yaeos","text":"public function RKPR(tc, pc, w, zc, kij, lij, delta_1, k) result(model) Uses yaeos__models_ar_cubic_quadratic_mixing yaeos__models_ar_cubic_alphas RKPR Equation of State The RKPR EoS extends the classical formulation of Cubic Equations \nof State by freeing the parameter . This extra degree\nprovides extra ways of implementing the equation in comparison\nof other Cubic EoS (like PR and SRK) which are limited to definition\nof their critical constants. Besides that extra parameter, the RKRR includes another function: In this implementation we take the simplest form which correlates\nthe extra parameter to the critical compressibility factor and\nthe parameter of the function to and : Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: tc (:) Critical Temperature [K] real(kind=pr), intent(in) :: pc (:) Critical Pressure [bar] real(kind=pr), intent(in) :: w (:) Acentric Factor real(kind=pr), intent(in) :: zc (:) Critical compressibility real(kind=pr), intent(in), optional :: kij (:,:) k_{ij} matrix real(kind=pr), intent(in), optional :: lij (:,:) l_{ij} matrix real(kind=pr), intent(in), optional :: delta_1 (:) real(kind=pr), intent(in), optional :: k (:) Return Value type( CubicEoS ) Variables Type Visibility Attributes Name Initial real(kind=pr), private, parameter :: A0 = 0.0017 real(kind=pr), private, parameter :: A1 = -2.4407 real(kind=pr), private, parameter :: B0 = 1.9681 real(kind=pr), private, parameter :: B1 = 7.4513 real(kind=pr), private, parameter :: C0 = -2.6238 real(kind=pr), private, parameter :: C1 = 12.504 real(kind=pr), private :: OMa (size(pc)) real(kind=pr), private :: OMb (size(pc)) real(kind=pr), private :: Zc_eos (size(pc)) type( AlphaRKPR ), private :: alpha type( Substances ), private :: composition real(kind=pr), private, parameter :: d1 = 0.428364 real(kind=pr), private, parameter :: d2 = 18.496215 real(kind=pr), private, parameter :: d3 = 0.338426 real(kind=pr), private, parameter :: d4 = 0.66 real(kind=pr), private, parameter :: d5 = 789.723105 real(kind=pr), private, parameter :: d6 = 2.512392 integer, private :: i type( QMR_RKPR ), private :: mixrule integer, private :: nc","tags":"","loc":"proc/rkpr.html"},{"title":"SoaveRedlichKwong – yaeos","text":"public function SoaveRedlichKwong(tc, pc, w, kij, lij) result(model) Uses yaeos__models_ar_genericcubic yaeos__models_ar_cubic_alphas yaeos__models_ar_cubic_quadratic_mixing SoaveRedlichKwong. Using the critical constants setup the parameters to use the \nSoaveRedlichKwong Equation of State There is also the optional posibility to include the k_{ij} and l_{ij}\nmatrices. Using by default Classic Van der Waals mixing rules. After setting up the model, it is possible to redefine either the\nmixing rule or the alpha function using a different derived type\ndefined outside the function. Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: tc (:) Critical temperature [K] real(kind=pr), intent(in) :: pc (:) Critical pressure [bar] real(kind=pr), intent(in) :: w (:) Acentric factor real(kind=pr), intent(in), optional :: kij (:,:) matrix real(kind=pr), intent(in), optional :: lij (:,:) matrix Return Value type( CubicEoS ) Variables Type Visibility Attributes Name Initial type( AlphaSoave ), private :: alpha type( Substances ), private :: composition integer, private :: i type( QMR ), private :: mixrule integer, private :: nc","tags":"","loc":"proc/soaveredlichkwong.html"},{"title":"get_OMa_OMb – yaeos","text":"private subroutine get_OMa_OMb(del1, OMa, OMb) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: del1 (:) real(kind=pr), intent(out) :: OMa (size(del1)) real(kind=pr), intent(out) :: OMb (size(del1)) Variables Type Visibility Attributes Name Initial real(kind=pr), private :: d1 (size(del1)) real(kind=pr), private :: y (size(del1))","tags":"","loc":"proc/get_oma_omb.html"},{"title":"volume_michelsen – yaeos","text":"public subroutine volume_michelsen(eos, n, P, T, V, root_type, max_iters, V0) Uses stdlib_optval iso_fortran_env Volume solver at a given pressure. Obtain the volume using the method described by Michelsen and Møllerup.\nWhile can be obtained with a simple Newton method, a better\napproach is solving where is the EoS covolume.\nThis method is easier to solve because: and At chapter 3 page 94 of Michelsen and Møllerup’s book a more complete\nexplanation can be seen Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos real(kind=pr), intent(in) :: n (:) Mixture moles real(kind=pr), intent(in) :: P Pressure [bar] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out) :: V Volume [L] character(len=*), intent(in), optional :: root_type Type of root [“vapor” | “liquid” | “stable”] integer, intent(in), optional :: max_iters Maxiumum number of iterations, defaults to 100 real(kind=pr), intent(in), optional :: V0 Specified initial volume Variables Type Visibility Attributes Name Initial real(kind=pr), public :: AT real(kind=pr), public :: AVAP real(kind=pr), public :: Ar real(kind=pr), public :: ArV real(kind=pr), public :: ArV2 real(kind=pr), public :: B Covolume real(kind=pr), public :: VVAP real(kind=pr), public :: ZETA real(kind=pr), public :: ZETMAX real(kind=pr), public :: ZETMIN integer, public :: iter integer, public :: maximum_iterations real(kind=pr), public :: pcalc character(len=10), public :: root real(kind=pr), public :: totn Subroutines subroutine solve_point (P, V, Pcalc, AT, iter) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: P Objective pressure [bar] real(kind=pr), intent(out) :: V Obtained volume [L] real(kind=pr), intent(out) :: Pcalc Calculated pressure at V [bar] real(kind=pr), intent(out) :: AT integer, intent(out) :: iter","tags":"","loc":"proc/volume_michelsen.html"},{"title":"pressure_equality_V_beta_xy – yaeos","text":"public subroutine pressure_equality_V_beta_xy(model, T, V, beta, x, y, Vx, Vy, P) Uses iso_fortran_env Solve pressure equality between two phases at a given temperature,\ntotal volume, vapor molar fractions and compositions. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: model real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(in) :: V Total volume [L/mol] real(kind=pr), intent(in) :: beta Molar fraction of light-phase real(kind=pr), intent(in) :: x (:) Molar fractions of heavy-phase real(kind=pr), intent(in) :: y (:) Molar fractions of light-phase real(kind=pr), intent(inout) :: Vx Heavy-phase molar volume [L/mol] real(kind=pr), intent(inout) :: Vy Light-Phase molar volume [L/mol] real(kind=pr), intent(out) :: P Pressure [bar] Variables Type Visibility Attributes Name Initial real(kind=pr), public :: Bx Liquid phase covolume real(kind=pr), public :: Px real(kind=pr), public :: Py real(kind=pr), public :: dPxdV real(kind=pr), public :: dPydV real(kind=pr), public :: dVydVx Derivative of Vy wrt Vx real(kind=pr), public :: dh dh/ real(kind=pr), public :: h Pressure equality integer, public :: its real(kind=pr), public :: stepv","tags":"","loc":"proc/pressure_equality_v_beta_xy.html"},{"title":"optimize – yaeos","text":"public function optimize(X, opt, data) result(y) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(inout) :: X (:) Vector of parameters to fit class( Optimizer ), intent(inout) :: opt Optimizer object, bsaed on the Optimizer class from yaeos__optimizers class( FittingProblem ), intent(inout), optional :: data Fitting problem to optimize Return Value real(kind=pr)","tags":"","loc":"proc/optimize.html"},{"title":"error_function – yaeos","text":"public subroutine error_function(X, Fobj, dF, func_data) Uses yaeos__math error_function Error function for phase-equilibria optimization. Using two-phase\npoints and an error function of: Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: X (:) Vector of parameters real(kind=pr), intent(out) :: Fobj Objective function real(kind=pr), intent(out), optional :: dF (:) Gradient of the objective function, only exists to be consistent\nwith the Optimizer class API class(*), intent(inout), optional :: func_data Variables Type Visibility Attributes Name Initial type( EquilibriumState ), public :: exp_point integer, public :: i type( EquilibriumState ), public :: model_point Each solved point","tags":"","loc":"proc/error_function.html"},{"title":"AddHyperDualHyperDual – yaeos","text":"public elemental function AddHyperDualHyperDual(v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual )","tags":"","loc":"proc/addhyperdualhyperdual.html"},{"title":"AddHyperDualReal – yaeos","text":"public elemental function AddHyperDualReal(v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 real(kind=pr), intent(in) :: v2 Return Value type( hyperdual )","tags":"","loc":"proc/addhyperdualreal.html"},{"title":"AddRealHyperDual – yaeos","text":"public elemental function AddRealHyperDual(v1, v2) result(v3) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual )","tags":"","loc":"proc/addrealhyperdual.html"},{"title":"DivideHyperDualHyperDual – yaeos","text":"public elemental function DivideHyperDualHyperDual(v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual )","tags":"","loc":"proc/dividehyperdualhyperdual.html"},{"title":"DivideHyperDualReal – yaeos","text":"public elemental function DivideHyperDualReal(v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 real(kind=pr), intent(in) :: v2 Return Value type( hyperdual ) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: invV2","tags":"","loc":"proc/dividehyperdualreal.html"},{"title":"DivideRealHyperDual – yaeos","text":"public elemental function DivideRealHyperDual(v1, v2) result(v3) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) Variables Type Visibility Attributes Name Initial type( hyperdual ), public :: invV2","tags":"","loc":"proc/dividerealhyperdual.html"},{"title":"MinusHyperDualHyperDual – yaeos","text":"public elemental function MinusHyperDualHyperDual(v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual )","tags":"","loc":"proc/minushyperdualhyperdual.html"},{"title":"MultiplyHyperDualHyperDual – yaeos","text":"public elemental function MultiplyHyperDualHyperDual(v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual )","tags":"","loc":"proc/multiplyhyperdualhyperdual.html"},{"title":"MultiplyHyperDualInt – yaeos","text":"public elemental function MultiplyHyperDualInt(v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 integer, intent(in) :: v2 Return Value type( hyperdual )","tags":"","loc":"proc/multiplyhyperdualint.html"},{"title":"MultiplyHyperDualReal – yaeos","text":"public elemental function MultiplyHyperDualReal(v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 real(kind=pr), intent(in) :: v2 Return Value type( hyperdual )","tags":"","loc":"proc/multiplyhyperdualreal.html"},{"title":"MultiplyIntHyperDual – yaeos","text":"public elemental function MultiplyIntHyperDual(v1, v2) result(v3) Arguments Type Intent Optional Attributes Name integer, intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual )","tags":"","loc":"proc/multiplyinthyperdual.html"},{"title":"MultiplyRealHyperDual – yaeos","text":"public elemental function MultiplyRealHyperDual(v1, v2) result(v3) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual )","tags":"","loc":"proc/multiplyrealhyperdual.html"},{"title":"PlusHyperDualHyperDual – yaeos","text":"public elemental function PlusHyperDualHyperDual(v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual )","tags":"","loc":"proc/plushyperdualhyperdual.html"},{"title":"PowerHyperDualHyperDual – yaeos","text":"public elemental function PowerHyperDualHyperDual(v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) Variables Type Visibility Attributes Name Initial type( hyperdual ), public :: v4","tags":"","loc":"proc/powerhyperdualhyperdual.html"},{"title":"PowerHyperDualInt – yaeos","text":"public elemental function PowerHyperDualInt(v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 integer, intent(in) :: v2 Return Value type( hyperdual ) Variables Type Visibility Attributes Name Initial integer, public :: i integer, public :: vv2","tags":"","loc":"proc/powerhyperdualint.html"},{"title":"PowerHyperDualReal – yaeos","text":"public elemental function PowerHyperDualReal(v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 real(kind=pr), intent(in) :: v2 Return Value type( hyperdual ) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: deriv real(kind=pr), public, parameter :: tol = 1.0e-15_pr real(kind=pr), public :: xval","tags":"","loc":"proc/powerhyperdualreal.html"},{"title":"SubtractHyperDualHyperDual – yaeos","text":"public elemental function SubtractHyperDualHyperDual(v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual )","tags":"","loc":"proc/subtracthyperdualhyperdual.html"},{"title":"SubtractHyperDualReal – yaeos","text":"public elemental function SubtractHyperDualReal(v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 real(kind=pr), intent(in) :: v2 Return Value type( hyperdual )","tags":"","loc":"proc/subtracthyperdualreal.html"},{"title":"SubtractRealHyperDual – yaeos","text":"public elemental function SubtractRealHyperDual(v1, v2) result(v3) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual )","tags":"","loc":"proc/subtractrealhyperdual.html"},{"title":"SumHyperDual – yaeos","text":"public pure function SumHyperDual(v1, mask) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 (:) logical, intent(in), optional :: mask (:) Return Value type( hyperdual ) Variables Type Visibility Attributes Name Initial integer, public :: i","tags":"","loc":"proc/sumhyperdual.html"},{"title":"SumHyperDual2 – yaeos","text":"public pure function SumHyperDual2(v1, dim) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 (:,:) integer, intent(in) :: dim Return Value type( hyperdual ), allocatable, (:) Variables Type Visibility Attributes Name Initial integer, public :: i","tags":"","loc":"proc/sumhyperdual2.html"},{"title":"absHyperDual – yaeos","text":"public elemental function absHyperDual(v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual )","tags":"","loc":"proc/abshyperdual.html"},{"title":"acosHyperDual – yaeos","text":"public elemental function acosHyperDual(v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: deriv real(kind=pr), public :: deriv1","tags":"","loc":"proc/acoshyperdual.html"},{"title":"asinHyperDual – yaeos","text":"public elemental function asinHyperDual(v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: deriv real(kind=pr), public :: deriv1","tags":"","loc":"proc/asinhyperdual.html"},{"title":"atan2HyperDual – yaeos","text":"public elemental function atan2HyperDual(v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: a real(kind=pr), public :: b real(kind=pr), public :: c real(kind=pr), public :: d","tags":"","loc":"proc/atan2hyperdual.html"},{"title":"atanHyperDual – yaeos","text":"public elemental function atanHyperDual(v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: deriv real(kind=pr), public :: deriv1","tags":"","loc":"proc/atanhyperdual.html"},{"title":"cosHyperDual – yaeos","text":"public elemental function cosHyperDual(v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: dx real(kind=pr), public :: f","tags":"","loc":"proc/coshyperdual.html"},{"title":"coshHyperDual – yaeos","text":"public elemental function coshHyperDual(v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) Variables Type Visibility Attributes Name Initial type( hyperdual ), public :: t1 type( hyperdual ), public :: t2","tags":"","loc":"proc/coshhyperdual.html"},{"title":"eq_dd – yaeos","text":"public function eq_dd(lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical","tags":"","loc":"proc/eq_dd.html"},{"title":"eq_di – yaeos","text":"public function eq_di(lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs integer, intent(in) :: rhs Return Value logical","tags":"","loc":"proc/eq_di.html"},{"title":"eq_dr – yaeos","text":"public elemental function eq_dr(lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs real(kind=pr), intent(in) :: rhs Return Value logical","tags":"","loc":"proc/eq_dr.html"},{"title":"eq_id – yaeos","text":"public function eq_id(lhs, rhs) Arguments Type Intent Optional Attributes Name integer, intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical","tags":"","loc":"proc/eq_id.html"},{"title":"eq_rd – yaeos","text":"public elemental function eq_rd(lhs, rhs) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical","tags":"","loc":"proc/eq_rd.html"},{"title":"expHyperDual – yaeos","text":"public elemental function expHyperDual(v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: dx","tags":"","loc":"proc/exphyperdual.html"},{"title":"ge_dd – yaeos","text":"public function ge_dd(lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical","tags":"","loc":"proc/ge_dd.html"},{"title":"ge_di – yaeos","text":"public function ge_di(lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs integer, intent(in) :: rhs Return Value logical","tags":"","loc":"proc/ge_di.html"},{"title":"ge_dr – yaeos","text":"public function ge_dr(lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs real(kind=pr), intent(in) :: rhs Return Value logical","tags":"","loc":"proc/ge_dr.html"},{"title":"ge_id – yaeos","text":"public function ge_id(lhs, rhs) Arguments Type Intent Optional Attributes Name integer, intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical","tags":"","loc":"proc/ge_id.html"},{"title":"ge_rd – yaeos","text":"public function ge_rd(lhs, rhs) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical","tags":"","loc":"proc/ge_rd.html"},{"title":"gt_dd – yaeos","text":"public function gt_dd(lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical","tags":"","loc":"proc/gt_dd.html"},{"title":"gt_di – yaeos","text":"public function gt_di(lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs integer, intent(in) :: rhs Return Value logical","tags":"","loc":"proc/gt_di.html"},{"title":"gt_dr – yaeos","text":"public function gt_dr(lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs real(kind=pr), intent(in) :: rhs Return Value logical","tags":"","loc":"proc/gt_dr.html"},{"title":"gt_id – yaeos","text":"public function gt_id(lhs, rhs) Arguments Type Intent Optional Attributes Name integer, intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical","tags":"","loc":"proc/gt_id.html"},{"title":"gt_rd – yaeos","text":"public function gt_rd(lhs, rhs) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical","tags":"","loc":"proc/gt_rd.html"},{"title":"intHyperDual – yaeos","text":"public elemental function intHyperDual(v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value integer","tags":"","loc":"proc/inthyperdual.html"},{"title":"le_dd – yaeos","text":"public function le_dd(lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical","tags":"","loc":"proc/le_dd.html"},{"title":"le_di – yaeos","text":"public function le_di(lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs integer, intent(in) :: rhs Return Value logical","tags":"","loc":"proc/le_di.html"},{"title":"le_dr – yaeos","text":"public function le_dr(lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs real(kind=pr), intent(in) :: rhs Return Value logical","tags":"","loc":"proc/le_dr.html"},{"title":"le_id – yaeos","text":"public function le_id(lhs, rhs) Arguments Type Intent Optional Attributes Name integer, intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical","tags":"","loc":"proc/le_id.html"},{"title":"le_rd – yaeos","text":"public function le_rd(lhs, rhs) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical","tags":"","loc":"proc/le_rd.html"},{"title":"log10HyperDual – yaeos","text":"public elemental function log10HyperDual(v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual )","tags":"","loc":"proc/log10hyperdual.html"},{"title":"logHyperDual – yaeos","text":"public elemental function logHyperDual(v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: dx1 real(kind=pr), public :: dx2","tags":"","loc":"proc/loghyperdual.html"},{"title":"lt_dd – yaeos","text":"public function lt_dd(lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical","tags":"","loc":"proc/lt_dd.html"},{"title":"lt_di – yaeos","text":"public function lt_di(lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs integer, intent(in) :: rhs Return Value logical","tags":"","loc":"proc/lt_di.html"},{"title":"lt_dr – yaeos","text":"public function lt_dr(lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs real(kind=pr), intent(in) :: rhs Return Value logical","tags":"","loc":"proc/lt_dr.html"},{"title":"lt_id – yaeos","text":"public function lt_id(lhs, rhs) Arguments Type Intent Optional Attributes Name integer, intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical","tags":"","loc":"proc/lt_id.html"},{"title":"lt_rd – yaeos","text":"public function lt_rd(lhs, rhs) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical","tags":"","loc":"proc/lt_rd.html"},{"title":"max_dd – yaeos","text":"public elemental function max_dd(v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual )","tags":"","loc":"proc/max_dd.html"},{"title":"max_ddd – yaeos","text":"public elemental function max_ddd(v1, v2, v3) result(v4) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 type( hyperdual ), intent(in) :: v3 Return Value type( hyperdual )","tags":"","loc":"proc/max_ddd.html"},{"title":"max_dr – yaeos","text":"public elemental function max_dr(v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 real(kind=pr), intent(in) :: v2 Return Value type( hyperdual )","tags":"","loc":"proc/max_dr.html"},{"title":"max_rd – yaeos","text":"public elemental function max_rd(v1, v2) result(v3) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual )","tags":"","loc":"proc/max_rd.html"},{"title":"min_dd – yaeos","text":"public elemental function min_dd(v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual )","tags":"","loc":"proc/min_dd.html"},{"title":"min_dr – yaeos","text":"public elemental function min_dr(v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 real(kind=pr), intent(in) :: v2 Return Value type( hyperdual )","tags":"","loc":"proc/min_dr.html"},{"title":"min_rd – yaeos","text":"public elemental function min_rd(v1, v2) result(v3) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual )","tags":"","loc":"proc/min_rd.html"},{"title":"ne_dd – yaeos","text":"public function ne_dd(lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical","tags":"","loc":"proc/ne_dd.html"},{"title":"ne_di – yaeos","text":"public function ne_di(lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs integer, intent(in) :: rhs Return Value logical","tags":"","loc":"proc/ne_di.html"},{"title":"ne_dr – yaeos","text":"public function ne_dr(lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs real(kind=pr), intent(in) :: rhs Return Value logical","tags":"","loc":"proc/ne_dr.html"},{"title":"ne_id – yaeos","text":"public function ne_id(lhs, rhs) Arguments Type Intent Optional Attributes Name integer, intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical","tags":"","loc":"proc/ne_id.html"},{"title":"ne_rd – yaeos","text":"public function ne_rd(lhs, rhs) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical","tags":"","loc":"proc/ne_rd.html"},{"title":"nintHyperDual – yaeos","text":"public elemental function nintHyperDual(v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value integer","tags":"","loc":"proc/ninthyperdual.html"},{"title":"realHyperDual – yaeos","text":"public elemental function realHyperDual(v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value real(kind=pr)","tags":"","loc":"proc/realhyperdual.html"},{"title":"sign_dd – yaeos","text":"public elemental function sign_dd(v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: ssign","tags":"","loc":"proc/sign_dd.html"},{"title":"sign_dr – yaeos","text":"public elemental function sign_dr(v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 real(kind=pr), intent(in) :: v2 Return Value type( hyperdual ) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: ssign","tags":"","loc":"proc/sign_dr.html"},{"title":"sign_rd – yaeos","text":"public elemental function sign_rd(v1, v2) result(v3) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: ssign","tags":"","loc":"proc/sign_rd.html"},{"title":"sinHyperDual – yaeos","text":"public elemental function sinHyperDual(v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: dx real(kind=pr), public :: f","tags":"","loc":"proc/sinhyperdual.html"},{"title":"sinhHyperDual – yaeos","text":"public elemental function sinhHyperDual(v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) Variables Type Visibility Attributes Name Initial type( hyperdual ), public :: t1 type( hyperdual ), public :: t2","tags":"","loc":"proc/sinhhyperdual.html"},{"title":"sqrtHyperDual – yaeos","text":"public elemental function sqrtHyperDual(v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) Variables Type Visibility Attributes Name Initial real(kind=pr), public, parameter :: expo = 3.0_pr/2.0_pr real(kind=pr), public :: square","tags":"","loc":"proc/sqrthyperdual.html"},{"title":"tanHyperDual – yaeos","text":"public elemental function tanHyperDual(v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) Variables Type Visibility Attributes Name Initial real(kind=pr), public :: dx real(kind=pr), public :: f","tags":"","loc":"proc/tanhyperdual.html"},{"title":"tanhHyperDual – yaeos","text":"public elemental function tanhHyperDual(v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) Variables Type Visibility Attributes Name Initial type( hyperdual ), public :: t1 type( hyperdual ), public :: t2","tags":"","loc":"proc/tanhhyperdual.html"},{"title":"EqualHyperDualHyperDual – yaeos","text":"public elemental subroutine EqualHyperDualHyperDual(res, inp) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(out) :: res type( hyperdual ), intent(in) :: inp","tags":"","loc":"proc/equalhyperdualhyperdual.html"},{"title":"EqualHyperDualReal – yaeos","text":"public elemental subroutine EqualHyperDualReal(res, inp) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(out) :: res real(kind=pr), intent(in) :: inp","tags":"","loc":"proc/equalhyperdualreal.html"},{"title":"abs – yaeos","text":"public interface abs Module Procedures public elemental function absHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual )","tags":"","loc":"interface/abs.html"},{"title":"acos – yaeos","text":"public interface acos Module Procedures public elemental function acosHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual )","tags":"","loc":"interface/acos.html"},{"title":"asin – yaeos","text":"public interface asin Module Procedures public elemental function asinHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual )","tags":"","loc":"interface/asin.html"},{"title":"assignment (=) – yaeos","text":"public interface assignment (=) Module Procedures public elemental subroutine EqualHyperDualHyperDual (res, inp) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(out) :: res type( hyperdual ), intent(in) :: inp public elemental subroutine EqualHyperDualReal (res, inp) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(out) :: res real(kind=pr), intent(in) :: inp","tags":"","loc":"interface/assignment (=).html"},{"title":"atan – yaeos","text":"public interface atan Module Procedures public elemental function atanHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual )","tags":"","loc":"interface/atan.html"},{"title":"atan2 – yaeos","text":"public interface atan2 Module Procedures public elemental function atan2HyperDual (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual )","tags":"","loc":"interface/atan2.html"},{"title":"cos – yaeos","text":"public interface cos Module Procedures public elemental function cosHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual )","tags":"","loc":"interface/cos.html"},{"title":"cosh – yaeos","text":"public interface cosh Module Procedures public elemental function coshHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual )","tags":"","loc":"interface/cosh.html"},{"title":"exp – yaeos","text":"public interface exp Module Procedures public elemental function expHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual )","tags":"","loc":"interface/exp.html"},{"title":"int – yaeos","text":"public interface int Module Procedures public elemental function intHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value integer","tags":"","loc":"interface/int.html"},{"title":"log – yaeos","text":"public interface log Module Procedures public elemental function logHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual )","tags":"","loc":"interface/log.html"},{"title":"log10 – yaeos","text":"public interface log10 Module Procedures public elemental function log10HyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual )","tags":"","loc":"interface/log10.html"},{"title":"max – yaeos","text":"public interface max Module Procedures public elemental function max_dd (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public elemental function max_ddd (v1, v2, v3) result(v4) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 type( hyperdual ), intent(in) :: v3 Return Value type( hyperdual ) public elemental function max_dr (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 real(kind=pr), intent(in) :: v2 Return Value type( hyperdual ) public elemental function max_rd (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual )","tags":"","loc":"interface/max.html"},{"title":"min – yaeos","text":"public interface min Module Procedures public elemental function min_dd (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public elemental function min_dr (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 real(kind=pr), intent(in) :: v2 Return Value type( hyperdual ) public elemental function min_rd (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual )","tags":"","loc":"interface/min.html"},{"title":"nint – yaeos","text":"public interface nint Module Procedures public elemental function nintHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value integer","tags":"","loc":"interface/nint.html"},{"title":"operator (*) – yaeos","text":"public interface operator (*) Module Procedures public elemental function MultiplyHyperDualHyperDual (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public elemental function MultiplyHyperDualReal (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 real(kind=pr), intent(in) :: v2 Return Value type( hyperdual ) public elemental function MultiplyRealHyperDual (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public elemental function MultiplyHyperDualInt (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 integer, intent(in) :: v2 Return Value type( hyperdual ) public elemental function MultiplyIntHyperDual (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name integer, intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual )","tags":"","loc":"interface/operator (ASTERISK).html"},{"title":"operator (**) – yaeos","text":"public interface operator (**) Module Procedures public elemental function PowerHyperDualInt (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 integer, intent(in) :: v2 Return Value type( hyperdual ) public elemental function PowerHyperDualHyperDual (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public elemental function PowerHyperDualReal (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 real(kind=pr), intent(in) :: v2 Return Value type( hyperdual )","tags":"","loc":"interface/operator (ASTERISKASTERISK).html"},{"title":"operator (+) – yaeos","text":"public interface operator (+) Module Procedures public elemental function PlusHyperDualHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual )","tags":"","loc":"interface/operator (+).html"},{"title":"operator (+) – yaeos","text":"public interface operator (+) Module Procedures public elemental function AddHyperDualHyperDual (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public elemental function AddHyperDualReal (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 real(kind=pr), intent(in) :: v2 Return Value type( hyperdual ) public elemental function AddRealHyperDual (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual )","tags":"","loc":"interface/operator (+)~2.html"},{"title":"operator (-) – yaeos","text":"public interface operator (-) Module Procedures public elemental function MinusHyperDualHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual )","tags":"","loc":"interface/operator (-).html"},{"title":"operator (-) – yaeos","text":"public interface operator (-) Module Procedures public elemental function SubtractHyperDualHyperDual (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public elemental function SubtractHyperDualReal (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 real(kind=pr), intent(in) :: v2 Return Value type( hyperdual ) public elemental function SubtractRealHyperDual (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual )","tags":"","loc":"interface/operator (-)~2.html"},{"title":"operator (.eq.) – yaeos","text":"public interface operator (.eq.) Module Procedures public function eq_dd (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public elemental function eq_dr (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs real(kind=pr), intent(in) :: rhs Return Value logical public elemental function eq_rd (lhs, rhs) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public function eq_di (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs integer, intent(in) :: rhs Return Value logical public function eq_id (lhs, rhs) Arguments Type Intent Optional Attributes Name integer, intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical","tags":"","loc":"interface/operator (.eq.).html"},{"title":"operator (.ge.) – yaeos","text":"public interface operator (.ge.) Module Procedures public function ge_dd (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public function ge_dr (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs real(kind=pr), intent(in) :: rhs Return Value logical public function ge_rd (lhs, rhs) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public function ge_di (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs integer, intent(in) :: rhs Return Value logical public function ge_id (lhs, rhs) Arguments Type Intent Optional Attributes Name integer, intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical","tags":"","loc":"interface/operator (.ge.).html"},{"title":"operator (.gt.) – yaeos","text":"public interface operator (.gt.) Module Procedures public function gt_dd (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public function gt_dr (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs real(kind=pr), intent(in) :: rhs Return Value logical public function gt_rd (lhs, rhs) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public function gt_di (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs integer, intent(in) :: rhs Return Value logical public function gt_id (lhs, rhs) Arguments Type Intent Optional Attributes Name integer, intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical","tags":"","loc":"interface/operator (.gt.).html"},{"title":"operator (.le.) – yaeos","text":"public interface operator (.le.) Module Procedures public function le_dd (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public function le_dr (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs real(kind=pr), intent(in) :: rhs Return Value logical public function le_rd (lhs, rhs) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public function le_di (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs integer, intent(in) :: rhs Return Value logical public function le_id (lhs, rhs) Arguments Type Intent Optional Attributes Name integer, intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical","tags":"","loc":"interface/operator (.le.).html"},{"title":"operator (.lt.) – yaeos","text":"public interface operator (.lt.) Module Procedures public function lt_dd (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public function lt_dr (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs real(kind=pr), intent(in) :: rhs Return Value logical public function lt_rd (lhs, rhs) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public function lt_di (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs integer, intent(in) :: rhs Return Value logical public function lt_id (lhs, rhs) Arguments Type Intent Optional Attributes Name integer, intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical","tags":"","loc":"interface/operator (.lt.).html"},{"title":"operator (.ne.) – yaeos","text":"public interface operator (.ne.) Module Procedures public function ne_dd (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public function ne_dr (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs real(kind=pr), intent(in) :: rhs Return Value logical public function ne_rd (lhs, rhs) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public function ne_di (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs integer, intent(in) :: rhs Return Value logical public function ne_id (lhs, rhs) Arguments Type Intent Optional Attributes Name integer, intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical","tags":"","loc":"interface/operator (.ne.).html"},{"title":"operator (/) – yaeos","text":"public interface operator (/) Module Procedures public elemental function DivideHyperDualHyperDual (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public elemental function DivideHyperDualReal (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 real(kind=pr), intent(in) :: v2 Return Value type( hyperdual ) public elemental function DivideRealHyperDual (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual )","tags":"","loc":"interface/operator (SLASH).html"},{"title":"real – yaeos","text":"public interface real Module Procedures public elemental function realHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value real(kind=pr)","tags":"","loc":"interface/real.html"},{"title":"sign – yaeos","text":"public interface sign Module Procedures public elemental function sign_dd (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public elemental function sign_dr (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 real(kind=pr), intent(in) :: v2 Return Value type( hyperdual ) public elemental function sign_rd (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual )","tags":"","loc":"interface/sign.html"},{"title":"sin – yaeos","text":"public interface sin Module Procedures public elemental function sinHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual )","tags":"","loc":"interface/sin.html"},{"title":"sinh – yaeos","text":"public interface sinh Module Procedures public elemental function sinhHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual )","tags":"","loc":"interface/sinh.html"},{"title":"sqrt – yaeos","text":"public interface sqrt Module Procedures public elemental function sqrtHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual )","tags":"","loc":"interface/sqrt.html"},{"title":"sum – yaeos","text":"public interface sum Module Procedures public pure function SumHyperDual (v1, mask) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 (:) logical, intent(in), optional :: mask (:) Return Value type( hyperdual ) public pure function SumHyperDual2 (v1, dim) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 (:,:) integer, intent(in) :: dim Return Value type( hyperdual ), allocatable, (:)","tags":"","loc":"interface/sum.html"},{"title":"tan – yaeos","text":"public interface tan Module Procedures public elemental function tanHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual )","tags":"","loc":"interface/tan.html"},{"title":"tanh – yaeos","text":"public interface tanh Module Procedures public elemental function tanhHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual )","tags":"","loc":"interface/tanh.html"},{"title":"write_EquilibriumState – yaeos","text":"public subroutine write_EquilibriumState(eq, unit, iotype, v_list, iostat, iomsg) Type Bound EquilibriumState Arguments Type Intent Optional Attributes Name class( EquilibriumState ), intent(in) :: eq integer, intent(in) :: unit character(len=*), intent(in) :: iotype integer, intent(in) :: v_list (:) integer, intent(out) :: iostat character(len=*), intent(inout) :: iomsg Variables Type Visibility Attributes Name Initial character(len=*), public, parameter :: nl = new_line(\"G\")","tags":"","loc":"proc/write_equilibriumstate.html"},{"title":"get_v0 – yaeos","text":"private function get_v0(self, n, p, t) Type Bound ArModelTapenade Arguments Type Intent Optional Attributes Name class( ArModelTapenade ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: p real(kind=pr), intent(in) :: t Return Value real(kind=pr)","tags":"","loc":"proc/get_v0.html"},{"title":"residual_helmholtz – yaeos","text":"private subroutine residual_helmholtz(self, n, v, t, Ar, ArV, ArT, ArTV, ArV2, ArT2, Arn, ArVn, ArTn, Arn2) Residual Helmholtz model generic interface Type Bound ArModelTapenade Arguments Type Intent Optional Attributes Name class( ArModelTapenade ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: v real(kind=pr), intent(in) :: t real(kind=pr), intent(out), optional :: Ar real(kind=pr), intent(out), optional :: ArV real(kind=pr), intent(out), optional :: ArT real(kind=pr), intent(out), optional :: ArTV real(kind=pr), intent(out), optional :: ArV2 real(kind=pr), intent(out), optional :: ArT2 real(kind=pr), intent(out), optional, dimension(size(n)) :: Arn real(kind=pr), intent(out), optional, dimension(size(n)) :: ArVn real(kind=pr), intent(out), optional, dimension(size(n)) :: ArTn real(kind=pr), intent(out), optional :: Arn2 (size(n),size(n)) Variables Type Visibility Attributes Name Initial real(kind=pr), private :: arval real(kind=pr), private :: arvalb real(kind=pr), private :: arvald real(kind=pr), private :: arvald0 real(kind=pr), private :: arvaldb real(kind=pr), private :: arvaldd real(kind=pr), private :: df (size(n)+2) real(kind=pr), private :: df2 (size(n)+2,size(n)+2) integer, private :: i real(kind=pr), private :: nb (size(n)) integer, private :: nc real(kind=pr), private :: nd (size(n)) real(kind=pr), private :: ndb (size(n)) real(kind=pr), private :: tb real(kind=pr), private :: td real(kind=pr), private :: td0 real(kind=pr), private :: tdb real(kind=pr), private :: vb real(kind=pr), private :: vd real(kind=pr), private :: vd0 real(kind=pr), private :: vdb Functions function get_ArnX (var) Arguments Type Intent Optional Attributes Name character(len=*), intent(in) :: var Return Value real(kind=pr), (size(n)) function get_dArdX2 (var) Arguments Type Intent Optional Attributes Name character(len=*), intent(in) :: var Return Value real(kind=pr) Subroutines subroutine reset_vars () Arguments None","tags":"","loc":"proc/residual_helmholtz~2.html"},{"title":"flash – yaeos","text":"public function flash(model, z, t, v_spec, p_spec, k0, iters) Uses stdlib_optval Flash algorithm using sucessive substitutions. Available specifications: TP (with T and P_spec variables) TV (with T and V_spec variables) This algorithm assumes that the specified T and P/V correspond to\nvapor-liquid separation predicted by the provided model (0 null() Procedure to calculate matrix. Can be overloaded\nby any method that respets the interface get_aij . real(kind=pr), public, allocatable :: k (:,:) Attractive Binary Interatction parameter matrix real(kind=pr), public, allocatable :: l (:,:) Repulsive Binary Interatction parameter matrix Type-Bound Procedures procedure, public :: Bmix ../../../ Repulsive parameter mixing rule procedure, public :: D1mix => D1mix_constant procedure, public :: Dmix ../../../ Attractive parameter mixing rule type, public, extends( QMR ) :: QMR_RKPR Components Type Visibility Attributes Name Initial procedure( get_aij ), public, pointer :: aij => null() Procedure to calculate matrix. Can be overloaded\nby any method that respets the interface get_aij . real(kind=pr), public, allocatable :: k (:,:) Attractive Binary Interatction parameter matrix real(kind=pr), public, allocatable :: l (:,:) Repulsive Binary Interatction parameter matrix Type-Bound Procedures procedure, public :: Bmix ../../../ Repulsive parameter mixing rule procedure, public :: D1Mix => RKPR_D1mix procedure, public :: Dmix ../../../ Attractive parameter mixing rule Subroutines public subroutine Bmix (self, n, bi, B, dBi, dBij) Mixture repulsive parameter. Read more… Arguments Type Intent Optional Attributes Name class( QMR ), intent(in) :: self Mixing rule object. real(kind=pr), intent(in) :: n (:) Moles vector. real(kind=pr), intent(in) :: bi (:) Pure components repulsive parameters. real(kind=pr), intent(out) :: B Mixture repulsive parameter. real(kind=pr), intent(out) :: dBi (:) real(kind=pr), intent(out) :: dBij (:,:) public subroutine D1mix_constant (self, n, d1i, D1, dD1i, dD1ij) Constant parameter. Read more… Arguments Type Intent Optional Attributes Name class( QMR ), intent(in) :: self Mixing rule real(kind=pr), intent(in) :: n (:) Moles vector real(kind=pr), intent(in) :: d1i (:) parameter real(kind=pr), intent(out) :: D1 Mixture’s real(kind=pr), intent(out) :: dD1i (:) real(kind=pr), intent(out) :: dD1ij (:,:) public subroutine Dmix (self, n, T, ai, daidt, daidt2, D, dDdT, dDdT2, dDi, dDidT, dDij) Attractive parameter mixing rule with quadratic mix. Read more… Arguments Type Intent Optional Attributes Name class( QMR ), intent(in) :: self Mixing rule object. real(kind=pr), intent(in) :: n (:) Moles vector [mol] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(in) :: ai (:) Pure components attractive parameters real(kind=pr), intent(in) :: daidt (:) real(kind=pr), intent(in) :: daidt2 (:) real(kind=pr), intent(out) :: D Mixture attractive parameter real(kind=pr), intent(out) :: dDdT real(kind=pr), intent(out) :: dDdT2 real(kind=pr), intent(out) :: dDi (:) real(kind=pr), intent(out) :: dDidT (:) real(kind=pr), intent(out) :: dDij (:,:) public subroutine RKPR_D1mix (self, n, d1i, D1, dD1i, dD1ij) RKPR parameter mixing rule. Read more… Arguments Type Intent Optional Attributes Name class( QMR_RKPR ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: d1i (:) real(kind=pr), intent(out) :: D1 real(kind=pr), intent(out) :: dD1i (:) real(kind=pr), intent(out) :: dD1ij (:,:) public subroutine kij_constant (self, T, a, dadt, dadt2, aij, daijdt, daijdt2) Combining rule that uses constant values. Read more… Arguments Type Intent Optional Attributes Name class( QMR ), intent(in) :: self real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(in) :: a (:) Pure components attractive parameters (\\a_i) real(kind=pr), intent(in) :: dadt (:) real(kind=pr), intent(in) :: dadt2 (:) real(kind=pr), intent(out) :: aij (:,:) Matrix real(kind=pr), intent(out) :: daijdt (:,:) real(kind=pr), intent(out) :: daijdt2 (:,:)","tags":"","loc":"module/yaeos__models_ar_cubic_quadratic_mixing.html"},{"title":"yaeos__models_base – yaeos","text":"Basic element of a thermodynamic model. Uses yaeos__substance Derived Types type, public, abstract :: BaseModel Base model type. Read more… Components Type Visibility Attributes Name Initial type( Substances ), public :: components Substances contained in the module","tags":"","loc":"module/yaeos__models_base.html"},{"title":"yaeos__substance – yaeos","text":"yaeos Subtance module. Module containing pure components properties and parameters. Uses yaeos__constants Derived Types type, public :: Substances Set of pure components Components Type Visibility Attributes Name Initial character(len=50), public, allocatable :: names (:) Composition names. real(kind=pr), public, allocatable :: pc (:) Critical Pressure [bar] real(kind=pr), public, allocatable :: tc (:) Critical Temperature [K] real(kind=pr), public, allocatable :: w (:) Acentric factor","tags":"","loc":"module/yaeos__substance.html"},{"title":"yaeos__models_ar – yaeos","text":"Module that defines the basics of a residual Helmholtz energy. All the residual properties that are calculated in this library are\nbased on residual Helmholtz Equations of State. Following the book by\nMichelsen and Mollerup. In this library up to second derivatives of residual Helmholtz energy\nare used. Because they’re the fundamentals for phase equilibria\ncalculation. Note Later on, third derivative with respect to volume will be included\nsince it’s importance on calculation of critical points. Properties Available properties: pressure(n, V, T) fugacity(n, V, T) fugacity(n, P, T, root=[vapor, liquid, stable]) volume Calculate thermodynamic properties using Helmholtz energy as a basis.\nAll the routines in this module work with the logic: call foo ( x , V , T , [ dfoodv , dfoodT , ...]) Where the user can call the routine of the desired property. And include\nas optional values the desired derivatives of said properties. Uses yaeos__models_base yaeos__constants Interfaces public interface size public pure function size_ar_model (eos) Get the size of the model. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Return Value integer Abstract Interfaces abstract interface public subroutine abs_residual_helmholtz(self, n, v, t, Ar, ArV, ArT, ArTV, ArV2, ArT2, Arn, ArVn, ArTn, Arn2) Residual Helmholtz model generic interface. This interface represents how an Ar model should be implemented.\nBy our standard, a Resiudal Helmholtz model takes as input: The mixture’s number of moles vector. Volume, by default in liters. Temperature, by default in Kelvin. All the output arguments are optional. While this keeps a long\nsignature for the implementation, this is done this way to take\nadvantage of any inner optimizations to calculate derivatives\ninside the procedure. Once the model is implemented, the signature can be short like model%residual_helmholtz(n, v, t, ArT2=dArdT2) Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: self ArModel real(kind=pr), intent(in) :: n (:) Moles vector real(kind=pr), intent(in) :: v Volume [L] real(kind=pr), intent(in) :: t Temperature [K] real(kind=pr), intent(out), optional :: Ar Residual Helmoltz energy real(kind=pr), intent(out), optional :: ArV real(kind=pr), intent(out), optional :: ArT real(kind=pr), intent(out), optional :: ArTV real(kind=pr), intent(out), optional :: ArV2 real(kind=pr), intent(out), optional :: ArT2 real(kind=pr), intent(out), optional :: Arn (size(n)) real(kind=pr), intent(out), optional :: ArVn (size(n)) real(kind=pr), intent(out), optional :: ArTn (size(n)) real(kind=pr), intent(out), optional :: Arn2 (size(n),size(n)) abstract interface public function abs_volume_initializer(self, n, p, t) Function that provides an initializer value for the liquid-root\nof newton solver of volume. In the case the model will use the volume_michelsen routine this value should provide the co-volume\nof the model. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: self Ar Model real(kind=pr), intent(in) :: n (:) Moles vector real(kind=pr), intent(in) :: p Pressure [bar] real(kind=pr), intent(in) :: t Temperature [K] Return Value real(kind=pr) Initial volume [L] Derived Types type, public, abstract, extends( BaseModel ) :: ArModel Abstract residual Helmholtz model. Read more… Components Type Visibility Attributes Name Initial type( Substances ), public :: components Substances contained in the module character(len=:), public, allocatable :: name Name of the model Type-Bound Procedures procedure, public :: Cp_residual_vt procedure, public :: Cv_residual_vt procedure, public :: enthalpy_residual_vt procedure, public :: entropy_residual_vt procedure( abs_volume_initializer ), public, deferred :: get_v0 procedure, public :: gibbs_residual_vt => gibbs_residual_VT procedure, public :: lnphi_pt => fugacity_pt procedure, public :: lnphi_vt => fugacity_vt procedure, public :: pressure procedure( abs_residual_helmholtz ), public, deferred :: residual_helmholtz procedure, public :: volume Functions public pure function size_ar_model (eos) Get the size of the model. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Return Value integer Subroutines public subroutine Cp_residual_vt (eos, n, V, T, Cp) Calculate residual heat capacity pressure constant given v and t. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: V Volume [L] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out) :: Cp heat capacity p constant [bar L / K / mol] public subroutine Cv_residual_vt (eos, n, V, T, Cv) Calculate residual heat capacity volume constant given v and t. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: V Volume [L] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out) :: Cv heat capacity v constant [bar L / K / mol] public subroutine enthalpy_residual_vt (eos, n, v, t, Hr, HrT, HrV, Hrn) Calculate residual enthalpy given volume and temperature. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: v Volume [L] real(kind=pr), intent(in) :: t Temperature [K] real(kind=pr), intent(out) :: Hr Residual enthalpy [bar L / mol] real(kind=pr), intent(out), optional :: HrT real(kind=pr), intent(out), optional :: HrV real(kind=pr), intent(out), optional :: Hrn (size(n)) public subroutine entropy_residual_vt (eos, n, V, T, Sr, SrT, SrV, Srn) Calculate residual entropy given volume and temperature. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: V Volume [L] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out) :: Sr Entropy [bar L / K / mol] real(kind=pr), intent(out), optional :: SrT real(kind=pr), intent(out), optional :: SrV real(kind=pr), intent(out), optional :: Srn (size(n)) public subroutine fugacity_pt (eos, n, P, T, V, root_type, lnPhi, dlnPhidP, dlnPhidT, dlnPhidn, dPdV, dPdT, dPdn) Calculate logarithm of fugacity, given pressure and temperature. Read more… Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Mixture mole numbers real(kind=pr), intent(in) :: P Pressure [bar] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out), optional :: V Volume [L] character(len=*), intent(in) :: root_type Type of root desired [“liquid”, “vapor”, “stable”] real(kind=pr), intent(out), optional :: lnPhi (size(n)) vector real(kind=pr), intent(out), optional :: dlnPhidP (size(n)) ln(phi) Presssure derivative real(kind=pr), intent(out), optional :: dlnPhidT (size(n)) ln(phi) Temp derivative real(kind=pr), intent(out), optional :: dlnPhidn (size(n),size(n)) ln(phi) compositional derivative real(kind=pr), intent(out), optional :: dPdV real(kind=pr), intent(out), optional :: dPdT real(kind=pr), intent(out), optional :: dPdn (size(n)) public subroutine fugacity_vt (eos, n, V, T, P, lnPhi, dlnPhidP, dlnPhidT, dlnPhidn, dPdV, dPdT, dPdn) Calculate fugacity coefficent given volume and temperature. Read more… Arguments Type Intent Optional Attributes Name class( ArModel ) :: eos Model real(kind=pr), intent(in) :: n (:) Mixture mole numbers real(kind=pr), intent(in) :: V Volume [L] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out), optional :: P Pressure [bar] real(kind=pr), intent(out), optional :: lnPhi (size(n)) vector real(kind=pr), intent(out), optional :: dlnPhidP (size(n)) Presssure derivative real(kind=pr), intent(out), optional :: dlnPhidT (size(n)) Temp derivative real(kind=pr), intent(out), optional :: dlnPhidn (size(n),size(n)) compositional derivative real(kind=pr), intent(out), optional :: dPdV real(kind=pr), intent(out), optional :: dPdT real(kind=pr), intent(out), optional :: dPdn (:) public subroutine gibbs_residual_VT (eos, n, V, T, Gr, GrT, GrV, Grn) Calculate residual Gibbs energy given volume and temperature. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: V Volume [L] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out) :: Gr Gibbs energy [bar L / mol] real(kind=pr), intent(out), optional :: GrT real(kind=pr), intent(out), optional :: GrV real(kind=pr), intent(out), optional :: Grn (size(n)) public subroutine pressure (eos, n, v, t, p, dPdV, dPdT, dPdn) Pressure calculation. Read more… Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: v Volume [L] real(kind=pr), intent(in) :: t Temperature [K] real(kind=pr), intent(out) :: p Pressure [bar] real(kind=pr), intent(out), optional :: dPdV real(kind=pr), intent(out), optional :: dPdT real(kind=pr), intent(out), optional :: dPdn (:) public subroutine volume (eos, n, P, T, V, root_type) Solves volume roots using newton method. Given pressure and temperature. Read more… Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: P Pressure [bar] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out) :: V Volume [L] character(len=*), intent(in) :: root_type Desired root-type to solve. Options are: [\"liquid\", \"vapor\", \"stable\"]","tags":"","loc":"module/yaeos__models_ar.html"},{"title":"yaeos__math_linalg – yaeos","text":"Wrapper module around LAPACK’s dgesv Uses yaeos__constants Functions public function solve_system (a, b) result(x) Solve a linear sytem AX = b Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: a (size(b),size(b)) real(kind=pr), intent(in) :: b (:) Return Value real(kind=pr), (size(b)) Subroutines public subroutine cubic_roots (parameters, real_roots, complex_roots, flag) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: parameters (4) real(kind=pr), intent(out) :: real_roots (3) complex(kind=pr), intent(out) :: complex_roots (3) integer, intent(out) :: flag flag that identifies which case the solution is\n- 0 : 3 real rotos, one of them repeated (use real_roots(1) and real_roots(2))\n- 1 : 1 real root, 2 complex roots.\n Use real_roots(1) and complex_roots(1) and complex_roots(2)\n- -1 : 3 real roots, all different public subroutine cubic_roots_rosendo (parameters, real_roots, complex_roots, flag) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: parameters (4) real(kind=pr), intent(out) :: real_roots (3) complex(kind=pr), intent(out) :: complex_roots (3) integer, intent(out) :: flag","tags":"","loc":"module/yaeos__math_linalg.html"},{"title":"yaeos__models_ar_cubic_mixing_base – yaeos","text":"Mixing rules core math Procedures of the core calculations of CubicEoS mixing rules. Description This module holds all the basic math to use mixing rules in other codes.\nKeeping it simple and accesible. Examples bi = [ 0.2 , 0.3 ] lij = reshape ([ 0.0 , 0.2 , 0.2 , 0 ], [ 2 , 2 ]) ! Calculate B parameter with Quadratric Mixing Rules. call bmix_qmr ( n , bi , lij , b , dbi , dbij ) References Uses yaeos__constants Subroutines public pure subroutine bmix_linear (n, bi, b, dbi, dbij) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: bi (:) real(kind=pr), intent(out) :: b real(kind=pr), intent(out) :: dbi (:) real(kind=pr), intent(out) :: dbij (:,:) public pure subroutine bmix_qmr (n, bi, lij, b, dbi, dbij) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: bi (:) real(kind=pr), intent(in) :: lij (:,:) real(kind=pr), intent(out) :: b real(kind=pr), intent(out) :: dbi (:) real(kind=pr), intent(out) :: dbij (:,:) public pure subroutine d1mix_rkpr (n, d1i, D1, dD1i, dD1ij) RKPR parameter mixing rule. Read more… Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: d1i (:) real(kind=pr), intent(out) :: D1 real(kind=pr), intent(out) :: dD1i (:) real(kind=pr), intent(out) :: dD1ij (:,:)","tags":"","loc":"module/yaeos__models_ar_cubic_mixing_base.html"},{"title":"yaeos__equilibria_auxiliar – yaeos","text":"Auxiliar functions used for phase-equilibria calculation. Uses yaeos__models_base yaeos__constants Functions public function P_wilson (model, z, T) result(P) Arguments Type Intent Optional Attributes Name class( BaseModel ), intent(in) :: model real(kind=pr), intent(in) :: z (:) real(kind=pr), intent(in) :: T Return Value real(kind=pr) public function k_wilson (model, T, P) result(K) K-factors regressión done by Wilson, used for initialization. Arguments Type Intent Optional Attributes Name class( BaseModel ), intent(in) :: model real(kind=pr), intent(in) :: T real(kind=pr), intent(in) :: P Return Value real(kind=pr), (size(model%components%pc))","tags":"","loc":"module/yaeos__equilibria_auxiliar.html"},{"title":"yaeos__optimizers – yaeos","text":"Uses yaeos__constants Abstract Interfaces abstract interface public subroutine abs_optimize(self, foo, X, F, data) Arguments Type Intent Optional Attributes Name class( Optimizer ), intent(inout) :: self procedure( obj_func ) :: foo real(kind=pr), intent(inout) :: X (:) real(kind=pr), intent(out) :: F class(*), intent(inout), optional, target :: data abstract interface public subroutine obj_func(X, F, dF, data) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: X (:) real(kind=pr), intent(out) :: F real(kind=pr), intent(out), optional :: dF (:) class(*), intent(inout), optional :: data Derived Types type, public, abstract :: Optimizer Components Type Visibility Attributes Name Initial real(kind=pr), public, allocatable :: parameter_step (:) real(kind=pr), public :: solver_tolerance = 1e-9_pr logical, public :: verbose Type-Bound Procedures procedure( abs_optimize ), public, deferred :: optimize","tags":"","loc":"module/yaeos__optimizers.html"},{"title":"yaeos__optimizers_powell_wrap – yaeos","text":"Uses yaeos__constants yaeos__optimizers Variables Type Visibility Attributes Name Initial class(*), private, pointer :: priv_data procedure( obj_func ), private, pointer :: priv_foo Derived Types type, public, extends( Optimizer ) :: PowellWrapper Wrapper derived type to optimize with the Powell method Components Type Visibility Attributes Name Initial real(kind=pr), public, allocatable :: parameter_step (:) real(kind=pr), public :: solver_tolerance = 1e-9_pr logical, public :: verbose Type-Bound Procedures procedure, public :: optimize => powell_optimize Subroutines private subroutine foo_wrap (n, x, f) Arguments Type Intent Optional Attributes Name integer :: n real(kind=pr) :: x (*) real(kind=pr) :: f private subroutine powell_optimize (self, foo, X, F, data) Arguments Type Intent Optional Attributes Name class( PowellWrapper ), intent(inout) :: self procedure( obj_func ) :: foo real(kind=pr), intent(inout) :: X (:) real(kind=pr), intent(out) :: F class(*), intent(inout), optional, target :: data","tags":"","loc":"module/yaeos__optimizers_powell_wrap.html"},{"title":"yaeos__models_ar_cubic_alphas – yaeos","text":"functions defined in the library. Uses yaeos__models_ar_genericcubic yaeos__constants yaeos__substance Derived Types type, public, extends( AlphaFunction ) :: AlphaRKPR RKPR function Components Type Visibility Attributes Name Initial real(kind=pr), public, allocatable :: k (:) parameter. Type-Bound Procedures procedure, public :: alpha => alpha_rkpr type, public, extends( AlphaFunction ) :: AlphaSoave Soave function. Components Type Visibility Attributes Name Initial real(kind=pr), public, allocatable :: k (:) parameter. Type-Bound Procedures procedure, public :: alpha ../../../ Alpha function Subroutines public subroutine alpha (self, Tr, a, dadt, dadt2) Soave function and it’s derivatives. Arguments Type Intent Optional Attributes Name class( AlphaSoave ), intent(in) :: self real(kind=pr), intent(in) :: Tr (:) Reduced temperature real(kind=pr), intent(out) :: a (:) real(kind=pr), intent(out) :: dadt (:) real(kind=pr), intent(out) :: dadt2 (:) public subroutine alpha_rkpr (self, Tr, a, dadt, dadt2) Arguments Type Intent Optional Attributes Name class( AlphaRKPR ), intent(in) :: self real(kind=pr), intent(in) :: Tr (:) Reduced temperature real(kind=pr), intent(out) :: a (:) real(kind=pr), intent(out) :: dadt (:) real(kind=pr), intent(out) :: dadt2 (:)","tags":"","loc":"module/yaeos__models_ar_cubic_alphas.html"},{"title":"yaeos__tapenade_ge_api – yaeos","text":"Module that wraps tapenade generated routines to calculate !\nGe and derivatives. Uses yaeos__models_ge yaeos__constants Abstract Interfaces abstract interface private subroutine tapenade_ge(model, n, t, ge) Arguments Type Intent Optional Attributes Name class( GeModelTapenade ) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: t real(kind=pr), intent(out) :: ge abstract interface private subroutine tapenade_ge_b(model, n, nb, t, tb, ge, geb) Arguments Type Intent Optional Attributes Name class( GeModelTapenade ) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr) :: nb (:) real(kind=pr), intent(in) :: t real(kind=pr) :: tb real(kind=pr) :: ge real(kind=pr) :: geb abstract interface private subroutine tapenade_ge_d(model, n, nd, t, td, ge, ged) Arguments Type Intent Optional Attributes Name class( GeModelTapenade ) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: nd (:) real(kind=pr), intent(in) :: t real(kind=pr), intent(in) :: td real(kind=pr), intent(out) :: ge real(kind=pr), intent(out) :: ged abstract interface private subroutine tapenade_ge_d_b(model, n, nb, nd, ndb, t, tb, td, tdb, ge, geb, ged, gedb) Arguments Type Intent Optional Attributes Name class( GeModelTapenade ) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr) :: nb (:) real(kind=pr), intent(in) :: nd (:) real(kind=pr) :: ndb (:) real(kind=pr), intent(in) :: t real(kind=pr) :: tb real(kind=pr), intent(in) :: td real(kind=pr) :: tdb real(kind=pr) :: ge real(kind=pr) :: geb real(kind=pr) :: ged real(kind=pr) :: gedb abstract interface private subroutine tapenade_ge_d_d(model, n, nd, t, td0, td, ge, ged0, ged, gedd) Arguments Type Intent Optional Attributes Name class( GeModelTapenade ) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: nd (:) real(kind=pr), intent(in) :: t real(kind=pr), intent(in) :: td0 real(kind=pr), intent(in) :: td real(kind=pr), intent(out) :: ge real(kind=pr), intent(out) :: ged0 real(kind=pr), intent(out) :: ged real(kind=pr), intent(out) :: gedd Derived Types type, public, abstract, extends( GeModel ) :: GeModelTapenade Components Type Visibility Attributes Name Initial type( Substances ), public :: components Substances contained in the module Type-Bound Procedures procedure, public :: excess_gibbs procedure( tapenade_ge ), public, deferred :: ge procedure( tapenade_ge_b ), public, deferred :: ge_b procedure( tapenade_ge_d ), public, deferred :: ge_d procedure( tapenade_ge_d_b ), public, deferred :: ge_d_b procedure( tapenade_ge_d_d ), public, deferred :: ge_d_d procedure, public :: ln_activity_coefficient Subroutines private subroutine excess_gibbs (self, n, t, Ge, GeT, GeT2, Gen, GeTn, Gen2) Excess Gibbs model generic interface Arguments Type Intent Optional Attributes Name class( GeModelTapenade ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: t real(kind=pr), intent(out), optional :: Ge real(kind=pr), intent(out), optional :: GeT real(kind=pr), intent(out), optional :: GeT2 real(kind=pr), intent(out), optional, dimension(size(n)) :: Gen real(kind=pr), intent(out), optional, dimension(size(n)) :: GeTn real(kind=pr), intent(out), optional :: Gen2 (size(n),size(n))","tags":"","loc":"module/yaeos__tapenade_ge_api.html"},{"title":"yaeos__fitting_fit_kij_lij – yaeos","text":"Binary interaction parameters fitting problem. Uses yaeos__fitting Variables Type Visibility Attributes Name Initial integer, public, parameter :: nc = 2 Derived Types type, public, extends( FittingProblem ) :: FitKijLij Fit the binary interaction parameters of a mixtures. Read more… Components Type Visibility Attributes Name Initial type( EquilibriumState ), public, allocatable :: experimental_points (:) Experimental points to fit logical, public :: fit_kij = .false. Fit the parameter logical, public :: fit_lij = .false. Fit the parameter class( ArModel ), public, allocatable :: model Residual Helmholtz Model to fit logical, public :: verbose = .false. If true log the fitting process Type-Bound Procedures procedure, public :: get_model_from_X => model_from_X Subroutines public subroutine model_from_X (problem, X) Arguments Type Intent Optional Attributes Name class( FitKijLij ), intent(inout) :: problem real(kind=pr), intent(in) :: X (:)","tags":"","loc":"module/yaeos__fitting_fit_kij_lij.html"},{"title":"yaeos__equilibria_boundaries_phase_envelopes_pt – yaeos","text":"Phase boundaries line on the plane calculation procedures. Uses yaeos__equilibria_equilibrium_state yaeos__models yaeos__constants yaeos__math_continuation Variables Type Visibility Attributes Name Initial real(kind=pr), private :: Vy real(kind=pr), private :: Vz Derived Types type, public :: CriticalPoint Critical point Components Type Visibility Attributes Name Initial real(kind=pr), public :: P Pressure [bar] real(kind=pr), public :: T Temperature [K] type, public :: PTEnvel2 Two-phase isopleth.\nPhase boundary line of a fluid at constant composition. Components Type Visibility Attributes Name Initial type( CriticalPoint ), public, allocatable :: cps (:) Critical points found along the line. type( EquilibriumState ), public, allocatable :: points (:) Each point through the line. Type-Bound Procedures procedure, public, pass :: write => write_PTEnvel2 generic, public :: write (FORMATTED) => write Functions public function pt_envelope_2ph (model, z, first_point, points, iterations, delta_0, specified_variable_0, solver, stop_conditions) result(envelopes) PT two-phase envelope calculation procedure. Read more… Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: model Thermodyanmic model real(kind=pr), intent(in) :: z (:) Vector of molar fractions type( EquilibriumState ) :: first_point integer, intent(in), optional :: points Maxmimum number of points, defaults to 500 integer, intent(in), optional :: iterations Point solver maximum iterations, defaults to 100 real(kind=pr), intent(in), optional :: delta_0 Initial extrapolation integer, intent(in), optional :: specified_variable_0 Position of specified variable, since the vector of variables is the values for specification\nwill be for the equilibria constants, for and for . procedure( continuation_solver ), optional :: solver Specify solver for each point, defaults to a full newton procedure procedure( continuation_stopper ), optional :: stop_conditions Function that returns true if the continuation method should stop Return Value type( PTEnvel2 ) Subroutines public subroutine write_PTEnvel2 (pt2, unit, iotype, v_list, iostat, iomsg) Arguments Type Intent Optional Attributes Name class( PTEnvel2 ), intent(in) :: pt2 integer, intent(in) :: unit character(len=*), intent(in) :: iotype integer, intent(in) :: v_list (:) integer, intent(out) :: iostat character(len=*), intent(inout) :: iomsg","tags":"","loc":"module/yaeos__equilibria_boundaries_phase_envelopes_pt.html"},{"title":"yaeos__adiff_hyperdual_ar_api – yaeos","text":"Module that contains the automatic differentiation logic for an Ar model. All that is needed to define an Ar model that uses automatic\ndifferentiation with hyperdual numbers is to define a new derived type\nthat overloads the method to the Ar function that you want to use.\nA minimal example follows: module newmodel use yaeos__adiff_hyperdual_ar_api , only : ArModelAdiff type , extends ( ArModelAdiff ) :: YourNewModel type ( Substances ) :: composition real ( 8 ) :: parameters (:) contains procedure :: Ar => arfun procedure :: get_v0 => v0 end type contains subroutine arfun ( self , n , v , t , Ar ) class ( YourNewModel ), intent ( in ) :: self type ( hyperdual ), intent ( in ) :: n (:) ! Number of moles type ( hyperdual ), intent ( in ) :: v ! Volume [L] type ( hyperdual ), intent ( in ) :: t ! Temperature [K] type ( hyperdual ), intent ( out ) :: ar_value ! Residual Helmholtz Energy ! A very complicated residual helmholtz function of a mixture Ar = sum ( n ) * v * t end subroutine function v0 ( self , n , p , t ) class ( YourNewModel ), intent ( in ) :: self real ( pr ), intent ( in ) :: n (:) ! Number of moles real ( pr ), intent ( in ) :: p ! Pressure [bar] real ( pr ), intent ( in ) :: t ! Temperature [K] real ( pr ) :: v0 v0 = self % parameters ( 3 ) end function A complete implementation of the PR76 Equation of State can me found in example/adiff/adiff_pr76.f90 Uses yaeos__models_ar yaeos__constants hyperdual_mod Abstract Interfaces abstract interface public function hyperdual_Ar(self, n, v, t) Arguments Type Intent Optional Attributes Name class( ArModelAdiff ) :: self type( hyperdual ), intent(in) :: n (:) type( hyperdual ), intent(in) :: v type( hyperdual ), intent(in) :: t Return Value type( hyperdual ) Derived Types type, public, abstract, extends( ArModel ) :: ArModelAdiff Components Type Visibility Attributes Name Initial type( Substances ), public :: components Substances contained in the module character(len=:), public, allocatable :: name Name of the model Type-Bound Procedures procedure( hyperdual_Ar ), public, deferred :: Ar procedure, public :: Cp_residual_vt procedure, public :: Cv_residual_vt procedure, public :: enthalpy_residual_vt procedure, public :: entropy_residual_vt procedure( abs_volume_initializer ), public, deferred :: get_v0 procedure, public :: gibbs_residual_vt => gibbs_residual_VT procedure, public :: lnphi_pt => fugacity_pt procedure, public :: lnphi_vt => fugacity_vt procedure, public :: pressure procedure, public :: residual_helmholtz procedure, public :: volume Subroutines public subroutine residual_helmholtz (self, n, v, t, Ar, ArV, ArT, ArTV, ArV2, ArT2, Arn, ArVn, ArTn, Arn2) Arguments Type Intent Optional Attributes Name class( ArModelAdiff ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: v real(kind=pr), intent(in) :: t real(kind=pr), intent(out), optional :: Ar real(kind=pr), intent(out), optional :: ArV real(kind=pr), intent(out), optional :: ArT real(kind=pr), intent(out), optional :: ArTV real(kind=pr), intent(out), optional :: ArV2 real(kind=pr), intent(out), optional :: ArT2 real(kind=pr), intent(out), optional, dimension(size(n)) :: Arn real(kind=pr), intent(out), optional, dimension(size(n)) :: ArVn real(kind=pr), intent(out), optional, dimension(size(n)) :: ArTn real(kind=pr), intent(out), optional :: Arn2 (size(n),size(n))","tags":"","loc":"module/yaeos__adiff_hyperdual_ar_api.html"},{"title":"yaeos__models_ge_group_contribution_model_parameters – yaeos","text":"group contribution model parameters group contribution model parameters module. Description This module contrains the GeGCModelParameters type that allows to store\nthe subgroups ids, maingroups ids, subgroups Rs, subgroups Qs,\nsubgroups maingroups, and maingroups interaction parameters for UNIFAC\nlike models (UNIFAC, LL-UNIFAC, Dortmund UNIFAC, PSRK, etc) Uses yaeos__constants Derived Types type, public :: GeGCModelParameters group contribution model parameters container Read more… Components Type Visibility Attributes Name Initial real(kind=pr), public, allocatable :: maingroups_aij (:,:) Maingroup interaction parameters matrix real(kind=pr), public, allocatable :: maingroups_bij (:,:) Maingroup interaction parameters matrix real(kind=pr), public, allocatable :: maingroups_cij (:,:) Maingroup interaction parameters matrix integer, public, allocatable :: maingroups_ids (:) ID of each model’s maingroup real(kind=pr), public, allocatable :: subgroups_Qs (:) value of each subgroup real(kind=pr), public, allocatable :: subgroups_Rs (:) value of each subgroup integer, public, allocatable :: subgroups_ids (:) ID of each model’s subgroup integer, public, allocatable :: subgroups_maingroups (:) Maingroup of each subgroup Type-Bound Procedures procedure, public :: get_maingroup_index procedure, public :: get_maingroups_aij procedure, public :: get_maingroups_bij procedure, public :: get_maingroups_cij procedure, public :: get_subgroup_Q procedure, public :: get_subgroup_R procedure, public :: get_subgroup_index procedure, public :: get_subgroup_maingroup procedure, public :: get_subgroups_aij procedure, public :: get_subgroups_bij procedure, public :: get_subgroups_cij Functions public function get_maingroup_index (self, maingroup_id) result(maingroup_idx) Get index of the maingoup with id: maingoup_id Read more… Arguments Type Intent Optional Attributes Name class( GeGCModelParameters ) :: self integer, intent(in) :: maingroup_id ID of the subgroup Return Value integer Index of the maingroup on the self%maingroups_ids vector public function get_maingroups_aij (self, maingroup_i_id, maingroup_j_id) result(aij) Get the interaction parameter Read more… Arguments Type Intent Optional Attributes Name class( GeGCModelParameters ) :: self integer, intent(in) :: maingroup_i_id ID of the maingroup i integer, intent(in) :: maingroup_j_id ID of the maingroup j Return Value real(kind=pr) Interaction parameter public function get_maingroups_bij (self, maingroup_i_id, maingroup_j_id) result(bij) Get the interaction parameter Read more… Arguments Type Intent Optional Attributes Name class( GeGCModelParameters ) :: self integer, intent(in) :: maingroup_i_id ID of the maingroup i integer, intent(in) :: maingroup_j_id ID of the maingroup j Return Value real(kind=pr) Interaction parameter public function get_maingroups_cij (self, maingroup_i_id, maingroup_j_id) result(cij) Get the interaction parameter Read more… Arguments Type Intent Optional Attributes Name class( GeGCModelParameters ) :: self integer, intent(in) :: maingroup_i_id ID of the maingroup i integer, intent(in) :: maingroup_j_id ID of the maingroup j Return Value real(kind=pr) Interaction parameter public function get_subgroup_Q (self, subgroup_id) result(subgroup_Q) Get the subgroup’s value Read more… Arguments Type Intent Optional Attributes Name class( GeGCModelParameters ) :: self integer, intent(in) :: subgroup_id ID of the subgroup Return Value real(kind=pr) value of the subgroup public function get_subgroup_R (self, subgroup_id) result(subgroup_R) Get the subgroup’s value Read more… Arguments Type Intent Optional Attributes Name class( GeGCModelParameters ) :: self integer, intent(in) :: subgroup_id ID of the subgroup Return Value real(kind=pr) value of the subgroup public function get_subgroup_index (self, subgroup_id) result(subgroup_idx) Get index of the subgroup with id: subgroup_id Read more… Arguments Type Intent Optional Attributes Name class( GeGCModelParameters ) :: self integer, intent(in) :: subgroup_id ID of the subgroup Return Value integer Index of the subgroup on the self%subgroups_ids vector public function get_subgroup_maingroup (self, subgroup_id) result(subgroup_maingroup) Get the subgroup’s maingroup Read more… Arguments Type Intent Optional Attributes Name class( GeGCModelParameters ) :: self integer, intent(in) :: subgroup_id ID of the subgroup Return Value integer Maingroup of the subgroup public function get_subgroups_aij (self, subgroup_i_id, subgroup_j_id) result(aij) Get the interaction parameter Read more… Arguments Type Intent Optional Attributes Name class( GeGCModelParameters ) :: self integer, intent(in) :: subgroup_i_id ID of the subgroup i integer, intent(in) :: subgroup_j_id ID of the subgroup j Return Value real(kind=pr) Interaction parameter public function get_subgroups_bij (self, subgroup_i_id, subgroup_j_id) result(bij) Get the interaction parameter Read more… Arguments Type Intent Optional Attributes Name class( GeGCModelParameters ) :: self integer, intent(in) :: subgroup_i_id ID of the subgroup i integer, intent(in) :: subgroup_j_id ID of the subgroup j Return Value real(kind=pr) Interaction parameter public function get_subgroups_cij (self, subgroup_i_id, subgroup_j_id) result(cij) Get the interaction parameter Read more… Arguments Type Intent Optional Attributes Name class( GeGCModelParameters ) :: self integer, intent(in) :: subgroup_i_id ID of the subgroup i integer, intent(in) :: subgroup_j_id ID of the subgroup j Return Value real(kind=pr) Interaction parameter","tags":"","loc":"module/yaeos__models_ge_group_contribution_model_parameters.html"},{"title":"yaeos__models – yaeos","text":"yaeos thermodynamic models On yaeos there are implemented a series of both residual Helmholtz\nenergy ( ) and excess Gibbs energy ( ) models. This module takes all the relevant procedures and derived types\nrelated to them. Residual Helmholtz model base type ArModel base derived type\n that provides the basic structure that a residual Helmholtz model\n should provide. Cubic Equations of state : AlphaFunction type CubicMixRule type CubicEos type that extends ArModel to use a generic\n two-parameter EoS. Implemented models that use this type can be\n seen at yaeos__models_ar_cubic_implementations QMR (Quadratic Mixing Rule) type: extensible derived type that \n defaults to classic vdW mixing rules. MHV (Modified Huron-Vidal) type: Michelsens first order modified\n Huron-Vidal mixing rule. Uses yaeos__models_ar_genericcubic yaeos__models_cubic_mixing_rules_huron_vidal yaeos__models_ge_implementations yaeos__models_ge yaeos__models_ar_cubic_quadratic_mixing yaeos__models_ar_cubic_implementations yaeos__models_base yaeos__models_ar yaeos__models_ar_cubic_alphas","tags":"","loc":"module/yaeos__models.html"},{"title":"yaeos__models_cubic_mixing_rules_huron_vidal – yaeos","text":"Huron-Vidal (like) mixing rules module This module contains the mixing rules that are based/similar to the \nmixing rules defined by Huron-Vidal Description Huron-Vidal presented a way to link a model with a Cubic EoS\nmixing rule. This makes it possible to make good predictions on \npolar compounds containing mixtures. Examples A basic code example References Uses yaeos__models_ge yaeos__models_ar_genericcubic yaeos__constants yaeos__models_ar_cubic_mixing_base Interfaces public interface MHV private function init (Ge, b, q, lij) result(mixrule) Arguments Type Intent Optional Attributes Name class( GeModel ), intent(in) :: Ge real(kind=pr), intent(in) :: b (:) real(kind=pr), intent(in) :: q real(kind=pr), intent(in), optional :: lij (:,:) Return Value type( MHV ) Derived Types type, public, extends( CubicMixRule ) :: MHV Mixing rule at zero-pressure which allows for the inclusion of an\nexcess-gibbs model. Read more… Components Type Visibility Attributes Name Initial class( GeModel ), public, allocatable :: ge real(kind=pr), public, allocatable :: l (:,:) real(kind=pr), public :: q real(kind=pr), private, allocatable :: B real(kind=pr), private, allocatable :: bi (:) real(kind=pr), private, allocatable :: dBi (:) real(kind=pr), private, allocatable :: dBij (:,:) Constructor private\n\n \n function init (Ge, b, q, lij) Type-Bound Procedures procedure, public :: Bmix => BmixMHV procedure, public :: D1Mix => D1MixMHV procedure, public :: Dmix => DmixMHV Functions private function init (Ge, b, q, lij) result(mixrule) Arguments Type Intent Optional Attributes Name class( GeModel ), intent(in) :: Ge real(kind=pr), intent(in) :: b (:) real(kind=pr), intent(in) :: q real(kind=pr), intent(in), optional :: lij (:,:) Return Value type( MHV ) Subroutines public subroutine DmixMHV (self, n, T, ai, daidt, daidt2, D, dDdT, dDdT2, dDi, dDidT, dDij) Mixing rule at infinite pressure as defined in the book of Michelsen and\nMøllerup. Read more… Arguments Type Intent Optional Attributes Name class( MHV ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: T real(kind=pr), intent(in) :: ai (:) real(kind=pr), intent(in) :: daidt (:) real(kind=pr), intent(in) :: daidt2 (:) real(kind=pr), intent(out) :: D real(kind=pr), intent(out) :: dDdT real(kind=pr), intent(out) :: dDdT2 real(kind=pr), intent(out) :: dDi (:) real(kind=pr), intent(out) :: dDidT (:) real(kind=pr), intent(out) :: dDij (:,:) private subroutine BmixMHV (self, n, bi, B, dBi, dBij) Quadratinc mixing rule for the repulsive parameter, using as a combining rule. Read more… Arguments Type Intent Optional Attributes Name class( MHV ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: bi (:) real(kind=pr), intent(out) :: B real(kind=pr), intent(out) :: dBi (:) real(kind=pr), intent(out) :: dBij (:,:) private subroutine D1MixMHV (self, n, d1i, D1, dD1i, dD1ij) Arguments Type Intent Optional Attributes Name class( MHV ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: d1i (:) real(kind=pr), intent(out) :: D1 real(kind=pr), intent(out) :: dD1i (:) real(kind=pr), intent(out) :: dD1ij (:,:)","tags":"","loc":"module/yaeos__models_cubic_mixing_rules_huron_vidal.html"},{"title":"yaeos__auxiliar – yaeos","text":"Uses yaeos__constants Interfaces public interface optval public function optval_integer (val, default) Set a value to a default if it is not defined Arguments Type Intent Optional Attributes Name integer, intent(inout), optional :: val integer, intent(in) :: default Return Value integer public function optval_real (val, default) Set a value to a default if it is not defined Arguments Type Intent Optional Attributes Name real(kind=pr), intent(inout), optional :: val real(kind=pr), intent(in) :: default Return Value real(kind=pr) Functions public function optval_integer (val, default) Set a value to a default if it is not defined Arguments Type Intent Optional Attributes Name integer, intent(inout), optional :: val integer, intent(in) :: default Return Value integer public function optval_real (val, default) Set a value to a default if it is not defined Arguments Type Intent Optional Attributes Name real(kind=pr), intent(inout), optional :: val real(kind=pr), intent(in) :: default Return Value real(kind=pr) Subroutines public subroutine sort (array, idx) Sort an array and return the indexes Arguments Type Intent Optional Attributes Name real(kind=pr), intent(inout) :: array (:) integer, intent(out), optional :: idx (:)","tags":"","loc":"module/yaeos__auxiliar.html"},{"title":"yaeos – yaeos","text":"Yet Another Equation-Of-State (library) Library to use EoS-based calculations. This main module imports all the\nrelevant constants, procedures and objects to have better access to them\nThe main submodules that it uses are: yaeos__constants : All the relevant costants and also the used precision (default=double precision). yaeos__consistency : Tools to evalaute the consistency of Ar and Ge models. yaeos__substance : Derived type that holds the important data (for example, critical constants) from a mixture. yaeos__models : All the implemented models, also their base types for making extensions. yaeos__equilibria : Phase equilibria related procedures. Uses yaeos__models yaeos__substance yaeos__consistency yaeos__equilibria yaeos__constants Variables Type Visibility Attributes Name Initial character(len=*), public, parameter :: version = \"1.0.0\" This version.","tags":"","loc":"module/yaeos.html"},{"title":"yaeos__fitting_fit_nrtl_mhv – yaeos","text":"Uses forsus yaeos__fitting yaeos__models yaeos__constants Variables Type Visibility Attributes Name Initial integer, public, parameter :: nc = 2 Derived Types type, public, extends( FittingProblem ) :: FitMHVNRTL Components Type Visibility Attributes Name Initial type( EquilibriumState ), public, allocatable :: experimental_points (:) Experimental points to fit logical, public :: fit_lij = .false. logical, public :: fit_nrtl = .false. class( ArModel ), public, allocatable :: model Residual Helmholtz Model to fit logical, public :: verbose = .false. If true log the fitting process Type-Bound Procedures procedure, public :: get_model_from_X => model_from_X Subroutines public subroutine model_from_X (problem, X) Arguments Type Intent Optional Attributes Name class( FitMHVNRTL ), intent(inout) :: problem real(kind=pr), intent(in) :: X (:)","tags":"","loc":"module/yaeos__fitting_fit_nrtl_mhv.html"},{"title":"yaeos__models_ar_genericcubic – yaeos","text":"Uses yaeos__models_ar yaeos__constants yaeos__substance Abstract Interfaces abstract interface public subroutine abs_Bmix(self, n, bi, B, dBi, dBij) Arguments Type Intent Optional Attributes Name class( CubicMixRule ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: bi (:) real(kind=pr), intent(out) :: B real(kind=pr), intent(out) :: dBi (:) real(kind=pr), intent(out) :: dBij (:,:) abstract interface public subroutine abs_D1mix(self, n, d1i, D1, dD1i, dD1ij) Arguments Type Intent Optional Attributes Name class( CubicMixRule ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: d1i (:) real(kind=pr), intent(out) :: D1 real(kind=pr), intent(out) :: dD1i (:) real(kind=pr), intent(out) :: dD1ij (:,:) abstract interface public subroutine abs_Dmix(self, n, T, ai, daidt, daidt2, D, dDdT, dDdT2, dDi, dDidT, dDij) Arguments Type Intent Optional Attributes Name class( CubicMixRule ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: T real(kind=pr), intent(in) :: ai (:) real(kind=pr), intent(in) :: daidt (:) real(kind=pr), intent(in) :: daidt2 (:) real(kind=pr), intent(out) :: D real(kind=pr), intent(out) :: dDdT real(kind=pr), intent(out) :: dDdT2 real(kind=pr), intent(out) :: dDi (:) real(kind=pr), intent(out) :: dDidT (:) real(kind=pr), intent(out) :: dDij (:,:) abstract interface public subroutine abs_alpha(self, Tr, a, dadt, dadt2) Arguments Type Intent Optional Attributes Name class( AlphaFunction ), intent(in) :: self real(kind=pr), intent(in) :: Tr (:) real(kind=pr), intent(out) :: a (:) real(kind=pr), intent(out) :: dadt (:) real(kind=pr), intent(out) :: dadt2 (:) Derived Types type, public, abstract :: AlphaFunction Abstract derived type that describe the required\nprocedure for an alpha function. Type-Bound Procedures procedure( abs_alpha ), public, deferred :: alpha type, public, extends( ArModel ) :: CubicEoS Generic Cubic Equation of State as defined by Michelsen and Mollerup\nwith a parameter that is not constant, \nand a parameter that depends on it. In the case of a \ntwo parameter EoS like PengRobinson the is the same for\nall components so it can be considered as a constant instead of a \nvariable. The expression of the Equation is: Read more… Components Type Visibility Attributes Name Initial real(kind=pr), public, allocatable :: ac (:) Attractive critical parameter class( AlphaFunction ), public, allocatable :: alpha Uses the abstract derived type AlphaFunction to define the\nAlpha function that the CubicEoS will use. The Alpha function\nreceives the reduced temperature and returns the values of alpha\nand its derivatives, named a , dadt and dadt2 respectively. Read more… real(kind=pr), public, allocatable :: b (:) Repulsive parameter type( Substances ), public :: components Substances contained in the module real(kind=pr), public, allocatable :: del1 (:) paramter real(kind=pr), public, allocatable :: del2 (:) paramter class( CubicMixRule ), public, allocatable :: mixrule Uses the abstract derived type CubicMixRule to define the\nmixing rule that the CubicEoS will use. It includes internally\nthree methods to calculate the corresponding parameters for the\nCubic EoS: Dmix , Bmix and D1mix . Read more… character(len=:), public, allocatable :: name Name of the model Type-Bound Procedures procedure, public :: Cp_residual_vt procedure, public :: Cv_residual_vt procedure, public :: enthalpy_residual_vt procedure, public :: entropy_residual_vt procedure, public :: get_v0 => v0 procedure, public :: gibbs_residual_vt => gibbs_residual_VT procedure, public :: lnphi_pt => fugacity_pt procedure, public :: lnphi_vt => fugacity_vt procedure, public :: pressure procedure, public :: residual_helmholtz => GenericCubic_Ar procedure, public :: volume type, public, abstract :: CubicMixRule Abstract derived type that describe the required\nprocedure for a mixing rule on a Cubic EoS Type-Bound Procedures procedure( abs_Bmix ), public, deferred :: Bmix procedure( abs_D1mix ), public, deferred :: D1mix procedure( abs_Dmix ), public, deferred :: Dmix Functions public function v0 (self, n, p, t) Cubic EoS volume initializer.\nFor a Cubic Equation of State, the covolume calculated with the mixing\nrule is a good estimate for the initial volume solver on the liquid\nregion. Arguments Type Intent Optional Attributes Name class( CubicEoS ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: p real(kind=pr), intent(in) :: t Return Value real(kind=pr) Subroutines public subroutine GenericCubic_Ar (self, n, v, t, ar, arv, ArT, artv, arv2, ArT2, Arn, ArVn, ArTn, Arn2) Residual Helmholtz Energy for a generic Cubic Equation of State. Read more… Arguments Type Intent Optional Attributes Name class( CubicEoS ), intent(in) :: self real(kind=pr), intent(in) :: n (:) Number of moles real(kind=pr), intent(in) :: v Volume [L] real(kind=pr), intent(in) :: t Temperature [K] real(kind=pr), intent(out), optional :: ar Residual Helmholtz real(kind=pr), intent(out), optional :: arv real(kind=pr), intent(out), optional :: ArT real(kind=pr), intent(out), optional :: artv real(kind=pr), intent(out), optional :: arv2 real(kind=pr), intent(out), optional :: ArT2 real(kind=pr), intent(out), optional :: Arn (size(n)) real(kind=pr), intent(out), optional :: ArVn (size(n)) real(kind=pr), intent(out), optional :: ArTn (size(n)) real(kind=pr), intent(out), optional :: Arn2 (size(n),size(n)) public subroutine volume (eos, n, P, T, V, root_type) Volume solver optimized for Cubic Equations of State. Read more… Arguments Type Intent Optional Attributes Name class( CubicEoS ), intent(in) :: eos real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: P real(kind=pr), intent(in) :: T real(kind=pr), intent(out) :: V character(len=*), intent(in) :: root_type","tags":"","loc":"module/yaeos__models_ar_genericcubic.html"},{"title":"ar_interface – yaeos","text":"Uses yaeos__constants iso_fortran_env Variables Type Visibility Attributes Name Initial procedure( Ares ), public, pointer :: ar_fun procedure( initial_volume ), public, pointer :: vinit Abstract Interfaces abstract interface public subroutine Ares(z, v, t, Ar, ArV, ArTV, ArV2, Arn, ArVn, ArTn, Arn2) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: z (:) real(kind=pr), intent(in) :: v real(kind=pr), intent(in) :: t real(kind=pr), intent(out) :: Ar real(kind=pr), intent(out) :: ArV real(kind=pr), intent(out) :: ArTV real(kind=pr), intent(out) :: ArV2 real(kind=pr), intent(out), dimension(size(z)) :: Arn real(kind=pr), intent(out), dimension(size(z)) :: ArVn real(kind=pr), intent(out), dimension(size(z)) :: ArTn real(kind=pr), intent(out) :: Arn2 (size(z),size(z)) abstract interface public function initial_volume(z, p, t) Arguments Type Intent Optional Attributes Name real(kind=pr) :: z (:) real(kind=pr) :: p real(kind=pr) :: t Return Value real(kind=pr)","tags":"","loc":"module/ar_interface.html"},{"title":"ADMM_TAPENADE_INTERFACE – yaeos","text":"Interfaces public interface ADMM_REBASE public subroutine ADMM_REBASE(base) bind(c, name='ADMM_rebase') Arguments Type Intent Optional Attributes Name type(C_PTR) :: base public interface ADMM_REBASESHADOWED public subroutine ADMM_REBASESHADOWED(base, baseb) bind(c, name= 'ADMM_rebaseShadowed') Arguments Type Intent Optional Attributes Name type(C_PTR) :: base type(C_PTR) :: baseb public interface ADMM_REGISTER public subroutine ADMM_REGISTER(base, obase, size, nbelem) bind(c, name= 'ADMM_register') Arguments Type Intent Optional Attributes Name type(C_PTR), VALUE :: base type(C_PTR), VALUE :: obase integer, VALUE :: size integer, VALUE :: nbelem public interface ADMM_REGISTERSHADOWED public subroutine ADMM_REGISTERSHADOWED(base, obase, size, baseb, obaseb, sizeb, nbelem) bind(c, name='ADMM_registerShadowed') Arguments Type Intent Optional Attributes Name type(C_PTR), VALUE :: base type(C_PTR), VALUE :: obase integer, VALUE :: size type(C_PTR), VALUE :: baseb type(C_PTR), VALUE :: obaseb integer, VALUE :: sizeb integer, VALUE :: nbelem public interface ADMM_UNREGISTER public subroutine ADMM_UNREGISTER(base, nbelem) bind(c, name= 'ADMM_unregister') Arguments Type Intent Optional Attributes Name type(C_PTR), VALUE :: base integer :: nbelem public interface ADMM_UNREGISTERSHADOWED public subroutine ADMM_UNREGISTERSHADOWED(base, baseb, nbelem) bind(c, name='ADMM_unregisterShadowed') Arguments Type Intent Optional Attributes Name type(C_PTR), VALUE :: base type(C_PTR), VALUE :: baseb integer :: nbelem public interface POPPOINTER8 public subroutine POPPOINTER8(pp) bind(c, name='popPointer8') Arguments Type Intent Optional Attributes Name type(C_PTR) :: pp public interface PUSHPOINTER8 public subroutine PUSHPOINTER8(pp) bind(c, name='pushPointer8') Arguments Type Intent Optional Attributes Name type(C_PTR), VALUE :: pp","tags":"","loc":"module/admm_tapenade_interface.html"},{"title":"yaeos__models_ge_group_contribution_unifac_parameters – yaeos","text":"UNIFAC parameters UNIFAC parameters module Description Instances of the yaeos GeGCModelParameters with the classic liquid-vapor\nUNIFAC parameters. Examples use yaeos__models_ge_group_contribution_unifac_parameters , only : UNIFACParameters use yaeos__models_ge_group_contribution_model_parameters , only : GeGCModelParameters type ( GeGCModelParameters ) :: parameters parameters = UNIFACParameters () ! Get the maingroups i:1, j:7 interaction parameter aij (CH2-H2O) print * , parameters % get_maingroups_aij ( 1 , 7 ) ! prints: 1318.0000 References Dortmund Data Bank Software & Separation Technology Fredenslund, A., Jones, R. L., & Prausnitz, J. M. (1975).\nGroup‐contribution estimation of activity coefficients in nonideal liquid\nmixtures. AIChE Journal, 21(6), 1086–1099. https://doi.org/10.1002/aic.690210607 Skjold-Jorgensen, S., Kolbe, B., Gmehling, J., & Rasmussen, P. (1979).\nVapor-Liquid Equilibria by UNIFAC Group Contribution. Revision and\nExtension. Industrial & Engineering Chemistry Process Design and\nDevelopment, 18(4), 714–722. https://doi.org/10.1021/i260072a024 Gmehling, J., Rasmussen, P., & Fredenslund, A. (1982). Vapor-liquid\nequilibriums by UNIFAC group contribution. Revision and extension. 2.\nIndustrial & Engineering Chemistry Process Design and Development, 21(1),\n118–127. https://doi.org/10.1021/i200016a021 Macedo, E. A., Weidlich, U., Gmehling, J., & Rasmussen, P. (1983).\nVapor-liquid equilibriums by UNIFAC group contribution. Revision and\nextension. 3. Industrial & Engineering Chemistry Process Design and\nDevelopment, 22(4), 676–678. https://doi.org/10.1021/i200023a023 Tiegs, D., Rasmussen, P., Gmehling, J., & Fredenslund, A. (1987).\nVapor-liquid equilibria by UNIFAC group contribution. 4. Revision and\nextension. Industrial & Engineering Chemistry Research, 26(1), 159–161. https://doi.org/10.1021/ie00061a030 Hansen, H. K., Rasmussen, P., Fredenslund, A., Schiller, M., &\nGmehling, J. (1991). Vapor-liquid equilibria by UNIFAC group\ncontribution. 5. Revision and extension. Industrial & Engineering\nChemistry Research, 30 (10), 2352–2355. https://doi.org/10.1021/ie00058a017 Wittig, R., Lohmann, J., & Gmehling, J. (2003). Vapor−Liquid Equilibria\nby UNIFAC Group Contribution. 6. Revision and Extension. Industrial &\nEngineering Chemistry Research, 42(1), 183–188. https://doi.org/10.1021/ie020506l Uses yaeos__models_ge_group_contribution_model_parameters yaeos__constants Functions public function UNIFACParameters () UNIFAC parameters Read more… Arguments None Return Value type( GeGCModelParameters )","tags":"","loc":"module/yaeos__models_ge_group_contribution_unifac_parameters.html"},{"title":"yaeos__models_ge_group_contribution_unifac – yaeos","text":"UNIFAC module Classic liquid-vapor UNIFAC model implementation module. Description Classic liquid-vapor UNIFAC model implementation module. The\nimplementation is based on the Thermopack library (SINTEF) implementation. Examples ! Instantiate an UNIFAC model with ethanol-water mix and calculate gammas use yaeos , only : pr , Groups , setup_unifac , UNIFAC type ( UNIFAC ) :: model type ( Groups ) :: molecules ( 2 ) real ( pr ) :: ln_gammas ( 2 ) ! Ethanol definition [CH3, CH2, OH] molecules ( 1 )% groups_ids = [ 1 , 2 , 14 ] ! Subgroups ids molecules ( 1 )% number_of_groups = [ 1 , 1 , 1 ] ! Subgroups occurrences ! Water definition [H2O] molecules ( 2 )% groups_ids = [ 16 ] molecules ( 2 )% number_of_groups = [ 1 ] ! Model setup model = setup_unifac ( molecules ) ! Calculate ln_gammas call model % ln_activity_coefficient ([ 0.5_pr , 0.5_pr ], 29 8.0_pr , ln_gammas ) print * , ln_gammas ! result: 0.18534142000449058 0.40331395945417559 References Dortmund Data Bank Software & Separation Technology Fredenslund, A., Jones, R. L., & Prausnitz, J. M. (1975).\nGroup‐contribution estimation of activity coefficients in nonideal liquid\nmixtures. AIChE Journal, 21(6), 1086–1099. https://doi.org/10.1002/aic.690210607 Skjold-Jorgensen, S., Kolbe, B., Gmehling, J., & Rasmussen, P. (1979).\nVapor-Liquid Equilibria by UNIFAC Group Contribution. Revision and\nExtension. Industrial & Engineering Chemistry Process Design and\nDevelopment, 18(4), 714–722. https://doi.org/10.1021/i260072a024 Gmehling, J., Rasmussen, P., & Fredenslund, A. (1982). Vapor-liquid\nequilibriums by UNIFAC group contribution. Revision and extension. 2.\nIndustrial & Engineering Chemistry Process Design and Development, 21(1),\n118–127. https://doi.org/10.1021/i200016a021 Macedo, E. A., Weidlich, U., Gmehling, J., & Rasmussen, P. (1983).\nVapor-liquid equilibriums by UNIFAC group contribution. Revision and\nextension. 3. Industrial & Engineering Chemistry Process Design and\nDevelopment, 22(4), 676–678. https://doi.org/10.1021/i200023a023 Tiegs, D., Rasmussen, P., Gmehling, J., & Fredenslund, A. (1987).\nVapor-liquid equilibria by UNIFAC group contribution. 4. Revision and\nextension. Industrial & Engineering Chemistry Research, 26(1), 159–161. https://doi.org/10.1021/ie00061a030 Hansen, H. K., Rasmussen, P., Fredenslund, A., Schiller, M., &\nGmehling, J. (1991). Vapor-liquid equilibria by UNIFAC group\ncontribution. 5. Revision and extension. Industrial & Engineering\nChemistry Research, 30 (10), 2352–2355. https://doi.org/10.1021/ie00058a017 Wittig, R., Lohmann, J., & Gmehling, J. (2003). Vapor−Liquid Equilibria\nby UNIFAC Group Contribution. 6. Revision and Extension. Industrial &\nEngineering Chemistry Research, 42(1), 183–188. https://doi.org/10.1021/ie020506l SINTEF - Thermopack Uses yaeos__models_ge yaeos__models_ge_group_contribution_model_parameters yaeos__constants yaeos__models_ge_group_contribution_unifac_parameters Abstract Interfaces abstract interface public subroutine temperature_dependence(self, systems_groups, T, psi, dpsi_dt, dpsi_dt2) temperature_dependence interface Interface subroutine for UNIFAC models temperature dependent\nfunctions Arguments Type Intent Optional Attributes Name class( PsiFunction ) :: self PsiFunction type variable class( Groups ) :: systems_groups Groups type variable containig all the system’s groups. See the groups_stew variable on the UNIFAC documentation. real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out), optional :: psi (:,:) real(kind=pr), intent(out), optional :: dpsi_dt (:,:) real(kind=pr), intent(out), optional :: dpsi_dt2 (:,:) Derived Types type, public :: Groups Derived type used to represent a molecule and its UNIFAC groups. Read more… Components Type Visibility Attributes Name Initial integer, public, allocatable :: groups_ids (:) Indexes (ids) of each subgroup in the main group matrix integer, public, allocatable :: number_of_groups (:) Occurrences of each subgroup in the molecule real(kind=pr), public :: surface_area Molecule surface area real(kind=pr), public :: volume Molecule volume type, public, abstract :: PsiFunction UNIFAC functions abstract type Read more… Type-Bound Procedures procedure( temperature_dependence ), public, deferred :: psi type, public, extends( GeModel ) :: UNIFAC Classic liquid-vapor UNIFAC model derived type Read more… Components Type Visibility Attributes Name Initial type( Substances ), public :: components Substances contained in the module real(kind=pr), public, allocatable :: group_area (:) Group areas real(kind=pr), public, allocatable :: group_volume (:) Group volumes type( Groups ), public :: groups_stew All the groups present in the system type( Groups ), public, allocatable :: molecules (:) Substances present in the system integer, public :: ngroups Total number of individual groups in the mixture integer, public :: nmolecules Total number of molecules in the mixture class( PsiFunction ), public, allocatable :: psi_function Temperature dependance function of the model real(kind=pr), public, allocatable :: qk (:) Area of each group k real(kind=pr), public, allocatable :: thetas_ij (:,:) Area fractions of the groups j on molecules i real(kind=pr), public, allocatable :: vij (:,:) Ocurrences of each group j on each molecule i real(kind=pr), public :: z = 10 Model constant Type-Bound Procedures procedure, public :: excess_gibbs procedure, public :: ln_activity_coefficient type, public, extends( PsiFunction ) :: UNIFACPsi Read more… Components Type Visibility Attributes Name Initial real(kind=pr), public, allocatable :: Aij (:,:) Type-Bound Procedures procedure, public :: psi => UNIFAC_temperature_dependence Functions public function setup_unifac (molecules, parameters) Instantiate a UNIFAC model Read more… Arguments Type Intent Optional Attributes Name type( Groups ), intent(in) :: molecules (:) Molecules (Group type) objects type( GeGCModelParameters ), intent(in), optional :: parameters UNIFAC parameters Return Value type( UNIFAC ) public function thetas_i (nm, ng, parameters, stew, molecules) result(thetas_ij) Calculate the area fraciton of each froup on each molecule. Read more… Arguments Type Intent Optional Attributes Name integer, intent(in) :: nm Number of molecules integer, intent(in) :: ng Number of groups type( GeGCModelParameters ), intent(in) :: parameters UNIFAC parameters type( Groups ), intent(in) :: stew All the groups present in the system type( Groups ), intent(in) :: molecules (:) Molecules Return Value real(kind=pr), (nm,ng) Group j area fraction on molecule i Subroutines public subroutine Ge_combinatorial (self, n, T, Ge, dGe_dn, dGe_dn2) Calculate the UNIFAC combinatorial term of Gibbs excess energy Read more… Arguments Type Intent Optional Attributes Name class( UNIFAC ) :: self real(kind=pr), intent(in) :: n (self%nmolecules) Moles vector [mol] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out), optional :: Ge Combinatorial Gibbs excess energy real(kind=pr), intent(out), optional :: dGe_dn (self%nmolecules) real(kind=pr), intent(out), optional :: dGe_dn2 (self%nmolecules,self%nmolecules) public subroutine Ge_residual (self, n, T, Ge, dGe_dn, dGe_dn2, dGe_dT, dGe_dT2, dGe_dTn) Evaluate the UNIFAC residual therm Read more… Arguments Type Intent Optional Attributes Name class( UNIFAC ) :: self real(kind=pr), intent(in) :: n (self%nmolecules) Moles vector real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out), optional :: Ge Residual Gibbs excess energy real(kind=pr), intent(out), optional :: dGe_dn (self%nmolecules) real(kind=pr), intent(out), optional :: dGe_dn2 (self%nmolecules,self%nmolecules) real(kind=pr), intent(out), optional :: dGe_dT real(kind=pr), intent(out), optional :: dGe_dT2 real(kind=pr), intent(out), optional :: dGe_dTn (self%nmolecules) public subroutine UNIFAC_temperature_dependence (self, systems_groups, T, psi, dpsi_dt, dpsi_dt2) Implementation of the function of the UNIFAC model. Read more… Arguments Type Intent Optional Attributes Name class( UNIFACPsi ) :: self function class( Groups ) :: systems_groups Groups in the system real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out), optional :: psi (:,:) real(kind=pr), intent(out), optional :: dpsi_dt (:,:) real(kind=pr), intent(out), optional :: dpsi_dt2 (:,:) public subroutine excess_gibbs (self, n, T, Ge, GeT, GeT2, Gen, GeTn, Gen2) Calculate the Gibbs excess energy of the UNIFAC model Read more… Arguments Type Intent Optional Attributes Name class( UNIFAC ), intent(in) :: self UNIFAC model real(kind=pr), intent(in) :: n (:) Moles vector [mol] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out), optional :: Ge Excess Gibbs energy real(kind=pr), intent(out), optional :: GeT real(kind=pr), intent(out), optional :: GeT2 real(kind=pr), intent(out), optional :: Gen (size(n)) real(kind=pr), intent(out), optional :: GeTn (size(n)) real(kind=pr), intent(out), optional :: Gen2 (size(n),size(n))","tags":"","loc":"module/yaeos__models_ge_group_contribution_unifac.html"},{"title":"yaeos__constants – yaeos","text":"Constants used on the whole package Uses iso_fortran_env Variables Type Visibility Attributes Name Initial real(kind=pr), public, parameter :: NOT_IMPLEMENTED = huge(R) real(kind=pr), public, parameter :: R = 0.08314462618_pr Ideal Gas constant character(len=254), public :: database_path = \"database\" Path to find database character(len=1), public :: path_sep = \"/\" File separator (to preprocess on Win or Mac/linux) integer, public, parameter :: pr = real64 Used precision","tags":"","loc":"module/yaeos__constants.html"},{"title":"yaeos__models_ge_implementations – yaeos","text":"Uses yaeos__models_ge_group_contribution_unifac yaeos__models_ge_NRTL","tags":"","loc":"module/yaeos__models_ge_implementations.html"},{"title":"yaeos__consistency_gemodel – yaeos","text":"yaeos__consistency_gemodel Consistency checks of Helmholtz free energy models ( GeModel ). Description This module contains tools to validate the analityc derivatives of\nimplmented excess Gibbs free energy models ( GeModel ). Also, allows to\nevaluate the consistency tests described in Thermodynamic Models:\nFundamentals & Computational Aspects 2 ed. by Michelsen and Mollerup\nChapter 5 section 4. Available tools: numeric_ge_derivatives : From an instantiated GeModel evaluate\nall the excess Gibbs free energy derivatives from the central finite\ndifference method. ge_consistency : From an instantiated GeModel evaluate all the\nMichelsen and Mollerup consistency tests References Michelsen, M. L., & Mollerup, J. M. (2007). Thermodynamic models:\nFundamentals & computational aspects (2. ed). Tie-Line Publications. Uses yaeos__models_ge yaeos__constants Subroutines public subroutine ge_consistency (model, n, t, eq58, eq59, eq60, eq61) models consistency tests Read more… Arguments Type Intent Optional Attributes Name class( GeModel ), intent(in) :: model model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: t Temperature [K] real(kind=pr), intent(out), optional :: eq58 MM Eq. 58 real(kind=pr), intent(out), optional :: eq59 (size(n)) MM Eq. 59 real(kind=pr), intent(out), optional :: eq60 (size(n),size(n)) MM Eq. 60 real(kind=pr), intent(out), optional :: eq61 (size(n)) MM Eq. 61 public subroutine numeric_ge_derivatives (model, n, t, d_n, d_t, Ge, GeT, Gen, GeT2, GeTn, Gen2) Numeric model derivatives Read more… Arguments Type Intent Optional Attributes Name class( GeModel ), intent(in) :: model model real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: t Temperature [K] real(kind=pr), intent(in) :: d_n Moles finite difference step real(kind=pr), intent(in) :: d_t Temperature finite difference step real(kind=pr), intent(out) :: Ge Residual Helmoltz energy real(kind=pr), intent(out), optional :: GeT real(kind=pr), intent(out), optional :: Gen (size(n)) real(kind=pr), intent(out), optional :: GeT2 real(kind=pr), intent(out), optional :: GeTn (size(n)) real(kind=pr), intent(out), optional :: Gen2 (size(n),size(n))","tags":"","loc":"module/yaeos__consistency_gemodel.html"},{"title":"yaeos__autodiff – yaeos","text":"This module holds the diferent ways of automatic differentiation Uses hyperdual_mod yaeos__adiff_hyperdual_ar_api","tags":"","loc":"module/yaeos__autodiff.html"},{"title":"yaeos__equilibria_rachford_rice – yaeos","text":"Uses yaeos__constants Subroutines public subroutine betalimits (z, K, bmin, bmax) Define beta limits to avoid overshooting when solving the Rachford-Rice\nequation. Read more… Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: z (:) Molar fractions vector real(kind=pr), intent(in) :: K (:) K-factors real(kind=pr), intent(out) :: bmin Minimum beta value real(kind=pr), intent(out) :: bmax Maximum beta value public subroutine betato01 (z, K) Modify K-factor values to assure that lies between (0,1) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: z (:) Molar fractions of the system real(kind=pr) :: K (:) K factors public subroutine rachford_rice (z, K, beta, rr, drrdb) Rachford-Rice equation for a two phase system Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: z (:) real(kind=pr), intent(in) :: K (:) real(kind=pr), intent(in) :: beta real(kind=pr), intent(out) :: rr real(kind=pr), intent(out) :: drrdb public subroutine solve_rr (z, K, beta, beta_min, beta_max) Solve the Rachford-Rice Equation. Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: z (:) Mole fractions vector real(kind=pr), intent(in) :: K (:) K-factors real(kind=pr), intent(out) :: beta value real(kind=pr), intent(out) :: beta_min Lower limit for real(kind=pr), intent(out) :: beta_max Upper limit for","tags":"","loc":"module/yaeos__equilibria_rachford_rice.html"},{"title":"legacy_ar_models – yaeos","text":"Legacy Thermodynamic routines\nModule for a cubic eos system, made with the intention to keep\ncompatiblity with legacy codes but with a better structure.\nthis should be later adapted into a simple oop system where an eos object\nstores the relevant parameters (or some functional oriented approach) Uses yaeos__constants ar_interface Variables Type Visibility Attributes Name Initial real(kind=pr), public, allocatable :: ac (:) Critical attractive parameter [bar (L/mol)^2] real(kind=pr), public, allocatable :: b (:) repulsive parameter [L] real(kind=pr), public, allocatable :: bij (:,:) real(kind=pr), public, allocatable :: dc (:) Critical density [mol/L] real(kind=pr), public, allocatable :: del1 (:) parameter real(kind=pr), public, allocatable :: k (:) Attractive parameter constant real(kind=pr), public, allocatable :: kij (:,:) Attractive BIP real(kind=pr), public, allocatable :: kij0 (:,:) real(kind=pr), public, allocatable :: kinf (:,:) real(kind=pr), public, allocatable :: lij (:,:) Repulsive BIP integer, public :: mixing_rule What mixing rule to use integer, public :: nc Number of components real(kind=pr), public, allocatable :: pc (:) Critical pressure [bar] real(kind=pr), public, allocatable :: tc (:) Critical temperature [K] integer, public :: tdep Temperature dependance of kij integer, public :: thermo_model Which thermodynamic model to use real(kind=pr), public, allocatable :: tstar (:,:) real(kind=pr), public, allocatable :: w (:) Acentric factor real(kind=pr), public, allocatable :: z (:) Mole fractions vector Functions public function cubic_v0 (z, p, t) Arguments Type Intent Optional Attributes Name real(kind=pr) :: z (:) real(kind=pr) :: p real(kind=pr) :: t Return Value real(kind=pr) Subroutines public subroutine ArVnder (nc, nder, ntemp, z, V, T, ar, arv, artv, arv2, Arn, ArVn, ArTn, Arn2) Arguments Type Intent Optional Attributes Name integer, intent(in) :: nc integer, intent(in) :: nder integer, intent(in) :: ntemp real(kind=pr), intent(in) :: z (nc) real(kind=pr), intent(in) :: V real(kind=pr), intent(in) :: T real(kind=pr), intent(out) :: ar real(kind=pr), intent(out) :: arv real(kind=pr), intent(out) :: artv real(kind=pr), intent(out) :: arv2 real(kind=pr), intent(out), dimension(size(z)) :: Arn real(kind=pr), intent(out), dimension(size(z)) :: ArVn real(kind=pr), intent(out), dimension(size(z)) :: ArTn real(kind=pr), intent(out) :: Arn2 (size(z),size(z)) public subroutine Bnder (nc, rn, Bmix, dBi, dBij) Arguments Type Intent Optional Attributes Name integer, intent(in) :: nc real(kind=pr), intent(in) :: rn (nc) real(kind=pr), intent(out) :: Bmix real(kind=pr), intent(out) :: dBi (nc) real(kind=pr), intent(out) :: dBij (nc,nc) public subroutine DELTAnder (nc, rn, D1m, dD1i, dD1ij) Arguments Type Intent Optional Attributes Name integer, intent(in) :: nc real(kind=pr), intent(in) :: rn (nc) real(kind=pr), intent(out) :: D1m real(kind=pr), intent(out) :: dD1i (nc) real(kind=pr), intent(out) :: dD1ij (nc,nc) public subroutine DandTnder (ntd, nc, T, rn, D, dDi, dDiT, dDij, dDdT, dDdT2) Arguments Type Intent Optional Attributes Name integer, intent(in) :: ntd integer, intent(in) :: nc real(kind=pr), intent(in) :: T real(kind=pr), intent(in) :: rn (nc) real(kind=pr), intent(out) :: D real(kind=pr), intent(out) :: dDi (nc) real(kind=pr), intent(out) :: dDiT (nc) real(kind=pr), intent(out) :: dDij (nc,nc) real(kind=pr), intent(out) :: dDdT real(kind=pr), intent(out) :: dDdT2 public subroutine HelmRKPR (nco, NDE, NTD, rn, V, T, Ar, ArV, ArTV, ArV2, Arn, ArVn, ArTn, Arn2) Calculate the reduced residual Helmholtz Energy and it’s derivatives with the RKPR EOS Arguments Type Intent Optional Attributes Name integer, intent(in) :: nco integer, intent(in) :: NDE integer, intent(in) :: NTD real(kind=pr), intent(in) :: rn (nco) real(kind=pr), intent(in) :: V real(kind=pr), intent(in) :: T real(kind=pr), intent(out) :: Ar real(kind=pr), intent(out) :: ArV real(kind=pr), intent(out) :: ArTV real(kind=pr), intent(out) :: ArV2 real(kind=pr), intent(out) :: Arn (nco) real(kind=pr), intent(out) :: ArVn (nco) real(kind=pr), intent(out) :: ArTn (nco) real(kind=pr), intent(out) :: Arn2 (nco,nco) public subroutine HelmSRKPR (nc, nd, nt, rn, v, t, ar, arv, artv, arv2, Arn, ArVn, ArTn, Arn2) Arguments Type Intent Optional Attributes Name integer, intent(in) :: nc Number of components integer, intent(in) :: nd Compositional derivatives integer, intent(in) :: nt Temperature derivatives real(kind=pr), intent(in) :: rn (nc) Number of moles real(kind=pr), intent(in) :: v Volume [L] real(kind=pr), intent(in) :: t Temperature [K] real(kind=pr), intent(out) :: ar Residual Helmholtz real(kind=pr), intent(out) :: arv dAr/dV real(kind=pr), intent(out) :: artv dAr2/dTV real(kind=pr), intent(out) :: arv2 dAr2/dV2 real(kind=pr), intent(out) :: Arn (nc) dAr/dn real(kind=pr), intent(out) :: ArVn (nc) dAr2/dVn real(kind=pr), intent(out) :: ArTn (nc) dAr2/dTn real(kind=pr), intent(out) :: Arn2 (nc,nc) dAr2/dn2 public subroutine PR76_factory (moles_in, ac_in, b_in, tc_in, pc_in, w_in, k_in) PengRobinson 76 factory Read more… Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: moles_in (nc) real(kind=pr), intent(in), optional :: ac_in (nc) real(kind=pr), intent(in), optional :: b_in (nc) real(kind=pr), intent(in), optional :: tc_in (nc) real(kind=pr), intent(in), optional :: pc_in (nc) real(kind=pr), intent(in), optional :: w_in (nc) real(kind=pr), intent(in), optional :: k_in (nc) public subroutine PR78_factory (moles_in, ac_in, b_in, tc_in, pc_in, w_in, k_in) PengRobinson 78 factory Read more… Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: moles_in (nc) real(kind=pr), intent(in), optional :: ac_in (nc) real(kind=pr), intent(in), optional :: b_in (nc) real(kind=pr), intent(in), optional :: tc_in (nc) real(kind=pr), intent(in), optional :: pc_in (nc) real(kind=pr), intent(in), optional :: w_in (nc) real(kind=pr), intent(in), optional :: k_in (nc) public subroutine SRK_factory (moles_in, ac_in, b_in, tc_in, pc_in, w_in, k_in) SoaveRedlichKwong factory Read more… Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: moles_in (nc) real(kind=pr), intent(in), optional :: ac_in (nc) real(kind=pr), intent(in), optional :: b_in (nc) real(kind=pr), intent(in), optional :: tc_in (nc) real(kind=pr), intent(in), optional :: pc_in (nc) real(kind=pr), intent(in), optional :: w_in (nc) real(kind=pr), intent(in), optional :: k_in (nc) public subroutine aTder (ac, Tc, k, T, a, dadT, dadT2) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: ac real(kind=pr), intent(in) :: Tc real(kind=pr), intent(in) :: k real(kind=pr), intent(in) :: T real(kind=pr), intent(out) :: a real(kind=pr), intent(out) :: dadT real(kind=pr), intent(out) :: dadT2 public subroutine aijTder (ntd, nc, T, aij, daijdT, daijdT2) Arguments Type Intent Optional Attributes Name integer, intent(in) :: ntd integer, intent(in) :: nc real(kind=pr), intent(in) :: T real(kind=pr), intent(out) :: aij (nc,nc) real(kind=pr), intent(out) :: daijdT (nc,nc) real(kind=pr), intent(out) :: daijdT2 (nc,nc) public subroutine ar_rkpr (z, v, t, ar, arv, artv, arv2, Arn, ArVn, ArTn, Arn2) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: z (:) Number of moles real(kind=pr), intent(in) :: v Volume [L] real(kind=pr), intent(in) :: t Temperature [K] real(kind=pr), intent(out) :: ar Residual Helmholtz real(kind=pr), intent(out) :: arv dAr/dV real(kind=pr), intent(out) :: artv dAr2/dTV real(kind=pr), intent(out) :: arv2 dAr2/dV2 real(kind=pr), intent(out) :: Arn (size(z)) dAr/dn real(kind=pr), intent(out) :: ArVn (size(z)) dAr2/dVn real(kind=pr), intent(out) :: ArTn (size(z)) dAr2/dTn real(kind=pr), intent(out) :: Arn2 (size(z),size(z)) dAr2/dn2 public subroutine ar_srkpr (z, v, t, ar, arv, artv, arv2, Arn, ArVn, ArTn, Arn2) Wrapper subroutine to the SRK/PR Residula Helmholtz function to\nuse the general interface Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: z (:) Number of moles real(kind=pr), intent(in) :: v Volume [L] real(kind=pr), intent(in) :: t Temperature [K] real(kind=pr), intent(out) :: ar Residual Helmholtz real(kind=pr), intent(out) :: arv dAr/dV real(kind=pr), intent(out) :: artv dAr2/dTV real(kind=pr), intent(out) :: arv2 dAr2/dV2 real(kind=pr), intent(out) :: Arn (size(z)) dAr/dn real(kind=pr), intent(out) :: ArVn (size(z)) dAr2/dVn real(kind=pr), intent(out) :: ArTn (size(z)) dAr2/dTn real(kind=pr), intent(out) :: Arn2 (size(z),size(z)) dAr2/dn2 public subroutine get_Zc_OMa_OMb (del1, Zc, OMa, OMb) Calculate Zc, OMa and OMb from the delta_1 parameter. Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: del1 (:) delta_1 parameter real(kind=pr), intent(out) :: Zc (:) Critical compressibility factor real(kind=pr), intent(out) :: OMa (:) OMa real(kind=pr), intent(out) :: OMb (:) OMb public subroutine setup (n, nmodel, ntdep, ncomb) Setup the basics variables that describe the model. Arguments Type Intent Optional Attributes Name integer, intent(in) :: n Number of components integer, intent(in) :: nmodel Number of model integer, intent(in) :: ntdep Kij dependant of temperature integer, intent(in) :: ncomb Combining rule","tags":"","loc":"module/legacy_ar_models.html"},{"title":"legacy_thermo_properties – yaeos","text":"Uses yaeos__constants legacy_ar_models Subroutines public subroutine PUREFUG_CALC (nc, icomp, T, P, V, phi) Fugacity of a pure component Arguments Type Intent Optional Attributes Name integer, intent(in) :: nc integer, intent(in) :: icomp real(kind=pr), intent(in) :: T real(kind=pr), intent(in) :: P real(kind=pr), intent(in) :: V real(kind=pr), intent(out) :: phi public subroutine TERMO (nc, mtyp, indic, t, p, rn, v, PHILOG, DLPHIP, DLPHIT, FUGN) Arguments Type Intent Optional Attributes Name integer, intent(in) :: nc Number of components integer, intent(in) :: mtyp Type of root desired (-1 vapor, 1 liquid, 0 lower Gr) integer, intent(in) :: indic Desired element, this should be setted with optionals real(kind=pr), intent(in) :: t Temperature [K] real(kind=pr), intent(in) :: p Pressure [bar] real(kind=pr), intent(in) :: rn (nc) Mixture mole numbers real(kind=pr), intent(out) :: v Volume [L] real(kind=pr), intent(out) :: PHILOG (nc) ln(phi*p) vector real(kind=pr), intent(out), optional :: DLPHIP (nc) ln(phi) Presssure derivative real(kind=pr), intent(out), optional :: DLPHIT (nc) ln(phi) Temp derivative real(kind=pr), intent(out), optional :: FUGN (nc,nc) ln(phi) compositional derivative public recursive subroutine VCALC (ITYP, nc, ntemp, rn, T, P, V) ROUTINE FOR CALCULATION OF VOLUME, GIVEN PRESSURE Arguments Type Intent Optional Attributes Name integer, intent(in) :: ITYP TYPE OF ROOT DESIRED (-1 vapor, 1 liquid, 0 lower Gibbs energy phase) integer, intent(in) :: nc NO. OF COMPONENTS integer, intent(in) :: ntemp 1 if T-derivatives are required real(kind=pr), intent(in) :: rn (nc) FEED MOELS real(kind=pr), intent(in) :: T TEMPERATURE real(kind=pr), intent(in) :: P PRESURE real(kind=pr), intent(out) :: V VOLUME public subroutine zTVTERMO (nc, indic, t, rn, v, p, dpv, PHILOG, DLPHIP, DLPHIT, FUGN) Calculation of lnphi P and derivatives\n rn mixture mole numbers (input)\n t temperature (k) (input)\n v volume (L) (input)\n p pressure (bar) (output)\n PHILOG vector of ln(phi(i) P) (output) 0 < INDIC < 5\n DLPHIT t-derivative of ln(phi(i)) (const P, n) (output) 0 < INDIC = 2 or 4\n DLPHIP P-derivative of ln(phi(i)) (const T, n) (output) 0 < INDIC < 5\n FUGN comp-derivative of ln(phi(i)) (const t & P)(output) 2 < INDIC Read more… Arguments Type Intent Optional Attributes Name integer, intent(in) :: nc integer, intent(in) :: indic real(kind=pr), intent(in) :: t real(kind=pr), intent(in) :: rn (nc) real(kind=pr), intent(in) :: v real(kind=pr), intent(out) :: p real(kind=pr), intent(out) :: dpv real(kind=pr), intent(out) :: PHILOG (nc) real(kind=pr), intent(out) :: DLPHIP (nc) real(kind=pr), intent(out) :: DLPHIT (nc) real(kind=pr), intent(out) :: FUGN (nc,nc)","tags":"","loc":"module/legacy_thermo_properties.html"},{"title":"yaeos__models_ar_cubic_implementations – yaeos","text":"Implemented Cubic Equations of State. PengRobinson76 PengRobinson78 SoaveRedlichKwong RKPR Uses yaeos__models_ar_genericcubic yaeos__constants yaeos__substance Functions public function PengRobinson76 (tc, pc, w, kij, lij) result(model) PengRobinson76. Read more… Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: tc (:) Critical Temperatures [K] real(kind=pr), intent(in) :: pc (:) Critical Pressures [bar] real(kind=pr), intent(in) :: w (:) Acentric Factors real(kind=pr), intent(in), optional :: kij (:,:) matrix real(kind=pr), intent(in), optional :: lij (:,:) matrix Return Value type( CubicEoS ) public function PengRobinson78 (tc, pc, w, kij, lij) result(model) PengRobinson78. Read more… Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: tc (:) Critical Temperatures [K] real(kind=pr), intent(in) :: pc (:) Critical Pressures [bar] real(kind=pr), intent(in) :: w (:) Acentric Factors real(kind=pr), intent(in), optional :: kij (:,:) matrix real(kind=pr), intent(in), optional :: lij (:,:) matrix Return Value type( CubicEoS ) public function RKPR (tc, pc, w, zc, kij, lij, delta_1, k) result(model) RKPR Equation of State Read more… Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: tc (:) Critical Temperature [K] real(kind=pr), intent(in) :: pc (:) Critical Pressure [bar] real(kind=pr), intent(in) :: w (:) Acentric Factor real(kind=pr), intent(in) :: zc (:) Critical compressibility real(kind=pr), intent(in), optional :: kij (:,:) k_{ij} matrix real(kind=pr), intent(in), optional :: lij (:,:) l_{ij} matrix real(kind=pr), intent(in), optional :: delta_1 (:) real(kind=pr), intent(in), optional :: k (:) Return Value type( CubicEoS ) public function SoaveRedlichKwong (tc, pc, w, kij, lij) result(model) SoaveRedlichKwong. Read more… Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: tc (:) Critical temperature [K] real(kind=pr), intent(in) :: pc (:) Critical pressure [bar] real(kind=pr), intent(in) :: w (:) Acentric factor real(kind=pr), intent(in), optional :: kij (:,:) matrix real(kind=pr), intent(in), optional :: lij (:,:) matrix Return Value type( CubicEoS ) Subroutines private subroutine get_OMa_OMb (del1, OMa, OMb) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: del1 (:) real(kind=pr), intent(out) :: OMa (size(del1)) real(kind=pr), intent(out) :: OMb (size(del1))","tags":"","loc":"module/yaeos__models_ar_cubic_implementations.html"},{"title":"yaeos__models_solvers – yaeos","text":"models solvers Set of different specialized solvers for different models Description This module holds specialized solvers for different kind of applications\nand models. Volume solving This module holds the routine volume_michelsen which is a solver for\nvolume that takes advantage over a simple newton on the function of\npressure by solving the function of pressure over the covolume instead,\nwhich solution is limited in the range [0, 1]. This solver requires that\nthe EoS uses the method get_v0 to return the covolume. Examples A basic code example References Uses yaeos__models_ar yaeos__constants Subroutines public subroutine volume_michelsen (eos, n, P, T, V, root_type, max_iters, V0) Volume solver at a given pressure. Read more… Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos real(kind=pr), intent(in) :: n (:) Mixture moles real(kind=pr), intent(in) :: P Pressure [bar] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out) :: V Volume [L] character(len=*), intent(in), optional :: root_type Type of root [“vapor” | “liquid” | “stable”] integer, intent(in), optional :: max_iters Maxiumum number of iterations, defaults to 100 real(kind=pr), intent(in), optional :: V0 Specified initial volume","tags":"","loc":"module/yaeos__models_solvers.html"},{"title":"yaeos__solvers_pressure_equality – yaeos","text":"Solve the pressure equality of a Uses yaeos__models_ar yaeos__constants Subroutines public subroutine pressure_equality_V_beta_xy (model, T, V, beta, x, y, Vx, Vy, P) Solve pressure equality between two phases at a given temperature,\ntotal volume, vapor molar fractions and compositions. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: model real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(in) :: V Total volume [L/mol] real(kind=pr), intent(in) :: beta Molar fraction of light-phase real(kind=pr), intent(in) :: x (:) Molar fractions of heavy-phase real(kind=pr), intent(in) :: y (:) Molar fractions of light-phase real(kind=pr), intent(inout) :: Vx Heavy-phase molar volume [L/mol] real(kind=pr), intent(inout) :: Vy Light-Phase molar volume [L/mol] real(kind=pr), intent(out) :: P Pressure [bar]","tags":"","loc":"module/yaeos__solvers_pressure_equality.html"},{"title":"yaeos__fitting – yaeos","text":"Uses yaeos__models yaeos__constants yaeos__equilibria yaeos__optimizers Abstract Interfaces abstract interface public subroutine model_from_X(problem, X) Function that returns a setted model from the parameters vector Arguments Type Intent Optional Attributes Name class( FittingProblem ), intent(inout) :: problem Fitting problem to optimize real(kind=pr), intent(in) :: X (:) Vector of parameters to fit Derived Types type, public, abstract :: FittingProblem This derived type holds all the relevant information for a parameter\noptimization problem. It keeps the base model structure that will be\noptimized and a procedure get_model_from_X that should reconstruct\nthe model with the desired parameters to optimize. Read more… Components Type Visibility Attributes Name Initial type( EquilibriumState ), public, allocatable :: experimental_points (:) Experimental points to fit class( ArModel ), public, allocatable :: model Residual Helmholtz Model to fit logical, public :: verbose = .false. If true log the fitting process Type-Bound Procedures procedure( model_from_X ), public, deferred :: get_model_from_X Functions public function optimize (X, opt, data) result(y) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(inout) :: X (:) Vector of parameters to fit class( Optimizer ), intent(inout) :: opt Optimizer object, bsaed on the Optimizer class from yaeos__optimizers class( FittingProblem ), intent(inout), optional :: data Fitting problem to optimize Return Value real(kind=pr) Subroutines public subroutine error_function (X, Fobj, dF, func_data) Error function for phase-equilibria optimization. Using two-phase\npoints and an error function of: Read more… Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: X (:) Vector of parameters real(kind=pr), intent(out) :: Fobj Objective function real(kind=pr), intent(out), optional :: dF (:) Gradient of the objective function, only exists to be consistent\nwith the Optimizer class API class(*), intent(inout), optional :: func_data","tags":"","loc":"module/yaeos__fitting.html"},{"title":"hyperdual_mod – yaeos","text":"Hyperdual number definition & type declaration Uses yaeos__constants Interfaces public interface abs public elemental function absHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) public interface acos public elemental function acosHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) public interface asin public elemental function asinHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) public interface assignment (=) public elemental subroutine EqualHyperDualHyperDual (res, inp) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(out) :: res type( hyperdual ), intent(in) :: inp public elemental subroutine EqualHyperDualReal (res, inp) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(out) :: res real(kind=pr), intent(in) :: inp public interface atan public elemental function atanHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) public interface atan2 public elemental function atan2HyperDual (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public interface cos public elemental function cosHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) public interface cosh public elemental function coshHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) public interface exp public elemental function expHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) public interface int public elemental function intHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value integer public interface log public elemental function logHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) public interface log10 public elemental function log10HyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) public interface max public elemental function max_dd (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public elemental function max_ddd (v1, v2, v3) result(v4) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 type( hyperdual ), intent(in) :: v3 Return Value type( hyperdual ) public elemental function max_dr (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 real(kind=pr), intent(in) :: v2 Return Value type( hyperdual ) public elemental function max_rd (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public interface min public elemental function min_dd (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public elemental function min_dr (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 real(kind=pr), intent(in) :: v2 Return Value type( hyperdual ) public elemental function min_rd (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public interface nint public elemental function nintHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value integer public interface operator (*) public elemental function MultiplyHyperDualHyperDual (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public elemental function MultiplyHyperDualReal (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 real(kind=pr), intent(in) :: v2 Return Value type( hyperdual ) public elemental function MultiplyRealHyperDual (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public elemental function MultiplyHyperDualInt (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 integer, intent(in) :: v2 Return Value type( hyperdual ) public elemental function MultiplyIntHyperDual (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name integer, intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public interface operator (**) public elemental function PowerHyperDualInt (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 integer, intent(in) :: v2 Return Value type( hyperdual ) public elemental function PowerHyperDualHyperDual (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public elemental function PowerHyperDualReal (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 real(kind=pr), intent(in) :: v2 Return Value type( hyperdual ) public interface operator (+) public elemental function PlusHyperDualHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) public interface operator (+) public elemental function AddHyperDualHyperDual (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public elemental function AddHyperDualReal (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 real(kind=pr), intent(in) :: v2 Return Value type( hyperdual ) public elemental function AddRealHyperDual (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public interface operator (-) public elemental function MinusHyperDualHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) public interface operator (-) public elemental function SubtractHyperDualHyperDual (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public elemental function SubtractHyperDualReal (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 real(kind=pr), intent(in) :: v2 Return Value type( hyperdual ) public elemental function SubtractRealHyperDual (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public interface operator (.eq.) public function eq_dd (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public elemental function eq_dr (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs real(kind=pr), intent(in) :: rhs Return Value logical public elemental function eq_rd (lhs, rhs) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public function eq_di (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs integer, intent(in) :: rhs Return Value logical public function eq_id (lhs, rhs) Arguments Type Intent Optional Attributes Name integer, intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public interface operator (.ge.) public function ge_dd (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public function ge_dr (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs real(kind=pr), intent(in) :: rhs Return Value logical public function ge_rd (lhs, rhs) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public function ge_di (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs integer, intent(in) :: rhs Return Value logical public function ge_id (lhs, rhs) Arguments Type Intent Optional Attributes Name integer, intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public interface operator (.gt.) public function gt_dd (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public function gt_dr (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs real(kind=pr), intent(in) :: rhs Return Value logical public function gt_rd (lhs, rhs) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public function gt_di (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs integer, intent(in) :: rhs Return Value logical public function gt_id (lhs, rhs) Arguments Type Intent Optional Attributes Name integer, intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public interface operator (.le.) public function le_dd (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public function le_dr (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs real(kind=pr), intent(in) :: rhs Return Value logical public function le_rd (lhs, rhs) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public function le_di (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs integer, intent(in) :: rhs Return Value logical public function le_id (lhs, rhs) Arguments Type Intent Optional Attributes Name integer, intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public interface operator (.lt.) public function lt_dd (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public function lt_dr (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs real(kind=pr), intent(in) :: rhs Return Value logical public function lt_rd (lhs, rhs) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public function lt_di (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs integer, intent(in) :: rhs Return Value logical public function lt_id (lhs, rhs) Arguments Type Intent Optional Attributes Name integer, intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public interface operator (.ne.) public function ne_dd (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public function ne_dr (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs real(kind=pr), intent(in) :: rhs Return Value logical public function ne_rd (lhs, rhs) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public function ne_di (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs integer, intent(in) :: rhs Return Value logical public function ne_id (lhs, rhs) Arguments Type Intent Optional Attributes Name integer, intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public interface operator (/) public elemental function DivideHyperDualHyperDual (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public elemental function DivideHyperDualReal (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 real(kind=pr), intent(in) :: v2 Return Value type( hyperdual ) public elemental function DivideRealHyperDual (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public interface real public elemental function realHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value real(kind=pr) public interface sign public elemental function sign_dd (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public elemental function sign_dr (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 real(kind=pr), intent(in) :: v2 Return Value type( hyperdual ) public elemental function sign_rd (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public interface sin public elemental function sinHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) public interface sinh public elemental function sinhHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) public interface sqrt public elemental function sqrtHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) public interface sum public pure function SumHyperDual (v1, mask) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 (:) logical, intent(in), optional :: mask (:) Return Value type( hyperdual ) public pure function SumHyperDual2 (v1, dim) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 (:,:) integer, intent(in) :: dim Return Value type( hyperdual ), allocatable, (:) public interface tan public elemental function tanHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) public interface tanh public elemental function tanhHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) Derived Types type, public, bind(c) :: hyperdual Components Type Visibility Attributes Name Initial real(kind=pr), public :: f0 = 0 real part of the hyperdual number real(kind=pr), public :: f1 = 0 \\f$\\varepsilon_1\\f$-part of the hyperdual number real(kind=pr), public :: f12 = 0 \\f$\\varepsilon_1\\varepsilon_2\\f$-part of the real(kind=pr), public :: f2 = 0 \\f$\\varepsilon_2\\f$-part of the hyperdual number Functions public elemental function AddHyperDualHyperDual (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public elemental function AddHyperDualReal (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 real(kind=pr), intent(in) :: v2 Return Value type( hyperdual ) public elemental function AddRealHyperDual (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public elemental function DivideHyperDualHyperDual (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public elemental function DivideHyperDualReal (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 real(kind=pr), intent(in) :: v2 Return Value type( hyperdual ) public elemental function DivideRealHyperDual (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public elemental function MinusHyperDualHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) public elemental function MultiplyHyperDualHyperDual (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public elemental function MultiplyHyperDualInt (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 integer, intent(in) :: v2 Return Value type( hyperdual ) public elemental function MultiplyHyperDualReal (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 real(kind=pr), intent(in) :: v2 Return Value type( hyperdual ) public elemental function MultiplyIntHyperDual (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name integer, intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public elemental function MultiplyRealHyperDual (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public elemental function PlusHyperDualHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) public elemental function PowerHyperDualHyperDual (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public elemental function PowerHyperDualInt (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 integer, intent(in) :: v2 Return Value type( hyperdual ) public elemental function PowerHyperDualReal (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 real(kind=pr), intent(in) :: v2 Return Value type( hyperdual ) public elemental function SubtractHyperDualHyperDual (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public elemental function SubtractHyperDualReal (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 real(kind=pr), intent(in) :: v2 Return Value type( hyperdual ) public elemental function SubtractRealHyperDual (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public pure function SumHyperDual (v1, mask) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 (:) logical, intent(in), optional :: mask (:) Return Value type( hyperdual ) public pure function SumHyperDual2 (v1, dim) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 (:,:) integer, intent(in) :: dim Return Value type( hyperdual ), allocatable, (:) public elemental function absHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) public elemental function acosHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) public elemental function asinHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) public elemental function atan2HyperDual (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public elemental function atanHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) public elemental function cosHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) public elemental function coshHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) public function eq_dd (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public function eq_di (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs integer, intent(in) :: rhs Return Value logical public elemental function eq_dr (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs real(kind=pr), intent(in) :: rhs Return Value logical public function eq_id (lhs, rhs) Arguments Type Intent Optional Attributes Name integer, intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public elemental function eq_rd (lhs, rhs) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public elemental function expHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) public function ge_dd (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public function ge_di (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs integer, intent(in) :: rhs Return Value logical public function ge_dr (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs real(kind=pr), intent(in) :: rhs Return Value logical public function ge_id (lhs, rhs) Arguments Type Intent Optional Attributes Name integer, intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public function ge_rd (lhs, rhs) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public function gt_dd (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public function gt_di (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs integer, intent(in) :: rhs Return Value logical public function gt_dr (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs real(kind=pr), intent(in) :: rhs Return Value logical public function gt_id (lhs, rhs) Arguments Type Intent Optional Attributes Name integer, intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public function gt_rd (lhs, rhs) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public elemental function intHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value integer public function le_dd (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public function le_di (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs integer, intent(in) :: rhs Return Value logical public function le_dr (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs real(kind=pr), intent(in) :: rhs Return Value logical public function le_id (lhs, rhs) Arguments Type Intent Optional Attributes Name integer, intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public function le_rd (lhs, rhs) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public elemental function log10HyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) public elemental function logHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) public function lt_dd (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public function lt_di (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs integer, intent(in) :: rhs Return Value logical public function lt_dr (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs real(kind=pr), intent(in) :: rhs Return Value logical public function lt_id (lhs, rhs) Arguments Type Intent Optional Attributes Name integer, intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public function lt_rd (lhs, rhs) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public elemental function max_dd (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public elemental function max_ddd (v1, v2, v3) result(v4) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 type( hyperdual ), intent(in) :: v3 Return Value type( hyperdual ) public elemental function max_dr (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 real(kind=pr), intent(in) :: v2 Return Value type( hyperdual ) public elemental function max_rd (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public elemental function min_dd (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public elemental function min_dr (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 real(kind=pr), intent(in) :: v2 Return Value type( hyperdual ) public elemental function min_rd (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public function ne_dd (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public function ne_di (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs integer, intent(in) :: rhs Return Value logical public function ne_dr (lhs, rhs) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: lhs real(kind=pr), intent(in) :: rhs Return Value logical public function ne_id (lhs, rhs) Arguments Type Intent Optional Attributes Name integer, intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public function ne_rd (lhs, rhs) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: lhs type( hyperdual ), intent(in) :: rhs Return Value logical public elemental function nintHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value integer public elemental function realHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value real(kind=pr) public elemental function sign_dd (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public elemental function sign_dr (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 real(kind=pr), intent(in) :: v2 Return Value type( hyperdual ) public elemental function sign_rd (v1, v2) result(v3) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: v1 type( hyperdual ), intent(in) :: v2 Return Value type( hyperdual ) public elemental function sinHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) public elemental function sinhHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) public elemental function sqrtHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) public elemental function tanHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) public elemental function tanhHyperDual (v1) result(v2) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(in) :: v1 Return Value type( hyperdual ) Subroutines public elemental subroutine EqualHyperDualHyperDual (res, inp) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(out) :: res type( hyperdual ), intent(in) :: inp public elemental subroutine EqualHyperDualReal (res, inp) Arguments Type Intent Optional Attributes Name type( hyperdual ), intent(out) :: res real(kind=pr), intent(in) :: inp","tags":"","loc":"module/hyperdual_mod.html"},{"title":"yaeos__equilibria_equilibrium_state – yaeos","text":"Uses yaeos__constants Derived Types type, public :: EquilibriumState Description of a two-phase equilibria state. Read more… Components Type Visibility Attributes Name Initial real(kind=pr), public :: P Pressure [bar] real(kind=pr), public :: T Temperature [K] real(kind=pr), public :: Vx Heavy-phase volume [L/mol] real(kind=pr), public :: Vy Light-phase volume [L/mol] real(kind=pr), public :: beta Mole fraction of light-phase integer, public :: iters = 0 Iterations needed to reach the state character(len=14), public :: kind Kind of point [“bubble”, “dew”, “liquid-liquid”, “split”] real(kind=pr), public, allocatable :: x (:) Heavy-phase molar fractions real(kind=pr), public, allocatable :: y (:) Light-phase molar fractions Type-Bound Procedures generic, public :: write (FORMATTED) => write procedure, private, pass :: write => write_EquilibriumState Subroutines public subroutine write_EquilibriumState (eq, unit, iotype, v_list, iostat, iomsg) Arguments Type Intent Optional Attributes Name class( EquilibriumState ), intent(in) :: eq integer, intent(in) :: unit character(len=*), intent(in) :: iotype integer, intent(in) :: v_list (:) integer, intent(out) :: iostat character(len=*), intent(inout) :: iomsg","tags":"","loc":"module/yaeos__equilibria_equilibrium_state.html"},{"title":"yaeos__consistency – yaeos","text":"yaeos__consistency Subroutine to evaluate the consistency of thermodynamic models. Description Tools to evaluate the consistency of and models. This\nmodule also provides subroutines for numerical evaluations of and derivatives using central finite differences. The purpose of the\nmodule is to assist in the development of new models and ensure the\naccuracy of the derivatives implementation. Examples For detailed explanations and examples of each consistency test, please\nrefer to the API documentation of each submodule. consistency tests: yaeos__consistency_armodel consistency tests: yaeos__consistency_gemodel References Michelsen, M. L., & Mollerup, J. M. (2007). Thermodynamic models:\nFundamentals & computational aspects (2. ed). Tie-Line Publications. Uses yaeos__consistency_armodel yaeos__consistency_gemodel","tags":"","loc":"module/yaeos__consistency.html"},{"title":"yaeos__tapenade_ar_api – yaeos","text":"Module that wraps tapenade generated routines to calculate !\nAr and derivatives. Uses yaeos__models_ar yaeos__constants Abstract Interfaces abstract interface private subroutine tapenade_ar(model, n, v, t, arval) Arguments Type Intent Optional Attributes Name class( ArModelTapenade ), intent(in) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: v real(kind=pr), intent(in) :: t real(kind=pr), intent(out) :: arval abstract interface private subroutine tapenade_ar_b(model, n, nb, v, vb, t, tb, arval, arvalb) Arguments Type Intent Optional Attributes Name class( ArModelTapenade ), intent(in) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr) :: nb (:) real(kind=pr), intent(in) :: v real(kind=pr) :: vb real(kind=pr), intent(in) :: t real(kind=pr) :: tb real(kind=pr) :: arval real(kind=pr) :: arvalb abstract interface private subroutine tapenade_ar_d(model, n, nd, v, vd, t, td, arval, arvald) Arguments Type Intent Optional Attributes Name class( ArModelTapenade ), intent(in) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: nd (:) real(kind=pr), intent(in) :: v real(kind=pr), intent(in) :: vd real(kind=pr), intent(in) :: t real(kind=pr), intent(in) :: td real(kind=pr), intent(out) :: arval real(kind=pr), intent(out) :: arvald abstract interface private subroutine tapenade_ar_d_b(model, n, nb, nd, ndb, v, vb, vd, vdb, t, tb, td, tdb, arval, arvalb, arvald, arvaldb) Arguments Type Intent Optional Attributes Name class( ArModelTapenade ), intent(in) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr) :: nb (:) real(kind=pr), intent(in) :: nd (:) real(kind=pr) :: ndb (:) real(kind=pr), intent(in) :: v real(kind=pr) :: vb real(kind=pr), intent(in) :: vd real(kind=pr) :: vdb real(kind=pr), intent(in) :: t real(kind=pr) :: tb real(kind=pr), intent(in) :: td real(kind=pr) :: tdb real(kind=pr) :: arval real(kind=pr) :: arvalb real(kind=pr) :: arvald real(kind=pr) :: arvaldb abstract interface private subroutine tapenade_ar_d_d(model, n, nd, v, vd0, vd, t, td0, td, arval, arvald0, arvald, arvaldd) Arguments Type Intent Optional Attributes Name class( ArModelTapenade ), intent(in) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: nd (:) real(kind=pr), intent(in) :: v real(kind=pr), intent(in) :: vd0 real(kind=pr), intent(in) :: vd real(kind=pr), intent(in) :: t real(kind=pr), intent(in) :: td0 real(kind=pr), intent(in) :: td real(kind=pr), intent(out) :: arval real(kind=pr), intent(out) :: arvald0 real(kind=pr), intent(out) :: arvald real(kind=pr), intent(out) :: arvaldd abstract interface private pure function tapenade_v0(model, n, p, t) Arguments Type Intent Optional Attributes Name class( ArModelTapenade ), intent(in) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: p real(kind=pr), intent(in) :: t Return Value real(kind=pr) Derived Types type, public, abstract, extends( ArModel ) :: ArModelTapenade Components Type Visibility Attributes Name Initial type( Substances ), public :: components Substances contained in the module character(len=:), public, allocatable :: name Name of the model Type-Bound Procedures procedure, public :: Cp_residual_vt procedure, public :: Cv_residual_vt procedure( tapenade_ar ), public, deferred :: ar procedure( tapenade_ar_b ), public, deferred :: ar_b procedure( tapenade_ar_d ), public, deferred :: ar_d procedure( tapenade_ar_d_b ), public, deferred :: ar_d_b procedure( tapenade_ar_d_d ), public, deferred :: ar_d_d procedure, public :: enthalpy_residual_vt procedure, public :: entropy_residual_vt procedure, public :: get_v0 procedure, public :: gibbs_residual_vt => gibbs_residual_VT procedure, public :: lnphi_pt => fugacity_pt procedure, public :: lnphi_vt => fugacity_vt procedure, public :: pressure procedure, public :: residual_helmholtz procedure( tapenade_v0 ), public, deferred :: v0 procedure, public :: volume Functions private function get_v0 (self, n, p, t) Arguments Type Intent Optional Attributes Name class( ArModelTapenade ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: p real(kind=pr), intent(in) :: t Return Value real(kind=pr) Subroutines private subroutine residual_helmholtz (self, n, v, t, Ar, ArV, ArT, ArTV, ArV2, ArT2, Arn, ArVn, ArTn, Arn2) Residual Helmholtz model generic interface Arguments Type Intent Optional Attributes Name class( ArModelTapenade ), intent(in) :: self real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: v real(kind=pr), intent(in) :: t real(kind=pr), intent(out), optional :: Ar real(kind=pr), intent(out), optional :: ArV real(kind=pr), intent(out), optional :: ArT real(kind=pr), intent(out), optional :: ArTV real(kind=pr), intent(out), optional :: ArV2 real(kind=pr), intent(out), optional :: ArT2 real(kind=pr), intent(out), optional, dimension(size(n)) :: Arn real(kind=pr), intent(out), optional, dimension(size(n)) :: ArVn real(kind=pr), intent(out), optional, dimension(size(n)) :: ArTn real(kind=pr), intent(out), optional :: Arn2 (size(n),size(n))","tags":"","loc":"module/yaeos__tapenade_ar_api.html"},{"title":"yaeos__equilibria_flash – yaeos","text":"Uses yaeos__models yaeos__solvers_pressure_equality yaeos__equilibria_rachford_rice yaeos__equilibria_auxiliar yaeos__equilibria_equilibrium_state yaeos__constants Functions public function flash (model, z, t, v_spec, p_spec, k0, iters) Flash algorithm using sucessive substitutions. Read more… Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: model Thermodynamic model real(kind=pr), intent(in) :: z (:) Global composition (molar fractions) real(kind=pr), intent(in) :: t Temperature [K] real(kind=pr), intent(in), optional :: v_spec Specified Volume [L/mol] real(kind=pr), intent(in), optional :: p_spec Specified Pressure [bar] real(kind=pr), intent(in), optional :: k0 (:) Initial K factors (y/x) integer, intent(out), optional :: iters Number of iterations Return Value type( EquilibriumState )","tags":"","loc":"module/yaeos__equilibria_flash.html"},{"title":"auxiliar_functions – yaeos","text":"Uses yaeos__constants Functions public function allclose (x, y, atol) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: x (:) real(kind=pr), intent(in) :: y (:) real(kind=pr), intent(in) :: atol Return Value logical public elemental function rel_error (x, y) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: x real(kind=pr), intent(in) :: y Return Value real(kind=pr)","tags":"","loc":"module/auxiliar_functions.html"},{"title":"yaeos__equilibria_pure_psat – yaeos","text":"Module used to calculate the saturation pressure of pure components at\na given temperature. Uses yaeos__models yaeos__constants Functions public function Psat (eos, ncomp, T) Calculation of saturation pressure of a pure component using the\nsecant method. Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Model that will be used integer, intent(in) :: ncomp Number of component in the mixture from which the saturation pressure\nwill be calculated real(kind=pr), intent(in) :: T Temperature [K] Return Value real(kind=pr)","tags":"","loc":"module/yaeos__equilibria_pure_psat.html"},{"title":"yaeos__math_continuation – yaeos","text":"Implementation of Algower’s numerical continuation method. Uses yaeos__math_linalg yaeos__constants Abstract Interfaces abstract interface public subroutine continuation_function(X, ns, S, F, dF, dFdS) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: X (:) integer, intent(in) :: ns real(kind=pr), intent(in) :: S real(kind=pr), intent(out) :: F (:) real(kind=pr), intent(out) :: dF (:,:) real(kind=pr), intent(out) :: dFdS (:) abstract interface public subroutine continuation_solver(fun, iters, X, ns, S, dS, dXdS, point, max_iters, F, df, dfds, tol) Solver to solve a point during numerical contination. Arguments Type Intent Optional Attributes Name procedure( continuation_function ) :: fun Function to solve integer, intent(out) :: iters Number of iterations needed real(kind=pr), intent(inout) :: X (:) Variables vector integer, intent(in) :: ns Specification number real(kind=pr), intent(in) :: S Specification value real(kind=pr), intent(in) :: dS Delta spec real(kind=pr), intent(in) :: dXdS (:) integer, intent(in) :: point Point number integer, intent(in) :: max_iters Maximum iterations real(kind=pr), intent(out) :: F (:) Function values at solved point real(kind=pr), intent(out) :: df (:,:) Jacobian values real(kind=pr), intent(out) :: dfds (:) dFdS real(kind=pr), intent(in) :: tol Solver tolerance abstract interface public function continuation_stopper(X, ns, S, dS, dXdS, iterations) Function that returns true if the method should stop Arguments Type Intent Optional Attributes Name real(kind=pr), intent(inout) :: X (:) Vector of variables integer, intent(inout) :: ns Position of specified variable real(kind=pr), intent(inout) :: S Specification variable value real(kind=pr), intent(inout) :: dS Step of specification in the method real(kind=pr), intent(inout) :: dXdS (:) integer, intent(in) :: iterations Iterations needed to converge point Return Value logical abstract interface public subroutine process(X, ns, S, dS, dXdS, iterations) Subroutine to make variation in the method after a point converged Arguments Type Intent Optional Attributes Name real(kind=pr), intent(inout) :: X (:) Vector of variables integer, intent(inout) :: ns Position of specified variable real(kind=pr), intent(inout) :: S Specification variable value real(kind=pr), intent(inout) :: dS Step of specification in the method real(kind=pr), intent(inout) :: dXdS (:) integer, intent(in) :: iterations Iterations needed to converge point Derived Types type, public :: ContinuationVariable Components Type Visibility Attributes Name Initial real(kind=pr), public :: S real(kind=pr), public, allocatable :: X (:) real(kind=pr), public :: dS integer, public :: ns Functions public function continuation (f, X0, ns0, S0, dS0, max_points, solver_tol, update_specification, postprocess, solver, stop) result(XS) Numerical continuation of a function. Read more… Arguments Type Intent Optional Attributes Name procedure( continuation_function ) :: f Function to trace real(kind=pr), intent(in) :: X0 (:) Initial point integer, intent(in) :: ns0 Initial specification real(kind=pr), intent(in) :: S0 Initial specification value real(kind=pr), intent(in) :: dS0 Initial integer, intent(in) :: max_points Maximum number of points to trace real(kind=pr), intent(in) :: solver_tol Point solver tolerance procedure( process ), optional :: update_specification Procedure to select the new specification and define the next step\n(\\DeltaS)\\, defaults to: Read more… procedure( process ), optional :: postprocess Any kind of postprocess that could be done after defining the\nnext step procedure( continuation_solver ), optional :: solver Solver procedures, uses Newton-Raphson by default procedure( continuation_stopper ), optional :: stop Stopping procedure Return Value real(kind=pr), (max_points,size(X0)) Subroutines public subroutine full_newton (fun, iters, X, ns, S, dS, dXdS, point, max_iters, F, df, dfds, tol) Subroutine to solve a point. Read more… Arguments Type Intent Optional Attributes Name procedure( continuation_function ) :: fun Function to solve integer, intent(out) :: iters Number of iterations needed real(kind=pr), intent(inout) :: X (:) Variables vector integer, intent(in) :: ns real(kind=pr), intent(in) :: S real(kind=pr), intent(in) :: dS real(kind=pr), intent(in) :: dXdS (:) integer, intent(in) :: point integer, intent(in) :: max_iters Maximum iterations real(kind=pr), intent(out) :: F (:) Function values at solved point real(kind=pr), intent(out) :: df (:,:) Jacobian values real(kind=pr), intent(out) :: dfds (:) dFdS real(kind=pr), intent(in) :: tol","tags":"","loc":"module/yaeos__math_continuation.html"},{"title":"yaeos__models_ge_NRTL – yaeos","text":"Uses yaeos__tapenade_interfaces yaeos__tapenade_ge_api yaeos__constants Interfaces public interface NRTL public function init (a, b, c) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: a (:,:) real(kind=pr), intent(in) :: b (:,:) real(kind=pr), intent(in) :: c (:,:) Return Value type( NRTL ) Derived Types type, public, extends( GeModelTapenade ) :: NRTL Non-Random-Two-Liquid model Read more… Components Type Visibility Attributes Name Initial real(kind=pr), public, allocatable :: a (:,:) A_{ij} matrix real(kind=pr), public, allocatable :: b (:,:) B_{ij} matrix real(kind=pr), public, allocatable :: c (:,:) C_{ij} matrix type( Substances ), public :: components Substances contained in the module Constructor public\n\n \n function init (a, b, c) Type-Bound Procedures procedure, public :: excess_gibbs procedure, public :: ge => EXCESS_GIBBS procedure, public :: ge_b => EXCESS_GIBBS_B procedure, public :: ge_d => EXCESS_GIBBS_D procedure, public :: ge_d_b => EXCESS_GIBBS_D_B procedure, public :: ge_d_d => EXCESS_GIBBS_D_D procedure, public :: ln_activity_coefficient Functions public function init (a, b, c) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: a (:,:) real(kind=pr), intent(in) :: b (:,:) real(kind=pr), intent(in) :: c (:,:) Return Value type( NRTL ) Subroutines public subroutine EXCESS_GIBBS (model, n, t, ge) Arguments Type Intent Optional Attributes Name class( NRTL ) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: t real(kind=pr), intent(out) :: ge public subroutine EXCESS_GIBBS_B (model, n, nb, t, tb, ge, geb) Arguments Type Intent Optional Attributes Name class( NRTL ) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr) :: nb (:) real(kind=pr), intent(in) :: t real(kind=pr) :: tb real(kind=pr) :: ge real(kind=pr) :: geb public subroutine EXCESS_GIBBS_D (model, n, nd, t, td, ge, ged) Arguments Type Intent Optional Attributes Name class( NRTL ) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: nd (:) real(kind=pr), intent(in) :: t real(kind=pr), intent(in) :: td real(kind=pr), intent(out) :: ge real(kind=pr), intent(out) :: ged public subroutine EXCESS_GIBBS_D_B (model, n, nb, nd, ndb, t, tb, td, tdb, ge, geb, ged, gedb) Arguments Type Intent Optional Attributes Name class( NRTL ) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr) :: nb (:) real(kind=pr), intent(in) :: nd (:) real(kind=pr) :: ndb (:) real(kind=pr), intent(in) :: t real(kind=pr) :: tb real(kind=pr), intent(in) :: td real(kind=pr) :: tdb real(kind=pr) :: ge real(kind=pr) :: geb real(kind=pr) :: ged real(kind=pr) :: gedb public subroutine EXCESS_GIBBS_D_D (model, n, nd, t, td0, td, ge, ged0, ged, gedd) Arguments Type Intent Optional Attributes Name class( NRTL ) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: nd (:) real(kind=pr), intent(in) :: t real(kind=pr), intent(in) :: td0 real(kind=pr), intent(in) :: td real(kind=pr), intent(out) :: ge real(kind=pr), intent(out) :: ged0 real(kind=pr), intent(out) :: ged real(kind=pr), intent(out) :: gedd public subroutine EXCESS_GIBBS_D_D_D (model, n, nd, t, td1, td0, td, ge, ged1, ged0, ged0d, ged, gedd0, gedd, geddd) Arguments Type Intent Optional Attributes Name class( NRTL ) :: model real(kind=pr), intent(in) :: n (:) real(kind=pr), intent(in) :: nd (:) real(kind=pr), intent(in) :: t real(kind=pr), intent(in) :: td1 real(kind=pr), intent(in) :: td0 real(kind=pr), intent(in) :: td real(kind=pr), intent(out) :: ge real(kind=pr), intent(out) :: ged1 real(kind=pr), intent(out) :: ged0 real(kind=pr), intent(out) :: ged0d real(kind=pr), intent(out) :: ged real(kind=pr), intent(out) :: gedd0 real(kind=pr), intent(out) :: gedd real(kind=pr), intent(out) :: geddd","tags":"","loc":"module/yaeos__models_ge_nrtl.html"},{"title":"yaeos__math – yaeos","text":"Mathematical methods for yaeos Description This module provides all the relevant mathematical functions used in this\nlibrary. Most important ones are: newton: Newton solving method solve_system: Solving linear system Ax = b continuation: Continuation method for line tracing Examples Squared error calculation use yaeos__math , only : sq_error real ( pr ) :: x = 2.5 , y = 3.0 , error print * , sq_error ( 2.5 , 3.0 ) ------------------------------------ use yaeos__math , only : sq_error real ( pr ) :: x = [ 2.5 , 5.0 ], y = [ 3.0 , 4.5 ], error ! It also works with arrays print * , sq_error ( x , y ) Uses yaeos__math_linalg yaeos__constants yaeos__math_continuation Interfaces public interface newton public subroutine newton_1d (f, x, tol, max_iters) Arguments Type Intent Optional Attributes Name procedure( f_1d ) :: f real(kind=pr), intent(inout) :: x real(kind=pr), intent(in) :: tol integer, intent(in) :: max_iters Abstract Interfaces abstract interface public subroutine f_1d(x, f, df) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: x real(kind=pr), intent(out) :: f real(kind=pr), intent(out) :: df Functions public function dx_to_dn (x, dx) result(dn) Convert the mole fraction derivatives of a quantity (calculated\nso they do not sum to 1) to mole number derivatives (where the mole\nfractions do sum to one). Requires the derivatives and the mole fractions\nof the mixture.\nFrom https://chemicals.readthedocs.io/chemicals.utils.html?highlight=dxs_to_dns#chemicals.utils.dxs_to_dns Read more… Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: x (:) real(kind=pr), intent(in) :: dx (:) Return Value real(kind=pr), (size(x)) public elemental function sq_error (exp, pred) … Read more… Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: exp real(kind=pr), intent(in) :: pred Return Value real(kind=pr) Subroutines public subroutine newton_1d (f, x, tol, max_iters) Arguments Type Intent Optional Attributes Name procedure( f_1d ) :: f real(kind=pr), intent(inout) :: x real(kind=pr), intent(in) :: tol integer, intent(in) :: max_iters","tags":"","loc":"module/yaeos__math.html"},{"title":"yaeos__consistency_armodel – yaeos","text":"yaeos__consistency_armodel Consistency checks of Helmholtz free energy models ( ArModel ). Description This module contains tools to validate the analityc derivatives of\nimplmented Helmholtz free energy models ( ArModel ). Also, allows to\nevaluate the consistency tests described in Thermodynamic Models:\nFundamentals & Computational Aspects 2 ed. by Michelsen and Mollerup\nChapter 2 section 3. Available tools: numeric_ar_derivatives : From an instantiated ArModel evaluate\nall the Helmholtz free energy derivatives from the central finite\ndifference method. ar_consistency : From an instantiated ArModel evaluate all the\nMichelsen and Mollerup consistency tests. References Michelsen, M. L., & Mollerup, J. M. (2007). Thermodynamic models:\nFundamentals & computational aspects (2. ed). Tie-Line Publications. Uses yaeos__models_ar yaeos__constants Subroutines public subroutine ar_consistency (eos, n, V, T, eq31, eq33, eq34, eq36, eq37) models consistency tests. Read more… Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Equation of state real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: V Volume [L] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out), optional :: eq31 MM Eq. 31 real(kind=pr), intent(out), optional :: eq33 (size(n),size(n)) MM Eq. 33 real(kind=pr), intent(out), optional :: eq34 (size(n)) MM Eq. 34 real(kind=pr), intent(out), optional :: eq36 MM Eq. 36 real(kind=pr), intent(out), optional :: eq37 MM Eq. 37 public subroutine numeric_ar_derivatives (eos, n, V, T, d_n, d_v, d_t, Ar, ArV, ArT, Arn, ArV2, ArT2, ArTV, ArVn, ArTn, Arn2) Evaluate the Helmholtz derivatives with central finite difference. Read more… Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: eos Equation of state real(kind=pr), intent(in) :: n (:) Moles number vector real(kind=pr), intent(in) :: V Volume [L] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(in) :: d_n Moles finite difference step real(kind=pr), intent(in) :: d_v Volume finite difference step real(kind=pr), intent(in) :: d_t Temperature finite difference step real(kind=pr), intent(out) :: Ar Residual Helmoltz energy real(kind=pr), intent(out), optional :: ArV real(kind=pr), intent(out), optional :: ArT real(kind=pr), intent(out), optional :: Arn (size(n)) real(kind=pr), intent(out), optional :: ArV2 real(kind=pr), intent(out), optional :: ArT2 real(kind=pr), intent(out), optional :: ArTV real(kind=pr), intent(out), optional :: ArVn (size(n)) real(kind=pr), intent(out), optional :: ArTn (size(n)) real(kind=pr), intent(out), optional :: Arn2 (size(n),size(n))","tags":"","loc":"module/yaeos__consistency_armodel.html"},{"title":"yaeos__phase_equilibria_stability – yaeos","text":"Phase Stability module Phase stability related calculations. Description Contains the basics rotuines to make phase stability analysis for\nphase-equilibria detection. tpd(model, z, w, P, T) : reduced Tangent-Plane-Distance min_tpd(model, z, P, T, mintpd, w) : Find minimal tpd for a multicomponent mixture Examples ! Obtain the minimal tpd for a binary mixture at z_1 = 0.13 model = PengRobinson76 ( tc , pc , ac , kij , lij ) z = [ 0.13 , 1 - 0.13 ] w = [ 0.1 , 0.9 ] P = 4 5.6_pr T = 19 0._pr z = z / sum ( z ) ----------------------------------------------- References Thermodynamic Models: Fundamental and Computational Aspects, Michael L.\nMichelsen, Jørgen M. Mollerup. Tie-Line Publications, Denmark (2004) doi Uses yaeos__models_ar yaeos__constants Derived Types type, private :: TMOptimizeData Data structure to hold the data for the min_tpd optimization Components Type Visibility Attributes Name Initial real(kind=pr), public :: P real(kind=pr), public :: T real(kind=pr), public, allocatable :: di (:) class( ArModel ), public, pointer :: model real(kind=pr), public, allocatable :: z (:) Functions public function tm (model, z, w, P, T, d, dtpd) Michelsen’s modified function, . Read more… Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: model Thermodynamic model real(kind=pr), intent(in) :: z (:) Feed composition real(kind=pr), intent(in) :: w (:) Test-phase mole numbers vector real(kind=pr), intent(in) :: P Pressure [bar] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(in), optional :: d (:) vector real(kind=pr), intent(out), optional :: dtpd (:) Return Value real(kind=pr) Subroutines public subroutine min_tpd (model, z, P, T, mintpd, w, all_minima) Arguments Type Intent Optional Attributes Name class( ArModel ), target :: model Thermodynamic model real(kind=pr), intent(in) :: z (:) Feed composition real(kind=pr), intent(in) :: P Pressure [bar] real(kind=pr), intent(in) :: T Temperature [K] real(kind=pr), intent(out) :: mintpd Minimal value of real(kind=pr), intent(out) :: w (:) Trial composition real(kind=pr), intent(out), optional :: all_minima (:,:) All the found minima public subroutine min_tpd_to_optimize (X, F, dF, data) Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: X (:) real(kind=pr), intent(out) :: F real(kind=pr), intent(out), optional :: dF (:) class(*), intent(inout), optional :: data","tags":"","loc":"module/yaeos__phase_equilibria_stability.html"},{"title":"yaeos__equilibria_boundaries_phase_envelopes_px – yaeos","text":"Phase boundaries line on the plane calculation procedures. Uses yaeos__equilibria_equilibrium_state yaeos__models yaeos__constants yaeos__math_continuation Variables Type Visibility Attributes Name Initial real(kind=pr), private :: Vy Incipient phase volume [L/mol] real(kind=pr), private :: Vz Main phase volume [L/mol] Derived Types type, public :: CriticalPoint Critical point Components Type Visibility Attributes Name Initial real(kind=pr), public :: P Pressure [bar] real(kind=pr), public :: alpha type, public :: PXEnvel2 Two-phase PX envelope.\nPhase boundary line of a fluid at constant temperature\nwith variation in composition. Components Type Visibility Attributes Name Initial real(kind=pr), public, allocatable :: alpha (:) Second fluid molar fraction type( CriticalPoint ), public, allocatable :: cps (:) Critical points found along the line. type( EquilibriumState ), public, allocatable :: points (:) Each point through the line. real(kind=pr), public, allocatable :: z0 (:) Original fluid composition real(kind=pr), public, allocatable :: z_inj (:) Second fluid composition Functions public function px_envelope_2ph (model, z0, alpha0, z_injection, first_point, points, iterations, delta_0, specified_variable_0, solver, stop_conditions) result(envelopes) PX two-phase envelope calculation procedure. Read more… Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: model Thermodyanmic model real(kind=pr), intent(in) :: z0 (:) Vector of molar fractions of the global composition (main phase) real(kind=pr), intent(in) :: alpha0 First point of real(kind=pr), intent(in) :: z_injection (:) Vector of molar fractions of the injection fluid type( EquilibriumState ) :: first_point integer, intent(in), optional :: points Maxmimum number of points, defaults to 500 integer, intent(in), optional :: iterations Point solver maximum iterations, defaults to 100 real(kind=pr), intent(in), optional :: delta_0 Initial extrapolation integer, intent(in), optional :: specified_variable_0 Position of specified variable, since the vector of variables is the values for specification\nwill be for the equilibria constants, for and for . procedure( continuation_solver ), optional :: solver Specify solver for each point, defaults to a full newton procedure procedure( continuation_stopper ), optional :: stop_conditions Function that returns true if the continuation method should stop Return Value type( PXEnvel2 ) Subroutines public subroutine get_z (alpha, z_0, z_inj, z, dzda) Calculate the fluid composition based on an amount of addition\nof second fluid. Read more… Arguments Type Intent Optional Attributes Name real(kind=pr), intent(in) :: alpha Addition percentaje real(kind=pr), intent(in) :: z_0 (:) real(kind=pr), intent(in) :: z_inj (:) real(kind=pr), intent(out) :: z (size(z_0)) New composition real(kind=pr), intent(out), optional :: dzda (size(z_0)) Derivative wrt","tags":"","loc":"module/yaeos__equilibria_boundaries_phase_envelopes_px.html"},{"title":"yaeos__equilibria_saturation_points – yaeos","text":"Uses yaeos__equilibria_equilibrium_state yaeos__models yaeos__constants yaeos__equilibria_auxiliar Variables Type Visibility Attributes Name Initial integer, public :: max_iterations = 1000 real(kind=pr), public :: step_tol = 0.1_pr real(kind=pr), public :: tol = 1e-9_pr Functions public function saturation_pressure (model, n, t, kind, p0, y0, max_iters) Saturation pressure calculation function. Read more… Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: model real(kind=pr), intent(in) :: n (:) Composition vector [moles / molar fraction] real(kind=pr), intent(in) :: t Temperature [K] character(len=*), intent(in) :: kind [bubble|dew|liquid-liquid] real(kind=pr), intent(in), optional :: p0 Initial pressure [bar] real(kind=pr), intent(in), optional :: y0 (:) Initial composition integer, intent(in), optional :: max_iters Maximum number of iterations Return Value type( EquilibriumState ) public function saturation_temperature (model, n, p, kind, t0, y0, max_iters) Saturation temperature calculation function. Read more… Arguments Type Intent Optional Attributes Name class( ArModel ), intent(in) :: model real(kind=pr), intent(in) :: n (:) Composition vector [moles / molar fraction] real(kind=pr), intent(in) :: p Pressure [bar] character(len=*), intent(in) :: kind [bubble|dew|liquid-liquid] real(kind=pr), intent(in), optional :: t0 Initial temperature [K] real(kind=pr), intent(in), optional :: y0 (:) Initial composition integer, intent(in), optional :: max_iters Maximum number of iterations Return Value type( EquilibriumState )","tags":"","loc":"module/yaeos__equilibria_saturation_points.html"},{"title":"ge_models.f90 – yaeos","text":"Source Code module yaeos__models_ge !! Excess Gibbs Models. use yaeos__constants , only : pr , R use yaeos__models_base , only : BaseModel implicit none type , extends ( BaseModel ), abstract :: GeModel !! Excess Gibbs energy model. contains procedure ( excess_gibbs ), deferred :: excess_gibbs procedure :: ln_activity_coefficient => ln_activity_coefficient end type abstract interface subroutine excess_gibbs ( self , n , t , Ge , GeT , GeT2 , Gen , GeTn , Gen2 ) !! Excess Gibbs and derivs procedure import pr , GeModel class ( GeModel ), intent ( in ) :: self !! Model real ( pr ), intent ( in ) :: n (:) !! Moles vector real ( pr ), intent ( in ) :: t !! Temperature [K] real ( pr ), optional , intent ( out ) :: Ge !! Excess Gibbs real ( pr ), optional , intent ( out ) :: GeT !! \\frac{dG^E}{dT} real ( pr ), optional , intent ( out ) :: GeT2 !! \\frac{d^2G^E}{dT^2} real ( pr ), optional , intent ( out ) :: Gen ( size ( n )) real ( pr ), optional , intent ( out ) :: GeTn ( size ( n )) real ( pr ), optional , intent ( out ) :: Gen2 ( size ( n ), size ( n )) end subroutine end interface contains subroutine ln_activity_coefficient ( self , n , T , lngamma ) class ( GeModel ), intent ( in ) :: self real ( pr ), intent ( in ) :: n (:) real ( pr ), intent ( in ) :: T real ( pr ), intent ( out ) :: lngamma (:) real ( pr ) :: ge , dgedn ( size ( n )) call self % excess_gibbs ( n , t , ge = ge , gen = dgedn ) lngamma = dgedn / ( R * T ) end subroutine end module","tags":"","loc":"sourcefile/ge_models.f90.html"},{"title":"equilibria.f90 – yaeos","text":"Source Code module yaeos__equilibria ! Equilibrium State definitions use yaeos__equilibria_equilibrium_state , only : EquilibriumState ! Pure component saturation pressure use yaeos__equilibria_pure_psat , only : Psat ! Phase split calculations use yaeos__equilibria_flash , only : flash ! Saturation points use yaeos__equilibria_saturation_points , only :& saturation_pressure , saturation_temperature ! Phase equilibria boundaries use yaeos__equilibria_boundaries_phase_envelopes_pt , only :& PTEnvel2 , pt_envelope_2ph use yaeos__equilibria_boundaries_phase_envelopes_px , only :& PXEnvel2 , px_envelope_2ph ! Extra use yaeos__equilibria_auxiliar , only : k_wilson , p_wilson implicit none end module yaeos__equilibria","tags":"","loc":"sourcefile/equilibria.f90.html"},{"title":"interfaces.f90 – yaeos","text":"Source Code module yaeos__tapenade_interfaces use yaeos__constants , only : pr implicit none interface subroutine pushinteger4 ( i ) integer :: i end subroutine subroutine popinteger4 ( i ) integer :: i end subroutine subroutine pushreal8array ( a , n ) import pr real ( pr ), dimension ( n ) :: a integer :: n end subroutine subroutine pushreal8 ( a ) import pr real ( pr ) :: a end subroutine subroutine POPREAL8 ( a ) import pr real ( pr ) :: a end subroutine subroutine POPREAL8ARRAY ( a , n ) import pr real ( pr ), dimension ( n ) :: a integer :: n end subroutine end interface end module","tags":"","loc":"sourcefile/interfaces.f90.html"},{"title":"quadratic_mixing.f90 – yaeos","text":"Source Code module yaeos__models_ar_cubic_quadratic_mixing !! Quadratic Mixing Rules for Cubic EoS. use yaeos__constants , only : pr use yaeos__substance , only : substances use yaeos__models_ar_genericcubic , only : CubicMixRule use yaeos__models_ar_cubic_mixing_base , only : bmix_qmr implicit none type , extends ( CubicMixRule ) :: QMR !! Quadratic Mixing Rule (QMR) derived type. Classic Van der Waals mixing !! rules. !! !! QMR depends on binary interaction parameters, on a Cubic EoS !! the mixture is obtained by the combination of an attractive and !! repulsive parameter matrices. !! !! By default the attractive parameter matrix is calculated with: !! a_{ij} = \\sqrt{a_i a_j}(1 - k_{ij}) !! generating the a_{ij} matrix, but this procedure can be overriden !! replacing the `aij` pointer procedure. real ( pr ), allocatable :: k (:, :) !! Attractive Binary Interatction parameter matrix real ( pr ), allocatable :: l (:, :) !! Repulsive Binary Interatction parameter matrix procedure ( get_aij ), pointer :: aij => null () !! Procedure to calculate a_{ij} matrix. Can be overloaded !! by any method that respets the interface [[get_aij(interface)]]. contains procedure :: Dmix !! Attractive parameter mixing rule procedure :: Bmix !! Repulsive parameter mixing rule procedure :: D1mix => D1mix_constant end type QMR type , extends ( QMR ) :: QMR_RKPR contains procedure :: D1Mix => RKPR_D1mix end type QMR_RKPR abstract interface subroutine get_aij ( self , T , ai , daidt , daidt2 , aij , daijdt , daijdt2 ) !! Combining rule for the attractive parameter. !! !! From previously calculated attractive parameters calculate the !! a_{ij} matrix and it's corresponding derivatives. import pr , QMR class ( QMR ), intent ( in ) :: self real ( pr ), intent ( in ) :: T real ( pr ), intent ( in ) :: ai (:), daidt (:), daidt2 (:) real ( pr ), intent ( out ) :: aij (:, :), daijdt (:, :), daijdt2 (:, :) end subroutine get_aij end interface contains subroutine Dmix ( self , n , T , & ai , daidt , daidt2 , & D , dDdT , dDdT2 , dDi , dDidT , dDij ) !! Attractive parameter mixing rule with quadratic mix. !! !! Takes the all the pure components attractive parameters and their !! derivatives with respect to temperature and mix them with the !! Van der Waals quadratic mixing rule: !! !! !! D = \\sum_i \\sum_j n_i n_j a_{ij} = n^2 a_{mix} !! !! !! Inside the routine the a_{ij} matrix is calculated using the !! procedure contained in the `QMR` object, this procedures defaults !! to the common combining rule: a_{ij} = \\sqrt{a_i a_j} (1 - k_{ij}) !! !! The procedure can be overloaded by a common one that respects the !! interface [[get_aij(interface)]] !! !! ```fortran !! type(QMR) :: my_mixing_rule !! my_mixing_rule%aij => new_aij_procedure !! ``` class ( QMR ), intent ( in ) :: self !! Mixing rule object. real ( pr ), intent ( in ) :: T !! Temperature [K] real ( pr ), intent ( in ) :: n (:) !! Moles vector [mol] real ( pr ), intent ( in ) :: ai (:) !! Pure components attractive parameters a_i real ( pr ), intent ( in ) :: daidt (:) !! \\frac{da_i}{dT} real ( pr ), intent ( in ) :: daidt2 (:) !! \\frac{d^2a_i}{dT^2} real ( pr ), intent ( out ) :: D !! Mixture attractive parameter n^2a_{mix} real ( pr ), intent ( out ) :: dDdT !! \\frac{dD}{dT} real ( pr ), intent ( out ) :: dDdT2 !! \\frac{d^2D}{dT^2} real ( pr ), intent ( out ) :: dDi (:) !! \\frac{dD}{dn_i} real ( pr ), intent ( out ) :: dDidT (:) !! \\frac{d^2D}{dTn_i} real ( pr ), intent ( out ) :: dDij (:, :) !! \\frac{d^2D}{dn_{ij}} integer :: i , j , nc real ( pr ) :: aux , aux2 real ( pr ) :: aij ( size ( ai ), size ( ai )) real ( pr ) :: daijdt ( size ( ai ), size ( ai )) real ( pr ) :: daijdt2 ( size ( ai ), size ( ai )) nc = size ( ai ) if ( associated ( self % aij )) then call self % aij ( T , ai , daidt , daidt2 , aij , daijdt , daijdt2 ) else call kij_constant ( self , T , ai , daidt , daidt2 , aij , daijdt , daijdt2 ) end if D = 0 dDdT = 0 dDdT2 = 0 do i = 1 , nc aux = 0 aux2 = 0 dDi ( i ) = 0 dDidT ( i ) = 0 do j = 1 , nc dDi ( i ) = dDi ( i ) + 2 * n ( j ) * aij ( i , j ) dDidT ( i ) = dDidT ( i ) + 2 * n ( j ) * daijdT ( i , j ) aux2 = aux2 + n ( j ) * daijdT2 ( i , j ) dDij ( i , j ) = 2 * aij ( i , j ) aux = aux + n ( j ) * aij ( i , j ) end do D = D + n ( i ) * aux dDdT = dDdT + n ( i ) * dDidT ( i ) * 0.5_pr dDdT2 = dDdT2 + n ( i ) * aux2 end do end subroutine Dmix subroutine Bmix ( self , n , bi , B , dBi , dBij ) !! Mixture repulsive parameter. !! !! Calculate the mixture's repulsive parameter and it's derivatives !! with respect to composition: !! !! !! nB = \\sum_i \\sum_j n_i n_j \\frac{b_i + b_j}{2} (1 - l_{ij}) !! !! class ( QMR ), intent ( in ) :: self !! Mixing rule object. real ( pr ), intent ( in ) :: n (:) !! Moles vector. real ( pr ), intent ( in ) :: bi (:) !! Pure components repulsive parameters. real ( pr ), intent ( out ) :: B !! Mixture repulsive parameter. real ( pr ), intent ( out ) :: dBi (:) !! \\frac{dB}{dn_i} real ( pr ), intent ( out ) :: dBij (:, :) !!\\frac{d^2B}{dn_{ij}} call bmix_qmr ( n , bi , self % l , b , dbi , dbij ) end subroutine Bmix subroutine D1mix_constant ( self , n , d1i , D1 , dD1i , dD1ij ) !! Constant \\delta_1 parameter. !! !! Most Cubic EoS keep a constant value for their \\delta_1 parameter. !! This procedure assumes that all the components have the same delta_1 !! and takes the first value as the one of the mixture. use yaeos__models_ar_cubic_mixing_base , only : d1mix_rkpr class ( QMR ), intent ( in ) :: self !! Mixing rule real ( pr ), intent ( in ) :: n (:) !! Moles vector real ( pr ), intent ( in ) :: d1i (:) !! \\delta_1 parameter real ( pr ), intent ( out ) :: D1 !! Mixture's \\Delta_1 real ( pr ), intent ( out ) :: dD1i (:) !! \\frac{dDelta_1}{dn_i} = 0 real ( pr ), intent ( out ) :: dD1ij (:, :) !! \\frac{d^2Delta_1}{dn_{ij}} = 0 D1 = d1i ( 1 ) dD1i = 0 dD1ij = 0 end subroutine D1mix_constant subroutine RKPR_D1mix ( self , n , d1i , D1 , dD1i , dD1ij ) use yaeos__models_ar_cubic_mixing_base , only : d1mix_rkpr !! RKPR \\delta_1 parameter mixing rule. !! !! The RKPR EoS doesn't have a constant \\delta_1 value for each !! component, so a proper mixing rule should be provided. A linear !! combination is used. !! !! !! \\Delta_1 = \\sum_i^N n_i \\delta_{1i} !! !! class ( QMR_RKPR ), intent ( in ) :: self real ( pr ), intent ( in ) :: n (:) real ( pr ), intent ( in ) :: d1i (:) real ( pr ), intent ( out ) :: D1 real ( pr ), intent ( out ) :: dD1i (:) real ( pr ), intent ( out ) :: dD1ij (:, :) call d1mix_rkpr ( n , d1i , d1 , dd1i , dd1ij ) end subroutine RKPR_D1mix subroutine kij_constant (& self , T , a , dadt , dadt2 , & aij , daijdt , daijdt2 & ) !! Combining rule that uses constant k_{ij} values. !! !! !! a_{ij} = \\sqrt{a_i a_j} (1 - k_{ij}) !! ] class ( QMR ), intent ( in ) :: self real ( pr ), intent ( in ) :: T !! Temperature [K] real ( pr ), intent ( in ) :: a (:) !! Pure components attractive parameters (\\a_i real ( pr ), intent ( in ) :: dadt (:) !! \\frac{da_i}{dT} real ( pr ), intent ( in ) :: dadt2 (:) !! \\frac{d^2a_i}{dT^2} real ( pr ), intent ( out ) :: aij (:, :) !! a_{ij} Matrix real ( pr ), intent ( out ) :: daijdt (:, :) !! \\frac{da_{ij}{dT} real ( pr ), intent ( out ) :: daijdt2 (:, :) !! \\frac{d^2a_{ij}{dT^2} integer :: i , j real ( pr ) :: sqrt_aii_ajj real ( pr ) :: inner_sum real ( pr ) :: aij_daidt do i = 1 , size ( a ) aij ( i , i ) = a ( i ) daijdt ( i , i ) = dadt ( i ) daijdt2 ( i , i ) = dadt2 ( i ) do j = i + 1 , size ( a ) sqrt_aii_ajj = sqrt ( a ( i ) * a ( j )) aij ( i , j ) = sqrt_aii_ajj * ( 1 - self % k ( i , j )) inner_sum = a ( i ) * dadt ( j ) + a ( j ) * dadt ( i ) daijdt ( i , j ) = 0.5_pr * aij ( i , j ) * ( inner_sum ) / ( a ( i ) * a ( j )) daijdt2 ( i , j ) = & ( 1 - self % k ( i , j )) * ( dadT ( j ) * dadT ( i ) / sqrt ( a ( i ) * a ( j )) & + sqrt ( a ( i ) / a ( j )) * ( dadT2 ( j ) - dadT ( j ) ** 2 / ( 2 * a ( j ))) & + sqrt ( a ( j ) / a ( i )) * ( dadT2 ( i ) - dadT ( i ) ** 2 / ( 2 * a ( i )))) / 2 aij ( j , i ) = aij ( i , j ) daijdt ( j , i ) = daijdt ( i , j ) daijdt2 ( j , i ) = daijdt2 ( i , j ) end do end do end subroutine kij_constant end module yaeos__models_ar_cubic_quadratic_mixing","tags":"","loc":"sourcefile/quadratic_mixing.f90.html"},{"title":"base.f90 – yaeos","text":"Source Code module yaeos__models_base !! Basic element of a thermodynamic model. use yaeos__substance , only : Substances implicit none type , abstract :: BaseModel !! Base model type. !! !! Contains the important parts of most models and other procedures. type ( Substances ) :: components !! Substances contained in the module end type end module","tags":"","loc":"sourcefile/base.f90.html"},{"title":"substance.f90 – yaeos","text":"Source Code module yaeos__substance !! yaeos Subtance module. !! !! Module containing pure components properties and parameters. use yaeos__constants , only : pr type :: Substances !! Set of pure components character ( len = 50 ), allocatable :: names (:) !! Composition names. real ( pr ), allocatable :: tc (:) !! Critical Temperature [K] real ( pr ), allocatable :: pc (:) !! Critical Pressure [bar] real ( pr ), allocatable :: w (:) !! Acentric factor end type end module","tags":"","loc":"sourcefile/substance.f90.html"},{"title":"ar_models.f90 – yaeos","text":"Source Code module yaeos__models_ar !! # Module that defines the basics of a residual Helmholtz energy. !! !! All the residual properties that are calculated in this library are !! based on residual Helmholtz Equations of State. Following the book by !! Michelsen and Mollerup. !! !! In this library up to second derivatives of residual Helmholtz energy !! are used. Because they're the fundamentals for phase equilibria !! calculation. !! !! @note !! Later on, third derivative with respect to volume will be included !! since it's importance on calculation of critical points. !! @endnote !! !! # Properties !! !! ## Available properties: !! !! - pressure(n, V, T) !! - fugacity(n, V, T) !! - fugacity(n, P, T, root=[vapor, liquid, stable]) !! - volume !! !! Calculate thermodynamic properties using Helmholtz energy as a basis. !! All the routines in this module work with the logic: !! !! ```fortran !! call foo(x, V, T, [dfoodv, dfoodT, ...]) !! ``` !! Where the user can call the routine of the desired property. And include !! as optional values the desired derivatives of said properties. use yaeos__constants , only : pr , R use yaeos__models_base , only : BaseModel implicit none type , abstract , extends ( BaseModel ) :: ArModel !! Abstract residual Helmholtz model. !! !! This derived type defines the basics needed for the calculation !! of residual properties. !! The basics of a residual Helmholtz model is a routine that calculates !! all the needed derivatives of Ar `residual_helmholtz` and !! a volume initializer function, that is used to initialize a Newton !! solver of volume when specifying pressure. character ( len = :), allocatable :: name !! Name of the model contains procedure ( abs_residual_helmholtz ), deferred :: residual_helmholtz procedure ( abs_volume_initializer ), deferred :: get_v0 procedure :: lnphi_vt => fugacity_vt procedure :: lnphi_pt => fugacity_pt procedure :: pressure procedure :: volume procedure :: enthalpy_residual_vt procedure :: gibbs_residual_vt procedure :: entropy_residual_vt procedure :: Cv_residual_vt procedure :: Cp_residual_vt end type ArModel interface size module procedure :: size_ar_model end interface size abstract interface subroutine abs_residual_helmholtz (& self , n , v , t , Ar , ArV , ArT , ArTV , ArV2 , ArT2 , Arn , ArVn , ArTn , Arn2 & ) !! Residual Helmholtz model generic interface. !! !! This interface represents how an Ar model should be implemented. !! By our standard, a Resiudal Helmholtz model takes as input: !! !! - The mixture's number of moles vector. !! - Volume, by default in liters. !! - Temperature, by default in Kelvin. !! !! All the output arguments are optional. While this keeps a long !! signature for the implementation, this is done this way to take !! advantage of any inner optimizations to calculate derivatives !! inside the procedure. !! !! Once the model is implemented, the signature can be short like !! `model%residual_helmholtz(n, v, t, ArT2=dArdT2)` import ArModel , pr class ( ArModel ), intent ( in ) :: self !! ArModel real ( pr ), intent ( in ) :: n (:) !! Moles vector real ( pr ), intent ( in ) :: v !! Volume [L] real ( pr ), intent ( in ) :: t !! Temperature [K] real ( pr ), optional , intent ( out ) :: Ar !! Residual Helmoltz energy real ( pr ), optional , intent ( out ) :: ArV !! \\frac{dAr}{dV} real ( pr ), optional , intent ( out ) :: ArT !! \\frac{dAr}{dT} real ( pr ), optional , intent ( out ) :: ArT2 !! \\frac{d^2Ar}{dT^2} real ( pr ), optional , intent ( out ) :: ArTV !! \\frac{d^2Ar}{dTV} real ( pr ), optional , intent ( out ) :: ArV2 !! \\frac{d^2Ar}{dV^2} real ( pr ), optional , intent ( out ) :: Arn ( size ( n )) !! \\frac{dAr}{dn_i} real ( pr ), optional , intent ( out ) :: ArVn ( size ( n )) !! \\frac{d^2Ar}{dVn_i} real ( pr ), optional , intent ( out ) :: ArTn ( size ( n )) !! \\frac{d^2Ar}{dTn_i} real ( pr ), optional , intent ( out ) :: Arn2 ( size ( n ), size ( n )) !! \\frac{d^2Ar}{dn_{ij}} end subroutine abs_residual_helmholtz function abs_volume_initializer ( self , n , p , t ) !! Function that provides an initializer value for the liquid-root !! of newton solver of volume. In the case the model will use the !! `volume_michelsen` routine this value should provide the co-volume !! of the model. import ArModel , pr class ( ArModel ), intent ( in ) :: self !! Ar Model real ( pr ), intent ( in ) :: n (:) !! Moles vector real ( pr ), intent ( in ) :: p !! Pressure [bar] real ( pr ), intent ( in ) :: t !! Temperature [K] real ( pr ) :: abs_volume_initializer !! Initial volume [L] end function abs_volume_initializer end interface contains integer pure function size_ar_model ( eos ) !! Get the size of the model. class ( ArModel ), intent ( in ) :: eos size_ar_model = size ( eos % components % pc ) end function size_ar_model subroutine volume ( eos , n , P , T , V , root_type ) !! # Volume solver routine for residual Helmholtz models. !! Solves volume roots using newton method. Given pressure and temperature. !! !! # Description !! This subroutine solves the volume using a newton method. The variable !! `root_type` !! !! # Examples !! !! ```fortran !! class(ArModel) :: eos !! call eos%volume(n, P, T, V, root_type=\"liquid\") !! call eos%volume(n, P, T, V, root_type=\"vapor\") !! call eos%volume(n, P, T, V, root_type=\"stable\") !! ``` use yaeos__constants , only : pr , R use yaeos__math , only : newton class ( ArModel ), intent ( in ) :: eos real ( pr ), intent ( in ) :: n (:) !! Moles number vector real ( pr ), intent ( in ) :: P !! Pressure [bar] real ( pr ), intent ( in ) :: T !! Temperature [K] real ( pr ), intent ( out ) :: V !! Volume [L] character ( len =* ), intent ( in ) :: root_type !! Desired root-type to solve. Options are: !! `[\"liquid\", \"vapor\", \"stable\"]` integer :: max_iters = 30 real ( pr ) :: tol = 1e-7 real ( pr ) :: totnRT , GrL , GrV , Gr real ( pr ) :: Vliq , Vvap GrL = HUGE ( GrL ) GrV = HUGE ( GrV ) totnRT = sum ( n ) * R * T select case ( root_type ) case ( \"liquid\" ) Vliq = eos % get_v0 ( n , P , T ) * 1.001_pr call newton ( foo , Vliq , tol = tol , max_iters = max_iters ) GrL = Gr case ( \"vapor\" ) Vvap = R * T / P call newton ( foo , Vvap , tol = tol , max_iters = max_iters ) GrV = Gr case ( \"stable\" ) Vliq = eos % get_v0 ( n , P , T ) * 1.00001_pr call newton ( foo , Vliq , tol = tol , max_iters = max_iters ) GrL = Gr Vvap = R * T / P call newton ( foo , Vvap , tol = tol , max_iters = max_iters ) GrV = Gr end select if ( GrL < GrV ) then V = Vliq else V = Vvap end if contains subroutine foo ( x , f , df ) real ( pr ), intent ( in ) :: x real ( pr ), intent ( out ) :: f , df real ( pr ) :: Ar , ArV , ArV2 , Pcalc , dPcalcdV , Vin Vin = x call eos % residual_helmholtz ( n , Vin , T , Ar = Ar , ArV = ArV , ArV2 = ArV2 ) Pcalc = totnRT / Vin - ArV dPcalcdV = - totnRT / Vin ** 2 - ArV2 f = Pcalc - p df = dPcalcdV Gr = Ar + P * Vin - totnRT - totnRT * log ( P * Vin / ( R * T )) end subroutine foo end subroutine volume subroutine pressure ( eos , n , V , T , P , dPdV , dPdT , dPdn ) !! Pressure calculation. !! !! Calculate pressure using residual helmholtz models. !! !! # Examples !! ```fortran !! class(ArModel), allocatable :: eos !! real(pr) :: n(2), t, v, p, dPdV, dPdT, dPdn(2) !! eos = PengRobinson(Tc, Pc, w) !! n = [1.0_pr, 1.0_pr] !! t = 300.0_pr !! v = 1.0_pr !! call eos%pressure(n, V, T, P, dPdV=dPdV, dPdT=dPdT, dPdn=dPdn) !! ``` class ( ArModel ), intent ( in ) :: eos !! Model real ( pr ), intent ( in ) :: n (:) !! Moles number vector real ( pr ), intent ( in ) :: t !! Temperature [K] real ( pr ), intent ( in ) :: v !! Volume [L] real ( pr ), intent ( out ) :: p !! Pressure [bar] real ( pr ), optional , intent ( out ) :: dPdV !! \\frac{dP}}{dV} real ( pr ), optional , intent ( out ) :: dPdT !! \\frac{dP}}{dT} real ( pr ), optional , intent ( out ) :: dPdn (:) !! \\frac{dP}}{dn_i} real ( pr ) :: totn real ( pr ) :: Ar , ArV , ArV2 , ArTV , ArVn ( size ( eos )) integer :: nc logical :: dn totn = sum ( n ) nc = size ( n ) if ( present ( dPdn )) then call eos % residual_helmholtz (& n , v , t , Ar = Ar , ArV = ArV , ArV2 = ArV2 , ArTV = ArTV , ArVn = ArVn & ) else call eos % residual_helmholtz (& n , v , t , Ar = Ar , ArV = ArV , ArV2 = ArV2 , ArTV = ArTV & ) end if P = totn * R * T / V - ArV if ( present ( dPdV )) dPdV = - ArV2 - R * T * totn / V ** 2 if ( present ( dPdT )) dPdT = - ArTV + totn * R / V if ( present ( dPdn )) dPdn (:) = R * T / V - ArVn (:) end subroutine pressure subroutine fugacity_pt ( eos , & n , P , T , V , root_type , lnPhi , dlnPhidP , dlnPhidT , dlnPhidn , dPdV , dPdT , dPdn & ) !! Calculate logarithm of fugacity, given pressure and temperature. !! !! This routine will obtain the desired volume root at the specified !! pressure and calculate fugacity at that point. use iso_fortran_env , only : error_unit class ( ArModel ), intent ( in ) :: eos !! Model real ( pr ), intent ( in ) :: n (:) !! Mixture mole numbers character ( len =* ), intent ( in ) :: root_type !! Type of root desired [\"liquid\", \"vapor\", \"stable\"] real ( pr ), intent ( in ) :: P !! Pressure [bar] real ( pr ), intent ( in ) :: T !! Temperature [K] real ( pr ), optional , intent ( out ) :: lnPhi ( size ( n )) !! \\ln(phi) vector real ( pr ), optional , intent ( out ) :: V !! Volume [L] real ( pr ), optional , intent ( out ) :: dlnPhidT ( size ( n )) !! ln(phi) Temp derivative real ( pr ), optional , intent ( out ) :: dlnPhidP ( size ( n )) !! ln(phi) Presssure derivative real ( pr ), optional , intent ( out ) :: dlnPhidn ( size ( n ), size ( n )) !! ln(phi) compositional derivative real ( pr ), optional , intent ( out ) :: dPdV !! \\frac{dP}{dV} real ( pr ), optional , intent ( out ) :: dPdT !! \\frac{dP}{dT} real ( pr ), optional , intent ( out ) :: dPdn ( size ( n )) !! \\frac{dP}{dn_i} real ( pr ) :: V_in , P_in call eos % volume ( n , P = P , T = T , V = V_in , root_type = root_type ) call eos % lnphi_vt (& n , V = V_in , T = T , & P = P_in , lnPhi = lnPhi , & dlnPhidP = dlnPhidP , dlnPhidT = dlnPhidT , dlnPhidn = dlnPhidn , & dPdV = dPdV , dPdT = dPdT , dPdn = dPdn & ) if ( present ( V )) V = V_in ! Check if the calculated pressure is the same as the input pressure. if ( abs ( P_in - P ) > 1e-2 ) then write ( error_unit , * ) \"WARN: possible bad root solving: \" , P_in , P end if end subroutine fugacity_pt subroutine fugacity_vt ( eos , & n , V , T , P , lnPhi , dlnPhidP , dlnPhidT , dlnPhidn , dPdV , dPdT , dPdn & ) !! Calculate fugacity coefficent given volume and temperature. !! !!@note !!While the natural output variable is ln \\phi_i P. The calculated !!derivatives will be the derivatives of the fugacity coefficient !!ln \\phi_i !!@endnote !! class ( ArModel ) :: eos !! Model real ( pr ), intent ( in ) :: n (:) !! Mixture mole numbers real ( pr ), intent ( in ) :: V !! Volume [L] real ( pr ), intent ( in ) :: T !! Temperature [K] real ( pr ), optional , intent ( out ) :: P !! Pressure [bar] real ( pr ), optional , intent ( out ) :: lnPhi ( size ( n )) !! \\ln(\\phi_i*P) vector real ( pr ), optional , intent ( out ) :: dlnPhidT ( size ( n )) !! ln(phi_i) Temp derivative real ( pr ), optional , intent ( out ) :: dlnPhidP ( size ( n )) !! ln(phi_i) Presssure derivative real ( pr ), optional , intent ( out ) :: dlnPhidn ( size ( n ), size ( n )) !! ln(phi_i) compositional derivative real ( pr ), optional , intent ( out ) :: dPdV !! \\frac{dP}{dV} real ( pr ), optional , intent ( out ) :: dPdT !! \\frac{dP}{dT} real ( pr ), optional , intent ( out ) :: dPdn (:) !! \\frac{dP}{dn_i} real ( pr ) :: Ar , ArTV , ArV , ArV2 real ( pr ), dimension ( size ( n )) :: Arn , ArVn , ArTn real ( pr ) :: Arn2 ( size ( n ), size ( n )) real ( pr ) :: dPdV_in , dPdT_in , dPdn_in ( size ( n )) real ( pr ) :: P_in real ( pr ) :: RT , Z real ( pr ) :: totn integer :: nc , i , j totn = sum ( n ) nc = size ( n ) RT = R * T if ( present ( lnPhi ) . and . . not . (& present ( dlnPhidn ) & . or . present ( dlnPhidP ) & . or . present ( dlnPhidT ) & )) then call eos % residual_helmholtz ( n , v , t , Arn = Arn , ArV = ArV ) P_in = totn * RT / V - ArV Z = P_in * V / ( totn * RT ) lnPhi (:) = Arn (:) / RT - log ( Z ) return else if ( present ( dlnPhidn )) then call eos % residual_helmholtz (& n , V , T , Ar = Ar , ArV = ArV , ArV2 = ArV2 , ArTV = ArTV , & Arn = Arn , ArVn = ArVn , ArTn = ArTn , Arn2 = Arn2 & ) else call eos % residual_helmholtz (& n , V , T , Ar = Ar , ArV = ArV , ArV2 = ArV2 , ArTV = ArTV , & Arn = Arn , ArVn = ArVn , ArTn = ArTn & ) end if P_in = totn * RT / V - ArV Z = P_in * V / ( totn * RT ) if ( present ( P )) P = P_in dPdV_in = - ArV2 - RT * totn / V ** 2 dPdT_in = - ArTV + totn * R / V dPdn_in = RT / V - ArVn if ( present ( lnPhi )) lnPhi = Arn (:) / RT - log ( Z ) if ( present ( dlnPhidP )) then dlnPhidP (:) = - dPdn_in (:) / dPdV_in / RT - 1._pr / P_in end if if ( present ( dlnPhidT )) then dlnPhidT (:) = ( ArTn (:) - Arn (:) / T ) / RT + dPdn_in (:) * dPdT_in / dPdV_in / RT + 1._pr / T end if if ( present ( dlnPhidn )) then do i = 1 , nc do j = i , nc dlnPhidn ( i , j ) = 1._pr / totn + ( Arn2 ( i , j ) + dPdn_in ( i ) * dPdn_in ( j ) / dPdV_in ) / RT dlnPhidn ( j , i ) = dlnPhidn ( i , j ) end do end do end if if ( present ( dPdV )) dPdV = dPdV_in if ( present ( dPdT )) dPdT = dPdT_in if ( present ( dPdn )) dPdn = dPdn_in end subroutine fugacity_vt subroutine enthalpy_residual_vt ( eos , n , V , T , Hr , HrT , HrV , Hrn ) !! Calculate residual enthalpy given volume and temperature. class ( ArModel ), intent ( in ) :: eos !! Model real ( pr ), intent ( in ) :: n (:) !! Moles number vector real ( pr ), intent ( in ) :: t !! Temperature [K] real ( pr ), intent ( in ) :: v !! Volume [L] real ( pr ), intent ( out ) :: Hr !! Residual enthalpy [bar L / mol] real ( pr ), optional , intent ( out ) :: HrT !! \\frac{dH^r}}{dT} real ( pr ), optional , intent ( out ) :: HrV !! \\frac{dH^r}}{dV} real ( pr ), optional , intent ( out ) :: Hrn ( size ( n )) !! \\frac{dH^r}}{dn} real ( pr ) :: Ar , ArV , ArT , Arn ( size ( n )) real ( pr ) :: ArV2 , ArT2 , ArTV , ArVn ( size ( n )), ArTn ( size ( n )) call eos % residual_helmholtz (& n , v , t , Ar = Ar , ArV = ArV , ArT = ArT , ArTV = ArTV , ArV2 = ArV2 , ArT2 = ArT2 , Arn = Arn , ArVn = ArVn , ArTn = ArTn & ) Hr = Ar - t * ArT - v * ArV if ( present ( HrT )) HrT = - t * ArT2 - v * ArTV if ( present ( HrV )) HrV = - t * ArTV - v * ArV2 if ( present ( HrN )) HrN (:) = Arn (:) - t * ArTn (:) - v * ArVn (:) end subroutine enthalpy_residual_vt subroutine gibbs_residual_VT ( eos , n , V , T , Gr , GrT , GrV , Grn ) !! Calculate residual Gibbs energy given volume and temperature. use yaeos__constants , only : R class ( ArModel ), intent ( in ) :: eos !! Model real ( pr ), intent ( in ) :: n (:) !! Moles number vector real ( pr ), intent ( in ) :: V !! Volume [L] real ( pr ), intent ( in ) :: T !! Temperature [K] real ( pr ), intent ( out ) :: Gr !! Gibbs energy [bar L / mol] real ( pr ), optional , intent ( out ) :: GrT !! \\frac{dG^r}}{dT} real ( pr ), optional , intent ( out ) :: GrV !! \\frac{dG^r}}{dV} real ( pr ), optional , intent ( out ) :: Grn ( size ( n )) !! \\frac{dG^r}}{dn} real ( pr ) :: Ar , ArV , ArT , Arn ( size ( n )) real ( pr ) :: p , dPdV , dPdT , dPdn ( size ( n )), z , totn totn = sum ( n ) call pressure ( eos , n , V , T , P , dPdV = dPdV , dPdT = dPdT , dPdn = dPdn ) z = P * V / ( totn * R * T ) call eos % residual_helmholtz ( n , v , t , Ar = Ar , ArV = ArV , ArT = ArT , Arn = Arn ) Gr = Ar + P * V - totn * R * T if ( present ( GrT )) GrT = ArT + V * dPdT - totn * R if ( present ( GrV )) GrV = ArV + V * dPdV + P if ( present ( GrN )) GrN (:) = Arn (:) + V * dPdn (:) - R * T end subroutine gibbs_residual_VT subroutine entropy_residual_vt ( eos , n , V , T , Sr , SrT , SrV , Srn ) !! Calculate residual entropy given volume and temperature. class ( ArModel ), intent ( in ) :: eos !! Model real ( pr ), intent ( in ) :: n (:) !! Moles number vector real ( pr ), intent ( in ) :: V !! Volume [L] real ( pr ), intent ( in ) :: T !! Temperature [K] real ( pr ), intent ( out ) :: Sr !! Entropy [bar L / K / mol] real ( pr ), optional , intent ( out ) :: SrT !! \\frac{dS^r}}{dT} real ( pr ), optional , intent ( out ) :: SrV !! \\frac{dS^r}}{dV} real ( pr ), optional , intent ( out ) :: Srn ( size ( n )) !! \\frac{dS^r}}{dn} real ( pr ) :: Ar , ArT , ArT2 , ArTV , ArTn ( size ( n )) call eos % residual_helmholtz (& n , v , t , Ar = Ar , ArT = ArT , ArTV = ArTV , ArT2 = ArT2 , ArTn = ArTn & ) Sr = - ArT if ( present ( SrT )) SrT = - ArT2 if ( present ( SrV )) SrV = - ArTV if ( present ( SrN )) SrN = - ArTn end subroutine entropy_residual_vt subroutine Cv_residual_vt ( eos , n , V , T , Cv ) !! Calculate residual heat capacity volume constant given v and t. class ( ArModel ), intent ( in ) :: eos !! Model real ( pr ), intent ( in ) :: n (:) !! Moles number vector real ( pr ), intent ( in ) :: T !! Temperature [K] real ( pr ), intent ( in ) :: V !! Volume [L] real ( pr ), intent ( out ) :: Cv !! heat capacity v constant [bar L / K / mol] real ( pr ) :: Ar , ArT2 call eos % residual_helmholtz ( n , V , T , Ar = Ar , ArT2 = ArT2 ) Cv = - T * ArT2 end subroutine Cv_residual_vt subroutine Cp_residual_vt ( eos , n , V , T , Cp ) !! Calculate residual heat capacity pressure constant given v and t. use yaeos__constants , only : R class ( ArModel ), intent ( in ) :: eos !! Model real ( pr ), intent ( in ) :: n (:) !! Moles number vector real ( pr ), intent ( in ) :: V !! Volume [L] real ( pr ), intent ( in ) :: T !! Temperature [K] real ( pr ), intent ( out ) :: Cp !! heat capacity p constant [bar L / K / mol] real ( pr ) :: Ar , ArT2 , Cv , p , dPdT , dPdV , totn totn = sum ( n ) call eos % residual_helmholtz ( n , V , T , Ar = Ar , ArT2 = ArT2 ) call Cv_residual_vt ( eos , n , V , T , Cv ) call pressure ( eos , n , V , T , P , dPdV = dPdV , dPdT = dPdT ) Cp = Cv - T * dPdT ** 2 / dPdV - totn * R end subroutine Cp_residual_vt end module yaeos__models_ar","tags":"","loc":"sourcefile/ar_models.f90.html"},{"title":"linalg.f90 – yaeos","text":"Source Code module yaeos__math_linalg !! Wrapper module around LAPACK's `dgesv` use yaeos__constants , only : pr implicit none contains function solve_system ( a , b ) result ( x ) !! Solve a linear sytem AX = b real ( pr ), intent ( in ) :: b (:) real ( pr ), intent ( in ) :: a ( size ( b ), size ( b )) integer , parameter :: dp = selected_real_kind ( 15 ) real ( pr ) :: x ( size ( b )) real ( dp ) :: a_lapack ( size ( b ), size ( b )), b_lapack ( size ( b )) integer :: n , nrhs , lda , ipiv ( size ( b )), ldb , info interface subroutine dgesv ( n , nrhs , a , lda , ipiv , b , ldb , info ) import dp integer :: n integer :: nrhs real ( dp ) :: a ( n , n ) integer :: lda integer :: ipiv ( n ) real ( dp ) :: b ( n ) integer :: ldb integer :: info end subroutine dgesv end interface n = size ( a , dim = 1 ) nrhs = 1 lda = n ldb = n a_lapack = a b_lapack = b call dgesv ( n , nrhs , a_lapack , lda , ipiv , b_lapack , ldb , info ) if ( info > 0 ) error stop 1 x = b_lapack end function solve_system subroutine cubic_roots ( parameters , real_roots , complex_roots , flag ) use yaeos__auxiliar , only : sort real ( pr ), parameter :: pi = atan ( 1.0_pr ) * 4.0_pr real ( pr ), intent ( in ) :: parameters ( 4 ) real ( pr ), intent ( out ) :: real_roots ( 3 ) complex ( pr ), intent ( out ) :: complex_roots ( 3 ) integer , intent ( out ) :: flag !! flag that identifies which case the solution is !! - `0`: 3 real rotos, one of them repeated (use real_roots(1) and real_roots(2)) !! - `1`: 1 real root, 2 complex roots. !! Use real_roots(1) and complex_roots(1) and complex_roots(2) !! - `-1`: 3 real roots, all different real ( pr ) :: p , q , u , v , nan real ( pr ) :: disc , theta nan = 0 nan = nan / nan associate (& a => parameters ( 1 ), b => parameters ( 2 ), & c => parameters ( 3 ), d => parameters ( 4 )& ) p = c / a - b ** 2 / ( 3 * a ** 2 ) q = d / a - b * c / ( 3 * a ** 2 ) + 2 * b ** 3 / ( 27 * a ** 3 ) disc = q ** 2 + 4 * p ** 3 / 27 real_roots = nan complex_roots = nan if ( abs ( disc ) < 1e-15 ) then flag = 0 real_roots ( 1 ) = 3 * q / p real_roots ( 2 ) = - 3 * q / ( 2 * p ) real_roots ( 3 ) = real_roots ( 2 ) elseif ( disc < 0 ) then flag = - 1 theta = acos ( 0.5_pr * 3 * q / p * sqrt ( - 3 / p )) real_roots ( 1 ) = 2 * sqrt ( - p / 3 ) * cos ( theta / 3 ) real_roots ( 2 ) = 2 * sqrt ( - p / 3 ) * cos (( theta + 2 * pi ) / 3 ) real_roots ( 3 ) = 2 * sqrt ( - p / 3 ) * cos (( theta + 4 * pi ) / 3 ) call sort ( real_roots ) elseif ( disc > 0 ) then flag = 1 u = (( - q + sqrt ( disc )) / 2 ) v = (( - q - sqrt ( disc )) / 2 ) u = sign ( abs ( u ) ** ( 1.0_pr / 3.0_pr ), u ) v = sign ( abs ( v ) ** ( 1.0_pr / 3.0_pr ), v ) real_roots ( 1 ) = u + v endif real_roots = real_roots - b / ( 3 * a ) end associate end subroutine cubic_roots subroutine cubic_roots_rosendo ( parameters , real_roots , complex_roots , flag ) use yaeos__auxiliar , only : sort real ( pr ), parameter :: pi = atan ( 1.0_pr ) * 4.0_pr real ( pr ), intent ( in ) :: parameters ( 4 ) real ( pr ), intent ( out ) :: real_roots ( 3 ) complex ( pr ), intent ( out ) :: complex_roots ( 3 ) integer , intent ( out ) :: flag real ( 16 ) :: d1 , d2 , d3 , Q , R , A , B , theta , alp , bet , gam integer :: i d1 = parameters ( 2 ) / parameters ( 1 ) d2 = parameters ( 3 ) / parameters ( 1 ) d3 = parameters ( 4 ) / parameters ( 1 ) Q = ( d1 ** 2 - 3 * d2 ) / 9.0_1 6 R = ( 2 * d1 ** 3 - 9 * d1 * d2 + 27 * d3 ) / 5 4.0_1 6 if ( R ** 2 <= Q ** 3 ) then theta = acos ( R / sqrt ( Q ** 3 )) real_roots ( 1 ) = - 2 * sqrt ( Q ) * cos ( theta / 3.0_1 6 ) - d1 / 3.0_1 6 real_roots ( 2 ) = - 2 * sqrt ( Q ) * cos (( theta + 2 * pi ) / 3.0_1 6 ) - d1 / 3.0_1 6 real_roots ( 3 ) = - 2 * sqrt ( Q ) * cos (( theta - 2 * pi ) / 3.0_1 6 ) - d1 / 3.0_1 6 ! Correction?? ! do i=1,100 ! real_roots(1) = -d1 - (real_roots(2) + real_roots(3)) ! real_roots(2) = (d2 - real_roots(1) * real_roots(3)) / (real_roots(1) + real_roots(3)) ! real_roots(3) = -d3 / (real_roots(1) * real_roots(2)) ! end do call sort ( real_roots ) flag = - 1 else A = - sign (( abs ( R ) + sqrt ( R ** 2 - Q ** 3 )) ** ( 1.0_1 6 / 3.0_1 6 ), R ) if ( abs ( A ) < 1e-6 ) then A = 0.0_1 6 B = 0.0_1 6 else B = Q / A end if real_roots = ( A + B ) - d1 / 3.0_1 6 flag = 1 end if end subroutine end module yaeos__math_linalg","tags":"","loc":"sourcefile/linalg.f90.html"},{"title":"base.f90 – yaeos","text":"Source Code module yaeos__models_ar_cubic_mixing_base !! # Mixing rules core math !! Procedures of the core calculations of CubicEoS mixing rules. !! !! # Description !! This module holds all the basic math to use mixing rules in other codes. !! Keeping it simple and accesible. !! !! # Examples !! !! ```fortran !! bi = [0.2, 0.3] !! lij = reshape([0.0, 0.2, 0.2, 0], [2,2]) !! !! ! Calculate B parameter with Quadratric Mixing Rules. !! call bmix_qmr(n, bi, lij, b, dbi, dbij) !! !! ``` !! !! # References use yaeos__constants , only : pr implicit none contains pure subroutine bmix_linear ( n , bi , b , dbi , dbij ) real ( pr ), intent ( in ) :: n (:) real ( pr ), intent ( in ) :: bi (:) real ( pr ), intent ( out ) :: b , dbi (:), dbij (:, :) b = sum ( n * bi ) dbi = bi dbij = 0 end subroutine pure subroutine bmix_qmr ( n , bi , lij , b , dbi , dbij ) real ( pr ), intent ( in ) :: n (:) real ( pr ), intent ( in ) :: bi (:) real ( pr ), intent ( in ) :: lij (:, :) real ( pr ), intent ( out ) :: b , dbi (:), dbij (:, :) real ( pr ) :: bij ( size ( n ), size ( n )) real ( pr ) :: totn , aux ( size ( n )) integer :: i , j , nc nc = size ( n ) TOTN = sum ( n ) B = 0 dBi = 0 dBij = 0 aux = 0 do i = 1 , nc do j = 1 , nc bij ( i , j ) = 0.5_pr * ( bi ( i ) + bi ( j )) * ( 1.0_pr - lij ( i , j )) aux ( i ) = aux ( i ) + n ( j ) * bij ( i , j ) end do B = B + n ( i ) * aux ( i ) end do B = B / totn do i = 1 , nc dBi ( i ) = ( 2 * aux ( i ) - B ) / totn do j = 1 , i dBij ( i , j ) = ( 2 * bij ( i , j ) - dBi ( i ) - dBi ( j )) / totn dBij ( j , i ) = dBij ( i , j ) end do end do end subroutine pure subroutine d1mix_rkpr ( n , d1i , d1 , dd1i , dd1ij ) !! RKPR \\delta_1 parameter mixing rule. !! !! The RKPR EoS doesn't have a constant \\delta_1 value for each !! component, so a proper mixing rule should be provided. A linear !! combination is used. !! !! !! \\Delta_1 = \\sum_i^N n_i \\delta_{1i} !! !! real ( pr ), intent ( in ) :: n (:) real ( pr ), intent ( in ) :: d1i (:) real ( pr ), intent ( out ) :: D1 real ( pr ), intent ( out ) :: dD1i (:) real ( pr ), intent ( out ) :: dD1ij (:, :) integer :: i , j , nc real ( pr ) :: totn nc = size ( n ) totn = sum ( n ) D1 = sum ( n * d1i ) / totn do i = 1 , nc dD1i ( i ) = ( d1i ( i ) - D1 ) / totn do j = 1 , nc dD1ij ( i , j ) = ( 2 * D1 - d1i ( i ) - d1i ( j )) / totn ** 2 end do end do end subroutine end module","tags":"","loc":"sourcefile/base.f90~2.html"},{"title":"auxiliar.f90 – yaeos","text":"Source Code module yaeos__equilibria_auxiliar !! Auxiliar functions used for phase-equilibria calculation. use yaeos__constants , only : pr use yaeos__models_base , only : BaseModel implicit none contains function k_wilson ( model , T , P ) result ( K ) !! K-factors regressión done by Wilson, used for initialization. class ( BaseModel ), intent ( in ) :: model real ( pr ), intent ( in ) :: T real ( pr ), intent ( in ) :: P real ( pr ) :: K ( size ( model % components % pc )) K = ( model % components % Pc / P ) & * exp ( 5.373_pr * ( 1 + model % components % w )& * ( 1 - model % components % Tc / T )) end function k_wilson real ( pr ) function P_wilson ( model , z , T ) result ( P ) class ( BaseModel ), intent ( in ) :: model real ( pr ), intent ( in ) :: z (:) real ( pr ), intent ( in ) :: T P = 1.0_pr / sum (& z * model % components % Pc & * exp ( 5.373_pr & * ( 1 + model % components % w ) * ( 1 - model % components % Tc / T ))) end function P_wilson end module yaeos__equilibria_auxiliar","tags":"","loc":"sourcefile/auxiliar.f90.html"},{"title":"optimizers.f90 – yaeos","text":"Source Code module yaeos__optimizers use yaeos__constants , only : pr implicit none type , abstract :: Optimizer logical :: verbose real ( pr ), allocatable :: parameter_step (:) real ( pr ) :: solver_tolerance = 1e-9_pr contains procedure ( abs_optimize ), deferred :: optimize end type abstract interface subroutine obj_func ( X , F , dF , data ) import pr real ( pr ), intent ( in ) :: X (:) real ( pr ), intent ( out ) :: F real ( pr ), optional , intent ( out ) :: dF (:) class ( * ), optional , intent ( in out ) :: data end subroutine end interface abstract interface subroutine abs_optimize ( self , foo , X , F , data ) import pr , obj_func , Optimizer class ( Optimizer ), intent ( in out ) :: self procedure ( obj_func ) :: foo real ( pr ), intent ( in out ) :: X (:) real ( pr ), intent ( out ) :: F class ( * ), optional , target , intent ( in out ) :: data end subroutine end interface end module module yaeos__optimizers_powell_wrap use yaeos__constants , only : pr use yaeos__optimizers , only : Optimizer , obj_func private public :: PowellWrapper type , extends ( Optimizer ) :: PowellWrapper !! Wrapper derived type to optimize with the Powell method contains procedure :: optimize => powell_optimize end type PowellWrapper ! These are private variables that will be used in the wrapper subroutine ! to call the user-defined function and pass the data class ( * ), private , pointer :: priv_data procedure ( obj_func ), private , pointer :: priv_foo contains subroutine powell_optimize ( self , foo , X , F , data ) use newuoa_module , only : newuoa class ( PowellWrapper ), intent ( in out ) :: self class ( * ), optional , target , intent ( in out ) :: data procedure ( obj_func ) :: foo real ( pr ), intent ( in out ) :: X (:) real ( pr ), intent ( out ) :: F real ( pr ) :: dx ( size ( x )) integer :: n , npt n = size ( X ) npt = ( N + 2 + ( N + 1 ) * ( N + 2 ) / 2 ) / 2 if ( allocated ( self % parameter_step )) then dx = self % parameter_step else dx = X * 0.01_pr end if if ( present ( data )) priv_data => data priv_foo => foo call newuoa (& n , npt , x , & maxval ( abs ( dx / 10 )), self % solver_tolerance , 0 , int ( 1e9 ), foo_wrap & ) call foo_wrap ( n , x , F ) end subroutine powell_optimize subroutine foo_wrap ( n , x , f ) integer :: n real ( pr ) :: x ( * ) real ( pr ) :: f real ( pr ) :: xx ( n ) xx = x ( 1 : n ) call priv_foo ( xx , F , data = priv_data ) end subroutine foo_wrap end module","tags":"","loc":"sourcefile/optimizers.f90.html"},{"title":"alphas.f90 – yaeos","text":"Source Code module yaeos__models_ar_cubic_alphas !! \\alpha functions defined in the library. use yaeos__constants , only : pr use yaeos__substance , only : substances use yaeos__models_ar_genericcubic , only : CubicEoS , AlphaFunction implicit none type , extends ( AlphaFunction ) :: AlphaSoave !! Soave \\alpha function. !! \\alpha(T_r) = (1 + k (1 - \\sqrt{Tr}))^2 real ( pr ), allocatable :: k (:) !! k parameter. contains procedure :: alpha !! Alpha function end type type , extends ( AlphaFunction ) :: AlphaRKPR !! RKPR \\alpha function !! !! \\alpha(T_r) = \\left(\\frac{3}{2 + T_r}\\right)^k !! real ( pr ), allocatable :: k (:) !! k parameter. contains procedure :: alpha => alpha_rkpr end type contains subroutine alpha ( self , Tr , a , dadt , dadt2 ) !! Soave \\alpha function and it's derivatives. class ( AlphaSoave ), intent ( in ) :: self real ( pr ), intent ( in ) :: Tr (:) !! Reduced temperature real ( pr ), intent ( out ) :: a (:) !! \\alpha real ( pr ), intent ( out ) :: dadt (:) !! \\frac{d\\alpha}{dT} real ( pr ), intent ( out ) :: dadt2 (:) !! \\frac{d^2\\alpha}{dT^2} associate ( k => self % k ) a = ( 1 + k * ( 1 - sqrt ( Tr ))) ** 2 dadT = k * ( k * ( sqrt ( Tr ) - 1 ) - 1 ) / sqrt ( Tr ) dadT2 = ( 1.0_pr / 2.0_pr ) * k * ( k + 1 ) / Tr ** ( 1.5_pr ) end associate end subroutine subroutine alpha_rkpr ( self , Tr , a , dadt , dadt2 ) class ( AlphaRKPR ), intent ( in ) :: self real ( pr ), intent ( in ) :: Tr (:) !! Reduced temperature real ( pr ), intent ( out ) :: a (:) !! \\alpha real ( pr ), intent ( out ) :: dadt (:) !! \\frac{d\\alpha}{dT} real ( pr ), intent ( out ) :: dadt2 (:) !! \\frac{d^2\\alpha}{dT^2} associate ( k => self % k ) a = ( 3 / ( 2 + Tr )) ** k dadT = - k * a / ( 2 + Tr ) dadT2 = - ( k + 1 ) * dadT / ( 2 + Tr ) end associate end subroutine end module","tags":"","loc":"sourcefile/alphas.f90.html"},{"title":"tapenade_ge_api.f90 – yaeos","text":"Source Code module yaeos__tapenade_ge_api !! Module that wraps tapenade generated routines to calculate ! !! Ge and derivatives. use yaeos__constants , only : pr , R use yaeos__models_ge , only : GeModel implicit none private public :: GeModelTapenade type , abstract , extends ( GeModel ) :: GeModelTapenade contains procedure ( tapenade_ge ), deferred :: ge procedure ( tapenade_ge_d ), deferred :: ge_d procedure ( tapenade_ge_b ), deferred :: ge_b procedure ( tapenade_ge_d_b ), deferred :: ge_d_b procedure ( tapenade_ge_d_d ), deferred :: ge_d_d procedure :: excess_gibbs => excess_gibbs end type abstract interface subroutine tapenade_ge ( model , n , t , ge ) import GeModelTapenade , pr class ( GeModelTapenade ) :: model real ( pr ), intent ( in ) :: n (:), t real ( pr ), intent ( out ) :: ge end subroutine subroutine tapenade_ge_d ( model , n , nd , t , td , ge , ged ) import pr , GeModelTapenade class ( GeModelTapenade ) :: model real ( pr ), intent ( in ) :: n (:), t real ( pr ), intent ( in ) :: nd (:), td real ( pr ), intent ( out ) :: ge , ged end subroutine subroutine tapenade_ge_b ( model , n , nb , t , tb , ge , geb ) import pr , GeModelTapenade class ( GeModelTapenade ) :: model real ( pr ), intent ( in ) :: n (:), t real ( pr ) :: geb real ( pr ) :: nb (:), tb real ( pr ) :: ge end subroutine subroutine tapenade_ge_d_b ( model , & n , nb , nd , ndb , t , tb , td , tdb , & ge , geb , ged , gedb ) import pr , GeModelTapenade class ( GeModelTapenade ) :: model real ( pr ), intent ( in ) :: n (:), t real ( pr ) :: ge real ( pr ), intent ( in ) :: nd (:), td real ( pr ) :: ged real ( pr ) :: nb (:), tb real ( pr ) :: geb real ( pr ) :: ndb (:), tdb real ( pr ) :: gedb end subroutine subroutine tapenade_ge_d_d ( model , n , nd , t , td0 , td , ge , ged0 , ged , gedd ) import pr , GeModelTapenade class ( GeModelTapenade ) :: model real ( pr ), intent ( in ) :: n (:), t real ( pr ), intent ( in ) :: td0 real ( pr ), intent ( in ) :: nd (:), td real ( pr ), intent ( out ) :: ge , ged0 , ged , gedd end subroutine end interface contains subroutine excess_gibbs (& self , n , t , Ge , GeT , GeT2 , Gen , GeTn , Gen2 & ) !! Excess Gibbs model generic interface class ( GeModelTapenade ), intent ( in ) :: self real ( pr ), intent ( in ) :: n (:) real ( pr ), intent ( in ) :: t real ( pr ), optional , intent ( out ) :: Ge , GeT , GeT2 real ( pr ), optional , dimension ( size ( n )), intent ( out ) :: Gen , GeTn real ( pr ), optional , intent ( out ) :: Gen2 ( size ( n ), size ( n )) real ( pr ) :: nb ( size ( n )), nd ( size ( n )), ndb ( size ( n )) real ( pr ) :: tb , td , tdb , td0 real ( pr ) :: geb , ged , gedb , ged0 , gedd integer :: i , nc nc = size ( n ) if ( present ( Gen2 )) then do i = 1 , nc call reset_vars gedb = 1 if ( i <= nc ) then nd ( i ) = 1 end if call self % ge_d_b (& n , nb , nd , ndb , & t , tb , td , tdb , & ge , geb , ged , gedb & ) Gen2 ( i , :) = nb end do if ( present ( Gen )) Gen = ndb if ( present ( GeT )) GeT = tdb else if ( present ( Gen )) then call reset_vars geb = 1 call self % ge_b ( n , nb , t , tb , ge , geb ) Gen = nb if ( present ( GeT )) GeT = tb else end if if ( present ( GeTn )) GeTn = get_GenT () if ( present ( GeT2 )) GeT2 = get_dGedT2 () call reset_vars if ( present ( Ge )) call self % ge ( n , t , ge ) contains subroutine reset_vars nb = 0 nd = 0 ndb = 0 tb = 0 td = 0 td0 = 0 tdb = 0 ge = 0 geb = 0 ged = 0 ged0 = 0 gedb = 0 end subroutine function get_dGedT2 () real ( pr ) :: get_dGedT2 call reset_vars td = 1 td0 = 1 call self % ge_d_d (& n , nd , t , td0 , td , & ge , ged0 , ged , gedd & ) get_dGedT2 = gedd end function function get_GenT () real ( pr ) :: get_GenT ( size ( n )) call reset_vars gedb = 1 td = 1 call self % ge_d_b (& n , nb , nd , ndb , & t , tb , td , tdb , & ge , geb , ged , gedb & ) get_GenT = nb end function end subroutine end module","tags":"","loc":"sourcefile/tapenade_ge_api.f90.html"},{"title":"fit_kij_lij.f90 – yaeos","text":"Source Code module yaeos__fitting_fit_kij_lij !! Binary interaction parameters fitting problem. use yaeos__fitting , only : pr , FittingProblem , ArModel implicit none integer , parameter :: nc = 2 type , extends ( FittingProblem ) :: FitKijLij !! # Binary Interaction Parameters of Cubic EoS fitting problem !! Fit the binary interaction parameters of a mixtures. !! !! # Description !! Fitting setup for quadratic combining rules, it is possible to select !! which parameters will be optimized with the `fit_lij` and `fit_kij` !! attributes. !! !! # Examples !! !! ## Fit the kij BIP !! !! ```fortran !! type(CubicEoS) :: model ! Model to fit !! type(FitKijLij) :: fitting_problem ! Fitting problem specification !! type(EquilibriumState) :: exp_data(3) !! real(pr) :: X(2) ! parameter variables !! real(pr) :: error !! !! ! !! !! model = PengRobinson76(tc, pc, w) ! Model to fit !! !! fitting_problem%exp_data = exp_data !! fitting_problem%model = model !! fitting_problem%fit_kij = .true. !! !! X = 0 ! initial values == 0 !! err = optimize(X, fitting_problem) !! ``` !! !! # References !! logical :: fit_lij = . false . !! Fit the l_{ij} parameter logical :: fit_kij = . false . !! Fit the k_{ij} parameter contains procedure :: get_model_from_X => model_from_X end type FitKijLij contains subroutine model_from_X ( problem , X ) use yaeos , only : R , RKPR , PengRobinson78 , ArModel , QMR , CubicEoS real ( pr ), intent ( in ) :: X (:) class ( FitKijLij ), intent ( in out ) :: problem real ( pr ) :: kij ( nc , nc ), lij ( nc , nc ) if ( size ( X ) /= 2 ) error stop 1 kij = 0 kij ( 1 , 2 ) = X ( 1 ) kij ( 2 , 1 ) = kij ( 1 , 2 ) lij = 0 lij ( 1 , 2 ) = X ( 2 ) lij ( 2 , 1 ) = X ( 2 ) associate ( model => problem % model ) select type ( model ) class is ( CubicEoS ) associate ( mr => model % mixrule ) select type ( mr ) class is ( QMR ) if ( problem % fit_kij ) mr % k = kij if ( problem % fit_lij ) mr % l = lij end select end associate end select end associate end subroutine end module yaeos__fitting_fit_kij_lij","tags":"","loc":"sourcefile/fit_kij_lij.f90.html"},{"title":"phase_envelopes_pt.f90 – yaeos","text":"Source Code module yaeos__equilibria_boundaries_phase_envelopes_pt !! Phase boundaries line on the PT plane calculation procedures. use yaeos__constants , only : pr use yaeos__models , only : ArModel use yaeos__equilibria_equilibrium_state , only : EquilibriumState use yaeos__math_continuation , only : & continuation , continuation_solver , continuation_stopper implicit none type :: CriticalPoint !! Critical point real ( pr ) :: T !! Temperature [K] real ( pr ) :: P !! Pressure [bar] end type CriticalPoint type :: PTEnvel2 !! Two-phase isopleth. !! Phase boundary line of a fluid at constant composition. type ( EquilibriumState ), allocatable :: points (:) !! Each point through the line. type ( CriticalPoint ), allocatable :: cps (:) !! Critical points found along the line. contains procedure , pass :: write => write_PTEnvel2 generic , public :: write ( FORMATTED ) => write end type PTEnvel2 ! Saved volume values real ( pr ), private :: Vz real ( pr ), private :: Vy contains function pt_envelope_2ph (& model , z , first_point , & points , iterations , delta_0 , specified_variable_0 , & solver , stop_conditions & ) result ( envelopes ) !! PT two-phase envelope calculation procedure. !! !! Phase envelope calculation using the continuation method. !! Defaults to solving the saturation temperature and continues with !! an increment in it. The variable to specify can be changed by modifying !! `specified_variable_0` with the corresponding variable number. ! ======================================================================== use stdlib_optval , only : optval class ( ArModel ), intent ( in ) :: model !! Thermodyanmic model real ( pr ), intent ( in ) :: z (:) !! Vector of molar fractions type ( EquilibriumState ) :: first_point integer , optional , intent ( in ) :: points !! Maxmimum number of points, defaults to 500 integer , optional , intent ( in ) :: iterations !! Point solver maximum iterations, defaults to 100 real ( pr ), optional , intent ( in ) :: delta_0 !! Initial extrapolation \\Delta integer , optional , intent ( in ) :: specified_variable_0 !! Position of specified variable, since the vector of variables is !! X = [lnK_i, \\dots, lnT, lnP] the values for specification !! will be [1 \\dots nc] for the equilibria constants, nc+1 for !! lnT and nc + 2 for lnT. procedure ( continuation_solver ), optional :: solver !! Specify solver for each point, defaults to a full newton procedure procedure ( continuation_stopper ), optional :: stop_conditions !! Function that returns true if the continuation method should stop type ( PTEnvel2 ) :: envelopes ! ------------------------------------------------------------------------ integer :: nc !! Number of components integer :: ns !! Number of specified variable real ( pr ) :: dS0 !! Initial specification step real ( pr ) :: S0 !! Initial specification value integer :: max_points !! Maximum number of points integer :: max_iterations !! Maximum number of iterations real ( pr ) :: X ( size ( z ) + 2 ) !! Vector of variables used in the continuation method real ( pr ), allocatable :: XS (:, :) !! All the calculated variables that are returned on the continuation !! method procedure (unused since each point is saved on the fly) character ( len = 14 ) :: kind ! ======================================================================== ! Handle input ! ------------------------------------------------------------------------ kind = first_point % kind nc = size ( z ) max_points = optval ( points , 500 ) max_iterations = optval ( iterations , 100 ) ns = optval ( specified_variable_0 , nc + 1 ) dS0 = optval ( delta_0 , 0.1_pr ) ! Correctly define the K-values based on the provided incipient point. select case ( first_point % kind ) case ( \"bubble\" , \"liquid-liquid\" ) X (: nc ) = log ( first_point % y / z ) case ( \"dew\" ) X (: nc ) = log ( first_point % x / z ) end select X ( nc + 1 ) = log ( first_point % T ) X ( nc + 2 ) = log ( first_point % P ) S0 = X ( ns ) allocate ( envelopes % points ( 0 ), envelopes % cps ( 0 )) ! ======================================================================== ! Trace the line using the continuation method. ! ------------------------------------------------------------------------ XS = continuation (& foo , X , ns0 = ns , S0 = S0 , & dS0 = dS0 , max_points = max_points , solver_tol = 1.e-9_pr , & update_specification = update_spec , & solver = solver , stop = stop_conditions & ) contains subroutine foo ( X , ns , S , F , dF , dFdS ) !! Function that needs to be solved at each envelope point real ( pr ), intent ( in ) :: X (:) integer , intent ( in ) :: ns real ( pr ), intent ( in ) :: S real ( pr ), intent ( out ) :: F (:) real ( pr ), intent ( out ) :: dF (:, :) real ( pr ), intent ( out ) :: dFdS (:) character ( len = 14 ) :: kind_z , kind_y real ( pr ) :: y ( nc ) real ( pr ) :: lnPhi_z ( nc ), lnPhi_y ( nc ) real ( pr ) :: dlnphi_dt_z ( nc ), dlnphi_dt_y ( nc ) real ( pr ) :: dlnphi_dp_z ( nc ), dlnphi_dp_y ( nc ) real ( pr ) :: dlnphi_dn_z ( nc , nc ), dlnphi_dn_y ( nc , nc ) real ( pr ) :: T , P , K ( nc ) integer :: i , j F = 0 dF = 0 K = exp ( X (: nc )) T = exp ( X ( nc + 1 )) P = exp ( X ( nc + 2 )) y = K * z select case ( kind ) case ( \"bubble\" ) kind_z = \"liquid\" kind_y = \"vapor\" case ( \"dew\" ) kind_z = \"vapor\" kind_y = \"liquid\" case ( \"liquid-liquid\" ) kind_z = \"liquid\" kind_y = \"liquid\" case default kind_z = \"stable\" kind_y = \"stable\" end select call model % lnphi_pt (& z , P , T , V = Vz , root_type = kind_z , & lnPhi = lnphi_z , dlnPhidt = dlnphi_dt_z , & dlnPhidp = dlnphi_dp_z , dlnphidn = dlnphi_dn_z & ) call model % lnphi_pt (& y , P , T , V = Vy , root_type = kind_y , & lnPhi = lnphi_y , dlnPhidt = dlnphi_dt_y , & dlnPhidp = dlnphi_dp_y , dlnphidn = dlnphi_dn_y & ) F (: nc ) = X (: nc ) + lnPhi_y - lnPhi_z F ( nc + 1 ) = sum ( y - z ) F ( nc + 2 ) = X ( ns ) - S ! Jacobian Matrix do j = 1 , nc df (: nc , j ) = dlnphi_dn_y (:, j ) * y ( j ) df ( j , j ) = dF ( j , j ) + 1 end do df (: nc , nc + 1 ) = T * ( dlnphi_dt_y - dlnphi_dt_z ) df (: nc , nc + 2 ) = P * ( dlnphi_dp_y - dlnphi_dp_z ) df ( nc + 1 , : nc ) = y df ( nc + 2 , :) = 0 df ( nc + 2 , ns ) = 1 dFdS = 0 dFdS ( nc + 2 ) = - 1 end subroutine foo subroutine update_spec ( X , ns , S , dS , dXdS , step_iters ) !! Update the specification during continuation. real ( pr ), intent ( in out ) :: X (:) !! Vector of variables [lnK_i \\dots , lnT, lnP] integer , intent ( in out ) :: ns !! Number of specified variable in the vector real ( pr ), intent ( in out ) :: S !! Variable specification value real ( pr ), intent ( in out ) :: dS !! Step in specification real ( pr ), intent ( in out ) :: dXdS (:) !! Variation of variables with respect to specification integer , intent ( in ) :: step_iters !! Iterations used in the solver real ( pr ) :: maxdS ! ===================================================================== ! Update specification ! - Dont select T or P near critical points ! - Update dS wrt specification units ! - Set step ! --------------------------------------------------------------------- if ( maxval ( abs ( X (: nc ))) < 0.1_pr ) then ns = maxloc ( abs ( dXdS (: nc )), dim = 1 ) maxdS = 0.01_pr else ns = maxloc ( abs ( dXdS ), dim = 1 ) maxdS = 0.05_pr end if dS = dXdS ( ns ) * dS dXdS = dXdS / dXdS ( ns ) dS = sign ( 1.0_pr , dS ) * minval ([ & max ( sqrt ( abs ( X ( ns )) / 1 0._pr ), 0.1_pr ), & abs ( dS ) * 3 / step_iters & ] & ) dS = sign ( 1.0_pr , dS ) * maxval ([ abs ( dS ), maxdS ]) call save_point ( X , step_iters ) call detect_critical ( X , dXdS , ns , S , dS ) end subroutine update_spec subroutine save_point ( X , iters ) !! Save the converged point real ( pr ), intent ( in ) :: X (:) integer , intent ( in ) :: iters type ( EquilibriumState ) :: point real ( pr ) :: y ( nc ), T , P T = exp ( X ( nc + 1 )) P = exp ( X ( nc + 2 )) y = exp ( X (: nc )) * z select case ( kind ) case ( \"bubble\" ) point = EquilibriumState (& kind = \"bubble\" , x = z , Vx = Vz , y = y , Vy = Vy , & T = T , P = P , beta = 0._pr , iters = iters & ) case ( \"dew\" ) point = EquilibriumState (& kind = \"dew\" , x = y , Vx = Vy , y = z , Vy = Vz , & T = T , P = P , beta = 1._pr , iters = iters & ) case default point = EquilibriumState (& kind = kind , x = z , Vx = Vz , y = y , Vy = Vy , & T = T , P = P , beta = 0._pr , iters = iters & ) end select envelopes % points = [ envelopes % points , point ] end subroutine save_point subroutine detect_critical ( X , dXdS , ns , S , dS ) !! # `detect_critical` !! Critical point detection !! !! # Description !! If the values of lnK (X[:nc]) change sign then a critical point !! Has passed, since for this to happen all variables should pass !! through zero. Near critical points (lnK < 0.05) points are harder !! to converge, so more steps in the extrapolation vector are made to !! jump over the critical point. !! If the critical point is detected then the kind of the point is !! changed and the point is saved using an interpolation knowing that !! !! !! X_c = a * X + (1-a)*X_{new} !! !! !! With X_c is the variables at the critical point, X_{new} !! is the new initialization point of the method and a is the !! parameter to interpolate the values. This subroutine finds the !! value of a to obtain X_c. real ( pr ), intent ( in out ) :: X (:) !! Vector of variables real ( pr ), intent ( in out ) :: dXdS (:) !! Variation of variables wrt S integer , intent ( in out ) :: ns !! Number of specified variable real ( pr ), intent ( in out ) :: S !! Specification value real ( pr ), intent ( in out ) :: dS !! Step in specification real ( pr ) :: Xc ( nc + 2 ) !! Value at (near) critical point real ( pr ) :: a !! Parameter for interpolation real ( pr ) :: Xold ( size ( X )) !! Old value of X real ( pr ) :: Xnew ( size ( X )) !! Value of the next initialization Xold = X do while ( maxval ( abs ( X (: nc ))) < 0.01 ) ! If near a critical point, jump over it S = S + dS X = X + dXdS * dS end do Xnew = X + dXdS * dS if ( all ( Xold (: nc ) * ( Xnew (: nc )) < 0 )) then select case ( kind ) case ( \"dew\" ) kind = \"bubble\" case ( \"bubble\" ) kind = \"dew\" case default kind = \"liquid-liquid\" end select ! 0 = a*X(ns) + (1-a)*Xnew(ns) < Interpolation equation to get X(ns) = 0 a = - Xnew ( ns ) / ( X ( ns ) - Xnew ( ns )) Xc = a * X + ( 1 - a ) * Xnew envelopes % cps = [& envelopes % cps , CriticalPoint ( T = exp ( Xc ( nc + 1 )), P = exp ( Xc ( nc + 2 ))) & ] X = Xc + dXdS * dS end if end subroutine detect_critical end function pt_envelope_2ph subroutine write_PTEnvel2 ( pt2 , unit , iotype , v_list , iostat , iomsg ) class ( PTEnvel2 ), intent ( in ) :: pt2 integer , intent ( in ) :: unit character ( * ), intent ( in ) :: iotype integer , intent ( in ) :: v_list (:) integer , intent ( out ) :: iostat character ( * ), intent ( inout ) :: iomsg integer , allocatable :: cps (:) integer :: cp integer :: i , nc if ( size ( pt2 % points ) == 0 ) return allocate ( cps ( 0 )) do i = 1 , size ( pt2 % cps ) cp = minloc (& ( pt2 % points % T - pt2 % cps ( i )% T ) ** 2 & + ( pt2 % points % P - pt2 % cps ( i )% P ) ** 2 , dim = 1 & ) cps = [ cps , cp ] end do write ( unit , \"(A, /, /)\" , iostat = iostat ) \"#PTEnvel2\" write ( unit , \"(A, /)\" ) \"#\" // pt2 % points ( 1 )% kind do i = 1 , size ( pt2 % points ) - 1 ! Change label if passed a critical point if ( any ( cps - i == 0 ) . and . i < size ( pt2 % points )) then write ( unit , \"(/, /)\" ) write ( unit , \"(A, /)\" ) \"#\" // pt2 % points ( i + 1 )% kind end if write ( unit , * ) pt2 % points ( i ) write ( unit , \"(/)\" ) end do write ( unit , \"(/, /, A, /)\" ) \"#Critical\" do cp = 1 , size ( cps ) write ( unit , * ) pt2 % cps ( cp )% T , pt2 % cps ( cp )% P end do end subroutine write_PTEnvel2 end module yaeos__equilibria_boundaries_phase_envelopes_pt","tags":"","loc":"sourcefile/phase_envelopes_pt.f90.html"},{"title":"armodel_adiff_api.f90 – yaeos","text":"Source Code module yaeos__adiff_hyperdual_ar_api !! Module that contains the automatic differentiation logic for an Ar model. !! !! All that is needed to define an Ar model that uses automatic !! differentiation with hyperdual numbers is to define a new derived type !! that overloads the method to the Ar function that you want to use. !! A minimal example follows: !! !! ```fortran !! module newmodel !! use yaeos__adiff_hyperdual_ar_api, only: ArModelAdiff !! !! type, extends(ArModelAdiff) :: YourNewModel !! type(Substances) :: composition !! real(8) :: parameters(:) !! contains !! procedure :: Ar => arfun !! procedure :: get_v0 => v0 !! end type !! contains !! subroutine arfun(self, n, v, t, Ar) !! class(YourNewModel), intent(in) :: self !! type(hyperdual), intent(in) :: n(:) ! Number of moles !! type(hyperdual), intent(in) :: v ! Volume [L] !! type(hyperdual), intent(in) :: t ! Temperature [K] !! type(hyperdual), intent(out) :: ar_value ! Residual Helmholtz Energy !! !! ! A very complicated residual helmholtz function of a mixture !! Ar = sum(n) * v * t !! end subroutine !! !! function v0(self, n, p, t) !! class(YourNewModel), intent(in) :: self !! real(pr), intent(in) :: n(:) ! Number of moles !! real(pr), intent(in) :: p ! Pressure [bar] !! real(pr), intent(in) :: t ! Temperature [K] !! real(pr) :: v0 !! !! v0 = self%parameters(3) !! end function !! ``` !! !! A complete implementation of the PR76 Equation of State can me found in !! `example/adiff/adiff_pr76.f90` !! use yaeos__constants , only : pr use yaeos__models_ar , only : ArModel use hyperdual_mod implicit none type , abstract , extends ( ArModel ) :: ArModelAdiff contains procedure ( hyperdual_ar ), deferred :: Ar procedure :: residual_helmholtz => residual_helmholtz end type abstract interface type ( hyperdual ) function hyperdual_Ar ( self , n , v , t ) import hyperdual , ArModelAdiff class ( ArModelAdiff ) :: self type ( hyperdual ), intent ( in ) :: n (:) type ( hyperdual ), intent ( in ) :: v type ( hyperdual ), intent ( in ) :: t end function end interface contains subroutine residual_helmholtz (& self , n , v , t , Ar , ArV , ArT , ArTV , ArV2 , ArT2 , Arn , ArVn , ArTn , Arn2 & ) class ( ArModelAdiff ), intent ( in ) :: self real ( pr ), intent ( in ) :: n (:) real ( pr ), intent ( in ) :: v , t real ( pr ), optional , intent ( out ) :: Ar , ArV , ArT , ArT2 , ArTV , ArV2 real ( pr ), optional , dimension ( size ( n )), intent ( out ) :: Arn , ArVn , ArTn real ( pr ), optional , intent ( out ) :: Arn2 ( size ( n ), size ( n )) type ( hyperdual ) :: d_v , d_t , d_n ( size ( n )) type ( hyperdual ) :: d_Ar if ( present ( ArV )) then if ( present ( ArV2 )) call get_dardv2 if ( present ( ArVn )) call get_dardvn if ( present ( ArTV )) call get_dardvt if (. not . ( present ( ArV2 ) . and . present ( ArVn ) . and . present ( ArTV ))) & call get_dardv end if if ( present ( ArT )) then if ( present ( ArT2 )) call get_dardt2 if ( present ( ArTn )) call get_dardtn if (. not . ( present ( ArT2 ) . and . present ( ArTn ))) call get_dardt end if if ( present ( Arn )) then if ( present ( Arn2 )) then call get_dardn2 else call get_dardn end if end if if ( present ( Ar )) Ar = d_Ar % f0 contains subroutine get_dardn () integer :: i , j do i = 2 , size ( n ), 2 call reset_vars d_n ( i - 1 )% f1 = 1 d_n ( i )% f2 = 1 d_Ar = self % Ar ( d_n , d_v , d_t ) Arn ( i - 1 ) = d_Ar % f1 Arn ( i ) = d_Ar % f2 end do if ( mod ( size ( n ), 2 ) /= 0 ) then call reset_vars d_n ( size ( n ))% f1 = 1 d_Ar = self % Ar ( d_n , d_v , d_t ) Arn ( size ( n )) = d_Ar % f1 end if end subroutine subroutine get_dardn2 () integer :: i , j do i = 1 , size ( n ) do j = i , size ( n ) call reset_vars d_n ( i )% f1 = 1 d_n ( j )% f2 = 1 d_Ar = self % Ar ( d_n , d_v , d_t ) Arn ( i ) = d_Ar % f1 Arn2 ( i , j ) = d_Ar % f12 Arn2 ( j , i ) = d_Ar % f12 end do end do end subroutine subroutine get_dardvn () integer :: i do i = 1 , size ( n ) call reset_vars d_n ( i )% f1 = 1 d_v % f2 = 1 d_Ar = self % Ar ( d_n , d_v , d_t ) Arn ( i ) = d_Ar % f1 ArV = d_Ar % f2 ArVn ( i ) = d_Ar % f12 end do end subroutine subroutine get_dardtn () integer :: i do i = 1 , size ( n ) call reset_vars d_n ( i )% f1 = 1 d_t % f2 = 1 d_Ar = self % Ar ( d_n , d_v , d_t ) Arn ( i ) = d_Ar % f1 ArT = d_Ar % f2 ArTn ( i ) = d_Ar % f12 end do end subroutine subroutine get_dardv () call reset_vars d_v % f1 = 1 d_Ar = self % Ar ( d_n , d_v , d_t ) ArV = d_Ar % f1 end subroutine subroutine get_dardt () call reset_vars d_t % f1 = 1 d_Ar = self % Ar ( d_n , d_v , d_t ) ArT = d_Ar % f1 end subroutine subroutine get_dardt2 () call reset_vars d_t % f1 = 1 d_t % f2 = 1 d_Ar = self % Ar ( d_n , d_v , d_t ) ArT = d_Ar % f1 ArT2 = d_Ar % f12 end subroutine subroutine get_dardv2 () call reset_vars d_v % f1 = 1 d_v % f2 = 1 d_Ar = self % Ar ( d_n , d_v , d_t ) ArV = d_Ar % f1 ArV2 = d_Ar % f12 end subroutine subroutine get_dardvt () call reset_vars d_v % f1 = 1 d_t % f2 = 1 d_Ar = self % Ar ( d_n , d_v , d_t ) ArV = d_Ar % f1 ArTV = d_Ar % f12 end subroutine subroutine reset_vars () d_n = n d_v = v d_t = t end subroutine end subroutine end module","tags":"","loc":"sourcefile/armodel_adiff_api.f90.html"},{"title":"model_parameters.f90 – yaeos","text":"Source Code module yaeos__models_ge_group_contribution_model_parameters !! # G^E group contribution model parameters !! G^E group contribution model parameters module. !! !! # Description !! This module contrains the GeGCModelParameters type that allows to store !! the subgroups ids, maingroups ids, subgroups Rs, subgroups Qs, !! subgroups maingroups, and maingroups interaction parameters for UNIFAC !! like models (UNIFAC, LL-UNIFAC, Dortmund UNIFAC, PSRK, etc) !! use yaeos__constants , only : pr implicit none type :: GeGCModelParameters !! # GeGCModelParameters !! G^E group contribution model parameters container !! !! # Description !! Type to represent a UNIFAC like models parameters. The type must be !! provided with the subgroups ids, maingroups ids, subgroups Rs, !! subgroups Qs, subgroups maingroups, and maingroups interaction !! parameters. Specifically, the type requires a_{ij}, b_{ij}, and !! c_{ij} for the maingroups interaction parameters. In the case of !! the classic UNIFAC model that only requires a_{ij} parameters, the !! b_{ij} and c_{ij} must be set as null matrixes. !! The documentation and source code of `yaeos` [[UNIFACParameters]] !! function could be consulted to understand how to instantiate a !! [[GeGCModelParameters]] object with the classic liquid-vapor UNIFAC !! parameters defined in DDBST. !! !! # References !! 1. [Dortmund Data Bank Software & Separation Technology](https://www.dd !! bst.com/published-parameters-unifac.html) !! integer , allocatable :: subgroups_ids (:) !! ID of each model's subgroup integer , allocatable :: maingroups_ids (:) !! ID of each model's maingroup integer , allocatable :: subgroups_maingroups (:) !! Maingroup of each subgroup real ( pr ), allocatable :: subgroups_Rs (:) !! R value of each subgroup real ( pr ), allocatable :: subgroups_Qs (:) !! Q value of each subgroup real ( pr ), allocatable :: maingroups_aij (:,:) !! Maingroup a_{ij} interaction parameters matrix real ( pr ), allocatable :: maingroups_bij (:,:) !! Maingroup b_{ij} interaction parameters matrix real ( pr ), allocatable :: maingroups_cij (:,:) !! Maingroup c_{ij} interaction parameters matrix contains procedure :: get_subgroup_index => get_subgroup_index procedure :: get_maingroup_index => get_maingroup_index procedure :: get_subgroup_maingroup => get_subgroup_maingroup procedure :: get_subgroup_R => get_subgroup_R procedure :: get_subgroup_Q => get_subgroup_Q procedure :: get_maingroups_aij => get_maingroups_aij procedure :: get_maingroups_bij => get_maingroups_bij procedure :: get_maingroups_cij => get_maingroups_cij procedure :: get_subgroups_aij => get_subgroups_aij procedure :: get_subgroups_bij => get_subgroups_bij procedure :: get_subgroups_cij => get_subgroups_cij end type GeGCModelParameters contains function get_subgroup_index ( self , subgroup_id ) result ( subgroup_idx ) !! # get_subgroup_index !! Get index of the subgroup with id: `subgroup_id` !! !! # Description !! Get index of the subgroup with id: `subgroup_id`. Gets the index of the !! subgroup in the `self%subgroups_ids` vector. !! !! # Examples !! !! ```fortran !! use yaeos__models_ge_group_contribution_unifac_parameters, only: UNIFACParameters !! use yaeos__models_ge_group_contribution_model_parameters, only: GeGCModelParameters !! !! type(GeGCModelParameters) :: parameters !! !! ! Default parameters of UNIFAC (ddbst) !! parameters = UNIFACParameters() !! !! ! Get index of the subgroup with id 178 (IMIDAZOL) !! print *, parameters%get_subgroup_index(178) ! Will print: 112 !! ``` !! !! # References !! 1. [Dortmund Data Bank Software & Separation Technology](https://www.dd !! bst.com/published-parameters-unifac.html) !! class ( GeGCModelParameters ) :: self integer , intent ( in ) :: subgroup_id !! ID of the subgroup integer :: subgroup_idx !! Index of the subgroup on the `self%subgroups_ids` vector subgroup_idx = findloc ( self % subgroups_ids , subgroup_id , dim = 1 ) end function get_subgroup_index function get_maingroup_index ( self , maingroup_id ) result ( maingroup_idx ) !! # get_maingroup_index !! Get index of the maingoup with id: `maingoup_id` !! !! # Description !! Get index of the maingoup with id: `maingoup_id`. Gets the index of the !! maingoup in the `self%maingoups_ids` vector. !! !! # Examples !! !! ```fortran !! use yaeos__models_ge_group_contribution_unifac_parameters, only: UNIFACParameters !! use yaeos__models_ge_group_contribution_model_parameters, only: GeGCModelParameters !! !! type(GeGCModelParameters) :: parameters !! !! parameters = UNIFACParameters() !! !! ! Get index of the maingroup with id 55 (Sulfones: [118](CH2)2SU [119]CH2CHSU) !! print *, parameters%get_maingroup_index(55) ! Will print: 52 !! ``` !! !! # References !! 1. [Dortmund Data Bank Software & Separation Technology](https://www.dd !! bst.com/published-parameters-unifac.html) !! class ( GeGCModelParameters ) :: self integer , intent ( in ) :: maingroup_id !! ID of the subgroup integer :: maingroup_idx !! Index of the maingroup on the `self%maingroups_ids` vector maingroup_idx = findloc ( self % maingroups_ids , maingroup_id , dim = 1 ) end function get_maingroup_index function get_subgroup_maingroup ( self , subgroup_id ) result ( subgroup_maingroup ) !! # get_subgroup_maingroup !! Get the subgroup's maingroup !! !! # Description !! Uses the `self%subgroups_maingroups` attribute to locate the maingroup !! where the subgroup with id `subgroup_id` belongs !! !! # Examples !! !! ```fortran !! use yaeos__models_ge_group_contribution_unifac_parameters, only: UNIFACParameters !! use yaeos__models_ge_group_contribution_model_parameters, only: GeGCModelParameters !! !! type(GeGCModelParameters) :: parameters !! !! parameters = UNIFACParameters() !! !! ! Get the maingroup of the subgroup with id 16 (H2O) !! print *, parameters%get_subgroup_maingroup(16) ! Will print: 7 !! ``` !! !! # References !! 1. [Dortmund Data Bank Software & Separation Technology](https://www.dd !! bst.com/published-parameters-unifac.html) !! class ( GeGCModelParameters ) :: self integer , intent ( in ) :: subgroup_id !! ID of the subgroup integer :: subgroup_maingroup !! Maingroup of the subgroup integer :: subgroup_idx subgroup_idx = self % get_subgroup_index ( subgroup_id ) subgroup_maingroup = self % subgroups_maingroups ( subgroup_idx ) end function get_subgroup_maingroup function get_subgroup_R ( self , subgroup_id ) result ( subgroup_R ) !! # get_subgroup_R !! Get the subgroup's R value !! !! # Description !! Uses the `self%subgroups_Rs` attribute to locate the subgroup R !! value. !! !! # Examples !! !! ```fortran !! use yaeos__models_ge_group_contribution_unifac_parameters, only: UNIFACParameters !! use yaeos__models_ge_group_contribution_model_parameters, only: GeGCModelParameters !! !! type(GeGCModelParameters) :: parameters !! !! parameters = UNIFACParameters() !! !! ! Get the subgroup, with id 1 (CH3), R value !! print *, parameters%get_subgroup_R(1) ! Will print: 0.9011 !! ``` !! !! # References !! 1. [Dortmund Data Bank Software & Separation Technology](https://www.dd !! bst.com/published-parameters-unifac.html) !! class ( GeGCModelParameters ) :: self integer , intent ( in ) :: subgroup_id !! ID of the subgroup real ( pr ) :: subgroup_R !! R value of the subgroup integer :: subgroup_idx subgroup_idx = self % get_subgroup_index ( subgroup_id ) subgroup_R = self % subgroups_Rs ( subgroup_idx ) end function get_subgroup_R function get_subgroup_Q ( self , subgroup_id ) result ( subgroup_Q ) !! # get_subgroup_Q !! Get the subgroup's Q value !! !! # Description !! Uses the `self%subgroups_Qs` attribute to locate the subgroup Q !! value. !! !! # Examples !! !! ```fortran !! use yaeos__models_ge_group_contribution_unifac_parameters, only: UNIFACParameters !! use yaeos__models_ge_group_contribution_model_parameters, only: GeGCModelParameters !! !! type(GeGCModelParameters) :: parameters !! !! parameters = UNIFACParameters() !! !! ! Get the subgroup, with id 1 (CH3), Q value !! print *, parameters%get_subgroup_Q(1) ! Will print: 0.8480 !! ``` !! !! # References !! 1. [Dortmund Data Bank Software & Separation Technology](https://www.dd !! bst.com/published-parameters-unifac.html) !! class ( GeGCModelParameters ) :: self integer , intent ( in ) :: subgroup_id !! ID of the subgroup real ( pr ) :: subgroup_Q !! Q value of the subgroup integer :: subgroup_idx subgroup_idx = self % get_subgroup_index ( subgroup_id ) subgroup_Q = self % subgroups_Qs ( subgroup_idx ) end function get_subgroup_Q function get_maingroups_aij ( self , maingroup_i_id , maingroup_j_id ) result ( aij ) !! # get_maingroups_aij !! Get the interaction parameter a_{ij} !! !! # Description !! Get the interaction parameter a_{ij} of the maingroups `i` and `j` !! ids. !! !! # Examples !! !! ```fortran !! use yaeos__models_ge_group_contribution_unifac_parameters, only: UNIFACParameters !! use yaeos__models_ge_group_contribution_model_parameters, only: GeGCModelParameters !! !! type(GeGCModelParameters) :: parameters !! !! parameters = UNIFACParameters() !! !! ! Get the maingroups i:1, j:7 interaction parameter aij (CH2-H2O) !! print *, parameters%get_maingroups_aij(1, 7) ! prints: 1318.0000 !! ``` !! !! # References !! 1. [Dortmund Data Bank Software & Separation Technology](https://www.dd !! bst.com/published-parameters-unifac.html) !! class ( GeGCModelParameters ) :: self integer , intent ( in ) :: maingroup_i_id !! ID of the maingroup `i` integer , intent ( in ) :: maingroup_j_id !! ID of the maingroup `j` real ( pr ) :: aij !! Interaction parameter a_{ij} integer :: i , j i = self % get_maingroup_index ( maingroup_i_id ) j = self % get_maingroup_index ( maingroup_j_id ) aij = self % maingroups_aij ( i , j ) end function get_maingroups_aij function get_maingroups_bij ( self , maingroup_i_id , maingroup_j_id ) result ( bij ) !! # get_maingroups_bij !! Get the interaction parameter b_{ij} !! !! # Description !! Get the interaction parameter b_{ij} of the maingroups `i` and `j` !! ids. !! !! # Examples !! !! ```fortran !! use yaeos__models_ge_group_contribution_unifac_parameters, only: UNIFACParameters !! use yaeos__models_ge_group_contribution_model_parameters, only: GeGCModelParameters !! !! type(GeGCModelParameters) :: parameters !! !! parameters = UNIFACParameters() !! !! ! Get the maingroups i:1, j:7 interaction parameter bij (CH2-H2O) !! print *, parameters%get_maingroups_bij(1, 7) ! prints: 0.0 !! ``` !! !! In the example we obtain 0.0 because UNIFAC only have a_{ij} !! parameters !! !! # References !! 1. [Dortmund Data Bank Software & Separation Technology](https://www.dd !! bst.com/published-parameters-unifac.html) !! class ( GeGCModelParameters ) :: self integer , intent ( in ) :: maingroup_i_id !! ID of the maingroup `i` integer , intent ( in ) :: maingroup_j_id !! ID of the maingroup `j` real ( pr ) :: bij !! Interaction parameter b_{ij} integer :: i , j i = self % get_maingroup_index ( maingroup_i_id ) j = self % get_maingroup_index ( maingroup_j_id ) bij = self % maingroups_bij ( i , j ) end function get_maingroups_bij function get_maingroups_cij ( self , maingroup_i_id , maingroup_j_id ) result ( cij ) !! # get_maingroups_cij !! Get the interaction parameter c_{ij} !! !! # Description !! Get the interaction parameter c_{ij} of the maingroups `i` and `j` !! ids. !! !! # Examples !! !! ```fortran !! use yaeos__models_ge_group_contribution_unifac_parameters, only: UNIFACParameters !! use yaeos__models_ge_group_contribution_model_parameters, only: GeGCModelParameters !! !! type(GeGCModelParameters) :: parameters !! !! parameters = UNIFACParameters() !! !! ! Get the maingroups i:1, j:7 interaction parameter cij (CH2-H2O) !! print *, parameters%get_maingroups_cij(1, 7) ! prints: 0.0 !! ``` !! !! In the example we obtain 0.0 because UNIFAC only have a_{ij} !! parameters !! !! # References !! 1. [Dortmund Data Bank Software & Separation Technology](https://www.dd !! bst.com/published-parameters-unifac.html) !! class ( GeGCModelParameters ) :: self integer , intent ( in ) :: maingroup_i_id !! ID of the maingroup `i` integer , intent ( in ) :: maingroup_j_id !! ID of the maingroup `j` real ( pr ) :: cij !! Interaction parameter c_{ij} integer :: i , j i = self % get_maingroup_index ( maingroup_i_id ) j = self % get_maingroup_index ( maingroup_j_id ) cij = self % maingroups_cij ( i , j ) end function get_maingroups_cij function get_subgroups_aij ( self , subgroup_i_id , subgroup_j_id ) result ( aij ) !! # get_subgroups_aij !! Get the interaction parameter a_{ij} !! !! # Description !! Get the interaction parameter a_{ij} of the subgroups `i` and `j` !! ids. !! !! # Examples !! !! ```fortran !! use yaeos__models_ge_group_contribution_unifac_parameters, only: UNIFACParameters !! use yaeos__models_ge_group_contribution_model_parameters, only: GeGCModelParameters !! !! type(GeGCModelParameters) :: parameters !! !! parameters = UNIFACParameters() !! !! ! Get the subgroups i:1, j:16 interaction parameter aij (CH3-H2O) !! ! with maingroups 1 and 7 respectively. !! print *, parameters%get_subgroups_aij(1, 16) ! prints: 1318.0000 !! ``` !! !! # References !! 1. [Dortmund Data Bank Software & Separation Technology](https://www.dd !! bst.com/published-parameters-unifac.html) !! class ( GeGCModelParameters ) :: self integer , intent ( in ) :: subgroup_i_id !! ID of the subgroup `i` integer , intent ( in ) :: subgroup_j_id !! ID of the subgroup `j` real ( pr ) :: aij !! Interaction parameter a_{ij} integer :: mi_id , mj_id , i , j mi_id = self % get_subgroup_maingroup ( subgroup_i_id ) mj_id = self % get_subgroup_maingroup ( subgroup_j_id ) i = self % get_maingroup_index ( mi_id ) j = self % get_maingroup_index ( mj_id ) aij = self % maingroups_aij ( i , j ) end function get_subgroups_aij function get_subgroups_bij ( self , subgroup_i_id , subgroup_j_id ) result ( bij ) !! # get_subgroups_bij !! Get the interaction parameter b_{ij} !! !! # Description !! Get the interaction parameter b_{ij} of the subgroups `i` and `j` !! ids. !! !! # Examples !! !! ```fortran !! use yaeos__models_ge_group_contribution_unifac_parameters, only: UNIFACParameters !! use yaeos__models_ge_group_contribution_model_parameters, only: GeGCModelParameters !! !! type(GeGCModelParameters) :: parameters !! !! parameters = UNIFACParameters() !! !! ! Get the subgroups i:1, j:16 interaction parameter bij (CH3-H2O) !! ! with maingroups 1 and 7 respectively. !! print *, parameters%get_subgroups_bij(1, 16) ! prints: 0.0000 !! ``` !! !! In the example we obtain 0.0 because UNIFAC only have a_{ij} !! parameters !! !! # References !! 1. [Dortmund Data Bank Software & Separation Technology](https://www.dd !! bst.com/published-parameters-unifac.html) !! class ( GeGCModelParameters ) :: self integer , intent ( in ) :: subgroup_i_id !! ID of the subgroup `i` integer , intent ( in ) :: subgroup_j_id !! ID of the subgroup `j` real ( pr ) :: bij !! Interaction parameter b_{ij} integer :: mi_id , mj_id , i , j mi_id = self % get_subgroup_maingroup ( subgroup_i_id ) mj_id = self % get_subgroup_maingroup ( subgroup_j_id ) i = self % get_maingroup_index ( mi_id ) j = self % get_maingroup_index ( mj_id ) bij = self % maingroups_bij ( i , j ) end function get_subgroups_bij function get_subgroups_cij ( self , subgroup_i_id , subgroup_j_id ) result ( cij ) !! # get_subgroups_cij !! Get the interaction parameter c_{ij} !! !! # Description !! Get the interaction parameter c_{ij} of the subgroups `i` and `j` !! ids. !! !! # Examples !! !! ```fortran !! use yaeos__models_ge_group_contribution_unifac_parameters, only: UNIFACParameters !! use yaeos__models_ge_group_contribution_model_parameters, only: GeGCModelParameters !! !! type(GeGCModelParameters) :: parameters !! !! parameters = UNIFACParameters() !! !! ! Get the subgroups i:1, j:16 interaction parameter cij (CH3-H2O) !! ! with maingroups 1 and 7 respectively. !! print *, parameters%get_subgroups_cij(1, 16) ! prints: 0.0000 !! ``` !! !! In the example we obtain 0.0 because UNIFAC only have a_{ij} !! parameters !! !! # References !! 1. [Dortmund Data Bank Software & Separation Technology](https://www.dd !! bst.com/published-parameters-unifac.html) !! class ( GeGCModelParameters ) :: self integer , intent ( in ) :: subgroup_i_id !! ID of the subgroup `i` integer , intent ( in ) :: subgroup_j_id !! ID of the subgroup `j` real ( pr ) :: cij !! Interaction parameter c_{ij} integer :: mi_id , mj_id , i , j mi_id = self % get_subgroup_maingroup ( subgroup_i_id ) mj_id = self % get_subgroup_maingroup ( subgroup_j_id ) i = self % get_maingroup_index ( mi_id ) j = self % get_maingroup_index ( mj_id ) cij = self % maingroups_cij ( i , j ) end function get_subgroups_cij end module yaeos__models_ge_group_contribution_model_parameters","tags":"","loc":"sourcefile/model_parameters.f90.html"},{"title":"models.f90 – yaeos","text":"Source Code module yaeos__models !! `yaeos` thermodynamic models !! !! On `yaeos` there are implemented a series of both residual Helmholtz !! energy (A_r) and excess Gibbs energy (G^E) models. !! !! This module takes all the relevant procedures and derived types !! related to them. !! !! - Residual Helmholtz model base type `ArModel` base derived type !! that provides the basic structure that a residual Helmholtz model !! should provide. !! - **Cubic Equations of state**: !! - `AlphaFunction` type !! - `CubicMixRule` type !! - `CubicEos` type that extends `ArModel` to use a generic !! two-parameter EoS. Implemented models that use this type can be !! seen at [[yaeos__models_ar_cubic_implementations(module)]] !! - `QMR` (Quadratic Mixing Rule) type: extensible derived type that !! defaults to classic vdW mixing rules. !! - `MHV` (Modified Huron-Vidal) type: Michelsens first order modified !! Huron-Vidal mixing rule. ! Base model structure use yaeos__models_base , only : BaseModel ! Residual Helmholtz Models use yaeos__models_ar , only : ArModel , size ! Cubic EoS models use yaeos__models_ar_genericcubic , only : & CubicEoS , GenericCubic_Ar , AlphaFunction , CubicMixRule ! Alpha functions use yaeos__models_ar_cubic_alphas ! Mixing Rules use yaeos__models_ar_cubic_quadratic_mixing use yaeos__models_cubic_mixing_rules_huron_vidal ! Implemented models use yaeos__models_ar_cubic_implementations ! Ge Models use yaeos__models_ge , only : GeModel ! Implemented models use yaeos__models_ge_implementations end module","tags":"","loc":"sourcefile/models.f90.html"},{"title":"huron_vidal.f90 – yaeos","text":"Source Code module yaeos__models_cubic_mixing_rules_huron_vidal !! # Huron-Vidal (like) mixing rules module !! This module contains the mixing rules that are based/similar to the !! mixing rules defined by Huron-Vidal !! !! # Description !! Huron-Vidal presented a way to link a G^E model with a Cubic EoS !! mixing rule. This makes it possible to make good predictions on !! polar compounds containing mixtures. !! !! # Examples !! !! ```fortran !! A basic code example !! ``` !! !! # References !! use yaeos__constants , only : pr , R use yaeos__models_ar_genericcubic , only : CubicMixRule use yaeos__models_ar_cubic_mixing_base , only : bmix_qmr use yaeos__models_ge , only : GeModel implicit none private public :: MHV public :: DmixMHV type , extends ( CubicMixRule ) :: MHV !! # Michelsen's modified Huron-Vidal mixing rule !! Mixing rule at zero-pressure which allows for the inclusion of an !! excess-gibbs model. !! !! # Description !! This mixing rule is based on the aproximate zero-pressure limit !! of a cubic equation of state. At the aproximate zero-pressure limit the !! attractive parameter can be expressed as: !! !! !! \\frac{D}{RTB}(n, T) = \\sum_i n_i \\frac{a_i(T)}{b_i} + \\frac{1}{q} !! \\left(\\frac{G^E(n, T)}{RT} + \\sum_i n_i \\ln \\frac{B}{nb_i} \\right) !! !! Where q is a weak function of temperature. In the case of `MHV` !! and simplicity it is considered that depends on the model used. !! !! # Examples !! To use the modified Huron-Vidal mixing rule it is necessary to define !! a `CubicEoS` and replace its original mixing rule with the one generated !! by the user. !! ```fortran !! type(MHV) :: mixrule !! type(NRTL) :: ge_model !! type(CubicEoS) :: model !! !! ! Define the Ge model to be used and the CubicEoS !! ge_model = NRTL(a, b, c) !! model = SoaveRedlichKwong(tc, pc, w) !! !! ! Use the initialization function to setup !! mixrule = MHV(ge=ge_model, q=-0.593_pr, bi=model%b) !! !! ! Replace the original mixrule on the previously defined model !! model%mixrule = mixrule !! !! ! Ready to do calculations !! call pressure(model, n, v, T) !! ``` !! !! # References !! real ( pr ), allocatable :: l (:, :) real ( pr ), private , allocatable :: bi (:) real ( pr ), private , allocatable :: B , dBi (:), dBij (:, :) class ( GeModel ), allocatable :: ge real ( pr ) :: q contains procedure :: Bmix => BmixMHV procedure :: D1Mix => D1MixMHV procedure :: Dmix => DmixMHV end type interface MHV module procedure :: init end interface contains type ( MHV ) function init ( ge , b , q , lij ) result ( mixrule ) class ( GeModel ), intent ( in ) :: Ge real ( pr ), intent ( in ) :: b (:) real ( pr ), intent ( in ) :: q real ( pr ), optional , intent ( in ) :: lij (:, :) integer :: i , nc nc = size ( b ) mixrule % q = q mixrule % bi = b mixrule % Ge = ge if ( present ( lij )) then mixrule % l = lij else mixrule % l = reshape ([( 0 , i = 1 , nc ** 2 )], [ nc , nc ]) end if end function subroutine BmixMHV ( self , n , bi , B , dBi , dBij ) !! # Repulsive parameter B mixing rule !! Quadratinc mixing rule for the repulsive parameter, using !! b_{ij} = \\frac{b_i + b_j}{2} (1 - l_{ij}) as a combining rule. !! !! # Description !! Michelsen's modified Huron-Vidal mixing rule assumes a linear mix of !! the repulsive parameter. !! !! B = \\sum_i n_i b_i !! !! In this implementation the most known crossed combining rule is used: !! nB = \\sum_i \\sum_j \\frac{b_i + b_j}{2} (1 - l_{ij}) !! to provide versatility to the used model. !! !! @warning !! This mixing rule is intended to use only with a linear combining !! rule, using l_{ij} could negatively affect the thermodynamic !! consistency of the model. !! @endwarning !! !! # Examples !! !! ```fortran !! A basic code example !! ``` !! !! # References !! use yaeos__models_ar_cubic_mixing_base , only : bmix_linear class ( MHV ), intent ( in ) :: self real ( pr ), intent ( in ) :: n (:) real ( pr ), intent ( in ) :: bi (:) real ( pr ), intent ( out ) :: B , dBi (:), dBij (:, :) call bmix_qmr ( n , bi , self % l , b , dbi , dbij ) ! call bmix_linear(n, bi, b, dbi, dbij) end subroutine subroutine DmixMHV ( self , n , T , & ai , daidt , daidt2 , & D , dDdT , dDdT2 , dDi , dDidT , dDij & ) !! # Michelsen Modified Huron-Vidal mixing rule. !! Mixing rule at infinite pressure as defined in the book of Michelsen and !! Møllerup. !! !! # Description !! At the infinite pressure limit of a cubic equation of state it is possible to !! relate teh mixing rule for the attractive term with a excess Gibbs energy !! model like NRTL with the expression: !! !! !! \\frac{D}{RTB}(n, T) = \\sum_i n_i \\frac{a_i(T)}{b_i} + \\frac{1}{q} !! \\left(\\frac{G^E(n, T)}{RT} + \\sum_i n_i \\ln \\frac{B}{nb_i} \\right) !! !! !! # Examples !! !! ```fortran !! type(CubicEoS) !! ``` !! !! # References !! class ( MHV ), intent ( in ) :: self real ( pr ), intent ( in ) :: T , n (:) real ( pr ), intent ( in ) :: ai (:), daidt (:), daidt2 (:) real ( pr ), intent ( out ) :: D , dDdT , dDdT2 , dDi (:), dDidT (:), dDij (:, :) real ( pr ) :: f , fdt , fdt2 , fdi ( size ( n )), fdit ( size ( n )), fdij ( size ( n ), size ( n )) real ( pr ) :: b , bi ( size ( n )), dbi ( size ( n )), dbij ( size ( n ), size ( n )) real ( pr ) :: Ge , GeT , GeT2 , Gen ( size ( n )), GeTn ( size ( n )), Gen2 ( size ( n ), size ( n )) real ( pr ) :: totn !! Total number of moles real ( pr ) :: dot_n_logB_nbi real ( pr ) :: logB_nbi ( size ( n )) !! \\ln \\frac{B}{n b_i} real ( pr ) :: dlogBi_nbi ( size ( n )) real ( pr ) :: d2logBi_nbi ( size ( n ), size ( n )) integer :: i , j , l , nc real ( pr ) :: q nc = size ( n ) totn = sum ( n ) q = self % q bi = self % bi call self % ge % excess_gibbs ( & n , T , Ge = Ge , GeT = GeT , GeT2 = GeT2 , Gen = Gen , GeTn = GeTn , Gen2 = Gen2 & ) call self % Bmix ( n , bi , B , dBi , dBij ) logb_nbi = log ( B / ( totn * bi )) dot_n_logB_nbi = dot_product ( n , logB_nbi ) do i = 1 , nc dlogBi_nbi ( i ) = logB_nbi ( i ) + sum ( n * dBi ( i )) / B - 1 end do do i = 1 , nc do j = 1 , nc !TODO: Need to figure out this derivative d2logBi_nbi ( i , j ) = dlogBi_nbi ( j ) & + ( sum ( n * dBij ( i , j )) + dBi ( i )) / B & - totn * dBi ( i ) * dBi ( j ) / B ** 2 end do end do autodiff : block !! Autodiff injection until we can decipher this derivative use hyperdual_mod type ( hyperdual ) :: hB type ( hyperdual ) :: hdot_ln_B_nbi type ( hyperdual ) :: hn ( nc ) integer :: ii , jj hn = n do i = 1 , nc do j = i , nc hn = n hn ( i )% f1 = 1 hn ( j )% f2 = 1 hB = 0._pr do ii = 1 , nc do jj = 1 , nc hB = hB & + ( hn ( ii ) * hn ( jj )) & * 0.5_pr * ( bi ( ii ) + bi ( jj )) * ( 1._pr - self % l ( ii , jj )) end do end do hB = hB / sum ( hn ) hdot_ln_B_nbi = sum ( hn * log ( hB / ( sum ( hn ) * bi ))) d2logBi_nbi ( i , j ) = hdot_ln_B_nbi % f12 d2logBi_nbi ( j , i ) = hdot_ln_B_nbi % f12 end do end do end block autodiff f = sum ( n * ai / bi ) + ( Ge + R * T * dot_n_logB_nbi ) / q fdt = sum ( n * daidt / bi ) + ( GeT + R * dot_n_logB_nbi ) / q fdt2 = sum ( n * daidt2 / bi ) + ( GeT2 ) / q fdi = ai / bi + ( 1._pr / q ) * ( GeN + R * T * ( dlogBi_nbi )) fdit = daidt / bi + ( 1._pr / q ) * ( GeTn + R * ( dlogBi_nbi )) do i = 1 , nc do j = 1 , nc fdij ( i , j ) = R * T * ( d2logBi_nbi ( i , j )) fdij ( i , j ) = 1 / q * ( fdij ( i , j ) + GeN2 ( i , j )) fdij ( i , j ) = & dBi ( j ) * fdi ( i ) + B * fdij ( i , j ) + fdi ( j ) * dBi ( i ) + f * dBij ( i , j ) end do end do dDi = B * fdi + f * dBi dDidT = B * fdiT + fdT * dBi D = f * B dDdT = fdT * B dDdT2 = fdT2 * B dDij = fdij end subroutine subroutine D1MixMHV ( self , n , d1i , D1 , dD1i , dD1ij ) use yaeos__models_ar_cubic_mixing_base , only : d1mix_rkpr class ( MHV ), intent ( in ) :: self real ( pr ), intent ( in ) :: n (:) real ( pr ), intent ( in ) :: d1i (:) real ( pr ), intent ( out ) :: D1 real ( pr ), intent ( out ) :: dD1i (:) real ( pr ), intent ( out ) :: dD1ij (:, :) call d1mix_rkpr ( n , d1i , D1 , dD1i , dD1ij ) end subroutine D1MixMHV end module yaeos__models_cubic_mixing_rules_huron_vidal","tags":"","loc":"sourcefile/huron_vidal.f90.html"},{"title":"auxiliar.f90 – yaeos","text":"Source Code module yaeos__auxiliar use yaeos__constants , only : pr implicit none interface optval module procedure optval_integer , optval_real end interface optval contains integer function optval_integer ( val , default ) !! Set a value to a default if it is not defined use stdlib_optval , only : std => optval integer , optional , intent ( in out ) :: val integer , intent ( in ) :: default optval_integer = std ( val , default ) end function optval_integer real ( pr ) function optval_real ( val , default ) !! Set a value to a default if it is not defined use stdlib_optval , only : std => optval real ( pr ), optional , intent ( in out ) :: val real ( pr ), intent ( in ) :: default optval_real = std ( val , default ) end function optval_real subroutine sort ( array , idx ) use stdlib_sorting , only : std => sort !! Sort an array and return the indexes real ( pr ), intent ( in out ) :: array (:) integer , optional , intent ( out ) :: idx (:) call std ( array ) end subroutine sort end module yaeos__auxiliar","tags":"","loc":"sourcefile/auxiliar.f90~2.html"},{"title":"yaeos.f90 – yaeos","text":"Source Code module yaeos !! Yet Another Equation-Of-State (library) !! !! Library to use EoS-based calculations. This main module imports all the !! relevant constants, procedures and objects to have better access to them !! The main submodules that it uses are: !! !! - [[yaeos__constants(module)]]: All the relevant costants and also the used precision (default=double precision). !! - [[yaeos__consistency(module)]]: Tools to evalaute the consistency of Ar and Ge models. !! - [[yaeos__substance(module)]]: Derived type that holds the important data (for example, critical constants) from a mixture. !! - [[yaeos__models(module)]]: All the implemented models, also their base types for making extensions. !! - [[yaeos__equilibria(module)]]: Phase equilibria related procedures. use yaeos__constants use yaeos__consistency use yaeos__substance use yaeos__models use yaeos__equilibria character ( len =* ), parameter :: version = \"1.0.0\" !! This version. end module","tags":"","loc":"sourcefile/yaeos.f90.html"},{"title":"fit_nrtl_mhv.f90 – yaeos","text":"Source Code module yaeos__fitting_fit_nrtl_mhv use yaeos__constants , only : pr use yaeos__fitting , only : FittingProblem use yaeos__models , only : ArModel , NRTL , CubicEoS , MHV use forsus , only : Substance implicit none integer , parameter :: nc = 2 type , extends ( FittingProblem ) :: FitMHVNRTL logical :: fit_nrtl = . false . logical :: fit_lij = . false . contains procedure :: get_model_from_X => model_from_X end type FitMHVNRTL contains subroutine model_from_X ( problem , X ) use yaeos , only : R , RKPR , PengRobinson78 , ArModel , QMR , CubicEoS use yaeos__models_ar_cubic_quadratic_mixing , only : RKPR_D1mix class ( FitMHVNRTL ), intent ( in out ) :: problem real ( pr ), intent ( in ) :: X (:) type ( NRTL ) :: ge real ( pr ) :: a ( nc , nc ), b ( nc , nc ), c ( nc , nc ) a = 0 ; b = 0 ; c = 0 a ( 1 , 2 ) = x ( 1 ) a ( 2 , 1 ) = x ( 2 ) b ( 1 , 2 ) = x ( 3 ) b ( 2 , 1 ) = x ( 4 ) c ( 1 , 2 ) = x ( 5 ) c ( 2 , 1 ) = x ( 6 ) ge = NRTL ( a , b , c ) associate ( model => problem % model ) select type ( model ) class is ( CubicEoS ) associate ( mr => model % mixrule ) select type ( mr ) class is ( MHV ) if ( problem % fit_lij ) mr % l ( 1 , 2 ) = x ( 7 ) if ( problem % fit_lij ) mr % l ( 2 , 1 ) = x ( 7 ) if ( problem % fit_nrtl ) mr % ge = ge end select end associate end select end associate end subroutine model_from_X end module yaeos__fitting_fit_nrtl_mhv","tags":"","loc":"sourcefile/fit_nrtl_mhv.f90.html"},{"title":"generic_cubic.f90 – yaeos","text":"Source Code module yaeos__models_ar_genericcubic use yaeos__constants , only : pr use yaeos__models_ar , only : ArModel use yaeos__substance , only : Substances implicit none type , abstract :: AlphaFunction !! Abstract derived type that describe the required !! procedure for an alpha function. contains procedure ( abs_alpha ), deferred :: alpha end type type , abstract :: CubicMixRule !! Abstract derived type that describe the required !! procedure for a mixing rule on a Cubic EoS contains procedure ( abs_Dmix ), deferred :: Dmix procedure ( abs_Bmix ), deferred :: Bmix procedure ( abs_D1mix ), deferred :: D1mix end type type , extends ( ArModel ) :: CubicEoS !! # Cubic Equation of State. !! !! Generic Cubic Equation of State as defined by Michelsen and Mollerup !! with a \\delta_1 parameter that is not constant, !! and a \\delta_2 parameter that depends on it. In the case of a !! two parameter EoS like PengRobinson the \\delta_1 is the same for !! all components so it can be considered as a constant instead of a !! variable. The expression of the Equation is: !! !! !! P = \\frac{RT}{V-B} !! - \\frac{D(T_r)}{(V+B\\Delta_1)(V+B\\Delta_2)} !! class ( CubicMixRule ), allocatable :: mixrule !! # CubicMixRule derived type. !! Uses the abstract derived type `CubicMixRule` to define the !! mixing rule that the CubicEoS will use. It includes internally !! three methods to calculate the corresponding parameters for the !! Cubic EoS: `Dmix`, `Bmix` and `D1mix`. !! !! # Examples !! ## Calculation of the B parameter. !! ```fortran !! use yaeos, only: CubicEoS, PengRobinson76 !! type(CubicEoS) :: eos !! eos = PengRobinson76(tc, pc, w) !! call eos%mixrule%Bmix(n, eos%b, B, dBi, dBij) !! ``` !! ## Calculation of the D parameter. !! ```fortran !! use yaeos, only: CubicEoS, PengRobinson76 !! type(CubicEoS) :: eos !! eos = PengRobinson76(tc, pc, w) !! !! ! The mixing rule takes the `a` parameters of the components so !! ! they should be calculated externally !! call eos%alpha%alpha(Tr, a, dadt, dadt2) !! a = a * eos%ac !! dadt = dadt * eos%ac / eos%components%Tc !! dadt = dadt * eos%ac / eos%components%Tc**2 !! ! Calculate parameter !! call eos%mixrule%Dmix(n, T, a, dadt, dadt2, D, dDdT, dDdT2, dDi, dDidT, dDij) !! ``` !! ## Calculation of the D1 parameter. !! ```fortran !! use yaeos, only: CubicEoS, PengRobinson76 !! type(CubicEoS) :: eos !! eos = PengRobinson76(tc, pc, w) !! call eos%mixrule%D1mix(n, eos%del1, D1, dD1i, dD1ij) !! ``` class ( AlphaFunction ), allocatable :: alpha !! # AlphaFunction derived type. !! Uses the abstract derived type `AlphaFunction` to define the !! Alpha function that the CubicEoS will use. The Alpha function !! receives the reduced temperature and returns the values of alpha !! and its derivatives, named `a`, `dadt` and `dadt2` respectively. !! !! # Examples !! ## Callign the AlphaFunction of a setted up model. !! ```fortran !! use yaeos, only: CubicEoS, PengRobinson76 !! !! type(CubicEoS) :: eos !! eos = PengRobinson76(tc, pc, w) !! call eos%alpha%alpha(Tr, a, dadt, dadt2) !! ``` real ( pr ), allocatable :: ac (:) !! Attractive critical parameter real ( pr ), allocatable :: b (:) !! Repulsive parameter real ( pr ), allocatable :: del1 (:) !! \\delta_1 paramter real ( pr ), allocatable :: del2 (:) !! \\delta_2 paramter contains procedure :: residual_helmholtz => GenericCubic_Ar procedure :: get_v0 => v0 procedure :: volume => volume end type abstract interface subroutine abs_alpha ( self , Tr , a , dadt , dadt2 ) import AlphaFunction , pr class ( AlphaFunction ), intent ( in ) :: self real ( pr ), intent ( in ) :: Tr (:) real ( pr ), intent ( out ) :: a (:), dadt (:), dadt2 (:) end subroutine subroutine abs_Dmix ( self , n , T , & ai , daidt , daidt2 , & D , dDdT , dDdT2 , dDi , dDidT , dDij & ) import CubicMixRule , pr class ( CubicMixRule ), intent ( in ) :: self real ( pr ), intent ( in ) :: T , n (:) real ( pr ), intent ( in ) :: ai (:), daidt (:), daidt2 (:) real ( pr ), intent ( out ) :: D , dDdT , dDdT2 , dDi (:), dDidT (:), dDij (:, :) end subroutine subroutine abs_Bmix ( self , n , bi , B , dBi , dBij ) import CubicMixRule , pr class ( CubicMixRule ), intent ( in ) :: self real ( pr ), intent ( in ) :: n (:) real ( pr ), intent ( in ) :: bi (:) real ( pr ), intent ( out ) :: B , dBi (:), dBij (:, :) end subroutine subroutine abs_D1mix ( self , n , d1i , D1 , dD1i , dD1ij ) import pr , CubicMixRule class ( CubicMixRule ), intent ( in ) :: self real ( pr ), intent ( in ) :: n (:) real ( pr ), intent ( in ) :: d1i (:) real ( pr ), intent ( out ) :: D1 real ( pr ), intent ( out ) :: dD1i (:) real ( pr ), intent ( out ) :: dD1ij (:, :) end subroutine abs_D1mix end interface contains subroutine GenericCubic_Ar (& self , n , V , T , Ar , ArV , ArT , ArTV , ArV2 , ArT2 , Arn , ArVn , ArTn , Arn2 & ) !! Residual Helmholtz Energy for a generic Cubic Equation of State. !! !! Calculates the residual Helmholtz Energy for a generic Cubic EoS as !! defined by Michelsen and Møllerup: !! !! !! P = \\frac{RT}{V-b} !! - \\frac{a_c\\alpha(T_r)}{(V+b\\delta_1)(V+b\\delta_2)} !! !! !! This routine assumes that the \\delta_1 is not a constant parameter !! (as it uses to be in classical Cubic EoS) to be compatible with the !! three parameter EoS RKPR where delta_1 is not a constant and !! has its own mixing rule. !! use yaeos__constants , only : R class ( CubicEoS ), intent ( in ) :: self real ( pr ), intent ( in ) :: n (:) !! Number of moles real ( pr ), intent ( in ) :: v !! Volume [L] real ( pr ), intent ( in ) :: t !! Temperature [K] real ( pr ), optional , intent ( out ) :: ar !! Residual Helmholtz real ( pr ), optional , intent ( out ) :: arv !! \\frac{dAr}{dV} real ( pr ), optional , intent ( out ) :: ArT !! \\frac{dAr}{dT} real ( pr ), optional , intent ( out ) :: artv !! \\frac{d^2Ar}{dTdV} real ( pr ), optional , intent ( out ) :: arv2 !! \\frac{d^2Ar}{dV^2} real ( pr ), optional , intent ( out ) :: ArT2 !! \\frac{d^2Ar}{dT^2} real ( pr ), optional , intent ( out ) :: Arn ( size ( n )) !! \\frac{dAr}{dn_i} real ( pr ), optional , intent ( out ) :: ArVn ( size ( n )) !! \\frac{d^2Ar}{dVdn_i} real ( pr ), optional , intent ( out ) :: ArTn ( size ( n )) !! \\frac{d^2Ar}{dTdn_i} real ( pr ), optional , intent ( out ) :: Arn2 ( size ( n ), size ( n )) !! \\frac{d^2Ar}{dn_{ij}} real ( pr ) :: Bmix , dBi ( size ( n )), dBij ( size ( n ), size ( n )) real ( pr ) :: D , dDi ( size ( n )), dDij ( size ( n ), size ( n )), dDidT ( size ( n )), dDdT , dDdT2 real ( pr ) :: totn real ( pr ) d1 , dD1i ( size ( n )), dD1ij ( size ( n ), size ( n )) real ( pr ) :: auxD2 , fD1 , fBD1 , fVD1 , fD1D1 real ( pr ) d2 real ( pr ) :: f , g , fv , fB , gv , fv2 , gv2 , AUX , FFB , FFBV , FFBB real ( pr ) :: Tr ( size ( n )), a ( size ( n )), dadt ( size ( n )), dadt2 ( size ( n )) integer :: i , j , nc nc = size ( n ) TOTN = sum ( n ) Tr = T / self % components % Tc ! ======================================================================== ! Attractive parameter and derivatives ! ------------------------------------------------------------------------ call self % alpha % alpha ( Tr , a , dadt , dadt2 ) a = self % ac * a dadt = self % ac * dadt / self % components % Tc dadt2 = self % ac * dadt2 / self % components % Tc ** 2 ! ======================================================================== ! Mixing rules ! ------------------------------------------------------------------------ call self % mixrule % D1mix ( n , self % del1 , D1 , dD1i , dD1ij ) call self % mixrule % Bmix ( n , self % b , Bmix , dBi , dBij ) call self % mixrule % Dmix (& n , T , a , dadt , dadt2 , D , dDdT , dDdT2 , dDi , dDidT , dDij & ) D2 = ( 1._pr - D1 ) / ( 1._pr + D1 ) ! ======================================================================== ! Main functions defined by Møllerup ! The f's and g's used here are for Ar, not F (reduced Ar) ! This requires to multiply by R all g, f ! ------------------------------------------------------------------------ f = log (( V + D1 * Bmix ) / ( V + D2 * Bmix )) / Bmix / ( D1 - D2 ) g = R * log ( 1 - Bmix / V ) fv = - 1 / (( V + D1 * Bmix ) * ( V + D2 * Bmix )) fB = - ( f + V * fv ) / Bmix gv = R * Bmix / ( V * ( V - Bmix )) fv2 = ( - 1 / ( V + D1 * Bmix ) ** 2 + 1 / ( V + D2 * Bmix ) ** 2 ) / Bmix / ( D1 - D2 ) gv2 = R * ( 1 / V ** 2 - 1 / ( V - Bmix ) ** 2 ) ! DERIVATIVES OF f WITH RESPECT TO DELTA1 auxD2 = ( 1 + 2 / ( 1 + D1 ) ** 2 ) fD1 = ( 1 / ( V + D1 * Bmix ) + 2 / ( V + D2 * Bmix ) / ( 1 + D1 ) ** 2 ) - f * auxD2 fD1 = fD1 / ( D1 - D2 ) fBD1 = - ( fB * auxD2 + D1 / ( V + D1 * Bmix ) ** 2 + 2 * D2 / ( V + D2 * Bmix ) ** 2 / ( 1 + D1 ) ** 2 ) fBD1 = fBD1 / ( D1 - D2 ) fVD1 = - ( fV * auxD2 + 1 / ( V + D1 * Bmix ) ** 2 + 2 / ( V + D2 * Bmix ) ** 2 / ( 1 + D1 ) ** 2 ) / ( D1 - D2 ) fD1D1 = 4 * ( f - 1 / ( V + D2 * Bmix )) / ( 1 + D1 ) ** 3 + Bmix * ( - 1 / ( V + D1 * Bmix ) ** 2 & + 4 / ( V + D2 * Bmix ) ** 2 / ( 1 + D1 ) ** 4 ) - 2 * fD1 * ( 1 + 2 / ( 1 + D1 ) ** 2 ) fD1D1 = fD1D1 / ( D1 - D2 ) AUX = R * T / ( V - Bmix ) FFB = TOTN * AUX - D * fB FFBV = - TOTN * AUX / ( V - Bmix ) + D * ( 2 * fv + V * fv2 ) / Bmix FFBB = TOTN * AUX / ( V - Bmix ) - D * ( 2 * f + 4 * V * fv + V ** 2 * fv2 ) / Bmix ** 2 ! ======================================================================== ! Reduced Helmholtz Energy and derivatives ! ------------------------------------------------------------------------ if ( present ( Ar )) Ar = - TOTN * g * T - D * f if ( present ( ArV )) ArV = - TOTN * gv * T - D * fv if ( present ( ArV2 )) ArV2 = - TOTN * gv2 * T - D * fv2 if ( present ( Arn )) Arn (:) = - g * T + FFB * dBi (:) - f * dDi (:) - D * fD1 * dD1i (:) if ( present ( ArVn )) ArVn (:) = - gv * T + FFBV * dBi (:) - fv * dDi (:) - D * fVD1 * dD1i (:) if ( present ( ArTn )) ArTn (:) = - g + ( TOTN * AUX / T - dDdT * fB ) * dBi (:) - f * dDidT (:) - dDdT * fD1 * dD1i (:) if ( present ( Arn2 )) then do i = 1 , nc do j = 1 , i Arn2 ( i , j ) = AUX * ( dBi ( i ) + dBi ( j )) - fB * ( dBi ( i ) * dDi ( j ) + dBi ( j ) * dDi ( i )) & + FFB * dBij ( i , j ) + FFBB * dBi ( i ) * dBi ( j ) - f * dDij ( i , j ) Arn2 ( i , j ) = Arn2 ( i , j ) - D * fBD1 * ( dBi ( i ) * dD1i ( j ) + dBi ( j ) * dD1i ( i )) & - fD1 * ( dDi ( i ) * dD1i ( j ) + dDi ( j ) * dD1i ( i )) & - D * fD1 * dD1ij ( i , j ) - D * fD1D1 * dD1i ( i ) * dD1i ( j ) Arn2 ( j , i ) = Arn2 ( i , j ) end do end do end if ! TEMPERATURE DERIVATIVES if ( present ( ArT )) ArT = - TOTN * g - dDdT * f if ( present ( ArTV )) ArTV = - TOTN * gv - dDdT * fV if ( present ( ArT2 )) ArT2 = - dDdT2 * f end subroutine GenericCubic_Ar function v0 ( self , n , p , t ) !! Cubic EoS volume initializer. !! For a Cubic Equation of State, the covolume calculated with the mixing !! rule is a good estimate for the initial volume solver on the liquid !! region. class ( CubicEoS ), intent ( in ) :: self real ( pr ), intent ( in ) :: n (:), p , t real ( pr ) :: v0 real ( pr ) :: dbi ( size ( n )), dbij ( size ( n ), size ( n )) call self % mixrule % Bmix ( n , self % b , v0 , dbi , dbij ) end function subroutine volume ( eos , n , P , T , V , root_type ) !! # Cubic EoS volume solver !! Volume solver optimized for Cubic Equations of State. !! !! @warn !! This routine intends to use the analyitical solution of the cubic !! equation, but due to errors in the solutions it is not used. And !! the general volume solver by Michelsen is used instead. !! @endwarn !! !! # Description !! Cubic equations can be analytically solved. Using an anallytical !! solution provides the best possible solution in terms of speed and !! precision. This subroutine uses the modified cardano method proposed !! by Rosendo. !! !! # Examples !! !! ```fortran !! use yaeos, only: CubicEoS, PengRobinson !! type(CubicEoS) :: eos !! !! eos = PengRobinson(tc, pc, w) !! ! Possible roots to solve !! call eos%volume(n, P, T, V, \"liquid\") !! call eos%volume(n, P, T, V, \"vapor\") !! call eos%volume(n, P, T, V, \"stable\") !! ``` !! !! # References !! !! - [1] \"Thermodynamic Models: Fundamental and Computational Aspects\", !! Michael L. Michelsen, Jørgen M. Mollerup. !! Tie-Line Publications, Denmark (2004) !! [doi](http://dx.doi.org/10.1016/j.fluid.2005.11.032) !! !! - [2] \"A Note on the Analytical Solution of Cubic Equations of State !! in Process Simulation\", Rosendo Monroy-Loperena !! [doi](https://dx.doi.org/10.1021/ie2023004) use yaeos__constants , only : R use yaeos__math_linalg , only : cubic_roots , cubic_roots_rosendo use yaeos__models_solvers , only : volume_michelsen class ( CubicEoS ), intent ( in ) :: eos real ( pr ), intent ( in ) :: n (:), P , T real ( pr ), intent ( out ) :: V character ( len =* ), intent ( in ) :: root_type real ( pr ) :: z ( size ( n )) real ( pr ) :: cp ( 4 ), rr ( 3 ) complex ( pr ) :: cr ( 3 ) integer :: flag real ( pr ) :: V_liq , V_vap real ( pr ) :: Ar , AT_Liq , AT_Vap real ( pr ) :: Bmix , dBi ( size ( n )), dBij ( size ( n ), size ( n )) real ( pr ) :: D , dDi ( size ( n )), dDij ( size ( n ), size ( n )), dDidT ( size ( n )), dDdT , dDdT2 real ( pr ) :: D1 , D2 , dD1i ( size ( n )), dD1ij ( size ( n ), size ( n )) real ( pr ) :: Tr ( size ( n )) real ( pr ) :: a ( size ( n )), dadt ( size ( n )), dadt2 ( size ( n )) real ( pr ) :: totn call volume_michelsen ( eos , n = n , P = P , T = T , V = V , root_type = root_type ) return totn = sum ( n ) z = n / totn Tr = T / eos % components % Tc ! ======================================================================== ! Attractive parameter and derivatives ! ------------------------------------------------------------------------ call eos % alpha % alpha ( Tr , a , dadt , dadt2 ) a = eos % ac * a dadt = eos % ac * dadt / eos % components % Tc dadt2 = eos % ac * dadt2 / eos % components % Tc ** 2 ! ======================================================================== ! Mixing rules ! ------------------------------------------------------------------------ call eos % mixrule % D1mix ( z , eos % del1 , D1 , dD1i , dD1ij ) call eos % mixrule % Bmix ( z , eos % b , Bmix , dBi , dBij ) call eos % mixrule % Dmix (& z , T , a , dadt , dadt2 , D , dDdT , dDdT2 , dDi , dDidT , dDij & ) D2 = ( 1._pr - D1 ) / ( 1._pr + D1 ) cp ( 1 ) = - P cp ( 2 ) = - P * Bmix * ( D1 + D2 - 1 ) + R * T cp ( 3 ) = - P * ( D1 * D2 * Bmix ** 2 - D1 * Bmix ** 2 - D2 * Bmix ** 2 ) + R * T * Bmix * ( D1 + D2 ) - D cp ( 4 ) = P * D1 * D2 * Bmix ** 3 + R * T * D1 * D2 * Bmix ** 2 + D * Bmix ! call cubic_roots(cp, rr, cr, flag) ! call cubic_roots_rosendo(cp, rr, cr, flag) select case ( flag ) case ( - 1 ) V_liq = rr ( 1 ) V_vap = rr ( 3 ) if ( V_liq < 0 ) V_liq = V_vap case ( 1 ) V_liq = rr ( 1 ) V_vap = rr ( 1 ) end select select case ( root_type ) case ( \"liquid\" ) V = V_liq case ( \"vapor\" ) V = V_vap case ( \"stable\" ) ! AT is something close to Gr(P,T) call eos % residual_helmholtz ( z , V_liq , T , Ar = Ar ) AT_Liq = ( Ar + V_liq * P ) / ( T * R ) - sum ( z ) * log ( V_liq ) call eos % residual_helmholtz ( z , V_vap , T , Ar = Ar ) AT_Vap = ( Ar + V_vap * P ) / ( T * R ) - sum ( z ) * log ( V_vap ) if ( AT_liq <= AT_vap ) then V = V_liq else V = V_vap end if end select V = totn * V end subroutine end module","tags":"","loc":"sourcefile/generic_cubic.f90.html"},{"title":"ar_interface.f90 – yaeos","text":"Source Code module ar_interface !-| Generic interfaces to an ArModel compatible with legacy codes, using ! pointers. use yaeos__constants , only : pr , R use iso_fortran_env , only : error_unit implicit none procedure ( Ares ), pointer :: ar_fun procedure ( initial_volume ), pointer :: vinit abstract interface subroutine Ares ( z , v , t , Ar , ArV , ArTV , ArV2 , Arn , ArVn , ArTn , Arn2 ) !| Residual Helmholtz model interface import pr real ( pr ), intent ( in ) :: z (:) real ( pr ), intent ( in ) :: v , t real ( pr ), intent ( out ) :: Ar , ArV , ArTV , ArV2 real ( pr ), dimension ( size ( z )), intent ( out ) :: Arn , ArVn , ArTn real ( pr ), intent ( out ) :: Arn2 ( size ( z ), size ( z )) end subroutine function initial_volume ( z , p , t ) import pr real ( pr ) :: z (:) real ( pr ) :: p real ( pr ) :: t real ( pr ) :: initial_volume end function end interface end module","tags":"","loc":"sourcefile/ar_interface.f90.html"},{"title":"admm_tapenade_interface.f90 – yaeos","text":"Source Code MODULE ADMM_TAPENADE_INTERFACE IMPLICIT NONE INTERFACE PUSHPOINTER8 SUBROUTINE PUSHPOINTER8 ( pp ) BIND ( c , name = 'pushPointer8' ) USE ISO_C_BINDING TYPE ( C_PTR ), VALUE :: pp END SUBROUTINE PUSHPOINTER8 END INTERFACE PUSHPOINTER8 INTERFACE POPPOINTER8 SUBROUTINE POPPOINTER8 ( pp ) BIND ( c , name = 'popPointer8' ) USE ISO_C_BINDING TYPE ( C_PTR ) :: pp END SUBROUTINE POPPOINTER8 END INTERFACE POPPOINTER8 INTERFACE ADMM_REGISTERSHADOWED SUBROUTINE ADMM_REGISTERSHADOWED ( base , obase , size , baseb , obaseb & & , sizeb , nbelem ) BIND ( c , name = 'ADMM_registerShadowed' ) USE ISO_C_BINDING TYPE ( C_PTR ), VALUE :: base , obase TYPE ( C_PTR ), VALUE :: baseb , obaseb INTEGER , VALUE :: size , sizeb INTEGER , VALUE :: nbelem END SUBROUTINE ADMM_REGISTERSHADOWED END INTERFACE ADMM_REGISTERSHADOWED INTERFACE ADMM_REGISTER SUBROUTINE ADMM_REGISTER ( base , obase , size , nbelem ) BIND ( c , name = & & 'ADMM_register' ) USE ISO_C_BINDING TYPE ( C_PTR ), VALUE :: base , obase INTEGER , VALUE :: size INTEGER , VALUE :: nbelem END SUBROUTINE ADMM_REGISTER END INTERFACE ADMM_REGISTER INTERFACE ADMM_UNREGISTERSHADOWED SUBROUTINE ADMM_UNREGISTERSHADOWED ( base , baseb , nbelem ) BIND ( c , & & name = 'ADMM_unregisterShadowed' ) USE ISO_C_BINDING TYPE ( C_PTR ), VALUE :: base , baseb INTEGER :: nbelem END SUBROUTINE ADMM_UNREGISTERSHADOWED END INTERFACE ADMM_UNREGISTERSHADOWED INTERFACE ADMM_UNREGISTER SUBROUTINE ADMM_UNREGISTER ( base , nbelem ) BIND ( c , name = & & 'ADMM_unregister' ) USE ISO_C_BINDING TYPE ( C_PTR ), VALUE :: base INTEGER :: nbelem END SUBROUTINE ADMM_UNREGISTER END INTERFACE ADMM_UNREGISTER INTERFACE ADMM_REBASESHADOWED SUBROUTINE ADMM_REBASESHADOWED ( base , baseb ) BIND ( c , name = & & 'ADMM_rebaseShadowed' ) USE ISO_C_BINDING TYPE ( C_PTR ) :: base , baseb END SUBROUTINE ADMM_REBASESHADOWED END INTERFACE ADMM_REBASESHADOWED INTERFACE ADMM_REBASE SUBROUTINE ADMM_REBASE ( base ) BIND ( c , name = 'ADMM_rebase' ) USE ISO_C_BINDING TYPE ( C_PTR ) :: base END SUBROUTINE ADMM_REBASE END INTERFACE ADMM_REBASE END MODULE ADMM_TAPENADE_INTERFACE","tags":"","loc":"sourcefile/admm_tapenade_interface.f90.html"},{"title":"unifac_parameters.f90 – yaeos","text":"Source Code module yaeos__models_ge_group_contribution_unifac_parameters !! # UNIFAC parameters !! UNIFAC parameters module !! !! # Description !! Instances of the yaeos GeGCModelParameters with the classic liquid-vapor !! UNIFAC parameters. !! !! # Examples !! !! ```fortran !! use yaeos__models_ge_group_contribution_unifac_parameters, only: UNIFACParameters !! use yaeos__models_ge_group_contribution_model_parameters, only: GeGCModelParameters !! !! type(GeGCModelParameters) :: parameters !! !! parameters = UNIFACParameters() !! !! ! Get the maingroups i:1, j:7 interaction parameter aij (CH2-H2O) !! print *, parameters%get_maingroups_aij(1, 7) ! prints: 1318.0000 !! ``` !! !! # References !! 1. [Dortmund Data Bank Software & Separation Technology](https://www.ddbst !! .com/published-parameters-unifac.html) !! 2. Fredenslund, A., Jones, R. L., & Prausnitz, J. M. (1975). !! Group‐contribution estimation of activity coefficients in nonideal liquid !! mixtures. AIChE Journal, 21(6), 1086–1099. !! [https://doi.org/10.1002/aic.690210607](https://doi.org/10.1002/aic.690210607) !! 3. Skjold-Jorgensen, S., Kolbe, B., Gmehling, J., & Rasmussen, P. (1979). !! Vapor-Liquid Equilibria by UNIFAC Group Contribution. Revision and !! Extension. Industrial & Engineering Chemistry Process Design and !! Development, 18(4), 714–722. !! [https://doi.org/10.1021/i260072a024](https://doi.org/10.1021/i260072a024) !! 4. Gmehling, J., Rasmussen, P., & Fredenslund, A. (1982). Vapor-liquid !! equilibriums by UNIFAC group contribution. Revision and extension. 2. !! Industrial & Engineering Chemistry Process Design and Development, 21(1), !! 118–127. !! [https://doi.org/10.1021/i200016a021](https://doi.org/10.1021/i200016a021) !! 5. Macedo, E. A., Weidlich, U., Gmehling, J., & Rasmussen, P. (1983). !! Vapor-liquid equilibriums by UNIFAC group contribution. Revision and !! extension. 3. Industrial & Engineering Chemistry Process Design and !! Development, 22(4), 676–678. !! [https://doi.org/10.1021/i200023a023](https://doi.org/10.1021/i200023a023) !! 6. Tiegs, D., Rasmussen, P., Gmehling, J., & Fredenslund, A. (1987). !! Vapor-liquid equilibria by UNIFAC group contribution. 4. Revision and !! extension. Industrial & Engineering Chemistry Research, 26(1), 159–161. !! [https://doi.org/10.1021/ie00061a030](https://doi.org/10.1021/ie00061a030) !! 7. Hansen, H. K., Rasmussen, P., Fredenslund, A., Schiller, M., & !! Gmehling, J. (1991). Vapor-liquid equilibria by UNIFAC group !! contribution. 5. Revision and extension. Industrial & Engineering !! Chemistry Research, 30 (10), 2352–2355. !! [https://doi.org/10.1021/ie00058a017](https://doi.org/10.1021/ie00058a017) !! 8. Wittig, R., Lohmann, J., & Gmehling, J. (2003). Vapor−Liquid Equilibria !! by UNIFAC Group Contribution. 6. Revision and Extension. Industrial & !! Engineering Chemistry Research, 42(1), 183–188. !! [https://doi.org/10.1021/ie020506l](https://doi.org/10.1021/ie020506l) !! use yaeos__constants , only : pr use yaeos__models_ge_group_contribution_model_parameters , only : GeGCModelParameters implicit none contains type ( GeGCModelParameters ) function UNIFACParameters () !! # UNIFACParameters !! UNIFAC parameters !! !! # Description !! Create a Instance of the yaeos GeGCModelParameters with the classic !! liquid-vapor UNIFAC parameters. !! !! # Examples !! !! ```fortran !! ! Instantiate an UNIFAC model with ethanol-water mix and calculate gammas !! use yaeos, only: pr, Groups, setup_unifac, UNIFAC !! use yaeos__models_ge_group_contribution_unifac_parameters, only: UNIFACParameters !! use yaeos__models_ge_group_contribution_model_parameters, only: GeGCModelParameters !! !! type(UNIFAC) :: model !! type(Groups) :: molecules(2) !! real(pr) :: ln_gammas(2) !! !! type(GeGCModelParameters) :: parameters !! !! ! Ethanol definition [CH3, CH2, OH] !! molecules(1)%groups_ids = [1, 2, 14] ! Subgroups ids !! molecules(1)%number_of_groups = [1, 1, 1] ! Subgroups occurrences !! !! ! Water definition [H2O] !! molecules(2)%groups_ids = [16] !! molecules(2)%number_of_groups = [1] !! !! parameters = UNIFACParameters() !! !! ! Model setup !! ! Disclaimer: the default parameters object can be ommited in the !! ! setup_unifac call, because if the parameters argument is not !! ! provided, the return of the constructor UNIFACParameters() will be !! ! used either way. This is just a demostration. !! model = setup_unifac(molecules, parameters) !! !! ! Calculate ln_gammas !! call model%ln_activity_coefficient([0.5_pr, 0.5_pr], 298.0_pr, ln_gammas) !! !! print *, ln_gammas ! result: 0.18534142000449058 0.40331395945417559 !! ``` !! !! # References !! 1. [Dortmund Data Bank Software & Separation Technology](https://www.ddbst !! .com/published-parameters-unifac.html) !! 2. Fredenslund, A., Jones, R. L., & Prausnitz, J. M. (1975). !! Group‐contribution estimation of activity coefficients in nonideal liquid !! mixtures. AIChE Journal, 21(6), 1086–1099. !! [https://doi.org/10.1002/aic.690210607](https://doi.org/10.1002/aic.690210607) !! 3. Skjold-Jorgensen, S., Kolbe, B., Gmehling, J., & Rasmussen, P. (1979). !! Vapor-Liquid Equilibria by UNIFAC Group Contribution. Revision and !! Extension. Industrial & Engineering Chemistry Process Design and !! Development, 18(4), 714–722. !! [https://doi.org/10.1021/i260072a024](https://doi.org/10.1021/i260072a024) !! 4. Gmehling, J., Rasmussen, P., & Fredenslund, A. (1982). Vapor-liquid !! equilibriums by UNIFAC group contribution. Revision and extension. 2. !! Industrial & Engineering Chemistry Process Design and Development, 21(1), !! 118–127. !! [https://doi.org/10.1021/i200016a021](https://doi.org/10.1021/i200016a021) !! 5. Macedo, E. A., Weidlich, U., Gmehling, J., & Rasmussen, P. (1983). !! Vapor-liquid equilibriums by UNIFAC group contribution. Revision and !! extension. 3. Industrial & Engineering Chemistry Process Design and !! Development, 22(4), 676–678. !! [https://doi.org/10.1021/i200023a023](https://doi.org/10.1021/i200023a023) !! 6. Tiegs, D., Rasmussen, P., Gmehling, J., & Fredenslund, A. (1987). !! Vapor-liquid equilibria by UNIFAC group contribution. 4. Revision and !! extension. Industrial & Engineering Chemistry Research, 26(1), 159–161. !! [https://doi.org/10.1021/ie00061a030](https://doi.org/10.1021/ie00061a030) !! 7. Hansen, H. K., Rasmussen, P., Fredenslund, A., Schiller, M., & !! Gmehling, J. (1991). Vapor-liquid equilibria by UNIFAC group !! contribution. 5. Revision and extension. Industrial & Engineering !! Chemistry Research, 30 (10), 2352–2355. !! [https://doi.org/10.1021/ie00058a017](https://doi.org/10.1021/ie00058a017) !! 8. Wittig, R., Lohmann, J., & Gmehling, J. (2003). Vapor−Liquid Equilibria !! by UNIFAC Group Contribution. 6. Revision and Extension. Industrial & !! Engineering Chemistry Research, 42(1), 183–188. !! [https://doi.org/10.1021/ie020506l](https://doi.org/10.1021/ie020506l) !! ! ======================================================================== ! UNIFAC subgroups ids definition ! ------------------------------------------------------------------------ UNIFACParameters % subgroups_ids = [& 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , & 13 , 14 , 15 , 16 , 17 , 18 , 19 , 20 , 21 , 22 , 23 , 24 , & 25 , 26 , 27 , 28 , 29 , 30 , 31 , 32 , 33 , 34 , 35 , 36 , & 37 , 38 , 39 , 40 , 41 , 42 , 43 , 44 , 45 , 46 , 47 , 48 , & 49 , 50 , 51 , 52 , 53 , 54 , 55 , 56 , 57 , 58 , 59 , 60 , & 61 , 62 , 63 , 64 , 65 , 66 , 67 , 68 , 69 , 70 , 71 , 72 , & 73 , 74 , 75 , 76 , 77 , 78 , 79 , 80 , 81 , 82 , 83 , 84 , & 85 , 86 , 87 , 88 , 89 , 90 , 91 , 92 , 93 , 94 , 95 , 96 , & 97 , 98 , 99 , 100 , 101 , 102 , 103 , 104 , 105 , 106 , 107 , 108 , & 109 , 118 , 119 , 178 , 179 & ] ! ======================================================================== ! UNIFAC maingroups ids definition ! ------------------------------------------------------------------------ UNIFACParameters % maingroups_ids = [& 1 , 2 , 3 , 4 , 5 , 6 , & 7 , 8 , 9 , 10 , 11 , 12 , & 13 , 14 , 15 , 16 , 17 , 18 , & 19 , 20 , 21 , 22 , 23 , 24 , & 25 , 26 , 27 , 28 , 29 , 30 , & 31 , 32 , 33 , 34 , 35 , 36 , & 37 , 38 , 39 , 40 , 41 , 42 , & 43 , 44 , 45 , 46 , 47 , 48 , & 49 , 50 , 51 , 55 , 84 , 85 & ] ! ======================================================================== ! UNIFAC subgroups maingroups ! ------------------------------------------------------------------------ UNIFACParameters % subgroups_maingroups = [& 1 , 1 , 1 , 1 , 2 , 2 , 2 , 2 , 3 , 3 , 4 , 4 , & 4 , 5 , 6 , 7 , 8 , 9 , 9 , 10 , 11 , 11 , 12 , 13 , & 13 , 13 , 13 , 14 , 14 , 14 , 15 , 15 , 15 , 16 , 16 , 17 , & 18 , 18 , 18 , 19 , 19 , 20 , 20 , 21 , 21 , 21 , 22 , 22 , & 22 , 23 , 23 , 24 , 25 , 26 , 26 , 26 , 27 , 28 , 29 , 29 , & 30 , 31 , 32 , 33 , 34 , 34 , 35 , 36 , 37 , 2 , 38 , 39 , & 39 , 40 , 40 , 40 , 41 , 42 , 42 , 42 , 42 , 43 , 43 , 43 , & 44 , 45 , 45 , 45 , 45 , 45 , 45 , 45 , 45 , 46 , 46 , 46 , & 46 , 46 , 46 , 47 , 47 , 48 , 48 , 48 , 49 , 50 , 50 , 50 , & 51 , 55 , 55 , 84 , 85 & ] ! ======================================================================== ! UNIFAC subgroups Rs ! ------------------------------------------------------------------------ UNIFACParameters % subgroups_Rs = [& 0.90110_pr , 0.67440_pr , 0.44690_pr , 0.21950_pr , 1.34540_pr , & 1.11670_pr , 1.11730_pr , 0.88860_pr , 0.53130_pr , 0.36520_pr , & 1.26630_pr , 1.03960_pr , 0.81210_pr , 1.00000_pr , 1.43110_pr , & 0.92000_pr , 0.89520_pr , 1.67240_pr , 1.44570_pr , 0.99800_pr , & 1.90310_pr , 1.67640_pr , 1.24200_pr , 1.14500_pr , 0.91830_pr , & 0.69080_pr , 0.91830_pr , 1.59590_pr , 1.36920_pr , 1.14170_pr , & 1.43370_pr , 1.20700_pr , 0.97950_pr , 1.18650_pr , 0.95970_pr , & 1.06000_pr , 2.99930_pr , 2.83320_pr , 2.66700_pr , 1.87010_pr , & 1.64340_pr , 1.30130_pr , 1.52800_pr , 1.46540_pr , 1.23800_pr , & 1.01060_pr , 2.25640_pr , 2.06060_pr , 1.80160_pr , 2.87000_pr , & 2.64010_pr , 3.39000_pr , 1.15620_pr , 2.00860_pr , 1.78180_pr , & 1.55440_pr , 1.41990_pr , 2.05700_pr , 1.87700_pr , 1.65100_pr , & 3.16800_pr , 2.40880_pr , 1.26400_pr , 0.94920_pr , 1.29200_pr , & 1.06130_pr , 2.82660_pr , 2.31440_pr , 0.79100_pr , 0.66050_pr , & 0.69480_pr , 3.08560_pr , 2.63220_pr , 1.40600_pr , 1.01050_pr , & 0.61500_pr , 1.38000_pr , 1.60350_pr , 1.44430_pr , 1.28530_pr , & 1.04700_pr , 1.48380_pr , 1.30300_pr , 1.10440_pr , 3.98100_pr , & 3.03560_pr , 2.22870_pr , 2.40600_pr , 1.64930_pr , 1.81740_pr , & 1.96700_pr , 2.17210_pr , 2.62430_pr , 1.45150_pr , 2.19050_pr , & 1.96370_pr , 2.85890_pr , 2.63220_pr , 2.40540_pr , 2.12260_pr , & 1.89520_pr , 1.61300_pr , 1.38630_pr , 1.15890_pr , 3.47400_pr , & 2.85690_pr , 2.69080_pr , 2.52470_pr , 1.05670_pr , 2.68690_pr , & 2.45950_pr , 2.02600_pr , 5.77400_pr & ] ! ======================================================================== ! UNIFAC subgroups Qs ! ------------------------------------------------------------------------ UNIFACParameters % subgroups_Qs = [& 0.84800_pr , 0.54000_pr , 0.22800_pr , 0.00000_pr , 1.17600_pr , & 0.86700_pr , 0.98800_pr , 0.67600_pr , 0.40000_pr , 0.12000_pr , & 0.96800_pr , 0.66000_pr , 0.34800_pr , 1.20000_pr , 1.43200_pr , & 1.40000_pr , 0.68000_pr , 1.48800_pr , 1.18000_pr , 0.94800_pr , & 1.72800_pr , 1.42000_pr , 1.18800_pr , 1.08800_pr , 0.78000_pr , & 0.46800_pr , 1.10000_pr , 1.54400_pr , 1.23600_pr , 0.92400_pr , & 1.24400_pr , 0.93600_pr , 0.62400_pr , 0.94000_pr , 0.63200_pr , & 0.81600_pr , 2.11300_pr , 1.83300_pr , 1.55300_pr , 1.72400_pr , & 1.41600_pr , 1.22400_pr , 1.53200_pr , 1.26400_pr , 0.95200_pr , & 0.72400_pr , 1.98800_pr , 1.68400_pr , 1.44800_pr , 2.41000_pr , & 2.18400_pr , 2.91000_pr , 0.84400_pr , 1.86800_pr , 1.56000_pr , & 1.24800_pr , 1.10400_pr , 1.65000_pr , 1.67600_pr , 1.36800_pr , & 2.48400_pr , 2.24800_pr , 0.99200_pr , 0.83200_pr , 1.08800_pr , & 0.78400_pr , 2.47200_pr , 2.05200_pr , 0.72400_pr , 0.48500_pr , & 0.52400_pr , 2.73600_pr , 2.12000_pr , 1.38000_pr , 0.92000_pr , & 0.46000_pr , 1.20000_pr , 1.26320_pr , 1.00630_pr , 0.74940_pr , & 0.40990_pr , 1.06210_pr , 0.76390_pr , 0.46570_pr , 3.20000_pr , & 2.64400_pr , 1.91600_pr , 2.11600_pr , 1.41600_pr , 1.64800_pr , & 1.82800_pr , 2.10000_pr , 2.37600_pr , 1.24800_pr , 1.79600_pr , & 1.48800_pr , 2.42800_pr , 2.12000_pr , 1.81200_pr , 1.90400_pr , & 1.59200_pr , 1.36800_pr , 1.06000_pr , 0.74800_pr , 2.79600_pr , & 2.14000_pr , 1.86000_pr , 1.58000_pr , 0.73200_pr , 2.12000_pr , & 1.80800_pr , 0.86800_pr , 4.93200_pr & ] ! ======================================================================== ! UNIFAC aij ! ------------------------------------------------------------------------ UNIFACParameters % maingroups_aij = reshape ([& 0.00000_pr , - 3 5.36000_pr , - 1 1.12000_pr , - 6 9.70000_pr , 15 6.40000_pr , & 1 6.51000_pr , 30 0.00000_pr , 27 5.80000_pr , 2 6.76000_pr , 50 5.70000_pr , & 11 4.80000_pr , 32 9.30000_pr , 8 3.36000_pr , - 3 0.48000_pr , 6 5.33000_pr , & - 8 3.98000_pr , 113 9.00000_pr , - 10 1.56000_pr , 2 4.82000_pr , 31 5.30000_pr , & 9 1.46000_pr , 3 4.01000_pr , 3 6.70000_pr , - 7 8.45000_pr , 10 6.80000_pr , & - 3 2.69000_pr , 554 1.00000_pr , - 5 2.65000_pr , - 7.48100_pr , - 2 5.31000_pr , & 13 9.93000_pr , 12 8.00000_pr , - 3 1.52000_pr , - 7 2.88000_pr , 5 0.49000_pr , & - 16 5.90000_pr , 4 7.41000_pr , - 5.13200_pr , - 3 1.95000_pr , 14 7.30000_pr , & 52 9.00000_pr , - 3 4.36000_pr , 11 0.20000_pr , 1 3.89000_pr , 3 0.74000_pr , & 2 7.97000_pr , - 1 1.92000_pr , 3 9.93000_pr , - 2 3.61000_pr , - 8.47900_pr , & 45 6.19000_pr , 24 5.21000_pr , 12 5.36000_pr , 22 1.56000_pr , 8 6.02000_pr , & 0.00000_pr , 3.44600_pr , - 11 3.60000_pr , 45 7.00000_pr , - 1 2.52000_pr , & 49 6.10000_pr , 21 7.50000_pr , 4 2.92000_pr , 5 6.30000_pr , 13 2.10000_pr , & 11 0.40000_pr , 2 6.51000_pr , 1.16300_pr , - 2 8.70000_pr , - 2 5.38000_pr , & 200 0.00000_pr , - 4 7.63000_pr , - 4 0.62000_pr , 126 4.00000_pr , 4 0.25000_pr , & - 2 3.50000_pr , 5 1.06000_pr , 16 0.90000_pr , 7 0.32000_pr , - 1.99600_pr , & 0.00000_pr , 1 6.62300_pr , 0.00000_pr , 8 2.64000_pr , 0.00000_pr , & 0.00000_pr , 17 4.60000_pr , 4 1.38000_pr , 6 4.07000_pr , 57 3.00000_pr , & 12 4.20000_pr , - 13 1.70000_pr , 24 9.00000_pr , 6 2.40000_pr , 139 7.00000_pr , & 0.00000_pr , 0.00000_pr , - 1 6.11000_pr , 0.00000_pr , 9.75500_pr , & 13 2.40000_pr , 54 3.60000_pr , 16 1.10000_pr , 0.00000_pr , 0.00000_pr , & 38 4.45000_pr , - 39 1.81000_pr , 62 9.96000_pr , 6 1.13000_pr , 3 8.81000_pr , & 0.00000_pr , - 14 6.80000_pr , 8 9.60000_pr , - 5 0.00000_pr , 36 2.30000_pr , & 2 5.34000_pr , 14 0.10000_pr , 2 3.39000_pr , 8 5.84000_pr , 1 8.12000_pr , & 5 2.13000_pr , - 4 4.85000_pr , - 2 2.31000_pr , - 22 3.90000_pr , 24 7.50000_pr , & 3 1.87000_pr , - 2 2.97000_pr , 6 2.32000_pr , 4.68000_pr , 12 1.30000_pr , & 28 8.50000_pr , - 4.70000_pr , - 9 7.27000_pr , 1 0.38000_pr , 182 4.00000_pr , & 2 1.49700_pr , 2 8.41000_pr , 15 7.29000_pr , 22 1.40000_pr , 5 8.68000_pr , & - 15 4.20000_pr , - 10 1.12000_pr , - 2.50400_pr , - 12 3.60000_pr , 39 5.80000_pr , & - 23 7.20000_pr , - 13 3.90000_pr , 14 0.60000_pr , 31 7.60000_pr , 78 7.90000_pr , & 23 4.40000_pr , - 2 3.88000_pr , 16 7.90000_pr , 0.00000_pr , - 8 6.88000_pr , & 0.00000_pr , 14 2.90000_pr , 2 3.93000_pr , 0.00000_pr , 4 7.05000_pr , & 0.00000_pr , 0.00000_pr , 7 6.50000_pr , 7 4.15000_pr , 16 7.00000_pr , & 0.00000_pr , 2 5.82000_pr , - 4 4.50000_pr , 37 7.60000_pr , 24 4.20000_pr , & 36 5.80000_pr , 10 6.00000_pr , - 17 0.00000_pr , 42 8.00000_pr , 6 5.69000_pr , & 29 6.40000_pr , 22 3.00000_pr , 10 9.90000_pr , 76 2.80000_pr , 4 9.80000_pr , & - 13 8.40000_pr , 8 9.86000_pr , 12 2.91000_pr , 14 0.78000_pr , 6 9.90000_pr , & 13 4.70000_pr , 40 2.50000_pr , - 9 7.05000_pr , - 12 7.80000_pr , 4 0.67500_pr , & 1 9.56000_pr , 12 8.80000_pr , 15 0.64000_pr , 2 6.41000_pr , 111 2.00000_pr , & 61 4.52000_pr , - 14 3.20000_pr , 39 7.40000_pr , 41 9.10000_pr , - 15 7.30000_pr , & - 24 0.20000_pr , 83 9.83000_pr , 61 5.80000_pr , 0.00000_pr , 0.00000_pr , & 6.21400_pr , 0.00000_pr , 0.00000_pr , - 1 9.45000_pr , 0.00000_pr , & 27 4.10000_pr , 2.84500_pr , 0.00000_pr , 34 7.13000_pr , 0.00000_pr , & 0.00000_pr , 98 6.50000_pr , 52 4.10000_pr , 63 6.10000_pr , 80 3.20000_pr , & 0.00000_pr , 24 9.10000_pr , - 22 9.10000_pr , - 45 1.60000_pr , 16 4.50000_pr , & 52 9.00000_pr , 24 5.40000_pr , 13 9.40000_pr , 23 7.70000_pr , - 24 2.80000_pr , & - 15 0.00000_pr , 2 8.60000_pr , - 1 7.40000_pr , - 13 2.30000_pr , 18 5.40000_pr , & - 15 1.00000_pr , 56 2.20000_pr , 52 7.60000_pr , 74 2.10000_pr , 85 6.30000_pr , & 32 5.70000_pr , 26 1.60000_pr , 56 1.60000_pr , 60 9.80000_pr , 46 1.60000_pr , & 52 1.63000_pr , 26 7.60000_pr , 50 1.30000_pr , 52 4.90000_pr , 6 8.95000_pr , & - 2 5.87000_pr , 38 9.30000_pr , 73 8.90000_pr , 64 9.70000_pr , 6 4.16000_pr , & 0.00000_pr , 8 8.63000_pr , 191 3.00000_pr , 43 0.06000_pr , 79 6.90000_pr , & 79 4.40000_pr , 39 4.80000_pr , 51 7.50000_pr , 0.00000_pr , - 6 1.20000_pr , & 68 2.50000_pr , 0.00000_pr , 7 2.19000_pr , 11 1.65000_pr , 12 2.19000_pr , & 69 7.20000_pr , 78 7.60000_pr , 63 7.35000_pr , 60 3.25000_pr , - 13 7.10000_pr , & 0.00000_pr , 28 9.60000_pr , - 26 5.20000_pr , 10 8.65000_pr , - 34 0.18000_pr , & 24 9.63000_pr , 22 7.80000_pr , 23 8.40000_pr , - 48 1.65000_pr , - 37 0.30000_pr , & - 40 6.80000_pr , - 11 8.10000_pr , - 37 8.24000_pr , 16 2.60000_pr , 33 9.80000_pr , & 52 9.00000_pr , 66 9.90000_pr , 64 9.10000_pr , 70 9.60000_pr , 61 2.80000_pr , & 25 2.56000_pr , 51 1.29000_pr , 91 4.20000_pr , 44 8.60000_pr , 28 7.00000_pr , & 24 0.80000_pr , 43 1.30000_pr , 49 4.70000_pr , 96 7.71000_pr , 69 5.00000_pr , & 21 8.80000_pr , 52 8.00000_pr , 64 5.90000_pr , 17 2.20000_pr , 0.00000_pr , & 17 1.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 76 2.70000_pr , & 0.00000_pr , 0.00000_pr , 42 0.00000_pr , - 8 9.24000_pr , 59 7.80000_pr , & 0.00000_pr , 26 5.75000_pr , 0.00000_pr , 0.00000_pr , 131 8.00000_pr , & 27 0.60000_pr , 90 3.80000_pr , 569 5.00000_pr , 35 3.50000_pr , - 18 0.95000_pr , & 0.00000_pr , - 60 1.80000_pr , 47 2.50000_pr , 48 0.80000_pr , 20 0.80000_pr , & 12 4.63000_pr , - 31 4.70000_pr , - 33 0.40000_pr , - 44 8.20000_pr , - 59 8.80000_pr , & - 34 1.60000_pr , - 33 2.90000_pr , 24 2.80000_pr , - 6 6.17000_pr , 69 8.24000_pr , & 70 8.69000_pr , 82 6.76000_pr , 120 1.00000_pr , - 27 4.50000_pr , 41 7.90000_pr , & 36 0.70000_pr , 108 1.00000_pr , 0.00000_pr , 2 3.48400_pr , - 13 7.40000_pr , & 0.00000_pr , 7 9.18000_pr , 0.00000_pr , - 24 0.00000_pr , 38 6.60000_pr , & 0.00000_pr , 0.00000_pr , - 28 7.10000_pr , 0.00000_pr , 28 4.40000_pr , & 18 0.20000_pr , 0.00000_pr , 83 2.20000_pr , 0.00000_pr , - 50 9.30000_pr , & - 20 5.70000_pr , 0.00000_pr , - 38 4.30000_pr , 0.00000_pr , 0.00000_pr , & 62 7.39000_pr , 0.00000_pr , 0.00000_pr , 133 3.00000_pr , 52 6.10000_pr , & 132 9.00000_pr , 88 4.90000_pr , - 25 9.70000_pr , - 10 1.70000_pr , 32 4.50000_pr , & 0.00000_pr , - 13 3.10000_pr , - 15 5.60000_pr , - 3 6.72000_pr , - 23 4.25000_pr , & - 17 8.54610_pr , - 87 0.80000_pr , 0.00000_pr , 0.00000_pr , - 25 3.10000_pr , & - 34 1.60000_pr , 0.00000_pr , - 1 1.00000_pr , 0.00000_pr , 163 3.50000_pr , & 0.00000_pr , 1000 0.00000_pr , 62 2.30000_pr , 0.00000_pr , 81 5.12000_pr , & 142 1.30000_pr , 0.00000_pr , 0.00000_pr , 83 8.40000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , - 16 7.30000_pr , 0.00000_pr , & 0.00000_pr , - 23 4.70000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 81 0.50000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 47 6.40000_pr , 18 2.60000_pr , 2 5.77000_pr , & - 5 2.10000_pr , 8 4.00000_pr , 2 3.39000_pr , - 19 5.40000_pr , - 35 6.10000_pr , & 0.00000_pr , 12 8.00000_pr , 37 2.20000_pr , 38 5.40000_pr , 19 1.10000_pr , & 0.00000_pr , 39 4.60000_pr , 22 5.30000_pr , - 45 0.30000_pr , 2 9.10000_pr , & - 28 7.50000_pr , - 29 7.80000_pr , 28 6.28000_pr , 8 2.86000_pr , 55 2.10000_pr , & 37 2.00000_pr , 51 8.40000_pr , - 14 2.61000_pr , - 10 1.50000_pr , 30 3.65700_pr , & 16 0.60000_pr , 31 7.50000_pr , 13 5.40000_pr , 13 8.00000_pr , - 14 2.60000_pr , & 44 3.61500_pr , 11 0.40000_pr , 11 4.55000_pr , - 4 0.90000_pr , 0.00000_pr , & 9 7.04000_pr , 0.00000_pr , 12 3.40000_pr , 99 2.40000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 15 6.40000_pr , 0.00000_pr , & 0.00000_pr , 27 8.80000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 67 7.00000_pr , 44 8.75000_pr , 34 7.30000_pr , 58 6.80000_pr , & - 20 3.60000_pr , 30 6.42000_pr , - 11 6.00000_pr , - 27 1.10000_pr , - 3 7.36000_pr , & 0.00000_pr , 18 5.10000_pr , - 23 6.50000_pr , - 7.83800_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 22 4.66000_pr , & - 16 5.50000_pr , - 4 7.51000_pr , 19 0.60000_pr , 24 2.80000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 24 5.90000_pr , 0.00000_pr , - 5 5.87000_pr , & 0.00000_pr , 35 4.00000_pr , 18 3.80000_pr , 0.00000_pr , 1 3.89000_pr , & 0.00000_pr , 57 7.50000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 23 2.10000_pr , 3 7.85000_pr , 5.99400_pr , 568 8.00000_pr , 10 1.10000_pr , & - 1 0.72000_pr , 7 2.87000_pr , - 44 9.40000_pr , - 21 3.70000_pr , - 11 0.30000_pr , & 0.00000_pr , 116 7.00000_pr , 46 1.30000_pr , 0.00000_pr , 13 6.00000_pr , & 288 8.60010_pr , - 29 4.80000_pr , 8.87000_pr , - 26 6.60000_pr , - 25 6.30000_pr , & 3 5.38000_pr , - 13 2.95000_pr , 17 6.45000_pr , 12 9.49000_pr , - 17 1.10000_pr , & 12 9.30000_pr , 0.00000_pr , 24 3.77500_pr , 0.00000_pr , - 14 6.31000_pr , & 15 2.00000_pr , 2 1.92000_pr , 2 4.37000_pr , - 11 1.45000_pr , 4 1.57000_pr , & 17 5.53000_pr , 61 1.30000_pr , 0.00000_pr , - 8 2.12000_pr , 0.00000_pr , & - 23 4.90000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , - 3.44400_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 50 7.00000_pr , & 33 3.50000_pr , 28 7.10000_pr , 19 7.80000_pr , 26 7.80000_pr , 17 9.70000_pr , & 23 3.87000_pr , - 3 2.52000_pr , - 19 0.40000_pr , 76 6.00000_pr , - 24 1.80000_pr , & 0.00000_pr , 45 7.30000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 55 4.40000_pr , 9 9.37000_pr , 19 3.90000_pr , 0.00000_pr , & 8 0.99000_pr , 23 5.60000_pr , 35 1.90000_pr , 38 3.30000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 20 1.50000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , - 9 2.26000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 13 4.50000_pr , 0.00000_pr , - 11 6.70000_pr , 0.00000_pr , 14 5.40000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 25 1.50000_pr , 21 4.50000_pr , & 3 2.14000_pr , 21 3.10000_pr , 2 8.06000_pr , - 12 8.60000_pr , 54 0.50000_pr , & - 16 2.87420_pr , - 10 3.60000_pr , 30 4.10000_pr , - 23 5.70000_pr , - 23 4.00000_pr , & 0.00000_pr , 22 2.10000_pr , - 5 6.08000_pr , - 19 4.10000_pr , 28 5.36000_pr , & - 15 6.10000_pr , 3 8.81000_pr , - 33 8.50000_pr , 22 5.39000_pr , - 19 7.71000_pr , & - 2 0.93000_pr , 11 3.90000_pr , - 2 5.15000_pr , - 9 4.49000_pr , 22 0.66000_pr , & 11 2.38200_pr , 6 3.71000_pr , - 8 7.31000_pr , 9.20700_pr , 47 6.60000_pr , & 73 6.40000_pr , 17 3.77000_pr , - 9 3.51000_pr , 0.00000_pr , - 21 7.90000_pr , & 16 7.30000_pr , - 15 8.20000_pr , 27 8.15000_pr , - 24 7.80000_pr , 44 8.50000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 39 1.50000_pr , 24 0.90000_pr , 16 1.70000_pr , & 1 9.02000_pr , 8.64200_pr , 35 9.30000_pr , 4 8.89000_pr , - 83 2.97000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , - 7 8.36000_pr , & 0.00000_pr , 12 7.40000_pr , 3 8.89000_pr , - 1 5.07000_pr , 0.00000_pr , & - 15 7.30000_pr , 0.00000_pr , 13 1.20000_pr , 0.00000_pr , 0.00000_pr , & 26 1.10000_pr , 10 8.50000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 10 6.70000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , - 36 6.51000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 4 9.70000_pr , 0.00000_pr , 0.00000_pr , 96 1.80000_pr , - 12 5.20000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 25 5.70000_pr , 16 3.90000_pr , 12 2.80000_pr , - 4 9.29000_pr , & 4 2.70000_pr , - 2 0.98000_pr , 16 8.00000_pr , 0.00000_pr , - 17 4.20000_pr , & 0.00000_pr , - 7 3.50000_pr , 0.00000_pr , 25 1.50000_pr , - 10 7.20000_pr , & 0.00000_pr , 86 5.90000_pr , 6 4.30000_pr , - 20 7.66000_pr , - 10 8.50000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 9 1.13000_pr , & 10 2.20000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , - 21 3.74000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , - 19 8.80000_pr , 1 0.03000_pr , & 0.00000_pr , 28 4.50000_pr , 146 4.20000_pr , 160 3.80000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 20 6.60000_pr , 6 1.11000_pr , 9 0.49000_pr , 2 3.50000_pr , - 32 3.00000_pr , & 5 3.90000_pr , 30 4.00000_pr , 0.00000_pr , - 16 9.00000_pr , 0.00000_pr , & - 19 6.70000_pr , 0.00000_pr , 542 2.29980_pr , - 4 1.11000_pr , - 18 9.20000_pr , & 0.00000_pr , - 2 4.46000_pr , 0.00000_pr , - 44 6.86000_pr , 0.00000_pr , & 15 1.38000_pr , - 14 1.40000_pr , - 29 3.70000_pr , 31 6.90000_pr , 295 1.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , - 25 7.20000_pr , & 0.00000_pr , 0.00000_pr , 11 6.47800_pr , - 18 5.20000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 92 0.70000_pr , & 74 9.30000_pr , 64 8.20000_pr , 66 4.20000_pr , - 5 2.39000_pr , 48 9.70000_pr , & 24 3.20000_pr , 11 9.90000_pr , 620 1.00000_pr , 0.00000_pr , 47 5.50000_pr , & 0.00000_pr , - 4 6.39000_pr , - 20 0.70000_pr , 13 8.54000_pr , 28 7.43000_pr , & 0.00000_pr , 11 7.40000_pr , 77 7.40000_pr , 49 3.80000_pr , 42 9.70000_pr , & 14 0.80000_pr , 0.00000_pr , 89 8.20000_pr , 33 4.90000_pr , 0.00000_pr , & 13 4.90000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 19 2.30000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 34 3.70000_pr , 0.00000_pr , - 2 2.10000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 28 7.77000_pr , 28 0.50000_pr , & - 4.44900_pr , 5 2.80000_pr , 17 0.02900_pr , 58 0.48000_pr , 45 9.00000_pr , & - 30 5.50000_pr , 7.34100_pr , 0.00000_pr , - 0.13000_pr , - 23 3.40000_pr , & 21 3.20000_pr , 0.00000_pr , 43 1.49000_pr , 0.00000_pr , 8 9.70000_pr , & 0.00000_pr , 13 4.28000_pr , - 31 3.50000_pr , 0.00000_pr , 58 7.30000_pr , & 1 8.98000_pr , 36 8.50000_pr , 2 0.18000_pr , 0.00000_pr , 247 5.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & - 4 2.71000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 28 1.60000_pr , & 15 9.80000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 22 1.40000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 59 7.00000_pr , 33 6.90000_pr , 21 2.50000_pr , & 609 6.00000_pr , 6.71200_pr , 5 3.28000_pr , 11 2.60000_pr , 0.00000_pr , & 48 1.70000_pr , - 10 6.40000_pr , 49 4.60000_pr , - 4 7.25000_pr , - 1 8.51000_pr , & 35 8.90000_pr , 14 7.10000_pr , 125 5.10000_pr , - 28 1.60000_pr , - 16 9.67000_pr , & 0.00000_pr , 9 2.07000_pr , 5 4.32000_pr , 25 8.60000_pr , 7 4.04000_pr , & 49 1.95000_pr , 36 3.50000_pr , 0.28300_pr , 0.00000_pr , 33 5.74300_pr , & 16 1.00000_pr , 0.00000_pr , 16 9.60000_pr , 0.00000_pr , 13 6.90000_pr , & 32 9.12000_pr , 0.00000_pr , - 4 2.31000_pr , 33 5.20000_pr , 0.00000_pr , & 15 0.60000_pr , 0.00000_pr , - 6 1.60000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 11 9.20000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 66 3.50000_pr , 31 8.90000_pr , 53 7.40000_pr , 87 2.30000_pr , & 19 9.00000_pr , - 20 2.00000_pr , - 1 4.09000_pr , 40 8.90000_pr , 66 9.40000_pr , & 49 7.50000_pr , 66 0.20000_pr , - 26 8.10000_pr , 66 4.60000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , - 39 6.00000_pr , - 15 3.70000_pr , 20 5.27000_pr , & 0.00000_pr , 51 9.10000_pr , 54 3.30000_pr , 50 4.20000_pr , 63 1.00000_pr , & 99 3.40000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 57 0.60000_pr , 0.00000_pr , 61 6.60000_pr , 525 6.00000_pr , 0.00000_pr , & - 18 0.20000_pr , 0.00000_pr , 89 8.20000_pr , 0.00000_pr , - 9 7.77000_pr , & 0.00000_pr , 117 9.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , - 7 0.25000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 3 5.93000_pr , - 3 6.87000_pr , - 1 8.81000_pr , - 11 4.14000_pr , 7 5.62000_pr , & - 3 8.32000_pr , 32 5.44000_pr , 0.00000_pr , - 19 1.69000_pr , 75 1.90000_pr , & - 3 4.74000_pr , 0.00000_pr , 30 1.14000_pr , - 8 2.92000_pr , 0.00000_pr , & - 18 2.91000_pr , 28 7.00000_pr , 0.00000_pr , 4.93300_pr , 1 3.41000_pr , & 0.00000_pr , - 8 4.53000_pr , - 15 7.10000_pr , 1 1.80000_pr , - 12 9.70000_pr , & 11 3.00000_pr , 197 1.00000_pr , - 7 3.09200_pr , - 2 7.94000_pr , - 3 9.46000_pr , & 0.00000_pr , 17 9.25000_pr , - 26 2.30000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 38 3.20000_pr , 0.00000_pr , - 5 5.21000_pr , 0.00000_pr , & 18 2.20000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 5 3.76000_pr , & 5 8.55000_pr , - 14 4.40000_pr , - 11 1.00000_pr , 6 5.28000_pr , - 10 2.54000_pr , & 37 0.40000_pr , 51 7.27000_pr , - 13 0.30000_pr , 6 7.52000_pr , 10 8.85000_pr , & 3 1.00000_pr , 13 7.77000_pr , 0.00000_pr , 0.00000_pr , - 7 3.85000_pr , & - 11 1.00000_pr , - 35 1.60000_pr , - 15 2.70000_pr , - 4 4.70000_pr , 10 8.31000_pr , & 0.00000_pr , 0.00000_pr , 1 7.97000_pr , - 8.30900_pr , - 9.63900_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , - 11 6.21000_pr , 0.00000_pr , & - 4 0.82000_pr , - 17 4.50000_pr , 0.00000_pr , - 21 5.00000_pr , 0.00000_pr , & 30 1.90000_pr , 0.00000_pr , 39 7.24000_pr , 0.00000_pr , 30 5.40000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & - 19 4.70000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 2 4.90000_pr , - 1 3.99000_pr , & - 23 1.90000_pr , - 8 0.25000_pr , - 9 8.12000_pr , - 13 9.35000_pr , 35 3.68000_pr , & 0.00000_pr , - 35 4.55000_pr , - 48 3.70000_pr , - 20 9.66000_pr , - 12 6.20000_pr , & - 15 4.30000_pr , 0.00000_pr , 0.00000_pr , - 35 2.90000_pr , 0.00000_pr , & - 11 4.73000_pr , - 1 5.62000_pr , 3 9.63000_pr , 24 9.15000_pr , 0.00000_pr , & 0.00000_pr , 5 1.90000_pr , - 0.22660_pr , 0.00000_pr , 0.00000_pr , & - 2 6.05800_pr , 0.00000_pr , 4 8.48400_pr , 0.00000_pr , 2 1.76000_pr , & - 4 6.80000_pr , 0.00000_pr , - 34 3.60000_pr , 0.00000_pr , - 14 9.80000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , - 19 3.00000_pr , 0.00000_pr , & 0.00000_pr , - 19 6.20000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & - 36 3.10000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 10 4.30000_pr , - 10 9.70000_pr , 3.00000_pr , & - 14 1.30000_pr , 14 3.10000_pr , - 4 4.76000_pr , 49 7.54000_pr , 182 7.00000_pr , & - 3 9.20000_pr , 0.00000_pr , 5 4.57000_pr , 17 9.70000_pr , 4 7.67000_pr , & - 9 9.81000_pr , 7 1.23000_pr , - 26 2.00000_pr , 88 2.00000_pr , - 20 5.30000_pr , & - 5 4.86000_pr , 18 3.40000_pr , 6 2.42000_pr , 5 6.33000_pr , - 3 0.10000_pr , & 0.00000_pr , 24 8.40000_pr , - 3 4.68000_pr , 51 4.60000_pr , - 6 0.71000_pr , & 0.00000_pr , - 13 3.16000_pr , 0.00000_pr , 4 8.49000_pr , 7 7.55000_pr , & 0.00000_pr , - 5 8.43000_pr , - 8 5.14800_pr , - 13 4.20000_pr , - 12 4.60000_pr , & - 18 6.70000_pr , 0.00000_pr , 33 5.70000_pr , 0.00000_pr , 7 0.81000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 3.16300_pr , - 1 1.30000_pr , & 0.00000_pr , - 7 9.34000_pr , 0.00000_pr , 7 5.04000_pr , 0.00000_pr , & 0.00000_pr , 1 1.44000_pr , 10 0.10000_pr , 18 7.00000_pr , - 21 1.00000_pr , & 12 3.50000_pr , - 2 8.25000_pr , 13 3.90000_pr , 691 5.00000_pr , - 11 9.80000_pr , & 0.00000_pr , 44 2.40000_pr , 2 4.28000_pr , 13 4.80000_pr , 3 0.05000_pr , & - 1 8.93000_pr , - 18 1.90000_pr , 61 7.50000_pr , - 2.17000_pr , - 4.62400_pr , & - 7 9.08000_pr , 15 3.00000_pr , 22 3.10000_pr , 19 2.10000_pr , - 7 5.97000_pr , & 0.00000_pr , 13 2.90000_pr , - 12 3.10000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , - 18 5.30000_pr , 0.00000_pr , & - 33 4.12000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , - 37 4.16000_pr , & 3 3.95000_pr , 95 6.10000_pr , 0.00000_pr , 0.00000_pr , 16 1.50000_pr , & 0.00000_pr , 0.00000_pr , 7.08200_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 66 1.50000_pr , 35 7.50000_pr , 16 8.04000_pr , 362 9.00000_pr , 25 6.50000_pr , & 7 5.14000_pr , 22 0.60000_pr , 0.00000_pr , 13 7.50000_pr , 0.00000_pr , & - 8 1.13000_pr , 0.00000_pr , 9 5.18000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , - 0.51500_pr , 0.00000_pr , & 3 2.73000_pr , 10 8.90000_pr , 0.00000_pr , 49 0.88000_pr , 13 2.70000_pr , & 0.00000_pr , - 8 5.12000_pr , 27 7.80000_pr , 0.00000_pr , 0.00000_pr , & 48 1.34800_pr , 6 4.28000_pr , 12 5.30000_pr , 17 4.43300_pr , 0.00000_pr , & 0.00000_pr , 37 9.40000_pr , 0.00000_pr , 22 3.60000_pr , 0.00000_pr , & - 12 4.70000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 84 4.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 17 6.30000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 54 3.00000_pr , & 0.00000_pr , 19 4.90000_pr , 444 8.00000_pr , 15 7.10000_pr , 45 7.88000_pr , & 39 9.50000_pr , - 41 3.48000_pr , 54 8.50000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 15 5.11000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & - 13 9.30000_pr , 284 5.00000_pr , 0.00000_pr , 0.00000_pr , 8 6.20000_pr , & 0.00000_pr , 0.00000_pr , 53 4.70000_pr , 221 3.00000_pr , 53 3.20000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 244 8.00000_pr , 428 8.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 15 3.60000_pr , 7 6.30000_pr , & 5 2.06800_pr , - 9.45100_pr , 48 8.90000_pr , - 3 1.09000_pr , 88 7.10000_pr , & 848 3.50000_pr , 21 6.13800_pr , 0.00000_pr , 18 3.04600_pr , 0.00000_pr , & 14 0.89600_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 23 0.85200_pr , 0.00000_pr , 45 0.08800_pr , 0.00000_pr , & 11 6.61200_pr , 13 2.20000_pr , 0.00000_pr , 32 0.20000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , - 2 7.45000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 16 7.90000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 88 5.50000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 18 4.40000_pr , 0.00000_pr , - 1 0.43000_pr , & 39 3.60000_pr , 14 7.50000_pr , 1 7.50000_pr , 0.00000_pr , 0.00000_pr , & - 4 6.28000_pr , 0.00000_pr , 0.00000_pr , 10 3.90000_pr , - 8.53800_pr , & - 7 0.14000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.46040_pr , 0.00000_pr , 5 9.02000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 8 5.70000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & - 7 1.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & - 27 4.10000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 6.97100_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 35 4.55000_pr , 26 2.90000_pr , - 6 4.69000_pr , 4 8.49000_pr , & - 12 0.46000_pr , - 6 1.76000_pr , 18 8.02600_pr , 0.00000_pr , - 16 3.70000_pr , & 0.00000_pr , 20 2.25000_pr , 0.00000_pr , 17 0.10000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & - 20 8.90000_pr , 6 5.56000_pr , 14 9.56000_pr , - 6 4.38000_pr , 54 6.68000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , - 6 4.28000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 302 5.00000_pr , 0.00000_pr , 21 0.36600_pr , 497 5.00000_pr , - 31 8.93000_pr , & - 11 9.20000_pr , 1 2.72000_pr , - 68 7.10000_pr , 7 1.46000_pr , 0.00000_pr , & - 10 1.70000_pr , 0.00000_pr , - 2 0.11000_pr , 0.00000_pr , 93 9.07000_pr , & 0.00000_pr , 0.10040_pr , 0.00000_pr , 17 7.50000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 13 9.82200_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 53 5.80000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , - 19 1.70000_pr , 0.00000_pr , & - 26 4.30000_pr , 0.00000_pr , 0.00000_pr , 26 2.00000_pr , 0.00000_pr , & 0.00000_pr , 51 5.80000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 33 5.80000_pr , & 0.00000_pr , 11 3.30000_pr , 25 9.00000_pr , 31 3.50000_pr , 21 2.10000_pr , & 0.00000_pr , 0.00000_pr , 5 3.59000_pr , 11 7.00000_pr , 14 8.30000_pr , & 0.00000_pr , - 14 9.50000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 22 8.40000_pr , 2.22000_pr , & 17 7.60000_pr , 8 6.40000_pr , 24 7.80000_pr , 0.00000_pr , 30 4.30000_pr , & 299 0.00000_pr , 29 2.70000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 3 7.10000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 28 8.10000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 47 9.50000_pr , 18 3.80000_pr , & 26 1.30000_pr , 21 0.00000_pr , 20 2.10000_pr , 10 6.30000_pr , 77 7.10000_pr , & 0.00000_pr , 24 5.20000_pr , 0.00000_pr , 1 8.88000_pr , 29 8.13000_pr , & - 20 2.30000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & - 6 0.78000_pr , - 6 2.17000_pr , - 9 5.00000_pr , 34 4.40000_pr , 31 5.90000_pr , & 16 8.80000_pr , 14 6.60000_pr , 59 3.40000_pr , 1 0.17000_pr , - 12 4.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 6.37000_pr , & 0.00000_pr , 0.00000_pr , - 11 1.20000_pr , 0.00000_pr , 32 2.42000_pr , & 0.00000_pr , - 17 6.26000_pr , 0.00000_pr , 62 7.70000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 29 8.90000_pr , 3 1.14000_pr , 15 4.26000_pr , & - 15 2.55000_pr , 72 7.80000_pr , - 11 9.10000_pr , 0.00000_pr , 0.00000_pr , & - 24 6.60000_pr , 2.21000_pr , 7 1.48000_pr , 0.00000_pr , - 15 6.57000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & - 20 3.02000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , - 2 7.70100_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 63 1.50000_pr , 0.00000_pr , & 6.69900_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 52 6.50000_pr , 17 9.00000_pr , 16 9.90000_pr , 428 4.00000_pr , & - 20 2.10000_pr , - 39 9.30000_pr , - 13 9.00000_pr , 0.00000_pr , - 4 4.58000_pr , & 0.00000_pr , 5 2.08000_pr , 0.00000_pr , 12 8.80000_pr , 87 4.19000_pr , & 0.00000_pr , 24 3.10000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & - 46 3.60000_pr , 0.00000_pr , 21 5.00000_pr , 36 3.70000_pr , 33 7.70000_pr , & 133 7.37000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 3 1.66000_pr , & 0.00000_pr , - 41 7.20000_pr , 0.00000_pr , 3 2.90000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 13 6.60000_pr , & 0.00000_pr , - 2 9.34000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 68 9.00000_pr , - 5 2.87000_pr , 38 3.90000_pr , - 11 9.20000_pr , 7 4.27000_pr , & - 5.22400_pr , 16 0.80000_pr , 0.00000_pr , - 6 3.50000_pr , - 33 9.20000_pr , & - 2 8.61000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 8 1.57000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 36 9.49000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 83 7.20000_pr , 0.00000_pr , 5.15000_pr , 0.00000_pr , & - 5 3.91000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , - 4.18900_pr , & - 6 6.46000_pr , - 25 9.10000_pr , - 28 2.50000_pr , 22 5.80000_pr , 3 3.47000_pr , & 0.00000_pr , 0.00000_pr , - 3 4.57000_pr , 17 2.40000_pr , - 27 5.20000_pr , & - 1 1.40000_pr , 24 0.20000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 16 0.70000_pr , - 5 5.77000_pr , - 1 1.16000_pr , - 16 8.20000_pr , & - 9 1.80000_pr , 11 1.20000_pr , 18 7.10000_pr , 0.00000_pr , 1 0.76000_pr , & 0.00000_pr , - 4 7.37000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , - 4 8.33000_pr , 207 3.20000_pr , 0.00000_pr , - 20 8.80000_pr , & 0.00000_pr , 0.00000_pr , - 13 7.70000_pr , 0.00000_pr , - 19 8.00000_pr , & 0.00000_pr , 0.00000_pr , - 6 6.31000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 14 8.90000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 12 5.80000_pr , 35 9.30000_pr , & 38 9.30000_pr , 10 1.40000_pr , 4 4.78000_pr , - 4 8.25000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & - 27 3.95000_pr , 0.00000_pr , 57 0.90000_pr , - 19 6.31200_pr , 0.00000_pr , & - 15 8.80000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 21 5.20000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 5 0.06000_pr , 18 5.60000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 48 5.30000_pr , - 7 0.45000_pr , 24 5.60000_pr , & 562 9.00000_pr , - 14 3.90000_pr , - 17 2.40000_pr , 31 9.00000_pr , 0.00000_pr , & - 6 1.70000_pr , - 26 8.80000_pr , 8 5.33000_pr , 30 8.90000_pr , 25 4.80000_pr , & - 16 4.00000_pr , - 25 5.22000_pr , 2 2.05000_pr , - 33 4.40000_pr , 0.00000_pr , & - 15 1.50000_pr , - 22 8.00000_pr , 6.57000_pr , - 16 0.28000_pr , 0.00000_pr , & 49 8.60000_pr , 514 3.14010_pr , - 22 3.10000_pr , 0.00000_pr , 0.00000_pr , & 7 8.92000_pr , 0.00000_pr , 30 2.20000_pr , 0.00000_pr , 33 6.25000_pr , & - 11 9.80000_pr , - 9 7.71000_pr , - 8.80400_pr , 25 5.00000_pr , - 11 0.65000_pr , & 0.00000_pr , 5 5.80000_pr , - 2 8.65000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , - 2.85900_pr , 44 9.40000_pr , 2 2.67000_pr , - 24 5.39000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , - 17 2.51000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 30 9.58000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , - 11 7.17000_pr , - 5.57900_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & - 3 2.17000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 38 7.10000_pr , 4 8.33000_pr , 10 3.50000_pr , 6 9.26000_pr , 19 0.30000_pr , & 16 5.70000_pr , - 19 7.50000_pr , - 49 4.20000_pr , - 1 8.80000_pr , - 27 5.50000_pr , & 56 0.20000_pr , - 12 2.30000_pr , 41 7.00000_pr , 0.00000_pr , - 3 8.77000_pr , & 0.00000_pr , - 8 9.42000_pr , 0.00000_pr , 12 0.30000_pr , - 33 7.00000_pr , & 6 3.67000_pr , - 9 6.87000_pr , 25 5.80000_pr , 25 6.50000_pr , - 7 1.18000_pr , & 24 8.40000_pr , 0.00000_pr , 46 9.80000_pr , 0.00000_pr , 4 3.37000_pr , & 34 7.80000_pr , 6 8.55000_pr , - 19 5.10000_pr , 0.00000_pr , 15 3.70000_pr , & 42 3.40000_pr , 73 0.80000_pr , 0.00000_pr , 7 2.31000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 10 1.20000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , - 45 0.40000_pr , & 0.00000_pr , - 43 2.30000_pr , 0.00000_pr , - 81 7.70000_pr , 0.00000_pr , & - 36 3.80000_pr , 0.00000_pr , - 58 8.90000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 133 8.00000_pr , - 66 4.40000_pr , 44 8.10000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 74 5.30000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 25 2.70000_pr , 0.00000_pr , & 23 8.90000_pr , 0.00000_pr , - 171 2.80000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 27 5.90000_pr , - 132 7.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 23 3.10000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , - 216 6.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 22 0.30000_pr , 8 6.46000_pr , 3 0.04000_pr , & 4 6.38000_pr , - 50 4.20000_pr , 0.00000_pr , - 45 2.20000_pr , - 65 9.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , - 3 5.68000_pr , & 0.00000_pr , - 20 9.70000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 100 4.20000_pr , 0.00000_pr , - 26 2.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 2 6.35000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , - 5.86900_pr , 0.00000_pr , - 8 8.11000_pr , 0.00000_pr , & 7 2.96000_pr , - 5 2.10000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , - 21 8.90000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 11 1.80000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 39 0.90000_pr , 20 0.20000_pr , 0.00000_pr , 0.00000_pr , - 38 2.70000_pr , & 0.00000_pr , 83 5.60000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , - 32 2.30000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 55 3.30000_pr , & 26 8.10000_pr , 33 3.30000_pr , 42 1.90000_pr , - 24 8.30000_pr , 0.00000_pr , & 13 9.60000_pr , 0.00000_pr , 3 7.54000_pr , 0.00000_pr , 15 1.80000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 1 6.23000_pr , 0.00000_pr , 0.00000_pr , & 36 1.10000_pr , 0.00000_pr , 42 3.10000_pr , 43 4.10000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , - 35 3.50000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 12 2.40000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 18 7.00000_pr , - 61 7.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 3 7.63000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 56 5.90000_pr , 6 3.95000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , - 1 8.27000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 242 9.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 21 6.10000_pr , 6 2.56000_pr , - 5 9.58000_pr , & - 20 3.60000_pr , 10 4.70000_pr , - 5 9.40000_pr , 40 7.90000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 9 2.99000_pr , 0.00000_pr , - 3 9.16000_pr , 18 4.90000_pr , & 5 7.65000_pr , - 4 6.01000_pr , 0.00000_pr , 100 5.00000_pr , - 16 2.60000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , - 13 6.60000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 10 8.50000_pr , & 0.00000_pr , - 4.56500_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 69 9.13000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 80 8.59000_pr , & 20 0.94000_pr , 36 0.82000_pr , 23 3.51000_pr , 21 5.81000_pr , 15 0.02000_pr , & - 25 5.63000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 58 5.19000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , - 124 3.00000_pr , - 86 1.46000_pr , & 0.00000_pr , 0.00000_pr , - 184 0.80000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , - 186 9.90000_pr , 63 7.65000_pr , 42 4.93000_pr , 0.00000_pr , & 0.00000_pr , 5 6.29800_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , & 0.00000_pr , 0.00000_pr , 0.00000_pr , 0.00000_pr , 151 7.50000_pr , & 0.00000_pr ], [ 54 , 54 ]) ! ======================================================================== ! UNIFAC bij ! ------------------------------------------------------------------------ allocate ( UNIFACParameters % maingroups_bij ( 54 , 54 )) UNIFACParameters % maingroups_bij = 0.0_pr ! ======================================================================== ! UNIFAC cij ! ------------------------------------------------------------------------ allocate ( UNIFACParameters % maingroups_cij ( 54 , 54 )) UNIFACParameters % maingroups_cij = 0.0_pr end function UNIFACParameters end module yaeos__models_ge_group_contribution_unifac_parameters","tags":"","loc":"sourcefile/unifac_parameters.f90.html"},{"title":"unifac.f90 – yaeos","text":"Source Code module yaeos__models_ge_group_contribution_unifac !! # UNIFAC module !! Classic liquid-vapor UNIFAC model implementation module. !! !! # Description !! Classic liquid-vapor UNIFAC model implementation module. The !! implementation is based on the Thermopack library (SINTEF) implementation. !! !! # Examples !! !! ```fortran !! ! Instantiate an UNIFAC model with ethanol-water mix and calculate gammas !! use yaeos, only: pr, Groups, setup_unifac, UNIFAC !! !! type(UNIFAC) :: model !! type(Groups) :: molecules(2) !! real(pr) :: ln_gammas(2) !! !! ! Ethanol definition [CH3, CH2, OH] !! molecules(1)%groups_ids = [1, 2, 14] ! Subgroups ids !! molecules(1)%number_of_groups = [1, 1, 1] ! Subgroups occurrences !! !! ! Water definition [H2O] !! molecules(2)%groups_ids = [16] !! molecules(2)%number_of_groups = [1] !! !! ! Model setup !! model = setup_unifac(molecules) !! !! ! Calculate ln_gammas !! call model%ln_activity_coefficient([0.5_pr, 0.5_pr], 298.0_pr, ln_gammas) !! !! print *, ln_gammas ! result: 0.18534142000449058 0.40331395945417559 !! ``` !! !! # References !! 1. [Dortmund Data Bank Software & Separation Technology](https://www.ddbst !! .com/published-parameters-unifac.html) !! 2. Fredenslund, A., Jones, R. L., & Prausnitz, J. M. (1975). !! Group‐contribution estimation of activity coefficients in nonideal liquid !! mixtures. AIChE Journal, 21(6), 1086–1099. !! [https://doi.org/10.1002/aic.690210607](https://doi.org/10.1002/aic.690210607) !! 3. Skjold-Jorgensen, S., Kolbe, B., Gmehling, J., & Rasmussen, P. (1979). !! Vapor-Liquid Equilibria by UNIFAC Group Contribution. Revision and !! Extension. Industrial & Engineering Chemistry Process Design and !! Development, 18(4), 714–722. !! [https://doi.org/10.1021/i260072a024](https://doi.org/10.1021/i260072a024) !! 4. Gmehling, J., Rasmussen, P., & Fredenslund, A. (1982). Vapor-liquid !! equilibriums by UNIFAC group contribution. Revision and extension. 2. !! Industrial & Engineering Chemistry Process Design and Development, 21(1), !! 118–127. !! [https://doi.org/10.1021/i200016a021](https://doi.org/10.1021/i200016a021) !! 5. Macedo, E. A., Weidlich, U., Gmehling, J., & Rasmussen, P. (1983). !! Vapor-liquid equilibriums by UNIFAC group contribution. Revision and !! extension. 3. Industrial & Engineering Chemistry Process Design and !! Development, 22(4), 676–678. !! [https://doi.org/10.1021/i200023a023](https://doi.org/10.1021/i200023a023) !! 6. Tiegs, D., Rasmussen, P., Gmehling, J., & Fredenslund, A. (1987). !! Vapor-liquid equilibria by UNIFAC group contribution. 4. Revision and !! extension. Industrial & Engineering Chemistry Research, 26(1), 159–161. !! [https://doi.org/10.1021/ie00061a030](https://doi.org/10.1021/ie00061a030) !! 7. Hansen, H. K., Rasmussen, P., Fredenslund, A., Schiller, M., & !! Gmehling, J. (1991). Vapor-liquid equilibria by UNIFAC group !! contribution. 5. Revision and extension. Industrial & Engineering !! Chemistry Research, 30 (10), 2352–2355. !! [https://doi.org/10.1021/ie00058a017](https://doi.org/10.1021/ie00058a017) !! 8. Wittig, R., Lohmann, J., & Gmehling, J. (2003). Vapor−Liquid Equilibria !! by UNIFAC Group Contribution. 6. Revision and Extension. Industrial & !! Engineering Chemistry Research, 42(1), 183–188. !! [https://doi.org/10.1021/ie020506l](https://doi.org/10.1021/ie020506l) !! 9. [SINTEF - Thermopack](https://github.com/thermotools/thermopack) !! use yaeos__constants , only : pr , R use yaeos__models_ge , only : GeModel use yaeos__models_ge_group_contribution_model_parameters , only : GeGCModelParameters use yaeos__models_ge_group_contribution_unifac_parameters , only : UNIFACParameters implicit none type :: Groups !! # Groups !! Derived type used to represent a molecule and its UNIFAC groups. !! !! # Description !! Derived type used to represent a molecule and its UNIFAC groups. Is !! necessary to specify the subgroups ids and the subgroups on each !! molecule as shown in the example. !! !! # Examples !! !! ```fortran !! ! Define toluene molecule groups !! use yaeos, only: Groups !! !! type(Groups) :: toluene !! !! ! Toluene [ACH, ACCH3] !! toluene%groups_ids = [9, 11] ! Subgroups ids !! toluene%number_of_groups = [5, 1] ! Subgroups occurrences !! ``` !! !! # References !! 1. [Dortmund Data Bank Software & Separation Technology](https://www.ddbst !! .com/published-parameters-unifac.html) integer , allocatable :: groups_ids (:) !! Indexes (ids) of each subgroup in the main group matrix integer , allocatable :: number_of_groups (:) !! Occurrences of each subgroup in the molecule real ( pr ) :: surface_area !! Molecule surface area q real ( pr ) :: volume !! Molecule volume r end type Groups type , extends ( GeModel ) :: UNIFAC !! # UNIFAC model !! Classic liquid-vapor UNIFAC model derived type !! !! # Description !! This type holds the needed parameters for using a UNIFAC G^E model !! mainly group areas, volumes and what temperature dependence function !! \\psi(T) to use. !! !! It also holds the individual molecules of a particular system and !! the set of all groups in the system as a \"stew\" of groups instead of !! being them included in particular molecules. !! !! # Examples !! !! ```fortran !! ! UNIFAC model with ethanol-formic acid mix and calculate gammas !! use yaeos, only: pr, Groups, setup_unifac, UNIFAC !! !! type(UNIFAC) :: model !! type(Groups) :: molecules(2) !! real(pr) :: ln_gammas(2) !! !! ! Ethanol definition [CH3, CH2, OH] !! molecules(1)%groups_ids = [1, 2, 14] ! Subgroups ids !! molecules(1)%number_of_groups = [1, 1, 1] ! Subgroups occurrences !! !! ! formic acid definition [HCOOH] !! molecules(2)%groups_ids = [43] !! molecules(2)%number_of_groups = [1] !! !! ! Model setup !! model = setup_unifac(molecules) !! !! ! Calculate ln_gammas !! call model%ln_activity_coefficient([0.5_pr, 0.5_pr], 298.0_pr, ln_gammas) !! !! print *, ln_gammas ! result: 0.10505475697637946 0.28073129552766890 !! ``` !! !! # References !! 1. [Dortmund Data Bank Software & Separation Technology](https://www.ddbst !! .com/published-parameters-unifac.html) !! 2. Fredenslund, A., Jones, R. L., & Prausnitz, J. M. (1975). !! Group‐contribution estimation of activity coefficients in nonideal liquid !! mixtures. AIChE Journal, 21(6), 1086–1099. !! [https://doi.org/10.1002/aic.690210607](https://doi.org/10.1002/aic.690210607) !! 3. Skjold-Jorgensen, S., Kolbe, B., Gmehling, J., & Rasmussen, P. (1979). !! Vapor-Liquid Equilibria by UNIFAC Group Contribution. Revision and !! Extension. Industrial & Engineering Chemistry Process Design and !! Development, 18(4), 714–722. !! [https://doi.org/10.1021/i260072a024](https://doi.org/10.1021/i260072a024) !! 4. Gmehling, J., Rasmussen, P., & Fredenslund, A. (1982). Vapor-liquid !! equilibriums by UNIFAC group contribution. Revision and extension. 2. !! Industrial & Engineering Chemistry Process Design and Development, 21(1), !! 118–127. !! [https://doi.org/10.1021/i200016a021](https://doi.org/10.1021/i200016a021) !! 5. Macedo, E. A., Weidlich, U., Gmehling, J., & Rasmussen, P. (1983). !! Vapor-liquid equilibriums by UNIFAC group contribution. Revision and !! extension. 3. Industrial & Engineering Chemistry Process Design and !! Development, 22(4), 676–678. !! [https://doi.org/10.1021/i200023a023](https://doi.org/10.1021/i200023a023) !! 6. Tiegs, D., Rasmussen, P., Gmehling, J., & Fredenslund, A. (1987). !! Vapor-liquid equilibria by UNIFAC group contribution. 4. Revision and !! extension. Industrial & Engineering Chemistry Research, 26(1), 159–161. !! [https://doi.org/10.1021/ie00061a030](https://doi.org/10.1021/ie00061a030) !! 7. Hansen, H. K., Rasmussen, P., Fredenslund, A., Schiller, M., & !! Gmehling, J. (1991). Vapor-liquid equilibria by UNIFAC group !! contribution. 5. Revision and extension. Industrial & Engineering !! Chemistry Research, 30 (10), 2352–2355. !! [https://doi.org/10.1021/ie00058a017](https://doi.org/10.1021/ie00058a017) !! 8. Wittig, R., Lohmann, J., & Gmehling, J. (2003). Vapor−Liquid Equilibria !! by UNIFAC Group Contribution. 6. Revision and Extension. Industrial & !! Engineering Chemistry Research, 42(1), 183–188. !! [https://doi.org/10.1021/ie020506l](https://doi.org/10.1021/ie020506l) !! 9. [SINTEF - Thermopack](https://github.com/thermotools/thermopack) !! integer :: ngroups !! Total number of individual groups in the mixture integer :: nmolecules !! Total number of molecules in the mixture real ( pr ) :: z = 10 !! Model constant real ( pr ), allocatable :: group_area (:) !! Group areas Q_k real ( pr ), allocatable :: group_volume (:) !! Group volumes R_k real ( pr ), allocatable :: thetas_ij (:, :) !! Area fractions of the groups j on molecules i real ( pr ), allocatable :: vij (:,:) !! Ocurrences of each group j on each molecule i real ( pr ), allocatable :: qk (:) !! Area of each group k class ( PsiFunction ), allocatable :: psi_function !! Temperature dependance function of the model type ( Groups ), allocatable :: molecules (:) !! Substances present in the system type ( Groups ) :: groups_stew !! All the groups present in the system contains procedure :: excess_gibbs end type UNIFAC type , abstract :: PsiFunction !! # \\psi(T) function !! UNIFAC \\psi(T) functions abstract type !! !! # Description !! Abstract derived type for UNIFAC models temperature dependent functions !! contains procedure ( temperature_dependence ), deferred :: psi end type PsiFunction abstract interface subroutine temperature_dependence (& self , systems_groups , T , psi , dpsi_dt , dpsi_dt2 & ) !! # temperature_dependence interface !! Interface subroutine for UNIFAC models temperature dependent !! functions !! import pr , PsiFunction , Groups class ( PsiFunction ) :: self !! PsiFunction type variable class ( Groups ) :: systems_groups !! Groups type variable containig all the system's groups. See the !! `groups_stew` variable on the `UNIFAC` documentation. real ( pr ), intent ( in ) :: T !! Temperature [K] real ( pr ), optional , intent ( out ) :: psi (:, :) !! \\psi(T) real ( pr ), optional , intent ( out ) :: dpsi_dt (:, :) !! \\frac{d \\psi (T)}{dT} real ( pr ), optional , intent ( out ) :: dpsi_dt2 (:, :) !! \\frac{d^2 \\psi (T)}{dT^2} end subroutine temperature_dependence end interface type , extends ( PsiFunction ) :: UNIFACPsi !! # Original UNIFAC \\psi function !! !! \\psi_{ij}(T) = \\exp(-\\frac{A_{ij}}{T}) !! !! !! !! \\frac{d \\psi_{ij}(T)}{dT} = \\frac{A_{ij}}{T^2} !! \\exp(-\\frac{A_{ij}}{T}) !! !! !! !! \\frac{d^2 \\psi_{ij}(T)}{dT^2} = !! \\frac{Aij (Aij - 2T)}{T^4} \\exp(-\\frac{A_{ij}}{T}) !! !! !! # References !! 1. [Dortmund Data Bank Software & Separation Technology](https://www.ddbst !! .com/published-parameters-unifac.html) !! 2. Fredenslund, A., Jones, R. L., & Prausnitz, J. M. (1975). !! Group‐contribution estimation of activity coefficients in nonideal liquid !! mixtures. AIChE Journal, 21(6), 1086–1099. !! [https://doi.org/10.1002/aic.690210607](https://doi.org/10.1002/aic.690210607) !! 3. Skjold-Jorgensen, S., Kolbe, B., Gmehling, J., & Rasmussen, P. (1979). !! Vapor-Liquid Equilibria by UNIFAC Group Contribution. Revision and !! Extension. Industrial & Engineering Chemistry Process Design and !! Development, 18(4), 714–722. !! [https://doi.org/10.1021/i260072a024](https://doi.org/10.1021/i260072a024) !! 4. Gmehling, J., Rasmussen, P., & Fredenslund, A. (1982). Vapor-liquid !! equilibriums by UNIFAC group contribution. Revision and extension. 2. !! Industrial & Engineering Chemistry Process Design and Development, 21(1), !! 118–127. !! [https://doi.org/10.1021/i200016a021](https://doi.org/10.1021/i200016a021) !! 5. Macedo, E. A., Weidlich, U., Gmehling, J., & Rasmussen, P. (1983). !! Vapor-liquid equilibriums by UNIFAC group contribution. Revision and !! extension. 3. Industrial & Engineering Chemistry Process Design and !! Development, 22(4), 676–678. !! [https://doi.org/10.1021/i200023a023](https://doi.org/10.1021/i200023a023) !! 6. Tiegs, D., Rasmussen, P., Gmehling, J., & Fredenslund, A. (1987). !! Vapor-liquid equilibria by UNIFAC group contribution. 4. Revision and !! extension. Industrial & Engineering Chemistry Research, 26(1), 159–161. !! [https://doi.org/10.1021/ie00061a030](https://doi.org/10.1021/ie00061a030) !! 7. Hansen, H. K., Rasmussen, P., Fredenslund, A., Schiller, M., & !! Gmehling, J. (1991). Vapor-liquid equilibria by UNIFAC group !! contribution. 5. Revision and extension. Industrial & Engineering !! Chemistry Research, 30 (10), 2352–2355. !! [https://doi.org/10.1021/ie00058a017](https://doi.org/10.1021/ie00058a017) !! 8. Wittig, R., Lohmann, J., & Gmehling, J. (2003). Vapor−Liquid Equilibria !! by UNIFAC Group Contribution. 6. Revision and Extension. Industrial & !! Engineering Chemistry Research, 42(1), 183–188. !! [https://doi.org/10.1021/ie020506l](https://doi.org/10.1021/ie020506l) !! 9. [SINTEF - Thermopack](https://github.com/thermotools/thermopack) !! real ( pr ), allocatable :: Aij (:, :) contains procedure :: psi => UNIFAC_temperature_dependence end type UNIFACPsi contains subroutine excess_gibbs ( self , n , T , Ge , GeT , GeT2 , Gen , GeTn , Gen2 ) !! # Excess Gibbs energy !! Calculate the Gibbs excess energy of the UNIFAC model !! !! # Description !! Calculate the Gibbs excess energy of the UNIFAC model and its !! derivatives. !! !! # Examples !! !! ```fortran !! ! Gibbs excess of ethane-ethanol-methyl amine mixture. !! use yaeos, only: R, pr, Groups, setup_unifac, UNIFAC !! !! type(UNIFAC) :: model !! !! integer, parameter :: nc = 3, ng = 4 !! !! type(Groups) :: molecules(nc) !! !! real(pr) :: Ge, Gen(nc), GeT, GeT2, GeTn(nc), Gen2(nc, nc) !! !! real(pr) :: n(nc), ln_gammas(nc), T !! !! T = 150.0_pr !! n = [2.0_pr, 7.0_pr, 1.0_pr] !! !! ! Ethane [CH3] !! molecules(1)%groups_ids = [1] !! molecules(1)%number_of_groups = [2] !! !! ! Ethanol [CH3, CH2, OH] !! molecules(2)%groups_ids = [1, 2, 14] !! molecules(2)%number_of_groups = [1, 1, 1] !! !! ! Methylamine [H3C-NH2] !! molecules(3)%groups_ids = [28] !! molecules(3)%number_of_groups = [1] !! !! ! setup UNIFAC model !! model = setup_unifac(molecules) !! !! ! Call all Ge and derivatives !! call model%excess_gibbs(model, n, T, Ge, GeT, GeT2, Gen, GeTn, Gen2) !! !! print *, \"Ge: \", Ge !! print *, \"GeT: \", GeT !! print *, \"GeT2: \", GeT2 !! print *, \"Gen: \", Gen !! print *, \"GeTn: \", GeTn !! print *, \"Gen2:\" !! print *, Gen2(1,:) !! print *, Gen2(2,:) !! print *, Gen2(3,:) !! !! ! If you want the ln_gammas from \"Gen\" derivative: !! print *, \"ln_gammas: \", Gen / R / T !! !! ! Or !! call model%ln_activity_coefficient(n, T, ln_gammas) !! print *, \"ln_gammas: \", ln_gammas !! ``` !! class ( UNIFAC ), intent ( in ) :: self !! UNIFAC model real ( pr ), intent ( in ) :: n (:) !! Moles vector [mol] real ( pr ), intent ( in ) :: T !! Temperature [K] real ( pr ), optional , intent ( out ) :: Ge !! Excess Gibbs energy real ( pr ), optional , intent ( out ) :: GeT !! \\frac{dG^E}{dT} real ( pr ), optional , intent ( out ) :: GeT2 !! \\frac{d^2G^E}{dT^2} real ( pr ), optional , intent ( out ) :: Gen ( size ( n )) !! \\frac{dG^E}{dn} real ( pr ), optional , intent ( out ) :: GeTn ( size ( n )) !! \\frac{d^2G^E}{dTdn} real ( pr ), optional , intent ( out ) :: Gen2 ( size ( n ), size ( n )) !! \\frac{d^2G^E}{dn^2} ! Combinatorial real ( pr ) :: Ge_c real ( pr ) :: dGe_c_dn ( self % nmolecules ) real ( pr ) :: dGe_c_dn2 ( self % nmolecules , self % nmolecules ) ! logical logical :: pge , dn , dn2 ! Residual calling call Ge_residual ( self , n , T , Ge , Gen , Gen2 , GeT , GeT2 , GeTn ) ! Individual combinatorial calling pge = present ( Ge ) dn = present ( Gen ) dn2 = present ( Gen2 ) if ( dn . and . . not . dn2 ) then call Ge_combinatorial ( self , n , T , Ge = Ge_c , dGe_dn = dGe_c_dn ) elseif ( dn2 . and . . not . dn ) then call Ge_combinatorial ( self , n , T , Ge = Ge_c , dGe_dn2 = dGe_c_dn2 ) else call Ge_combinatorial (& self , n , T , Ge = Ge_c , dGe_dn = dGe_c_dn , dGe_dn2 = dGe_c_dn2 & ) end if if ( present ( Ge )) Ge = Ge_c + Ge if ( present ( Gen )) Gen = dGe_c_dn + Gen if ( present ( Gen2 )) Gen2 = dGe_c_dn2 + Gen2 if ( present ( GeT )) GeT = Ge_c / T + GeT if ( present ( GeT2 )) GeT2 = GeT2 if ( present ( GeTn )) GeTn = dGe_c_dn / T + GeTn end subroutine excess_gibbs subroutine Ge_combinatorial ( self , n , T , Ge , dGe_dn , dGe_dn2 ) !! # UNIFAC combinatorial term !! Calculate the UNIFAC combinatorial term of Gibbs excess energy !! !! # Description !! Calculate the UNIFAC combinatorial term of reduced Gibbs excess energy. !! The subroutine uses the Flory-Huggins and Staverman-Guggenheim !! combinatory terms as follows: !! !! ### Flory-Huggins !! !! !! G^{E,FH} = !! RT \\left(\\sum_i^{NC} n_i \\, \\text{ln} \\, r_i !! - n \\, \\text{ln} \\, \\sum_j^{NC} n_j r_j !! + n \\, \\text{ln} \\, n \\right) !! !! !! !! \\frac{dG^{E,FH}}{dn_i} = !! RT \\left(\\text{ln} \\, r_i - \\text{ln} \\, \\sum_j^{NC} n_j r_j !! + \\text{ln} \\, n + 1 - \\frac{n r_i}{\\displaystyle !! \\sum_j^{NC} n_j r_j} \\right) !! !! !! !! \\frac{d^2G^{E,FH}}{dn_i dn_j} = !! RT \\left(- \\frac{r_i + r_j}{\\displaystyle \\sum_l^{NC} n_l r_l} !! + \\frac{1}{n} + \\frac{n r_i r_j}{\\displaystyle \\left(\\sum_l^{NC} !! n_l r_l \\right)^2} \\right) !! !! !! ### Staverman-Guggenheim !! !! !! \\frac{G^{E,SG}}{RT} = !! \\frac{z}{2} \\sum_i^{NC} n_i q_i !! \\left(\\text{ln} \\frac{q_i}{r_i} !! - \\text{ln} \\, \\sum_j^{NC} n_j q_j !! + \\text{ln} \\, \\sum_j^{NC} n_j r_j \\right) !! !! !! !! \\frac{1}{RT}\\frac{dG^{E,SG}}{dn_i} = !! \\frac{z}{2} q_i \\left( !! - \\text{ln} \\, \\left( !! \\frac{r_i \\sum_j^{NC} n_j q_j}{\\displaystyle q_i \\sum_j^{NC} !! n_j r_j} \\right) - 1 + \\frac{\\displaystyle r_i \\sum_j^{NC} n_j !! q_j}{\\displaystyle q_i \\sum_j^{NC} n_j r_j} \\right) !! !! !! !! \\frac{1}{RT}\\frac{d^2G^{E,SG}}{dn_i dn_j} = !! \\frac{z}{2} \\left(- \\frac{q_i q_j}{\\displaystyle \\sum_l^{NC} n_lq_l} !! + \\frac{q_i r_j + q_j r_i}{\\displaystyle \\sum_l^{NC} n_l r_l} !! - \\frac{\\displaystyle r_i r_j \\sum_l^{NC} n_l q_l} !! {\\left(\\displaystyle \\sum_l^{NC} n_l r_l \\right)^2} \\right) !! !! !! ### Fredenslund et al. (UNIFAC) !! !! \\frac{G^{E,\\text{UNIFAC}}}{RT} = !! \\frac{G^{E,FH}}{RT} + \\frac{G^{E,SG}}{RT} !! !! !! # References !! 1. [SINTEF - Thermopack](https://github.com/thermotools/thermopack) class ( UNIFAC ) :: self real ( pr ), intent ( in ) :: n ( self % nmolecules ) !! Moles vector [mol] real ( pr ), intent ( in ) :: T !! Temperature [K] real ( pr ), optional , intent ( out ) :: Ge !! Combinatorial Gibbs excess energy real ( pr ), optional , intent ( out ) :: dGe_dn ( self % nmolecules ) !! \\frac{dGe}{dn} real ( pr ), optional , intent ( out ) :: dGe_dn2 ( self % nmolecules , self % nmolecules ) !! \\frac{d^2Ge}{dn^2} ! Flory-Huggins variables real ( pr ) :: Ge_fh real ( pr ) :: dGe_fh_dn ( self % nmolecules ) real ( pr ) :: dGe_fh_dn2 ( self % nmolecules , self % nmolecules ) ! Staverman-Guggenheim variables real ( pr ) :: Ge_sg real ( pr ) :: dGe_sg_dn ( self % nmolecules ) real ( pr ) :: dGe_sg_dn2 ( self % nmolecules , self % nmolecules ) ! utility real ( pr ) :: nq , nr , n_t integer :: i , j associate (& q => self % molecules % surface_area ,& r => self % molecules % volume ,& z => self % z & ) nr = dot_product ( n , r ) nq = dot_product ( n , q ) n_t = sum ( n ) if ( present ( Ge )) then Ge_fh = sum ( n * log ( r )) - n_t * log ( nr ) + n_t * log ( n_t ) Ge_sg = z / 2 * sum ( n * q * ( log ( q / r ) - log ( nq ) + log ( nr ))) end if if ( present ( dGe_dn )) then dGe_fh_dn = log ( r ) - log ( nr ) + log ( n_t ) + 1.0_pr - n_t * r / nr dGe_sg_dn = z / 2 * q * ( - log (( r * nq ) / ( q * nr )) - 1.0_pr + ( r * nq ) / ( q * nr )) end if if ( present ( dGe_dn2 )) then dGe_fh_dn2 = 0.0_pr dGe_sg_dn2 = 0.0_pr do concurrent ( i = 1 : size ( n ), j = 1 : size ( n )) dGe_fh_dn2 ( i , j ) = - ( r ( i ) + r ( j )) / nr + 1.0_pr / n_t + n_t * r ( i ) * r ( j ) / nr ** 2 dGe_sg_dn2 ( i , j ) = z / 2.0_pr * ( - q ( i ) * q ( j ) / nq + ( q ( i ) * r ( j ) + q ( j ) * r ( i )) / nr - r ( i ) * r ( j ) * nq / nr ** 2 ) end do end if end associate if ( present ( Ge )) Ge = ( Ge_fh + Ge_sg ) * R * T if ( present ( dGe_dn )) dGe_dn = ( dGe_fh_dn + dGe_sg_dn ) * R * T if ( present ( dGe_dn2 )) dGe_dn2 = ( dGe_fh_dn2 + dGe_sg_dn2 ) * R * T end subroutine Ge_combinatorial subroutine Ge_residual ( self , n , T , Ge , dGe_dn , dGe_dn2 , dGe_dT , dGe_dT2 , dGe_dTn ) !! # UNIFAC residual term !! Evaluate the UNIFAC residual therm !! !! # Description !! Evaluate the UNIFAC residual therm. The residual Gibbs excess energy !! and its derivatives are evaluated as: !! !! !! \\frac{G^{E,R}}{RT} = - \\sum_i^{NC} n_i \\sum_k^{NG} v_k^i Q_k !! (\\Lambda_k - \\Lambda_k^i) !! !! !! With: !! !! !! \\Lambda_k = \\text{ln} \\, \\sum_{j}^{NG} \\Theta_j E_{jk} !! !! !! !! \\Lambda_k^i = \\text{ln} \\, \\sum_{j}^{NG} \\Theta_j^i E_{jk} !! !! !! !! E_{jk} = \\text{exp} \\left(- \\frac{U_{jk}}{RT} \\right) !! !! !! !! \\Theta_j = \\frac{Q_j \\displaystyle \\sum_{l}^{NC} n_l v_j^l} !! {\\displaystyle \\sum_{k}^{NC} n_k \\sum_{m}^{NG} v_m^l Q_m} !! !! !! !! \\Theta_j^i = \\frac{Q_j v_j^i}{\\displaystyle \\sum_k^{NG} v_k^i Q_k} !! !! !! In the UNIFAC model, the \\Theta_j^i values are calculated assuming !! that the molecule \"i\" is pure, hence only the subgroups of the molecule !! \"i\" must be considered for the calculation. On the other hand, for the !! \\Theta_j values, all the system's subgroups are considered. !! !! ##### The compositional derivatives: !! !! !! \\frac{1}{R T} \\frac{\\partial G^{E,R}}{\\partial n_\\alpha} = !! - \\sum_k^{\\mathrm{NG}} v_k^\\alpha Q_k \\left(\\Lambda_k - !! \\Lambda_k^\\alpha \\right) - \\sum_i^{\\mathrm{NC}} n_i !! \\sum_k^{\\mathrm{NG}} v_k^i Q_k !! \\frac{\\partial \\Lambda_k}{\\partial n_\\alpha} !! !! !! !! \\frac{1}{R T} \\frac{\\partial^2 G^{E,R}}{\\partial n_ !! \\alpha \\partial n_\\beta} = -\\sum_k^{\\mathrm{NG}} Q_k \\left(v_k^\\alpha !! \\frac{\\partial \\Lambda_k}{\\partial n_\\beta} + v_k^\\beta !! \\frac{\\partial \\Lambda_k}{\\partial n_\\alpha}\\right) !! - \\sum_k^{\\mathrm{NG}} \\left(\\sum_i^{\\mathrm{NC}} n_i v_k^i\\right) Q_k !! \\frac{\\partial^2 \\Lambda_k}{\\partial n_\\alpha \\partial n_\\beta} !! !! !! With: !! !! !! \\frac{\\partial \\Lambda_k}{\\partial n_\\alpha} !! = \\frac{\\sum_j^{\\mathrm{NG}} v_j^\\alpha Q_j E_{j k}} !! {\\sum_l^{\\mathrm{NC}} n_l \\sum_j^{\\mathrm{NG}} v_j^l Q_j !! E_{j k}} - \\frac{\\sum_m^{\\mathrm{NG}} v_m^\\alpha Q_m} !! {\\sum_l^{\\mathrm{NC}} n_l \\sum_m^{\\mathrm{NG}} v_m^l Q_m} !! !! !! !! \\frac{\\partial^2 \\Lambda_k}{\\partial n_\\alpha \\partial n_\\beta} !! = - \\frac{\\left(\\sum_j^{\\mathrm{NG}} v_j^\\alpha Q_j E_{j k}\\right) !! \\left(\\sum_j^{\\mathrm{NG}} v_j^\\beta Q_j E_{j k}\\right)} !! {\\left(\\sum_l^{\\mathrm{NC}} n_l \\sum_j^{\\mathrm{NG}} v_j^l Q_j !! E_{j k}\\right)^2} + \\frac{\\left(\\sum_m^{\\mathrm{NG}} v_m^\\alpha !! Q_m\\right)\\left(\\sum_m^{\\mathrm{NG}} v_m^\\beta Q_m\\right)} !! {\\left(\\sum_l^{\\mathrm{NC}} n_l !! \\sum_m^{\\mathrm{NG}} v_m^l Q_m\\right)^2} !! !! !! ##### The temperature derivatives: !! !! !! \\frac{\\partial\\left(\\frac{G^{E, R}}{R T}\\right)}{\\partial T} = !! -\\sum_i^{\\mathrm{NC}} n_i \\sum_k^{\\mathrm{NG}} v_k^i Q_k !! \\left(\\frac{\\partial \\Lambda_k}{\\partial T} !! -\\frac{\\partial \\Lambda_k^i}{\\partial T}\\right) !! !! !! !! \\frac{\\partial^2\\left(\\frac{G^{E,R}}{R T}\\right)}{\\partial T^2} = !! -\\sum_i^{\\mathrm{NC}} n_i \\sum_k^{\\mathrm{NG}} v_k^i Q_k !! \\left(\\frac{\\partial^2 \\Lambda_k}{\\partial T^2} - !! \\frac{\\partial^2 \\Lambda_k^i}{\\partial T^2}\\right) !! !! !! With: !! !! !! \\frac{\\partial \\Lambda_k}{\\partial T} = !! \\frac{\\sum_{j}^{NG} \\Theta_j \\frac{d E_{jk}}{dT}} !! {\\sum_{j}^{NG} \\Theta_j E_{jk}} !! !! !! !! \\frac{\\partial \\Lambda_k^i}{\\partial T} = !! \\frac{\\sum_{j}^{NG} \\Theta_j^i \\frac{d E_{jk}}{dT}} !! {\\sum_{j}^{NG} \\Theta_j^i E_{jk}} !! !! !! !! \\frac{\\partial^2 \\Lambda_k}{\\partial T^2} = !! \\frac{\\sum_{j}^{NG} \\Theta_j \\frac{d^2 E_{jk}}{dT^2}} !! {\\sum_{j}^{NG} \\Theta_j E_{jk}} !! - \\left(\\frac{\\partial \\Lambda_k}{\\partial T} \\right)^2 !! !! !! !! \\frac{\\partial^2 \\Lambda_k^i}{\\partial T^2} = !! \\frac{\\sum_{j}^{NG} \\Theta_j^i \\frac{d^2 E_{jk}}{dT^2}} !! {\\sum_{j}^{NG} \\Theta_j^i E_{jk}} !! - \\left(\\frac{\\partial \\Lambda_k^i}{\\partial T} \\right)^2 !! !! !! ##### Temperature-compositional cross derivative: !! !! !! \\frac{\\partial \\left(\\frac{G^{E, R}}{R T} \\right)} !! {\\partial n_\\alpha \\partial T}= !! -\\sum_k^{\\mathrm{NG}} v_k^\\alpha Q_k \\left(\\frac{\\partial \\Lambda_k} !! {\\partial T} - \\frac{\\partial \\Lambda_k^\\alpha}{\\partial T}\\right) !! -\\sum_k^{\\mathrm{NG}} \\left(\\sum_i^{\\mathrm{NC}} n_i v_k^i \\right) !! Q_k \\frac{\\partial^2 \\Lambda_k}{\\partial n_\\alpha \\partial T} !! !! !! With: !! !! !! \\frac{\\partial^2 \\Lambda_k}{\\partial n_\\alpha \\partial T} = !! \\frac{\\sum_j^{\\mathrm{NG}} v_j^\\alpha Q_j \\frac{\\partial !! \\tilde{E}_{j k}}{\\partial T}}{\\sum_l^{\\mathrm{NC}} n_l !! \\sum_j^{\\mathrm{NG}} v_j^l Q_j \\tilde{E}_{j k}} - !! \\frac{\\left(\\sum_j^{\\mathrm{NG}} v_j^\\alpha Q_j \\tilde{E}_{j k}\\right) !! \\left(\\sum_l^{\\mathrm{NC}} n_l \\sum_j^{\\mathrm{NG}} v_j^l Q_j !! \\frac{\\partial \\tilde{E}_{j k}}{\\partial T}\\right)} !! {\\left(\\sum_l^{\\mathrm{NC}} n_l !! \\sum_j^{\\mathrm{NG}} v_j^l Q_j \\tilde{E}_{j k}\\right)^2} !! !! !! # References !! 1. [SINTEF - Thermopack](https://github.com/thermotools/thermopack) class ( UNIFAC ) :: self real ( pr ), intent ( in ) :: n ( self % nmolecules ) !! Moles vector real ( pr ), intent ( in ) :: T !! Temperature [K] real ( pr ), optional , intent ( out ) :: Ge !! Residual Gibbs excess energy real ( pr ), optional , intent ( out ) :: dGe_dn ( self % nmolecules ) !! \\frac{\\partial G^{E,R}}{\\partial n} real ( pr ), optional , intent ( out ) :: dGe_dn2 ( self % nmolecules , self % nmolecules ) !! \\frac{\\partial^2 G^{E,R}}{\\partial n^2} real ( pr ), optional , intent ( out ) :: dGe_dT !! \\frac{\\partial G^{E,R}}{\\partial T} real ( pr ), optional , intent ( out ) :: dGe_dT2 !! \\frac{\\partial^2 G^{E,R}}{\\partial T^2} real ( pr ), optional , intent ( out ) :: dGe_dTn ( self % nmolecules ) !! \\frac{\\partial^2 G^{E,R}}{\\partial n \\partial T} ! Thetas variables real ( pr ) :: theta_j ( self % ngroups ) ! Ejk variables real ( pr ) :: Ejk ( self % ngroups , self % ngroups ) real ( pr ) :: dEjk_dt ( self % ngroups , self % ngroups ) real ( pr ) :: dEjk_dt2 ( self % ngroups , self % ngroups ) ! Lambdas variables real ( pr ) :: lambda_k ( self % ngroups ) real ( pr ) :: dlambda_k_dT ( self % ngroups ) real ( pr ) :: dlambda_k_dT2 ( self % ngroups ) real ( pr ) :: dlambda_k_dn ( self % nmolecules , self % ngroups ) real ( pr ) :: dlambda_k_dn2 ( self % nmolecules , self % nmolecules , self % ngroups ) real ( pr ) :: dlambda_k_dndT ( self % nmolecules , self % ngroups ) real ( pr ) :: lambda_ik ( self % nmolecules , self % ngroups ) real ( pr ) :: dlambda_ik_dT ( self % nmolecules , self % ngroups ) real ( pr ) :: dlambda_ik_dT2 ( self % nmolecules , self % ngroups ) ! Auxiliars real ( pr ) :: Ge_aux , dGe_dT_aux , dGe_dn_aux ( self % nmolecules ) real ( pr ) :: sum_vij_Qj_Ejk ( self % nmolecules , self % ngroups ) real ( pr ) :: sum_ni_vij_Qj_Ejk ( self % ngroups ) real ( pr ) :: sum_vik_Qk ( self % nmolecules ) real ( pr ) :: sum_vQ_Lambda ( self % nmolecules ) real ( pr ) :: sum_nl_vlj ( self % ngroups ) real ( pr ) :: sum_ni_vik_Qk real ( pr ) :: aux_sum ( self % nmolecules ) real ( pr ) :: sum_Q_v_dlambda_k_dn ( self % nmolecules , self % nmolecules ) real ( pr ) :: aux_sum2 real ( pr ) :: sum_vij_Qj_dEjk_dT ( self % nmolecules , self % ngroups ) real ( pr ) :: sum_vij_Qj_dEjk_dT2 ( self % nmolecules , self % ngroups ) real ( pr ) :: sum_ni_vij_Qj_dEjk_dT ( self % ngroups ) real ( pr ) :: sum_vij_Qj_dlambdas_dT ( self % nmolecules ) real ( pr ) :: sum_vij_Qj_dlambdas_dT2 ( self % nmolecules ) ! Indexes used for groups integer :: j , k ! Indexes used for components integer :: i , l ! logicals logical :: pge , dn , dn2 , dt , dt2 , dtn pge = present ( Ge ) dn = present ( dGe_dn ) dn2 = present ( dGe_dn2 ) dt = present ( dGe_dT ) dt2 = present ( dGe_dT2 ) dtn = present ( dGe_dTn ) ! ======================================================================== ! Ejk ! ------------------------------------------------------------------------ if (( dt . or . dtn ) . and . . not . dt2 ) then call self % psi_function % psi (& self % groups_stew , T , psi = Ejk , dpsi_dt = dEjk_dt & ) elseif ( dt2 . and . . not . ( dt . or . dtn )) then call self % psi_function % psi (& self % groups_stew , T , psi = Ejk , dpsi_dt2 = dEjk_dt2 & ) else call self % psi_function % psi (& self % groups_stew , T , psi = Ejk , dpsi_dt = dEjk_dt , dpsi_dt2 = dEjk_dt2 & ) end if ! ======================================================================== ! Auxiliars ! ------------------------------------------------------------------------ do i = 1 , self % nmolecules sum_vik_Qk ( i ) = sum ( self % vij ( i ,:) * self % qk ) end do sum_ni_vik_Qk = sum ( n * sum_vik_Qk ) if ( dtn . or . dt2 . or . dt ) then do concurrent ( i = 1 : self % nmolecules , k = 1 : self % ngroups ) sum_vij_Qj_dEjk_dT ( i , k ) = sum ( self % vij ( i ,:) * self % qk * dEjk_dT (:, k )) sum_vij_Qj_dEjk_dT2 ( i , k ) = sum ( self % vij ( i ,:) * self % qk * dEjk_dT2 (:, k )) end do end if ! ======================================================================== ! Thetas ! ------------------------------------------------------------------------ do j = 1 , self % ngroups sum_nl_vlj ( j ) = sum ( n * self % vij (:, j )) theta_j ( j ) = sum_nl_vlj ( j ) * self % qk ( j ) / sum_ni_vik_Qk end do ! ======================================================================== ! Lambda_k ! ------------------------------------------------------------------------ ! Lambda_k if ( pge . or . dn . or . dt . or . dtn ) then do k = 1 , self % ngroups lambda_k ( k ) = log ( sum ( theta_j * Ejk (:, k ))) end do end if ! Lambda_k first compositional derivatives if ( dn . or . dt . or . dt2 . or . dtn . or . dn2 ) then do concurrent ( i = 1 : self % nmolecules , k = 1 : self % ngroups ) sum_vij_Qj_Ejk ( i , k ) = sum ( self % vij ( i ,:) * self % qk * Ejk (:, k )) end do do k = 1 , self % ngroups sum_ni_vij_Qj_Ejk ( k ) = sum ( n * sum_vij_Qj_Ejk (:, k )) end do do i = 1 , self % nmolecules dlambda_k_dn ( i ,:) = sum_vij_Qj_Ejk ( i ,:) / sum_ni_vij_Qj_Ejk - sum_vik_Qk ( i ) / sum_ni_vik_Qk end do end if ! Lambda_k second compositional derivatives if ( dn2 ) then do concurrent ( i = 1 : self % nmolecules , l = 1 : self % nmolecules ) sum_Q_v_dlambda_k_dn ( i , l ) = sum ( self % qk * self % vij ( l ,:) * dlambda_k_dn ( i ,:)) dlambda_k_dn2 ( i , l ,:) = (& - sum_vij_Qj_Ejk ( i ,:) * sum_vij_Qj_Ejk ( l ,:) / sum_ni_vij_Qj_Ejk ** 2 & + sum_vik_Qk ( i ) * sum_vik_Qk ( l ) / sum_ni_vik_Qk ** 2 & ) end do end if ! Temperature derivatives if ( dt . or . dtn . or . dt2 ) then do k = 1 , self % ngroups sum_ni_vij_Qj_dEjk_dT ( k ) = sum ( n * sum_vij_Qj_dEjk_dT (:, k )) dlambda_k_dT ( k ) = sum ( theta_j * dEjk_dt (:, k )) / sum ( theta_j * Ejk (:, k )) dlambda_k_dT2 ( k ) = sum ( n * sum_vij_Qj_dEjk_dT2 (:, k )) / sum_ni_vij_Qj_Ejk ( k ) - dlambda_k_dT ( k ) ** 2 end do end if if ( dtn ) then do i = 1 , self % nmolecules dlambda_k_dndT ( i ,:) = (& sum_vij_Qj_dEjk_dT ( i ,:) / sum_ni_vij_Qj_Ejk & - sum_vij_Qj_Ejk ( i ,:) * sum_ni_vij_Qj_dEjk_dT / sum_ni_vij_Qj_Ejk ** 2 & ) end do end if ! ======================================================================== ! Lambda_ik ! ------------------------------------------------------------------------ if ( pge . or . dn . or . dt . or . dtn ) then lambda_ik = 0.0_pr do concurrent ( i = 1 : self % nmolecules , k = 1 : self % ngroups ) if ( self % vij ( i , k ) /= 0 ) then lambda_ik ( i , k ) = log ( sum ( self % thetas_ij ( i , :) * Ejk (:, k ))) end if end do end if ! Temperature derivatives if ( dt . or . dt2 . or . dtn ) then dlambda_ik_dT = 0.0_pr do concurrent ( i = 1 : self % nmolecules , k = 1 : self % ngroups ) if ( self % vij ( i , k ) /= 0 ) then dlambda_ik_dT ( i , k ) = sum ( self % thetas_ij ( i ,:) * dEjk_dt (:, k )) / sum ( self % thetas_ij ( i ,:) * Ejk (:, k )) end if end do if ( dt2 ) dlambda_ik_dT2 = sum_vij_Qj_dEjk_dT2 / sum_vij_Qj_Ejk - dlambda_ik_dT * dlambda_ik_dT end if ! ======================================================================== ! Ge ! ------------------------------------------------------------------------ if ( pge . or . dn . or . dt . or . dtn ) then do i = 1 , self % nmolecules sum_vQ_Lambda ( i ) = sum ( self % vij ( i ,:) * self % qk * ( lambda_k - lambda_ik ( i ,:))) end do Ge_aux = - sum ( n * sum_vQ_Lambda ) end if ! ======================================================================== ! dGe_dn ! ------------------------------------------------------------------------ if ( dn . or . dtn ) then do i = 1 , self % nmolecules aux_sum ( i ) = sum ( sum_nl_vlj * self % qk * dlambda_k_dn ( i ,:)) end do dGe_dn_aux = - sum_vQ_Lambda - aux_sum end if ! ======================================================================== ! dGe_dn2 ! ------------------------------------------------------------------------ if ( dn2 ) then do concurrent ( i = 1 : self % nmolecules , l = 1 : self % nmolecules ) aux_sum2 = sum ( sum_nl_vlj * dlambda_k_dn2 ( i , l ,:) * self % qk ) dGe_dn2 ( i , l ) = - ( sum_Q_v_dlambda_k_dn ( i , l ) + sum_Q_v_dlambda_k_dn ( l , i )) - aux_sum2 end do end if ! ======================================================================== ! dGe_dT, dGe_dT2, dGE_dnT ! ------------------------------------------------------------------------ if ( dt . or . dt2 . or . dtn ) then do i = 1 , self % nmolecules sum_vij_Qj_dlambdas_dT ( i ) = sum ( self % vij ( i ,:) * self % qk * ( dlambda_k_dT - dlambda_ik_dT ( i ,:))) end do dGe_dT_aux = - sum ( n * sum_vij_Qj_dlambdas_dT ) end if if ( dt2 ) then do i = 1 , self % nmolecules sum_vij_Qj_dlambdas_dT2 ( i ) = sum ( self % vij ( i ,:) * self % qk * ( dlambda_k_dT2 - dlambda_ik_dT2 ( i ,:))) end do dGe_dT2 = - sum ( n * sum_vij_Qj_dlambdas_dT2 ) end if if ( dtn ) then do i = 1 , self % nmolecules aux_sum ( i ) = sum ( sum_nl_vlj * self % qk * dlambda_k_dndT ( i ,:)) end do dGe_dTn = - sum_vij_Qj_dLambdas_dT - aux_sum end if ! ======================================================================== ! From reduced Ge to Ge ! ------------------------------------------------------------------------ if ( present ( Ge )) then Ge = Ge_aux * R * T end if if ( present ( dGe_dT )) then dGe_dT = R * ( Ge_aux + dGe_dT_aux * T ) end if if ( present ( dGe_dT2 )) then dGe_dT2 = R * ( 2.0 * dGe_dT_aux + T * dGe_dT2 ) end if if ( present ( dGe_dTn )) then dGe_dTn = R * ( dGe_dn_aux + dGe_dTn * T ) end if if ( present ( dGe_dn )) then dGe_dn = dGe_dn_aux * R * T end if if ( present ( dGe_dn2 )) then dGe_dn2 = dGe_dn2 * R * T end if end subroutine Ge_residual subroutine UNIFAC_temperature_dependence (& self , systems_groups , T , psi , dpsi_dt , dpsi_dt2 & ) !! # UNIFAC temperature dependence !! Implementation of the \\psi(T) function of the UNIFAC model. !! !! !! \\psi_{ij}(T) = \\exp(-\\frac{A_{ij}}{T}) !! !! !! !! \\frac{d \\psi_{ij}(T)}{dT} = \\frac{A_{ij}}{T^2} !! \\exp(-\\frac{A_{ij}}{T}) !! !! !! !! \\frac{d^2 \\psi_{ij}(T)}{dT^2} = !! \\frac{Aij (Aij - 2T)}{T^4} \\exp(-\\frac{A_{ij}}{T}) !! !! !! # References !! 1. [Dortmund Data Bank Software & Separation Technology](https://www.ddbst !! .com/published-parameters-unifac.html) !! 2. Fredenslund, A., Jones, R. L., & Prausnitz, J. M. (1975). !! Group‐contribution estimation of activity coefficients in nonideal liquid !! mixtures. AIChE Journal, 21(6), 1086–1099. !! [https://doi.org/10.1002/aic.690210607](https://doi.org/10.1002/aic.690210607) !! 3. Skjold-Jorgensen, S., Kolbe, B., Gmehling, J., & Rasmussen, P. (1979). !! Vapor-Liquid Equilibria by UNIFAC Group Contribution. Revision and !! Extension. Industrial & Engineering Chemistry Process Design and !! Development, 18(4), 714–722. !! [https://doi.org/10.1021/i260072a024](https://doi.org/10.1021/i260072a024) !! 4. Gmehling, J., Rasmussen, P., & Fredenslund, A. (1982). Vapor-liquid !! equilibriums by UNIFAC group contribution. Revision and extension. 2. !! Industrial & Engineering Chemistry Process Design and Development, 21(1), !! 118–127. !! [https://doi.org/10.1021/i200016a021](https://doi.org/10.1021/i200016a021) !! 5. Macedo, E. A., Weidlich, U., Gmehling, J., & Rasmussen, P. (1983). !! Vapor-liquid equilibriums by UNIFAC group contribution. Revision and !! extension. 3. Industrial & Engineering Chemistry Process Design and !! Development, 22(4), 676–678. !! [https://doi.org/10.1021/i200023a023](https://doi.org/10.1021/i200023a023) !! 6. Tiegs, D., Rasmussen, P., Gmehling, J., & Fredenslund, A. (1987). !! Vapor-liquid equilibria by UNIFAC group contribution. 4. Revision and !! extension. Industrial & Engineering Chemistry Research, 26(1), 159–161. !! [https://doi.org/10.1021/ie00061a030](https://doi.org/10.1021/ie00061a030) !! 7. Hansen, H. K., Rasmussen, P., Fredenslund, A., Schiller, M., & !! Gmehling, J. (1991). Vapor-liquid equilibria by UNIFAC group !! contribution. 5. Revision and extension. Industrial & Engineering !! Chemistry Research, 30 (10), 2352–2355. !! [https://doi.org/10.1021/ie00058a017](https://doi.org/10.1021/ie00058a017) !! 8. Wittig, R., Lohmann, J., & Gmehling, J. (2003). Vapor−Liquid Equilibria !! by UNIFAC Group Contribution. 6. Revision and Extension. Industrial & !! Engineering Chemistry Research, 42(1), 183–188. !! [https://doi.org/10.1021/ie020506l](https://doi.org/10.1021/ie020506l) !! 9. [SINTEF - Thermopack](https://github.com/thermotools/thermopack) !! class ( UNIFACPsi ) :: self !! \\psi function class ( Groups ) :: systems_groups !! Groups in the system real ( pr ), intent ( in ) :: T !! Temperature [K] real ( pr ), optional , intent ( out ) :: psi (:, :) !! \\psi real ( pr ), optional , intent ( out ) :: dpsi_dt (:, :) !! \\frac{d \\psi}{dT} real ( pr ), optional , intent ( out ) :: dpsi_dt2 (:, :) !! \\frac{d^2 \\psi}{dT^2} integer :: i , j integer :: ngroups real ( pr ) :: Aij real ( pr ) :: Eij ngroups = size ( systems_groups % groups_ids ) do concurrent ( i = 1 : ngroups , j = 1 : ngroups ) Aij = self % Aij ( i , j ) Eij = exp ( - Aij / T ) if ( present ( psi )) & psi ( i , j ) = Eij if ( present ( dpsi_dt )) & dpsi_dt ( i , j ) = Aij * Eij / T ** 2 if ( present ( dpsi_dt2 )) & dpsi_dt2 ( i , j ) = Aij * ( Aij - 2_pr * T ) * Eij / T ** 4 end do end subroutine UNIFAC_temperature_dependence function thetas_i ( nm , ng , parameters , stew , molecules ) result ( thetas_ij ) !! # \\Theta_i calculation !! Calculate the area fraciton of each froup on each molecule. !! !! # Description !! Calculate the area fraciton of each froup on each molecule. The values !! are obtained on the setup_unifac function and stored on the UNIFAC !! type, since the values can be reused (no compositional or temperature !! dependence) !! !! # References !! 1. [SINTEF - Thermopack](https://github.com/thermotools/thermopack) integer , intent ( in ) :: nm !! Number of molecules integer , intent ( in ) :: ng !! Number of groups type ( GeGCModelParameters ), intent ( in ) :: parameters !! UNIFAC parameters type ( Groups ), intent ( in ) :: stew !! All the groups present in the system type ( Groups ), intent ( in ) :: molecules (:) !! Molecules real ( pr ) :: thetas_ij ( nm , ng ) !! Group j area fraction on molecule i real ( pr ) :: total_area_i ( nm ) real ( pr ) :: qki_contribution integer :: gi integer :: i , j , k thetas_ij = 0.0_pr total_area_i = 0.0_pr ! Obtain the total area of each molecule do i = 1 , size ( molecules ) do k = 1 , size ( molecules ( i )% number_of_groups ) gi = molecules ( i )% groups_ids ( k ) ! Contribution of the group k to the molecule i area. qki_contribution = (& parameters % get_subgroup_Q ( gi ) * molecules ( i )% number_of_groups ( k )& ) ! Adding to the total area of each molecule total_area_i ( i ) = total_area_i ( i ) + qki_contribution end do end do ! Calculate the fraction of each group on each molecule thetas_ij = 0.0_pr do i = 1 , size ( molecules ) do k = 1 , size ( molecules ( i )% number_of_groups ) gi = molecules ( i )% groups_ids ( k ) j = findloc ( stew % groups_ids , gi , dim = 1 ) thetas_ij ( i , j ) = (& parameters % get_subgroup_Q ( gi ) & * molecules ( i )% number_of_groups ( k ) & / total_area_i ( i ) & ) end do end do end function thetas_i type ( UNIFAC ) function setup_unifac ( molecules , parameters ) !! # Setup UNIFAC !! Instantiate a UNIFAC model !! !! # Description !! Subroutine used to instantiate a UNIFAC model. !! !! # Examples !! !! ```fortran !! ! Instantiate an UNIFAC model with ethanol-water mix and calculate gammas !! use yaeos, only: pr, Groups, setup_unifac, UNIFAC !! !! type(UNIFAC) :: model !! type(Groups) :: molecules(2) !! real(pr) :: ln_gammas(2) !! !! ! Ethanol definition [CH3, CH2, OH] !! molecules(1)%groups_ids = [1, 2, 14] ! Subgroups ids !! molecules(1)%number_of_groups = [1, 1, 1] ! Subgroups occurrences !! !! ! Water definition [H2O] !! molecules(2)%groups_ids = [16] !! molecules(2)%number_of_groups = [1] !! !! ! Model setup !! model = setup_unifac(molecules) !! !! ! Calculate ln_gammas !! call model%ln_activity_coefficient([0.5_pr, 0.5_pr], 298.0_pr, ln_gammas) !! !! print *, ln_gammas ! result: 0.18534142000449058 0.40331395945417559 !! ``` !! !! # References !! 1. [Dortmund Data Bank Software & Separation Technology](https://www.ddbst !! .com/published-parameters-unifac.html) !! type ( Groups ), intent ( in ) :: molecules (:) !! Molecules (Group type) objects type ( GeGCModelParameters ), optional , intent ( in ) :: parameters !! UNIFAC parameters type ( Groups ) :: soup type ( UNIFACPsi ) :: psi_function ! UNIFAC parameters type ( GeGCModelParameters ) :: params ! Usefull matrixes to store integer , allocatable :: vij (:, :) real ( pr ), allocatable :: qks (:), Aij (:, :) integer :: gi , i , j , k setup_unifac % molecules = molecules allocate ( soup % groups_ids ( 0 )) allocate ( soup % number_of_groups ( 0 )) ! ======================================================================== ! Load default UNIFAC parameters if not provided ! ------------------------------------------------------------------------ if (. not . present ( parameters )) then params = UNIFACParameters () else params = parameters end if ! ======================================================================== ! Count all the individual groups and each molecule volume and area ! ------------------------------------------------------------------------ associate (& r => setup_unifac % molecules % volume , & q => setup_unifac % molecules % surface_area & ) ! Get all the groups indexes and counts into a single stew of groups. do i = 1 , size ( molecules ) r ( i ) = 0 q ( i ) = 0 do j = 1 , size ( molecules ( i )% groups_ids ) gi = molecules ( i )% groups_ids ( j ) ! Calculate molecule i volume and area r ( i ) = r ( i ) + molecules ( i )% number_of_groups ( j ) * params % get_subgroup_R ( gi ) q ( i ) = q ( i ) + molecules ( i )% number_of_groups ( j ) * params % get_subgroup_Q ( gi ) if ( all ( soup % groups_ids - gi /= 0 )) then ! Add group if it wasn't included yet soup % groups_ids = [ soup % groups_ids , gi ] soup % number_of_groups = [ soup % number_of_groups , 0 ] end if ! Find where is the group located in the main soup of ! groups. gi = findloc ( soup % groups_ids - gi , 0 , dim = 1 ) soup % number_of_groups ( gi ) = soup % number_of_groups ( gi ) & + molecules ( i )% number_of_groups ( j ) end do end do end associate ! ======================================================================== ! Build vij matrix (occurrence of each group of the soup on each molecule) ! ------------------------------------------------------------------------ allocate ( vij ( size ( molecules ), size ( soup % number_of_groups ))) vij = 0 do i = 1 , size ( molecules ) do k = 1 , size ( molecules ( i )% number_of_groups ) gi = molecules ( i )% groups_ids ( k ) ! Index of group for Area j = findloc ( soup % groups_ids , gi , dim = 1 ) vij ( i , j ) = molecules ( i )% number_of_groups ( k ) end do end do ! ======================================================================== ! Build qk vector (area of each group in the soup) ! ------------------------------------------------------------------------ allocate ( qks ( size ( soup % number_of_groups ))) qks = 0.0_pr do k = 1 , size ( soup % groups_ids ) qks ( k ) = params % get_subgroup_Q ( soup % groups_ids ( k )) end do ! ======================================================================== ! Build Aij matrix (interaction of the soup's subgroups) ! ------------------------------------------------------------------------ allocate ( Aij ( size ( soup % groups_ids ), size ( soup % groups_ids ))) Aij = 0.0_pr do i = 1 , size ( soup % groups_ids ) do j = 1 , size ( soup % groups_ids ) Aij ( i , j ) = params % get_subgroups_aij (& soup % groups_ids ( i ), soup % groups_ids ( j ) & ) end do end do ! ======================================================================== psi_function % Aij = Aij setup_unifac % groups_stew = soup setup_unifac % ngroups = size ( soup % number_of_groups ) setup_unifac % nmolecules = size ( molecules ) setup_unifac % psi_function = psi_function setup_unifac % group_area = params % subgroups_Qs setup_unifac % group_volume = params % subgroups_Rs setup_unifac % thetas_ij = thetas_i (& size ( molecules ), size ( soup % number_of_groups ), params , soup , molecules ) setup_unifac % vij = vij setup_unifac % qk = qks end function setup_unifac end module yaeos__models_ge_group_contribution_unifac","tags":"","loc":"sourcefile/unifac.f90.html"},{"title":"constants.f90 – yaeos","text":"Source Code module yaeos__constants !! Constants used on the whole package use iso_fortran_env , only : real32 , real64 , real128 implicit none integer , parameter :: pr = real64 !! Used precision real ( pr ), parameter :: R = 0.08314462618_pr !! Ideal Gas constant character ( len = 254 ) :: database_path = \"database\" !! Path to find database character ( len = 1 ) :: path_sep = \"/\" !! File separator (to preprocess on Win or Mac/linux) real ( pr ), parameter :: NOT_IMPLEMENTED = huge ( R ) end module","tags":"","loc":"sourcefile/constants.f90.html"},{"title":"implementations.f90 – yaeos","text":"Source Code module yaeos__models_ge_implementations use yaeos__models_ge_NRTL , only : NRTL use yaeos__models_ge_group_contribution_unifac , only : & Groups , setup_unifac , UNIFAC , excess_gibbs implicit none end module yaeos__models_ge_implementations","tags":"","loc":"sourcefile/implementations.f90.html"},{"title":"consistency_gemodel.f90 – yaeos","text":"Source Code module yaeos__consistency_gemodel !! # yaeos__consistency_gemodel !! Consistency checks of Helmholtz free energy models ([[GeModel]]). !! !! # Description !! This module contains tools to validate the analityc derivatives of !! implmented excess Gibbs free energy models ([[GeModel]]). Also, allows to !! evaluate the consistency tests described in Thermodynamic Models: !! Fundamentals & Computational Aspects 2 ed. by Michelsen and Mollerup !! Chapter 5 section 4. !! !! Available tools: !! !! - [[numeric_ge_derivatives]]: From an instantiated [[GeModel]] evaluate !! all the excess Gibbs free energy derivatives from the central finite !! difference method. !! !! - [[ge_consistency]]: From an instantiated GeModel evaluate all the !! Michelsen and Mollerup consistency tests !! !! # References !! 1. Michelsen, M. L., & Mollerup, J. M. (2007). Thermodynamic models: !! Fundamentals & computational aspects (2. ed). Tie-Line Publications. !! use yaeos__constants , only : pr , R use yaeos__models_ge , only : GeModel implicit none contains subroutine ge_consistency ( model , n , t , eq58 , eq59 , eq60 , eq61 ) !! # ge_consistency !! G^E models consistency tests !! !! # Description !! Evaluate the G^E models consistency tests described in !! Thermodynamic Models: Fundamentals & Computational Aspects 2 ed. by !! Michelsen and Mollerup (MM) Chapter 5 section 4. The \"eq\" are !! evaluations of the left hand side of the following expressions: !! !! Equation 58 !! !! !! \\sum_i^{NC} n_i \\text{ln} \\gamma_i - \\frac{G^E}{RT} = 0 !! !! !! Equation 59 !! !! !! \\text{ln} \\gamma_i - \\frac{1}{RT} !! \\frac{\\partial G^E}{\\partial n_i} = 0 !! !! !! Equation 60 !! !! !! \\frac{\\partial \\text{ln} \\gamma_i}{\\partial n_j} - !! \\frac{\\partial \\text{ln} \\gamma_j}{\\partial n_i} = 0 !! !! !! Equation 61 !! !! !! \\sum_i^{NC} n_i !! \\frac{\\partial \\text{ln} \\gamma_i}{\\partial n_j} = 0 !! !! !! # Examples !! !! ```fortran !! use yaeos, only: pr !! use yaeos, only: Groups, setup_unifac, UNIFAC !! use yaeos__consistency_gemodel, only: ge_consistency !! !! type(UNIFAC) :: model !! !! integer, parameter :: nc = 4, ng = 4 !! !! type(Groups) :: molecules(nc) !! !! real(pr) :: n(nc), T !! real(pr) :: dt, dn !! !! real(pr) :: eq58, eq59(nc), eq60(nc,nc), eq61(nc) !! !! T = 303.15 !! n = [400.0, 100.0, 300.0, 200.0] !! !! ! Hexane [CH3, CH2] !! molecules(1)%groups_ids = [1, 2] !! molecules(1)%number_of_groups = [2, 4] !! !! ! Ethanol [CH3, CH2, OH] !! molecules(2)%groups_ids = [1, 2, 14] !! molecules(2)%number_of_groups = [1, 1, 1] !! !! ! Toluene [ACH, ACCH3] !! molecules(3)%groups_ids = [9, 11] !! molecules(3)%number_of_groups = [5, 1] !! !! ! Cyclohexane [CH2] !! molecules(4)%groups_ids = [2] !! molecules(4)%number_of_groups = [6] !! !! model = setup_unifac(molecules) !! !! ! ==================================================================== !! ! Consistency tests !! ! -------------------------------------------------------------------- !! call ge_consistency(model, n, t, eq58, eq59, eq60, eq61) !! ``` !! !! # References !! 1. Michelsen, M. L., & Mollerup, J. M. (2007). Thermodynamic models: !! Fundamentals & computational aspects (2. ed). Tie-Line Publications. !! class ( GeModel ), intent ( in ) :: model !! G^E model real ( pr ), intent ( in ) :: n (:) !! Moles number vector real ( pr ), intent ( in ) :: t !! Temperature [K] real ( pr ), optional , intent ( out ) :: eq58 !! MM Eq. 58 real ( pr ), optional , intent ( out ) :: eq59 ( size ( n )) !! MM Eq. 59 real ( pr ), optional , intent ( out ) :: eq60 ( size ( n ), size ( n )) !! MM Eq. 60 real ( pr ), optional , intent ( out ) :: eq61 ( size ( n )) !! MM Eq. 61 real ( pr ) :: Ge , Gen ( size ( n )), Gen2 ( size ( n ), size ( n )) real ( pr ) :: ln_gammas ( size ( n )) integer i , j call model % excess_gibbs ( n , t , Ge = Ge , Gen = Gen , Gen2 = Gen2 ) call model % ln_activity_coefficient ( n , t , ln_gammas ) ! ======================================================================== ! Equation 58 ! ------------------------------------------------------------------------ if ( present ( eq58 )) then eq58 = sum ( n * ln_gammas ) - Ge / R / T end if ! ======================================================================== ! Equation 59 ! ------------------------------------------------------------------------ if ( present ( eq59 )) then eq59 = Gen / R / T - ln_gammas end if ! ======================================================================== ! Equation 60 ! ------------------------------------------------------------------------ if ( present ( eq60 )) then eq60 = 0.0_pr do i = 1 , size ( n ) do j = 1 , size ( n ) eq60 ( i , j ) = Gen2 ( i , j ) / R / T - Gen2 ( j , i ) / R / T end do end do end if ! ======================================================================== ! Equation 61 ! ------------------------------------------------------------------------ if ( present ( eq61 )) then eq61 = 0.0_pr do j = 1 , size ( n ) eq61 ( j ) = sum ( n * Gen2 (:, j ) / R / T ) end do end if end subroutine ge_consistency subroutine numeric_ge_derivatives (& model , n , t , d_n , d_t , Ge , GeT , Gen , GeT2 , GeTn , Gen2 & ) !! # numeric_ge_derivatives !! Numeric G^E model derivatives !! !! # Description !! Tool to facilitate the development of new [[GeModel]] by testing !! the implementation of analytic derivatives. !! !! # Examples !! !! ```fortran !! use yaeos, only: Groups, setup_unifac, UNIFAC !! use yaeos__consistency_gemodel, only: numeric_ge_derivatives !! !! type(UNIFAC) :: model !! !! integer, parameter :: nc = 4, ng = 4 !! !! type(Groups) :: molecules(nc) !! !! real(pr) :: Ge, Gen(nc), GeT, GeT2, GeTn(nc), Gen2(nc, nc) !! real(pr) :: Ge_n, Gen_n(nc), GeT_n, GeT2_n, GeTn_n(nc), Gen2_n(nc, nc) !! real(pr) :: ln_gammas(nc) !! !! real(pr) :: n(nc), T !! real(pr) :: dt, dn !! !! T = 303.15 !! n = [400.0, 100.0, 300.0, 200.0] ! always test with sum(n) > 1 !! !! dt = 0.1_pr !! dn = 0.1_pr !! !! ! Hexane [CH3, CH2] !! molecules(1)%groups_ids = [1, 2] !! molecules(1)%number_of_groups = [2, 4] !! !! ! Ethanol [CH3, CH2, OH] !! molecules(2)%groups_ids = [1, 2, 14] !! molecules(2)%number_of_groups = [1, 1, 1] !! !! ! Toluene [ACH, ACCH3] !! molecules(3)%groups_ids = [9, 11] !! molecules(3)%number_of_groups = [5, 1] !! !! ! Cyclohexane [CH2] !! molecules(4)%groups_ids = [2] !! molecules(4)%number_of_groups = [6] !! !! model = setup_unifac(molecules) !! !! ! ===================================================================== !! ! Call analytic derivatives !! ! --------------------------------------------------------------------- !! call model%excess_gibbs(n, T, Ge, GeT, GeT2, Gen, GeTn, Gen2) !! !! ! ===================================================================== !! ! Call numeric derivatives !! ! --------------------------------------------------------------------- !! call numeric_ge_derivatives(model, n, T, dn, dt, Ge=Ge_n, GeT=GeT_n) !! call numeric_ge_derivatives(model, n, T, dn, dt, Ge=Ge_n, Gen=Gen_n) !! call numeric_ge_derivatives(model, n, T, dn, dt, Ge=Ge_n, GeT2=GeT2_n) !! call numeric_ge_derivatives(model, n, T, dn, dt, Ge=Ge_n, GeTn=GeTn_n) !! call numeric_ge_derivatives(model, n, T, dn, dt, Ge=Ge_n, Gen2=Gen2_n) !! ``` !! class ( GeModel ), intent ( in ) :: model !! G^E model real ( pr ), intent ( in ) :: n (:) !! Moles number vector real ( pr ), intent ( in ) :: t !! Temperature [K] real ( pr ), intent ( in ) :: d_n !! Moles finite difference step real ( pr ), intent ( in ) :: d_t !! Temperature finite difference step real ( pr ), intent ( out ) :: Ge !! Residual Helmoltz energy real ( pr ), optional , intent ( out ) :: GeT !! \\frac{dGe}{dT} real ( pr ), optional , intent ( out ) :: Gen ( size ( n )) !! \\frac{dGe}{dn_i} real ( pr ), optional , intent ( out ) :: GeT2 !! \\frac{d^2Ge}{dT^2} real ( pr ), optional , intent ( out ) :: GeTn ( size ( n )) !! \\frac{d^2Ge}{dTdn_i} real ( pr ), optional , intent ( out ) :: Gen2 ( size ( n ), size ( n )) !! \\frac{d^2Ge}{dn_{ij}} ! Auxiliary real ( pr ) :: Ge_aux1 , Ge_aux2 , Ge_aux3 , Ge_aux4 real ( pr ) :: dn_aux1 ( size ( n )), dn_aux2 ( size ( n )) integer :: i , j ! ======================================================================== ! Ar valuations ! ------------------------------------------------------------------------ ! on point valuation call model % excess_gibbs ( n , t , Ge = Ge ) ! ======================================================================== ! Central numeric derivatives ! ------------------------------------------------------------------------ ! Temperature if ( present ( GeT ) . or . present ( GeT2 )) then call model % excess_gibbs ( n , t + d_t , Ge = Ge_aux1 ) call model % excess_gibbs ( n , t - d_t , Ge = Ge_aux2 ) if ( present ( GeT )) GeT = ( Ge_aux1 - Ge_aux2 ) / ( 2 * d_t ) if ( present ( GeT2 )) GeT2 = ( Ge_aux1 - 2 * Ge + Ge_aux2 ) / d_t ** 2 end if ! Mole first derivatives if ( present ( Gen )) then Gen = 0.0_pr do i = 1 , size ( n ), 1 dn_aux1 = 0.0_pr dn_aux1 ( i ) = d_n call model % excess_gibbs ( n + dn_aux1 , t , Ge = Ge_aux1 ) call model % excess_gibbs ( n - dn_aux1 , t , Ge = Ge_aux2 ) Gen ( i ) = ( Ge_aux1 - Ge_aux2 ) / ( 2 * d_n ) end do end if ! ======================================================================== ! Central cross derivatives ! ------------------------------------------------------------------------ ! Temperature - Mole if ( present ( GeTn )) then GeTn = 0.0_pr do i = 1 , size ( n ), 1 dn_aux1 = 0.0_pr dn_aux1 ( i ) = d_n call model % excess_gibbs ( n + dn_aux1 , t + d_t , Ge = Ge_aux1 ) call model % excess_gibbs ( n + dn_aux1 , t - d_t , Ge = Ge_aux2 ) call model % excess_gibbs ( n - dn_aux1 , t + d_t , Ge = Ge_aux3 ) call model % excess_gibbs ( n - dn_aux1 , t - d_t , Ge = Ge_aux4 ) GeTn ( i ) = & ( Ge_aux1 - Ge_aux2 - Ge_aux3 + Ge_aux4 ) / ( 4 * d_t * d_n ) end do end if ! Mole second derivatives if ( present ( Gen2 )) then Gen2 = 0.0_pr do i = 1 , size ( n ), 1 do j = 1 , size ( n ), 1 if ( i . eq . j ) then dn_aux1 = 0.0_pr dn_aux1 ( i ) = d_n call model % excess_gibbs ( n + dn_aux1 , t , Ge = Ge_aux1 ) call model % excess_gibbs ( n - dn_aux1 , t , Ge = Ge_aux2 ) Gen2 ( i , j ) = ( Ge_aux1 - 2 * Ge + Ge_aux2 ) / d_n ** 2 else dn_aux1 = 0.0_pr dn_aux2 = 0.0_pr dn_aux1 ( i ) = d_n dn_aux2 ( j ) = d_n call model % excess_gibbs ( n + dn_aux1 + dn_aux2 , t , Ge = Ge_aux1 ) call model % excess_gibbs ( n + dn_aux1 - dn_aux2 , t , Ge = Ge_aux2 ) call model % excess_gibbs ( n - dn_aux1 + dn_aux2 , t , Ge = Ge_aux3 ) call model % excess_gibbs ( n - dn_aux1 - dn_aux2 , t , Ge = Ge_aux4 ) Gen2 ( i , j ) = & ( Ge_aux1 - Ge_aux2 - Ge_aux3 + Ge_aux4 ) / ( 4 * d_n ** 2 ) end if end do end do end if end subroutine numeric_ge_derivatives end module yaeos__consistency_gemodel","tags":"","loc":"sourcefile/consistency_gemodel.f90.html"},{"title":"autodiff.f90 – yaeos","text":"Source Code module yaeos__autodiff !! This module holds the diferent ways of automatic differentiation use hyperdual_mod use yaeos__adiff_hyperdual_ar_api , only : ArModelAdiff implicit none end module","tags":"","loc":"sourcefile/autodiff.f90.html"},{"title":"rachford_rice.f90 – yaeos","text":"Source Code module yaeos__equilibria_rachford_rice use yaeos__constants , only : pr implicit none contains subroutine betato01 ( z , K ) !! Modify K-factor values to assure that \\beta lies between (0,1) implicit none real ( pr ), intent ( in ) :: z (:) !! Molar fractions of the system real ( pr ) :: K (:) !! K factors \\frac{y_i}{x_i} real ( pr ) :: g0 , g1 ! function g valuated at beta=0 and 1, based on K factors g1 = 1.0 do while ( g0 < 0 . or . g1 > 0 ) if (& any ( isnan ([ g0 , g1 ])) & . or . all ( K == 0 ) & . or . maxval ( abs ( K - 1 )) < 0.01_pr ) exit g0 = sum ( z * K ) - 1._pr g1 = 1._pr - sum ( z / K ) if ( g0 < 0 ) then ! Increased volatiliy will bring the solution from ! subcooled liquid into VLE K = 1.1_pr * K else if ( g1 > 0 ) then ! Decreased volatiliy will bring the solution from ! superheated vapor into VLE K = 0.9_pr * K end if end do end subroutine betato01 subroutine betalimits ( z , K , bmin , bmax ) !! Define beta limits to avoid overshooting when solving the Rachford-Rice !! equation. !! !! This is based on the assumtion that either y_i < 1 and x_i < 1. real ( pr ), intent ( in ) :: z (:) !! Molar fractions vector real ( pr ), intent ( in ) :: K (:) !! K-factors real ( pr ), intent ( out ) :: bmin !! Minimum beta value real ( pr ), intent ( out ) :: bmax !! Maximum beta value real ( pr ), dimension ( size ( z )) :: vmin , vmax vmin = 0.d0 ! max=1.001d0 ! modified 3/3/15 (not to generate false separations with beta 0.9999...) vmax = 1.00001_pr ! modified 28/6/15 (to prevent overshooting in the Newton for solving RR eq.) where ( K * z > 1 ) vmin = ( K * z - 1._pr ) / ( K - 1._pr ) elsewhere ( K < z ) vmax = ( 1 - z ) / ( 1 - K ) end where bmin = maxval ( vmin ) bmax = minval ( vmax ) end subroutine betalimits subroutine rachford_rice ( z , K , beta , rr , drrdb ) !! Rachford-Rice equation for a two phase system real ( pr ), intent ( in ) :: z (:) real ( pr ), intent ( in ) :: K (:) real ( pr ), intent ( in ) :: beta real ( pr ), intent ( out ) :: rr real ( pr ), intent ( out ) :: drrdb real ( pr ) :: denom ( size ( z )) denom = 1 + beta * ( K - 1._pr ) rr = sum ( z * ( K - 1._pr ) / denom ) drrdb = - sum ( z * ( K - 1._pr ) ** 2 / denom ** 2 ) end subroutine rachford_rice subroutine solve_rr ( z , K , beta , beta_min , beta_max ) !! Solve the Rachford-Rice Equation. real ( pr ), intent ( in ) :: z (:) !! Mole fractions vector real ( pr ), intent ( in ) :: K (:) !! K-factors real ( pr ), intent ( out ) :: beta_min !! Lower limit for \\beta real ( pr ), intent ( out ) :: beta_max !! Upper limit for \\beta real ( pr ), intent ( out ) :: beta !! \\beta value real ( pr ) :: g , dgdb real ( pr ) :: step g = 1.0 step = 1.0 call betalimits ( z , k , beta_min , beta_max ) do while ( abs ( g ) > 1.d-5 . and . abs ( step ) > 1.d-10 ) call rachford_rice ( z , k , beta , g , dgdb ) step = - g / dgdb beta = beta + step do while (( beta < beta_min . or . beta_max < beta ) . and . abs ( step ) > 1e-10 ) step = step / 2 beta = beta - step end do end do end subroutine solve_rr end module yaeos__equilibria_rachford_rice","tags":"","loc":"sourcefile/rachford_rice.f90.html"},{"title":"legacy.f90 – yaeos","text":"Source Code module legacy_ar_models !! Legacy Thermodynamic routines !! Module for a cubic eos system, made with the intention to keep !! compatiblity with legacy codes but with a better structure. !! this should be later adapted into a simple oop system where an eos object !! stores the relevant parameters (or some functional oriented approach) use yaeos__constants , only : pr , R use ar_interface , only : ar_fun , vinit implicit none ! Model settings integer :: thermo_model !! Which thermodynamic model to use integer :: tdep !! Temperature dependance of kij integer :: mixing_rule !! What mixing rule to use integer :: nc !! Number of components ! Mole fractions real ( pr ), allocatable :: z (:) !! Mole fractions vector ! ========================================================================== ! Cubic EoS Possible parameters ! -------------------------------------------------------------------------- ! Critical constants real ( pr ), allocatable :: tc (:) !! Critical temperature [K] real ( pr ), allocatable :: pc (:) !! Critical pressure [bar] real ( pr ), allocatable :: dc (:) !! Critical density [mol/L] real ( pr ), allocatable :: w (:) !! Acentric factor ! Model parameters real ( pr ), allocatable :: ac (:) !! Critical attractive parameter [bar (L/mol)^2] real ( pr ), allocatable :: b (:) !! repulsive parameter [L] real ( pr ), allocatable :: del1 (:) !! \\delta_1 parameter real ( pr ), allocatable :: k (:) !! Attractive parameter constant ! Classic VdW mixing rules parameters real ( pr ), allocatable :: kij (:, :) !! Attractive BIP real ( pr ), allocatable :: lij (:, :) !! Repulsive BIP real ( pr ), allocatable :: bij (:, :) ! T dependant mixing rule parameters real ( pr ), allocatable :: kij0 (:, :), kinf (:, :), tstar (:, :) ! ========================================================================== contains ! ========================================================================== ! Initializer routines ! -------------------------------------------------------------------------- subroutine setup ( n , nmodel , ntdep , ncomb ) !! Setup the basics variables that describe the model. ! TODO: With a more integrated legacy code maybe this can be ! avoided or at least better set up integer , intent ( in ) :: n !! Number of components integer , intent ( in ) :: nmodel !! Number of model integer , intent ( in ) :: ntdep !! Kij dependant of temperature integer , intent ( in ) :: ncomb !! Combining rule thermo_model = nmodel tdep = ntdep mixing_rule = ncomb nc = n if ( allocated ( tc )) deallocate ( tc ) if ( allocated ( pc )) deallocate ( pc ) if ( allocated ( dc )) deallocate ( dc ) if ( allocated ( w )) deallocate ( w ) if ( allocated ( ac )) deallocate ( ac ) if ( allocated ( b )) deallocate ( b ) if ( allocated ( del1 )) deallocate ( del1 ) if ( allocated ( k )) deallocate ( k ) if ( allocated ( kij )) deallocate ( kij ) if ( allocated ( lij )) deallocate ( lij ) if ( allocated ( kinf )) deallocate ( kinf ) if ( allocated ( tstar )) deallocate ( tstar ) if ( allocated ( bij )) deallocate ( bij ) allocate ( tc ( n )) allocate ( pc ( n )) allocate ( dc ( n )) allocate ( w ( n )) allocate ( ac ( n )) allocate ( b ( n )) allocate ( del1 ( n )) allocate ( k ( n )) allocate ( kij ( n , n )) allocate ( lij ( n , n )) allocate ( kinf ( n , n )) allocate ( tstar ( n , n )) allocate ( bij ( n , n )) end subroutine setup subroutine PR78_factory ( moles_in , ac_in , b_in , tc_in , pc_in , w_in , k_in ) !! PengRobinson 78 factory !! !! Takes either the critical parameters or the fitted model parameters !! and gets ones in base of the others real ( pr ), intent ( in ) :: moles_in ( nc ) real ( pr ), optional , intent ( in ) :: ac_in ( nc ) real ( pr ), optional , intent ( in ) :: b_in ( nc ) real ( pr ), optional , intent ( in ) :: tc_in ( nc ) real ( pr ), optional , intent ( in ) :: pc_in ( nc ) real ( pr ), optional , intent ( in ) :: w_in ( nc ) real ( pr ), optional , intent ( in ) :: k_in ( nc ) integer :: i logical :: params_spec , critical_spec real ( pr ) :: zc ( nc ), oma ( nc ), omb ( nc ) real ( pr ) :: vceos ( nc ), al , be , ga ( nc ) real ( pr ) :: RTc ( nc ) ar_fun => ar_srkpr vinit => cubic_v0 del1 = 1 + sqrt ( 2.0_pr ) z = moles_in params_spec = ( present ( ac_in ) . and . present ( b_in ) . and . present ( k_in )) critical_spec = ( present ( tc_in ) . and . present ( pc_in ) . and . present ( w_in )) if ( params_spec ) then ac = ac_in b = b_in k = k_in call get_Zc_OMa_OMb ( del1 , zc , oma , omb ) Tc = OMb * ac / ( OMa * R * b ) RTc = R * Tc Pc = OMb * RTc / b Vceos = Zc * RTc / Pc al = - 0.26992 be = 1.54226 ga = 0.37464 - k w = 0.5 * ( - be + sqrt ( be ** 2 - 4 * al * ga )) / al else if ( critical_spec ) then tc = tc_in pc = pc_in w = w_in RTc = R * Tc call get_Zc_OMa_OMb ( del1 , Zc , OMa , OMb ) ac = OMa * RTc ** 2 / Pc b = OMb * RTc / Pc Vceos = Zc * RTc / Pc ! k (or m) constant to calculate attractive parameter depending on temperature do i = 1 , nc if ( w ( i ) <= 0.491 ) then ! m from PR k ( i ) = 0.37464 + 1.54226 * w ( i ) - 0.26992 * w ( i ) ** 2 else ! PR78 k ( i ) = 0.379642 + 1.48503 * w ( i ) - 0.164423 * w ( i ) ** 2 + 0.016666 * w ( i ) ** 3 end if end do end if end subroutine subroutine PR76_factory ( moles_in , ac_in , b_in , tc_in , pc_in , w_in , k_in ) !! PengRobinson 76 factory !! !! Takes either the critical parameters or the fitted model parameters !! and gets ones in base of the others real ( pr ), intent ( in ) :: moles_in ( nc ) real ( pr ), optional , intent ( in ) :: ac_in ( nc ) real ( pr ), optional , intent ( in ) :: b_in ( nc ) real ( pr ), optional , intent ( in ) :: tc_in ( nc ) real ( pr ), optional , intent ( in ) :: pc_in ( nc ) real ( pr ), optional , intent ( in ) :: w_in ( nc ) real ( pr ), optional , intent ( in ) :: k_in ( nc ) integer :: i logical :: params_spec , critical_spec real ( pr ) :: zc ( nc ), oma ( nc ), omb ( nc ) real ( pr ) :: vceos ( nc ), al , be , ga ( nc ) real ( pr ) :: RTc ( nc ) ar_fun => ar_srkpr vinit => cubic_v0 del1 = 1 + sqrt ( 2.0_pr ) z = moles_in params_spec = ( present ( ac_in ) . and . present ( b_in ) . and . present ( k_in )) critical_spec = ( present ( tc_in ) . and . present ( pc_in ) . and . present ( w_in )) if ( params_spec ) then ac = ac_in b = b_in k = k_in call get_Zc_OMa_OMb ( del1 , zc , oma , omb ) Tc = OMb * ac / ( OMa * R * b ) RTc = R * Tc Pc = OMb * RTc / b Vceos = Zc * RTc / Pc al = - 0.26992 be = 1.54226 ga = 0.37464 - k w = 0.5 * ( - be + sqrt ( be ** 2 - 4 * al * ga )) / al else if ( critical_spec ) then tc = tc_in pc = pc_in w = w_in RTc = R * Tc call get_Zc_OMa_OMb ( del1 , Zc , OMa , OMb ) ac = OMa * RTc ** 2 / Pc b = OMb * RTc / Pc Vceos = Zc * RTc / Pc ! k (or m) constant to calculate attractive parameter depending on temperature do i = 1 , nc k ( i ) = 0.37464 + 1.54226 * w ( i ) - 0.26992 * w ( i ) ** 2 end do end if ! ac = 0.45723553_pr * R**2 * tc**2 / pc ! b = 0.07779607_pr * R * tc/pc ! k = 0.37464_pr + 1.54226_pr * w - 0.26993_pr * w**2 end subroutine subroutine SRK_factory ( moles_in , ac_in , b_in , tc_in , pc_in , w_in , k_in ) !! SoaveRedlichKwong factory !! !! Takes either the critical parameters or the fitted model parameters !! and gets ones in base of the others real ( pr ), intent ( in ) :: moles_in ( nc ) real ( pr ), optional , intent ( in ) :: ac_in ( nc ) real ( pr ), optional , intent ( in ) :: b_in ( nc ) real ( pr ), optional , intent ( in ) :: tc_in ( nc ) real ( pr ), optional , intent ( in ) :: pc_in ( nc ) real ( pr ), optional , intent ( in ) :: w_in ( nc ) real ( pr ), optional , intent ( in ) :: k_in ( nc ) logical :: params_spec , critical_spec real ( pr ) :: zc ( nc ), oma ( nc ), omb ( nc ) real ( pr ) :: vceos ( nc ), al , be , ga ( nc ) real ( pr ) :: RTc ( nc ) integer :: i , j ar_fun => ar_srkpr vinit => cubic_v0 del1 = 1 z = moles_in params_spec = ( present ( ac_in ) . and . present ( b_in ) . and . present ( k_in )) critical_spec = ( present ( tc_in ) . and . present ( pc_in ) . and . present ( w_in )) if ( params_spec ) then ac = ac_in b = b_in k = k_in call get_Zc_OMa_OMb ( del1 , zc , oma , omb ) Tc = OMb * ac / ( OMa * R * b ) RTc = R * Tc Pc = OMb * RTc / b Vceos = Zc * RTc / Pc dc = 1 / vceos al = - 0.26992 be = 1.54226 ga = 0.37464 - k w = 0.5 * ( - be + sqrt ( be ** 2 - 4 * al * ga )) / al else if ( critical_spec ) then tc = tc_in pc = pc_in w = w_in RTc = R * Tc call get_Zc_OMa_OMb ( del1 , Zc , OMa , OMb ) ac = OMa * RTc ** 2 / Pc b = OMb * RTc / Pc Vceos = Zc * RTc / Pc k = 0.48 + 1.574 * w - 0.175 * w ** 2 end if end subroutine subroutine get_Zc_OMa_OMb ( del1 , Zc , OMa , OMb ) !! Calculate Zc, OMa and OMb from the delta_1 parameter. real ( pr ), intent ( in ) :: del1 (:) !! delta_1 parameter real ( pr ), intent ( out ) :: Zc (:) !! Critical compressibility factor real ( pr ), intent ( out ) :: OMa (:) !! OMa real ( pr ), intent ( out ) :: OMb (:) !! OMb real ( pr ) :: d1 ( size ( del1 )), y ( size ( del1 )) d1 = ( 1._pr + del1 ** 2._pr ) / ( 1._pr + del1 ) y = 1._pr + ( 2._pr * ( 1._pr + del1 )) ** ( 1.0_pr / 3._pr ) + ( 4._pr / ( 1._pr + del1 )) ** ( 1.0_pr / 3 ) OMa = ( 3._pr * y * y + 3._pr * y * d1 + d1 ** 2._pr + d1 - 1.0_pr ) / ( 3._pr * y + d1 - 1.0_pr ) ** 2._pr OMb = 1._pr / ( 3._pr * y + d1 - 1.0_pr ) Zc = y / ( 3._pr * y + d1 - 1.0_pr ) end subroutine get_Zc_OMa_OMb ! ========================================================================== ! ========================================================================== ! Ar Functions ! -------------------------------------------------------------------------- subroutine ar_srkpr ( z , V , T , Ar , ArV , ArTV , ArV2 , Arn , ArVn , ArTn , Arn2 ) !! Wrapper subroutine to the SRK/PR Residula Helmholtz function to !! use the general interface real ( pr ), intent ( in ) :: z (:) !! Number of moles real ( pr ), intent ( in ) :: v !! Volume [L] real ( pr ), intent ( in ) :: t !! Temperature [K] real ( pr ), intent ( out ) :: ar !! Residual Helmholtz real ( pr ), intent ( out ) :: arv !! dAr/dV real ( pr ), intent ( out ) :: artv !! dAr2/dTV real ( pr ), intent ( out ) :: arv2 !! dAr2/dV2 real ( pr ), intent ( out ) :: Arn ( size ( z )) !! dAr/dn real ( pr ), intent ( out ) :: ArVn ( size ( z )) !! dAr2/dVn real ( pr ), intent ( out ) :: ArTn ( size ( z )) !! dAr2/dTn real ( pr ), intent ( out ) :: Arn2 ( size ( z ), size ( z )) !! dAr2/dn2 integer :: nd !! Compositional derivatives integer :: nt !! Temperature derivatives nd = 2 nt = 1 call HelmSRKPR ( size ( z ), nd , nt , z , V , T , Ar , ArV , ArTV , ArV2 , Arn , ArVn , ArTn , Arn2 ) end subroutine subroutine ar_rkpr ( z , V , T , Ar , ArV , ArTV , ArV2 , Arn , ArVn , ArTn , Arn2 ) real ( pr ), intent ( in ) :: z (:) !! Number of moles real ( pr ), intent ( in ) :: v !! Volume [L] real ( pr ), intent ( in ) :: t !! Temperature [K] real ( pr ), intent ( out ) :: ar !! Residual Helmholtz real ( pr ), intent ( out ) :: arv !! dAr/dV real ( pr ), intent ( out ) :: artv !! dAr2/dTV real ( pr ), intent ( out ) :: arv2 !! dAr2/dV2 real ( pr ), intent ( out ) :: Arn ( size ( z )) !! dAr/dn real ( pr ), intent ( out ) :: ArVn ( size ( z )) !! dAr2/dVn real ( pr ), intent ( out ) :: ArTn ( size ( z )) !! dAr2/dTn real ( pr ), intent ( out ) :: Arn2 ( size ( z ), size ( z )) !! dAr2/dn2 integer :: nd !! Compositional derivatives integer :: nt !! Temperature derivatives nd = 2 nt = 1 call HelmRKPR ( size ( z ), nd , nt , z , V , T , Ar , ArV , ArTV , ArV2 , Arn , ArVn , ArTn , Arn2 ) end subroutine subroutine HelmSRKPR ( nc , ND , NT , rn , V , T , Ar , ArV , ArTV , ArV2 , Arn , ArVn , ArTn , Arn2 ) integer , intent ( in ) :: nc !! Number of components integer , intent ( in ) :: nd !! Compositional derivatives integer , intent ( in ) :: nt !! Temperature derivatives real ( pr ), intent ( in ) :: v !! Volume [L] real ( pr ), intent ( in ) :: t !! Temperature [K] real ( pr ), intent ( in ) :: rn ( nc ) !! Number of moles real ( pr ), intent ( out ) :: ar !! Residual Helmholtz real ( pr ), intent ( out ) :: arv !! dAr/dV real ( pr ), intent ( out ) :: artv !! dAr2/dTV real ( pr ), intent ( out ) :: arv2 !! dAr2/dV2 real ( pr ), intent ( out ) :: Arn ( nc ) !! dAr/dn real ( pr ), intent ( out ) :: ArVn ( nc ) !! dAr2/dVn real ( pr ), intent ( out ) :: ArTn ( nc ) !! dAr2/dTn real ( pr ), intent ( out ) :: Arn2 ( nc , nc ) !! dAr2/dn2 real ( pr ) :: ArT , ArTT real ( pr ) :: Bmix , dBi ( nc ), dBij ( nc , nc ) real ( pr ) :: D , dDi ( nc ), dDij ( nc , nc ), dDiT ( nc ), dDdT , dDdT2 real ( pr ) :: totn , d1 , d2 real ( pr ) :: f , g , fv , fB , gv , fv2 , gv2 , AUX , FFB , FFBV , FFBB integer :: i , j real ( pr ) :: b_v , a TOTN = sum ( rn ) D1 = del1 ( 1 ) D2 = ( 1._pr - D1 ) / ( 1._pr + D1 ) if ( mixing_rule . lt . 2 ) then call Bnder ( nc , rn , Bmix , dBi , dBij ) call DandTnder ( NT , nc , T , rn , D , dDi , dDiT , dDij , dDdT , dDdT2 ) end if ! The f's and g's used here are for Ar, not F (reduced Ar) ! This requires to multiply by R all g, f and its derivatives as defined by Mollerup f = log (( V + D1 * Bmix ) / ( V + D2 * Bmix )) / Bmix / ( D1 - D2 ) g = R * log ( 1 - Bmix / V ) fv = - 1 / (( V + D1 * Bmix ) * ( V + D2 * Bmix )) fB = - ( f + V * fv ) / Bmix gv = R * Bmix / ( V * ( V - Bmix )) fv2 = ( - 1 / ( V + D1 * Bmix ) ** 2 + 1 / ( V + D2 * Bmix ) ** 2 ) / Bmix / ( D1 - D2 ) gv2 = R * ( 1 / V ** 2 - 1 / ( V - Bmix ) ** 2 ) ! Reduced Helmholtz Energy and derivatives Ar = - TOTN * g * T - D * f ArV = - TOTN * gv * T - D * fv ArV2 = - TOTN * gv2 * T - D * fv2 AUX = R * T / ( V - Bmix ) FFB = TOTN * AUX - D * fB FFBV = - TOTN * AUX / ( V - Bmix ) + D * ( 2 * fv + V * fv2 ) / Bmix FFBB = TOTN * AUX / ( V - Bmix ) - D * ( 2 * f + 4 * V * fv + V ** 2 * fv2 ) / Bmix ** 2 do i = 1 , nc Arn ( i ) = - g * T + FFB * dBi ( i ) - f * dDi ( i ) ArVn ( i ) = - gv * T + FFBV * dBi ( i ) - fv * dDi ( i ) if ( ND . eq . 2 ) then do j = 1 , i Arn2 ( i , j ) = AUX * ( dBi ( i ) + dBi ( j )) - fB * ( dBi ( i ) * dDi ( j ) + dBi ( j ) * dDi ( i )) & + FFB * dBij ( i , j ) + FFBB * dBi ( i ) * dBi ( j ) - f * dDij ( i , j ) Arn2 ( j , i ) = Arn2 ( i , j ) end do end if end do ! TEMPERATURE DERIVATIVES if ( NT . eq . 1 ) then ArT = - TOTN * g - dDdT * f ArTV = - TOTN * gv - dDdT * fV ArTT = - dDdT2 * f do i = 1 , nc ArTn ( i ) = - g + ( TOTN * AUX / T - dDdT * fB ) * dBi ( i ) - f * dDiT ( i ) end do end if end subroutine HelmSRKPR subroutine HelmRKPR ( nco , NDE , NTD , rn , V , T , Ar , ArV , ArTV , ArV2 , Arn , ArVn , ArTn , Arn2 ) !! Calculate the reduced residual Helmholtz Energy and it's derivatives with the RKPR EOS integer , intent ( in ) :: nco integer , intent ( in ) :: NDE integer , intent ( in ) :: NTD real ( pr ), intent ( in ) :: rn ( nco ) real ( pr ), intent ( in ) :: V real ( pr ), intent ( in ) :: T real ( pr ), intent ( out ) :: Ar , ArV , ArTV , ArV2 real ( pr ), intent ( out ) :: Arn ( nco ), ArVn ( nco ), ArTn ( nco ), Arn2 ( nco , nco ) real ( pr ) :: totn real ( pr ) :: Bmix , dBi ( nco ), dBij ( nco , nco ), dD1i ( nco ), dD1ij ( nco , nco ) real ( pr ) :: D , dDi ( nco ), dDij ( nco , nco ), dDiT ( nco ), dDdT , dDdT2 real ( pr ) :: D1 , D2 ! Auxiliar functions for Ar real ( pr ) :: f , g , fv , fB , gv , fv2 , gv2 , AUX , FFB , FFBV , FFBB ! Extra auxiliar functions for RKPR real ( pr ) :: auxD2 , fD1 , fBD1 , fVD1 , fD1D1 real ( pr ) :: ArT , ArTT integer :: i , j nc = nco TOTN = sum ( rn ) call DELTAnder ( nc , rn , D1 , dD1i , dD1ij ) D2 = ( 1 - D1 ) / ( 1 + D1 ) if ( mixing_rule . lt . 2 ) then call Bnder ( nc , rn , Bmix , dBi , dBij ) call DandTnder ( NTD , nc , T , rn , D , dDi , dDiT , dDij , dDdT , dDdT2 ) else ! call Bcubicnder(nc,rn,Bmix,dBi,dBij) ! call DCubicandTnder(NTD,nc,T,rn,D,dDi,dDiT,dDij,dDdT,dDdT2) end if ! The f's and g's used here are for Ar, not F (reduced Ar) ! This requires to multiply by R all g, f and its derivatives as defined by Mollerup f = log (( V + D1 * Bmix ) / ( V + D2 * Bmix )) / Bmix / ( D1 - D2 ) g = R * log ( 1 - Bmix / V ) fv = - 1 / (( V + D1 * Bmix ) * ( V + D2 * Bmix )) fB = - ( f + V * fv ) / Bmix gv = R * Bmix / ( V * ( V - Bmix )) fv2 = ( - 1 / ( V + D1 * Bmix ) ** 2 + 1 / ( V + D2 * Bmix ) ** 2 ) / Bmix / ( D1 - D2 ) gv2 = R * ( 1 / V ** 2 - 1 / ( V - Bmix ) ** 2 ) ! DERIVATIVES OF f WITH RESPECT TO DELTA1 auxD2 = ( 1 + 2 / ( 1 + D1 ) ** 2 ) fD1 = ( 1 / ( V + D1 * Bmix ) + 2 / ( V + D2 * Bmix ) / ( 1 + D1 ) ** 2 ) - f * auxD2 fD1 = fD1 / ( D1 - D2 ) fBD1 = - ( fB * auxD2 + D1 / ( V + D1 * Bmix ) ** 2 + 2 * D2 / ( V + D2 * Bmix ) ** 2 / ( 1 + D1 ) ** 2 ) fBD1 = fBD1 / ( D1 - D2 ) fVD1 = - ( fV * auxD2 + 1 / ( V + D1 * Bmix ) ** 2 + 2 / ( V + D2 * Bmix ) ** 2 / ( 1 + D1 ) ** 2 ) / ( D1 - D2 ) fD1D1 = 4 * ( f - 1 / ( V + D2 * Bmix )) / ( 1 + D1 ) ** 3 + Bmix * ( - 1 / ( V + D1 * Bmix ) ** 2 & + 4 / ( V + D2 * Bmix ) ** 2 / ( 1 + D1 ) ** 4 ) - 2 * fD1 * ( 1 + 2 / ( 1 + D1 ) ** 2 ) fD1D1 = fD1D1 / ( D1 - D2 ) ! Reduced Helmholtz Energy and derivatives Ar = - TOTN * g * T - D * f ArV = - TOTN * gv * T - D * fv ArV2 = - TOTN * gv2 * T - D * fv2 AUX = R * T / ( V - Bmix ) FFB = TOTN * AUX - D * fB FFBV = - TOTN * AUX / ( V - Bmix ) + D * ( 2 * fv + V * fv2 ) / Bmix FFBB = TOTN * AUX / ( V - Bmix ) - D * ( 2 * f + 4 * V * fv + V ** 2 * fv2 ) / Bmix ** 2 do i = 1 , nc Arn ( i ) = - g * T + FFB * dBi ( i ) - f * dDi ( i ) - D * fD1 * dD1i ( i ) ArVn ( i ) = - gv * T + FFBV * dBi ( i ) - fv * dDi ( i ) - D * fVD1 * dD1i ( i ) if ( NDE . eq . 2 ) then do j = 1 , i Arn2 ( i , j ) = AUX * ( dBi ( i ) + dBi ( j )) - fB * ( dBi ( i ) * dDi ( j ) + dBi ( j ) * dDi ( i )) & + FFB * dBij ( i , j ) + FFBB * dBi ( i ) * dBi ( j ) - f * dDij ( i , j ) Arn2 ( i , j ) = Arn2 ( i , j ) - D * fBD1 * ( dBi ( i ) * dD1i ( j ) + dBi ( j ) * dD1i ( i )) & - fD1 * ( dDi ( i ) * dD1i ( j ) + dDi ( j ) * dD1i ( i )) & - D * fD1 * dD1ij ( i , j ) - D * fD1D1 * dD1i ( i ) * dD1i ( j ) Arn2 ( j , i ) = Arn2 ( i , j ) end do end if end do ! TEMPERATURE DERIVATIVES if ( NTD . eq . 1 ) then ArT = - TOTN * g - dDdT * f ArTV = - TOTN * gv - dDdT * fV ArTT = - dDdT2 * f do i = 1 , nc ArTn ( i ) = - g + ( TOTN * AUX / T - dDdT * fB ) * dBi ( i ) - f * dDiT ( i ) - dDdT * fD1 * dD1i ( i ) end do end if end subroutine HelmRKPR subroutine ArVnder ( nc , NDER , NTEMP , z , V , T , Ar , ArV , ArTV , ArV2 , Arn , ArVn , ArTn , Arn2 ) integer , intent ( in ) :: nc integer , intent ( in ) :: nder ! Get compositional derivatives integer , intent ( in ) :: ntemp ! Get temperature derivatives real ( pr ), intent ( in ) :: z ( nc ) real ( pr ), intent ( in ) :: V real ( pr ), intent ( in ) :: T real ( pr ), intent ( out ) :: ar , arv , artv , arv2 real ( pr ), dimension ( size ( z )), intent ( out ) :: Arn , ArVn , ArTn real ( pr ), intent ( out ) :: Arn2 ( size ( z ), size ( z )) vinit => cubic_v0 call ar_fun ( z , v , t , Ar , ArV , ArTV , ArV2 , Arn , ArVn , ArTn , Arn2 ) end subroutine ArVnder ! ========================================================================== ! ========================================================================== ! Attractive parameter routines ! -------------------------------------------------------------------------- subroutine aTder ( ac , Tc , k , T , a , dadT , dadT2 ) ! Given ac,Tc and the k parameter of the RKPR correlation, as well as the actual T, ! this subroutine calculates a(T) and its first and second derivatives with T. real ( pr ), intent ( in ) :: ac real ( pr ), intent ( in ) :: Tc real ( pr ), intent ( in ) :: k real ( pr ), intent ( in ) :: T real ( pr ), intent ( out ) :: a real ( pr ), intent ( out ) :: dadT real ( pr ), intent ( out ) :: dadT2 real ( pr ) :: Tr Tr = T / Tc if ( thermo_model . le . 3 ) then a = ac * ( 1 + k * ( 1 - sqrt ( Tr ))) ** 2 dadT = ac * k * ( k - ( k + 1 ) / sqrt ( Tr )) / Tc dadT2 = ac * k * ( k + 1 ) / ( 2 * Tc ** 2 * Tr ** 1.5D0 ) else if ( thermo_model == 4 ) then a = ac * ( 3 / ( 2 + Tr )) ** k dadT = - k * a / Tc / ( 2 + Tr ) dadT2 = - ( k + 1 ) * dadT / Tc / ( 2 + Tr ) end if end subroutine aTder subroutine aijTder ( NTD , nc , T , aij , daijdT , daijdT2 ) integer , intent ( in ) :: ntd integer , intent ( in ) :: nc real ( pr ), intent ( in ) :: T real ( pr ), intent ( out ) :: aij ( nc , nc ), daijdT ( nc , nc ), daijdT2 ( nc , nc ) real ( pr ) :: ai ( nc ), daidT ( nc ), daidT2 ( nc ) real ( pr ) :: aux ( nc , nc ), ratK ( nc , nc ) integer :: i , j if ( tdep . ge . 1 ) then Kij = 0.0D0 do i = 1 , nc Kij (: i - 1 , i ) = Kinf (: i - 1 , i ) + Kij0 (: i - 1 , i ) * exp ( - T / Tstar (: i - 1 , i )) end do end if do i = 1 , nc call aTder ( ac ( i ), Tc ( i ), k ( i ), T , ai ( i ), daidT ( i ), daidT2 ( i )) aij ( i , i ) = ai ( i ) daijdT ( i , i ) = daidT ( i ) daijdT2 ( i , i ) = daidT2 ( i ) if ( i . gt . 1 ) then do j = 1 , i - 1 aij ( j , i ) = sqrt ( ai ( i ) * ai ( j )) * ( 1 - Kij ( j , i )) aij ( i , j ) = aij ( j , i ) if ( NTD . eq . 1 ) then daijdT ( j , i ) = ( 1 - Kij ( j , i )) * ( sqrt ( ai ( i ) / ai ( j )) * daidT ( j ) & + sqrt ( ai ( j ) / ai ( i )) * daidT ( i )) / 2 daijdT2 ( j , i ) = ( 1 - Kij ( j , i )) * ( daidT ( j ) * daidT ( i ) / sqrt ( ai ( i ) * ai ( j )) & + sqrt ( ai ( i ) / ai ( j )) * ( daidT2 ( j ) - daidT ( j ) ** 2 / ( 2 * ai ( j ))) & + sqrt ( ai ( j ) / ai ( i )) * ( daidT2 ( i ) - daidT ( i ) ** 2 / ( 2 * ai ( i )))) / 2 daijdT ( i , j ) = daijdT ( j , i ) daijdT2 ( i , j ) = daijdT2 ( j , i ) end if end do end if end do end subroutine aijTder subroutine DandTnder ( NTD , nc , T , rn , D , dDi , dDiT , dDij , dDdT , dDdT2 ) integer , intent ( in ) :: ntd integer , intent ( in ) :: nc real ( pr ), intent ( in ) :: T real ( pr ), intent ( in ) :: rn ( nc ) real ( pr ), intent ( out ) :: D real ( pr ), intent ( out ) :: dDiT ( nc ) real ( pr ), intent ( out ) :: dDdT real ( pr ), intent ( out ) :: dDdT2 real ( pr ), intent ( out ) :: dDi ( nc ) real ( pr ), intent ( out ) :: dDij ( nc , nc ) real ( pr ) :: aij ( nc , nc ), daijdT ( nc , nc ), daijdT2 ( nc , nc ) real ( pr ) :: aux , aux2 integer :: i , j call aijTder ( NTD , nc , T , aij , daijdT , daijdT2 ) D = 0 dDdT = 0 dDdT2 = 0 do i = 1 , nc aux = 0 aux2 = 0 dDi ( i ) = 0 dDiT ( i ) = 0 do j = 1 , nc dDi ( i ) = dDi ( i ) + 2 * rn ( j ) * aij ( i , j ) if ( NTD . eq . 1 ) then dDiT ( i ) = dDiT ( i ) + 2 * rn ( j ) * daijdT ( i , j ) aux2 = aux2 + rn ( j ) * daijdT2 ( i , j ) end if dDij ( i , j ) = 2 * aij ( i , j ) aux = aux + rn ( j ) * aij ( i , j ) end do D = D + rn ( i ) * aux if ( NTD . eq . 1 ) then dDdT = dDdT + rn ( i ) * dDiT ( i ) / 2 dDdT2 = dDdT2 + rn ( i ) * aux2 end if end do end subroutine DandTnder ! ========================================================================== subroutine DELTAnder ( nc , rn , D1m , dD1i , dD1ij ) integer , intent ( in ) :: nc real ( pr ), intent ( in ) :: rn ( nc ) real ( pr ), intent ( out ) :: D1m , dD1i ( nc ), dD1ij ( nc , nc ) real ( pr ) :: totn integer :: i , j D1m = 0.0_pr do i = 1 , nc D1m = D1m + rn ( i ) * del1 ( i ) end do TOTN = sum ( rn ) D1m = D1m / totn do i = 1 , nc dD1i ( i ) = ( del1 ( i ) - D1m ) / totn do j = 1 , nc dD1ij ( i , j ) = ( 2.0_pr * D1m - del1 ( i ) - del1 ( j )) / totn ** 2 end do end do end subroutine DELTAnder ! ========================================================================== ! Repulsive parameter routines ! -------------------------------------------------------------------------- subroutine Bnder ( nc , rn , Bmix , dBi , dBij ) integer , intent ( in ) :: nc real ( pr ), intent ( in ) :: rn ( nc ) real ( pr ), intent ( out ) :: Bmix , dBi ( nc ), dBij ( nc , nc ) real ( pr ) :: totn , aux ( nc ) integer :: i , j TOTN = sum ( rn ) Bmix = 0.0_pr aux = 0.0_pr do i = 1 , nc do j = 1 , nc bij ( i , j ) = ( b ( i ) + b ( j )) * 0.5_pr * ( 1.0_pr - lij ( i , j )) aux ( i ) = aux ( i ) + rn ( j ) * bij ( i , j ) end do Bmix = Bmix + rn ( i ) * aux ( i ) end do Bmix = Bmix / totn do i = 1 , nc dBi ( i ) = ( 2 * aux ( i ) - Bmix ) / totn do j = 1 , i dBij ( i , j ) = ( 2 * bij ( i , j ) - dBi ( i ) - dBi ( j )) / totn dBij ( j , i ) = dBij ( i , j ) end do end do end subroutine Bnder ! ========================================================================== ! ========================================================================== ! Properties ! -------------------------------------------------------------------------- function cubic_v0 ( z , p , t ) real ( pr ) :: z (:) real ( pr ) :: p real ( pr ) :: t real ( pr ) :: cubic_v0 real ( pr ) :: dbi ( nc ), dbij ( nc , nc ) call bnder ( nc , z , cubic_v0 , dBi , dBij ) end function end module module legacy_thermo_properties use yaeos__constants , only : R , pr use legacy_ar_models , only : ArVnder , vinit implicit none contains subroutine TERMO ( nc , MTYP , INDIC , T , P , rn , V , PHILOG , DLPHIP , DLPHIT , FUGN ) ! MTYP TYPE OF ROOT DESIRED (-1 vapor, 1 liquid, 0 lower Gibbs energy phase) ! rn mixture mole numbers (input) ! t temperature (k) (input)x, y ! p pressure (bar) (input) ! v volume (L) (output) ! PHILOG vector of ln(phi(i)*P) (output) INDIC < 5 ! DLPHIT t-derivative of ln(phi(i)) (const P, n) (output) INDIC = 2 or 4 ! DLPHIP P-derivative of ln(phi(i)) (const T, n) (output) INDIC < 5 ! FUGN comp-derivative of ln(phi(i)) (const t & P)(output) INDIC > 2 ! ------------------------------------------------------------------------- integer , intent ( in ) :: nc !! Number of components integer , intent ( in ) :: indic !! Desired element, this should be setted with optionals integer , intent ( in ) :: mtyp !! Type of root desired (-1 vapor, 1 liquid, 0 lower Gr) real ( pr ), intent ( in ) :: t !! Temperature [K] real ( pr ), intent ( in ) :: p !! Pressure [bar] real ( pr ), intent ( in ) :: rn ( nc ) !! Mixture mole numbers real ( pr ), intent ( out ) :: v !! Volume [L] real ( pr ), intent ( out ) :: PHILOG ( nc ) !! ln(phi*p) vector real ( pr ), optional , intent ( out ) :: DLPHIT ( nc ) !! ln(phi) Temp derivative real ( pr ), optional , intent ( out ) :: DLPHIP ( nc ) !! ln(phi) Presssure derivative real ( pr ), optional , intent ( out ) :: FUGN ( nc , nc ) !! ln(phi) compositional derivative real ( pr ) :: ar , arv , artv , arv2 real ( pr ) :: RT , Z , dpv , dpdt real ( pr ) :: Arn ( nc ) real ( pr ) :: ArVn ( nc ) real ( pr ) :: ArTn ( nc ) real ( pr ) :: Arn2 ( nc , nc ) real ( pr ) :: DPDN ( nc ) real ( pr ) :: totn integer :: ntemp , igz , nder , i , k ! The output PHILOG is actually the vector ln(phi(i)*P) NTEMP = 0 IGZ = 0 NDER = 1 if ( INDIC . gt . 2 ) NDER = 2 if ( INDIC . eq . 2 . or . INDIC . eq . 4 ) NTEMP = 1 TOTN = sum ( rn ) ! if (P .le. 0.0d0) MTYP = 1 call VCALC ( MTYP , NC , NTEMP , rn , T , P , V ) RT = R * T Z = V / ( TOTN * RT ) ! this is Z/P call ArVnder ( nc , NDER , NTEMP , rn , V , T , Ar , ArV , ArTV , ArV2 , Arn , ArVn , ArTn , Arn2 ) DPV = - ArV2 - RT * TOTN / V ** 2 DPDT = - ArTV + TOTN * R / V do I = 1 , NC PHILOG ( I ) = - log ( Z ) + Arn ( I ) / RT DPDN ( I ) = RT / V - ArVn ( I ) if ( present ( dlphip )) DLPHIP ( I ) = - DPDN ( I ) / DPV / RT - 1.D0 / P if ( NTEMP . ne . 0 ) then if ( present ( dlphit )) then DLPHIT ( I ) = ( ArTn ( I ) - Arn ( I ) / T ) / RT + DPDN ( I ) * DPDT / DPV / RT + 1.D0 / T end if end if end do if ( present ( fugn )) then do I = 1 , NC do K = I , NC FUGN ( I , K ) = 1.D0 / TOTN + ( Arn2 ( I , K ) + DPDN ( I ) * DPDN ( K ) / DPV ) / RT FUGN ( K , I ) = FUGN ( I , K ) end do end do end if end subroutine TERMO subroutine zTVTERMO ( nc , INDIC , T , rn , V , P , DPV , PHILOG , DLPHIP , DLPHIT , FUGN ) !! Calculation of lnphi*P and derivatives !! rn mixture mole numbers (input) !! t temperature (k) (input) !! v volume (L) (input) !! p pressure (bar) (output) !! PHILOG vector of ln(phi(i)*P) (output) 0 < INDIC < 5 !! DLPHIT t-derivative of ln(phi(i)) (const P, n) (output) 0 < INDIC = 2 or 4 !! DLPHIP P-derivative of ln(phi(i)) (const T, n) (output) 0 < INDIC < 5 !! FUGN comp-derivative of ln(phi(i)) (const t & P)(output) 2 < INDIC !! ------------------------------------------------------------------------- implicit none integer , intent ( in ) :: nc , indic real ( pr ), intent ( in ) :: t , rn ( nc ), v real ( pr ), intent ( out ) :: p , dpv real ( pr ), intent ( out ) :: PHILOG ( nc ), DLPHIT ( nc ), DLPHIP ( nc ) real ( pr ), intent ( out ) :: FUGN ( nc , nc ) real ( pr ) :: Arn ( nc ), ArVn ( nc ), ArTn ( nc ), Arn2 ( nc , nc ), DPDN ( nc ), totn real ( pr ) :: ar , arv , artv , arv2 , RT , Z , dpdt integer :: ntemp , igz , nder , i , k NTEMP = 0 IGZ = 0 NDER = 1 if ( INDIC . gt . 2 ) NDER = 2 if ( INDIC . eq . 2 . or . INDIC . eq . 4 ) NTEMP = 1 TOTN = sum ( rn ) RT = R * T Z = V / ( TOTN * RT ) ! this is Z/P call ArVnder ( nc , NDER , NTEMP , rn , V , T , Ar , ArV , ArTV , ArV2 , Arn , ArVn , ArTn , Arn2 ) P = TOTN * RT / V - ArV DPV = - ArV2 - RT * TOTN / V ** 2 DPDT = - ArTV + TOTN * R / V if ( INDIC > 0 ) then do I = 1 , NC PHILOG ( I ) = - log ( Z ) + Arn ( I ) / RT DPDN ( I ) = RT / V - ArVn ( I ) DLPHIP ( I ) = - DPDN ( I ) / DPV / RT - 1.D0 / P if ( NTEMP . ne . 0 ) then DLPHIT ( I ) = ( ArTn ( I ) - Arn ( I ) / T ) / RT + DPDN ( I ) * DPDT / DPV / RT + 1.D0 / T end if end do end if if ( NDER . ge . 2 ) then do I = 1 , NC do K = I , NC FUGN ( I , K ) = 1.D0 / TOTN + ( Arn2 ( I , K ) + DPDN ( I ) * DPDN ( K ) / DPV ) / RT FUGN ( K , I ) = FUGN ( I , K ) end do end do end if end subroutine zTVTERMO subroutine PUREFUG_CALC ( nc , icomp , T , P , V , phi ) !! Fugacity of a pure component integer , intent ( in ) :: nc integer , intent ( in ) :: icomp real ( pr ), intent ( in ) :: T , P , V real ( pr ), intent ( out ) :: phi real ( pr ) :: rn ( nc ), Ar , Arv , ArTV , ArV2 , Arn ( nc ), ArVn ( nc ), ArTn ( nc ), Arn2 ( nc , nc ) real ( pr ) :: RT , Z , philog rn = 0.0 rn ( icomp ) = 1.0 RT = R * T Z = P * V / RT call ArVnder ( nc , 0 , 0 , rn , V , T , Ar , ArV , ArTV , ArV2 , Arn , ArVn , ArTn , Arn2 ) PHILOG = - log ( Z ) + Arn ( icomp ) / RT phi = exp ( PHILOG ) end subroutine purefug_calc recursive subroutine VCALC ( ITYP , nc , NTEMP , rn , T , P , V ) !! ROUTINE FOR CALCULATION OF VOLUME, GIVEN PRESSURE integer , intent ( in ) :: ITYP !! TYPE OF ROOT DESIRED (-1 vapor, 1 liquid, 0 lower Gibbs energy phase) integer , intent ( in ) :: nc !! NO. OF COMPONENTS integer , intent ( in ) :: ntemp !! 1 if T-derivatives are required real ( pr ), intent ( in ) :: rn ( nc ) !! FEED MOELS real ( pr ), intent ( in ) :: T !! TEMPERATURE real ( pr ), intent ( in ) :: P !! PRESURE real ( pr ), intent ( out ) :: V !! VOLUME real ( pr ) :: Ar , ArV , ArTV , ArV2 , Arn ( nc ), ArVn ( nc ), ArTn ( nc ), Arn2 ( nc , nc ) logical :: FIRST_RUN integer :: nder real ( pr ) :: totn real ( pr ) :: B , CPV , S3R real ( pr ) :: ZETMIN , ZETA , ZETMAX real ( pr ) :: del , pcalc , der , AT , AVAP , VVAP integer :: iter NDER = 0 FIRST_RUN = . true . TOTN = sum ( rn ) CPV = vinit ( rn , p , t ) B = CPV S3R = 1.D0 / CPV ITER = 0 ZETMIN = 0.D0 !ZETMAX = 1.D0-0.01*T/5000 !.99D0 This is flexible for low T (V very close to B) ZETMAX = 1.D0 - 0.01 * T / ( 10000 * B ) ! improvement for cases with heavy components if ( ITYP . gt . 0 ) then ZETA = . 5 D0 else ! IDEAL GAS ESTIMATE ZETA = min (. 5 D0 , CPV * P / ( TOTN * R * T )) end if 100 continue DEL = 1 pcalc = 2 * p do while ( abs ( DEL ) > 1 d - 10 . and . iter < 100 ) V = CPV / ZETA ITER = ITER + 1 call ArVnder (& nc , NDER , NTEMP , rn , V , T , Ar , ArV , ArTV , ArV2 , Arn , ArVn , ArTn , Arn2 & ) PCALC = TOTN * R * T / V - ArV if ( PCALC . gt . P ) then ZETMAX = ZETA else ZETMIN = ZETA end if AT = ( Ar + V * P ) / ( T * R ) - TOTN * log ( V ) ! AT is something close to Gr(P,T) DER = ( ArV2 * V ** 2 + TOTN * R * T ) * S3R ! this is dPdrho/B DEL = - ( PCALC - P ) / DER ZETA = ZETA + max ( min ( DEL , 0.1D0 ), - . 1 D0 ) if ( ZETA . gt . ZETMAX . or . ZETA . lt . ZETMIN ) & ZETA = . 5 D0 * ( ZETMAX + ZETMIN ) end do if ( ITYP . eq . 0 ) then ! FIRST RUN WAS VAPOUR; RERUN FOR LIQUID if ( FIRST_RUN ) then VVAP = V AVAP = AT FIRST_RUN = . false . ZETA = 0.5D0 ZETMAX = 1.D0 - 0.01 * T / 500 goto 100 else if ( AT . gt . AVAP ) V = VVAP end if end if end subroutine vcalc ! ========================================================================== end module","tags":"","loc":"sourcefile/legacy.f90.html"},{"title":"implementations.f90 – yaeos","text":"Source Code module yaeos__models_ar_cubic_implementations use yaeos__constants , only : pr , R use yaeos__models_ar_genericcubic , only : CubicEoS use yaeos__substance , only : Substances !! Implemented Cubic Equations of State. !! !! - PengRobinson76 !! - PengRobinson78 !! - SoaveRedlichKwong !! - RKPR private public :: PengRobinson76 public :: PengRobinson78 public :: SoaveRedlichKwong public :: RKPR contains type ( CubicEoS ) function PengRobinson76 ( tc , pc , w , kij , lij ) result ( model ) !! PengRobinson76. !! !! Using the critical constants setup the parameters to use the !! PengRobinson Equation of State !! !! - \\alpha(T_r) = (1 + k (1 - \\sqrt{T_r}))^2 !! - k = 0.37464 + 1.54226 * \\omega - 0.26993 \\omega^2 !! - a_c = 0.45723553 R^2 T_c^2 / P_c !! - b = 0.07779607r R T_c/P_c !! - \\delta_1 = 1 + \\sqrt{2} !! - \\delta_2 = 1 - \\sqrt{2} !! !! There is also the optional posibility to include the k_{ij} and !! l_{ij} matrices. Using by default Classic Van der Waals mixing !! rules. !! !! After setting up the model, it is possible to redefine either the !! mixing rule or the alpha function using a different derived type !! defined outside the function. use yaeos__constants , only : pr , R use yaeos__substance , only : Substances use yaeos__models_ar_genericcubic , only : CubicEoS use yaeos__models_ar_cubic_alphas , only : AlphaSoave use yaeos__models_ar_cubic_quadratic_mixing , only : QMR real ( pr ), intent ( in ) :: tc (:) !! Critical Temperatures [K] real ( pr ), intent ( in ) :: pc (:) !! Critical Pressures [bar] real ( pr ), intent ( in ) :: w (:) !! Acentric Factors real ( pr ), optional , intent ( in ) :: kij (:, :) !! k_{ij} matrix real ( pr ), optional , intent ( in ) :: lij (:, :) !! l_{ij} matrix type ( Substances ) :: composition type ( QMR ) :: mixrule type ( AlphaSoave ) :: alpha integer :: nc integer :: i nc = size ( tc ) composition % tc = tc composition % pc = pc composition % w = w alpha % k = 0.37464_pr & + 1.54226_pr * composition % w & - 0.26993_pr * composition % w ** 2 if ( present ( kij )) then mixrule % k = kij else mixrule % k = reshape ([( 0 , i = 1 , nc ** 2 )], [ nc , nc ]) endif if ( present ( lij )) then mixrule % l = lij else mixrule % l = reshape ([( 0 , i = 1 , nc ** 2 )], [ nc , nc ]) endif model % components = composition model % ac = 0.45723553_pr * R ** 2 * composition % tc ** 2 / composition % pc model % b = 0.07779607_pr * R * composition % tc / composition % pc model % del1 = [( 1 + sqrt ( 2.0_pr ), i = 1 , nc )] model % del2 = [( 1 - sqrt ( 2.0_pr ), i = 1 , nc )] model % alpha = alpha model % mixrule = mixrule model % name = \"PR76\" end function type ( CubicEoS ) function PengRobinson78 ( tc , pc , w , kij , lij ) result ( model ) !! PengRobinson78. !! !! Using the critical constants setup the parameters to use the !! PengRobinson Equation of State !! !! - \\alpha(T_r) = (1 + k (1 - \\sqrt{T_r}))^2 !! - k = 0.37464 + 1.54226 \\omega - 0.26992 \\omega^2 \\text{ where } \\omega <=0.491 !! - k = 0.37464 + 1.48503 \\omega - 0.16442 \\omega^2 + 0.016666 \\omega^3 \\text{ where } \\omega > 0.491 !! - a_c = 0.45723553 R^2 T_c^2 / P_c !! - b = 0.07779607r R T_c/P_c !! - \\delta_1 = 1 + \\sqrt{2} !! - \\delta_2 = 1 - \\sqrt{2} !! !! There is also the optional posibility to include the k_{ij} and !! l_{ij} matrices. Using by default Classic Van der Waals mixing !! rules. !! !! After setting up the model, it is possible to redefine either the !! mixing rule or the alpha function using a different derived type !! defined outside the function. use yaeos__constants , only : pr , R use yaeos__substance , only : Substances use yaeos__models_ar_genericcubic , only : CubicEoS use yaeos__models_ar_cubic_alphas , only : AlphaSoave use yaeos__models_ar_cubic_quadratic_mixing , only : QMR real ( pr ), intent ( in ) :: tc (:) !! Critical Temperatures [K] real ( pr ), intent ( in ) :: pc (:) !! Critical Pressures [bar] real ( pr ), intent ( in ) :: w (:) !! Acentric Factors real ( pr ), optional , intent ( in ) :: kij (:, :) !! k_{ij} matrix real ( pr ), optional , intent ( in ) :: lij (:, :) !! l_{ij} matrix type ( Substances ) :: composition type ( QMR ) :: mixrule type ( AlphaSoave ) :: alpha integer :: nc integer :: i nc = size ( tc ) composition % tc = tc composition % pc = pc composition % w = w allocate ( alpha % k ( nc )) where ( composition % w <= 0.491 ) alpha % k = 0.37464 + 1.54226 * composition % w - 0.26992 * composition % w ** 2 elsewhere alpha % k = 0.379642 + 1.48503 * composition % w - 0.164423 * composition % w ** 2 + 0.016666 * composition % w ** 3 end where if ( present ( kij )) then mixrule % k = kij else mixrule % k = reshape ([( 0 , i = 1 , nc ** 2 )], [ nc , nc ]) endif if ( present ( lij )) then mixrule % l = lij else mixrule % l = reshape ([( 0 , i = 1 , nc ** 2 )], [ nc , nc ]) endif model % components = composition model % ac = 0.45723553_pr * R ** 2 * composition % tc ** 2 / composition % pc model % b = 0.07779607_pr * R * composition % tc / composition % pc model % del1 = [( 1 + sqrt ( 2.0_pr ), i = 1 , nc )] model % del2 = [( 1 - sqrt ( 2.0_pr ), i = 1 , nc )] model % alpha = alpha model % mixrule = mixrule model % name = \"PR78\" end function type ( CubicEoS ) function SoaveRedlichKwong ( tc , pc , w , kij , lij ) result ( model ) !! SoaveRedlichKwong. !! !! Using the critical constants setup the parameters to use the !! SoaveRedlichKwong Equation of State !! !! - \\alpha(T_r) = (1 + k (1 - \\sqrt{T_r}))^2 !! - k = 0.48 + 1.574 \\omega - 0.175 \\omega^2 !! - a_c = 0.427480 R^2 * T_c^2/P_c !! - b = 0.086640 R T_c/P_c !! - \\delta_1 = 1 !! - \\delta_2 = 0 !! !! There is also the optional posibility to include the k_{ij} and l_{ij} !! matrices. Using by default Classic Van der Waals mixing rules. !! !! After setting up the model, it is possible to redefine either the !! mixing rule or the alpha function using a different derived type !! defined outside the function. use yaeos__models_ar_genericcubic , only : CubicEoS use yaeos__models_ar_cubic_alphas , only : AlphaSoave use yaeos__models_ar_cubic_quadratic_mixing , only : QMR real ( pr ), intent ( in ) :: tc (:) !! Critical temperature [K] real ( pr ), intent ( in ) :: pc (:) !! Critical pressure [bar] real ( pr ), intent ( in ) :: w (:) !! Acentric factor real ( pr ), optional , intent ( in ) :: kij (:, :) !! k_{ij} matrix real ( pr ), optional , intent ( in ) :: lij (:, :) !! l_{ij} matrix type ( Substances ) :: composition type ( QMR ) :: mixrule type ( AlphaSoave ) :: alpha integer :: nc integer :: i nc = size ( tc ) composition % tc = tc composition % pc = pc composition % w = w alpha % k = 0.48_pr + 1.574_pr * composition % w - 0.175_pr * composition % w ** 2 if ( present ( kij )) then mixrule % k = kij else mixrule % k = reshape ([( 0 , i = 1 , nc ** 2 )], [ nc , nc ]) endif if ( present ( lij )) then mixrule % l = lij else mixrule % l = reshape ([( 0 , i = 1 , nc ** 2 )], [ nc , nc ]) endif model % components = composition model % ac = 0.427480_pr * R ** 2 * composition % tc ** 2 / composition % pc model % b = 0.086640_pr * R * composition % tc / composition % pc model % del1 = [( 1 , i = 1 , nc )] model % del2 = [( 0 , i = 1 , nc )] model % alpha = alpha model % mixrule = mixrule model % name = \"SRK\" end function type ( CubicEoS ) function RKPR ( tc , pc , w , zc , kij , lij , delta_1 , k ) result ( model ) !! RKPR Equation of State !! !! The RKPR EoS extends the classical formulation of Cubic Equations !! of State by freeing the parameter \\delta_1. This extra degree !! provides extra ways of implementing the equation in comparison !! of other Cubic EoS (like PR and SRK) which are limited to definition !! of their critical constants. !! !! Besides that extra parameter, the RKRR includes another \\alpha !! function: !! !! \\alpha(T_r) = \\left(\\frac{3}{2+T_r}\\right)^k !! !! !! In this implementation we take the simplest form which correlates !! the extra parameter to the critical compressibility factor Z_c and !! the k parameter of the \\alpha function to Z_c and \\omega: !! !! \\delta_1 = d_1 + d_2 (d_3 - Z_c)^d_4 + d_5 (d_3 - Z_c) ^ d_6 !! k = (A_1 Z_c + A_0)\\omega^2 + (B_1 Z_c + B_0)\\omega + (C_1 Z_c + C_0) use yaeos__models_ar_cubic_quadratic_mixing , only : QMR_RKPR use yaeos__models_ar_cubic_alphas , only : AlphaRKPR real ( pr ), intent ( in ) :: tc (:) !! Critical Temperature [K] real ( pr ), intent ( in ) :: pc (:) !! Critical Pressure [bar] real ( pr ), intent ( in ) :: w (:) !! Acentric Factor real ( pr ), intent ( in ) :: zc (:) !! Critical compressibility real ( pr ), optional , intent ( in ) :: kij (:, :) !! k_{ij} matrix real ( pr ), optional , intent ( in ) :: lij (:, :) !! l_{ij} matrix real ( pr ), optional , intent ( in ) :: delta_1 (:) real ( pr ), optional , intent ( in ) :: k (:) type ( AlphaRKPR ) :: alpha type ( QMR_RKPR ) :: mixrule type ( Substances ) :: composition integer :: i , nc real ( pr ), parameter :: d1 = 0.428364 , & d2 = 1 8.496215 , & d3 = 0.338426 , & d4 = 0.66 , & d5 = 78 9.723105 , & d6 = 2.512392 real ( pr ), parameter :: A1 = - 2.4407 real ( pr ), parameter :: A0 = 0.0017 real ( pr ), parameter :: B1 = 7.4513 real ( pr ), parameter :: B0 = 1.9681 real ( pr ), parameter :: C1 = 1 2.504 real ( pr ), parameter :: C0 =- 2.6238 real ( pr ) :: OMa ( size ( pc )), OMb ( size ( pc )) real ( pr ) :: Zc_eos ( size ( pc )) nc = size ( tc ) composition % pc = pc composition % tc = tc composition % w = w Zc_eos = 1.168 * Zc if ( present ( k )) then alpha % k = k else alpha % k = ( A1 * zc + A0 ) * w ** 2 + ( B1 * zc + B0 ) * w + ( C1 * Zc + C0 ) end if if ( present ( kij )) then mixrule % k = kij else mixrule % k = reshape ([( 0 , i = 1 , nc ** 2 )], [ nc , nc ]) end if if ( present ( lij )) then mixrule % l = lij else mixrule % l = reshape ([( 0 , i = 1 , nc ** 2 )], [ nc , nc ]) end if model % components = composition if ( present ( delta_1 )) then model % del1 = delta_1 else model % del1 = d1 + d2 * ( d3 - zc ) ** d4 + d5 * ( d3 - zc ) ** d6 end if model % del2 = ( 1._pr - model % del1 ) / ( 1._pr + model % del1 ) model % alpha = alpha call get_OMa_OMb ( model % del1 , oma , omb ) model % ac = OMa * ( R * Tc ) ** 2 / Pc model % b = OMb * ( R * Tc ) / Pc model % mixrule = mixrule model % name = \"RKPR 2005\" end function subroutine get_OMa_OMb ( del1 , OMa , OMb ) real ( pr ), intent ( in ) :: del1 (:) real ( pr ), intent ( out ) :: OMa ( size ( del1 )) real ( pr ), intent ( out ) :: OMb ( size ( del1 )) real ( pr ) :: d1 ( size ( del1 )), y ( size ( del1 )) d1 = ( 1._pr + del1 ** 2._pr ) / ( 1._pr + del1 ) y = 1._pr + ( 2._pr * ( 1._pr + del1 )) ** ( 1.0_pr / 3._pr ) + ( 4._pr / ( 1._pr + del1 )) ** ( 1.0_pr / 3 ) OMa = ( 3._pr * y * y + 3._pr * y * d1 + d1 ** 2._pr + d1 - 1.0_pr ) / ( 3._pr * y + d1 - 1.0_pr ) ** 2._pr OMb = 1._pr / ( 3._pr * y + d1 - 1.0_pr ) end subroutine end module","tags":"","loc":"sourcefile/implementations.f90~2.html"},{"title":"volume.f90 – yaeos","text":"Source Code module yaeos__models_solvers !! # `models solvers` !! Set of different specialized solvers for different models !! !! # Description !! This module holds specialized solvers for different kind of applications !! and models. !! !! ## Volume solving !! This module holds the routine `volume_michelsen` which is a solver for !! volume that takes advantage over a simple newton on the function of !! pressure by solving the function of pressure over the covolume instead, !! which solution is limited in the range [0, 1]. This solver requires that !! the EoS uses the method `get_v0` to return the covolume. !! !! # Examples !! !! ```fortran !! A basic code example !! ``` !! !! # References !! use yaeos__constants , only : pr , R use yaeos__models_ar , only : ArModel implicit none contains subroutine volume_michelsen ( eos , n , P , T , V , root_type , max_iters , V0 ) !! Volume solver at a given pressure. !! !! Obtain the volume using the method described by Michelsen and Møllerup. !! While P(V, T) can be obtained with a simple Newton method, a better !! approach is solving P(B/V, T) where B is the EoS covolume. !! This method is easier to solve because: !! !! V(P, T) \\in [0, \\infty) !! !! and !! !! \\frac{B}{V}(P, T) \\in [0, 1] !! !! !! At chapter 3 page 94 of Michelsen and Møllerup's book a more complete !! explanation can be seen use iso_fortran_env , only : error_unit use stdlib_optval , only : optval class ( ArModel ), intent ( in ) :: eos real ( pr ), intent ( in ) :: n (:) !! Mixture moles real ( pr ), intent ( in ) :: T !! Temperature [K] real ( pr ), intent ( in ) :: P !! Pressure [bar] real ( pr ), intent ( out ) :: V !! Volume [L] character ( len =* ), optional , intent ( in ) :: root_type !! Type of root [\"vapor\" | \"liquid\" | \"stable\"] integer , optional , intent ( in ) :: max_iters !! Maxiumum number of iterations, defaults to 100 real ( pr ), optional , intent ( in ) :: V0 !! Specified initial volume character ( len = 10 ) :: root real ( pr ) :: Ar , ArV , ArV2 real ( pr ) :: totn real ( pr ) :: B !! Covolume real ( pr ) :: ZETMIN , ZETA , ZETMAX real ( pr ) :: pcalc , AT , AVAP , VVAP integer :: iter , maximum_iterations maximum_iterations = optval ( max_iters , 100 ) root = optval ( root_type , \"stable\" ) TOTN = sum ( n ) B = eos % get_v0 ( n , p , t ) ITER = 0 ! Limits ZETMIN = 0._pr ZETMAX = 1._pr if ( present ( V0 )) then zeta = B / V0 else select case ( root_type ) case ( \"liquid\" ) ZETA = 0.5_pr call solve_point ( P , V , Pcalc , AT , iter ) case ( \"vapor\" , \"stable\" ) ZETA = min ( 0.5_pr , B * P / ( TOTN * R * T )) call solve_point ( P , V , Pcalc , AT , iter ) if ( root_type == \"stable\" ) then ! Run first for vapor and then for liquid VVAP = V AVAP = AT ZETA = 0.5_pr ZETMAX = 1._pr call solve_point ( P , V , Pcalc , AT , iter ) if ( AT . gt . AVAP ) V = VVAP end if case default write ( error_unit , * ) \"ERROR [VCALC]: Wrong specification\" error stop 1 end select end if contains subroutine solve_point ( P , V , Pcalc , AT , iter ) real ( pr ), intent ( in ) :: P !! Objective pressure [bar] real ( pr ), intent ( out ) :: V !! Obtained volume [L] real ( pr ), intent ( out ) :: Pcalc !! Calculated pressure at V [bar] real ( pr ), intent ( out ) :: AT !! integer , intent ( out ) :: iter real ( pr ) :: del , der iter = 0 DEL = 1 pcalc = 2 * p do while ( abs ( DEL ) > 1.e-10_pr . and . iter < maximum_iterations ) V = B / ZETA iter = iter + 1 call eos % residual_helmholtz ( n , V , T , Ar = Ar , ArV = ArV , ArV2 = ArV2 ) Pcalc = TOTN * R * T / V - ArV if ( Pcalc . gt . P ) then ZETMAX = ZETA else ZETMIN = ZETA end if ! AT is something close to Gr(P,T) AT = ( Ar + V * P ) / ( T * R ) - TOTN * log ( V ) DER = ( ArV2 * V ** 2 + TOTN * R * T ) / B ! this is dPdrho/B DEL = - ( Pcalc - P ) / DER ZETA = ZETA + max ( min ( DEL , 0.1_pr ), - . 1_pr ) if ( ZETA . gt . ZETMAX . or . ZETA . lt . ZETMIN ) then ZETA = 0.5_pr * ( ZETMAX + ZETMIN ) end if end do if ( iter >= maximum_iterations ) write ( error_unit , * ) & \"WARN: Volume solver exceeded maximum number of iterations\" end subroutine solve_point end subroutine volume_michelsen end module","tags":"","loc":"sourcefile/volume.f90.html"},{"title":"pressure_equality.f90 – yaeos","text":"Source Code module yaeos__solvers_pressure_equality !! Solve the pressure equality of a use yaeos__constants , only : pr , R use yaeos__models_ar , only : ArModel implicit none contains subroutine pressure_equality_V_beta_xy ( model , T , V , beta , x , y , vx , vy , P ) !! Solve pressure equality between two phases at a given temperature, !! total volume, vapor molar fractions and compositions. use iso_fortran_env , only : error_unit class ( ArModel ), intent ( in ) :: model real ( pr ), intent ( in ) :: T !! Temperature [K] real ( pr ), intent ( in ) :: V !! Total volume [L/mol] real ( pr ), intent ( in ) :: beta !! Molar fraction of light-phase real ( pr ), intent ( in ) :: x (:) !! Molar fractions of heavy-phase real ( pr ), intent ( in ) :: y (:) !! Molar fractions of light-phase real ( pr ), intent ( in out ) :: Vx !! Heavy-phase molar volume [L/mol] real ( pr ), intent ( in out ) :: Vy !! Light-Phase molar volume [L/mol] real ( pr ), intent ( out ) :: P !! Pressure [bar] real ( pr ) :: Bx !! Liquid phase covolume real ( pr ) :: dVydVx !! Derivative of Vy wrt Vx ! Pressure equality newton functions real ( pr ) :: h !! Pressure equality real ( pr ) :: dh !! dh/ real ( pr ) :: stepv real ( pr ) :: dPxdV , dPydV real ( pr ) :: Px , Py integer :: its dVydVx = - ( 1 - beta ) / beta Bx = model % get_v0 ( x , 0.1_pr , T ) ! First evaluation will be with Vx = 1.5*Bx if ( Vx < Bx ) Vx = 1.625_pr * Bx call model % pressure ( x , Vx , T , Px , dpdv = dPxdV ) do while ( Px < 0 . or . dPxdV >= 0 ) Vx = Vx - 0.2 * ( Vx - Bx ) call model % pressure ( x , Vx , T , Px , dpdv = dPxdV ) end do Vy = ( V - ( 1 - beta ) * Vx ) / beta h = 1.0 its = 0 do while ( abs ( h ) > 1.d-4 ) ! Newton for solving P equality, with Vx as independent variable its = its + 1 call model % pressure ( x , Vx , T , Px , dpdv = dPxdV ) call model % pressure ( y , Vy , T , Py , dpdv = dPydV ) h = Py - Px dh = - dPydV * dVydVx - dPxdV stepv = - h / dh if ( its >= 10 ) stepv = stepv / 2 Vx = Vx + stepv do while ( Vx < 1.001 * Bx ) stepv = stepv / 2 Vx = Vx - stepv end do Vy = ( v - ( 1 - beta ) * Vx ) / beta if ( its >= 100 ) then write ( error_unit , * ) \"WARN(FLASH_VT): volume convergence problems\" , Px , Py P = - 1.0 return end if end do call model % pressure ( x , Vx , T , Px ) call model % pressure ( y , Vy , T , Py ) P = ( Px + Py ) * 0.5_pr end subroutine pressure_equality_V_beta_xy end module yaeos__solvers_pressure_equality","tags":"","loc":"sourcefile/pressure_equality.f90.html"},{"title":"fitting.f90 – yaeos","text":"Source Code module yaeos__fitting use yaeos__constants , only : pr use yaeos__models , only : ArModel use yaeos__equilibria , only : & EquilibriumState , saturation_pressure , saturation_temperature , flash use yaeos__optimizers , only : Optimizer , obj_func implicit none type , abstract :: FittingProblem !! # Fitting problem setting !! !! # Description !! This derived type holds all the relevant information for a parameter !! optimization problem. It keeps the base model structure that will be !! optimized and a procedure `get_model_from_X` that should reconstruct !! the model with the desired parameters to optimize. class ( ArModel ), allocatable :: model !! Residual Helmholtz Model to fit type ( EquilibriumState ), allocatable :: experimental_points (:) !! Experimental points to fit logical :: verbose = . false . !! If true log the fitting process contains procedure ( model_from_X ), deferred :: get_model_from_X end type FittingProblem abstract interface subroutine model_from_X ( problem , X ) !! Function that returns a setted model from the parameters vector import ArModel , FittingProblem , pr class ( FittingProblem ), intent ( in out ) :: problem !! Fitting problem to optimize real ( pr ), intent ( in ) :: X (:) !! Vector of parameters to fit end subroutine model_from_X end interface contains real ( pr ) function optimize ( X , opt , data ) result ( y ) real ( pr ), intent ( in out ) :: X (:) !! Vector of parameters to fit class ( Optimizer ), intent ( in out ) :: opt !! Optimizer object, bsaed on the `Optimizer` class from !! `yaeos__optimizers` class ( FittingProblem ), optional , intent ( in out ) :: data !! Fitting problem to optimize call opt % optimize ( error_function , X , y , data ) end function optimize subroutine error_function ( X , Fobj , dF , func_data ) !! # `error_function` !! Error function for phase-equilibria optimization. Using two-phase !! points and an error function of: !! !! !! FO = \\sum_i (\\frac{P_i^{exp} - P_i^{calc}}{P_i^{exp}})^2 !! + \\sum_i (y_i^{exp} - y_i^{calc})**2 !! + \\sum_i (x_i^{exp} - x_i^{calc})**2 !! use yaeos__math , only : sq_error real ( pr ), intent ( in ) :: X (:) !! Vector of parameters real ( pr ), intent ( out ) :: Fobj !! Objective function real ( pr ), optional , intent ( out ) :: dF (:) !! Gradient of the objective function, only exists to be consistent !! with the `Optimizer` class API class ( * ), optional , intent ( in out ) :: func_data type ( EquilibriumState ) :: model_point !! Each solved point type ( EquilibriumState ) :: exp_point integer :: i if ( present ( dF )) error stop 1 select type ( func_data ) class is ( FittingProblem ) ! Update the problem model to the new vector of parameters call func_data % get_model_from_X ( X ) fobj = 0 associate ( model => func_data % model ) ! Calculate each point and calculate its error. ! if at some point there is a NaN value, assign a big number and ! exit do i = 1 , size ( func_data % experimental_points ) exp_point = func_data % experimental_points ( i ) select case ( exp_point % kind ) case ( \"bubble\" ) model_point = saturation_pressure (& model , exp_point % x , exp_point % t , kind = \"bubble\" , & p0 = exp_point % p , y0 = exp_point % y & ) case ( \"dew\" ) model_point = saturation_pressure (& model , exp_point % y , exp_point % t , kind = \"dew\" , & p0 = exp_point % p , y0 = exp_point % x & ) case ( \"liquid-liquid\" ) model_point = saturation_pressure (& model , exp_point % x , exp_point % t , kind = \"liquid-liquid\" , & p0 = exp_point % p , y0 = exp_point % y & ) end select fobj = fobj + sq_error ( exp_point % p , model_point % p ) fobj = fobj + maxval ( sq_error ( exp_point % y , model_point % y )) fobj = fobj + maxval ( sq_error ( exp_point % x , model_point % x )) write ( 1 , * ) fobj , exp_point , model_point if ( isnan ( fobj )) then fobj = 1e6 exit end if end do end associate end select end subroutine error_function end module yaeos__fitting","tags":"","loc":"sourcefile/fitting.f90.html"},{"title":"hyperdual.f90 – yaeos","text":"Source Code module hyperdual_mod !> Hyperdual number definition & type declaration ! ! Original code provided by Philipp Rehner and Gernot Bauer, ! Institute of Thermodynamics and Thermal Process Engineering (ITT), ! University of Stuttgart, Stuttgart, Germany ! ! #### Hypderdual numbers ! ! Hypderdual numbers extend the idea of additional, non-real ! components from one non-real component (complex numbers) to four ! non-real components: \\f$\\varepsilon_1\\f$, \\f$\\varepsilon_2\\f$ and ! \\f$\\varepsilon_1 \\varepsilon_2\\f$. ! Hyperdual numbers require: \\f$(\\varepsilon_1)^2 = 0\\f$, ! \\f$(\\varepsilon_2)^2 = 0\\f$ and ! \\f$(\\varepsilon_1\\varepsilon_2)^2 = 0\\f$ ! This leads to the fact, that the Taylor series of a function with ! hyperdual arguments can be truncated _exactly_ after the second ! derivative term: ! ! \\f[ ! f(\\mathbf{x} + h_1 \\varepsilon_1 + h_2 \\varepsilon_2 ! + h_1 h_2 \\varepsilon_1 \\varepsilon_2) ! = f(\\mathbf{x}) + h_1 f'(\\mathbf{x}) \\varepsilon_1 ! + h_2 f'(\\mathbf{x}) \\varepsilon_2 ! + h_1 h_2 f''(\\mathbf{x}) \\varepsilon_1 \\varepsilon_2 ! \\f] ! ! Because there is _no truncation error_, all first and second order ! derivatives can be obtained _exactly_, regardless of the step size '' ! \\f$h_1\\f$ and \\f$h_2\\f$. ! The derivatives can be obtained for a function \\f$ f(\\mathbf{x}) \\f$ ! with multiple variables \\f$ \\mathbf{x} \\in \\mathbb{R}^n \\f$ via ! \\f{eqnarray*}{ ! \\frac{\\partial f(\\mathbf{x})}{\\partial x_i} &=& \\frac{ ! \\varepsilon_{1, \\mathrm{part}} \\Big\\{ ! f(\\mathbf{x} + h_1 \\varepsilon_1 \\mathbf{e}_i ! + h_2 \\varepsilon_2 \\mathbf{e}_j + h_1 h_2 \\mathbf{0})\\Big\\}} ! {h_1}\\\\ ! \\frac{\\partial f(\\mathbf{x})}{\\partial x_i} &=& \\frac{ ! \\varepsilon_{2, \\mathrm{part}} \\Big\\{ ! f(\\mathbf{x} + h_1 \\varepsilon_1 \\mathbf{e}_i ! + h_2 \\varepsilon_2 \\mathbf{e}_j + h_1 h_2 \\mathbf{0})\\Big\\}} ! {h_2}\\\\ ! \\frac{\\partial^2 f(\\mathbf{x})}{\\partial x_i \\partial x_j} &=& ! \\frac{(\\varepsilon_1 \\varepsilon_2)_\\mathrm{part} \\Big\\{ ! f(\\mathbf{x} + h_1 \\varepsilon_1 \\mathbf{e}_i ! + h_2 \\varepsilon_2 \\mathbf{e}_j + h_1 h_2 \\mathbf{0})\\Big\\}} ! {h_1 h_2} \\\\ ! \\f} ! where \\f$\\mathbf{e}_i\\f$ and \\f$\\mathbf{e}_j\\f$ are unit vectors, ! which are all zero except for the \\f$i\\f$-th and \\f$j\\f$-th ! component, respectively. ! ! #### Computation principles for hypderdual numbers ! ! Hyperdual numbers \\f$\\mathbf{x} \\in \\mathbb{HD}\\f$ can be expressed ! as tuples: \\f$\\mathbf{x} = [x_0, x_1, x_2, x_{12}] = x_0 ! + x_1 \\varepsilon_1 + x_2 \\varepsilon_2 ! + x_{12} \\varepsilon_1\\varepsilon_2\\f$. ! By using the Taylor expansion of the function \\f$f(\\mathbf{x})\\f$ ! one gets computation priniple for functions with hyperdual ! arguments from ! ! \\f[ ! f(\\mathbf{x}) = f(x_0) + x_1 f'(x_0) \\varepsilon_1 ! + x_2 f'(x_0) \\varepsilon_2 + \\big( x_{12} f'(x_0) ! + x_1 x_2 f''(x_0) \\big) \\varepsilon_1 \\varepsilon_2 ! \\f] ! ! A hyperdual number derived type is provided by: \\ref hyperdual. ! ! #### References ! ! [[1]](https://doi.org/10.2514/6.2011-886) ! Fike, Alonso: **The Development of Hyper-Dual Numbers for Exact ! Second-Derivative Calculations.** ! _49th AIAA Aerospace Sciences Meeting including the New ! Horizons Forum and Aerospace Exposition_ (2011) \\n ! [[2]](https://doi.org/10.3389/fceng.2021.758090) ! Rehner, P. and Bauer, G.: **Application of Generalized ! (Hyper-) Dual Numbers in Equation ! of State Modeling.** ! Frontiers in Chemical Engineering_ (2021) \\n ! use yaeos__constants , only : pr implicit none type , bind ( c ) :: hyperdual !-| Derived type for hyperdual numbers ! ! Hyperdual numbers are represented by the tuple \\f$\\mathbf{f} = ! [f_0, f_1, f_2, f_{12}] = f_0 + f_1 \\varepsilon_1 ! + f_2 \\varepsilon_2 + f_{12} \\varepsilon_1 \\varepsilon_2 \\f$. ! Calculations specificaions are defined in module hyperdual_mod. ! sequence real ( pr ) :: f0 = 0 !! real part of the hyperdual number real ( pr ) :: f1 = 0 !! \\f$\\varepsilon_1\\f$-part of the hyperdual number real ( pr ) :: f2 = 0 !! \\f$\\varepsilon_2\\f$-part of the hyperdual number real ( pr ) :: f12 = 0 !! \\f$\\varepsilon_1\\varepsilon_2\\f$-part of the end type hyperdual !--------------------------------------------------------------------- !--- Operator interfaces --------------------------------------------- !--------------------------------------------------------------------- ! Equal assignment interface assignment ( = ) procedure EqualHyperDualHyperDual procedure EqualHyperDualReal end interface ! Unary operator + interface operator ( + ) procedure PlusHyperDualHyperDual end interface ! Addition operator interface operator ( + ) procedure AddHyperDualHyperDual procedure AddHyperDualReal procedure AddRealHyperDual end interface ! Unary operator - interface operator ( - ) procedure MinusHyperDualHyperDual end interface ! Subtraction operator interface operator ( - ) procedure SubtractHyperDualHyperDual procedure SubtractHyperDualReal procedure SubtractRealHyperDual end interface ! Multiplication operator interface operator ( * ) procedure MultiplyHyperDualHyperDual procedure MultiplyHyperDualReal procedure MultiplyRealHyperDual procedure MultiplyHyperDualInt procedure MultiplyIntHyperDual end interface ! Division operator interface operator ( / ) procedure DivideHyperDualHyperDual procedure DivideHyperDualReal procedure DivideRealHyperDual end interface ! Power operator interface operator ( ** ) procedure PowerHyperDualInt procedure PowerHyperDualHyperDual procedure PowerHyperDualReal end interface !--------------------------------------------------------------------- !--- Summation interface --------------------------------------------- !--------------------------------------------------------------------- interface sum module procedure SumHyperDual module procedure SumHyperDual2 end interface sum !--------------------------------------------------------------------- !--- Logical operator interfaces ------------------------------------- !--------------------------------------------------------------------- ! Equal operator. interface operator (. eq .) ! or (==) procedure eq_dd procedure eq_dr procedure eq_rd procedure eq_di procedure eq_id end interface ! Not equal operator. interface operator (. ne .) ! or (/=) procedure ne_dd procedure ne_dr procedure ne_rd procedure ne_di procedure ne_id end interface ! Less than operator. interface operator (. lt .) ! or (<) procedure lt_dd procedure lt_dr procedure lt_rd procedure lt_di procedure lt_id end interface ! Less than or equal operator. interface operator (. le .) ! or (<=) procedure le_dd procedure le_dr procedure le_rd procedure le_di procedure le_id end interface ! Greater than operator. interface operator (. gt .) ! or (>) procedure gt_dd procedure gt_dr procedure gt_rd procedure gt_di procedure gt_id end interface ! Greater than or equal operator. interface operator (. ge .) ! or (>=) procedure ge_dd procedure ge_dr procedure ge_rd procedure ge_di procedure ge_id end interface !--------------------------------------------------------------------- !--- Math function interfaces ---------------------------------------- !--------------------------------------------------------------------- ! Absolute value function interface abs module procedure absHyperDual end interface ! Integer function interface int module procedure intHyperDual end interface ! Nearest integer function interface nint module procedure nintHyperDual end interface ! Real function interface real module procedure realHyperDual end interface ! Sign function interface sign module procedure sign_dd module procedure sign_dr module procedure sign_rd end interface ! Sine function interface sin module procedure sinHyperDual end interface ! Cosine function interface cos module procedure cosHyperDual end interface ! Tangent function interface tan module procedure tanHyperDual end interface ! Sqrt function interface sqrt module procedure sqrtHyperDual end interface ! Log function interface log module procedure logHyperDual end interface ! Log10 function interface log10 module procedure log10HyperDual end interface ! Exp function interface exp module procedure expHyperDual end interface ! Sinh function interface sinh module procedure sinhHyperDual end interface ! Cosh function interface cosh module procedure coshHyperDual end interface ! Tanh function interface tanh module procedure tanhHyperDual end interface ! Acos function interface acos module procedure acosHyperDual end interface ! Asin function interface asin module procedure asinHyperDual end interface ! Atan function interface atan module procedure atanHyperDual end interface ! Atan2 function interface atan2 module procedure atan2HyperDual end interface ! Max function (limited to combinations below, but that ! can be extended) interface max module procedure max_dd module procedure max_ddd module procedure max_dr module procedure max_rd end interface ! Min function (limited for now to 2 arguments, but that ! can be extended) interface min module procedure min_dd module procedure min_dr module procedure min_rd end interface !===================================================================== contains !------------------------------------------------------------------- !--- Functions for the equal assignment. --------------------------- !------------------------------------------------------------------- elemental subroutine EqualHyperDualHyperDual ( res , inp ) implicit none type ( hyperdual ), intent ( out ) :: res type ( hyperdual ), intent ( in ) :: inp res % f0 = inp % f0 res % f1 = inp % f1 res % f2 = inp % f2 res % f12 = inp % f12 end subroutine EqualHyperDualHyperDual elemental subroutine EqualHyperDualReal ( res , inp ) implicit none type ( hyperdual ), intent ( out ) :: res real ( pr ), intent ( in ) :: inp res % f0 = inp res % f1 = 0.0_pr res % f2 = 0.0_pr res % f12 = 0.0_pr end subroutine EqualHyperDualReal !------------------------------------------------------------------- !--- Function for the unary operator +. ---------------------------- !------------------------------------------------------------------- elemental function PlusHyperDualHyperDual ( v1 ) result ( v2 ) type ( hyperdual ), intent ( in ) :: v1 type ( hyperdual ) :: v2 v2 % f0 = v1 % f0 v2 % f1 = v1 % f1 v2 % f2 = v1 % f2 v2 % f12 = v1 % f12 end function PlusHyperDualHyperDual !------------------------------------------------------------------- !--- Functions for the addition operator. -------------------------- !------------------------------------------------------------------- elemental function AddHyperDualHyperDual ( v1 , v2 ) result ( v3 ) type ( hyperdual ), intent ( in ) :: v1 , v2 type ( hyperdual ) :: v3 v3 % f0 = v1 % f0 + v2 % f0 v3 % f1 = v1 % f1 + v2 % f1 v3 % f2 = v1 % f2 + v2 % f2 v3 % f12 = v1 % f12 + v2 % f12 end function AddHyperDualHyperDual elemental function AddHyperDualReal ( v1 , v2 ) result ( v3 ) type ( hyperdual ), intent ( in ) :: v1 real ( pr ), intent ( in ) :: v2 type ( hyperdual ) :: v3 v3 % f0 = v1 % f0 + v2 v3 % f1 = v1 % f1 v3 % f2 = v1 % f2 v3 % f12 = v1 % f12 end function AddHyperDualReal elemental function AddRealHyperDual ( v1 , v2 ) result ( v3 ) real ( pr ), intent ( in ) :: v1 type ( hyperdual ), intent ( in ) :: v2 type ( hyperdual ) :: v3 v3 % f0 = v1 + v2 % f0 v3 % f1 = v2 % f1 v3 % f2 = v2 % f2 v3 % f12 = v2 % f12 end function AddRealHyperDual !------------------------------------------------------------------- !--- Function for the unary operator -. ---------------------------- !------------------------------------------------------------------- elemental function MinusHyperDualHyperDual ( v1 ) result ( v2 ) type ( hyperdual ), intent ( in ) :: v1 type ( hyperdual ) :: v2 v2 % f0 = - v1 % f0 v2 % f1 = - v1 % f1 v2 % f2 = - v1 % f2 v2 % f12 = - v1 % f12 end function MinusHyperDualHyperDual !------------------------------------------------------------------- !--- Functions for the subtraction operator. ----------------------- !------------------------------------------------------------------- elemental function SubtractHyperDualHyperDual ( v1 , v2 ) result ( v3 ) type ( hyperdual ), intent ( in ) :: v1 , v2 type ( hyperdual ) :: v3 v3 % f0 = v1 % f0 - v2 % f0 v3 % f1 = v1 % f1 - v2 % f1 v3 % f2 = v1 % f2 - v2 % f2 v3 % f12 = v1 % f12 - v2 % f12 end function SubtractHyperDualHyperDual elemental function SubtractHyperDualReal ( v1 , v2 ) result ( v3 ) type ( hyperdual ), intent ( in ) :: v1 real ( pr ), intent ( in ) :: v2 type ( hyperdual ) :: v3 v3 % f0 = v1 % f0 - v2 v3 % f1 = v1 % f1 v3 % f2 = v1 % f2 v3 % f12 = v1 % f12 end function SubtractHyperDualReal elemental function SubtractRealHyperDual ( v1 , v2 ) result ( v3 ) real ( pr ), intent ( in ) :: v1 type ( hyperdual ), intent ( in ) :: v2 type ( hyperdual ) :: v3 v3 % f0 = v1 - v2 % f0 v3 % f1 = - v2 % f1 v3 % f2 = - v2 % f2 v3 % f12 = - v2 % f12 end function SubtractRealHyperDual !------------------------------------------------------------------- !--- Functions for the multiplication operator. -------------------- !------------------------------------------------------------------- elemental function MultiplyHyperDualHyperDual ( v1 , v2 ) result ( v3 ) type ( hyperdual ), intent ( in ) :: v1 , v2 type ( hyperdual ) :: v3 v3 % f0 = v1 % f0 * v2 % f0 v3 % f1 = v1 % f0 * v2 % f1 + v1 % f1 * v2 % f0 v3 % f2 = v1 % f0 * v2 % f2 + v1 % f2 * v2 % f0 v3 % f12 = v1 % f0 * v2 % f12 + v1 % f1 * v2 % f2 + v1 % f2 * v2 % f1 + v1 % f12 * v2 % f0 end function MultiplyHyperDualHyperDual elemental function MultiplyHyperDualReal ( v1 , v2 ) result ( v3 ) type ( hyperdual ), intent ( in ) :: v1 real ( pr ), intent ( in ) :: v2 type ( hyperdual ) :: v3 v3 % f0 = v1 % f0 * v2 v3 % f1 = v1 % f1 * v2 v3 % f2 = v1 % f2 * v2 v3 % f12 = v1 % f12 * v2 end function MultiplyHyperDualReal elemental function MultiplyRealHyperDual ( v1 , v2 ) result ( v3 ) real ( pr ), intent ( in ) :: v1 type ( hyperdual ), intent ( in ) :: v2 type ( hyperdual ) :: v3 v3 % f0 = v1 * v2 % f0 v3 % f1 = v1 * v2 % f1 v3 % f2 = v1 * v2 % f2 v3 % f12 = v1 * v2 % f12 end function MultiplyRealHyperDual elemental function MultiplyHyperDualInt ( v1 , v2 ) result ( v3 ) type ( hyperdual ), intent ( in ) :: v1 integer , intent ( in ) :: v2 type ( hyperdual ) :: v3 v3 % f0 = v1 % f0 * v2 v3 % f1 = v1 % f1 * v2 v3 % f2 = v1 % f2 * v2 v3 % f12 = v1 % f12 * v2 end function MultiplyHyperDualInt elemental function MultiplyIntHyperDual ( v1 , v2 ) result ( v3 ) integer , intent ( in ) :: v1 type ( hyperdual ), intent ( in ) :: v2 type ( hyperdual ) :: v3 v3 % f0 = v1 * v2 % f0 v3 % f1 = v1 * v2 % f1 v3 % f2 = v1 * v2 % f2 v3 % f12 = v1 * v2 % f12 end function MultiplyIntHyperDual !------------------------------------------------------------------- !--- Functions for the division operator. -------------------------- !------------------------------------------------------------------- elemental function DivideHyperDualHyperDual ( v1 , v2 ) result ( v3 ) type ( hyperdual ), intent ( in ) :: v1 , v2 type ( hyperdual ) :: v3 v3 = v1 * v2 ** ( - 1 ) end function DivideHyperDualHyperDual elemental function DivideHyperDualReal ( v1 , v2 ) result ( v3 ) type ( hyperdual ), intent ( in ) :: v1 real ( pr ), intent ( in ) :: v2 type ( hyperdual ) :: v3 real ( pr ) :: invV2 invV2 = 1.0_pr / v2 v3 = v1 * invV2 end function DivideHyperDualReal elemental function DivideRealHyperDual ( v1 , v2 ) result ( v3 ) real ( pr ), intent ( in ) :: v1 type ( hyperdual ), intent ( in ) :: v2 type ( hyperdual ) :: invV2 , v3 invV2 = 1.0_pr * v2 ** ( - 1.0_pr ) v3 = v1 * invV2 end function DivideRealHyperDual !------------------------------------------------------------------- !--- Functions for the power operator. ----------------------------- !------------------------------------------------------------------- elemental function PowerHyperDualInt ( v1 , v2 ) result ( v3 ) type ( hyperdual ), intent ( in ) :: v1 integer , intent ( in ) :: v2 integer :: i , vv2 type ( hyperdual ) :: v3 v3 = 1.0_pr vv2 = abs ( v2 ) do i = 1 , vv2 v3 = v3 * v1 enddo if ( v2 < 0 ) v3 = 1.0_pr / v3 end function PowerHyperDualInt elemental function PowerHyperDualHyperDual ( v1 , v2 ) result ( v3 ) type ( hyperdual ), intent ( in ) :: v1 , v2 type ( hyperdual ) :: v3 , v4 v4 = logHyperDual ( v1 ) v3 = expHyperDual ( v2 * v4 ) end function PowerHyperDualHyperDual elemental function PowerHyperDualReal ( v1 , v2 ) result ( v3 ) type ( hyperdual ), intent ( in ) :: v1 real ( pr ), intent ( in ) :: v2 type ( hyperdual ) :: v3 real ( pr ), parameter :: tol = 1.0e-15_pr real ( pr ) :: xval , deriv xval = v1 % f0 if ( abs ( xval ) < tol ) then if ( xval >= 0.0_pr ) then xval = tol else xval = - tol endif endif deriv = v2 * ( xval ** ( v2 - 1.0_pr )) v3 % f0 = ( v1 % f0 ) ** v2 v3 % f1 = v1 % f1 * deriv v3 % f2 = v1 % f2 * deriv v3 % f12 = v1 % f12 * deriv & & + v2 * ( v2 - 1.0_pr ) * v1 % f1 * v1 % f2 * xval ** ( v2 - 2.0_pr ) end function PowerHyperDualReal !------------------------------------------------------------------- !--- Sum ----------------------------------------------------------- !------------------------------------------------------------------- pure type ( hyperdual ) function SumHyperDual ( v1 , mask ) type ( hyperdual ), intent ( in ) :: v1 (:) logical , intent ( in ), optional :: mask (:) integer :: i SumHyperDual = hyperdual ( 0.0_pr , 0.0_pr , 0.0_pr , 0.0_pr ) if ( present ( mask )) then do i = 1 , size ( v1 ) if ( mask ( i )) SumHyperDual = SumHyperDual + v1 ( i ) end do else do i = 1 , size ( v1 ) SumHyperDual = SumHyperDual + v1 ( i ) end do end if end function SumHyperDual pure function SumHyperDual2 ( v1 , dim ) type ( hyperdual ), intent ( in ) :: v1 (:,:) integer , intent ( in ) :: dim type ( hyperdual ), allocatable :: SumHyperDual2 (:) integer :: i allocate ( SumHyperDual2 ( size ( v1 ) / size ( v1 , dim ))) SumHyperDual2 = hyperdual ( 0.0_pr , 0.0_pr , 0.0_pr , 0.0_pr ) do i = 1 , size ( v1 , dim ) if ( dim == 1 ) then SumHyperDual2 = SumHyperDual2 + v1 ( i ,:) else SumHyperDual2 = SumHyperDual2 + v1 (:, i ) end if end do end function SumHyperDual2 !------------------------------------------------------------------- !--- Functions for the equal operator. ----------------------------- !------------------------------------------------------------------- logical function eq_dd ( lhs , rhs ) type ( hyperdual ), intent ( in ) :: lhs , rhs eq_dd = lhs % f0 == rhs % f0 end function eq_dd elemental logical function eq_dr ( lhs , rhs ) type ( hyperdual ), intent ( in ) :: lhs real ( pr ), intent ( in ) :: rhs eq_dr = lhs % f0 == rhs end function eq_dr elemental logical function eq_rd ( lhs , rhs ) real ( pr ), intent ( in ) :: lhs type ( hyperdual ), intent ( in ) :: rhs eq_rd = lhs == rhs % f0 end function eq_rd logical function eq_di ( lhs , rhs ) type ( hyperdual ), intent ( in ) :: lhs integer , intent ( in ) :: rhs eq_di = lhs % f0 == rhs end function eq_di logical function eq_id ( lhs , rhs ) integer , intent ( in ) :: lhs type ( hyperdual ), intent ( in ) :: rhs eq_id = lhs == rhs % f0 end function eq_id !------------------------------------------------------------------- !--- Functions for the not equal operator. ------------------------- !------------------------------------------------------------------- logical function ne_dd ( lhs , rhs ) type ( hyperdual ), intent ( in ) :: lhs , rhs ne_dd = lhs % f0 /= rhs % f0 end function ne_dd logical function ne_dr ( lhs , rhs ) type ( hyperdual ), intent ( in ) :: lhs real ( pr ), intent ( in ) :: rhs ne_dr = lhs % f0 /= rhs end function ne_dr logical function ne_rd ( lhs , rhs ) real ( pr ), intent ( in ) :: lhs type ( hyperdual ), intent ( in ) :: rhs ne_rd = lhs /= rhs % f0 end function ne_rd logical function ne_di ( lhs , rhs ) type ( hyperdual ), intent ( in ) :: lhs integer , intent ( in ) :: rhs ne_di = lhs % f0 /= rhs end function ne_di logical function ne_id ( lhs , rhs ) integer , intent ( in ) :: lhs type ( hyperdual ), intent ( in ) :: rhs ne_id = lhs /= rhs % f0 end function ne_id !------------------------------------------------------------------- !--- Functions for the less than operator. ------------------------- !------------------------------------------------------------------- logical function lt_dd ( lhs , rhs ) type ( hyperdual ), intent ( in ) :: lhs , rhs lt_dd = lhs % f0 < rhs % f0 end function lt_dd logical function lt_dr ( lhs , rhs ) type ( hyperdual ), intent ( in ) :: lhs real ( pr ), intent ( in ) :: rhs lt_dr = lhs % f0 < rhs end function lt_dr logical function lt_rd ( lhs , rhs ) real ( pr ), intent ( in ) :: lhs type ( hyperdual ), intent ( in ) :: rhs lt_rd = lhs < rhs % f0 end function lt_rd logical function lt_di ( lhs , rhs ) type ( hyperdual ), intent ( in ) :: lhs integer , intent ( in ) :: rhs lt_di = lhs % f0 < rhs end function lt_di logical function lt_id ( lhs , rhs ) integer , intent ( in ) :: lhs type ( hyperdual ), intent ( in ) :: rhs lt_id = lhs < rhs % f0 end function lt_id !------------------------------------------------------------------- !--- Functions for the less than or equal operator. ---------------- !------------------------------------------------------------------- logical function le_dd ( lhs , rhs ) type ( hyperdual ), intent ( in ) :: lhs , rhs le_dd = lhs % f0 <= rhs % f0 end function le_dd logical function le_dr ( lhs , rhs ) type ( hyperdual ), intent ( in ) :: lhs real ( pr ), intent ( in ) :: rhs le_dr = lhs % f0 <= rhs end function le_dr logical function le_rd ( lhs , rhs ) real ( pr ), intent ( in ) :: lhs type ( hyperdual ), intent ( in ) :: rhs le_rd = lhs <= rhs % f0 end function le_rd logical function le_di ( lhs , rhs ) type ( hyperdual ), intent ( in ) :: lhs integer , intent ( in ) :: rhs le_di = lhs % f0 <= rhs end function le_di logical function le_id ( lhs , rhs ) integer , intent ( in ) :: lhs type ( hyperdual ), intent ( in ) :: rhs le_id = lhs <= rhs % f0 end function le_id !------------------------------------------------------------------- !--- Functions for the greater than operator. ---------------------- !------------------------------------------------------------------- logical function gt_dd ( lhs , rhs ) type ( hyperdual ), intent ( in ) :: lhs , rhs gt_dd = lhs % f0 > rhs % f0 end function gt_dd logical function gt_dr ( lhs , rhs ) type ( hyperdual ), intent ( in ) :: lhs real ( pr ), intent ( in ) :: rhs gt_dr = lhs % f0 > rhs end function gt_dr logical function gt_rd ( lhs , rhs ) real ( pr ), intent ( in ) :: lhs type ( hyperdual ), intent ( in ) :: rhs gt_rd = lhs > rhs % f0 end function gt_rd logical function gt_di ( lhs , rhs ) type ( hyperdual ), intent ( in ) :: lhs integer , intent ( in ) :: rhs gt_di = lhs % f0 > rhs end function gt_di logical function gt_id ( lhs , rhs ) integer , intent ( in ) :: lhs type ( hyperdual ), intent ( in ) :: rhs gt_id = lhs > rhs % f0 end function gt_id !------------------------------------------------------------------- !--- Functions for the greater than or equal operator. ------------- !------------------------------------------------------------------- logical function ge_dd ( lhs , rhs ) type ( hyperdual ), intent ( in ) :: lhs , rhs ge_dd = lhs % f0 >= rhs % f0 end function ge_dd logical function ge_dr ( lhs , rhs ) type ( hyperdual ), intent ( in ) :: lhs real ( pr ), intent ( in ) :: rhs ge_dr = lhs % f0 >= rhs end function ge_dr logical function ge_rd ( lhs , rhs ) real ( pr ), intent ( in ) :: lhs type ( hyperdual ), intent ( in ) :: rhs ge_rd = lhs >= rhs % f0 end function ge_rd logical function ge_di ( lhs , rhs ) type ( hyperdual ), intent ( in ) :: lhs integer , intent ( in ) :: rhs ge_di = lhs % f0 >= rhs end function ge_di logical function ge_id ( lhs , rhs ) integer , intent ( in ) :: lhs type ( hyperdual ), intent ( in ) :: rhs ge_id = lhs >= rhs % f0 end function ge_id !------------------------------------------------------------------- !--- Math functions. ----------------------------------------------- !------------------------------------------------------------------- ! Absolute value function. elemental function absHyperDual ( v1 ) result ( v2 ) type ( hyperdual ), intent ( in ) :: v1 type ( hyperdual ) :: v2 if ( v1 % f0 >= 0.0 ) then v2 % f0 = v1 % f0 v2 % f1 = v1 % f1 v2 % f2 = v1 % f2 v2 % f12 = v1 % f12 else v2 % f0 = - v1 % f0 v2 % f1 = - v1 % f1 v2 % f2 = - v1 % f2 v2 % f12 = - v1 % f12 endif end function absHyperDual ! Integer function. elemental function intHyperDual ( v1 ) result ( v2 ) type ( hyperdual ), intent ( in ) :: v1 integer :: v2 v2 = int ( v1 % f0 ) end function intHyperDual ! Nearest integer function. elemental function nintHyperDual ( v1 ) result ( v2 ) type ( hyperdual ), intent ( in ) :: v1 integer :: v2 v2 = nint ( v1 % f0 ) end function nintHyperDual ! Real function. elemental function realHyperDual ( v1 ) result ( v2 ) type ( hyperdual ), intent ( in ) :: v1 real ( pr ) :: v2 v2 = v1 % f0 end function realHyperDual ! Functions for the sign function. elemental function sign_dd ( v1 , v2 ) result ( v3 ) type ( hyperdual ), intent ( in ) :: v1 , v2 type ( hyperdual ) :: v3 real ( pr ) :: ssign if ( v2 % f0 < 0.0 ) then ssign = - 1.0 else ssign = 1.0 endif v3 = ssign * v1 end function sign_dd elemental function sign_dr ( v1 , v2 ) result ( v3 ) type ( hyperdual ), intent ( in ) :: v1 real ( pr ), intent ( in ) :: v2 type ( hyperdual ) :: v3 real ( pr ) :: ssign if ( v2 < 0.0 ) then ssign = - 1.0 else ssign = 1.0 endif v3 = ssign * v1 end function sign_dr elemental function sign_rd ( v1 , v2 ) result ( v3 ) real ( pr ), intent ( in ) :: v1 type ( hyperdual ), intent ( in ) :: v2 type ( hyperdual ) :: v3 real ( pr ) :: ssign if ( v2 % f0 < 0.0 ) then ssign = - 1.0 else ssign = 1.0 endif v3 = ssign * v1 end function sign_rd ! Sine function. elemental function sinHyperDual ( v1 ) result ( v2 ) type ( hyperdual ), intent ( in ) :: v1 type ( hyperdual ) :: v2 real ( pr ) :: f , dx f = sin ( v1 % f0 ) dx = cos ( v1 % f0 ) v2 % f0 = f v2 % f1 = dx * v1 % f1 v2 % f2 = dx * v1 % f2 v2 % f12 = dx * v1 % f12 - f * v1 % f1 * v1 % f2 end function sinHyperDual ! Cosine function. elemental function cosHyperDual ( v1 ) result ( v2 ) type ( hyperdual ), intent ( in ) :: v1 type ( hyperdual ) :: v2 real ( pr ) :: f , dx f = cos ( v1 % f0 ) dx = - sin ( v1 % f0 ) v2 % f0 = f v2 % f1 = dx * v1 % f1 v2 % f2 = dx * v1 % f2 v2 % f12 = dx * v1 % f12 - f * v1 % f1 * v1 % f2 end function cosHyperDual ! Tangent function. elemental function tanHyperDual ( v1 ) result ( v2 ) type ( hyperdual ), intent ( in ) :: v1 type ( hyperdual ) :: v2 real ( pr ) :: f , dx f = tan ( v1 % f0 ) dx = f * f + 1.0_pr v2 % f0 = f v2 % f1 = dx * v1 % f1 v2 % f2 = dx * v1 % f2 v2 % f12 = dx * v1 % f12 + v1 % f1 * v1 % f2 * 2.0_pr * f * dx end function tanHyperDual ! Sqrt function elemental function sqrtHyperDual ( v1 ) result ( v2 ) type ( hyperdual ), intent ( in ) :: v1 type ( hyperdual ) :: v2 real ( pr ), parameter :: expo = 3.0_pr / 2.0_pr real ( pr ) :: square square = sqrt ( v1 % f0 ) v2 % f0 = square v2 % f1 = 0.5_pr / square * v1 % f1 v2 % f2 = 0.5_pr / square * v1 % f2 v2 % f12 = 0.5_pr * v1 % f12 / square - 0.25_pr * v1 % f1 * v1 % f2 / ( v1 % f0 ** expo ) end function sqrtHyperDual ! Log function elemental function logHyperDual ( v1 ) result ( v2 ) type ( hyperdual ), intent ( in ) :: v1 type ( hyperdual ) :: v2 real ( pr ) :: dx1 , dx2 dx1 = v1 % f1 / v1 % f0 dx2 = v1 % f2 / v1 % f0 v2 % f0 = log ( v1 % f0 ) v2 % f1 = dx1 v2 % f2 = dx2 v2 % f12 = v1 % f12 / v1 % f0 - ( dx1 * dx2 ) end function logHyperDual ! Log10 function elemental function log10HyperDual ( v1 ) result ( v2 ) type ( hyperdual ), intent ( in ) :: v1 type ( hyperdual ) :: v2 v2 = log ( v1 ) / log ( 1 0.0_pr ) end function log10HyperDual ! Exp function elemental function expHyperDual ( v1 ) result ( v2 ) type ( hyperdual ), intent ( in ) :: v1 type ( hyperdual ) :: v2 real ( pr ) :: dx dx = exp ( v1 % f0 ) v2 % f0 = dx v2 % f1 = dx * v1 % f1 v2 % f2 = dx * v1 % f2 v2 % f12 = dx * ( v1 % f12 + v1 % f1 * v1 % f2 ) end function expHyperDual ! Sinh function elemental function sinhHyperDual ( v1 ) result ( v2 ) type ( hyperdual ), intent ( in ) :: v1 type ( hyperdual ) :: t1 , t2 , v2 t1 = exp ( v1 ) t2 = exp ( - v1 ) v2 = 0.5_pr * ( t1 - t2 ) end function sinhHyperDual ! Cosh function elemental function coshHyperDual ( v1 ) result ( v2 ) type ( hyperdual ), intent ( in ) :: v1 type ( hyperdual ) :: t1 , t2 , v2 t1 = exp ( v1 ) t2 = exp ( - v1 ) v2 = 0.5_pr * ( t1 + t2 ) end function coshHyperDual ! Tanh function elemental function tanhHyperDual ( v1 ) result ( v2 ) type ( hyperdual ), intent ( in ) :: v1 type ( hyperdual ) :: t1 , t2 , v2 t1 = exp ( v1 ) t2 = exp ( - v1 ) v2 = ( t1 - t2 ) / ( t1 + t2 ) end function tanhHyperDual ! Acos function elemental function acosHyperDual ( v1 ) result ( v2 ) type ( hyperdual ), intent ( in ) :: v1 type ( hyperdual ) :: v2 real ( pr ) :: deriv , deriv1 deriv1 = 1.0_pr - v1 % f0 * v1 % f0 deriv = - 1.0_pr / sqrt ( deriv1 ) v2 % f0 = acos ( v1 % f0 ) v2 % f1 = deriv * v1 % f1 v2 % f2 = deriv * v1 % f2 v2 % f12 = deriv * v1 % f12 & & + v1 % f1 * v1 % f2 * ( - v1 % f0 * deriv1 ** ( - 1.5_pr )) end function acosHyperDual ! Asin function elemental function asinHyperDual ( v1 ) result ( v2 ) type ( hyperdual ), intent ( in ) :: v1 type ( hyperdual ) :: v2 real ( pr ) :: deriv , deriv1 deriv1 = 1.0_pr - v1 % f0 * v1 % f0 deriv = 1.0_pr / sqrt ( deriv1 ) v2 % f0 = asin ( v1 % f0 ) v2 % f1 = deriv * v1 % f1 v2 % f2 = deriv * v1 % f2 v2 % f12 = deriv * v1 % f12 & & + v1 % f1 * v1 % f2 * ( v1 % f0 * deriv1 ** ( - 1.5_pr )) end function asinHyperDual ! Atan function elemental function atanHyperDual ( v1 ) result ( v2 ) type ( hyperdual ), intent ( in ) :: v1 type ( hyperdual ) :: v2 real ( pr ) :: deriv , deriv1 deriv1 = 1.0_pr + v1 % f0 * v1 % f0 deriv = 1.0_pr / deriv1 v2 % f0 = atan ( v1 % f0 ) v2 % f1 = deriv * v1 % f1 v2 % f2 = deriv * v1 % f2 v2 % f12 = deriv * v1 % f12 & & + v1 % f1 * v1 % f2 * ( - 2.0_pr * v1 % f0 / ( deriv1 * deriv1 )) end function atanHyperDual ! Atan2 function elemental function atan2HyperDual ( v1 , v2 ) result ( v3 ) type ( hyperdual ), intent ( in ) :: v1 , v2 type ( hyperdual ) :: v3 real ( pr ) :: a , b , c , d a = v1 % f0 b = v1 % f1 c = v2 % f0 d = v2 % f1 v3 % f0 = atan2 ( a , c ) v3 % f1 = ( c * b - a * d ) / ( a * a + c * c ) end function atan2HyperDual ! Max functions elemental function max_dd ( v1 , v2 ) result ( v3 ) type ( hyperdual ), intent ( in ) :: v1 , v2 type ( hyperdual ) :: v3 if ( v1 % f0 > v2 % f0 ) then v3 = v1 else v3 = v2 endif end function max_dd elemental function max_ddd ( v1 , v2 , v3 ) result ( v4 ) type ( hyperdual ), intent ( in ) :: v1 , v2 , v3 type ( hyperdual ) :: v4 if ( v1 % f0 > v2 % f0 ) then v4 = v1 else v4 = v2 endif if ( v3 % f0 > v4 % f0 ) v4 = v3 end function max_ddd elemental function max_dr ( v1 , v2 ) result ( v3 ) type ( hyperdual ), intent ( in ) :: v1 real ( pr ), intent ( in ) :: v2 type ( hyperdual ) :: v3 if ( v1 % f0 > v2 ) then v3 = v1 else v3 = v2 endif end function max_dr elemental function max_rd ( v1 , v2 ) result ( v3 ) real ( pr ), intent ( in ) :: v1 type ( hyperdual ), intent ( in ) :: v2 type ( hyperdual ) :: v3 if ( v1 > v2 % f0 ) then v3 = v1 else v3 = v2 endif end function max_rd ! Min functions elemental function min_dd ( v1 , v2 ) result ( v3 ) type ( hyperdual ), intent ( in ) :: v1 , v2 type ( hyperdual ) :: v3 if ( v1 % f0 < v2 % f0 ) then v3 = v1 else v3 = v2 endif end function min_dd elemental function min_dr ( v1 , v2 ) result ( v3 ) type ( hyperdual ), intent ( in ) :: v1 real ( pr ), intent ( in ) :: v2 type ( hyperdual ) :: v3 if ( v1 % f0 < v2 ) then v3 = v1 else v3 = v2 endif end function min_dr elemental function min_rd ( v1 , v2 ) result ( v3 ) real ( pr ), intent ( in ) :: v1 type ( hyperdual ), intent ( in ) :: v2 type ( hyperdual ) :: v3 if ( v1 < v2 % f0 ) then v3 = v1 else v3 = v2 endif end function min_rd end module","tags":"","loc":"sourcefile/hyperdual.f90.html"},{"title":"equilibria_state.f90 – yaeos","text":"Source Code module yaeos__equilibria_equilibrium_state use yaeos__constants , only : pr implicit none type :: EquilibriumState !! Description of a two-phase equilibria state. !! !! Contains the relevant information of an equilibrium point obtained !! from some kind of equilibria calculation. character ( len = 14 ) :: kind !! Kind of point [\"bubble\", \"dew\", \"liquid-liquid\", \"split\"] integer :: iters = 0 !! Iterations needed to reach the state real ( pr ), allocatable :: y (:) !! Light-phase molar fractions real ( pr ), allocatable :: x (:) !! Heavy-phase molar fractions real ( pr ) :: Vx !! Heavy-phase volume [L/mol] real ( pr ) :: Vy !! Light-phase volume [L/mol] real ( pr ) :: T !! Temperature [K] real ( pr ) :: P !! Pressure [bar] real ( pr ) :: beta !! Mole fraction of light-phase contains private procedure , pass :: write => write_EquilibriumState generic , public :: write ( FORMATTED ) => write end type EquilibriumState contains subroutine write_EquilibriumState ( eq , unit , iotype , v_list , iostat , iomsg ) class ( EquilibriumState ), intent ( in ) :: eq integer , intent ( in ) :: unit character ( * ), intent ( in ) :: iotype integer , intent ( in ) :: v_list (:) integer , intent ( out ) :: iostat character ( * ), intent ( inout ) :: iomsg character ( * ), parameter :: nl = new_line ( \"G\" ) write ( unit , * ) eq % kind , eq % T , eq % P , eq % beta , eq % x , eq % y end subroutine write_EquilibriumState end module yaeos__equilibria_equilibrium_state","tags":"","loc":"sourcefile/equilibria_state.f90.html"},{"title":"consistency.f90 – yaeos","text":"Source Code module yaeos__consistency !! # yaeos__consistency !! Subroutine to evaluate the consistency of thermodynamic models. !! !! # Description !! Tools to evaluate the consistency of A^r and G^E models. This !! module also provides subroutines for numerical evaluations of A^r and !! G^E derivatives using central finite differences. The purpose of the !! module is to assist in the development of new models and ensure the !! accuracy of the derivatives implementation. !! !! # Examples !! For detailed explanations and examples of each consistency test, please !! refer to the API documentation of each submodule. !! !! - A^r consistency tests: [[yaeos__consistency_armodel]] !! - G^E consistency tests: [[yaeos__consistency_gemodel]] !! !! # References !! 1. Michelsen, M. L., & Mollerup, J. M. (2007). Thermodynamic models: !! Fundamentals & computational aspects (2. ed). Tie-Line Publications. !! ! Consistency test for ArModels use yaeos__consistency_armodel use yaeos__consistency_gemodel end module yaeos__consistency","tags":"","loc":"sourcefile/consistency.f90.html"},{"title":"tapenade_ar_api.f90 – yaeos","text":"Source Code module yaeos__tapenade_ar_api !! Module that wraps tapenade generated routines to calculate ! !! Ar and derivatives. use yaeos__constants , only : pr use yaeos__models_ar , only : ArModel implicit none private public :: ArModelTapenade type , abstract , extends ( ArModel ) :: ArModelTapenade contains procedure ( tapenade_ar ), deferred :: ar procedure ( tapenade_ar_d ), deferred :: ar_d procedure ( tapenade_ar_b ), deferred :: ar_b procedure ( tapenade_ar_d_b ), deferred :: ar_d_b procedure ( tapenade_ar_d_d ), deferred :: ar_d_d procedure ( tapenade_v0 ), deferred :: v0 procedure :: residual_helmholtz => residual_helmholtz procedure :: get_v0 => get_v0 end type abstract interface subroutine tapenade_ar ( model , n , v , t , arval ) import pr , ArModelTapenade class ( ArModelTapenade ), intent ( in ) :: model real ( pr ), intent ( in ) :: n (:), v , t real ( pr ), intent ( out ) :: arval end subroutine subroutine tapenade_ar_d ( model , n , nd , v , vd , t , td , arval , arvald ) import pr , ArModelTapenade class ( ArModelTapenade ), intent ( in ) :: model real ( pr ), intent ( in ) :: n (:), v , t real ( pr ), intent ( in ) :: nd (:), vd , td real ( pr ), intent ( out ) :: arval , arvald end subroutine subroutine tapenade_ar_b ( model , n , nb , v , vb , t , tb , arval , arvalb ) import pr , ArModelTapenade class ( ArModelTapenade ), intent ( in ) :: model real ( pr ), intent ( in ) :: n (:), v , t real ( pr ) :: arvalb real ( pr ) :: nb (:), vb , tb real ( pr ) :: arval end subroutine subroutine tapenade_ar_d_b ( model , & n , nb , nd , ndb , v , vb , vd , vdb , t , tb , td , tdb , & arval , arvalb , arvald , arvaldb ) import pr , ArModelTapenade class ( ArModelTapenade ), intent ( in ) :: model real ( pr ), intent ( in ) :: n (:), v , t real ( pr ) :: arval real ( pr ), intent ( in ) :: nd (:), vd , td real ( pr ) :: arvald real ( pr ) :: nb (:), vb , tb real ( pr ) :: arvalb real ( pr ) :: ndb (:), vdb , tdb real ( pr ) :: arvaldb end subroutine subroutine tapenade_ar_d_d ( model , n , nd , v , vd0 , vd , t , td0 , td , & arval , arvald0 , arvald , arvaldd ) import pr , ArModelTapenade class ( ArModelTapenade ), intent ( in ) :: model real ( pr ), intent ( in ) :: n (:), v , t real ( pr ), intent ( in ) :: vd0 , td0 real ( pr ), intent ( in ) :: nd (:), vd , td real ( pr ), intent ( out ) :: arval , arvald0 , arvald , arvaldd end subroutine pure function tapenade_v0 ( model , n , p , t ) import pr , ArModelTapenade class ( ArModelTapenade ), intent ( in ) :: model real ( pr ), intent ( in ) :: n (:), p , t real ( pr ) :: tapenade_v0 end function end interface contains subroutine residual_helmholtz (& self , n , v , t , Ar , ArV , ArT , ArTV , ArV2 , ArT2 , Arn , ArVn , ArTn , Arn2 & ) !! Residual Helmholtz model generic interface class ( ArModelTapenade ), intent ( in ) :: self real ( pr ), intent ( in ) :: n (:) real ( pr ), intent ( in ) :: v , t real ( pr ), optional , intent ( out ) :: Ar , ArV , ArT , ArT2 , ArTV , ArV2 real ( pr ), optional , dimension ( size ( n )), intent ( out ) :: Arn , ArVn , ArTn real ( pr ), optional , intent ( out ) :: Arn2 ( size ( n ), size ( n )) real ( pr ) :: df ( size ( n ) + 2 ), df2 ( size ( n ) + 2 , size ( n ) + 2 ) real ( pr ) :: nb ( size ( n )), nd ( size ( n )), ndb ( size ( n )) real ( pr ) :: vb , vd , vdb , vd0 real ( pr ) :: tb , td , tdb , td0 real ( pr ) :: arval , arvalb , arvald , arvaldb , arvald0 , arvaldd integer :: i , nc nc = size ( n ) if ( present ( Arn2 )) then do i = 1 , nc call reset_vars arvaldb = 1 if ( i <= nc ) then nd ( i ) = 1 end if call self % ar_d_b (& n , nb , nd , ndb , & v , vb , vd , vdb , & t , tb , td , tdb , & arval , arvalb , arvald , arvaldb & ) Arn2 ( i , :) = nb end do if ( present ( Arn )) Arn = ndb if ( present ( ArV )) ArV = vdb if ( present ( ArT )) ArT = tdb else if ( present ( Arn )) then call reset_vars arvalb = 1 call self % ar_b ( n , nb , v , vb , t , tb , arval , arvalb ) Arn = nb if ( present ( ArT )) ArT = tb if ( present ( ArV )) ArV = vb end if end if if ( present ( ArTn )) ArTn = get_ArnX ( \"T\" ) if ( present ( ArVn )) ArVn = get_ArnX ( \"V\" ) if ( present ( ArTV )) ArTV = get_dArdX2 ( \"TV\" ) if ( present ( ArT2 )) ArT2 = get_dArdX2 ( \"T2\" ) if ( present ( ArV2 )) ArV2 = get_dArdX2 ( \"V2\" ) if ( present ( Ar )) Ar = arval contains subroutine reset_vars nb = 0 nd = 0 ndb = 0 vb = 0 vd = 0 vd0 = 0 vdb = 0 tb = 0 td = 0 td0 = 0 tdb = 0 arval = 0 arvalb = 0 arvald = 0 arvald0 = 0 arvaldb = 0 end subroutine function get_dArdX2 ( var ) character ( len =* ), intent ( in ) :: var real ( pr ) :: get_dArdX2 call reset_vars select case ( var ) case ( \"TV\" ) vd = 1 td0 = 1 case ( \"V2\" ) vd = 1 vd0 = 1 case ( \"T2\" ) td = 1 td0 = 1 end select call self % ar_d_d (& n , nd , v , vd0 , vd , t , td0 , td , & arval , arvald0 , arvald , arvaldd & ) get_dArdX2 = arvaldd end function function get_ArnX ( var ) character ( len =* ), intent ( in ) :: var real ( pr ) :: get_ArnX ( size ( n )) call reset_vars arvaldb = 1 select case ( var ) case ( \"V\" ) vd = 1 case ( \"T\" ) td = 1 end select call self % ar_d_b (& n , nb , nd , ndb , & v , vb , vd , vdb , & t , tb , td , tdb , & arval , arvalb , arvald , arvaldb & ) get_ArnX = nb end function end subroutine function get_v0 ( self , n , p , t ) class ( ArModelTapenade ), intent ( in ) :: self real ( pr ), intent ( in ) :: n (:), p , t real ( pr ) :: get_v0 get_v0 = self % v0 ( n , p , t ) end function end module","tags":"","loc":"sourcefile/tapenade_ar_api.f90.html"},{"title":"flash.f90 – yaeos","text":"Source Code module yaeos__equilibria_flash use yaeos__constants , only : pr use yaeos__models , only : ArModel use yaeos__equilibria_equilibrium_state , only : EquilibriumState use yaeos__equilibria_rachford_rice , only : betato01 , betalimits , rachford_rice , solve_rr use yaeos__equilibria_auxiliar , only : k_wilson use yaeos__solvers_pressure_equality , only : pressure_equality_V_beta_xy implicit none contains type ( EquilibriumState ) function flash ( model , z , t , v_spec , p_spec , k0 , iters ) !! Flash algorithm using sucessive substitutions. !! !! Available specifications: !! !! - TP (with T and P_spec variables) !! - TV (with T and V_spec variables) !! !! This algorithm assumes that the specified T and P/V correspond to !! vapor-liquid separation predicted by the provided model (00 and g1<0 and therefore 0 1.e-6_pr ) iters = iters + 1 call betato01 ( z , K ) call solve_rr ( z , K , beta , bmin , bmax ) y = z * K / ( 1 + beta * ( K - 1._pr )) x = y / K ! Calculate fugacities for each kind of specification select case ( spec ) case ( \"TV\" ) ! find Vy,Vx (vV and vL) from V balance and P equality equations call pressure_equality_V_beta_xy ( model , T , V , beta , x , y , Vx , Vy , P ) call model % lnphi_pt ( y , P , T , V = Vy , root_type = \"stable\" , lnPhi = lnfug_y ) call model % lnphi_pt ( x , P , T , V = Vx , root_type = \"liquid\" , lnPhi = lnfug_x ) case ( \"TP\" ) call model % lnphi_pt ( y , P , T , V = Vy , root_type = \"stable\" , lnPhi = lnfug_y ) call model % lnphi_pt ( x , P , T , V = Vx , root_type = \"liquid\" , lnPhi = lnfug_x ) end select dKold = dK lnKold = lnK lnK = lnfug_x - lnfug_y dK = lnK - lnKold K = exp ( lnK ) if ( iters > 10 . and . abs ( sum ( dK + dKold )) < 0.05_pr ) then ! oscilation behavior detected (27/06/15) lnK = ( lnK + lnKold ) / 2 end if ! Assure that beta is between the limits call betalimits ( z , K , bmin , bmax ) ! 26/06/15 if (( beta < bmin ) . or . ( bmax < beta )) then beta = ( bmin + bmax ) / 2 end if ! Step is too big, go back if ( maxval ( abs ( dK )) > 1.10_pr ) then ! 26/11/2014 g0 = sum ( z * K ) - 1._pr g1 = 1._pr - sum ( z / K ) if ( g0 < 0 . or . g1 > 0 ) then ! bring beta back to range, by touching K call betato01 ( z , K ) call betalimits ( z , K , bmin , bmax ) beta = ( bmin + bmax ) / 2 ! new guess for beta end if end if if ( iters > 500 ) then p = - 1 exit end if end do ! ======================================================================== ! Format results ! ------------------------------------------------------------------------ if ( spec == 'TP' ) V = beta * Vy + ( 1 - beta ) * Vx if ( maxval ( K ) < 1.001_pr . and . minval ( K ) > 0.999_pr . or . P < 0 ) then ! trivial solution flash % kind = \"failed\" P = - 1.0 flash % x = x / x flash % y = y / y flash % iters = iters flash % P = P flash % T = T return end if flash % kind = \"split\" flash % iters = iters flash % P = P flash % T = T flash % x = x flash % y = y flash % Vx = Vx flash % Vy = Vy flash % beta = beta end function flash end module yaeos__equilibria_flash","tags":"","loc":"sourcefile/flash.f90.html"},{"title":"auxiliar_functions.f90 – yaeos","text":"Source Code module auxiliar_functions use yaeos__constants , only : pr contains elemental function rel_error ( x , y ) real ( pr ), intent ( in ) :: x , y real ( pr ) :: rel_error rel_error = abs ( x - y ) / abs ( x ) end function rel_error function allclose ( x , y , atol ) real ( pr ), intent ( in ) :: x (:) real ( pr ), intent ( in ) :: y (:) real ( pr ), intent ( in ) :: atol logical :: allclose allclose = maxval ( rel_error ( x , y )) < atol end function allclose end module auxiliar_functions","tags":"","loc":"sourcefile/auxiliar_functions.f90.html"},{"title":"pure_psat.f90 – yaeos","text":"Source Code module yaeos__equilibria_pure_psat !! Module used to calculate the saturation pressure of pure components at !! a given temperature. use yaeos__constants , only : pr use yaeos__models , only : ArModel , size contains real ( pr ) function Psat ( eos , ncomp , T ) !! Calculation of saturation pressure of a pure component using the !! secant method. class ( ArModel ), intent ( in ) :: eos !! Model that will be used integer , intent ( in ) :: ncomp !! Number of component in the mixture from which the saturation pressure !! will be calculated real ( pr ), intent ( in ) :: T !! Temperature [K] real ( pr ) :: P1 , P2 real ( pr ) :: f1 , f2 real ( pr ) :: n ( size ( eos )) n = 0 n ( ncomp ) = 1 P1 = 0.5 P2 = 1 do while ( abs ( diff ( P2 )) > 1e-5 ) f1 = diff ( P1 ) f2 = diff ( P2 ) Psat = ( P1 * f2 - P2 * f1 ) / ( f2 - f1 ) P1 = P2 P2 = Psat end do contains real ( pr ) function diff ( P ) real ( pr ), intent ( in ) :: P real ( pr ) :: V_l , V_v real ( pr ) :: phi_v ( size ( eos )), phi_l ( size ( eos )) call eos % lnphi_pt ( n , P , T , V = V_v , lnPhi = phi_v , root_type = \"vapor\" ) call eos % lnphi_pt ( n , P , T , V = V_l , lnPhi = phi_l , root_type = \"liquid\" ) diff = phi_v ( ncomp ) - phi_l ( ncomp ) end function end function Psat end module","tags":"","loc":"sourcefile/pure_psat.f90.html"},{"title":"continuation.f90 – yaeos","text":"Source Code module yaeos__math_continuation !! Implementation of Algower's numerical continuation method. use yaeos__constants , only : pr use yaeos__math_linalg , only : solve_system implicit none type :: ContinuationVariable real ( pr ), allocatable :: X (:) integer :: ns real ( pr ) :: S real ( pr ) :: dS end type abstract interface subroutine continuation_function ( X , ns , S , F , dF , dFdS ) import pr real ( pr ), intent ( in ) :: X (:) integer , intent ( in ) :: ns real ( pr ), intent ( in ) :: S real ( pr ), intent ( out ) :: F (:) real ( pr ), intent ( out ) :: dF (:, :) real ( pr ), intent ( out ) :: dFdS (:) end subroutine continuation_function end interface abstract interface subroutine process ( X , ns , S , dS , dXdS , iterations ) !! Subroutine to make variation in the method after a point converged import pr real ( pr ), intent ( in out ) :: X (:) !! Vector of variables X integer , intent ( in out ) :: ns !! Position of specified variable real ( pr ), intent ( in out ) :: S !! Specification variable value real ( pr ), intent ( in out ) :: dS !! Step of specification in the method real ( pr ), intent ( in out ) :: dXdS (:) !! \\frac{dX}{dS} integer , intent ( in ) :: iterations !! Iterations needed to converge point end subroutine process logical function continuation_stopper ( X , ns , S , dS , dXdS , iterations ) !! Function that returns true if the method should stop import pr real ( pr ), intent ( in out ) :: X (:) !! Vector of variables X integer , intent ( in out ) :: ns !! Position of specified variable real ( pr ), intent ( in out ) :: S !! Specification variable value real ( pr ), intent ( in out ) :: dS !! Step of specification in the method real ( pr ), intent ( in out ) :: dXdS (:) !! \\frac{dX}{dS} integer , intent ( in ) :: iterations !! Iterations needed to converge point end function continuation_stopper end interface abstract interface subroutine continuation_solver (& fun , iters , X , ns , S , dS , dXdS , point , max_iters , F , dF , dFdS , tol & ) !! Solver to solve a point during numerical contination. import pr , continuation_function procedure ( continuation_function ) :: fun !! Function to solve integer , intent ( out ) :: iters !! Number of iterations needed real ( pr ), intent ( in out ) :: X (:) !! Variables vector integer , intent ( in ) :: ns !! Specification number real ( pr ), intent ( in ) :: S !! Specification value real ( pr ), intent ( in ) :: dS !! Delta spec real ( pr ), intent ( in ) :: dXdS (:) !! integer , intent ( in ) :: point !! Point number integer , intent ( in ) :: max_iters !! Maximum iterations real ( pr ), intent ( out ) :: F (:) !! Function values at solved point real ( pr ), intent ( out ) :: df (:, :) !! Jacobian values real ( pr ), intent ( out ) :: dfds (:) !! dFdS real ( pr ), intent ( in ) :: tol !! Solver tolerance end subroutine continuation_solver end interface contains function continuation (& f , X0 , ns0 , S0 , dS0 , max_points , solver_tol , & update_specification , postprocess , solver , stop & ) result ( XS ) !! Numerical continuation of a function. !! !! Uses Algower method of numerical continuation to trace a line that !! solves a system of the kind: !! !! F(X,S) = 0 !! !! Where X is the variables vector and S)\\ is the value of the !! specification. !! The method works with by providing a good set of initial points to !! solve the system of equations with an extrapolation using the previous !! solved point information. procedure ( continuation_function ) :: f !! Function to trace real ( pr ), intent ( in ) :: X0 (:) !! Initial point integer , intent ( in ) :: ns0 !! Initial specification real ( pr ), intent ( in ) :: S0 !! Initial specification value real ( pr ), intent ( in ) :: dS0 !! Initial \\deltaS integer , intent ( in ) :: max_points !! Maximum number of points to trace real ( pr ), intent ( in ) :: solver_tol !! Point solver tolerance procedure ( process ), optional :: update_specification !! Procedure to select the new specification and define the next step !! \\DeltaS)\\, defaults to: !! !! ```fortran !! ns = maxloc(abs(dXdS), dim=1) !! dS = dXdS(ns)*dS !! dXdS = dXdS/dXdS(ns) !! dS = sign(minval(abs([0.05_pr, dS])), dS) !! ``` procedure ( process ), optional :: postprocess !! Any kind of postprocess that could be done after defining the !! next step procedure ( continuation_solver ), optional :: solver !! Solver procedures, uses Newton-Raphson by default procedure ( continuation_stopper ), optional :: stop !! Stopping procedure real ( pr ) :: XS ( max_points , size ( X0 )) real ( pr ) :: X ( size ( X0 )), S , fval ( size ( X0 )), dF ( size ( X0 ), size ( X0 )), dFdS ( size ( X0 )) real ( pr ) :: dXdS ( size ( X0 )) integer :: ns real ( pr ) :: dS integer :: i , newton_its integer :: max_iters = 500 X = X0 ns = ns0 dS = dS0 S = S0 XS = 0 do i = 1 , max_points if ( present ( solver )) then call solver (& f , newton_its , X , ns , S , dS , dXdS , i , max_iters , & fval , dF , dFdS , solver_tol & ) else call full_newton (& f , newton_its , X , ns , S , dS , dXdS , i , max_iters , & fval , dF , dFdS , solver_tol & ) end if if ( newton_its >= max_iters ) exit XS ( i , :) = X dXdS = solve_system ( dF , - dFdS ) if ( present ( update_specification )) then call update_specification ( X , ns , S , dS , dXdS , newton_its ) else ns = maxloc ( abs ( dXdS ), dim = 1 ) dS = dXdS ( ns ) * dS dXdS = dXdS / dXdS ( ns ) dS = sign ( minval ( abs ([ 0.05_pr , dS ])), dS ) end if if ( present ( postprocess )) then call postprocess ( X , ns , S , dS , dXdS , newton_its ) end if if ( present ( stop )) then if ( stop ( X , ns , S , dS , dXdS , newton_its )) exit end if X = X + dXdS * dS S = X ( ns ) end do end function continuation subroutine full_newton (& fun , iters , X , ns , S , dS , dXdS , point , max_iters , F , dF , dFdS , tol & ) !! Subroutine to solve a point. !! !! Procedure that solves a point with the Newton-Raphson method. use stdlib_optval , only : optval use yaeos__math_linalg , only : solve_system procedure ( continuation_function ) :: fun !! Function to solve integer , intent ( out ) :: iters !! Number of iterations needed real ( pr ), intent ( in out ) :: X (:) !! Variables vector integer , intent ( in ) :: ns real ( pr ), intent ( in ) :: S real ( pr ), intent ( in ) :: dS real ( pr ), intent ( in ) :: dXdS (:) integer , intent ( in ) :: point integer , intent ( in ) :: max_iters !! Maximum iterations real ( pr ), intent ( out ) :: F (:) !! Function values at solved point real ( pr ), intent ( out ) :: df (:, :) !! Jacobian values real ( pr ), intent ( out ) :: dfds (:) !! dFdS real ( pr ), intent ( in ) :: tol real ( pr ) :: X0 ( size ( X )) real ( pr ) :: dX ( size ( X )), solve_tol solve_tol = tol dX = 20 F = 500 X0 = X newton : do iters = 1 , max_iters ! Converged point if ( maxval ( abs ( dx )) < tol . or . maxval ( abs ( F )) < 1e-7 ) exit newton call fun ( X , ns , S , F , dF , dFdS ) if ( maxval ( abs ( F )) < tol ) exit dX = solve_system ( dF , - F ) ! Fix the step do while ( maxval ( abs ( dx )) > 0.1 ) dX = dX / 2 end do X = X + dX end do newton end subroutine full_newton ! subroutine levenberg_marquardt(& ! fun, iters, X, ns, S, dS, dXdS, point, max_iters, F, dF, dFdS, tol & ! ) ! use minpack_module, only: lmdif1 ! use stdlib_optval, only: optval ! use yaeos__math_linalg, only: solve_system ! procedure(continuation_function) :: fun !! Function to solve ! integer, intent(out) :: iters !! Number of iterations needed ! real(pr), intent(in out) :: X(:) !! Variables vector ! integer, intent(in) :: ns ! real(pr), intent(in) :: S ! real(pr), intent(in) :: dS ! real(pr), intent(in) :: dXdS(:) ! integer, intent(in) :: point ! integer, intent(in) :: max_iters !! Maximum iterations ! real(pr), intent(out) :: F(:) !! Function values at solved point ! real(pr), intent(out) :: df(:, :) !! Jacobian values ! real(pr), intent(out) :: dfds(:) !! dFdS ! real(pr), intent(in) :: tol ! integer :: m, n, info, iwa(size(x)) ! integer :: lwa ! real(pr) :: wa(size(F) * size(x) + 5*size(x) + size(f)) ! m = size(F) ! n = size(x) ! lwa = size(F) * size(x)+5*size(x)+size(f) ! call lmdif1(fcn, m, n, x, F, tol, Info, Iwa, Wa, Lwa) ! contains ! subroutine fcn(m, n, xx, fvec, iflag) ! integer, intent(in) :: m, n ! real(pr), intent(in) :: xx(n) ! real(pr), intent(out) :: fvec(m) ! integer, intent(in out) :: iflag ! call fun(xx, ns, S, fvec, dF, dFdS) ! end subroutine ! end subroutine end module yaeos__math_continuation","tags":"","loc":"sourcefile/continuation.f90.html"},{"title":"nrtl.f90 – yaeos","text":"Source Code module yaeos__models_ge_NRTL use yaeos__tapenade_ge_api , only : gemodeltapenade use yaeos__tapenade_interfaces use yaeos__constants , only : pr , R implicit none type , extends ( GeModelTapenade ) :: NRTL !! Non-Random-Two-Liquid model !! !! !! G^E = nRT \\cdot \\sum_i x_i \\frac{\\sum_j x_j \\tau_{ji} G_{ji}}{\\sum_j x_j G_{ji}} !! !! !! with: !! !! \\tau_{ij} = A_{ij} + \\frac{B_{ij}}{T} !! !! G_{ij} = -\\frac{C}{tau_ij} real ( pr ), allocatable :: a (:, :) !! A_{ij} matrix real ( pr ), allocatable :: b (:, :) !! B_{ij} matrix real ( pr ), allocatable :: c (:, :) !! C_{ij} matrix contains procedure :: ge => excess_gibbs procedure :: ge_b => excess_gibbs_b procedure :: ge_d => excess_gibbs_d procedure :: ge_d_b => excess_gibbs_d_b procedure :: ge_d_d => excess_gibbs_d_d end type NRTL interface NRTL module procedure :: init end interface contains type ( NRTL ) function init ( a , b , c ) real ( pr ), intent ( in ) :: a (:, :) real ( pr ), intent ( in ) :: b (:, :) real ( pr ), intent ( in ) :: c (:, :) init % a = a init % b = b init % c = c end function subroutine EXCESS_GIBBS_D_D_D ( model , n , nd , t , td1 , td0 , td , ge , ged1 & & , ged0 , ged0d , ged , gedd0 , gedd , geddd ) implicit none class ( NRTL ) :: model real ( pr ), intent ( IN ) :: n (:) real ( pr ), intent ( IN ) :: nd (:) real ( pr ), intent ( IN ) :: t real ( pr ), intent ( IN ) :: td1 real ( pr ), intent ( IN ) :: td0 real ( pr ), intent ( IN ) :: td real ( pr ), intent ( OUT ) :: ge real ( pr ), intent ( OUT ) :: ged1 real ( pr ), intent ( OUT ) :: ged0 real ( pr ), intent ( OUT ) :: ged0d real ( pr ), intent ( OUT ) :: ged real ( pr ), intent ( OUT ) :: gedd0 real ( pr ), intent ( OUT ) :: gedd real ( pr ), intent ( OUT ) :: geddd real ( pr ) :: x ( size ( n )), g ( size ( n ), size ( n )), tau ( size ( n ), size ( n )) real ( pr ) :: gd1 ( size ( n ), size ( n )), taud1 ( size ( n ), size ( n )) real ( pr ) :: gd0 ( size ( n ), size ( n )), taud0 ( size ( n ), size ( n )) real ( pr ) :: gd0d ( size ( n ), size ( n )), taud0d ( size ( n ), size ( n )) real ( pr ) :: xd ( size ( n )), gd ( size ( n ), size ( n )), taud ( size ( n ), size ( n )) real ( pr ) :: gdd0 ( size ( n ), size ( n )), taudd0 ( size ( n ), size ( n )) real ( pr ) :: gdd ( size ( n ), size ( n )), taudd ( size ( n ), size ( n )) real ( pr ) :: gddd ( size ( n ), size ( n )), tauddd ( size ( n ), size ( n )) real ( pr ) :: a ( size ( n ), size ( n )), b ( size ( n ), size ( n )), c ( size ( n ), size (& & n )) real ( pr ) :: down integer :: i , j intrinsic SUM intrinsic EXP intrinsic SIZE real ( pr ), dimension ( size ( n )) :: arg1 real ( pr ), dimension ( size ( n )) :: arg1d1 real ( pr ), dimension ( size ( n )) :: arg1d0 real ( pr ), dimension ( size ( n )) :: arg1d0d real ( pr ), dimension ( size ( n )) :: arg1d real ( pr ), dimension ( size ( n )) :: arg1dd0 real ( pr ), dimension ( size ( n )) :: arg1dd real ( pr ), dimension ( size ( n )) :: arg1ddd real ( pr ), dimension ( size ( n )) :: arg2 real ( pr ), dimension ( size ( n )) :: arg2d1 real ( pr ), dimension ( size ( n )) :: arg2d0 real ( pr ), dimension ( size ( n )) :: arg2d0d real ( pr ), dimension ( size ( n )) :: arg2d real ( pr ), dimension ( size ( n )) :: arg2dd0 real ( pr ), dimension ( size ( n )) :: arg2dd real ( pr ), dimension ( size ( n )) :: arg2ddd real ( pr ) :: temp real ( pr ) :: tempd0 real ( pr ) :: tempd real ( pr ) :: tempdd real ( pr ) :: temp0 real ( pr ) :: temp0d0 real ( pr ) :: temp0d real ( pr ) :: temp0dd real ( pr ) :: temp1 real ( pr ) :: temp1d0 real ( pr ) :: temp1d real ( pr ) :: temp1dd real ( pr ), dimension ( size ( b , 1 ), size ( b , 2 )) :: temp2 real ( pr ), dimension ( size ( b , 1 ), size ( b , 2 )) :: temp2d real ( pr ), dimension ( size ( n ), size ( n )) :: temp3 real ( pr ), dimension ( size ( n ), size ( n )) :: temp3d real ( pr ), dimension ( size ( n )) :: temp4 real ( pr ), dimension ( size ( n )) :: temp4d real ( pr ) :: temp5 real ( pr ) :: temp5d real ( pr ) :: temp6 real ( pr ) :: temp6d real ( pr ), dimension ( size ( b , 1 ), size ( b , 2 )) :: temp7 real ( pr ), dimension ( size ( n ), size ( n )) :: temp8 real ( pr ), dimension ( size ( n )) :: temp9 real ( pr ) :: temp10 real ( pr ) :: temp11 temp = sum ( n ) xd = ( nd - n * sum ( nd ) / temp ) / temp x = n / temp temp7 = model % b (:, :) * td / ( t * t ) temp2d = - ( temp7 * 2 * td1 / t ) temp2 = temp7 tauddd = td0 * 2 * ( temp2d - temp2 * td1 / t ) / t taudd = temp2 * 2 * td0 / t taudd0 = - temp2d taud = - temp2 temp7 = model % b (:, :) * td0 / ( t * t ) taud0d = temp7 * 2 * td1 / t taud0 = - temp7 taud1 = - ( model % b (:, :) * td1 / t ** 2 ) tau = model % a (:, :) + model % b (:, :) / t temp3d = - ( exp ( - ( model % c * tau )) * model % c * taud1 ) temp3 = exp ( - ( model % c * tau )) temp8 = exp ( - ( model % c * tau )) gddd = - ( model % c * ( taudd * temp3d + temp3 * tauddd - model % c * ( temp8 * ( taud0 * & & taudd0 + taud * taud0d ) - taud * taud0 * exp ( - ( model % c * tau )) * model % c * taud1 ))& & ) gdd = - ( model % c * ( temp3 * taudd - model % c * ( temp8 * ( taud * taud0 )))) gdd0 = - ( model % c * ( taud * temp3d + temp3 * taudd0 )) gd = - ( model % c * ( temp3 * taud )) temp8 = exp ( - ( model % c * tau )) gd0d = - ( model % c * ( temp8 * taud0d - taud0 * exp ( - ( model % c * tau )) * model % c * & & taud1 )) gd0 = - ( model % c * ( temp8 * taud0 )) gd1 = - ( exp ( - ( model % c * tau )) * model % c * taud1 ) g = exp ( - ( model % c * tau )) ge = 0 ged = 0.0_pr gedd = 0.0_pr ged0 = 0.0_pr gedd0 = 0.0_pr geddd = 0.0_pr ged0d = 0.0_pr ged1 = 0.0_pr do i = 1 , size ( n ) temp4d = xd (:) * taud1 (:, i ) + x (:) * taudd0 (:, i ) temp4 = xd (:) * tau (:, i ) + x (:) * taud (:, i ) temp9 = xd (:) * taud0 (:, i ) + x (:) * taudd (:, i ) arg1ddd (:) = gd0 (:, i ) * temp4d + temp4 * gd0d (:, i ) + temp9 * gd1 (:, i )& & + g (:, i ) * ( xd (:) * taud0d (:, i ) + x (:) * tauddd (:, i )) + x (:) * ( taud0 (:& & , i ) * gdd0 (:, i ) + gd (:, i ) * taud0d (:, i ) + gdd (:, i ) * taud1 (:, i ) + tau (& & :, i ) * gddd (:, i )) arg1dd (:) = temp4 * gd0 (:, i ) + g (:, i ) * temp9 + x (:) * ( gd (:, i ) * taud0 & & (:, i ) + tau (:, i ) * gdd (:, i )) arg1dd0 (:) = temp4 * gd1 (:, i ) + g (:, i ) * temp4d + x (:) * ( gd (:, i ) * & & taud1 (:, i ) + tau (:, i ) * gdd0 (:, i )) arg1d (:) = g (:, i ) * temp4 + x (:) * ( tau (:, i ) * gd (:, i )) arg1d0d (:) = x (:) * ( taud0 (:, i ) * gd1 (:, i ) + g (:, i ) * taud0d (:, i ) + gd0 (& & :, i ) * taud1 (:, i ) + tau (:, i ) * gd0d (:, i )) arg1d0 (:) = x (:) * ( g (:, i ) * taud0 (:, i ) + tau (:, i ) * gd0 (:, i )) arg1d1 (:) = x (:) * ( g (:, i ) * taud1 (:, i ) + tau (:, i ) * gd1 (:, i )) arg1 (:) = x (:) * tau (:, i ) * g (:, i ) arg2ddd (:) = xd (:) * gd0d (:, i ) + x (:) * gddd (:, i ) arg2dd (:) = xd (:) * gd0 (:, i ) + x (:) * gdd (:, i ) arg2dd0 (:) = xd (:) * gd1 (:, i ) + x (:) * gdd0 (:, i ) arg2d (:) = g (:, i ) * xd (:) + x (:) * gd (:, i ) arg2d0d (:) = x (:) * gd0d (:, i ) arg2d0 (:) = x (:) * gd0 (:, i ) arg2d1 (:) = x (:) * gd1 (:, i ) arg2 (:) = x (:) * g (:, i ) tempdd = sum ( arg2d0d (:)) tempd = sum ( arg2d0 (:)) tempd0 = sum ( arg2d1 (:)) temp = sum ( arg2 (:)) temp0dd = sum ( arg1d0d (:)) temp0d = sum ( arg1d0 (:)) temp0d0 = sum ( arg1d1 (:)) temp0 = sum ( arg1 (:)) temp10 = temp0 * tempd / temp temp11 = ( temp0d - temp10 ) / temp temp1dd = x ( i ) * ( temp0dd - ( tempd * temp0d0 + temp0 * tempdd - temp10 * tempd0 )& & / temp - temp11 * tempd0 ) / temp temp1d = x ( i ) * temp11 temp1d0 = x ( i ) * ( temp0d0 - temp0 * tempd0 / temp ) / temp temp1 = x ( i ) * temp0 / temp temp5d = sum ( arg2dd0 (:)) temp5 = sum ( arg2d (:)) temp11 = ( xd ( i ) * temp0 + x ( i ) * sum ( arg1d (:)) - temp1 * temp5 ) / temp temp6d = ( xd ( i ) * temp0d0 + x ( i ) * sum ( arg1dd0 (:)) - temp5 * temp1d0 - temp1 * & & temp5d - temp11 * tempd0 ) / temp temp6 = temp11 temp11 = sum ( arg2dd (:)) temp10 = ( xd ( i ) * temp0d + x ( i ) * sum ( arg1dd (:)) - temp5 * temp1d - temp1 * & & temp11 - temp6 * tempd ) / temp geddd = geddd + ( xd ( i ) * temp0dd + x ( i ) * sum ( arg1ddd (:)) - temp1d * temp5d - & & temp5 * temp1dd - temp11 * temp1d0 - temp1 * sum ( arg2ddd (:)) - tempd * temp6d - & & temp6 * tempdd - temp10 * tempd0 ) / temp gedd = gedd + temp10 gedd0 = gedd0 + temp6d ged = ged + temp6 ged0d = ged0d + temp1dd ged0 = ged0 + temp1d ged1 = ged1 + temp1d0 ge = ge + temp1 end do temp1 = sum ( n ) temp6 = sum ( nd ) geddd = r * ( temp6 * ( td0 * ged1 + ged0 * td1 + t * ged0d ) + temp1 * ( td * ged0d + td0 * & & gedd0 + gedd * td1 + t * geddd )) gedd = r * ( temp6 * ( ge * td0 + t * ged0 ) + temp1 * ( td * ged0 + ged * td0 + t * gedd )) gedd0 = r * ( temp6 * ( ge * td1 + t * ged1 ) + temp1 * ( td * ged1 + ged * td1 + t * gedd0 )) ged = r * ( temp6 * ( t * ge ) + temp1 * ( td * ge + t * ged )) ged0d = r * temp1 * ( td0 * ged1 + ged0 * td1 + t * ged0d ) ged0 = r * temp1 * ( ge * td0 + t * ged0 ) ged1 = r * temp1 * ( ge * td1 + t * ged1 ) ge = r * ( temp1 * ( t * ge )) end subroutine EXCESS_GIBBS_D_D_D subroutine EXCESS_GIBBS_D_D ( model , n , nd , t , td0 , td , ge , ged0 , ged , & & gedd ) implicit none class ( NRTL ) :: model real ( pr ), intent ( IN ) :: n (:) real ( pr ), intent ( IN ) :: nd (:) real ( pr ), intent ( IN ) :: t real ( pr ), intent ( IN ) :: td0 real ( pr ), intent ( IN ) :: td real ( pr ), intent ( OUT ) :: ge real ( pr ), intent ( OUT ) :: ged0 real ( pr ), intent ( OUT ) :: ged real ( pr ), intent ( OUT ) :: gedd real ( pr ) :: x ( size ( n )), g ( size ( n ), size ( n )), tau ( size ( n ), size ( n )) real ( pr ) :: gd0 ( size ( n ), size ( n )), taud0 ( size ( n ), size ( n )) real ( pr ) :: xd ( size ( n )), gd ( size ( n ), size ( n )), taud ( size ( n ), size ( n )) real ( pr ) :: gdd ( size ( n ), size ( n )), taudd ( size ( n ), size ( n )) real ( pr ) :: a ( size ( n ), size ( n )), b ( size ( n ), size ( n )), c ( size ( n ), size (& & n )) real ( pr ) :: down integer :: i , j intrinsic SUM intrinsic EXP intrinsic SIZE real ( pr ), dimension ( size ( n )) :: arg1 real ( pr ), dimension ( size ( n )) :: arg1d0 real ( pr ), dimension ( size ( n )) :: arg1d real ( pr ), dimension ( size ( n )) :: arg1dd real ( pr ), dimension ( size ( n )) :: arg2 real ( pr ), dimension ( size ( n )) :: arg2d0 real ( pr ), dimension ( size ( n )) :: arg2d real ( pr ), dimension ( size ( n )) :: arg2dd real ( pr ) :: temp real ( pr ) :: tempd real ( pr ) :: temp0 real ( pr ) :: temp0d real ( pr ) :: temp1 real ( pr ) :: temp1d real ( pr ), dimension ( size ( b , 1 ), size ( b , 2 )) :: temp2 real ( pr ), dimension ( size ( n ), size ( n )) :: temp3 real ( pr ), dimension ( size ( n )) :: temp4 real ( pr ) :: temp5 real ( pr ) :: temp6 temp = sum ( n ) xd = ( nd - n * sum ( nd ) / temp ) / temp x = n / temp temp2 = model % b (:, :) * td / ( t * t ) taudd = temp2 * 2 * td0 / t taud = - temp2 taud0 = - ( model % b (:, :) * td0 / t ** 2 ) tau = model % a (:, :) + model % b (:, :) / t temp3 = exp ( - ( model % c * tau )) gdd = - ( model % c * ( temp3 * taudd - taud * exp ( - ( model % c * tau )) * model % c * taud0 )& & ) gd = - ( model % c * ( temp3 * taud )) gd0 = - ( exp ( - ( model % c * tau )) * model % c * taud0 ) g = exp ( - ( model % c * tau )) ge = 0 ged = 0.0_pr gedd = 0.0_pr ged0 = 0.0_pr do i = 1 , size ( n ) temp4 = xd (:) * tau (:, i ) + x (:) * taud (:, i ) arg1dd (:) = temp4 * gd0 (:, i ) + g (:, i ) * ( xd (:) * taud0 (:, i ) + x (:) * & & taudd (:, i )) + x (:) * ( gd (:, i ) * taud0 (:, i ) + tau (:, i ) * gdd (:, i )) arg1d (:) = g (:, i ) * temp4 + x (:) * ( tau (:, i ) * gd (:, i )) arg1d0 (:) = x (:) * ( g (:, i ) * taud0 (:, i ) + tau (:, i ) * gd0 (:, i )) arg1 (:) = x (:) * tau (:, i ) * g (:, i ) arg2dd (:) = xd (:) * gd0 (:, i ) + x (:) * gdd (:, i ) arg2d (:) = g (:, i ) * xd (:) + x (:) * gd (:, i ) arg2d0 (:) = x (:) * gd0 (:, i ) arg2 (:) = x (:) * g (:, i ) tempd = sum ( arg2d0 (:)) temp = sum ( arg2 (:)) temp0d = sum ( arg1d0 (:)) temp0 = sum ( arg1 (:)) temp1d = x ( i ) * ( temp0d - temp0 * tempd / temp ) / temp temp1 = x ( i ) * temp0 / temp temp5 = sum ( arg2d (:)) temp6 = ( xd ( i ) * temp0 + x ( i ) * sum ( arg1d (:)) - temp1 * temp5 ) / temp gedd = gedd + ( xd ( i ) * temp0d + x ( i ) * sum ( arg1dd (:)) - temp5 * temp1d - temp1 & & * sum ( arg2dd (:)) - temp6 * tempd ) / temp ged = ged + temp6 ged0 = ged0 + temp1d ge = ge + temp1 end do temp1 = sum ( n ) temp6 = sum ( nd ) gedd = r * ( temp6 * ( ge * td0 + t * ged0 ) + temp1 * ( td * ged0 + ged * td0 + t * gedd )) ged = r * ( temp6 * ( t * ge ) + temp1 * ( td * ge + t * ged )) ged0 = r * temp1 * ( ge * td0 + t * ged0 ) ge = r * ( temp1 * ( t * ge )) end subroutine EXCESS_GIBBS_D_D subroutine EXCESS_GIBBS_D_B ( model , n , nb , nd , ndb , t , tb , td , tdb , ge & & , geb , ged , gedb ) implicit none class ( NRTL ) :: model real ( pr ), intent ( IN ) :: n (:) real ( pr ) :: nb (:) real ( pr ), intent ( IN ) :: nd (:) real ( pr ) :: ndb (:) real ( pr ), intent ( IN ) :: t real ( pr ) :: tb real ( pr ), intent ( IN ) :: td real ( pr ) :: tdb real ( pr ) :: ge real ( pr ) :: geb real ( pr ) :: ged real ( pr ) :: gedb real ( pr ) :: x ( size ( n )), g ( size ( n ), size ( n )), tau ( size ( n ), size ( n )) real ( pr ) :: xb ( size ( n )), gb ( size ( n ), size ( n )), taub ( size ( n ), size ( n )) real ( pr ) :: xd ( size ( n )), gd ( size ( n ), size ( n )), taud ( size ( n ), size ( n )) real ( pr ) :: xdb ( size ( n )), gdb ( size ( n ), size ( n )), taudb ( size ( n ), size ( n & & )) real ( pr ) :: a ( size ( n ), size ( n )), b ( size ( n ), size ( n )), c ( size ( n ), size (& & n )) real ( pr ) :: down integer :: i , j intrinsic SUM intrinsic EXP intrinsic SIZE real ( pr ), dimension ( size ( n )) :: arg1 real ( pr ), dimension ( size ( n )) :: arg1b real ( pr ), dimension ( size ( n )) :: arg1d real ( pr ), dimension ( size ( n )) :: arg1db real ( pr ), dimension ( size ( n )) :: arg2 real ( pr ), dimension ( size ( n )) :: arg2b real ( pr ), dimension ( size ( n )) :: arg2d real ( pr ), dimension ( size ( n )) :: arg2db real ( pr ) :: temp real ( pr ) :: tempb real ( pr ) :: temp0 real ( pr ) :: temp0b real ( pr ) :: temp1 real ( pr ) :: temp1b real ( pr ), dimension ( size ( n , 1 )) :: tempb0 real ( pr ), dimension ( size ( n , 1 )) :: temp2 real ( pr ) :: temp3 real ( pr ), dimension ( size ( n , 1 )) :: tempb1 real ( pr ) :: tempb2 real ( pr ), dimension ( size ( n )) :: tempb3 real ( pr ) :: temp4 real ( pr ) :: temp5 real ( pr ) :: tempb4 real ( pr ) :: tempb5 integer :: ad_to integer :: arg10 real ( pr ) :: result1 temp = sum ( n ) xd = ( nd - n * sum ( nd ) / temp ) / temp x = n / temp taud = - ( model % b (:, :) * td / t ** 2 ) tau = model % a (:, :) + model % b (:, :) / t gd = - ( exp ( - ( model % c * tau )) * model % c * taud ) g = exp ( - ( model % c * tau )) ge = 0 ged = 0.0_pr do i = 1 , size ( n ) arg10 = size ( n ) call PUSHREAL8ARRAY ( arg1d , arg10 ) arg1d (:) = g (:, i ) * ( tau (:, i ) * xd (:) + x (:) * taud (:, i )) + x (:) * tau (:& & , i ) * gd (:, i ) arg1 (:) = x (:) * tau (:, i ) * g (:, i ) arg2d (:) = g (:, i ) * xd (:) + x (:) * gd (:, i ) arg2 (:) = x (:) * g (:, i ) call PUSHREAL8 ( temp ) temp = sum ( arg2 (:)) call PUSHREAL8 ( temp0 ) temp0 = sum ( arg1 (:)) temp1 = x ( i ) * temp0 / temp ged = ged + ( temp0 * xd ( i ) + x ( i ) * sum ( arg1d (:)) - temp1 * sum ( arg2d (:))) / & & temp ge = ge + temp1 end do call PUSHINTEGER4 ( i - 1 ) temp1 = sum ( n ) tempb4 = r * geb geb = temp1 * t * tempb4 temp1b = t * ge * tempb4 tb = tb + temp1 * ge * tempb4 tempb4 = r * gedb tempb5 = sum ( nd ) * tempb4 ndb = ndb + t * ge * tempb4 temp1b = temp1b + ( ge * td + t * ged ) * tempb4 tempb2 = temp1 * tempb4 gedb = t * tempb2 geb = geb + td * tempb2 + t * tempb5 tdb = tdb + ge * tempb2 tb = tb + ged * tempb2 + ge * tempb5 nb = nb + temp1b taudb = 0.0_pr taub = 0.0_pr gb = 0.0_pr xdb = 0.0_pr xb = 0.0_pr gdb = 0.0_pr call POPINTEGER4 ( ad_to ) do i = ad_to , 1 , - 1 tempb2 = gedb / temp arg2d (:) = g (:, i ) * xd (:) + x (:) * gd (:, i ) temp5 = sum ( arg2d (:)) temp1 = x ( i ) * temp0 / temp temp1b = geb - temp5 * tempb2 arg1db = 0.0_pr arg2db = 0.0_pr temp4 = sum ( arg1d (:)) temp0b = xd ( i ) * tempb2 xdb ( i ) = xdb ( i ) + temp0 * tempb2 xb ( i ) = xb ( i ) + temp4 * tempb2 + temp0 * temp1b / temp arg1db = x ( i ) * tempb2 arg2db = - ( temp1 * tempb2 ) tempb = - (( temp0 * xd ( i ) + x ( i ) * temp4 - temp1 * temp5 ) * tempb2 / temp ) tempb2 = x ( i ) * temp1b / temp temp0b = temp0b + tempb2 tempb = tempb - temp0 * tempb2 / temp arg1b = 0.0_pr call POPREAL8 ( temp0 ) arg1b = temp0b arg2b = 0.0_pr call POPREAL8 ( temp ) arg2b = tempb gb (:, i ) = gb (:, i ) + x * arg2b + xd * arg2db + x * tau (:, i ) * arg1b + (& & tau (:, i ) * xd + x * taud (:, i )) * arg1db gdb (:, i ) = gdb (:, i ) + x * arg2db + x * tau (:, i ) * arg1db arg10 = size ( n ) call POPREAL8ARRAY ( arg1d , arg10 ) tempb3 = g (:, i ) * arg1db xb = xb + g (:, i ) * arg2b + gd (:, i ) * arg2db + tau (:, i ) * g (:, i ) * & & arg1b + tau (:, i ) * gd (:, i ) * arg1db + taud (:, i ) * tempb3 xdb = xdb + g (:, i ) * arg2db + tau (:, i ) * tempb3 taub (:, i ) = taub (:, i ) + x * g (:, i ) * arg1b + x * gd (:, i ) * arg1db + xd & & * tempb3 taudb (:, i ) = taudb (:, i ) + x * tempb3 end do temp3 = sum ( nd ) tempb0 = xdb / temp tempb1 = - ( temp3 * tempb0 / temp ) temp2 = n / temp result1 = sum (( nd - temp3 * temp2 ) * tempb0 ) tempb = - ( sum ( n * xb ) / temp ** 2 ) - result1 / temp - sum ( temp2 * tempb1 ) taub = taub + model % c ** 2 * exp ( - ( model % c * tau )) * taud * gdb - model % c * exp (& & - ( model % c * tau )) * gb taudb = taudb - exp ( - ( model % c * tau )) * model % c * gdb tempb2 = - ( sum ( model % b * taudb ) / t ** 2 ) tb = tb - sum ( model % b * taub ) / t ** 2 - 2 * td * tempb2 / t tdb = tdb + tempb2 nb = nb + xb / temp + tempb1 + tempb ndb = ndb + tempb0 - sum ( temp2 * tempb0 ) gedb = 0.0_pr geb = 0.0_pr end subroutine EXCESS_GIBBS_D_B subroutine EXCESS_GIBBS_D ( model , n , nd , t , td , ge , ged ) implicit none class ( NRTL ) :: model real ( pr ), intent ( IN ) :: n (:) real ( pr ), intent ( IN ) :: nd (:) real ( pr ), intent ( IN ) :: t real ( pr ), intent ( IN ) :: td real ( pr ), intent ( OUT ) :: ge real ( pr ), intent ( OUT ) :: ged real ( pr ) :: x ( size ( n )), g ( size ( n ), size ( n )), tau ( size ( n ), size ( n )) real ( pr ) :: xd ( size ( n )), gd ( size ( n ), size ( n )), taud ( size ( n ), size ( n )) real ( pr ) :: a ( size ( n ), size ( n )), b ( size ( n ), size ( n )), c ( size ( n ), size (& & n )) real ( pr ) :: down integer :: i , j intrinsic SUM intrinsic EXP intrinsic SIZE real ( pr ), dimension ( size ( n )) :: arg1 real ( pr ), dimension ( size ( n )) :: arg1d real ( pr ), dimension ( size ( n )) :: arg2 real ( pr ), dimension ( size ( n )) :: arg2d real ( pr ) :: temp real ( pr ) :: temp0 real ( pr ) :: temp1 temp = sum ( n ) xd = ( nd - n * sum ( nd ) / temp ) / temp x = n / temp taud = - ( model % b (:, :) * td / t ** 2 ) tau = model % a (:, :) + model % b (:, :) / t gd = - ( exp ( - ( model % c * tau )) * model % c * taud ) g = exp ( - ( model % c * tau )) ge = 0 ged = 0.0_pr do i = 1 , size ( n ) arg1d (:) = g (:, i ) * ( tau (:, i ) * xd (:) + x (:) * taud (:, i )) + x (:) * tau (:& & , i ) * gd (:, i ) arg1 (:) = x (:) * tau (:, i ) * g (:, i ) arg2d (:) = g (:, i ) * xd (:) + x (:) * gd (:, i ) arg2 (:) = x (:) * g (:, i ) temp = sum ( arg2 (:)) temp0 = sum ( arg1 (:)) temp1 = x ( i ) * temp0 / temp ged = ged + ( temp0 * xd ( i ) + x ( i ) * sum ( arg1d (:)) - temp1 * sum ( arg2d (:))) / & & temp ge = ge + temp1 end do temp1 = sum ( n ) ged = r * ( t * ge * sum ( nd ) + temp1 * ( ge * td + t * ged )) ge = r * ( temp1 * ( t * ge )) end subroutine EXCESS_GIBBS_D subroutine EXCESS_GIBBS_B ( model , n , nb , t , tb , ge , geb ) implicit none class ( NRTL ) :: model real ( pr ), intent ( IN ) :: n (:) real ( pr ) :: nb (:) real ( pr ), intent ( IN ) :: t real ( pr ) :: tb real ( pr ) :: ge real ( pr ) :: geb real ( pr ) :: x ( size ( n )), g ( size ( n ), size ( n )), tau ( size ( n ), size ( n )) real ( pr ) :: xb ( size ( n )), gb ( size ( n ), size ( n )), taub ( size ( n ), size ( n )) real ( pr ) :: a ( size ( n ), size ( n )), b ( size ( n ), size ( n )), c ( size ( n ), size (& & n )) real ( pr ) :: down integer :: i , j intrinsic SUM intrinsic EXP intrinsic SIZE real ( pr ), dimension ( size ( n )) :: arg1 real ( pr ), dimension ( size ( n )) :: arg1b real ( pr ), dimension ( size ( n )) :: arg2 real ( pr ), dimension ( size ( n )) :: arg2b real ( pr ) :: temp real ( pr ) :: tempb real ( pr ) :: temp0 real ( pr ) :: tempb0 integer :: ad_to x = n / sum ( n ) tau = model % a (:, :) + model % b (:, :) / t g = exp ( - ( model % c * tau )) ge = 0 do i = 1 , size ( n ) arg1 (:) = x (:) * tau (:, i ) * g (:, i ) arg2 (:) = x (:) * g (:, i ) ge = ge + x ( i ) * sum ( arg1 (:)) / sum ( arg2 (:)) end do call PUSHINTEGER4 ( i - 1 ) nb = 0.0_pr nb = t * ge * r * geb tempb0 = sum ( n ) * r * geb geb = t * tempb0 tb = ge * tempb0 taub = 0.0_pr gb = 0.0_pr xb = 0.0_pr call POPINTEGER4 ( ad_to ) do i = ad_to , 1 , - 1 arg1 (:) = x (:) * tau (:, i ) * g (:, i ) arg2 (:) = x (:) * g (:, i ) arg1b = 0.0_pr arg2b = 0.0_pr temp = sum ( arg2 (:)) temp0 = sum ( arg1 (:)) tempb = geb / temp xb ( i ) = xb ( i ) + temp0 * tempb arg1b = x ( i ) * tempb arg2b = - ( x ( i ) * temp0 * tempb / temp ) xb = xb + g (:, i ) * arg2b + tau (:, i ) * g (:, i ) * arg1b gb (:, i ) = gb (:, i ) + x * arg2b + x * tau (:, i ) * arg1b taub (:, i ) = taub (:, i ) + x * g (:, i ) * arg1b end do taub = taub - model % c * exp ( - ( model % c * tau )) * gb tb = tb - sum ( model % b * taub ) / t ** 2 temp = sum ( n ) nb = nb + xb / temp - sum ( n * xb ) / temp ** 2 geb = 0.0_pr end subroutine EXCESS_GIBBS_B subroutine EXCESS_GIBBS ( model , n , t , ge ) implicit none class ( NRTL ) :: model real ( pr ), intent ( IN ) :: n (:) real ( pr ), intent ( IN ) :: t real ( pr ), intent ( OUT ) :: ge real ( pr ) :: x ( size ( n )), g ( size ( n ), size ( n )), tau ( size ( n ), size ( n )) real ( pr ) :: a ( size ( n ), size ( n )), b ( size ( n ), size ( n )), c ( size ( n ), size (& & n )) real ( pr ) :: down integer :: i , j intrinsic SUM intrinsic EXP intrinsic SIZE real ( pr ), dimension ( size ( n )) :: arg1 real ( pr ), dimension ( size ( n )) :: arg2 x = n / sum ( n ) tau = model % a (:, :) + model % b (:, :) / t g = exp ( - ( model % c * tau )) ge = 0 do i = 1 , size ( n ) arg1 (:) = x (:) * tau (:, i ) * g (:, i ) arg2 (:) = x (:) * g (:, i ) ge = ge + x ( i ) * sum ( arg1 (:)) / sum ( arg2 (:)) end do ge = sum ( n ) * r * t * ge end subroutine EXCESS_GIBBS end module yaeos__models_ge_NRTL","tags":"","loc":"sourcefile/nrtl.f90.html"},{"title":"math.f90 – yaeos","text":"Source Code module yaeos__math !! # Mathematical methods for `yaeos` !! !! # Description !! This module provides all the relevant mathematical functions used in this !! library. Most important ones are: !! !! - newton: Newton solving method !! - solve_system: Solving linear system Ax = b !! - continuation: Continuation method for line tracing !! !! # Examples !! !! ## Squared error calculation !! ```fortran !! use yaeos__math, only: sq_error !! real(pr) :: x = 2.5, y = 3.0, error !! print *, sq_error(2.5, 3.0) !! ------------------------------------ !! ``` !! !! ```fortran !! use yaeos__math, only: sq_error !! real(pr) :: x = [2.5, 5.0], y = [3.0, 4.5], error !! ! It also works with arrays !! print *, sq_error(x, y) !! ``` use yaeos__math_continuation , only : continuation use yaeos__math_linalg , only : solve_system , cubic_roots use yaeos__constants , only : pr implicit none abstract interface subroutine f_1d ( x , f , df ) import pr real ( pr ), intent ( in ) :: x real ( pr ), intent ( out ) :: f real ( pr ), intent ( out ) :: df end subroutine f_1d end interface interface newton module procedure :: newton_1d end interface newton contains elemental real ( pr ) function sq_error ( exp , pred ) !! # Squared error between two values. !! !! # Description !! ... !! !! # Examples !! !! ```fortran !! error = sq_error(true_value, model_value) !! ``` use yaeos__constants , only : pr real ( pr ), intent ( in ) :: exp real ( pr ), intent ( in ) :: pred sq_error = (( exp - pred ) / exp ) ** 2 end function sq_error function dx_to_dn ( x , dx ) result ( dn ) !! # dx_to_dn !! !! # Description !! Convert the mole fraction derivatives of a quantity (calculated !! so they do not sum to 1) to mole number derivatives (where the mole !! fractions do sum to one). Requires the derivatives and the mole fractions !! of the mixture. !! From [https://chemicals.readthedocs.io/chemicals.utils.html?highlight=dxs_to_dns#chemicals.utils.dxs_to_dns](Chemicals (Python)) use yaeos__constants , only : pr real ( pr ), intent ( in ) :: x (:) real ( pr ), intent ( in ) :: dx (:) real ( pr ) :: dn ( size ( x )) real ( pr ) :: sum_xdx dn = 0 sum_xdx = sum ( x * dx ) dn = dx - sum_xdx end function dx_to_dn subroutine newton_1d ( f , x , tol , max_iters ) procedure ( f_1d ) :: f real ( pr ), intent ( in out ) :: x real ( pr ), intent ( in ) :: tol integer , intent ( in ) :: max_iters integer :: i real ( pr ) :: fval , df , step fval = 10 step = 10 do i = 1 , max_iters if ( abs ( fval ) < tol . or . abs ( step ) < tol ) exit call f ( x , fval , df ) step = fval / df do while ( abs ( step ) > 0.5 * abs ( x )) step = step / 2 end do x = x - step end do end subroutine newton_1d end module yaeos__math","tags":"","loc":"sourcefile/math.f90.html"},{"title":"consistency_armodel.f90 – yaeos","text":"Source Code module yaeos__consistency_armodel !! # yaeos__consistency_armodel !! Consistency checks of Helmholtz free energy models ([[ArModel]]). !! !! # Description !! This module contains tools to validate the analityc derivatives of !! implmented Helmholtz free energy models ([[ArModel]]). Also, allows to !! evaluate the consistency tests described in Thermodynamic Models: !! Fundamentals & Computational Aspects 2 ed. by Michelsen and Mollerup !! Chapter 2 section 3. !! !! Available tools: !! !! - [[numeric_ar_derivatives]]: From an instantiated [[ArModel]] evaluate !! all the Helmholtz free energy derivatives from the central finite !! difference method. !! !! - [[ar_consistency]]: From an instantiated [[ArModel]] evaluate all the !! Michelsen and Mollerup consistency tests. !! !! # References !! 1. Michelsen, M. L., & Mollerup, J. M. (2007). Thermodynamic models: !! Fundamentals & computational aspects (2. ed). Tie-Line Publications. !! use yaeos__constants , only : pr , R use yaeos__models_ar , only : ArModel implicit none contains subroutine ar_consistency (& eos , n , V , T , eq31 , eq33 , eq34 , eq36 , eq37 & ) !! # ar_consistency !! A^r models consistency tests. !! !! # Description !! The evaluated equations are taken from Fundamentals & Computational !! Aspects 2 ed. by Michelsen and Mollerup Chapter 2 section 3. The !! \"eq\" are evaluations of the left hand side of the following !! expressions: !! !! Equation 31: !! !! \\sum_i n_i ln \\hat{\\phi}_i - \\frac{G^r(T,P,n)}{RT} = 0 !! !! Equation 33: !! !! !! \\left(\\frac{\\partial ln \\hat{\\phi}_i}{\\partial n_j} \\right)_{T,P} !! - \\left(\\frac{\\partial ln \\hat{\\phi}_j}{\\partial n_i} \\right)_{T,P} !! = 0 !! !! !! Equation 34: !! !! !! \\sum_i n_i !! \\left(\\frac{\\partial ln \\hat{\\phi}_i}{\\partial n_j} \\right)_{T,P} !! = 0 !! !! !! Equation 36: !! !! !! \\left(\\frac{\\partial}{\\partial P} !! \\sum_i n_i ln \\hat{\\phi}_i \\right)_{T,n} - \\frac{(Z - 1)n}{P} = 0 !! !! !! Equation 37: !! !! !! \\sum_i n_i \\left(\\frac{\\partial ln \\hat{\\phi}_i}{\\partial T} !! \\right)_{P,n} + \\frac{H^r(T,P,n)}{RT^2} = 0 !! !! !! The consistency test could be applied to any instantiated [[ArModel]] !! as shown in the following example. !! !! # Examples !! !! ```fortran !! use yaeos, only: pr, SoaveRedlichKwong, ArModel !! use yaeos__consistency_armodel, only: ar_consistency !! !! class(ArModel), allocatable :: model !! real(pr) :: tc(4), pc(4), w(4) !! !! real(pr) :: n(4), T, V !! !! real(pr) :: eq31, eq33(size(n), size(n)), eq34(size(n)), eq36, eq37 !! !! n = [1.5, 0.2, 0.7, 2.3] !! tc = [190.564, 425.12, 300.11, 320.25] !! pc = [45.99, 37.96, 39.23, 40.21] !! w = [0.0115478, 0.200164, 0.3624, 0.298] !! !! T = 600_pr !! V = 0.5_pr !! !! model = SoaveRedlichKwong(tc, pc, w) !! !! call ar_consistency(& !! model, n, V, T, eq31=eq31, eq33=eq33, eq34=eq34, eq36=eq36, eq37=eq37 & !! ) !! ``` !! All `eqXX` variables should be close to zero. !! !! # References !! 1. Michelsen, M. L., & Mollerup, J. M. (2007). Thermodynamic models: !! Fundamentals & computational aspects (2. ed). Tie-Line Publications. !! class ( ArModel ), intent ( in ) :: eos !! Equation of state real ( pr ), intent ( in ) :: n (:) !! Moles number vector real ( pr ), intent ( in ) :: T !! Temperature [K] real ( pr ), intent ( in ) :: V !! Volume [L] real ( pr ), optional , intent ( out ) :: eq31 !! MM Eq. 31 ! TODO real(pr), optional, intent(out) :: eq32 real ( pr ), optional , intent ( out ) :: eq33 ( size ( n ), size ( n )) !! MM Eq. 33 real ( pr ), optional , intent ( out ) :: eq34 ( size ( n )) !! MM Eq. 34 real ( pr ), optional , intent ( out ) :: eq36 !! MM Eq. 36 real ( pr ), optional , intent ( out ) :: eq37 !! MM Eq. 37 integer i , j ! ======================================================================== ! Previous calculations ! ------------------------------------------------------------------------ real ( pr ) :: Grp , Grv , Hrv , P , dPdn ( size ( n )), ntot , z real ( pr ) :: lnphi ( size ( n )), dlnPhidP ( size ( n )) real ( pr ) :: dlnPhidT ( size ( n )), dlnPhidn ( size ( n ), size ( n )) call eos % pressure ( n , V , T , P , dPdn = dPdn ) call eos % gibbs_residual_vt ( n , V , T , Grv ) call eos % enthalpy_residual_vt ( n , V , T , Hr = Hrv ) call eos % lnphi_vt (& n , V , T , lnPhi = lnPhi , & dlnPhidP = dlnPhidP , dlnPhidT = dlnPhidT , dlnPhidn = dlnPhidn & ) ntot = sum ( n ) z = P * V / ntot / R / T Grp = Grv - ntot * R * T * log ( Z ) ! ======================================================================== ! Equation 31 ! ------------------------------------------------------------------------ if ( present ( eq31 )) eq31 = sum ( n (:) * lnPhi (:)) - Grp / ( R * T ) ! ======================================================================== ! Equation 32 ! ------------------------------------------------------------------------ ! TODO ! ======================================================================== ! Equation 33 ! ------------------------------------------------------------------------ if ( present ( eq33 )) then do i = 1 , size ( n ), 1 do j = 1 , size ( n ), 1 eq33 ( i , j ) = dlnPhidn ( i , j ) - dlnPhidn ( j , i ) end do end do end if ! ======================================================================== ! Equation 34 ! ------------------------------------------------------------------------ if ( present ( eq34 )) then eq34 = 0.0_pr do j = 1 , size ( n ), 1 do i = 1 , size ( n ), 1 eq34 ( j ) = eq34 ( j ) + n ( i ) * dlnPhidn ( i , j ) end do end do end if ! ======================================================================== ! Equation 36 ! ------------------------------------------------------------------------ if ( present ( eq36 )) eq36 = sum ( n (:) * dlnPhidP (:)) - ( z - 1 ) * ntot / P ! ======================================================================== ! Equation 37 ! ------------------------------------------------------------------------ if ( present ( eq37 )) then eq37 = sum ( n (:) * dlnPhidT (:)) + Hrv / ( R * T ** 2 ) end if end subroutine ar_consistency subroutine numeric_ar_derivatives (& eos , n , V , T , d_n , d_v , d_t , & Ar , ArV , ArT , Arn , ArV2 , ArT2 , ArTV , ArVn , ArTn , Arn2 & ) !! # numeric_ar_derivatives !! Evaluate the Helmholtz derivatives with central finite difference. !! !! # Description !! Tool to facilitate the development of new [[ArModel]] by testing !! the implementation of analytic derivatives. !! !! # Examples !! !! ```fortran !! use yaeos, only: pr, SoaveRedlichKwong, ArModel !! use yaeos__consistency_armodel, only: numeric_ar_derivatives !! !! class(ArModel), allocatable :: model !! real(pr) :: tc(4), pc(4), w(4) !! !! real(pr) :: n(4), T, V !! !! real(pr) :: Ar_num, ArV_num, ArT_num, Arn_num(size(n)), ArV2_num, ArT2_num !! real(pr) :: ArTV_num, ArVn_num(size(n)), ArTn_num(size(n)) !! real(pr) :: Arn2_num(size(n), size(n)) !! !! n = [1.5, 0.2, 0.7, 2.3] !! tc = [190.564, 425.12, 300.11, 320.25] !! pc = [45.99, 37.96, 39.23, 40.21] !! w = [0.0115478, 0.200164, 0.3624, 0.298] !! !! T = 600_pr !! V = 0.5_pr !! !! model = SoaveRedlichKwong(tc, pc, w) !! !! call numeric_ar_derivatives(& !! model, n, V, T, d_n = 0.0001_pr, d_v = 0.0001_pr, d_t = 0.01_pr, & !! Ar=Ar_num, ArV=ArV_num, ArT=ArT_num, ArTV=ArTV_num, ArV2=ArV2_num, & !! ArT2=ArT2_num, Arn=Arn_num, ArVn=ArVn_num, ArTn=ArTn_num, & !! Arn2=Arn2_num & !! ) !! ``` !! class ( ArModel ), intent ( in ) :: eos !! Equation of state real ( pr ), intent ( in ) :: n (:) !! Moles number vector real ( pr ), intent ( in ) :: T !! Temperature [K] real ( pr ), intent ( in ) :: V !! Volume [L] real ( pr ), intent ( in ) :: d_n !! Moles finite difference step real ( pr ), intent ( in ) :: d_t !! Temperature finite difference step real ( pr ), intent ( in ) :: d_v !! Volume finite difference step real ( pr ), intent ( out ) :: Ar !! Residual Helmoltz energy real ( pr ), optional , intent ( out ) :: ArV !! \\frac{dAr}{dV} real ( pr ), optional , intent ( out ) :: ArT !! \\frac{dAr}{dT} real ( pr ), optional , intent ( out ) :: Arn ( size ( n )) !! \\frac{dAr}{dn_i} real ( pr ), optional , intent ( out ) :: ArV2 !! \\frac{d^2Ar}{dV^2} real ( pr ), optional , intent ( out ) :: ArT2 !! \\frac{d^2Ar}{dT^2} real ( pr ), optional , intent ( out ) :: ArTV !! \\frac{d^2Ar}{dTdV} real ( pr ), optional , intent ( out ) :: ArVn ( size ( n )) !! \\frac{d^2Ar}{dVdn_i} real ( pr ), optional , intent ( out ) :: ArTn ( size ( n )) !! \\frac{d^2Ar}{dTdn_i} real ( pr ), optional , intent ( out ) :: Arn2 ( size ( n ), size ( n )) !! \\frac{d^2Ar}{dn_{ij}} ! Auxiliary real ( pr ) :: Ar_aux1 , Ar_aux2 , Ar_aux3 , Ar_aux4 real ( pr ) :: dn_aux1 ( size ( n )), dn_aux2 ( size ( n )) integer :: i , j ! ======================================================================== ! Ar valuations ! ------------------------------------------------------------------------ ! on point valuation call eos % residual_helmholtz ( n , V , T , Ar = Ar ) ! ======================================================================== ! Central numeric derivatives ! ------------------------------------------------------------------------ ! Volume if ( present ( ArV ) . or . present ( ArV2 )) then call eos % residual_helmholtz ( n , V + d_v , T , Ar = Ar_aux1 ) call eos % residual_helmholtz ( n , V - d_v , T , Ar = Ar_aux2 ) if ( present ( ArV )) ArV = ( Ar_aux1 - Ar_aux2 ) / ( 2 * d_v ) if ( present ( ArV2 )) ArV2 = ( Ar_aux1 - 2 * Ar + Ar_aux2 ) / d_v ** 2 end if ! Temperature if ( present ( ArT ) . or . present ( ArT2 )) then call eos % residual_helmholtz ( n , V , T + d_t , Ar = Ar_aux1 ) call eos % residual_helmholtz ( n , V , T - d_t , Ar = Ar_aux2 ) if ( present ( ArT )) ArT = ( Ar_aux1 - Ar_aux2 ) / ( 2 * d_t ) if ( present ( ArT2 )) ArT2 = ( Ar_aux1 - 2 * Ar + Ar_aux2 ) / d_t ** 2 end if ! Mole first derivatives if ( present ( Arn )) then Arn = 0.0_pr do i = 1 , size ( n ), 1 dn_aux1 = 0.0_pr dn_aux1 ( i ) = d_n call eos % residual_helmholtz ( n + dn_aux1 , V , T , Ar = Ar_aux1 ) call eos % residual_helmholtz ( n - dn_aux1 , V , T , Ar = Ar_aux2 ) Arn ( i ) = ( Ar_aux1 - Ar_aux2 ) / ( 2 * d_n ) end do end if ! ======================================================================== ! Central cross derivatives ! ------------------------------------------------------------------------ ! Temperature - Volume if ( present ( ArTV )) then call eos % residual_helmholtz ( n , V + d_v , T + d_t , Ar = Ar_aux1 ) call eos % residual_helmholtz ( n , V + d_v , T - d_t , Ar = Ar_aux2 ) call eos % residual_helmholtz ( n , V - d_v , T + d_t , Ar = Ar_aux3 ) call eos % residual_helmholtz ( n , V - d_v , T - d_t , Ar = Ar_aux4 ) ArTV = ( Ar_aux1 - Ar_aux2 - Ar_aux3 + Ar_aux4 ) / ( 4 * d_t * d_v ) end if ! Temperature - Mole if ( present ( ArTn )) then ArTn = 0.0_pr do i = 1 , size ( n ), 1 dn_aux1 = 0.0_pr dn_aux1 ( i ) = d_n call eos % residual_helmholtz ( n + dn_aux1 , V , T + d_t , Ar = Ar_aux1 ) call eos % residual_helmholtz ( n + dn_aux1 , V , T - d_t , Ar = Ar_aux2 ) call eos % residual_helmholtz ( n - dn_aux1 , V , T + d_t , Ar = Ar_aux3 ) call eos % residual_helmholtz ( n - dn_aux1 , V , T - d_t , Ar = Ar_aux4 ) ArTn ( i ) = & ( Ar_aux1 - Ar_aux2 - Ar_aux3 + Ar_aux4 ) / ( 4 * d_t * d_n ) end do end if ! Volume - Mole if ( present ( ArVn )) then ArVn = 0.0_pr do i = 1 , size ( n ), 1 dn_aux1 = 0.0_pr dn_aux1 ( i ) = d_n call eos % residual_helmholtz ( n + dn_aux1 , V + d_v , T , Ar = Ar_aux1 ) call eos % residual_helmholtz ( n + dn_aux1 , V - d_v , T , Ar = Ar_aux2 ) call eos % residual_helmholtz ( n - dn_aux1 , V + d_v , T , Ar = Ar_aux3 ) call eos % residual_helmholtz ( n - dn_aux1 , V - d_v , T , Ar = Ar_aux4 ) ArVn ( i ) = & ( Ar_aux1 - Ar_aux2 - Ar_aux3 + Ar_aux4 ) / ( 4 * d_v * d_n ) end do end if ! Mole second derivatives if ( present ( Arn2 )) then Arn2 = 0.0_pr do i = 1 , size ( n ), 1 do j = 1 , size ( n ), 1 if ( i . eq . j ) then dn_aux1 = 0.0_pr dn_aux1 ( i ) = d_n call eos % residual_helmholtz ( n + dn_aux1 , V , T , Ar = Ar_aux1 ) call eos % residual_helmholtz ( n - dn_aux1 , V , T , Ar = Ar_aux2 ) Arn2 ( i , j ) = ( Ar_aux1 - 2 * Ar + Ar_aux2 ) / d_n ** 2 else dn_aux1 = 0.0_pr dn_aux2 = 0.0_pr dn_aux1 ( i ) = d_n dn_aux2 ( j ) = d_n call eos % residual_helmholtz (& n + dn_aux1 + dn_aux2 , V , T , Ar = Ar_aux1 & ) call eos % residual_helmholtz (& n + dn_aux1 - dn_aux2 , V , T , Ar = Ar_aux2 & ) call eos % residual_helmholtz (& n - dn_aux1 + dn_aux2 , V , T , Ar = Ar_aux3 & ) call eos % residual_helmholtz (& n - dn_aux1 - dn_aux2 , V , T , Ar = Ar_aux4 & ) Arn2 ( i , j ) = & ( Ar_aux1 - Ar_aux2 - Ar_aux3 + Ar_aux4 ) / ( 4 * d_n ** 2 ) end if end do end do end if end subroutine numeric_ar_derivatives end module yaeos__consistency_armodel","tags":"","loc":"sourcefile/consistency_armodel.f90.html"},{"title":"stability.f90 – yaeos","text":"Source Code module yaeos__phase_equilibria_stability !! # Phase Stability module !! Phase stability related calculations. !! !! # Description !! Contains the basics rotuines to make phase stability analysis for !! phase-equilibria detection. !! !! - `tpd(model, z, w, P, T)`: reduced Tangent-Plane-Distance !! - `min_tpd(model, z, P, T, mintpd, w)`: Find minimal tpd for a multicomponent mixture !! !! # Examples !! !! ```fortran !! ! Obtain the minimal tpd for a binary mixture at z_1 = 0.13 !! model = PengRobinson76(tc, pc, ac, kij, lij) !! !! z = [0.13, 1-0.13] !! w = [0.1, 0.9] !! !! P = 45.6_pr !! T = 190._pr !! !! z = z/sum(z) !! ----------------------------------------------- !! ``` !! !! # References !! 1. Thermodynamic Models: Fundamental and Computational Aspects, Michael L. !! Michelsen, Jørgen M. Mollerup. Tie-Line Publications, Denmark (2004) !! [doi](http://dx.doi.org/10.1016/j.fluid.2005.11.032) use yaeos__constants , only : pr , r use yaeos__models_ar , only : ArModel implicit none type , private :: TMOptimizeData !! Data structure to hold the data for the `min_tpd` optimization class ( ArModel ), pointer :: model real ( pr ), allocatable :: z (:) real ( pr ), allocatable :: di (:) real ( pr ) :: P , T end type contains real ( pr ) function tm ( model , z , w , P , T , d , dtpd ) !! # Alternative formulation of tangent-plane-distance !! Michelsen's modified tpd function, tm. !! !! # Description !! Alternative formulation of the reduced tangent plane tpd function, !! where the test phase is defined in moles, which enables for unconstrained !! minimization. !! !! tm(W) = 1 + \\sum_i W_i (\\ln W_i + \\ln \\phi_i(W) - d_i - 1) !! !! !! # Examples !! !! ## Calculation of `tm` !! ```fortran !! tm = tpd(model, z, w, P, T) !! --------------------------- !! ``` !! !! ## Using precalculated trial-phase data !! It is possible to calculate externaly the `d_i` vector and use it for !! later calculations. !! ```fortran !! call fugacity_tp(& !! model, z, T=T, P=P, V=Vz, root_type=\"stable\", lnphip=lnphi_z& !! ) !! lnphi_z = lnphi_z - log(P) !! di = log(z) + lnphi_z !! tm = tpd(model, z, w, P, T, d=di) !! --------------------------- !! ``` !! !! # References !! 1. Thermodynamic Models: Fundamental and Computational Aspects, Michael L. !! Michelsen, Jørgen M. Mollerup. Tie-Line Publications, Denmark (2004) !! [doi](http://dx.doi.org/10.1016/j.fluid.2005.11.032) class ( ArModel ), intent ( in ) :: model !! Thermodynamic model real ( pr ), intent ( in ) :: z (:) !! Feed composition real ( pr ), intent ( in ) :: w (:) !! Test-phase mole numbers vector real ( pr ), intent ( in ) :: P !! Pressure [bar] real ( pr ), intent ( in ) :: T !! Temperature [K] real ( pr ), optional , intent ( in ) :: d (:) !! d_i vector real ( pr ), optional , intent ( out ) :: dtpd (:) real ( pr ) :: di ( size ( z )), vz , vw real ( pr ) :: lnphi_z ( size ( z )), lnphi_w ( size ( z )) call model % lnphi_pt (& w , T = T , P = P , V = Vw , root_type = \"stable\" , lnPhi = lnPhi_w & ) if (. not . present ( d )) then call model % lnphi_pt (& z , T = T , P = P , V = Vz , root_type = \"stable\" , lnPhi = lnPhi_z & ) di = log ( z ) + lnphi_z else di = d end if ! tpd = sum(w * (log(w) + lnphi_w - di)) tm = 1 + sum ( w * ( log ( w ) + lnPhi_w - di - 1 )) if ( present ( dtpd )) then dtpd = log ( w ) + lnPhi_w - di end if end function tm subroutine min_tpd ( model , z , P , T , mintpd , w , all_minima ) use yaeos__optimizers_powell_wrap , only : PowellWrapper class ( ArModel ), target :: model !! Thermodynamic model real ( pr ), intent ( in ) :: z (:) !! Feed composition real ( pr ), intent ( in ) :: P !! Pressure [bar] real ( pr ), intent ( in ) :: T !! Temperature [K] real ( pr ), intent ( out ) :: w (:) !! Trial composition real ( pr ), intent ( out ) :: mintpd !! Minimal value of tm real ( pr ), optional , intent ( out ) :: all_minima (:, :) !! All the found minima type ( PowellWrapper ) :: opt type ( TMOptimizeData ) :: data real ( pr ) :: dx ( size ( w )) real ( pr ) :: lnphi_z ( size ( z )), di ( size ( z )) real ( pr ) :: mins ( size ( w )), ws ( size ( w ), size ( w )), V integer :: i integer :: stat dx = 0.001_pr ! Calculate feed di call model % lnphi_pt ( z , T = T , P = P , V = V , root_type = \"stable\" , lnPhi = lnPhi_z ) di = log ( z ) + lnphi_z ! ============================================================== ! Minimize for each component using each quasi-pure component ! as initialization. ! -------------------------------------------------------------- data % model => model data % di = di data % P = P data % T = T data % z = z opt % parameter_step = dx !$OMP PARALLEL DO PRIVATE(i, w, mintpd, stat) SHARED(opt, ws, mins) do i = 1 , size ( w ) w = 0.001_pr w ( i ) = 0.999_pr call opt % optimize ( min_tpd_to_optimize , w , mintpd , data = data ) mins ( i ) = mintpd ws ( i , :) = w end do !$OMP END PARALLEL DO i = minloc ( mins , dim = 1 ) mintpd = mins ( i ) w = ws ( i , :) if ( present ( all_minima )) all_minima = ws end subroutine min_tpd subroutine min_tpd_to_optimize ( X , F , dF , data ) real ( pr ), intent ( in ) :: X (:) real ( pr ), intent ( out ) :: F real ( pr ), optional , intent ( out ) :: dF (:) class ( * ), optional , intent ( in out ) :: data select type ( data ) type is ( TMOptimizeData ) F = tm ( data % model , data % z , X , data % P , data % T , d = data % di ) end select end subroutine end module yaeos__phase_equilibria_stability","tags":"","loc":"sourcefile/stability.f90.html"},{"title":"phase_envelopes_px.f90 – yaeos","text":"Source Code module yaeos__equilibria_boundaries_phase_envelopes_px !! Phase boundaries line on the P\\alpha plane calculation procedures. use yaeos__constants , only : pr use yaeos__models , only : ArModel use yaeos__equilibria_equilibrium_state , only : EquilibriumState use yaeos__math_continuation , only : & continuation , continuation_solver , continuation_stopper implicit none type :: CriticalPoint !! Critical point real ( pr ) :: alpha !! \\alpha real ( pr ) :: P !! Pressure [bar] end type CriticalPoint type :: PXEnvel2 !! Two-phase PX envelope. !! Phase boundary line of a fluid at constant temperature !! with variation in composition. real ( pr ), allocatable :: alpha (:) !! Second fluid molar fraction real ( pr ), allocatable :: z0 (:) !! Original fluid composition real ( pr ), allocatable :: z_inj (:) !! Second fluid composition type ( EquilibriumState ), allocatable :: points (:) !! Each point through the line. type ( CriticalPoint ), allocatable :: cps (:) !! Critical points found along the line. end type PXEnvel2 ! Private volumes of each phase to share between functions real ( pr ), private :: Vz !! Main phase volume [L/mol] real ( pr ), private :: Vy !! Incipient phase volume [L/mol] contains function px_envelope_2ph (& model , z0 , alpha0 , z_injection , first_point , & points , iterations , delta_0 , specified_variable_0 , & solver , stop_conditions & ) result ( envelopes ) !! PX two-phase envelope calculation procedure. !! !! Phase envelope calculation using the continuation method. !! Defaults to solving the saturation temperature and continues with !! an increment in it. The variable to specify can be changed by modifying !! `specified_variable_0` with the corresponding variable number. ! ======================================================================== use stdlib_optval , only : optval class ( ArModel ), intent ( in ) :: model !! Thermodyanmic model real ( pr ), intent ( in ) :: z0 (:) !! Vector of molar fractions of the global composition (main phase) real ( pr ), intent ( in ) :: alpha0 !! First point of alpha real ( pr ), intent ( in ) :: z_injection (:) !! Vector of molar fractions of the injection fluid type ( EquilibriumState ) :: first_point integer , optional , intent ( in ) :: points !! Maxmimum number of points, defaults to 500 integer , optional , intent ( in ) :: iterations !! Point solver maximum iterations, defaults to 100 real ( pr ), optional , intent ( in ) :: delta_0 !! Initial extrapolation \\Delta integer , optional , intent ( in ) :: specified_variable_0 !! Position of specified variable, since the vector of variables is !! X = [lnK_i, \\dots, lnP, \\alpha] the values for specification !! will be [1 \\dots nc] for the equilibria constants, nc+1 for !! lnP and nc + 2 for \\alpha. procedure ( continuation_solver ), optional :: solver !! Specify solver for each point, defaults to a full newton procedure procedure ( continuation_stopper ), optional :: stop_conditions !! Function that returns true if the continuation method should stop type ( PXEnvel2 ) :: envelopes ! ------------------------------------------------------------------------ integer :: nc !! Number of components integer :: ns !! Number of specified variable real ( pr ) :: dS0 !! Initial specification step real ( pr ) :: S0 !! Initial specification value real ( pr ) :: z ( size ( z0 )) !! Composition at some point integer :: max_points !! Maximum number of points integer :: max_iterations !! Maximum number of iterations real ( pr ) :: X ( size ( z ) + 2 ), T real ( pr ), allocatable :: XS (:, :) character ( len = 14 ) :: kind ! ======================================================================== ! Handle input ! ------------------------------------------------------------------------ call get_z ( alpha0 , z0 , z_injection , z ) kind = first_point % kind nc = size ( z ) max_points = optval ( points , 500 ) max_iterations = optval ( iterations , 100 ) ns = optval ( specified_variable_0 , nc + 2 ) dS0 = optval ( delta_0 , 0.1_pr ) ! Correctly define the K-values based on the provided incipient point. select case ( first_point % kind ) case ( \"bubble\" , \"liquid-liquid\" ) X (: nc ) = log ( first_point % y / z ) case ( \"dew\" ) X (: nc ) = log ( first_point % x / z ) end select T = first_point % T X ( nc + 1 ) = log ( first_point % P ) X ( nc + 2 ) = alpha0 S0 = X ( ns ) allocate ( envelopes % points ( 0 ), envelopes % cps ( 0 ), envelopes % alpha ( 0 )) test_numdiff : block real ( pr ) :: F ( size ( X )), df ( size ( X ), size ( X )), numdiff ( size ( X ), size ( X )) real ( pr ) :: FdX ( size ( X )), dx ( size ( X )), dFdS ( size ( X )) real ( pr ) :: FdX2 ( size ( X )) integer :: i integer :: loc ( 2 ) real ( pr ) :: maxerr do i = 1 , size ( X ) dx = 0 dx ( i ) = 1.e-3_pr * X ( i ) call foo ( X - dx , ns , S0 , FdX , df , dFdS ) call foo ( X + dx , ns , S0 , FdX2 , df , dFdS ) call foo ( X , ns , S0 , F , df , dFdS ) numdiff (:, i ) = ( FdX2 - FdX ) / ( 2 * dx ( i )) end do loc = maxloc ( abs ( numdiff - df )) maxerr = abs (& ( numdiff ( loc ( 1 ), loc ( 2 )) - df ( loc ( 1 ), loc ( 2 ))& ) / numdiff ( loc ( 1 ), loc ( 2 ))) if ( maxerr > 0.01_pr ) then print * , \"ERROR: PXEnvel2 Numerical differentiation failed\" loc = maxloc ( abs ( numdiff - df )) print * , loc print * , df ( loc ( 1 ), loc ( 2 )), numdiff ( loc ( 1 ), loc ( 2 )) ! error stop 1 end if end block test_numdiff ! ======================================================================== ! Trace the line using the continuation method. ! ------------------------------------------------------------------------ XS = continuation (& foo , X , ns0 = ns , S0 = S0 , & dS0 = dS0 , max_points = max_points , solver_tol = 1.e-9_pr , & update_specification = update_spec , & solver = solver , stop = stop_conditions & ) contains recursive subroutine foo ( X , ns , S , F , dF , dFdS ) !! Function that needs to be solved at each envelope point real ( pr ), intent ( in ) :: X (:) integer , intent ( in ) :: ns real ( pr ), intent ( in ) :: S real ( pr ), intent ( out ) :: F (:) real ( pr ), intent ( out ) :: dF (:, :) real ( pr ), intent ( out ) :: dFdS (:) character ( len = 14 ) :: kind_z , kind_y real ( pr ) :: y ( nc ) real ( pr ) :: lnphip_z ( nc ), lnphip_y ( nc ) real ( pr ) :: dlnphi_dt_z ( nc ), dlnphi_dt_y ( nc ) real ( pr ) :: dlnphi_dp_z ( nc ), dlnphi_dp_y ( nc ) real ( pr ) :: dlnphi_dn_z ( nc , nc ), dlnphi_dn_y ( nc , nc ) real ( pr ) :: P , K ( nc ), alpha , dzda ( nc ) integer :: i , j F = 0 dF = 0 K = exp ( X (: nc )) P = exp ( X ( nc + 1 )) alpha = X ( nc + 2 ) call get_z ( alpha , z0 , z_injection , z , dzda ) y = K * z select case ( kind ) case ( \"bubble\" ) kind_z = \"liquid\" kind_y = \"vapor\" case ( \"dew\" ) kind_z = \"vapor\" kind_y = \"liquid\" case default kind_z = \"stable\" kind_y = \"stable\" end select call model % lnphi_pt (& z , P = P , T = T , V = Vz , root_type = kind_z , & lnphi = lnphip_z , dlnPhidt = dlnphi_dt_z , & dlnPhidp = dlnphi_dp_z , dlnphidn = dlnphi_dn_z & ) call model % lnphi_pt (& y , P = P , T = T , V = Vy , root_type = kind_y , & lnphi = lnphip_y , dlnPhidt = dlnphi_dt_y , & dlnPhidp = dlnphi_dp_y , dlnphidn = dlnphi_dn_y & ) F (: nc ) = X (: nc ) + lnphip_y - lnphip_z F ( nc + 1 ) = sum ( y - z ) F ( nc + 2 ) = X ( ns ) - S ! Jacobian Matrix do i = 1 , nc do j = 1 , nc df ( i , j ) = y ( j ) * dlnphi_dn_y ( i , j ) end do df ( i , i ) = df ( i , i ) + 1 df ( i , nc + 2 ) = sum ( K * dlnphi_dn_y ( i , :) * dzda - dlnphi_dn_z ( i , :) * dzda ) end do df (: nc , nc + 1 ) = P * ( dlnphi_dp_y - dlnphi_dp_z ) df ( nc + 1 , : nc ) = y df ( nc + 1 , nc + 2 ) = sum ( dzda * ( K - 1 )) df ( nc + 2 , :) = 0 df ( nc + 2 , ns ) = 1 dFdS = 0 dFdS ( nc + 2 ) = - 1 end subroutine foo subroutine update_spec ( X , ns , S , dS , dXdS , step_iters ) !! Update the specification during continuation. real ( pr ), intent ( in out ) :: X (:) !! Vector of variables [lnK_i \\dots , lnT, lnP] integer , intent ( in out ) :: ns !! Number of specified variable in the vector real ( pr ), intent ( in out ) :: S !! Variable specification value real ( pr ), intent ( in out ) :: dS !! Step in specification real ( pr ), intent ( in out ) :: dXdS (:) !! Variation of variables with respect to specification integer , intent ( in ) :: step_iters !! Iterations used in the solver real ( pr ) :: maxdS ! ===================================================================== ! Update specification ! - Dont select T or P near critical points ! - Update dS wrt specification units ! - Set step ! --------------------------------------------------------------------- write ( 1 , * ) X if ( maxval ( abs ( X (: nc ))) < 0.5_pr ) then ns = maxloc ( abs ( dXdS (: nc )), dim = 1 ) maxdS = 0.01_pr else ns = maxloc ( abs ( dXdS ), dim = 1 ) maxdS = 0.5_pr end if dS = dXdS ( ns ) * dS dXdS = dXdS / dXdS ( ns ) dS = sign ( 1.0_pr , dS ) * minval ([ & max ( sqrt ( abs ( X ( ns )) / 1 0._pr ), 0.1_pr ), & abs ( dS ) * 3 / step_iters & ] & ) dS = sign ( 1.0_pr , dS ) * maxval ([ abs ( dS ), maxdS ]) do while ( abs ( dXdS ( nc + 2 ) * dS ) > 0.1_pr ) dS = dS / 2 end do call save_point ( X , step_iters ) call detect_critical ( X , dXdS , ns , S , dS ) end subroutine update_spec subroutine save_point ( X , iters ) !! Save the converged point real ( pr ), intent ( in ) :: X (:) integer , intent ( in ) :: iters type ( EquilibriumState ) :: point real ( pr ) :: y ( nc ), P , alpha P = exp ( X ( nc + 1 )) alpha = X ( nc + 2 ) y = exp ( X (: nc )) * z select case ( kind ) case ( \"bubble\" ) point = EquilibriumState (& kind = kind , x = z , Vx = Vz , y = y , Vy = Vy , & T = T , P = P , beta = 0._pr , iters = iters & ) case ( \"dew\" ) point = EquilibriumState (& kind = kind , x = y , Vx = Vy , y = z , Vy = Vz , & T = T , P = P , beta = 0._pr , iters = iters & ) case default point = EquilibriumState (& kind = \"saturation\" , x = z , Vx = Vz , y = y , Vy = Vy , & T = T , P = P , beta = 0._pr , iters = iters & ) end select envelopes % alpha = [ envelopes % alpha , alpha ] envelopes % points = [ envelopes % points , point ] end subroutine save_point subroutine detect_critical ( X , dXdS , ns , S , dS ) !! # `detect_critical` !! Critical point detection !! !! # Description !! If the values of lnK (X[:nc]) change sign then a critical point !! Has passed, since for this to happen all variables should pass !! through zero. Near critical points (lnK < 0.05) points are harder !! to converge, so more steps in the extrapolation vector are made to !! jump over the critical point. !! If the critical point is detected then the kind of the point is !! changed and the point is saved using an interpolation knowing that !! !! !! X_c = a * X + (1-a)*X_{new} !! !! !! With X_c is the variables at the critical point, X_{new} !! is the new initialization point of the method and a is the !! parameter to interpolate the values. This subroutine finds the !! value of a to obtain X_c. real ( pr ), intent ( in out ) :: X (:) !! Vector of variables real ( pr ), intent ( in out ) :: dXdS (:) !! Variation of variables wrt S integer , intent ( in out ) :: ns !! Number of specified variable real ( pr ), intent ( in out ) :: S !! Specification value real ( pr ), intent ( in out ) :: dS !! Step in specification real ( pr ) :: Xc ( nc + 2 ) !! Value at (near) critical point real ( pr ) :: a !! Parameter for interpolation real ( pr ) :: Xold ( size ( X )) !! Old value of X real ( pr ) :: Xnew ( size ( X )) !! Value of the next initialization Xold = X do while ( maxval ( abs ( X (: nc ))) < 0.03_pr . and . abs ( Vz - Vy ) < 0.01_pr ) ! If near a critical point, jump over it S = S + dS X = X + dXdS * dS end do Xnew = X + dXdS * dS if ( all ( Xold (: nc ) * ( Xnew (: nc )) < 0 )) then select case ( kind ) case ( \"dew\" ) kind = \"bubble\" case ( \"bubble\" ) kind = \"dew\" case default kind = \"liquid-liquid\" end select ! 0 = a*X(ns) + (1-a)*Xnew(ns) Interpolation equation to get X(ns) = 0 a = - Xnew ( ns ) / ( X ( ns ) - Xnew ( ns )) Xc = a * X + ( 1 - a ) * Xnew envelopes % cps = [& envelopes % cps , & CriticalPoint ( P = exp ( Xc ( nc + 1 )), alpha = Xc ( nc + 2 )) & ] X = Xc + dXdS * dS end if end subroutine detect_critical end function px_envelope_2ph subroutine get_z ( alpha , z_0 , z_inj , z , dzda ) !! Calculate the fluid composition based on an amount of addition !! of second fluid. !! !! The injection can be considered as two kinds of injection: !! - Displacement: z = \\alpha z_i + (1-\\alpha) z_0 !! - Addition: z = \\frac{\\alpha z_i + (1-\\alpha) z_0}{\\sum_{i=1}^N \\alpha z_i + (1-\\alpha) z_0} real ( pr ), intent ( in ) :: alpha !! Addition percentaje \\alpha real ( pr ), intent ( in ) :: z_inj (:) real ( pr ), intent ( in ) :: z_0 (:) real ( pr ), intent ( out ) :: z ( size ( z_0 )) !! New composition real ( pr ), optional , intent ( out ) :: dzda ( size ( z_0 )) !! Derivative wrt \\alpha z = z_inj * alpha + ( 1.0_pr - alpha ) * z_0 if ( present ( dzda )) dzda = z_inj - z_0 end subroutine get_z end module yaeos__equilibria_boundaries_phase_envelopes_px","tags":"","loc":"sourcefile/phase_envelopes_px.f90.html"},{"title":"saturations_points.f90 – yaeos","text":"Source Code module yaeos__equilibria_saturation_points use yaeos__constants , only : pr use yaeos__models , only : ArModel use yaeos__equilibria_equilibrium_state , only : EquilibriumState use yaeos__equilibria_auxiliar , only : k_wilson real ( pr ) :: tol = 1e-9_pr integer :: max_iterations = 1000 real ( pr ) :: step_tol = 0.1_pr contains type ( EquilibriumState ) function saturation_pressure ( model , n , t , kind , p0 , y0 , max_iters ) !! Saturation pressure calculation function. !! !! Calculates the saturation pressure of a multicomponent mixture with !! a given molar composition `n`. !! It is possible to calculate: !! !! - Bubble point: `kind=\"bubble\"` !! - Dew point: `kind=\"dew\"` !! - Liquid-Liquid point: `kind=\"liquid-liquid\"` use stdlib_optval , only : optval class ( ArModel ), intent ( in ) :: model real ( pr ), intent ( in ) :: n (:) !! Composition vector [moles / molar fraction] real ( pr ), intent ( in ) :: t !! Temperature [K] character ( len =* ), intent ( in ) :: kind !! [bubble|dew|liquid-liquid] real ( pr ), optional , intent ( in ) :: p0 !! Initial pressure [bar] real ( pr ), optional , intent ( in ) :: y0 (:) !! Initial composition integer , optional , intent ( in ) :: max_iters !! Maximum number of iterations real ( pr ) :: p , vy , vz real ( pr ) :: k ( size ( n )), y ( size ( n )), z ( size ( n )), lnk ( size ( n )) real ( pr ) :: lnfug_y ( size ( n )), dlnphi_dp_y ( size ( n )) real ( pr ) :: lnfug_z ( size ( n )), dlnphi_dp_z ( size ( n )) character ( len = 50 ) :: incipient character ( len = 50 ) :: main real ( pr ) :: f , step integer :: its , iterations , i ! ======================================================================= ! Handle arguments ! ----------------------------------------------------------------------- z = n / sum ( n ) if ( present ( p0 )) then p = p0 else call model % pressure ( z , T , 1 0._pr , P = P ) end if if ( present ( y0 )) then y = y0 else y = z * k_wilson ( model , T , P ) end if iterations = optval ( max_iters , max_iterations ) select case ( kind ) case ( \"bubble\" ) k = y / z incipient = \"vapor\" main = \"liquid\" case ( \"dew\" ) k = z / y incipient = \"liquid\" main = \"vapor\" case ( \"liquid-liquid\" ) k = y / z incipient = \"liquid\" main = \"liquid\" end select where ( z == 0 ) k = 0 end where ! ======================================================================== ! ======================================================================== ! Solve point ! ------------------------------------------------------------------------ do its = 1 , iterations y = k * z call model % lnphi_pt ( y , P , T , vy , incipient , lnPhi = lnfug_y , dlnphidp = dlnphi_dp_y ) call model % lnphi_pt ( z , P , T , vz , main , lnPhi = lnfug_z , dlnphidp = dlnphi_dp_z ) k = exp ( lnfug_z - lnfug_y ) if ( all ( k < 1e-9_pr ) . or . all ( abs ( k - 1 ) < tol )) exit f = sum ( z * k ) - 1 step = f / sum ( z * k * ( dlnphi_dp_z - dlnphi_dp_y )) do while ( P - step < 0 . or . abs ( step ) > 0.1 * P ) step = step / 2 end do p = p - step if ( abs ( step ) < tol . and . abs ( f ) < tol ) exit end do ! ======================================================================== select case ( kind ) case ( \"bubble\" ) saturation_pressure = EquilibriumState ( kind = \"bubble\" , & iters = its , y = y , x = z , vx = vz , vy = vy , t = t , p = p , beta = 0._pr & ) case ( \"dew\" ) saturation_pressure = EquilibriumState ( kind = \"dew\" , & iters = its , x = y , y = z , vy = vz , vx = vy , t = t , p = p , beta = 1._pr & ) case ( \"liquid-liquid\" ) saturation_pressure = EquilibriumState ( kind = \"liquid-liquid\" , & iters = its , y = y , x = z , vx = vz , vy = vy , t = t , p = p , beta = 0._pr & ) end select end function saturation_pressure type ( EquilibriumState ) function saturation_temperature ( model , n , p , kind , t0 , y0 , max_iters ) !! Saturation temperature calculation function. !! !! Calculates the saturation pressure of a multicomponent mixture with !! a given molar composition `n`. !! It is possible to calculate: !! !! - Bubble point: `kind=\"bubble\"` !! - Dew point: `kind=\"dew\"` !! - Liquid-Liquid point: `kind=\"liquid-liquid\"` use stdlib_optval , only : optval class ( ArModel ), intent ( in ) :: model real ( pr ), intent ( in ) :: n (:) !! Composition vector [moles / molar fraction] real ( pr ), intent ( in ) :: p !! Pressure [bar] character ( len =* ), intent ( in ) :: kind !! [bubble|dew|liquid-liquid] real ( pr ), optional , intent ( in ) :: t0 !! Initial temperature [K] real ( pr ), optional , intent ( in ) :: y0 (:) !! Initial composition integer , optional , intent ( in ) :: max_iters !! Maximum number of iterations real ( pr ) :: t , vy , vz real ( pr ) :: k ( size ( n )), y ( size ( n )), z ( size ( n )), lnk ( size ( n )) real ( pr ) :: lnfug_y ( size ( n )), dlnphi_dt_y ( size ( n )) real ( pr ) :: lnfug_z ( size ( n )), dlnphi_dt_z ( size ( n )) character ( len = 50 ) :: incipient character ( len = 50 ) :: main real ( pr ) :: f , step integer :: its , iterations logical :: is_incipient ( size ( n )) ! ======================================================================= ! Handle arguments ! ----------------------------------------------------------------------- is_incipient = . true . z = n / sum ( n ) if ( present ( t0 )) then t = t0 else t = 15 0._pr end if if ( present ( y0 )) then y = y0 else y = z * k_wilson ( model , T , P ) end if iterations = optval ( max_iters , max_iterations ) select case ( kind ) case ( \"bubble\" ) k = y / z incipient = \"vapor\" main = \"liquid\" case ( \"dew\" ) k = z / y incipient = \"liquid\" main = \"vapor\" case ( \"liquid-liquid\" ) k = y / z incipient = \"liquid\" main = \"liquid\" end select where ( z == 0 ) k = 0 end where where ( y == 0 ) is_incipient = . false . end where ! ======================================================================== ! ======================================================================== ! Solve point ! ------------------------------------------------------------------------ do its = 1 , iterations y = k * z where (. not . is_incipient ) y = 0 endwhere call model % lnphi_pt ( y , P , T , vy , incipient , lnPhi = lnfug_y , dlnphidt = dlnphi_dt_y ) call model % lnphi_pt ( z , P , T , vz , main , lnPhi = lnfug_z , dlnphidt = dlnphi_dt_z ) k = exp ( lnfug_z - lnfug_y ) f = sum ( z * k ) - 1 step = f / sum ( z * k * ( dlnphi_dt_z - dlnphi_dt_y )) do while ( abs ( step ) > 0.25 * T . or . T - step < 0 ) step = step / 2 end do t = t - step if ( abs ( step ) < tol . and . abs ( f ) < tol ) exit end do ! ======================================================================== select case ( kind ) case ( \"bubble\" ) saturation_temperature = EquilibriumState ( kind = \"bubble\" , & iters = its , y = y , x = z , vx = vz , vy = vy , t = t , p = p , beta = 0._pr & ) case ( \"dew\" ) saturation_temperature = EquilibriumState ( kind = \"dew\" , & iters = its , x = y , y = z , vy = vz , vx = vy , t = t , p = p , beta = 1._pr & ) case ( \"liquid-liquid\" ) saturation_temperature = EquilibriumState ( kind = \"liquid-liquid\" , & iters = its , y = y , x = z , vx = vz , vy = vy , t = t , p = p , beta = 0._pr & ) end select end function saturation_temperature end module yaeos__equilibria_saturation_points","tags":"","loc":"sourcefile/saturations_points.f90.html"},{"title":"User documentation – yaeos","text":"Welcome to yaeos user documentation yaeos is a Fortran library that handles thermodynamic Equations of State-based\ncalculations, mostly phase-equilibria related ones and properties estimation\nones. This is a work-in-progress library (and documentation) so don’t hesisate to\nreport any problem/requirement as an issue in our GitHub\npage . Basic usage The base object that represents most of yaeos functionality is the ArModel object, which holds the basic interface of how a $A_r$ model behaves. Since all the properties that yaeos calculates are based on residual Helmholtz\nenergy, once the object is set-up all the library functionality is available. use yaeos class ( ArModel ), allocatable :: model ! Variable that holds the model ! A setup function that returns a setted model model = setup_model ( < the properties that define a model > ) ! Once the model is set up, the user has access to the properties call pressure ( model , V , T , P , dPdN = dPdN )","tags":"","loc":"page/index.html"},{"title":"Using yaeos – yaeos","text":"Getting started Fortran Getting yaeos Setting up a model Calculating thermodynamic properties Phase equilibria Getting started Fortran Maybe you’ve heard of Fortran as that old and cryptic language that everyone is\nafraid of. Well, not anymore! Fortran is really easy to understand and has been\nupdated a lot in the recent decades. There is a fairly direct guide on the fortran-lang site Getting yaeos yaeos is a Fortran library intended to be used as a fpm package, fpm can be easily easily obtained with\nthe Python package manager pip with a simple: pip install --user fpm With fpm installed you can create a new Fortran project by running: fpm new your_project_name A new directory with the name of your project will be created. You include yaeos in your fpm project by adding it as a dependency on your fpm.toml file by adding this: [dependencies] stdlib = \"*\" yaeos = { git = \"https://github.com/ipqa-research/yaeos\" } Or maybe you want a specific version: [dependencies] stdlib = \"*\" yaeos = { git = \"https://github.com/ipqa-research/yaeos\" , tag = \"0.1.0b2\" } Setting up a model On yaeos there is a series of models implemented, right now we include\nResidual Helmholtz energy models (like Cubic Equations of State), but plan on\nextening to a broader variety. In this example we’ll show how a model in yaeos can be used. We’ll take\nthe Peng-Robinson equation of state as an example, but all the implemented\nmodels can be seen at yaeos__models . Inside\nyour app/main.f90 file use program main use yaeos ! Set the variable `model` as a generic `ArModel` class ( ArModel ), allocatable :: model ! Set the the variables that we're going to use ! as variable lenght arrays real ( pr ), allocatable :: n (:), tc (:), pc (:), w (:) n = [ 0.3 , 0.7 ] ! Number of moles of each component tc = [ 190 , 310 ] ! Critical temperatures pc = [ 14 , 30 ] ! Critical pressures w = [ 0.001 , 0.03 ] ! Acentric factors ! Now we set our model as the PengRobinson76 ! Equation of state. model = PengRobinson76 ( tc , pc , w ) end program And then it’s all set, now we’ve set the model variable to use in our\ncalculations Calculating thermodynamic properties Some thermodynamic properties can be calculated with yaeos models, and we’re\nadding more! In this example we’ll calculate a PV isotherm from our previously\ndefined model. For the sake of simplicity all the next code blocks are assumed\nto be extensions of the previous one, before the end program sentence. pv_isotherm : block real ( pr ) :: v , t , p ! Thermodynamic variables real ( pr ) :: v0 , vf , dv ! End and start volumes integer :: i , n_points ! iteration variable and how many points to calc v0 = 0.001 vf = 10 dv = ( vf - v0 ) / n_points do i = 1 , n_points v = v0 + i * dv ! Set new volume point call pressure ( model , n , v , t , p ) ! Calculate pressure print * , v , p end do end block pv_isotherm Also some useful derivatives are available when calculating each property, they\ncan be easily accessed as optional arguments of the routine. For example, to \nobtain the derivative of pressure with respect to volume the line that\ncalculates pressure should be changed to: call pressure ( model , n , v , t , p , dpdv = dpdv ) ! Calculate pressure and dPdV The available thermodynamic properties to calculate can be seen at the yaeos__thermoprops module. Phase equilibria","tags":"","loc":"page/usage/index.html"},{"title":"Equations of State – yaeos","text":"yaeos is a library based on Equation-of-State calculations.","tags":"","loc":"page/usage/eos/index.html"},{"title":"Cubics – yaeos","text":"** Table of contents**\n[TOC] SoaveRedlichKwong PengRobinson76 PengRobinson78 RKPR","tags":"","loc":"page/usage/eos/cubics/index.html"},{"title":"Alpha functions – yaeos","text":"","tags":"","loc":"page/usage/eos/cubics/alpha.html"},{"title":"Mixing Rules – yaeos","text":"Cubic Mixing Rules All CubicEoS in yaeos include a CubicMixRule derived type, which \nhandles how the and parameters in the CubicEoS are calculated. Quadratic Mixing Rules (QMR) Quadratic mixing rules are the ussually most used mixing rules for cubic \nequations of state. QMR are handled by the QMR derived type. Which can be used like: use yaeos , only : pr , QMR type ( QMR ) :: mixrule real ( pr ) :: kij ( 2 , 2 ), lij ( 2 , 2 ) kij ( 1 , :) = [ 0.0 , 0.1 ] kij ( 2 , :) = [ 0.1 , 0.0 ] lij ( 1 , :) = [ 0.0 , 0.01 ] lij ( 2 , :) = [ 0.01 , 0.0 ] mixrule = QMR ( k = kij , l = lij ) By default the matrix will be calculated with a constant value (as shown below). But this functionality can be modified by replacing\nthe get_aij procedure use yaeos , only : pr , QMR type ( QMR ) :: mixrule real ( pr ) :: kij ( 2 , 2 ), lij ( 2 , 2 ) kij ( 1 , :) = [ 0.0 , 0.1 ] kij ( 2 , :) = [ 0.1 , 0.0 ] lij ( 1 , :) = [ 0.0 , 0.01 ] lij ( 2 , :) = [ 0.01 , 0.0 ] mixrule = QMR ( k = kij , l = lij ) mixrule % get_aij => my_aij_implementation subroutine my_aij_implementation ( self , ai , daidt , daidt2 , aij , daijdt , daijdt2 ) class ( QMR ) :: self real ( pr ), intent ( in ) :: ai (:), daidt (:), daidt2 (:) real ( pr ), intent ( out ) :: aij (:, :), daijdt (:, .), daijdt2 (:, :) ! Implementation here end subroutine Constant Models Mixing Rules Michelsen’s Modified Huron-Vidal Mixing Rules","tags":"","loc":"page/usage/eos/cubics/mixing.html"},{"title":"Gibbs Excess Models – yaeos","text":"Explain thermoprops of Ge models here","tags":"","loc":"page/usage/excessmodels/index.html"},{"title":"NRTL – yaeos","text":"","tags":"","loc":"page/usage/excessmodels/nrtl.html"},{"title":"UNIFAC-LV – yaeos","text":"UNIFAC UNIFAC (UNIQUAC Functional-group Activity Coefficients) is an Excess Gibbs\nfree energy model used to estimate activity coefficients in non-ideal mixtures.\nIt is particularly useful for predicting the phase behavior of chemical\nmixtures, including liquid-liquid equilibrium (LLE) and vapor-liquid\nequilibrium (VLE). In this model the Excess Gibbs free energy is calculated\nfrom the contribution of a combinatorial term and a residual term. Being: Combinatorial: Accounts for the size and shape of the molecules. The involved\nequations can be checked in the API documentation: Ge_combinatorial Residual: Accounts for the energy interactions between different functional\ngroups. The involved equations can be checked in the API documentation: Ge_residual Each substance of a mixture modeled with UNIFAC must be represented by a\nlist a functional groups and other list with the ocurrence of each functional\ngroup on the substance. The list of the functional groups culd be accesed on\nthe DDBST web page: https://www.ddbst.com/published-parameters-unifac.html Examples Calculating activity coefficients We can instantiate a UNIFAC model with a mixture ethanol-water and\nevaluate the logarithm of activity coefficients of the model for a 0.5 mole\nfraction of each, and a temperature of 298.0 K. use yaeos__constants , only : pr use yaeos__models_ge_group_contribution_unifac , only : Groups , UNIFAC , setup_unifac ! Variables declarations type ( UNIFAC ) :: model type ( Groups ) :: molecules ( 2 ) real ( pr ) :: ln_gammas ( 2 ) ! Variables instances ! Ethanol definition [CH3, CH2, OH] molecules ( 1 )% groups_ids = [ 1 , 2 , 14 ] ! Subgroups ids molecules ( 1 )% number_of_groups = [ 1 , 1 , 1 ] ! Subgroups occurrences ! Water definition [H2O] molecules ( 2 )% groups_ids = [ 16 ] molecules ( 2 )% number_of_groups = [ 1 ] ! Model setup model = setup_unifac ( molecules ) ! Calculate ln_gammas call model % ln_activity_coefficient ([ 0.5_pr , 0.5_pr ], 29 8.0_pr , ln_gammas ) print * , ln_gammas You will obtain: >>> 0.18534142000449058 0.40331395945417559 References Dortmund Data Bank Software & Separation Technology Fredenslund, A., Jones, R. L., & Prausnitz, J. M. (1975). Group‐contribution\nestimation of activity coefficients in nonideal liquid mixtures. AIChE Journal,\n21(6), 1086–1099. https://doi.org/10.1002/aic.690210607 Skjold-Jorgensen, S., Kolbe, B., Gmehling, J., & Rasmussen, P. (1979).\nVapor-Liquid Equilibria by UNIFAC Group Contribution. Revision and Extension.\nIndustrial & Engineering Chemistry Process Design and Development, 18(4),\n714–722. https://doi.org/10.1021/i260072a024 Gmehling, J., Rasmussen, P., & Fredenslund, A. (1982). Vapor-liquid\nequilibriums by UNIFAC group contribution. Revision and extension. 2.\nIndustrial & Engineering Chemistry Process Design and Development, 21(1),\n118–127. https://doi.org/10.1021/i200016a021 Macedo, E. A., Weidlich, U., Gmehling, J., & Rasmussen, P. (1983).\nVapor-liquid equilibriums by UNIFAC group contribution. Revision and extension. Industrial & Engineering Chemistry Process Design and Development, 22(4),\n676–678. https://doi.org/10.1021/i200023a023 Tiegs, D., Rasmussen, P., Gmehling, J., & Fredenslund, A. (1987).\nVapor-liquid equilibria by UNIFAC group contribution. 4. Revision and\nextension. Industrial & Engineering Chemistry Research, 26(1), 159–161. https://doi.org/10.1021/ie00061a030 Hansen, H. K., Rasmussen, P., Fredenslund, A., Schiller, M., & Gmehling, J.\n(1991). Vapor-liquid equilibria by UNIFAC group contribution. 5. Revision and\nextension. Industrial & Engineering Chemistry Research, 30 (10), 2352–2355. https://doi.org/10.1021/ie00058a017 Wittig, R., Lohmann, J., & Gmehling, J. (2003). Vapor−Liquid Equilibria by\nUNIFAC Group Contribution. 6. Revision and Extension. Industrial & Engineering\nChemistry Research, 42(1), 183–188. https://doi.org/10.1021/ie020506l SINTEF - Thermopack","tags":"","loc":"page/usage/excessmodels/unifaclv.html"},{"title":"Phase Equilibrium – yaeos","text":"Phase Equilibria calculations are fundamental for the majority of EoS based\nmodelling either for processes or when studying phase-behaviour. In yaeos most of phase-equilibria procedures return the EquilibriaState type EquilibriaState , which holds all the relevant information of an\nequilibria point. The implemented methods, and their usage are: Flash calculations Saturation points Phase envelopes Flash calculations Flash calcuations are one of the most used phase-equilibria calculations during\nmodelling of processes. In yaeos it is possible to make Flash calculations either specifying: type ( EquilibriaState ) :: result ! zPT flash result = flash ( model , z , p_spec = P , T = T ) ! zVT flash result = flash ( model , z , v_spec = P , T = T ) ! It is possible to provide initialization compositions in terms of the ! K-factors. Where k0=y/x result = flash ( model , z , v_spec = P , T = T , k0 = k0 ) Saturation points Single saturation point calculations are included with the procedures saturation_pressure and saturation_temperature . Both procedures solve\nthe equation With a newton procedure with respect to the desired variable (either or . type ( EquilibriaState ) :: sat_point sat = saturation_pressure ( model , z , T = T , kind = \"bubble\" ) sat = saturation_pressure ( model , z , T = T , kind = \"dew\" ) sat = saturation_temperature ( model , z , P = P , kind = \"bubble\" ) sat = saturation_temperature ( model , z , P = P , kind = \"dew\" ) Phase envelopes Phase envelopes are the conection of all the saturation points of a system.\nWhen the interest is in calculating a whole phase diagram instead of a single\npoint, or the point is hard to converge. It is better to use a robust\nmathematical algorithm that eases the calcuation providing an easy-to-converge\npoint and using its information to initialize a next one and continue along the\nwhole phase-boundary. This can be done with the procedure pt_envelope_2ph type ( PTEnvel2 ) :: env sat = saturation_pressure ( model , z , T = 15 0._pr , kind = \"bubble\" ) env = pt_envelope_2ph ( model , z , sat )","tags":"","loc":"page/usage/phase_equilibrium/index.html"},{"title":"Phase envelopes – yaeos","text":"Two-phase envelopes Two-phase envelopes show all the saturation points of a mixture, they can\nbe seen as the boundary line of transition between monophasic regions to \ntwo-phase equilibria regions. In yaeos it is possible to calculate two-phase of different kinds. Isoplets Isoplets Isoplets are the phase boundaries at constant composition \n(the global composition) of the system. Here is a simple example with\ncommentaries on how a phase boundary can be calculated: program phase_diagram !! Program for calculation of phase diagrams. use forsus , only : Substance , forsus_dir , forsus_default_dir use yaeos , only : pr , & SoaveRedlichKwong , PengRobinson76 , PengRobinson78 , RKPR , & EquilibriaState , ArModel , PTEnvel2 , & pt_envelope_2ph , saturation_pressure , saturation_temperature use yaeos__phase_equilibria_auxiliar , only : k_wilson implicit none ! =========================================================================== ! Variables definition ! --------------------------------------------------------------------------- integer , parameter :: nc = 2 class ( ArModel ), allocatable :: model ! Thermodynamic model to be used type ( EquilibriaState ) :: sat_point ! Init type ( PTEnvel2 ) :: envelope ! PT Phase envelope real ( pr ) :: tc ( nc ), pc ( nc ), w ( nc ) ! Component's critical constants real ( pr ) :: n ( nc ) ! Termodynamic variables type ( Substance ) :: sus ( nc ) ! Substances to use ! =========================================================================== ! forsus database directory forsus_dir = \"build/dependencies/forsus/\" // forsus_default_dir ! Find the selected substances on the database and extract their ! critical constants sus ( 1 ) = Substance ( \"methane\" ) sus ( 2 ) = Substance ( \"n-hexane\" ) call get_critical_constants ( sus , tc , pc , w ) ! Model definition model = PengRobinson76 ( tc , pc , w ) ! Composition vector n = [ 0.9_pr , 0.1_pr ] ! Calculate a dew point at low pressure to later ! initialize the phase envelope sat_point = saturation_temperature ( model , n , P = 1._pr , kind = \"dew\" , t0 = 15 0._pr ) ! Calculate phase envelope envelope = pt_envelope_2ph ( model , n , sat_point ) ! Write the phase envelope to screen write ( * , * ) envelope contains subroutine get_critical_constants ( subs , tc_in , pc_in , w_in ) type ( Substance ) :: subs (:) real ( pr ), intent ( out ) :: tc_in (:), pc_in (:), w_in (:) tc_in = subs % critical % critical_temperature % value pc_in = subs % critical % critical_pressure % value / 1e5 w_in = subs % critical % acentric_factor % value end subroutine end program phase_diagram The output of the write command will be pre-formatted. Showing in tabular\ndata with this # PTEnvel2\n\n# kind of sat point\nkind T P [liquid-phase composition vector] [gas-phase composition vector]\n\n# other kind of sat point\nkind T P [liquid-phase composition vector] [gas-phase composition vector]\n\n# Critical\nT P Which when plotted with gnuplot with: plot \"outfile\" \\ index \"dew\" u 2 : 3 w l title \"Dew\" , \\ \"\" index \"bubble\" u 2 : 3 w l t \"Bubble\" , \\ \"\" index \"Critical\" u 1 : 2 w p pt 7 lc rgb \"black\" t \"CP\" Gives the following plot:","tags":"","loc":"page/usage/phase_equilibrium/envelopes.html"},{"title":"Flash calculations – yaeos","text":"","tags":"","loc":"page/usage/phase_equilibrium/flash.html"},{"title":"Saturation Points – yaeos","text":"","tags":"","loc":"page/usage/phase_equilibrium/saturation_points.html"},{"title":"Adding your own models – yaeos","text":"Most of thermodynamic properties calculated in yaeos heavily depend on\ndifferent kind of models and their respective derivatives. Since obtaining the\nderivatives of complex models can be a tedious and error-prone task. We provide\ntwo different ways of getting them automatically (in some cases with some\nperformance-cost), but there is also the possibility of using analytical\nobtained expressions instead. The calculation of thermodynamic properties heavily depends on On yaeos there are three different ways of adding your own model:W Residual Helmholtz models Residual Helmholtz models Residual Helmholtz models are the basis to obtain the residual properties. The main basis in yaeos to define a new object that extends the abstract\ntype called` ArModel . Which enforces the expected functionality of this\nkind of models. use yaeos , only : ArModel type , extends ( ArModel ) :: MyNewModel end type The definition of an ArModel expects that two procedures are defined: abs_residual_helmholtz : Procedure to calculate residual\n Helmholtz energy and it’s derivatives abs_volume_initializer : Volume initializer to find a liquid\n root, given a pressure and temperature. use yaeos , only : ArModel type , extends ( ArModel ) :: MyNewModel contains procedure :: residual_helmholtz => an_Ar_implementation procedure :: volume_initializer => an_v0_implementation end type Satisfying those requirements, our model will be ready to make calculations! use yaeos , only : pressure use my_model , only : MyNewModel type ( MyNewModel ) :: model ! Assuming model parameters are set-up call pressure ( model , n , V , T , P )","tags":"","loc":"page/usage/newmodels/index.html"},{"title":"Analytical derivatives – yaeos","text":"","tags":"","loc":"page/usage/newmodels/analtical.html"},{"title":"Automatic differentiation – yaeos","text":"Autodiff The implementation of new models and all their required derivatives can be\nan endeavours and error-prone task. A tool that helps with this, at a small\nperformance cost, can be automatic differentiation. Automatic differentiation can be implemented in two ways: Forward Differentiation Backward Differentiation With can be combined to obtain higher order derivatives. In yaeos it is possible to add new models via two different kind of\nimplementations. Operator overloading with hyperdual numbers and\nsource-to-source automatic differentiation with tapenade . @warn\nRemember to use the R constant from yaeos__constants , and all models\nshould have a type(Substances) attribute!\n@endwarn Hyperdual autodiff ArModel Automatic differentiation with hyperdual numbers can be done with the ArModelAdiff derived type. This implementation requires just to extend\nthat derived type with your own implementation and a volume initializer. module hyperdual_pr76 use yaeos__constants , only : pr , R use yaeos__ar_models_hyperdual use yaeos__substance , only : Substances implicit none type , extends ( ArModelAdiff ) :: PR76 !! PengRobinson 76 EoS ! Composition type ( Substances ) :: composition ! Mixing rule Parameters real ( pr ), allocatable :: kij (:, :), lij (:, :) ! EoS parameters real ( pr ), allocatable :: ac (:), b (:), k (:) real ( pr ), allocatable :: tc (:), pc (:), w (:) contains procedure :: Ar => arfun procedure :: get_v0 => v0 end type real ( pr ), parameter :: del1 = 1._pr + sqrt ( 2._pr ) real ( pr ), parameter :: del2 = 1._pr - sqrt ( 2._pr ) contains type ( PR76 ) function setup ( tc , pc , w , kij , lij ) result ( self ) !! Function to obtain a defined PR76 model with setted up parameters !! as function of Tc, Pc, and w real ( pr ) :: tc (:) real ( pr ) :: pc (:) real ( pr ) :: w (:) real ( pr ) :: kij (:, :) real ( pr ) :: lij (:, :) self % composition % tc = tc self % composition % pc = pc self % composition % w = w self % ac = 0.45723553_pr * R ** 2 * tc ** 2 / pc self % b = 0.07779607_pr * R * tc_in / pc_in self % k = 0.37464_pr + 1.54226_pr * w - 0.26993_pr * w ** 2 self % kij = kij self % lij = lij end function function arfun ( self , n , v , t ) result ( ar ) !! Residual Helmholtz calculation for a generic cubic with !! quadratic mixing rules. class ( PR76 ) :: self type ( hyperdual ), intent ( in ) :: n (:), v , t type ( hyperdual ) :: ar type ( hyperdual ) :: amix , a ( size ( n )), ai ( size ( n )), n2 ( size ( n )) type ( hyperdual ) :: bmix type ( hyperdual ) :: b_v , nij integer :: i , j associate (& pc => self % composition % pc , ac => self % ac , b => self % b , k => self % k ,& kij => self % kij , lij => self % lij , tc => self % compostion % tc & ) ! Soave alpha function a = 1.0_pr + k * ( 1.0_pr - sqrt ( t / tc )) a = ac * a ** 2 ai = sqrt ( a ) ! Quadratic Mixing Rule amix = 0.0_pr bmix = 0.0_pr do i = 1 , size ( n ) - 1 do j = i + 1 , size ( n ) nij = n ( i ) * n ( j ) amix = amix + 2 * nij * ( ai ( i ) * ai ( j )) * ( 1 - kij ( i , j )) bmix = bmix + nij * ( b ( i ) + b ( j )) * ( 1 - lij ( i , j )) end do end do amix = amix + sum ( n ** 2 * a ) bmix = bmix + sum ( n ** 2 * b ) bmix = bmix / sum ( n ) b_v = bmix / v ! Generic Cubic Ar function ar = (& - sum ( n ) * log ( 1.0_pr - b_v ) & - amix / ( R * T * bmix ) * 1.0_pr / ( del1 - del2 ) & * log (( 1.0_pr + del1 * b_v ) / ( 1.0_pr + del2 * b_v )) & ) * ( R * T ) end associate end function function v0 ( self , n , p , t ) !! Initialization of liquid volume solving with covolume class ( PR76 ), intent ( in ) :: self real ( pr ), intent ( in ) :: n (:) real ( pr ), intent ( in ) :: p real ( pr ), intent ( in ) :: t real ( pr ) :: v0 v0 = sum ( n * self % b ) / sum ( n ) end function end module Tapenade Adiff And alternative to hyperdual that takes a bit more work, but can end in a more\nperformant model, is doing tapenade source-to-source differentiation. For\nthis tapenade must be installed and accessible from a terminal donwload link . tapenade diff Tapenade is an automatic differentiation tool developed by researchers at INRIA (the French National\nInstitute for Research in Computer Science and Automation). Tapenade is designed to automatically generate derivative code for numerical\nsimulation programs written in Fortran or C. It enables the computation of\ngradients, Hessians, and other derivatives efficiently, which is particularly\nuseful in fields such as optimization, sensitivity analysis, and scientific\ncomputing. By analyzing the source code of the original program, Tapenade generates code\nthat computes the derivatives of the program’s outputs with respect to its\ninputs. This capability is crucial in many scientific and engineering\napplications where the ability to efficiently compute derivatives is essential. Overall, Tapenade simplifies the process of incorporating automatic\ndifferentiation into existing numerical simulation codes, making it a valuable\ntool for researchers and developers working in computational science and\nengineering. How we use it In yaeos we developed a wrapper object that receives a set of routines from\na differentiated module and uses and internal logic to get the desired $A_r$ \nderivatives. Obtain a tapenade differentiated EoS Getting a usable $A_r$ equation of state with tapenade is fairly easy. Install tapenade and assure that you have the tapenade executable in\n your PATH . Setup your new model following the template file .\n a full implementation of the PengRobinson EoS can be seen at pr.f90 as an example. Run the script gen_tapemodel.sh , providing your file as an argument: bash\n bash gen_tapemodel.sh This will generate a new folder tapeout , with your differentiated model\n inside. Some little post-process must be done due to some details in the tapenade implementation. These are described in the base template but can also\n be checked on the differentiated PR76 result after fixing the last details To add your new tapenade model just include the file in your src folder and\nuse it with use yaeos , only : ArModel , pressure use your_module_name , only : setup_model class ( ArModel ), allocatable :: model model = setup_model ( < your parameters > ) call pressure ( model , n , v , t )","tags":"","loc":"page/usage/newmodels/autodiff.html"},{"title":"Contributing – yaeos","text":"Contributing to yaeos First off, thanks for your interesnt and taking the time to contribute! All types of contributions are encouraged and valued. \nSee the Table of Contents for different ways to help and\ndetails about how this project handles them. Please make sure to read the\nrelevant section before making your contribution. It will make it a lot easier\nfor us maintainers and smooth out the experience for all involved. The\ncommunity looks forward to your contributions. 🎉 And if you like the project, but just don’t have time to contribute, that’s\nfine. There are other easy ways to support the project and show your\nappreciation, which we would also be very happy about:\n- Star the project\n- Tweet about it\n- Refer this project in your project’s readme\n- Mention the project at local meetups and tell your friends/colleagues Table of Contents I Have a Question I Want To Contribute Reporting Bugs Suggesting Enhancements Your First Code Contribution Improving The Documentation Styleguides Commit Messages Join The Project Team I Have a Question If you want to ask a question, we assume that you have read the available Documentation . Before you ask a question, it is best to search for existing Issues that might help you. In\ncase you have found a suitable issue and still need clarification, you can\nwrite your question in this issue. It is also advisable to search the internet\nfor answers first. If you then still feel the need to ask a question and need clarification, we\nrecommend the following: Open an Issue . Provide as much context as you can about what you’re running into. Provide project and platform versions, depending on what seems relevant. We will then take care of the issue as soon as possible. I Want To Contribute Legal Notice When contributing to this project, you must agree that you have authored 100%\nof the content, that you have the necessary rights to the content and that\nthe content you contribute may be provided under the project license. Reporting Bugs Before Submitting a Bug Report A good bug report shouldn’t leave others needing to chase you up for more information. Therefore, we ask you to investigate carefully, collect information and describe the issue in detail in your report. Please complete the following steps in advance to help us fix any potential bug as fast as possible. Make sure that you are using the latest version. Determine if your bug is really a bug and not an error on your side e.g. using incompatible environment components/versions (Make sure that you have read the documentation . If you are looking for support, you might want to check this section ). To see if other users have experienced (and potentially already solved) the same issue you are having, check if there is not already a bug report existing for your bug or error in the bug tracker . Also make sure to search the internet (including Stack Overflow) to see if users outside of the GitHub community have discussed the issue. Collect information about the bug: Stack trace (Traceback) OS, Platform and Version (Windows, Linux, macOS, x86, ARM) Version of the interpreter, compiler, SDK, runtime environment, package manager, depending on what seems relevant. Possibly your input and the output Can you reliably reproduce the issue? And can you also reproduce it with older versions? How Do I Submit a Good Bug Report? You must never report security related issues, vulnerabilities or bugs including sensitive information to the issue tracker, or elsewhere in public. Instead sensitive bugs must be sent by email to <>. We use GitHub issues to track bugs and errors. If you run into an issue with the project: Open an Issue . (Since we can’t be sure at this point whether it is a bug or not, we ask you not to talk about a bug yet and not to label the issue.) Explain the behavior you would expect and the actual behavior. Please provide as much context as possible and describe the reproduction steps that someone else can follow to recreate the issue on their own. This usually includes your code. For good bug reports you should isolate the problem and create a reduced test case. Provide the information you collected in the previous section. Once it’s filed: The project team will label the issue accordingly. A team member will try to reproduce the issue with your provided steps. If there are no reproduction steps or no obvious way to reproduce the issue, the team will ask you for those steps and mark the issue as needs-repro . Bugs with the needs-repro tag will not be addressed until they are reproduced. If the team is able to reproduce the issue, it will be marked needs-fix , as well as possibly other tags (such as critical ), and the issue will be left to be implemented by someone . Suggesting Enhancements This section guides you through submitting an enhancement suggestion for yaeos, including completely new features and minor improvements to existing\nfunctionality . Following these guidelines will help maintainers and the\ncommunity to understand your suggestion and find related suggestions. Before Submitting an Enhancement Make sure that you are using the latest version. Read the documentation carefully and find out if the functionality is already covered, maybe by an individual configuration. Perform a search to see if the enhancement has already been suggested. If it has, add a comment to the existing issue instead of opening a new one. Find out whether your idea fits with the scope and aims of the project. It’s up to you to make a strong case to convince the project’s developers of the merits of this feature. Keep in mind that we want features that will be useful to the majority of our users and not just a small subset. If you’re just targeting a minority of users, consider writing an add-on/plugin library. How Do I Submit a Good Enhancement Suggestion? Enhancement suggestions are tracked as GitHub issues . Use a clear and descriptive title for the issue to identify the suggestion. Provide a step-by-step description of the suggested enhancement in as many details as possible. Describe the current behavior and explain which behavior you expected to see instead and why. At this point you can also tell which alternatives do not work for you. You may want to include screenshots and animated GIFs which help you demonstrate the steps or point out the part which the suggestion is related to. You can use this tool to record GIFs on macOS and Windows, and this tool or this tool on Linux. Explain why this enhancement would be useful to most yaeos users. You may also want to point out the other projects that solved it better and which could serve as inspiration. Your First Code Contribution Improving The Documentation Styleguides Our code style can be read at Style Guide Commit Messages We encourage the use of commitizen styling on commit\nmessages. Join The Project Team mail me","tags":"","loc":"page/contributing/index.html"},{"title":"Style guide – yaeos","text":"yaeos Style Guide Adopting a consistent style can improve code legibility through the choice of good naming conventions.\nIn addition, style checks will be run during CI to flag any severe non-conformance.\nThis allows code review discussions to focus on semantics and substance rather than pedantry.\nConsistent whitespace usage, and not polluting line endings with trailing white space makes git diff s considerably more legible.\nThis style guide is a living document and proposed changes may be adopted after discussing them and coming to a consensus. Use (modern) standard Fortran Do not use obsolescent or deleted language features\n E.g., common , pause , entry , arithmetic if and computed goto Do not use vendor extensions in the form of non-standard syntax and vendor supplied intrinsic procedures\n E.g., real*8 or etime() , use real(pr) Naming of variables and constructs Variable and procedure names, as well as Fortran keywords, should be written in lowercase All constants (like the R gas constant) should be upper case All variables should be in lowercase unless they are represented in uppercase in the bibliography.\n for example, the molar volume would be v and the total volume would be V . In the case of derivatives, for general properties they should be written as dXdy for first derivatives and dXdyz or dXdy2 for second order derivatives. The only exception is with energetic properties, like Ar , where derivatives are written like ArV , ArVn , etc. All thermodynamic variables that are input of a subroutine/function should\n have the order: n, V, T n, P, T Variable and procedure names should be made up of one or more full words separated by an underscore,\n for example has_failed is preferred over hasfailed Where conventional and appropriate shortening of a word is used then the underscore may be omitted,\n for example linspace is preferred over lin_space For derived types use CamelCase, like ArModel File naming conventions Source files should contain at most one program , module , or submodule The filename should match the program or module name and have the file extension .f90 or .F90 if preprocessing is required module names should include it’s subdirectory, using yaeos__ for the parent src directory. For example the module in src/phase_equilibria/flash.f90 should be named yaeos__phase_equilibria_flash . If the interface and implementation is split using submodules the implementation submodule file should have the same name as the\n interface (parent) module but end in _implementation E.g., string_class.f90 and string_class_implementation.f90 Tests should be added in the test subdirectory and have the same name as the module they are testing with the test_ prefix\n added E.g., string_class.f90 and test/test_string_class.f90 Indentation & whitespace By setting and following a convention for indentation and whitespace, code\nreviews and git-diffs can focus on the semantics of the proposed changes rather\nthan style and formatting. We recommend ~~enforce~~ the use of findent to format your files. The body of every Fortran construct should be indented by three (3) spaces Line length should be limited to 80 characters and must not exceed 132 Do not use Tab characters for indentation Remove trailing white space before committing code Attributes Always specify intent for dummy arguments. Don’t use dimension attribute to declare arrays because it is more verbose.\n Use this: real, allocatable :: a(:), b(:,:) instead of: real, dimension(:), allocatable :: a real, dimension(:,:), allocatable :: b When defining many arrays of the same dimension, dimension can be used as an exception if it makes the code less verbose. If the optional attribute is used to declare a dummy argument, it should follow the intent attribute. End block closing statements Fortran allows certain block constructs or scopes to include the name of the program unit in the end statement.\nThe convention adopted herein is to include procedure names, module names and program names in the end statement,\nunless the closing statement can reasonably be expected to be on the same screen or page, within about 25 lines. Document public API code with FORD Documentation strings should be provided for all public and protected entities and their arguments or parameters.\nThis is currently accomplished using the FORD tool .\nFor help writing FORD style documentation please see the FORD wiki .\nThe following two sections are most relevant for contributing new code: Writing Documentation Documentation Meta Data Limitations To write the “spec” (specification) for a new proposal, please place it in the FORD “pages” directory at doc/specs/ .\nTo get help please see the “Writing Pages” and “Writing Documentation” pages\non the FORD wiki .","tags":"","loc":"page/contributing/styleguide.html"},{"title":"Python-API – yaeos","text":"Python API documentation. Dummy file to make sure the Python API documentation\nindex.html is generated, then is replaces with the index.html from the Python\ndocumentation generated with Sphinx.","tags":"","loc":"page/python-api/index.html"}]} \ No newline at end of file diff --git a/type/alphafunction.html b/type/alphafunction.html index ce05aee0a..4fb8c975b 100644 --- a/type/alphafunction.html +++ b/type/alphafunction.html @@ -134,7 +134,7 @@

    Type-Bound Procedures

    - alpha + alpha
    @@ -162,7 +162,7 @@

    Type-Bound Procedures

    - +

    procedure(abs_alpha), public, deferred :: alpha @@ -293,7 +293,7 @@

    Arguments

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/type/alpharkpr.html b/type/alpharkpr.html index a36ed09b2..ce0585951 100644 --- a/type/alpharkpr.html +++ b/type/alpharkpr.html @@ -118,7 +118,7 @@

    Variables

    - k + k
    @@ -145,7 +145,7 @@

    Type-Bound Procedures

    - alpha + alpha
    @@ -182,7 +182,7 @@

    Components

  • @@ -211,7 +211,7 @@

    Type-Bound Procedures

    - +

    procedure, public :: alpha => alpha_rkpr @@ -349,7 +349,7 @@

    Arguments

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/type/alphasoave.html b/type/alphasoave.html index f3bb0a58e..db22d32a8 100644 --- a/type/alphasoave.html +++ b/type/alphasoave.html @@ -118,7 +118,7 @@

    Variables

    - k + k
    @@ -145,7 +145,7 @@

    Type-Bound Procedures

    - alpha + alpha
    @@ -180,7 +180,7 @@

    Components

    @@ -209,7 +209,7 @@

    Type-Bound Procedures

    - +

    procedure, public :: alpha @@ -351,7 +351,7 @@

    Arguments

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/type/armodel.html b/type/armodel.html index 69f14570f..ad6adc273 100644 --- a/type/armodel.html +++ b/type/armodel.html @@ -150,13 +150,13 @@

    Type-Bound Procedures

    Cv_residual_vt enthalpy_residual_vt entropy_residual_vt - get_v0 + get_v0 gibbs_residual_vt lnphi_pt lnphi_vt pressure - residual_helmholtz - volume + residual_helmholtz + volume
    @@ -799,7 +799,7 @@

    Arguments

    - +

    procedure(abs_volume_initializer), public, deferred :: get_v0 @@ -1705,7 +1705,7 @@

    Arguments

    - +

    procedure(abs_residual_helmholtz), public, deferred :: residual_helmholtz @@ -1984,7 +1984,7 @@

    Arguments

    - +

    procedure, public :: volume @@ -1994,11 +1994,11 @@

    • - public subroutine volume(eos, n, P, T, V, root_type) + public subroutine volume(eos, n, P, T, V, root_type)

      -

      Solves volume roots using newton method. Given pressure and temperature.

      Read more… +

      Solves volume roots using newton method. Given pressure and temperature.

      Read more…

      Arguments

    - - class(FitMHVNRTL), + + class(FitKijLij), intent(inout) @@ -200,7 +197,7 @@

    Arguments

    - + real(kind=pr), intent(in)
    - + real(kind=pr), public ::a(nc,nc)kij(nc,nc) @@ -250,7 +247,7 @@

    Variables

    - + real(kind=pr), public ::b(nc,nc) - -
    - - real(kind=pr), - public - - ::c(nc,nc) - -
    - - type(NRTL), - public - - ::gelij(nc,nc) @@ -332,7 +295,7 @@

    Variables

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/model_from_x~2.html b/proc/model_from_x~2.html index d43a5e71f..567f93f0b 100644 --- a/proc/model_from_x~2.html +++ b/proc/model_from_x~2.html @@ -78,20 +78,20 @@

    model_from_X
  • 25 statements + title=" 0.6% of total for procedures.">31 statements
  • - Source File + Source File
  • @@ -118,8 +118,10 @@

    Variables

    - kij - lij + a + b + c + ge
    @@ -158,6 +160,7 @@

    Uses

  • @@ -167,7 +170,7 @@

    Uses

    Type Bound

    -

    FitKijLij

    +

    FitMHVNRTL

    Arguments

    @@ -182,8 +185,8 @@

    Arguments

    @@ -230,7 +233,7 @@

    Variables

    @@ -238,7 +241,7 @@

    Variables

    - + @@ -255,7 +258,41 @@

    Variables

    - + + + + + + + + + + + + + + + + + + + + + @@ -185,7 +185,7 @@

    Arguments

    @@ -200,7 +200,7 @@

    Arguments

    @@ -248,7 +248,7 @@

    Variables

    @@ -282,7 +282,7 @@

    Variables

    @@ -299,7 +299,7 @@

    Variables

    @@ -347,7 +347,7 @@

    Variables

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/ninthyperdual.html b/proc/ninthyperdual.html index b9b1e99d4..32f4191ed 100644 --- a/proc/ninthyperdual.html +++ b/proc/ninthyperdual.html @@ -210,7 +210,7 @@

    Return Value

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/numeric_ar_derivatives.html b/proc/numeric_ar_derivatives.html index 1a46d2d8f..00692d25f 100644 --- a/proc/numeric_ar_derivatives.html +++ b/proc/numeric_ar_derivatives.html @@ -122,10 +122,10 @@

    Variables

    Ar_aux2Ar_aux3Ar_aux4 - dn_aux1 - dn_aux2 - i - j + dn_aux1 + dn_aux2 + i + j @@ -209,7 +209,7 @@

    Arguments

    @@ -224,7 +224,7 @@

    Arguments

    @@ -239,7 +239,7 @@

    Arguments

    @@ -254,7 +254,7 @@

    Arguments

    @@ -269,7 +269,7 @@

    Arguments

    @@ -284,7 +284,7 @@

    Arguments

    @@ -299,7 +299,7 @@

    Arguments

    @@ -314,7 +314,7 @@

    Arguments

    @@ -329,7 +329,7 @@

    Arguments

    @@ -346,7 +346,7 @@

    Arguments

    @@ -363,7 +363,7 @@

    Arguments

    @@ -380,7 +380,7 @@

    Arguments

    @@ -397,7 +397,7 @@

    Arguments

    @@ -414,7 +414,7 @@

    Arguments

    @@ -431,7 +431,7 @@

    Arguments

    @@ -448,7 +448,7 @@

    Arguments

    @@ -465,7 +465,7 @@

    Arguments

    @@ -568,7 +568,7 @@

    Variables

    @@ -585,7 +585,7 @@

    Variables

    @@ -602,7 +602,7 @@

    Variables

    @@ -619,7 +619,7 @@

    Variables

    @@ -667,7 +667,7 @@

    Variables

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/numeric_ge_derivatives.html b/proc/numeric_ge_derivatives.html index 5f58c1052..7789bba3a 100644 --- a/proc/numeric_ge_derivatives.html +++ b/proc/numeric_ge_derivatives.html @@ -122,10 +122,10 @@

    Variables

    Ge_aux2Ge_aux3Ge_aux4 - dn_aux1 - dn_aux2 - i - j + dn_aux1 + dn_aux2 + i + j @@ -234,7 +234,7 @@

    Arguments

    @@ -250,7 +250,7 @@

    Arguments

    @@ -265,7 +265,7 @@

    Arguments

    @@ -280,7 +280,7 @@

    Arguments

    @@ -295,7 +295,7 @@

    Arguments

    @@ -496,7 +496,7 @@

    Variables

    @@ -513,7 +513,7 @@

    Variables

    @@ -530,7 +530,7 @@

    Variables

    @@ -547,7 +547,7 @@

    Variables

    @@ -595,7 +595,7 @@

    Variables

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/optimize.html b/proc/optimize.html index 47ee7a129..408b34bc7 100644 --- a/proc/optimize.html +++ b/proc/optimize.html @@ -187,7 +187,7 @@

    Arguments

    @@ -205,7 +205,7 @@

    Arguments

    Return Value - + real(kind=pr)

    @@ -241,7 +241,7 @@

    Return Value

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/optval_integer.html b/proc/optval_integer.html index 71e57108b..850f329bc 100644 --- a/proc/optval_integer.html +++ b/proc/optval_integer.html @@ -90,7 +90,7 @@

    optval_integer

    diff --git a/proc/optval_real.html b/proc/optval_real.html index 6d1ab40f3..106206911 100644 --- a/proc/optval_real.html +++ b/proc/optval_real.html @@ -90,7 +90,7 @@

    optval_real

    diff --git a/proc/p_wilson.html b/proc/p_wilson.html index 23ec37e33..e354e7a05 100644 --- a/proc/p_wilson.html +++ b/proc/p_wilson.html @@ -90,7 +90,7 @@

    P_wilson

    @@ -171,7 +171,7 @@

    Arguments

    @@ -186,7 +186,7 @@

    Arguments

    @@ -204,7 +204,7 @@

    Arguments

    Return Value - + real(kind=pr)

    @@ -240,7 +240,7 @@

    Return Value

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/pengrobinson76.html b/proc/pengrobinson76.html index 9f4822ca7..b8a615d22 100644 --- a/proc/pengrobinson76.html +++ b/proc/pengrobinson76.html @@ -118,11 +118,11 @@

    Variables

    @@ -160,11 +160,11 @@

    Uses

    @@ -296,7 +296,7 @@

    Arguments

    Return Value - + type(CubicEoS)

    @@ -318,7 +318,7 @@

    Variables

    @@ -352,7 +352,7 @@

    Variables

    @@ -386,7 +386,7 @@

    Variables

    @@ -434,7 +434,7 @@

    Variables

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/pengrobinson78.html b/proc/pengrobinson78.html index 8ebedfe01..f4d5c4f86 100644 --- a/proc/pengrobinson78.html +++ b/proc/pengrobinson78.html @@ -118,11 +118,11 @@

    Variables

    @@ -160,11 +160,11 @@

    Uses

    @@ -299,7 +299,7 @@

    Arguments

    Return Value - + type(CubicEoS)

    @@ -321,7 +321,7 @@

    Variables

    @@ -355,7 +355,7 @@

    Variables

    @@ -389,7 +389,7 @@

    Variables

    @@ -437,7 +437,7 @@

    Variables

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/plushyperdualhyperdual.html b/proc/plushyperdualhyperdual.html index 15a717abc..370011e34 100644 --- a/proc/plushyperdualhyperdual.html +++ b/proc/plushyperdualhyperdual.html @@ -210,7 +210,7 @@

    Return Value

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/powell_optimize.html b/proc/powell_optimize.html index 50a7ea44c..a6d1d2809 100644 --- a/proc/powell_optimize.html +++ b/proc/powell_optimize.html @@ -119,7 +119,7 @@

    Variables

    dx - n + n npt
    @@ -198,7 +198,7 @@

    Arguments

    @@ -213,7 +213,7 @@

    Arguments

    @@ -228,7 +228,7 @@

    Arguments

    @@ -243,7 +243,7 @@

    Arguments

    @@ -293,7 +293,7 @@

    Variables

    @@ -358,7 +358,7 @@

    Variables

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/powerhyperdualhyperdual.html b/proc/powerhyperdualhyperdual.html index 76d7a21a8..b96f6a2fa 100644 --- a/proc/powerhyperdualhyperdual.html +++ b/proc/powerhyperdualhyperdual.html @@ -270,7 +270,7 @@

    Variables

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/powerhyperdualint.html b/proc/powerhyperdualint.html index 2108d542d..b81289b63 100644 --- a/proc/powerhyperdualint.html +++ b/proc/powerhyperdualint.html @@ -118,7 +118,7 @@

    Variables

    - i + i vv2
    @@ -223,7 +223,7 @@

    Variables

    @@ -288,7 +288,7 @@

    Variables

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/powerhyperdualreal.html b/proc/powerhyperdualreal.html index 052b6acca..6988b8e18 100644 --- a/proc/powerhyperdualreal.html +++ b/proc/powerhyperdualreal.html @@ -119,7 +119,7 @@

    Variables

    @@ -241,7 +241,7 @@

    Variables

    @@ -306,7 +306,7 @@

    Variables

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/pr76_factory.html b/proc/pr76_factory.html index 4506aa751..d439891c2 100644 --- a/proc/pr76_factory.html +++ b/proc/pr76_factory.html @@ -123,7 +123,7 @@

    Variables

    becritical_specga - i + iomaombparams_spec @@ -388,7 +388,7 @@

    Variables

    @@ -521,7 +521,7 @@

    Variables

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/pr78_factory.html b/proc/pr78_factory.html index bff3c32b6..90ad60ee6 100644 --- a/proc/pr78_factory.html +++ b/proc/pr78_factory.html @@ -123,7 +123,7 @@

    Variables

    becritical_specga - i + iomaombparams_spec @@ -388,7 +388,7 @@

    Variables

    @@ -521,7 +521,7 @@

    Variables

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/pressure.html b/proc/pressure.html index 487a779ce..90aebd6fd 100644 --- a/proc/pressure.html +++ b/proc/pressure.html @@ -118,14 +118,14 @@

    Variables

    - Ar - ArTV - ArV - ArV2 - ArVn - dn - nc - totn + Ar + ArTV + ArV + ArV2 + ArVn + dn + nc + totn
    @@ -187,7 +187,7 @@

    Arguments

    @@ -202,7 +202,7 @@

    Arguments

    @@ -217,7 +217,7 @@

    Arguments

    @@ -232,7 +232,7 @@

    Arguments

    @@ -247,7 +247,7 @@

    Arguments

    @@ -296,7 +296,7 @@

    Arguments

    @@ -331,7 +331,7 @@

    Variables

    @@ -348,7 +348,7 @@

    Variables

    @@ -365,7 +365,7 @@

    Variables

    @@ -382,7 +382,7 @@

    Variables

    @@ -399,7 +399,7 @@

    Variables

    @@ -416,7 +416,7 @@

    Variables

    @@ -433,7 +433,7 @@

    Variables

    @@ -450,7 +450,7 @@

    Variables

    @@ -498,7 +498,7 @@

    Variables

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/pressure_equality_v_beta_xy.html b/proc/pressure_equality_v_beta_xy.html index 3c9bfc7f2..6a25b0cf5 100644 --- a/proc/pressure_equality_v_beta_xy.html +++ b/proc/pressure_equality_v_beta_xy.html @@ -190,7 +190,7 @@

    Arguments

    @@ -205,7 +205,7 @@

    Arguments

    @@ -220,7 +220,7 @@

    Arguments

    @@ -235,7 +235,7 @@

    Arguments

    @@ -250,7 +250,7 @@

    Arguments

    @@ -265,7 +265,7 @@

    Arguments

    @@ -310,7 +310,7 @@

    Arguments

    @@ -544,7 +544,7 @@

    Variables

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/psat.html b/proc/psat.html index bf3d402ad..bf915356a 100644 --- a/proc/psat.html +++ b/proc/psat.html @@ -120,9 +120,9 @@

    Variables

    P1 P2 - f1 - f2 - n + f1 + f2 + n
    @@ -184,7 +184,7 @@

    Arguments

    @@ -215,7 +215,7 @@

    Arguments

    @@ -289,7 +289,7 @@

    Variables

    @@ -306,7 +306,7 @@

    Variables

    @@ -323,7 +323,7 @@

    Variables

    @@ -371,7 +371,7 @@

    Arguments

    @@ -421,7 +421,7 @@

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/pt_envelope_2ph.html b/proc/pt_envelope_2ph.html index 9affe339c..98eca6298 100644 --- a/proc/pt_envelope_2ph.html +++ b/proc/pt_envelope_2ph.html @@ -119,13 +119,13 @@

    Variables

    @@ -149,7 +149,7 @@

    Subroutines

    @@ -206,7 +206,7 @@

    Arguments

    @@ -387,7 +387,7 @@

    Variables

    @@ -490,7 +490,7 @@

    Variables

    @@ -556,7 +556,7 @@

    Arguments

    @@ -637,7 +637,7 @@

    Arguments

    -

    subroutine foo(X, ns, S, F, dF, dFdS) +

    subroutine foo(X, ns, S, F, dF, dFdS)

    @@ -656,7 +656,7 @@

    Arguments

    @@ -701,7 +701,7 @@

    Arguments

    @@ -716,7 +716,7 @@

    Arguments

    @@ -771,7 +771,7 @@

    Arguments

    @@ -826,7 +826,7 @@

    Arguments

    @@ -944,7 +944,7 @@

    Arguments

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/purefug_calc.html b/proc/purefug_calc.html index 18a9d8a25..7ff41bf72 100644 --- a/proc/purefug_calc.html +++ b/proc/purefug_calc.html @@ -118,13 +118,13 @@

    Variables

    - Ar - ArTV - ArTn - ArV2 - ArVn - Arn - Arn2 + Ar + ArTV + ArTn + ArV2 + ArVn + Arn + Arn2 Arv RT Z @@ -179,7 +179,7 @@

    Arguments

    @@ -209,7 +209,7 @@

    Arguments

    @@ -224,7 +224,7 @@

    Arguments

    @@ -239,7 +239,7 @@

    Arguments

    @@ -287,7 +287,7 @@

    Variables

    @@ -304,7 +304,7 @@

    Variables

    @@ -321,7 +321,7 @@

    Variables

    @@ -338,7 +338,7 @@

    Variables

    @@ -355,7 +355,7 @@

    Variables

    @@ -372,7 +372,7 @@

    Variables

    @@ -389,7 +389,7 @@

    Variables

    @@ -522,7 +522,7 @@

    Variables

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/px_envelope_2ph.html b/proc/px_envelope_2ph.html index a7cbf2c0e..4fddf82ed 100644 --- a/proc/px_envelope_2ph.html +++ b/proc/px_envelope_2ph.html @@ -118,17 +118,17 @@

    Variables

    - S0 - T - X - XS - dS0 - kind - max_iterations - max_points - nc - ns - z + S0 + T + X + XS + dS0 + kind + max_iterations + max_points + nc + ns + z
    @@ -151,7 +151,7 @@

    Subroutines

    @@ -208,7 +208,7 @@

    Arguments

    @@ -348,7 +348,7 @@

    Arguments

    @@ -403,7 +403,7 @@

    Variables

    @@ -420,7 +420,7 @@

    Variables

    @@ -437,7 +437,7 @@

    Variables

    @@ -454,7 +454,7 @@

    Variables

    @@ -471,7 +471,7 @@

    Variables

    @@ -488,7 +488,7 @@

    Variables

    @@ -505,7 +505,7 @@

    Variables

    @@ -522,7 +522,7 @@

    Variables

    @@ -539,7 +539,7 @@

    Variables

    @@ -556,7 +556,7 @@

    Variables

    @@ -573,7 +573,7 @@

    Variables

    @@ -622,7 +622,7 @@

    Arguments

    @@ -637,7 +637,7 @@

    Arguments

    @@ -652,7 +652,7 @@

    Arguments

    @@ -667,7 +667,7 @@

    Arguments

    @@ -682,7 +682,7 @@

    Arguments

    @@ -703,7 +703,7 @@

    Arguments

    -

    recursive subroutine foo(X, ns, S, F, dF, dFdS) +

    recursive subroutine foo(X, ns, S, F, dF, dFdS)

    @@ -722,7 +722,7 @@

    Arguments

    @@ -737,7 +737,7 @@

    Arguments

    @@ -752,7 +752,7 @@

    Arguments

    @@ -767,7 +767,7 @@

    Arguments

    @@ -782,7 +782,7 @@

    Arguments

    @@ -797,7 +797,7 @@

    Arguments

    @@ -837,7 +837,7 @@

    Arguments

    @@ -852,7 +852,7 @@

    Arguments

    @@ -892,7 +892,7 @@

    Arguments

    @@ -908,7 +908,7 @@

    Arguments

    @@ -923,7 +923,7 @@

    Arguments

    @@ -938,7 +938,7 @@

    Arguments

    @@ -953,7 +953,7 @@

    Arguments

    @@ -1010,7 +1010,7 @@

    Arguments

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/rachford_rice.html b/proc/rachford_rice.html index b348acea8..fcb21e870 100644 --- a/proc/rachford_rice.html +++ b/proc/rachford_rice.html @@ -168,7 +168,7 @@

    Arguments

    @@ -183,7 +183,7 @@

    Arguments

    @@ -198,7 +198,7 @@

    Arguments

    @@ -309,7 +309,7 @@

    Variables

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/realhyperdual.html b/proc/realhyperdual.html index 209656987..180fd6913 100644 --- a/proc/realhyperdual.html +++ b/proc/realhyperdual.html @@ -210,7 +210,7 @@

    Return Value

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/rel_error.html b/proc/rel_error.html index 24ae2e9a0..4ccbb79ba 100644 --- a/proc/rel_error.html +++ b/proc/rel_error.html @@ -156,7 +156,7 @@

    Arguments

    @@ -171,7 +171,7 @@

    Arguments

    @@ -225,7 +225,7 @@

    Return Value

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/residual_helmholtz.html b/proc/residual_helmholtz.html index 3d8ae498d..b4f678cc3 100644 --- a/proc/residual_helmholtz.html +++ b/proc/residual_helmholtz.html @@ -78,20 +78,20 @@

    residual_helmholtz
  • 95 statements + title=" 2.3% of total for procedures.">126 statements
  • - Source File + Source File
  • @@ -118,27 +118,10 @@

    Variables

    - arval - arvalb - arvald - arvald0 - arvaldb - arvaldd - df - df2 - i - nb - nc - nd - ndb - tb - td - td0 - tdb - vb - vd - vd0 - vdb + d_Ar + d_n + d_t + d_v
    @@ -152,19 +135,7 @@

    Variables

    - - + @@ -191,14 +171,13 @@

    Subroutines

    -

    private subroutine residual_helmholtz(self, n, v, t, Ar, ArV, ArT, ArTV, ArV2, ArT2, Arn, ArVn, ArTn, Arn2) +

    public subroutine residual_helmholtz(self, n, v, t, Ar, ArV, ArT, ArTV, ArV2, ArT2, Arn, ArVn, ArTn, Arn2)

    -

    Residual Helmholtz model generic interface

    Type Bound

    -

    ArModelTapenade

    +

    ArModelAdiff

    Arguments

    - - class(FitKijLij), + + class(FitMHVNRTL), intent(inout) @@ -197,7 +200,7 @@

    Arguments

    - + real(kind=pr), intent(in)
    - + real(kind=pr), public ::kij(nc,nc)a(nc,nc) @@ -247,7 +250,7 @@

    Variables

    - + real(kind=pr), public ::lij(nc,nc)b(nc,nc) + +
    + + real(kind=pr), + public + + ::c(nc,nc) + +
    + + type(NRTL), + public + + ::ge @@ -295,7 +332,7 @@

    Variables

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/multiplyhyperdualhyperdual.html b/proc/multiplyhyperdualhyperdual.html index c9bc3f9dd..72123c8a1 100644 --- a/proc/multiplyhyperdualhyperdual.html +++ b/proc/multiplyhyperdualhyperdual.html @@ -225,7 +225,7 @@

    Return Value

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/multiplyhyperdualint.html b/proc/multiplyhyperdualint.html index 2ae28aa4b..93f78a145 100644 --- a/proc/multiplyhyperdualint.html +++ b/proc/multiplyhyperdualint.html @@ -225,7 +225,7 @@

    Return Value

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/multiplyhyperdualreal.html b/proc/multiplyhyperdualreal.html index 8f39bba6a..d0297f2a0 100644 --- a/proc/multiplyhyperdualreal.html +++ b/proc/multiplyhyperdualreal.html @@ -225,7 +225,7 @@

    Return Value

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/multiplyinthyperdual.html b/proc/multiplyinthyperdual.html index 8fcc39f2e..e3096f28d 100644 --- a/proc/multiplyinthyperdual.html +++ b/proc/multiplyinthyperdual.html @@ -225,7 +225,7 @@

    Return Value

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/multiplyrealhyperdual.html b/proc/multiplyrealhyperdual.html index e8aa7968c..9dd9b521a 100644 --- a/proc/multiplyrealhyperdual.html +++ b/proc/multiplyrealhyperdual.html @@ -225,7 +225,7 @@

    Return Value

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/ne_dd.html b/proc/ne_dd.html index 44be50420..2df3c5ce6 100644 --- a/proc/ne_dd.html +++ b/proc/ne_dd.html @@ -225,7 +225,7 @@

    Return Value

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/ne_di.html b/proc/ne_di.html index f49b83211..6e75047df 100644 --- a/proc/ne_di.html +++ b/proc/ne_di.html @@ -225,7 +225,7 @@

    Return Value

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/ne_dr.html b/proc/ne_dr.html index 35c0d8689..4fe499076 100644 --- a/proc/ne_dr.html +++ b/proc/ne_dr.html @@ -225,7 +225,7 @@

    Return Value

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/ne_id.html b/proc/ne_id.html index 39d0a3384..c10f899da 100644 --- a/proc/ne_id.html +++ b/proc/ne_id.html @@ -225,7 +225,7 @@

    Return Value

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/ne_rd.html b/proc/ne_rd.html index e4625a4e4..77ddc0557 100644 --- a/proc/ne_rd.html +++ b/proc/ne_rd.html @@ -225,7 +225,7 @@

    Return Value

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/newton_1d.html b/proc/newton_1d.html index c6a7289bb..0432f5a50 100644 --- a/proc/newton_1d.html +++ b/proc/newton_1d.html @@ -118,10 +118,10 @@

    Variables

    - df + df fval - i - step + i + step
    @@ -170,7 +170,7 @@

    Arguments

    - + procedure(f_1d)
    - + real(kind=pr), intent(inout)
    - + real(kind=pr), intent(in)
    - + real(kind=pr), public
    - + integer, public
    - + real(kind=pr), public
    - + class(ArModel), intent(in)
    - + real(kind=pr), intent(in)
    - + real(kind=pr), intent(in)
    - + real(kind=pr), intent(in)
    - + real(kind=pr), intent(in)
    - + real(kind=pr), intent(in)
    - + real(kind=pr), intent(in)
    - + real(kind=pr), intent(out)
    - + real(kind=pr), intent(out),
    - + real(kind=pr), intent(out),
    - + real(kind=pr), intent(out),
    - + real(kind=pr), intent(out),
    - + real(kind=pr), intent(out),
    - + real(kind=pr), intent(out),
    - + real(kind=pr), intent(out),
    - + real(kind=pr), intent(out),
    - + real(kind=pr), intent(out),
    - + real(kind=pr), public
    - + real(kind=pr), public
    - + integer, public
    - + integer, public
    - + class(GeModel), intent(in)
    - + real(kind=pr), intent(in)
    - + real(kind=pr), intent(in)
    - + real(kind=pr), intent(in)
    - + real(kind=pr), intent(in)
    - + real(kind=pr), public
    - + real(kind=pr), public
    - + integer, public
    - + integer, public
    - + class(FittingProblem), intent(inout),
    - + class(BaseModel), intent(in)
    - + real(kind=pr), intent(in)
    - + real(kind=pr), intent(in)
    - + type(AlphaSoave), private
    - + integer, private
    - + integer, private
    - + type(AlphaSoave), private
    - + integer, private
    - + integer, private
    - + procedure(obj_func)
    - + real(kind=pr), intent(inout)
    - + real(kind=pr), intent(out)
    - + class(*), intent(inout),
    - + integer, private
    - + integer, public
    - + real(kind=pr), public,
    - + integer, public
    - + integer, public
    - + class(ArModel), intent(in)
    - + real(kind=pr), intent(in)
    - + real(kind=pr), intent(in)
    - + real(kind=pr), intent(in)
    - + real(kind=pr), intent(out)
    - + real(kind=pr), intent(out),
    - + real(kind=pr), public
    - + real(kind=pr), public
    - + real(kind=pr), public
    - + real(kind=pr), public
    - + real(kind=pr), public
    - + logical, public
    - + integer, public
    - + real(kind=pr), public
    - + class(ArModel), intent(in)
    - + real(kind=pr), intent(in)
    - + real(kind=pr), intent(in)
    - + real(kind=pr), intent(in)
    - + real(kind=pr), intent(in)
    - + real(kind=pr), intent(in)
    - + real(kind=pr), intent(out)
    - + class(ArModel), intent(in)
    - + real(kind=pr), intent(in)
    - + real(kind=pr), public
    - + real(kind=pr), public
    - + real(kind=pr), public
    - + real(kind=pr), intent(in)
    - + class(ArModel), intent(in)
    - + real(kind=pr), public
    - + integer, public
    - + real(kind=pr), intent(inout)
    - + real(kind=pr), intent(in)
    - + real(kind=pr), intent(out)
    - + real(kind=pr), intent(out)
    - + real(kind=pr), intent(in)
    - + real(kind=pr), intent(inout)
    - + integer, intent(in)
    - + real(kind=pr), intent(in)
    - + real(kind=pr), intent(in)
    - + real(kind=pr), intent(in)
    - + real(kind=pr), public
    - + real(kind=pr), public
    - + real(kind=pr), public
    - + real(kind=pr), public
    - + real(kind=pr), public
    - + real(kind=pr), public
    - + real(kind=pr), public
    - + class(ArModel), intent(in)
    - + procedure(continuation_solver),
    - + real(kind=pr), public
    - + real(kind=pr), public
    - + real(kind=pr), public
    - + real(kind=pr), public,
    - + real(kind=pr), public
    - + character(len=14), public
    - + integer, public
    - + integer, public
    - + integer, public
    - + integer, public
    - + real(kind=pr), public
    - + real(kind=pr), intent(inout)
    - + real(kind=pr), intent(inout)
    - + integer, intent(inout)
    - + real(kind=pr), intent(inout)
    - + real(kind=pr), intent(inout)
    - + real(kind=pr), intent(in)
    - + integer, intent(in)
    - + real(kind=pr), intent(in)
    - + real(kind=pr), intent(out)
    - + real(kind=pr), intent(out)
    - + real(kind=pr), intent(out)
    - + real(kind=pr), intent(in)
    - + integer, intent(in)
    - + real(kind=pr), intent(inout)
    - + integer, intent(inout)
    - + real(kind=pr), intent(inout)
    - + real(kind=pr), intent(inout)
    - + real(kind=pr), intent(inout)
    - + real(kind=pr), intent(in)
    - + real(kind=pr), intent(in)
    - + real(kind=pr), intent(in)
    - + real(kind=pr), intent(in)
    - + real(kind=pr), intent(in)
    @@ -213,8 +192,8 @@

    Arguments

    @@ -243,7 +222,7 @@

    Arguments

    @@ -258,7 +237,7 @@

    Arguments

    @@ -273,7 +252,7 @@

    Arguments

    @@ -288,7 +267,7 @@

    Arguments

    @@ -303,7 +282,7 @@

    Arguments

    @@ -318,7 +297,7 @@

    Arguments

    @@ -333,7 +312,7 @@

    Arguments

    @@ -348,7 +327,7 @@

    Arguments

    @@ -363,7 +342,7 @@

    Arguments

    @@ -378,7 +357,7 @@

    Arguments

    @@ -393,7 +372,7 @@

    Arguments

    @@ -408,7 +387,7 @@

    Arguments

    @@ -441,236 +420,15 @@

    Variables

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -235,7 +235,7 @@

    Arguments

    @@ -250,7 +250,7 @@

    Arguments

    @@ -265,7 +265,7 @@

    Arguments

    @@ -280,7 +280,7 @@

    Arguments

    @@ -310,7 +310,7 @@

    Arguments

    @@ -392,7 +392,7 @@

    Variables

    @@ -409,7 +409,7 @@

    Variables

    @@ -426,7 +426,7 @@

    Variables

    @@ -443,7 +443,7 @@

    Variables

    @@ -645,7 +645,7 @@

    Arguments

    @@ -660,7 +660,7 @@

    Arguments

    @@ -747,7 +747,7 @@

    Arguments

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/volume~2.html b/proc/volume~2.html index 1a31420e2..023f2b80e 100644 --- a/proc/volume~2.html +++ b/proc/volume~2.html @@ -78,20 +78,20 @@

    volume
  • 52 statements + title=" 1.2% of total for procedures.">64 statements
  • - Source File + Source File
  • @@ -118,14 +118,34 @@

    Variables

    - Gr - GrL - GrV - Vliq - Vvap - max_iters - tol - totnRT + AT_Liq + AT_Vap + Ar + Bmix + D + D1 + D2 + Tr + V_liq + V_vap + a + cp + cr + dBi + dBij + dD1i + dD1ij + dDdT + dDdT2 + dDi + dDidT + dDij + dadt + dadt2 + flag + rr + totn + z
    @@ -140,18 +160,7 @@

    Variables

    -
    - -
    -
    - foo -
    -
    -
    - + @@ -174,8 +183,9 @@

    Uses

    @@ -183,20 +193,46 @@

    Uses

    -

    Volume solver routine for residual Helmholtz models.

    -

    Solves volume roots using newton method. Given pressure and temperature.

    +

    Cubic EoS volume solver

    +

    Volume solver optimized for Cubic Equations of State.

    +

    @warn +This routine intends to use the analyitical solution of the cubic +equation, but due to errors in the solutions it is not used. And +the general volume solver by Michelsen is used instead. +@endwarn

    Description

    -

    This subroutine solves the volume using a newton method. The variable -root_type

    +

    Cubic equations can be analytically solved. Using an anallytical +solution provides the best possible solution in terms of speed and +precision. This subroutine uses the modified cardano method proposed +by Rosendo.

    Examples

    -
    class(ArModel) :: eos
    -call eos%volume(n, P, T, V, root_type="liquid")
    -call eos%volume(n, P, T, V, root_type="vapor")
    -call eos%volume(n, P, T, V, root_type="stable")
    +
     use yaeos, only: CubicEoS, PengRobinson
    + type(CubicEoS) :: eos
    +
    + eos = PengRobinson(tc, pc, w)
    + ! Possible roots to solve
    + call eos%volume(n, P, T, V, "liquid")
    + call eos%volume(n, P, T, V, "vapor")
    + call eos%volume(n, P, T, V, "stable")
     
    +

    References

    +
      +
    • +

      [1] “Thermodynamic Models: Fundamental and Computational Aspects”, + Michael L. Michelsen, Jørgen M. Mollerup. + Tie-Line Publications, Denmark (2004) +doi

      +
    • +
    • +

      [2] “A Note on the Analytical Solution of Cubic Equations of State +in Process Simulation”, Rosendo Monroy-Loperena +doi

      +
    • +
    +

    Type Bound

    -

    ArModel

    +

    CubicEoS

    Arguments

    - - class(ArModelTapenade), + + class(ArModelAdiff), intent(in) @@ -228,7 +207,7 @@

    Arguments

    - + real(kind=pr), intent(in)
    - + real(kind=pr), intent(in)
    - + real(kind=pr), intent(in)
    - + real(kind=pr), intent(out),
    - + real(kind=pr), intent(out),
    - + real(kind=pr), intent(out),
    - + real(kind=pr), intent(out),
    - + real(kind=pr), intent(out),
    - + real(kind=pr), intent(out),
    - + real(kind=pr), intent(out),
    - + real(kind=pr), intent(out),
    - + real(kind=pr), intent(out),
    - + real(kind=pr), intent(out),
    - - real(kind=pr), - private - - ::arval - -
    - - real(kind=pr), - private - - ::arvalb - -
    - - real(kind=pr), - private - - ::arvald - -
    - - real(kind=pr), - private - - ::arvald0 - -
    - - real(kind=pr), - private - - ::arvaldb - -
    - - real(kind=pr), - private - - ::arvaldd - -
    - - real(kind=pr), - private - - ::df(size(n)+2) - -
    - - real(kind=pr), - private - - ::df2(size(n)+2,size(n)+2) - -
    - - integer, - private - - ::i - -
    - - real(kind=pr), - private - - ::nb(size(n)) - -
    - - integer, - private - - ::nc - -
    - - real(kind=pr), - private - - ::nd(size(n)) - -
    - - real(kind=pr), - private - - ::ndb(size(n)) - -
    - - real(kind=pr), + + type(hyperdual), privatepublic ::tbd_Ar @@ -679,15 +437,15 @@

    Variables

    - - real(kind=pr), + + type(hyperdual), privatepublic ::tdd_n(size(n)) @@ -696,15 +454,15 @@

    Variables

    - - real(kind=pr), + + type(hyperdual), privatepublic ::td0d_t @@ -713,83 +471,15 @@

    Variables

    - - real(kind=pr), + + type(hyperdual), privatepublic ::tdb - -
    - - real(kind=pr), - private - - ::vb - -
    - - real(kind=pr), - private - - ::vd - -
    - - real(kind=pr), - private - - ::vd0 - -
    - - real(kind=pr), - private - - ::vdbd_v @@ -806,107 +496,129 @@

    Variables

    - + +
    -

    Functions

    +

    Subroutines

    -

    function get_ArnX(var) +

    subroutine get_dardn()

    Arguments

    - - - - - - - - - - - - - - - - - - - -
    TypeIntentOptional AttributesName
    - - character(len=*), - intent(in) - - ::var + None -
    +
    +

    -

    - Return Value - real(kind=pr), (size(n)) -

    - +
    +

    subroutine get_dardn2() +

    +
    + + + +

    Arguments

    + None
    -

    function get_dArdX2(var) +

    subroutine get_dardt()

    Arguments

    - - - - - - - - - - - - - - - - - - - -
    TypeIntentOptional AttributesName
    - - character(len=*), - intent(in) - - ::var + None -
    +
    +

    -

    - Return Value - real(kind=pr) -

    - +
    +

    subroutine get_dardt2() +

    +
    + + + +

    Arguments

    + None
    -
    -
    +
    +

    subroutine get_dardtn() +

    +
    + + + +

    Arguments

    + None +
    +
    + +
    +

    subroutine get_dardv() +

    +
    + + + +

    Arguments

    + None + +
    +
    + +
    +

    subroutine get_dardv2() +

    +
    + + + +

    Arguments

    + None + +
    +
    + +
    +

    subroutine get_dardvn() +

    +
    + + + +

    Arguments

    + None + +
    +
    + +
    +

    subroutine get_dardvt() +

    +
    + + + +

    Arguments

    + None + +
    +
    -
    -

    Subroutines

    -

    subroutine reset_vars() +

    subroutine reset_vars()

    @@ -940,7 +652,7 @@

    Arguments

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/residual_helmholtz~2.html b/proc/residual_helmholtz~2.html index 3b1a94eab..68bccfab2 100644 --- a/proc/residual_helmholtz~2.html +++ b/proc/residual_helmholtz~2.html @@ -78,20 +78,20 @@

    residual_helmholtz
  • 126 statements + title=" 1.7% of total for procedures.">95 statements
  • - Source File + Source File
  • @@ -118,10 +118,27 @@

    Variables

    - d_Ar - d_n - d_t - d_v + arval + arvalb + arvald + arvald0 + arvaldb + arvaldd + df + df2 + i + nb + nc + nd + ndb + tb + td + td0 + tdb + vb + vd + vd0 + vdb
    @@ -135,7 +152,19 @@

    Variables

    - + + @@ -171,13 +191,14 @@

    Subroutines

    -

    public subroutine residual_helmholtz(self, n, v, t, Ar, ArV, ArT, ArTV, ArV2, ArT2, Arn, ArVn, ArTn, Arn2) +

    private subroutine residual_helmholtz(self, n, v, t, Ar, ArV, ArT, ArTV, ArV2, ArT2, Arn, ArVn, ArTn, Arn2)

    +

    Residual Helmholtz model generic interface

    Type Bound

    -

    ArModelAdiff

    +

    ArModelTapenade

    Arguments

    @@ -192,8 +213,8 @@

    Arguments

    @@ -222,7 +243,7 @@

    Arguments

    @@ -237,7 +258,7 @@

    Arguments

    @@ -252,7 +273,7 @@

    Arguments

    @@ -267,7 +288,7 @@

    Arguments

    @@ -282,7 +303,7 @@

    Arguments

    @@ -297,7 +318,7 @@

    Arguments

    @@ -312,7 +333,7 @@

    Arguments

    @@ -327,7 +348,7 @@

    Arguments

    @@ -342,7 +363,7 @@

    Arguments

    @@ -357,7 +378,7 @@

    Arguments

    @@ -372,7 +393,7 @@

    Arguments

    @@ -387,7 +408,7 @@

    Arguments

    @@ -420,15 +441,236 @@

    Variables

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -341,7 +341,7 @@

    Arguments

    Return Value - + type(CubicEoS)

    @@ -516,7 +516,7 @@

    Variables

    @@ -652,7 +652,7 @@

    Variables

    @@ -686,7 +686,7 @@

    Variables

    @@ -734,7 +734,7 @@

    Variables

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/rkpr_d1mix.html b/proc/rkpr_d1mix.html index e9ecee434..c06eecf59 100644 --- a/proc/rkpr_d1mix.html +++ b/proc/rkpr_d1mix.html @@ -179,7 +179,7 @@

    Arguments

    @@ -194,7 +194,7 @@

    Arguments

    @@ -209,7 +209,7 @@

    Arguments

    @@ -224,7 +224,7 @@

    Arguments

    @@ -239,7 +239,7 @@

    Arguments

    @@ -254,7 +254,7 @@

    Arguments

    @@ -301,7 +301,7 @@

    Arguments

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/saturation_pressure.html b/proc/saturation_pressure.html index a8f36c306..fd7fe3180 100644 --- a/proc/saturation_pressure.html +++ b/proc/saturation_pressure.html @@ -118,24 +118,24 @@

    Variables

    @@ -205,7 +205,7 @@

    Arguments

    @@ -220,7 +220,7 @@

    Arguments

    @@ -235,7 +235,7 @@

    Arguments

    @@ -250,7 +250,7 @@

    Arguments

    @@ -295,7 +295,7 @@

    Arguments

    @@ -335,7 +335,7 @@

    Variables

    @@ -352,7 +352,7 @@

    Variables

    @@ -369,7 +369,7 @@

    Variables

    @@ -386,7 +386,7 @@

    Variables

    @@ -420,7 +420,7 @@

    Variables

    @@ -454,7 +454,7 @@

    Variables

    @@ -471,7 +471,7 @@

    Variables

    @@ -539,7 +539,7 @@

    Variables

    @@ -556,7 +556,7 @@

    Variables

    @@ -590,7 +590,7 @@

    Variables

    @@ -607,7 +607,7 @@

    Variables

    @@ -624,7 +624,7 @@

    Variables

    @@ -672,7 +672,7 @@

    Variables

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/saturation_temperature.html b/proc/saturation_temperature.html index 6f16c0372..4bac6aae6 100644 --- a/proc/saturation_temperature.html +++ b/proc/saturation_temperature.html @@ -118,24 +118,24 @@

    Variables

    @@ -205,7 +205,7 @@

    Arguments

    @@ -220,7 +220,7 @@

    Arguments

    @@ -235,7 +235,7 @@

    Arguments

    @@ -250,7 +250,7 @@

    Arguments

    @@ -295,7 +295,7 @@

    Arguments

    @@ -335,7 +335,7 @@

    Variables

    @@ -352,7 +352,7 @@

    Variables

    @@ -369,7 +369,7 @@

    Variables

    @@ -420,7 +420,7 @@

    Variables

    @@ -454,7 +454,7 @@

    Variables

    @@ -471,7 +471,7 @@

    Variables

    @@ -539,7 +539,7 @@

    Variables

    @@ -556,7 +556,7 @@

    Variables

    @@ -590,7 +590,7 @@

    Variables

    @@ -607,7 +607,7 @@

    Variables

    @@ -624,7 +624,7 @@

    Variables

    @@ -672,7 +672,7 @@

    Variables

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/setup.html b/proc/setup.html index 2f78510db..b6315d61e 100644 --- a/proc/setup.html +++ b/proc/setup.html @@ -157,7 +157,7 @@

    Arguments

    @@ -249,7 +249,7 @@

    Arguments

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/setup_unifac.html b/proc/setup_unifac.html index d41fd80ee..a2e2b934d 100644 --- a/proc/setup_unifac.html +++ b/proc/setup_unifac.html @@ -120,9 +120,9 @@

    Variables

    Aij gi - i - j - k + i + j + k params psi_function qks @@ -299,7 +299,7 @@

    Variables

    @@ -316,7 +316,7 @@

    Variables

    @@ -333,7 +333,7 @@

    Variables

    @@ -466,7 +466,7 @@

    Variables

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/sign_dd.html b/proc/sign_dd.html index 2a74c5ad0..e9a926c73 100644 --- a/proc/sign_dd.html +++ b/proc/sign_dd.html @@ -270,7 +270,7 @@

    Variables

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/sign_dr.html b/proc/sign_dr.html index 229c1c80a..afef1c428 100644 --- a/proc/sign_dr.html +++ b/proc/sign_dr.html @@ -270,7 +270,7 @@

    Variables

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/sign_rd.html b/proc/sign_rd.html index 8a3311ec4..24338a39c 100644 --- a/proc/sign_rd.html +++ b/proc/sign_rd.html @@ -270,7 +270,7 @@

    Variables

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/sinhhyperdual.html b/proc/sinhhyperdual.html index 099147968..234aa7906 100644 --- a/proc/sinhhyperdual.html +++ b/proc/sinhhyperdual.html @@ -273,7 +273,7 @@

    Variables

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/sinhyperdual.html b/proc/sinhyperdual.html index c9bd16a08..7867630fb 100644 --- a/proc/sinhyperdual.html +++ b/proc/sinhyperdual.html @@ -118,8 +118,8 @@

    Variables

    - dx - f + dx + f
    @@ -208,7 +208,7 @@

    Variables

    @@ -225,7 +225,7 @@

    Variables

    @@ -273,7 +273,7 @@

    Variables

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/size_ar_model.html b/proc/size_ar_model.html index cafe18d1e..360867a86 100644 --- a/proc/size_ar_model.html +++ b/proc/size_ar_model.html @@ -157,7 +157,7 @@

    Arguments

    @@ -211,7 +211,7 @@

    Return Value

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/soaveredlichkwong.html b/proc/soaveredlichkwong.html index ea0969373..3fb0e9f03 100644 --- a/proc/soaveredlichkwong.html +++ b/proc/soaveredlichkwong.html @@ -118,11 +118,11 @@

    Variables

    @@ -293,7 +293,7 @@

    Arguments

    Return Value - + type(CubicEoS)

    @@ -315,7 +315,7 @@

    Variables

    @@ -349,7 +349,7 @@

    Variables

    @@ -383,7 +383,7 @@

    Variables

    @@ -431,7 +431,7 @@

    Variables

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/solve_rr.html b/proc/solve_rr.html index d2ee1880b..11d8744dc 100644 --- a/proc/solve_rr.html +++ b/proc/solve_rr.html @@ -119,8 +119,8 @@

    Variables

    dgdb - g - step + g + step
    @@ -170,7 +170,7 @@

    Arguments

    @@ -185,7 +185,7 @@

    Arguments

    @@ -200,7 +200,7 @@

    Arguments

    @@ -283,7 +283,7 @@

    Variables

    @@ -300,7 +300,7 @@

    Variables

    @@ -348,7 +348,7 @@

    Variables

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/solve_system.html b/proc/solve_system.html index e4a6ef1d7..8900ea8d7 100644 --- a/proc/solve_system.html +++ b/proc/solve_system.html @@ -125,7 +125,7 @@

    Variables

    ipivldaldb - n + nnrhs @@ -187,7 +187,7 @@

    Arguments

    @@ -202,7 +202,7 @@

    Arguments

    @@ -220,7 +220,7 @@

    Arguments

    Return Value - + real(kind=pr), (size(b))

    @@ -361,7 +361,7 @@

    Variables

    @@ -429,7 +429,7 @@

    Arguments

    @@ -459,7 +459,7 @@

    Arguments

    @@ -504,7 +504,7 @@

    Arguments

    @@ -583,7 +583,7 @@

    Arguments

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/sort.html b/proc/sort.html index 7bc8d8312..fe072a9b2 100644 --- a/proc/sort.html +++ b/proc/sort.html @@ -90,7 +90,7 @@

    sort

    diff --git a/proc/sq_error.html b/proc/sq_error.html index 2383e8cf6..4e02510e8 100644 --- a/proc/sq_error.html +++ b/proc/sq_error.html @@ -243,7 +243,7 @@

    Return Value

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/sqrthyperdual.html b/proc/sqrthyperdual.html index b0d1a543e..070a3468f 100644 --- a/proc/sqrthyperdual.html +++ b/proc/sqrthyperdual.html @@ -273,7 +273,7 @@

    Variables

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/srk_factory.html b/proc/srk_factory.html index 5f48518d0..2964bfaa3 100644 --- a/proc/srk_factory.html +++ b/proc/srk_factory.html @@ -123,8 +123,8 @@

    Variables

    becritical_specga - i - j + i + jomaombparams_spec @@ -389,7 +389,7 @@

    Variables

    @@ -406,7 +406,7 @@

    Variables

    @@ -539,7 +539,7 @@

    Variables

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/subtracthyperdualhyperdual.html b/proc/subtracthyperdualhyperdual.html index 2037c609a..d1dd3ae93 100644 --- a/proc/subtracthyperdualhyperdual.html +++ b/proc/subtracthyperdualhyperdual.html @@ -225,7 +225,7 @@

    Return Value

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/subtracthyperdualreal.html b/proc/subtracthyperdualreal.html index bbd6b0616..27e418302 100644 --- a/proc/subtracthyperdualreal.html +++ b/proc/subtracthyperdualreal.html @@ -225,7 +225,7 @@

    Return Value

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/subtractrealhyperdual.html b/proc/subtractrealhyperdual.html index e13445774..ef5b64cb2 100644 --- a/proc/subtractrealhyperdual.html +++ b/proc/subtractrealhyperdual.html @@ -225,7 +225,7 @@

    Return Value

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/sumhyperdual.html b/proc/sumhyperdual.html index 9af79325f..fd1750ffd 100644 --- a/proc/sumhyperdual.html +++ b/proc/sumhyperdual.html @@ -118,7 +118,7 @@

    Variables

    - i + i
    @@ -222,7 +222,7 @@

    Variables

    @@ -270,7 +270,7 @@

    Variables

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/sumhyperdual2.html b/proc/sumhyperdual2.html index cb046bf5d..87271f2b2 100644 --- a/proc/sumhyperdual2.html +++ b/proc/sumhyperdual2.html @@ -118,7 +118,7 @@

    Variables

    - i + i
    @@ -222,7 +222,7 @@

    Variables

    @@ -270,7 +270,7 @@

    Variables

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/tanhhyperdual.html b/proc/tanhhyperdual.html index 40a9bd0a8..76c45a774 100644 --- a/proc/tanhhyperdual.html +++ b/proc/tanhhyperdual.html @@ -273,7 +273,7 @@

    Variables

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/tanhyperdual.html b/proc/tanhyperdual.html index c84539366..d18dc9f7c 100644 --- a/proc/tanhyperdual.html +++ b/proc/tanhyperdual.html @@ -118,8 +118,8 @@

    Variables

    - dx - f + dx + f
    @@ -208,7 +208,7 @@

    Variables

    @@ -225,7 +225,7 @@

    Variables

    @@ -273,7 +273,7 @@

    Variables

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/termo.html b/proc/termo.html index 122d5be32..2819518dc 100644 --- a/proc/termo.html +++ b/proc/termo.html @@ -118,25 +118,25 @@

    Variables

    - ArTn - ArVn - Arn - Arn2 + ArTn + ArVn + Arn + Arn2 DPDN RT Z - ar + ar artv arv arv2 dpdt dpv - i + i igz - k + k nder ntemp - totn + totn
    @@ -185,7 +185,7 @@

    Arguments

    @@ -230,7 +230,7 @@

    Arguments

    @@ -245,7 +245,7 @@

    Arguments

    @@ -275,7 +275,7 @@

    Arguments

    @@ -368,7 +368,7 @@

    Variables

    @@ -385,7 +385,7 @@

    Variables

    @@ -402,7 +402,7 @@

    Variables

    @@ -419,7 +419,7 @@

    Variables

    @@ -487,7 +487,7 @@

    Variables

    @@ -589,7 +589,7 @@

    Variables

    @@ -623,7 +623,7 @@

    Variables

    @@ -674,7 +674,7 @@

    Variables

    @@ -722,7 +722,7 @@

    Variables

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/thetas_i.html b/proc/thetas_i.html index 5d77d8563..09d377698 100644 --- a/proc/thetas_i.html +++ b/proc/thetas_i.html @@ -119,9 +119,9 @@

    Variables

    @@ -301,7 +301,7 @@

    Variables

    @@ -318,7 +318,7 @@

    Variables

    @@ -335,7 +335,7 @@

    Variables

    @@ -417,7 +417,7 @@

    Variables

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/tm.html b/proc/tm.html index 352315288..c4b4257ef 100644 --- a/proc/tm.html +++ b/proc/tm.html @@ -122,7 +122,7 @@

    Variables

    lnphi_wlnphi_zvw - vz + vz @@ -205,7 +205,7 @@

    Arguments

    @@ -220,7 +220,7 @@

    Arguments

    @@ -250,7 +250,7 @@

    Arguments

    @@ -265,7 +265,7 @@

    Arguments

    @@ -404,7 +404,7 @@

    Variables

    @@ -452,7 +452,7 @@

    Variables

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/unifac_temperature_dependence.html b/proc/unifac_temperature_dependence.html index 2a622edd6..adff95286 100644 --- a/proc/unifac_temperature_dependence.html +++ b/proc/unifac_temperature_dependence.html @@ -120,8 +120,8 @@

    Variables

    Aij Eij - i - j + i + j ngroups
    @@ -230,7 +230,7 @@

    Arguments

    @@ -261,7 +261,7 @@

    Arguments

    @@ -379,7 +379,7 @@

    Variables

    @@ -396,7 +396,7 @@

    Variables

    @@ -461,7 +461,7 @@

    Variables

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/unifacparameters.html b/proc/unifacparameters.html index 8507d198a..8e5d8b1f1 100644 --- a/proc/unifacparameters.html +++ b/proc/unifacparameters.html @@ -262,7 +262,7 @@

    Return Value

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/v0.html b/proc/v0.html index 3e084fa0b..196e5d37d 100644 --- a/proc/v0.html +++ b/proc/v0.html @@ -118,8 +118,8 @@

    Variables

    - dbi - dbij + dbi + dbij
    @@ -174,7 +174,7 @@

    Arguments

    @@ -189,7 +189,7 @@

    Arguments

    @@ -204,7 +204,7 @@

    Arguments

    @@ -219,7 +219,7 @@

    Arguments

    @@ -259,7 +259,7 @@

    Variables

    @@ -276,7 +276,7 @@

    Variables

    @@ -324,7 +324,7 @@

    Variables

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/vcalc.html b/proc/vcalc.html index 644fbf4fa..14a6ddfef 100644 --- a/proc/vcalc.html +++ b/proc/vcalc.html @@ -120,15 +120,15 @@

    Variables

    AT AVAP - Ar - ArTV - ArTn - ArV - ArV2 - ArVn - Arn - Arn2 - B + Ar + ArTV + ArTn + ArV + ArV2 + ArVn + Arn + Arn2 + B CPV FIRST_RUN S3R @@ -141,7 +141,7 @@

    Variables

    iter nder pcalc - totn + totn
    @@ -206,7 +206,7 @@

    Arguments

    @@ -251,7 +251,7 @@

    Arguments

    @@ -266,7 +266,7 @@

    Arguments

    @@ -281,7 +281,7 @@

    Arguments

    @@ -348,7 +348,7 @@

    Variables

    @@ -365,7 +365,7 @@

    Variables

    @@ -382,7 +382,7 @@

    Variables

    @@ -399,7 +399,7 @@

    Variables

    @@ -416,7 +416,7 @@

    Variables

    @@ -433,7 +433,7 @@

    Variables

    @@ -450,7 +450,7 @@

    Variables

    @@ -467,7 +467,7 @@

    Variables

    @@ -484,7 +484,7 @@

    Variables

    @@ -705,7 +705,7 @@

    Variables

    @@ -753,7 +753,7 @@

    Variables

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/volume.html b/proc/volume.html index ef72088c4..7343aba38 100644 --- a/proc/volume.html +++ b/proc/volume.html @@ -78,20 +78,20 @@

    volume
  • 64 statements + title=" 0.9% of total for procedures.">52 statements
  • - Source File + Source File
  • @@ -118,34 +118,14 @@

    Variables

    - AT_Liq - AT_Vap - Ar - Bmix - D - D1 - D2 - Tr - V_liq - V_vap - a - cp - cr - dBi - dBij - dD1i - dD1ij - dDdT - dDdT2 - dDi - dDidT - dDij - dadt - dadt2 - flag - rr - totn - z + Gr + GrL + GrV + Vliq + Vvap + max_iters + tol + totnRT
    @@ -160,7 +140,18 @@

    Variables

    - +
    + +
    +
    + foo +
    +
    +
    + @@ -184,8 +175,7 @@

    Uses

  • @@ -193,46 +183,20 @@

    Uses

    -

    Cubic EoS volume solver

    -

    Volume solver optimized for Cubic Equations of State.

    -

    @warn -This routine intends to use the analyitical solution of the cubic -equation, but due to errors in the solutions it is not used. And -the general volume solver by Michelsen is used instead. -@endwarn

    +

    Volume solver routine for residual Helmholtz models.

    +

    Solves volume roots using newton method. Given pressure and temperature.

    Description

    -

    Cubic equations can be analytically solved. Using an anallytical -solution provides the best possible solution in terms of speed and -precision. This subroutine uses the modified cardano method proposed -by Rosendo.

    +

    This subroutine solves the volume using a newton method. The variable +root_type

    Examples

    -
     use yaeos, only: CubicEoS, PengRobinson
    - type(CubicEoS) :: eos
    -
    - eos = PengRobinson(tc, pc, w)
    - ! Possible roots to solve
    - call eos%volume(n, P, T, V, "liquid")
    - call eos%volume(n, P, T, V, "vapor")
    - call eos%volume(n, P, T, V, "stable")
    +
    class(ArModel) :: eos
    +call eos%volume(n, P, T, V, root_type="liquid")
    +call eos%volume(n, P, T, V, root_type="vapor")
    +call eos%volume(n, P, T, V, root_type="stable")
     
    -

    References

    -
      -
    • -

      [1] “Thermodynamic Models: Fundamental and Computational Aspects”, - Michael L. Michelsen, Jørgen M. Mollerup. - Tie-Line Publications, Denmark (2004) -doi

      -
    • -
    • -

      [2] “A Note on the Analytical Solution of Cubic Equations of State -in Process Simulation”, Rosendo Monroy-Loperena -doi

      -
    • -
    -

    Type Bound

    -

    CubicEoS

    +

    ArModel

    Arguments

    - - class(ArModelAdiff), + + class(ArModelTapenade), intent(in) @@ -207,7 +228,7 @@

    Arguments

    - + real(kind=pr), intent(in)
    - + real(kind=pr), intent(in)
    - + real(kind=pr), intent(in)
    - + real(kind=pr), intent(out),
    - + real(kind=pr), intent(out),
    - + real(kind=pr), intent(out),
    - + real(kind=pr), intent(out),
    - + real(kind=pr), intent(out),
    - + real(kind=pr), intent(out),
    - + real(kind=pr), intent(out),
    - + real(kind=pr), intent(out),
    - + real(kind=pr), intent(out),
    - + real(kind=pr), intent(out),
    - - type(hyperdual), + + real(kind=pr), + private + + ::arval + +
    + + real(kind=pr), + private + + ::arvalb + +
    + + real(kind=pr), + private + + ::arvald + +
    + + real(kind=pr), + private + + ::arvald0 + +
    + + real(kind=pr), + private + + ::arvaldb + +
    + + real(kind=pr), + private + + ::arvaldd + +
    + + real(kind=pr), + private + + ::df(size(n)+2) + +
    + + real(kind=pr), + private + + ::df2(size(n)+2,size(n)+2) + +
    + + integer, + private + + ::i + +
    + + real(kind=pr), + private + + ::nb(size(n)) + +
    + + integer, + private + + ::nc + +
    + + real(kind=pr), + private + + ::nd(size(n)) + +
    + + real(kind=pr), + private + + ::ndb(size(n)) + +
    + + real(kind=pr), publicprivate ::d_Artb @@ -437,15 +679,15 @@

    Variables

    - - type(hyperdual), + + real(kind=pr), publicprivate ::d_n(size(n))td @@ -454,15 +696,15 @@

    Variables

    - - type(hyperdual), + + real(kind=pr), publicprivate ::d_ttd0 @@ -471,15 +713,83 @@

    Variables

    - - type(hyperdual), + + real(kind=pr), publicprivate ::d_vtdb + +
    + + real(kind=pr), + private + + ::vb + +
    + + real(kind=pr), + private + + ::vd + +
    + + real(kind=pr), + private + + ::vd0 + +
    + + real(kind=pr), + private + + ::vdb @@ -496,129 +806,107 @@

    Variables

    - - +
    -

    Subroutines

    -
    -

    subroutine get_dardn() -

    -
    - - - -

    Arguments

    - None - -
    -
    - -
    -

    subroutine get_dardn2() -

    -
    - - - -

    Arguments

    - None - -
    -
    - -
    -

    subroutine get_dardt() -

    -
    - - - -

    Arguments

    - None - -
    -
    - +

    Functions

    -

    subroutine get_dardt2() +

    function get_ArnX(var)

    Arguments

    - None - -
    -

    - -
    -

    subroutine get_dardtn() -

    -
    - - - -

    Arguments

    - None - -
    -
    + + + + + + + + + + + + + + + + + + + +
    TypeIntentOptional AttributesName
    + + character(len=*), + intent(in) + + ::var -
    -

    subroutine get_dardv() -

    -
    - - +
    -

    Arguments

    - None +

    + Return Value + real(kind=pr), (size(n)) +

    +
    -

    subroutine get_dardv2() +

    function get_dArdX2(var)

    Arguments

    - None - -
    -

    + + + + + + + + + + + + + + + + + + + +
    TypeIntentOptional AttributesName
    + + character(len=*), + intent(in) + + ::var -
    -

    subroutine get_dardvn() -

    -
    - - +
    -

    Arguments

    - None +

    + Return Value + real(kind=pr) +

    +
    -
    -

    subroutine get_dardvt() -

    -
    - - - -

    Arguments

    - None +
    +
    - - +
    +

    Subroutines

    -

    subroutine reset_vars() +

    subroutine reset_vars()

    @@ -652,7 +940,7 @@

    Arguments

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/rkpr.html b/proc/rkpr.html index f845cc9ca..049dd7a02 100644 --- a/proc/rkpr.html +++ b/proc/rkpr.html @@ -127,7 +127,7 @@

    Variables

    OMa OMb Zc_eos - alpha + alpha composition d1 d2 @@ -135,9 +135,9 @@

    Variables

    d4 d5 d6 - i + i mixrule - nc + nc
    @@ -175,8 +175,8 @@

    Uses

    @@ -323,7 +323,7 @@

    Arguments

    - + real(kind=pr), intent(in),
    - + type(AlphaRKPR), private
    - + integer, private
    - + integer, private
    - + class(QMR_RKPR), intent(in)
    - + real(kind=pr), intent(in)
    - + real(kind=pr), intent(in)
    - + real(kind=pr), intent(out)
    - + real(kind=pr), intent(out)
    - + real(kind=pr), intent(out)
    - + class(ArModel), intent(in)
    - + real(kind=pr), intent(in)
    - + real(kind=pr), intent(in)
    - + character(len=*), intent(in)
    - + integer, intent(in),
    - + real(kind=pr), public
    - + real(kind=pr), public
    - + real(kind=pr), public
    - + integer, public
    - + integer, public
    - + real(kind=pr), public
    - + real(kind=pr), public
    - + real(kind=pr), public
    - + real(kind=pr), public
    - + real(kind=pr), public
    - + real(kind=pr), public
    - + real(kind=pr), public
    - + class(ArModel), intent(in)
    - + real(kind=pr), intent(in)
    - + real(kind=pr), intent(in)
    - + character(len=*), intent(in)
    - + integer, intent(in),
    - + real(kind=pr), public
    - + real(kind=pr), public
    - + real(kind=pr), public
    - + integer, public
    - + real(kind=pr), public
    - + real(kind=pr), public
    - + real(kind=pr), public
    - + real(kind=pr), public
    - + real(kind=pr), public
    - + real(kind=pr), public
    - + real(kind=pr), public
    - + integer, intent(in)
    - + integer, public
    - + integer, public
    - + integer, public
    - + real(kind=pr), public
    - + real(kind=pr), public
    - + class(ArModel), intent(in)
    - + type(AlphaSoave), private
    - + integer, private
    - + integer, private
    - + real(kind=pr), intent(in)
    - + real(kind=pr), intent(in)
    - + real(kind=pr), intent(out)
    - + real(kind=pr), public
    - + real(kind=pr), public
    - + real(kind=pr), intent(in)
    - + real(kind=pr), intent(in)
    - + integer, public
    - + integer
    - + real(kind=dp)
    - + real(kind=dp)
    - + integer, public
    - + integer, public
    - + integer, public
    - + integer, public
    - + real(kind=pr), public
    - + real(kind=pr), public
    - + integer, intent(in)
    - + real(kind=pr), intent(in)
    - + real(kind=pr), intent(in)
    - + real(kind=pr), intent(out)
    - + real(kind=pr), public
    - + real(kind=pr), public
    - + real(kind=pr), public
    - + real(kind=pr), public
    - + real(kind=pr), public
    - + integer, public
    - + integer, public
    - + real(kind=pr), public
    - + integer, public
    - + integer, public
    - + integer, public
    - + class(ArModel), intent(in)
    - + real(kind=pr), intent(in)
    - + real(kind=pr), intent(in)
    - + real(kind=pr), intent(in)
    - + real(kind=pr), public
    - + class(UNIFACPsi)
    - + real(kind=pr), intent(in)
    - + integer, public
    - + integer, public
    - + class(CubicEoS), intent(in)
    - + real(kind=pr), intent(in)
    - + real(kind=pr), intent(in)
    - + real(kind=pr), intent(in)
    - + real(kind=pr), public
    - + real(kind=pr), public
    - + integer, intent(in)
    - + real(kind=pr), intent(in)
    - + real(kind=pr), intent(in)
    - + real(kind=pr), intent(out)
    - + real(kind=pr), public
    - + real(kind=pr), public
    - + real(kind=pr), public
    - + real(kind=pr), public
    - + real(kind=pr), public
    - + real(kind=pr), public
    - + real(kind=pr), public
    - + real(kind=pr), public
    - + real(kind=pr), public
    - + real(kind=pr), public
    @@ -247,8 +211,8 @@

    Arguments

    @@ -272,12 +236,12 @@

    Arguments

    @@ -287,12 +251,12 @@

    Arguments

    @@ -302,12 +266,12 @@

    Arguments

    @@ -317,7 +281,7 @@

    Arguments

    @@ -332,7 +296,8 @@

    Arguments

    @@ -355,109 +320,7 @@

    Variables

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -465,7 +328,7 @@

    Variables

    - + @@ -482,7 +345,7 @@

    Variables

    - + @@ -499,7 +362,7 @@

    Variables

    - + @@ -516,7 +379,7 @@

    Variables

    - + @@ -533,7 +396,7 @@

    Variables

    - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + @@ -737,16 +430,16 @@

    Variables

    - - - + + + @@ -754,93 +447,98 @@

    Variables

    - - - - - - - - - - - + + +
    - - class(CubicEoS), + + class(ArModel), intent(in) @@ -262,7 +226,7 @@

    Arguments

    - + real(kind=pr), intent(in):: n(:) - +

    Moles number vector

    - + real(kind=pr), intent(in):: P - +

    Pressure [bar]

    - + real(kind=pr), intent(in):: T - +

    Temperature [K]

    - + real(kind=pr), intent(out):: V - +

    Volume [L]

    :: root_type - +

    Desired root-type to solve. Options are: +["liquid", "vapor", "stable"]

    - - real(kind=pr), - public - - ::AT_Liq - -
    - - real(kind=pr), - public - - ::AT_Vap - -
    - - real(kind=pr), - public - - ::Ar - -
    - - real(kind=pr), - public - - ::Bmix - -
    - - real(kind=pr), - public - - ::D - -
    - - real(kind=pr), - public - - ::D1 - -
    - + real(kind=pr), public::D2Gr @@ -474,7 +337,7 @@

    Variables

    - + real(kind=pr), public::Tr(size(n))GrL @@ -491,7 +354,7 @@

    Variables

    - + real(kind=pr), public::V_liqGrV @@ -508,7 +371,7 @@

    Variables

    - + real(kind=pr), public::V_vapVliq @@ -525,7 +388,7 @@

    Variables

    - + real(kind=pr), public::a(size(n))Vvap @@ -542,194 +405,24 @@

    Variables

    - - real(kind=pr), - public - - ::cp(4) - -
    - - complex(kind=pr), - public - - ::cr(3) - -
    - - real(kind=pr), - public - - ::dBi(size(n)) - -
    - - real(kind=pr), - public - - ::dBij(size(n),size(n)) - -
    - - real(kind=pr), - public - - ::dD1i(size(n)) - -
    - - real(kind=pr), - public - - ::dD1ij(size(n),size(n)) - -
    - - real(kind=pr), - public - - ::dDdT - -
    - - real(kind=pr), - public - - ::dDdT2 - -
    - - real(kind=pr), - public - - ::dDi(size(n)) - -
    - - real(kind=pr), - public - - ::dDidT(size(n)) - -
    - - real(kind=pr), + + integer, public ::dDij(size(n),size(n))max_iters =30
    - + real(kind=pr), public::dadt(size(n))tol =1e-7
    - + real(kind=pr), public::dadt2(size(n)) - -
    - - integer, - public - - ::flagtotnRT
    + +
    +
    + + + + + + + +
    +

    Subroutines

    +
    +

    subroutine foo(x, f, df) +

    +
    + + + +

    Arguments

    + + + + + + + + + + - - + - - - + - - + - - - + - - + - - - +
    TypeIntentOptional AttributesName
    - + real(kind=pr), public +intent(in) ::rr(3)x - +
    - + real(kind=pr), public +intent(out) ::totnf - +
    - + real(kind=pr), public +intent(out) ::z(size(n))df - +
    -
    -
    - - - - - + + + @@ -862,7 +560,7 @@

    Variables

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/volume_michelsen.html b/proc/volume_michelsen.html index 847a41260..b107eaebe 100644 --- a/proc/volume_michelsen.html +++ b/proc/volume_michelsen.html @@ -120,10 +120,10 @@

    Variables

    AT AVAP - Ar - ArV - ArV2 - B + Ar + ArV + ArV2 + B VVAP ZETA ZETMAX @@ -220,7 +220,7 @@

    Arguments

    - + class(ArModel), intent(in)
    - + real(kind=pr), intent(in)
    - + real(kind=pr), intent(in)
    - + real(kind=pr), intent(in)
    - + real(kind=pr), intent(out)
    - + integer, intent(in),
    - + real(kind=pr), public
    - + real(kind=pr), public
    - + real(kind=pr), public
    - + real(kind=pr), public
    - + real(kind=pr), intent(in)
    - + real(kind=pr), intent(out)
    @@ -211,8 +247,8 @@

    Arguments

    @@ -236,12 +272,12 @@

    Arguments

    @@ -251,12 +287,12 @@

    Arguments

    @@ -266,12 +302,12 @@

    Arguments

    @@ -281,12 +317,12 @@

    Arguments

    @@ -296,8 +332,7 @@

    Arguments

    @@ -320,7 +355,7 @@

    Variables

    @@ -328,7 +363,7 @@

    Variables

    - + @@ -345,7 +380,7 @@

    Variables

    - + @@ -362,7 +397,7 @@

    Variables

    - + @@ -379,7 +414,7 @@

    Variables

    - + @@ -396,7 +431,7 @@

    Variables

    - + - - - + + + @@ -430,16 +465,16 @@

    Variables

    - - - + + + @@ -447,98 +482,365 @@

    Variables

    - + - -
    - - class(ArModel), + + class(CubicEoS), intent(in) @@ -226,7 +262,7 @@

    Arguments

    - + real(kind=pr), intent(in):: n(:) -

    Moles number vector

    +
    - + real(kind=pr), intent(in):: P -

    Pressure [bar]

    +
    - + real(kind=pr), intent(in):: T -

    Temperature [K]

    +
    - + real(kind=pr), intent(out):: V -

    Volume [L]

    +
    - + character(len=*), intent(in):: root_type -

    Desired root-type to solve. Options are: -["liquid", "vapor", "stable"]

    +
    - + real(kind=pr), public::GrAT_Liq @@ -337,7 +372,7 @@

    Variables

    - + real(kind=pr), public::GrLAT_Vap @@ -354,7 +389,7 @@

    Variables

    - + real(kind=pr), public::GrVAr @@ -371,7 +406,7 @@

    Variables

    - + real(kind=pr), public::VliqBmix @@ -388,7 +423,7 @@

    Variables

    - + real(kind=pr), public::VvapD @@ -405,24 +440,24 @@

    Variables

    - - integer, + + real(kind=pr), public ::max_iters =30D1
    - + real(kind=pr), public::tol =1e-7D2
    - + real(kind=pr), public::totnRTTr(size(n))
    - - -
    - - - - - - - -
    -

    Subroutines

    -
    -

    subroutine foo(x, f, df) -

    -
    - - - -

    Arguments

    - - - - - - - - - - - - + - + + + - - + - + + + - - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    TypeIntentOptional AttributesName
    - + real(kind=pr), intent(in) + public ::xV_liq - +
    - + real(kind=pr), intent(out) + public ::fV_vap - +
    - + real(kind=pr), intent(out) + public ::dfa(size(n)) - + +
    + + real(kind=pr), + public + + ::cp(4) + +
    + + complex(kind=pr), + public + + ::cr(3) + +
    + + real(kind=pr), + public + + ::dBi(size(n)) + +
    + + real(kind=pr), + public + + ::dBij(size(n),size(n)) + +
    + + real(kind=pr), + public + + ::dD1i(size(n)) + +
    + + real(kind=pr), + public + + ::dD1ij(size(n),size(n)) + +
    + + real(kind=pr), + public + + ::dDdT + +
    + + real(kind=pr), + public + + ::dDdT2 + +
    + + real(kind=pr), + public + + ::dDi(size(n)) + +
    + + real(kind=pr), + public + + ::dDidT(size(n)) + +
    + + real(kind=pr), + public + + ::dDij(size(n),size(n)) + +
    + + real(kind=pr), + public + + ::dadt(size(n)) + +
    + + real(kind=pr), + public + + ::dadt2(size(n)) + +
    + + integer, + public + + ::flag + +
    + + real(kind=pr), + public + + ::rr(3) + +
    + + real(kind=pr), + public + + ::totn + +
    + + real(kind=pr), + public + + ::z(size(n)) +
    +
    +
    + + + + + - - - @@ -560,7 +862,7 @@

    Arguments

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/write_equilibriumstate.html b/proc/write_equilibriumstate.html index b376716ce..44e6254af 100644 --- a/proc/write_equilibriumstate.html +++ b/proc/write_equilibriumstate.html @@ -325,7 +325,7 @@

    Variables

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/proc/write_ptenvel2.html b/proc/write_ptenvel2.html index 76bc20dc5..4547f1977 100644 --- a/proc/write_ptenvel2.html +++ b/proc/write_ptenvel2.html @@ -120,8 +120,8 @@

    Variables

    cp cps - i - nc + i + nc
    @@ -314,7 +314,7 @@

    Variables

    - + integer, public
    - + integer, public
    - + integer, intent(in)
    - + real(kind=pr), intent(in)
    - + real(kind=pr), intent(in)
    - + real(kind=pr), intent(out)
    - + real(kind=pr), public
    - + real(kind=pr), public
    - + real(kind=pr), public
    - + real(kind=pr), public
    - + real(kind=pr), public
    - + integer, public
    - + integer, public
    - + real(kind=pr), public
    - + real(kind=pr), public,
    - + real(kind=pr), public,
    @@ -2132,7 +2132,7 @@

    Arguments

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/type/armodeladiff.html b/type/armodeladiff.html index f6d8f78e2..99af33581 100644 --- a/type/armodeladiff.html +++ b/type/armodeladiff.html @@ -146,18 +146,18 @@

    Type-Bound Procedures

    @@ -235,7 +235,7 @@

    Type-Bound Procedures

    - +

    procedure(hyperdual_Ar), public, deferred :: Ar @@ -896,7 +896,7 @@

    Arguments

    - +

    procedure(abs_volume_initializer), public, deferred :: get_v0 @@ -1802,7 +1802,7 @@

    Arguments

    - +

    procedure, public :: residual_helmholtz @@ -1812,7 +1812,7 @@

    • - public subroutine residual_helmholtz(self, n, v, t, Ar, ArV, ArT, ArTV, ArV2, ArT2, Arn, ArVn, ArTn, Arn2) + public subroutine residual_helmholtz(self, n, v, t, Ar, ArV, ArT, ArTV, ArV2, ArT2, Arn, ArVn, ArTn, Arn2)

      @@ -2051,7 +2051,7 @@

      Arguments

      - +

      procedure, public :: volume @@ -2061,11 +2061,11 @@

      • - public subroutine volume(eos, n, P, T, V, root_type) + public subroutine volume(eos, n, P, T, V, root_type)

        -

        Solves volume roots using newton method. Given pressure and temperature.

        Read more… +

        Solves volume roots using newton method. Given pressure and temperature.

        Read more…

        Arguments

    @@ -2199,7 +2199,7 @@

    Arguments

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/type/armodeltapenade.html b/type/armodeltapenade.html index 0d5a8f9ba..8d8cd731f 100644 --- a/type/armodeltapenade.html +++ b/type/armodeltapenade.html @@ -148,21 +148,21 @@

    Type-Bound Procedures

    @@ -468,7 +468,7 @@

    Arguments

    - +

    procedure(tapenade_ar), public, deferred :: ar @@ -1783,7 +1783,7 @@

    Arguments

    - +

    procedure, public :: get_v0 @@ -2687,7 +2687,7 @@

    Arguments

    - +

    procedure, public :: residual_helmholtz @@ -2697,7 +2697,7 @@

    • - private subroutine residual_helmholtz(self, n, v, t, Ar, ArV, ArT, ArTV, ArV2, ArT2, Arn, ArVn, ArTn, Arn2) + private subroutine residual_helmholtz(self, n, v, t, Ar, ArV, ArT, ArTV, ArV2, ArT2, Arn, ArVn, ArTn, Arn2)

      @@ -3039,7 +3039,7 @@

      - +

      procedure, public :: volume @@ -3049,11 +3049,11 @@

      • - public subroutine volume(eos, n, P, T, V, root_type) + public subroutine volume(eos, n, P, T, V, root_type)

        -

        Solves volume roots using newton method. Given pressure and temperature.

        Read more… +

        Solves volume roots using newton method. Given pressure and temperature.

        Read more…

        Arguments

    @@ -3187,7 +3187,7 @@

    Arguments

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/type/basemodel.html b/type/basemodel.html index 08f1a6cb5..4edec13c4 100644 --- a/type/basemodel.html +++ b/type/basemodel.html @@ -90,7 +90,7 @@

    BaseModel

    diff --git a/type/continuationvariable.html b/type/continuationvariable.html index 1b4e9c5e9..48bc58c2f 100644 --- a/type/continuationvariable.html +++ b/type/continuationvariable.html @@ -118,10 +118,10 @@

    Variables

    - S - X - dS - ns + S + X + dS + ns
    @@ -170,7 +170,7 @@

    Components

    @@ -187,7 +187,7 @@

    Components

    @@ -204,7 +204,7 @@

    Components

    @@ -221,7 +221,7 @@

    Components

    @@ -264,7 +264,7 @@

    Components

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/type/criticalpoint.html b/type/criticalpoint.html index 15037f825..d77e8ba01 100644 --- a/type/criticalpoint.html +++ b/type/criticalpoint.html @@ -118,8 +118,8 @@

    Variables

    - P - T + P + T
    @@ -168,7 +168,7 @@

    Components

    @@ -185,7 +185,7 @@

    Components

    @@ -228,7 +228,7 @@

    Components

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/type/criticalpoint~2.html b/type/criticalpoint~2.html index c417e9b0c..62ee00a19 100644 --- a/type/criticalpoint~2.html +++ b/type/criticalpoint~2.html @@ -118,8 +118,8 @@

    Variables

    - P - alpha + P + alpha
    @@ -168,7 +168,7 @@

    Components

    @@ -185,7 +185,7 @@

    Components

    @@ -230,7 +230,7 @@

    Components

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/type/cubiceos.html b/type/cubiceos.html index 60be00ce1..432e7c443 100644 --- a/type/cubiceos.html +++ b/type/cubiceos.html @@ -119,12 +119,12 @@

    Variables

    @@ -156,13 +156,13 @@

    Type-Bound Procedures

    Cv_residual_vtenthalpy_residual_vtentropy_residual_vt - get_v0 + get_v0gibbs_residual_vtlnphi_ptlnphi_vtpressure - residual_helmholtz - volume + residual_helmholtz + volume @@ -224,7 +224,7 @@

    Components

    @@ -253,7 +253,7 @@

    Callign the AlphaFunctio

    @@ -323,7 +323,7 @@

    Callign the AlphaFunctio

    @@ -959,7 +959,7 @@

    Arguments

    - +

    procedure, public :: get_v0 => v0 @@ -1866,7 +1866,7 @@

    Arguments

    - +

    procedure, public :: residual_helmholtz => GenericCubic_Ar @@ -2133,7 +2133,7 @@

    Arguments

    - +

    procedure, public :: volume @@ -2143,11 +2143,11 @@

    • - public subroutine volume(eos, n, P, T, V, root_type) + public subroutine volume(eos, n, P, T, V, root_type)

      -

      Volume solver optimized for Cubic Equations of State.

      Read more… +

      Volume solver optimized for Cubic Equations of State.

      Read more…

      Arguments

    - + real(kind=pr), public
    - + real(kind=pr), public,
    - + real(kind=pr), public
    - + integer, public
    - + real(kind=pr), public
    - + real(kind=pr), public
    - + real(kind=pr), public
    - + real(kind=pr), public
    - + class(AlphaFunction), public,
    - + real(kind=pr), public,
    - + class(CubicMixRule), public,
    @@ -2280,7 +2280,7 @@

    Arguments

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/type/cubicmixrule.html b/type/cubicmixrule.html index 5c945ee2f..5a1ed6dba 100644 --- a/type/cubicmixrule.html +++ b/type/cubicmixrule.html @@ -134,9 +134,9 @@

    Type-Bound Procedures

    - Bmix - D1mix - Dmix + Bmix + D1mix + Dmix
    @@ -164,7 +164,7 @@

    Type-Bound Procedures

    - +

    procedure(abs_Bmix), public, deferred :: Bmix @@ -292,7 +292,7 @@

    Arguments

    - +

    procedure(abs_D1mix), public, deferred :: D1mix @@ -420,7 +420,7 @@

    Arguments

    - +

    procedure(abs_Dmix), public, deferred :: Dmix @@ -656,7 +656,7 @@

    Arguments

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/type/equilibriumstate.html b/type/equilibriumstate.html index 4cb44a16f..dc72be311 100644 --- a/type/equilibriumstate.html +++ b/type/equilibriumstate.html @@ -118,15 +118,15 @@

    Variables

    - P - T + P + T Vx - Vy - beta - iters - kind - x - y + Vy + beta + iters + kind + x + y
    @@ -189,7 +189,7 @@

    Components

    @@ -206,7 +206,7 @@

    Components

    @@ -240,7 +240,7 @@

    Components

    @@ -257,7 +257,7 @@

    Components

    @@ -274,7 +274,7 @@

    Components

    @@ -291,7 +291,7 @@

    Components

    @@ -308,7 +308,7 @@

    Components

    @@ -325,7 +325,7 @@

    Components

    @@ -629,7 +629,7 @@

    Arguments

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/type/fitkijlij.html b/type/fitkijlij.html index 905bf6dbd..d246838d7 100644 --- a/type/fitkijlij.html +++ b/type/fitkijlij.html @@ -120,9 +120,9 @@

    Variables

    @@ -149,7 +149,7 @@

    Type-Bound Procedures

    @@ -242,7 +242,7 @@

    Components

    @@ -259,7 +259,7 @@

    Components

    @@ -276,7 +276,7 @@

    Components

    @@ -304,17 +304,17 @@

    Type-Bound Procedures

    - +

    procedure, public :: - get_model_from_X => model_from_X + get_model_from_X => model_from_X

    • - public subroutine model_from_X(problem, X) + public subroutine model_from_X(problem, X)

      @@ -391,7 +391,7 @@

      Arguments

      Documentation generated by FORD - on 2024-08-27 18:43

      + on 2024-08-27 18:52


    diff --git a/type/fitmhvnrtl.html b/type/fitmhvnrtl.html index 8e68a9ac0..5553b88f7 100644 --- a/type/fitmhvnrtl.html +++ b/type/fitmhvnrtl.html @@ -119,10 +119,10 @@

    Variables

    @@ -199,7 +199,7 @@

    Components

    @@ -233,7 +233,7 @@

    Components

    @@ -250,7 +250,7 @@

    Components

    @@ -281,14 +281,14 @@

    Type-Bound Procedures

    procedure, public :: - get_model_from_X => model_from_X + get_model_from_X => model_from_X

    • - public subroutine model_from_X(problem, X) + public subroutine model_from_X(problem, X)

      @@ -365,7 +365,7 @@

      Arguments

      Documentation generated by FORD - on 2024-08-27 18:43

      + on 2024-08-27 18:52


      diff --git a/type/fittingproblem.html b/type/fittingproblem.html index b76ab4875..a16c86d58 100644 --- a/type/fittingproblem.html +++ b/type/fittingproblem.html @@ -119,8 +119,8 @@

      Variables

      @@ -147,7 +147,7 @@

      Type-Bound Procedures

      @@ -202,7 +202,7 @@

      Components

    @@ -219,7 +219,7 @@

    Components

    @@ -247,7 +247,7 @@

    Type-Bound Procedures

    - +

    procedure(model_from_X), public, deferred :: get_model_from_X @@ -333,7 +333,7 @@

    Arguments

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/type/gegcmodelparameters.html b/type/gegcmodelparameters.html index 0a1d6f1d2..d335e2cab 100644 --- a/type/gegcmodelparameters.html +++ b/type/gegcmodelparameters.html @@ -1299,7 +1299,7 @@

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/type/gemodel.html b/type/gemodel.html index 53028bf2c..8e18ab2e5 100644 --- a/type/gemodel.html +++ b/type/gemodel.html @@ -501,7 +501,7 @@

    Arguments

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/type/gemodeltapenade.html b/type/gemodeltapenade.html index dcd98db80..5b008e50a 100644 --- a/type/gemodeltapenade.html +++ b/type/gemodeltapenade.html @@ -145,12 +145,12 @@

    Type-Bound Procedures

    @@ -212,7 +212,7 @@

    Type-Bound Procedures

    - +

    procedure, public :: excess_gibbs @@ -222,7 +222,7 @@

    • - private subroutine excess_gibbs(self, n, t, Ge, GeT, GeT2, Gen, GeTn, Gen2) + private subroutine excess_gibbs(self, n, t, Ge, GeT, GeT2, Gen, GeTn, Gen2)

      @@ -386,7 +386,7 @@

      Arguments

      - +

      procedure(tapenade_ge), public, deferred :: ge @@ -484,7 +484,7 @@

      Arguments

      - +

      procedure(tapenade_ge_b), public, deferred :: ge_b @@ -627,7 +627,7 @@

      Arguments

      - +

      procedure(tapenade_ge_d), public, deferred :: ge_d @@ -770,7 +770,7 @@

      Arguments

      - +

      procedure(tapenade_ge_d_b), public, deferred :: ge_d_b @@ -1003,7 +1003,7 @@

      Arguments

      - +

      procedure(tapenade_ge_d_d), public, deferred :: ge_d_d @@ -1308,7 +1308,7 @@

      Arguments

      Documentation generated by FORD - on 2024-08-27 18:43

      + on 2024-08-27 18:52


      diff --git a/type/groups.html b/type/groups.html index bed48e526..786299eec 100644 --- a/type/groups.html +++ b/type/groups.html @@ -121,7 +121,7 @@

      Variables

      groups_ids number_of_groups surface_area - volume + volume
      @@ -243,7 +243,7 @@

      Components

    @@ -287,7 +287,7 @@

    Components

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/type/hyperdual.html b/type/hyperdual.html index 6c8911cd7..a38921828 100644 --- a/type/hyperdual.html +++ b/type/hyperdual.html @@ -119,9 +119,9 @@

    Variables

    f0 - f1 + f1 f12 - f2 + f2
    @@ -187,7 +187,7 @@

    Components

    @@ -221,7 +221,7 @@

    Components

    @@ -264,7 +264,7 @@

    Components

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/type/mhv.html b/type/mhv.html index 4d54459c1..f0634ad07 100644 --- a/type/mhv.html +++ b/type/mhv.html @@ -118,13 +118,13 @@

    Variables

    - ge + ge l q - B + B bi - dBi - dBij + dBi + dBij
    @@ -162,8 +162,8 @@

    Type-Bound Procedures

    @@ -233,7 +233,7 @@

    Components

    @@ -284,7 +284,7 @@

    Components

    @@ -318,7 +318,7 @@

    Components

    @@ -335,7 +335,7 @@

    Components

    @@ -367,7 +367,7 @@

    public interface MHV
    • - private function init(Ge, b, q, lij) result(mixrule) + private function init(Ge, b, q, lij) result(mixrule)

      @@ -386,7 +386,7 @@

      Arguments

    @@ -401,7 +401,7 @@

    Arguments

    @@ -431,7 +431,7 @@

    Arguments

    @@ -466,7 +466,7 @@

    Type-Bound Procedures

    - +

    procedure, public :: Bmix => BmixMHV @@ -596,7 +596,7 @@

    Arguments

    - +

    procedure, public :: D1Mix => D1MixMHV @@ -963,7 +963,7 @@

    Arguments

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/type/nrtl.html b/type/nrtl.html index 4b3333430..8ee8b8b58 100644 --- a/type/nrtl.html +++ b/type/nrtl.html @@ -118,9 +118,9 @@

    Variables

    - a - b - c + a + b + c components
    @@ -159,12 +159,12 @@

    Type-Bound Procedures

    @@ -210,7 +210,7 @@

    Components

    @@ -227,7 +227,7 @@

    Components

    @@ -244,7 +244,7 @@

    Components

    @@ -293,7 +293,7 @@

    public interface NRTL
    • - public function init(a, b, c) + public function init(a, b, c)

      @@ -312,7 +312,7 @@

      Arguments

    @@ -327,7 +327,7 @@

    Arguments

    @@ -342,7 +342,7 @@

    Arguments

    @@ -377,7 +377,7 @@

    Type-Bound Procedures

    - +

    procedure, public :: excess_gibbs @@ -387,7 +387,7 @@

    • - private subroutine excess_gibbs(self, n, t, Ge, GeT, GeT2, Gen, GeTn, Gen2) + private subroutine excess_gibbs(self, n, t, Ge, GeT, GeT2, Gen, GeTn, Gen2)

      @@ -551,7 +551,7 @@

      Arguments

      - +

      procedure, public :: ge => EXCESS_GIBBS @@ -650,7 +650,7 @@

      Arguments

      - +

      procedure, public :: ge_b => EXCESS_GIBBS_B @@ -794,7 +794,7 @@

      Arguments

      - +

      procedure, public :: ge_d => EXCESS_GIBBS_D @@ -938,7 +938,7 @@

      Arguments

      - +

      procedure, public :: ge_d_b => EXCESS_GIBBS_D_B @@ -1172,7 +1172,7 @@

      Arguments

      - +

      procedure, public :: ge_d_d => EXCESS_GIBBS_D_D @@ -1478,7 +1478,7 @@

      Arguments

      Documentation generated by FORD - on 2024-08-27 18:43

      + on 2024-08-27 18:52


      diff --git a/type/optimizer.html b/type/optimizer.html index 8a43f5fd1..38557eb9f 100644 --- a/type/optimizer.html +++ b/type/optimizer.html @@ -120,7 +120,7 @@

      Variables

      @@ -214,7 +214,7 @@

      Components

    @@ -373,7 +373,7 @@

    Arguments

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/type/powellwrapper.html b/type/powellwrapper.html index 425f90066..e3d519789 100644 --- a/type/powellwrapper.html +++ b/type/powellwrapper.html @@ -120,7 +120,7 @@

    Variables

    @@ -214,7 +214,7 @@

    Components

    @@ -374,7 +374,7 @@

    Arguments

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/type/psifunction.html b/type/psifunction.html index e50a46e4c..b33f61d55 100644 --- a/type/psifunction.html +++ b/type/psifunction.html @@ -320,7 +320,7 @@

    Arguments

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/type/ptenvel2.html b/type/ptenvel2.html index 7df525d4a..2edcb69b3 100644 --- a/type/ptenvel2.html +++ b/type/ptenvel2.html @@ -502,7 +502,7 @@

    Arguments

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/type/pxenvel2.html b/type/pxenvel2.html index 74186cb2b..914016759 100644 --- a/type/pxenvel2.html +++ b/type/pxenvel2.html @@ -118,7 +118,7 @@

    Variables

    - alpha + alpha cps points z0 @@ -173,7 +173,7 @@

    Components

    @@ -284,7 +284,7 @@

    Components

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/type/qmr.html b/type/qmr.html index 087060995..47cb5cdf0 100644 --- a/type/qmr.html +++ b/type/qmr.html @@ -118,9 +118,9 @@

    Variables

    - aij - k - l + aij + k + l
    @@ -147,9 +147,9 @@

    Type-Bound Procedures

    - Bmix - D1mix - Dmix + Bmix + D1mix + Dmix
    @@ -190,7 +190,7 @@

    Components

    @@ -208,7 +208,7 @@

    Components

    @@ -225,7 +225,7 @@

    Components

    @@ -253,7 +253,7 @@

    Type-Bound Procedures

    - +

    procedure, public :: Bmix @@ -390,7 +390,7 @@

    Arguments

    - +

    procedure, public :: D1mix => D1mix_constant @@ -525,7 +525,7 @@

    Arguments

    - +

    procedure, public :: Dmix @@ -782,7 +782,7 @@

    Arguments

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/type/qmr_rkpr.html b/type/qmr_rkpr.html index c9b4f9328..572b5771e 100644 --- a/type/qmr_rkpr.html +++ b/type/qmr_rkpr.html @@ -118,9 +118,9 @@

    Variables

    - aij - k - l + aij + k + l
    @@ -147,9 +147,9 @@

    Type-Bound Procedures

    - Bmix - D1Mix - Dmix + Bmix + D1Mix + Dmix
    @@ -182,7 +182,7 @@

    Components

    @@ -200,7 +200,7 @@

    Components

    @@ -217,7 +217,7 @@

    Components

    @@ -245,7 +245,7 @@

    Type-Bound Procedures

    - +

    procedure, public :: Bmix @@ -382,7 +382,7 @@

    Arguments

    - +

    procedure, public :: D1Mix => RKPR_D1mix @@ -511,7 +511,7 @@

    Arguments

    - +

    procedure, public :: Dmix @@ -768,7 +768,7 @@

    Arguments

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/type/substances.html b/type/substances.html index 91f00965c..38dff89e5 100644 --- a/type/substances.html +++ b/type/substances.html @@ -264,7 +264,7 @@

    Components

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/type/tmoptimizedata.html b/type/tmoptimizedata.html index 0bd10e4c2..db88aafd0 100644 --- a/type/tmoptimizedata.html +++ b/type/tmoptimizedata.html @@ -118,11 +118,11 @@

    Variables

    - P - T + P + T di - model - z + model + z
    @@ -171,7 +171,7 @@

    Components

    @@ -188,7 +188,7 @@

    Components

    @@ -222,7 +222,7 @@

    Components

    @@ -239,7 +239,7 @@

    Components

    @@ -282,7 +282,7 @@

    Components

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/type/unifac.html b/type/unifac.html index add2a38b0..f131cbb30 100644 --- a/type/unifac.html +++ b/type/unifac.html @@ -129,7 +129,7 @@

    Variables

    qkthetas_ijvij - z + z @@ -156,7 +156,7 @@

    Type-Bound Procedures

    @@ -450,7 +450,7 @@

    Components

    @@ -478,7 +478,7 @@

    Type-Bound Procedures

    - +

    procedure, public :: excess_gibbs @@ -488,11 +488,11 @@

    • - public subroutine excess_gibbs(self, n, T, Ge, GeT, GeT2, Gen, GeTn, Gen2) + public subroutine excess_gibbs(self, n, T, Ge, GeT, GeT2, Gen, GeTn, Gen2)

      -

      Calculate the Gibbs excess energy of the UNIFAC model

      Read more… +

      Calculate the Gibbs excess energy of the UNIFAC model

      Read more…

      Arguments

    - + real(kind=pr), public
    - + real(kind=pr), public
    - + real(kind=pr), public
    - + real(kind=pr), public
    - + integer, public
    - + character(len=14), public
    - + real(kind=pr), public,
    - + real(kind=pr), public,
    - + logical, public
    - + class(ArModel), public,
    - + logical, public
    - + logical, public
    - + class(ArModel), public,
    - + logical, public
    - + class(ArModel), public,
    - + logical, public
    - + real(kind=pr), public
    - + real(kind=pr), public
    - + real(kind=pr), public
    - + class(GeModel), public,
    - + real(kind=pr), private,
    - + real(kind=pr), private,
    - + real(kind=pr), private,
    - + class(GeModel), intent(in)
    - + real(kind=pr), intent(in)
    - + real(kind=pr), intent(in),
    - + real(kind=pr), public,
    - + real(kind=pr), public,
    - + real(kind=pr), public,
    - + real(kind=pr), intent(in)
    - + real(kind=pr), intent(in)
    - + real(kind=pr), intent(in)
    - + logical, public
    - + logical, public
    - + real(kind=pr), public,
    - + procedure(get_aij), public,
    - + real(kind=pr), public,
    - + real(kind=pr), public,
    - + procedure(get_aij), public,
    - + real(kind=pr), public,
    - + real(kind=pr), public,
    - + real(kind=pr), public
    - + real(kind=pr), public
    - + class(ArModel), public,
    - + real(kind=pr), public,
    - + real(kind=pr), public
    @@ -779,7 +779,7 @@

    Arguments

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52


    diff --git a/type/unifacpsi.html b/type/unifacpsi.html index 6033a1939..e3f1dbf4e 100644 --- a/type/unifacpsi.html +++ b/type/unifacpsi.html @@ -415,7 +415,7 @@

    Arguments

    Documentation generated by FORD - on 2024-08-27 18:43

    + on 2024-08-27 18:52