Module Index
Detailed API
GasChromatographySystems.ModuleColumn
— TypeModuleColumn(; Tcold_abs=true, sflank=40, tflank=20, alg=Vern9(), abstol=1e-10, reltol=1e-8, dtinit=1e-6, ng=true, Tcontrol="inlet")
Structure describing the module of a gas chromatographic column, the basic buliding block of a gas chromatographic system. These are edges of the graph representation of a GC system.
Arguments
name
: Name of the module.L
: Length of the column in m.d
: Internal diameter of the column in m. This can be a function of column position, if a non-uniform diameter is used (not tested yet).a_d
: Parameters of the diameter functiond
. Empty, ifd
is not a function.df
: Film thickness of the column in m. This can be a function of column position, if a non-uniform film thickness is used (not tested yet).a_df
: Parameters of the film thickness functiondf
. Empty, ifdf
is not a function.sp
: The name of the stationary phase.T
: Temperature of the module. This can be a value (in °C) or a temperature program as aTemperatureProgram
structure.F
: Flow of the mobile phase through the column in mL/min. This can be an number, a fuction or a NaN (if it is not defined yet an should be calculated based on values from other modules or pressure points in the system).opt
: Options for this module. This is a structure of the formModuleColumnOptions
.
Four methods to construct this structure exist:
ModuleColumn(name, L, d, df, sp, T, opt::ModuleColumnOptions)
: The flow is not defined, uniformd
anddf
.ModuleColumn(name, L, d, df, sp, T, F, opt::ModuleColumnOptions)
: The flow is defined byF
and uniformd
anddf
.ModuleColumn(name, L, d, df, sp, T; alg=OwrenZen5(), abstol=1e-8, reltol=1e-6, ng=false, Tcontrol="inlet")
: The flow is not defined, uniformd
anddf
. Options according toModuleColumnOptions
.ModuleColumn(name, L, d, df, sp, tp, flow; alg=OwrenZen5(), abstol=1e-8, reltol=1e-6, ng=false, Tcontrol="inlet")
: The flow is defined byF
and uniformd
anddf
. Options according toModuleColumnOptions
.
GasChromatographySystems.ModuleColumnOptions
— TypeModuleColumnOptions(; alg=OwrenZen5(), abstol=1e-8, reltol=1e-5, ng=false, Tcontrol="inlet")
Structure describing options for column modules.
Arguments
alg
: The algorithm used for the ODE solver. The algorithmsOwrenZen3()
,OwrenZen4()
andOwrenZen5()
are recommended.abstol
: The absolute tolerance for the ODE solver. Recommended value 1e-6 to 1e-8.reltol
: The relative tolerance for the ODE solver. Recommended value 1e-3 to 1e-5.ng
: Option to calculate the simulation without a gradient (ng = true
, default) or with a gradient (ng = false
).Tcontrol
: Option defining at which point of the column the temperature program is calculated. The options areinlet
(x=0) andoutlet
(x=L).
GasChromatographySystems.ModuleTM
— TypeModuleTM(; Tcold_abs=true, sflank=40, tflank=20, alg=Vern9(), abstol=1e-10, reltol=1e-8, dtinit=1e-6, ng=true, Tcontrol="inlet")
Structure describing the module of a thermal modulator, a short section of a column with a periodic repeating temperature modulation between a cold and hot jet. These are edges of the graph representation of a GC system.
Arguments
name
: Name of the module.L
: Length of the column in m.d
: Internal diameter of the column in m. This can be a function of column position, if a non-uniform diameter is used (not tested yet).a_d
: Parameters of the diameter functiond
. Empty, ifd
is not a function.df
: Film thickness of the column in m. This can be a function of column position, if a non-uniform film thickness is used (not tested yet).a_df
: Parameters of the film thickness functiondf
. Empty, ifdf
is not a function.sp
: The name of the stationary phase.T
: Basic temperature of the module. On top of this temperature the modulation occurs. This can be a value (in °C) or a temperature program as aTemperatureProgram
structure.shift
: Time shift in s of the periodic modulation relative to the start of the chromatogram.PM
: Modulation period in s.ratio
: The ratio of the duration of cold and hot jet.Thot
: Temperature in °C, by whichT
is increased while the hot jet is active.Tcold
: Temperature in °C, by whichT
is decrease while the cold jet is active (ifTcold_abs = false
inModuleColumnOptions
) or to which the column is cooled down (ifTcold_abs = true
inModuleTMOptions
)F
: Flow of the mobile phase through the column in mL/min. This can be an number, a fuction or a NaN (if it is not defined yet an should be calculated based on values from other modules or pressure points in the system).opt
: Options for this module. This is a structure of the formModuleTMOptions
.
Four methods to construct this structure exist:
ModuleTM(name, L, d, df, sp, T, shift, PM, ratio, Thot, Tcold, opt::ModuleTMOptions)
: The flow is not defined, uniformd
anddf
.ModuleTM(name, L, d, df, sp, T, shift, PM, ratio, Thot, Tcold, F, opt::ModuleTMOptions)
: The flow is defined byF
and uniformd
anddf
.ModuleTM(name, L, d, df, sp, T, shift, PM, ratio, Thot, Tcold; Tcold_abs=true, sflank=40, tflank=20, alg=Vern9(), abstol=1e-10, reltol=1e-8, dtinit=1e-6, ng=false, Tcontrol="inlet")
: The flow is not defined, uniformd
anddf
. Options according toModuleTMOptions
.ModuleTM(name, L, d, df, sp, tp, shift, pm, ratio, Thot, Tcold, F; Tcold_abs=true, sflank=40, tflank=20, alg=Vern9(), abstol=1e-10, reltol=1e-8, dtinit=1e-6, ng=false, Tcontrol="inlet")
: The flow is defined byF
and uniformd
anddf
. Options according toModuleTMOptions
.
GasChromatographySystems.ModuleTMOptions
— TypeModuleTMOptions(; Tcold_abs=true, sflank=40, tflank=20, alg=Vern9(), abstol=1e-10, reltol=1e-8, dtinit=1e-6, ng=true, Tcontrol="inlet")
Structure describing options for thermal modulator modules.
Arguments
Tcold_abs
: Calculate the low temperature at the modulator as the absolute value of the defined parameterTcold
(Tcold_abs = true
) or as relative temperature difference from the defined oven temperature (Tcold_abs = false
).sflank
: Flank factor of the smoothed rectangle temperature function in space. A higher factor results in a steeper slope at the edges of the modulator point. Values between 12 and 100, or Inf ifng = true
. Recommendsflank = 40
. Only relevante, if optionng = false
.tflank
: Flank factor of the smoothed rectangle temperature function in time. A higher factor results in a steeper slope at the begining and end of the hot jet. Values between 12 and 100. Recommendtflank = 20
.alg
: The algorithm used for the ODE solver. For the thermal modulator module the algorithmVern9()
is recommend.abstol
: The absolute tolerance for the ODE solver. Recommended value 1e-6 to 1e-12.reltol
: The relative tolerance for the ODE solver. Recommended value 1e-3 to 1e-10.dtinit
: The initial step width for the ODE solver. A value ofL*1e-6
, withL
the length of the modulator module, is recommend.ng
: Option to calculate the simulation without a gradient (ng = true
, default) or with a gradient (ng = false
).Tcontrol
: Option defining at which point of the column the temperature program is calculated. The options areinlet
(x=0) andoutlet
(x=L).
GasChromatographySystems.Options
— TypeOptions(; gas="He", odesys=true, vis="Blumberg", control="Pressure", k_th=1e12)
Structure describing general options for the simulation of the system.
Arguments
gas
: The type of gas used as mobile phase in the gas chromatographic system. Allowed values: He, H2 or N2.odesys
: Combine the ODEs for migration and peak-width into a system of ODEs (odesys = true
) or solve the two ODEs separately (odesys = false
).vis
: Used model of viscosity.HP
is a second-order polynomial taken from the HP flow calculator.Blumberg
is an emperical formula according to the bookTemperature-programmed Gas Chromatography
by Leonid M. Blumberg (2010, Wiley-VCH).control
: Control of the "Flow" or of the "Pressure" (at column inlet) during the program.k_th
: Threshold for the maximum of the retention factor. If the calculated retention factor is bigger thank_th
than the retention factor is set to the valuek_th
. This is done to avoid to small step widths in the solver for highly retained soultes at the beginning of a GC program.
GasChromatographySystems.PressurePoint
— TypePressurePoint(name, PP)
Structure describing the pressure program at the connection points of the modules. These are the vertices of the graph representation of a GC system.
Arguments
name
: Name of thePressurePoint
.P
: Pressure program as structureGasChromatographySystems.PressureProgram
or as a number for constant pressure.
GasChromatographySystems.PressureProgram
— TypePressureProgram(time_steps, pressure_steps)
Structure describing the pressure program.
Arguments
time_steps
: Time steps in s, after which the corresponding pressure inpressure_steps
is reached.pressure_steps
: Pressure steps in Pa.
A default temperature program is avaliable:
default_PP()
: Pressure increase from 100.000 Pa to 200.000 in 1800 s (30 min).
GasChromatographySystems.System
— TypeSystem(g, pressurepoints, modules, options)
Structure describing a GC system.
Arguments
name
: Name of the GC system.g
: The graph representation of the GC system, usingSimpleDiGraph
fromGraphs.jl
.pressurepoints
: The vertices of graphg
and their pressure programs. These are structures of typePressurePoint
.modules
: The edges of graphg
. These are column segments of typeModuleColumn
or thermal modulator points of typeModuleTM
.
Examples
Simple GC:
Definition of the graph:
g = SimpleDiGraph(1)
add_edge!(g, 1, 2)
Definition of the two pressure points, here column inlet has the default pressure program and the outlet pressure is constant:
pp = Array{GasChromatographySystems.PressurePoint}(undef, nv(g))
pp[1] = GasChromatographySystems.PressurePoint("p_in", GasChromatographySystems.default_PP())
pp[2] = GasChromatographySystems.PressurePoint("p_out", pout)
Definition of the column module with default temperature program default_TP()
, flow is unknown and is calculated from the pressures, default module options:
modules = Array{GasChromatographySystems.AbstractModule}(undef, ne(g))
modules[1] = GasChromatographySystems.ModuleColumn("column", 30.0, 0.25*1e-3, 0.25*1e-6, "Rxi5ms", GasChromatographySystems.default_TP())
Combination to construct the System using the function update_system()
and default system options:
sys = GasChromatographySystems.update_system(GasChromatographySystems.System(g, pp, modules, GasChromatographySystems.Options()))
Series of n
columns:
Definition of the graph:
g = SimpleDiGraph(n+1)
for i=1:n
add_edge!(g, i, i+1)
end
Split of Columns:
GCxGC with thermal modulation and loop:
GasChromatographySystems.TemperatureProgram
— TypeTemperatureProgram(time_steps, temp_steps, gf, a_gf)
Structure describing the temperature program.
Arguments
time_steps
: Time steps in s, after which the corresponding temperature intemp_steps
is reached.temp_steps
: Temperature steps in °C.gf
: Gradient functiongf(x, a_gf)
, describes the thermal gradient.a_gf
:Parameters of the gradient function.
Two method to construct this structure exist for a uniform temperatur program (same for all column positions x
):
TemperatureProgram(time_steps, temp_steps)
TemperatureProgram(CP)
, withCP
beeing a conventional notation of a temperature program in the form of an array with the pattern[T1, t1, r1, T2, t2, r2, ..., Tn, tn]
, withTi
temperature niveaus,ti
holding times for the corresponding tempertures,ri
the heating ramp between temperaturesTi
andTi+1
.
A default temperature program is avaliable:
default_TP()
: Heating from 40°C to 340°C in 1800 s (30 min).
GasChromatographySystems.build_pressure_squared_functions
— Methodbuild_pressure_squared_functions(sys, solutions; mode="λ")
Construct array of functions of the solutions for the unkown squared pressures of the flow balance equations of the system of capillaries sys
.
The arguments for the build functions are arrays of the ordered known squared pressures $p^2$, the ordered known flow permabilities $λ$ resp. flow restrictions $κ$, the ordered known flows $F$ and constant $A = π/256 p_n/T_n$.
Arguments
sys
: System structure of the capillary system for which the flow balance is set up.solutions
: The solutions of the flow balance equations for the unknown pressures as symbolic expressions.mode
: Mode for flow equations to use flow permeabilities λ (mode = λ
; default) or flow restrictions κ (mode = κ
)
GasChromatographySystems.check_expressions_λ_κ
— Methodcheck_expressions_λ_κ(sol; mode="λ", n=100)
Checks the expressions of the array sol
(solutions to the flow balance equations) if they use the flow permeabilities λ or the flow restrictions κ and substitutes them if needed.
Arguments
sol
: Symbolic expressions (of the solutions for the flow balance equations)mode
: Mode for flow equations to use flow permeabilities λ (mode = λ
; default) or flow restrictions κ (mode = κ
)n
: Maximum of the number of expected symbols λ resp. κ. Could be replaced by the number of edges of the used systemn = ne(sys.g)
.
GasChromatographySystems.flow_balance
— Methodflow_balance(sys)
Constructing the flow balance equations of the capillary system sys
in the form of an array of symbolic equations.
For every inner vertice the sum of ingoing flows (positive) and of outgoing flows (negative) are equated to zero.
\[\Sum F_{in} + \Sum F_{out} = 0\]
Arguments
sys
: System structure of the capillary system for which the flow balance is set up.
GasChromatographySystems.flow_functions
— Methodflow_functions(sys, p2fun; mode="λ")
Collects the flow functions as functions of time t for all edges of the system of capillaries sys
.
The flow over edge i => j
is calculated as
\[F_{i,j} = \frac{A}{κ_{i,j}} \left(p_i^2-p_j^2\right)\]
with flow restriction $κ_{i,j} = \int_0^{L_{i,j}} η(T_{i,j})T_{i,j}/d_{i,j}^4 dx$, pressures $p_i$ resp. $p_j$ at the vertices $i$ resp. $j$, temperature $T_{i,j}$, capillary length $L_{i,j}$ and diameter $d_{i,j}$ of the edge i => j
.
Arguments
sys
: System structure of the capillary system for which the flow balance is set up.p2fun
: Julia function of the solutions of the flow balance equations frombuild_pressure_squared_functions(sys; mode="λ")
mode
: Mode for flow equations to use flow permeabilities λ (mode = λ
; default) or flow restrictions κ (mode = κ
)
GasChromatographySystems.flow_permeabilities
— Methodflow_permeabilities(sys)
Calculates the flow permeabilities λ of all edges (capliaries) of a system of capillaries.
Arguments
sys
: System structure of the capillary system for which the flow balance is set up.
GasChromatographySystems.flow_restrictions
— Methodflow_restrictions(sys)
Calculates the flow restrictions κ of all edges (capliaries) of a system of capillaries.
Arguments
sys
: System structure of the capillary system for which the flow balance is set up.
GasChromatographySystems.holdup_time_functions
— Methodholdup_time_functions(sys, p2fun; mode="λ")
Collects the hold-up time functions as functions of time t for all edges of the system of capillaries sys
.
The hold-up time over edge i => j
is calculated as
\[t_{M_{i,j}} = \frac{128}{3} η(T_{i,j}) \frac{L_{i,j}^2}{d_{i,j}^2} \frac{p_i^3-p_j^3}{\left(p_i^2-p_j^2\right)^2}\]
with flow restriction, pressures $p_i$ resp. $p_j$ at the vertices $i$ resp. $j$, temperature $T_{i,j}$, capillary length $L_{i,j}$ and diameter $d_{i,j}$ of the edge i => j
.
Arguments
sys
: System structure of the capillary system for which the flow balance is set up.p2fun
: Julia function of the solutions of the flow balance equations frombuild_pressure_squared_functions(sys; mode="λ")
mode
: Mode for flow equations to use flow permeabilities λ (mode = λ
; default) or flow restrictions κ (mode = κ
)
GasChromatographySystems.holdup_time_path
— Methodholdup_time_path(sys, p2fun, numpaths; mode="λ")
Calculates the hold-up times of the numpaths
paths as functions of time t of the system of capillaries sys
.
The hold-up time over edge i => j
is calculated as
Arguments
sys
: System structure of the capillary system for which the flow balance is set up.p2fun
: Julia function of the solutions of the flow balance equations frombuild_pressure_squared_functions(sys; mode="λ")
numpaths
: Number of the different paths between inlet and outlets of systemsys
.mode
: Mode for flow equations to use flow permeabilities λ (mode = λ
; default) or flow restrictions κ (mode = κ
)
GasChromatographySystems.interpolate_pressure_functions
— Methodinterpolate_pressure_functions(sys, p2fun; dt=1, mode="λ")
Interpolates (linearly) all pressure funtions at the vertices of the system of capillaries sys
between the time steps dt
. For the speed of the simulation these interpolated functions are faster than the pure solution functions of the flow balance equations.
Arguments
sys
: System structure of the capillary system for which the flow balance is set up.p2fun
: Julia function of the solutions of the flow balance equations frombuild_pressure_squared_functions(sys; mode="λ")
dt
: time steps, where the original pressure function is evaluated. Inbetween these time steps the pressure function is linearly interpolated.mode
: Mode for flow equations to use flow permeabilities λ (mode = λ
; default) or flow restrictions κ (mode = κ
)
GasChromatographySystems.pressure_functions
— Methodpressure_functions(sys, p2fun; mode="λ")
Collect all pressure functions as functions of time t at the vertices of the capillary system sys
, either from defined input values or from the solutions of the flow balance equations.
Arguments
sys
: System structure of the capillary system for which the flow balance is set up.p2fun
: Julia function of the solutions of the flow balance equations frombuild_pressure_squared_functions(sys; mode="λ")
mode
: Mode for flow equations to use flow permeabilities λ (mode = λ
; default) or flow restrictions κ (mode = κ
)
GasChromatographySystems.save_build_pressure_squared_functions
— Methodsave_build_pressure_squared_functions(sys, solution; filename=pwd()*"/p2fun_"*sys.name, mode="λ")
Constructs and saves the array of functions of the solutions solution
for the unkown squared pressures of the flow balance equations of the system of capillaries sys
.
Arguments
sys
: System structure of the capillary system for which the flow balance is set up.filename
: Filename, where the solution functions are saved. Defaultpwd()*"/p2fun_"*sys.name
attached with"_λ.jl"
or"_κ.jl"
, depending onmode
.mode
: Mode for flow equations to use flow permeabilities λ (mode = λ
; default) or flow restrictions κ (mode = κ
)
Output
A dictionary with the folowing keys is saved in a .jl
file:
"p2fun"
: the build function of the solutions"i_known_p"
: the indices of the known pressures."i_known_λ"
: the indices of the known flow permeabilities."i_known_F"
: the indices of the known flows."mode"
: mode of the functions using flow permeabilities λ or flow restrictions κ.
Loading
The saved dictionary can easily be loaded into Julia by
p2fun_load = include("p2fun_saved.jl")
The build functions have to be evaluated by eval.(p2fun_load["p2fun"])
before usage. The arguments for the squared pressure functions are the ordered known squared pressures $p^2$, the ordered known flow permabilities $λ$ resp. flow restrictions $κ$, the ordered known flows $F$ and constant $A = π/256 p_n/T_n$.
GasChromatographySystems.solve_balance
— Methodsolve_balance(sys; mode="λ", bal_eq = flow_balance(sys))
Solves the substituted flow balance equations of the capillary system sys
for the squared pressures of vertices with undefined pressures as an array of symbolic expressions.
Arguments
sys
: System structure of the capillary system for which the flow balance is set up.mode
: Mode for flow equations to use flow permeabilities λ (mode = λ
; default) or flow restrictions κ (mode = κ
)
GasChromatographySystems.substitute_pressure_squared_functions
— Methodsubstitute_pressure_squared_functions(p2fun, sys; mode="λ")
Substitutes the the pressure functions (solutions to the flow balance equations) with the known quantities of pressures, flows, flow restictions/permabilities.
This results in an array of pressures $p$ at vertices without defined pressure as function of time $t$.
Arguments
p2fun
: Julia function of the solutions of the flow balance equations frombuild_pressure_squared_functions(sys; mode="λ")
sys
: System structure of the capillary system for which the flow balance is set up.mode
: Mode for flow equations to use flow permeabilities λ (mode = λ
; default) or flow restrictions κ (mode = κ
)
GasChromatographySystems.substitute_unknown_flows
— Methodsubstitute_unknown_flows(sys; mode="λ", bal_eq = flow_balance(sys))
Substitutes flow equations for undefined flows over edges in the capillary system sys
in the flow balance equation system.
Flow equation over edge $j,i$ between vertice ì
and
j
with flow permability
λ_{i,j}
`:
\[F_{i,j} = A λ_{i,j} \left(p_i^2-p_j^2\right)\]
For flow resistance $κ_{i,j}$:
\[F_{i,j} = \frac{A}{κ_{i,j}} \left(p_i^2-p_j^2\right)\]
Arguments
sys
: System structure of the capillary system for which the flow balance is set up.mode
: Mode for flow equations to use flow permeabilities λ (mode = λ
; default) or flow restrictions κ (mode = κ
)bal_eq
: Array of the symbolic flow balance equations; defaults toflow_balance(sys)
GasChromatographySystems.unknown_F
— Methodunknown_F(sys)
Extract the index of the edges of the graph of system sys
for which the flows F
are not defined.
Arguments
sys
: System structure of the capillary system for which the flow balance is set up.
GasChromatographySystems.unknown_p
— Methodunknown_p(sys)
Extract the index of the vertices of the graph of system sys
for which the pressure p
are not defined.
Arguments
sys
: System structure of the capillary system for which the flow balance is set up.
GasChromatographySystems.unknown_λ
— Methodunknown_λ(sys)
Extract the index of the edges of the graph of system sys
for which the flow permeabilities λ
are not defined.
Arguments
sys
: System structure of the capillary system for which the flow balance is set up.