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
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 )
module~~yaeos__math~~UsesGraph
module~yaeos__math
yaeos__math
module~yaeos__constants
yaeos__constants
module~yaeos__math->module~yaeos__constants
module~yaeos__math_continuation
yaeos__math_continuation
module~yaeos__math->module~yaeos__math_continuation
module~yaeos__math_linalg
yaeos__math_linalg
module~yaeos__math->module~yaeos__math_linalg
iso_fortran_env
iso_fortran_env
module~yaeos__constants->iso_fortran_env
module~yaeos__math_continuation->module~yaeos__constants
module~yaeos__math_continuation->module~yaeos__math_linalg
module~yaeos__math_linalg->module~yaeos__constants
Nodes of different colours represent the following:
Graph Key
Module
Module
Submodule
Submodule
Subroutine
Subroutine
Function
Function
Program
Program
This Page's Entity
This Page's Entity
Solid arrows point from a submodule to the (sub)module which it is
descended from. Dashed arrows point from a module or program unit to
modules which it uses.
module~~yaeos__math~~UsedByGraph
module~yaeos__math
yaeos__math
module~yaeos__equilibria_binaries
yaeos__equilibria_binaries
module~yaeos__equilibria_binaries->module~yaeos__math
module~yaeos__equilibria_boundaries_auxiliar
yaeos__equilibria_boundaries_auxiliar
module~yaeos__equilibria_boundaries_auxiliar->module~yaeos__math
module~yaeos__equilibria_boundaries_generalized_isopleths
yaeos__equilibria_boundaries_generalized_isopleths
module~yaeos__equilibria_boundaries_generalized_isopleths->module~yaeos__math
module~yaeos__equilibria_boundaries_phase_envelopes_mp
yaeos__equilibria_boundaries_phase_envelopes_mp
module~yaeos__equilibria_boundaries_phase_envelopes_mp->module~yaeos__math
module~yaeos__equilibria_boundaries_phase_envelopes_mp->module~yaeos__equilibria_boundaries_auxiliar
module~yaeos__equilibria_boundaries_phase_envelopes_mp_px
yaeos__equilibria_boundaries_phase_envelopes_mp_px
module~yaeos__equilibria_boundaries_phase_envelopes_mp_px->module~yaeos__math
module~yaeos__equilibria_boundaries_phase_envelopes_mp_px->module~yaeos__equilibria_boundaries_auxiliar
module~yaeos__equilibria_boundaries_phase_envelopes_mp_tx
yaeos__equilibria_boundaries_phase_envelopes_mp_tx
module~yaeos__equilibria_boundaries_phase_envelopes_mp_tx->module~yaeos__math
module~yaeos__equilibria_boundaries_phase_envelopes_mp_tx->module~yaeos__equilibria_boundaries_auxiliar
module~yaeos__equilibria_boundaries_phase_envelopes_pt3
yaeos__equilibria_boundaries_phase_envelopes_pt3
module~yaeos__equilibria_boundaries_phase_envelopes_pt3->module~yaeos__math
module~yaeos__equilibria_boundaries_phase_envelopes_px3
yaeos__equilibria_boundaries_phase_envelopes_px3
module~yaeos__equilibria_boundaries_phase_envelopes_px3->module~yaeos__math
module~yaeos__equilibria_boundaries_phase_envelopes_px3->module~yaeos__equilibria_boundaries_auxiliar
module~yaeos__models_ge_uniquac
yaeos__models_ge_uniquac
module~yaeos__models_ge_uniquac->module~yaeos__math
proc~check_critical_jump
check_critical_jump
proc~check_critical_jump->module~yaeos__math
proc~critical_line
critical_line
proc~critical_line->module~yaeos__math
proc~critical_point
critical_point
proc~critical_point->module~yaeos__math
proc~detect_critical~3
detect_critical
proc~detect_critical~3->module~yaeos__math
proc~homotopy
homotopy
proc~homotopy->module~yaeos__math
proc~look_for_cep
look_for_cep
proc~look_for_cep->module~yaeos__math
proc~solve_generalized_point
solve_generalized_point
proc~solve_generalized_point->module~yaeos__math
proc~solve_mp_flash_point
solve_mp_flash_point
proc~solve_mp_flash_point->module~yaeos__math
proc~solve_point
PXEnvelMP%solve_point
proc~solve_point->module~yaeos__math
proc~solve_point~4
PTEnvelMP%solve_point
proc~solve_point~4->module~yaeos__math
proc~solve_point~7
TXEnvelMP%solve_point
proc~solve_point~7->module~yaeos__math
proc~solve_tp
solve_TP
proc~solve_tp->module~yaeos__math
proc~solve_vxvyt
solve_VxVyT
proc~solve_vxvyt->module~yaeos__math
proc~three_phase_line_f
three_phase_line_F
proc~three_phase_line_f->module~yaeos__math
proc~three_phase_line_f_solve
three_phase_line_F_solve
proc~three_phase_line_f_solve->module~yaeos__math
proc~volume
Gerg2008%volume
proc~volume->module~yaeos__math
proc~volume~3
ArModel%volume
proc~volume~3->module~yaeos__math
module~yaeos__equilibria
yaeos__equilibria
module~yaeos__equilibria->module~yaeos__equilibria_binaries
module~yaeos__equilibria->module~yaeos__equilibria_boundaries_generalized_isopleths
module~yaeos__equilibria->module~yaeos__equilibria_boundaries_phase_envelopes_mp
module~yaeos__equilibria->module~yaeos__equilibria_boundaries_phase_envelopes_mp_px
module~yaeos__equilibria->module~yaeos__equilibria_boundaries_phase_envelopes_mp_tx
module~yaeos__equilibria->module~yaeos__equilibria_boundaries_phase_envelopes_pt3
module~yaeos__equilibria->module~yaeos__equilibria_boundaries_phase_envelopes_px3
module~yaeos__equilibria_boundaries_phase_envelopes_px
yaeos__equilibria_boundaries_phase_envelopes_px
module~yaeos__equilibria->module~yaeos__equilibria_boundaries_phase_envelopes_px
module~yaeos__equilibria_boundaries_phase_envelopes_tx
yaeos__equilibria_boundaries_phase_envelopes_tx
module~yaeos__equilibria->module~yaeos__equilibria_boundaries_phase_envelopes_tx
module~yaeos__equilibria_boundaries_phase_envelopes_px->module~yaeos__equilibria_boundaries_auxiliar
module~yaeos__equilibria_boundaries_phase_envelopes_tx->module~yaeos__equilibria_boundaries_auxiliar
module~yaeos__models_ge_implementations
yaeos__models_ge_implementations
module~yaeos__models_ge_implementations->module~yaeos__models_ge_uniquac
module~yaeos
yaeos
module~yaeos->module~yaeos__equilibria
module~yaeos__models
yaeos__models
module~yaeos->module~yaeos__models
module~yaeos__models->module~yaeos__models_ge_implementations
proc~psrk
PSRK
proc~psrk->module~yaeos__models_ge_implementations
Nodes of different colours represent the following:
Graph Key
Module
Module
Submodule
Submodule
Subroutine
Subroutine
Function
Function
Program
Program
This Page's Entity
This Page's Entity
Solid arrows point from a submodule to the (sub)module which it is
descended from. Dashed arrows point from a module or program unit to
modules which it uses.
Interfaces
public subroutine newton_1d (f, x, tol, max_iters, failed)
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
logical,
intent(out)
::
failed
Abstract Interfaces
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
Derived Types
Represents the single point of a line segment.
Read more…
Components
Type
Visibility Attributes
Name
Initial
integer,
public
::
i
Index of the first line segment
integer,
public
::
j
Index of the second line segment
real(kind=pr),
public
::
x
X coordinate
real(kind=pr),
public
::
y
Y coordinate
Functions
Calculate the mole fraction second derivatives respect to mole numbers
Read more…
Arguments
Type
Intent Optional Attributes
Name
real(kind=pr),
intent(in)
::
n (:)
Return Value
real(kind=pr), (size(n),size(n),size(n))
Calculate the mole fraction first derivatives respect to mole numbers
Read more…
Arguments
Type
Intent Optional Attributes
Name
real(kind=pr),
intent(in)
::
n (:)
Return Value
real(kind=pr), (size(n),size(n))
Linear interpolation.
Read more…
Arguments
Type
Intent Optional Attributes
Name
real(kind=pr),
intent(in)
::
x1
First point x value
real(kind=pr),
intent(in)
::
x2
Second point x value
real(kind=pr),
intent(in)
::
y1
First point y value
real(kind=pr),
intent(in)
::
y2
Second point y value
real(kind=pr),
intent(in)
::
x_obj
Desired x value to interpolate
Return Value
real(kind=pr)
y value at x_obj
Find the intersections of a single line with itself.
Read more…
Arguments
Type
Intent Optional Attributes
Name
real(kind=pr),
intent(in)
::
lx (:)
real(kind=pr),
intent(in)
::
ly (:)
Return Value
type(Point ), allocatable, (:)
…
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
Calculate the intersection between two line segments.
Read more…
Arguments
Type
Intent Optional Attributes
Name
real(kind=pr),
intent(in)
::
x1
real(kind=pr),
intent(in)
::
x2
real(kind=pr),
intent(in)
::
x3
real(kind=pr),
intent(in)
::
x4
real(kind=pr),
intent(in)
::
y1
real(kind=pr),
intent(in)
::
y2
real(kind=pr),
intent(in)
::
y3
real(kind=pr),
intent(in)
::
y4
real(kind=pr),
intent(out)
::
s
real(kind=pr),
intent(out)
::
t
Arguments
Type
Intent Optional Attributes
Name
public subroutine fun(m, n, x, fvec, iflag)
Arguments
Type
Intent Optional Attributes
Name
integer,
intent(in)
::
m
integer,
intent(in)
::
n
real(kind=pr),
intent(in)
::
x (n)
real(kind=pr),
intent(out)
::
fvec (m)
integer,
intent(inout)
::
iflag
real(kind=pr),
intent(in)
::
tol
real(kind=pr),
intent(inout)
::
X (:)
Variables vector
real(kind=pr),
intent(out)
::
F (:)
Function values at solved point
integer,
intent(inout)
::
info
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
logical,
intent(out)
::
failed
Arguments
Type
Intent Optional Attributes
Name
public subroutine fun(n, x, fvec, iflag)
Arguments
Type
Intent Optional Attributes
Name
integer,
intent(in)
::
n
real(kind=pr),
intent(in)
::
x (n)
real(kind=pr),
intent(out)
::
fvec (n)
integer,
intent(inout)
::
iflag
real(kind=pr),
intent(in)
::
tol
real(kind=pr),
intent(inout)
::
X (:)
Variables vector
real(kind=pr),
intent(out)
::
F (:)
Function values at solved point
integer,
intent(out)
::
info