Module Index

Detailed API

GasChromatographySystems.ModuleColumnType
ModuleColumn(; 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 function d. Empty, if d 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 function df. Empty, if df 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 a TemperatureProgram 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 form ModuleColumnOptions.

Four methods to construct this structure exist:

  • ModuleColumn(name, L, d, df, sp, T, opt::ModuleColumnOptions): The flow is not defined, uniform d and df.
  • ModuleColumn(name, L, d, df, sp, T, F, opt::ModuleColumnOptions): The flow is defined by F and uniform d and df.
  • ModuleColumn(name, L, d, df, sp, T; alg=OwrenZen5(), abstol=1e-8, reltol=1e-6, ng=false, Tcontrol="inlet"): The flow is not defined, uniform d and df. Options according to ModuleColumnOptions.
  • ModuleColumn(name, L, d, df, sp, tp, flow; alg=OwrenZen5(), abstol=1e-8, reltol=1e-6, ng=false, Tcontrol="inlet"): The flow is defined by F and uniform d and df. Options according to ModuleColumnOptions.
source
GasChromatographySystems.ModuleColumnOptionsType
ModuleColumnOptions(; 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 algorithms OwrenZen3(), OwrenZen4() and OwrenZen5() 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 are inlet (x=0) and outlet (x=L).
source
GasChromatographySystems.ModuleTMType
ModuleTM(; 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 function d. Empty, if d 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 function df. Empty, if df 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 a TemperatureProgram 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 which T is increased while the hot jet is active.
  • Tcold: Temperature in °C, by which T is decrease while the cold jet is active (if Tcold_abs = false in ModuleColumnOptions) or to which the column is cooled down (if Tcold_abs = true in ModuleTMOptions)
  • 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 form ModuleTMOptions.

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, uniform d and df.
  • ModuleTM(name, L, d, df, sp, T, shift, PM, ratio, Thot, Tcold, F, opt::ModuleTMOptions): The flow is defined by F and uniform d and df.
  • 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, uniform d and df. Options according to ModuleTMOptions.
  • 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 by F and uniform d and df. Options according to ModuleTMOptions.
source
GasChromatographySystems.ModuleTMOptionsType
ModuleTMOptions(; 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 parameter Tcold (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 if ng = true. Recommend sflank = 40. Only relevante, if option ng = 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. Recommend tflank = 20.
  • alg: The algorithm used for the ODE solver. For the thermal modulator module the algorithm Vern9() 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 of L*1e-6, with L 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 are inlet (x=0) and outlet (x=L).
source
GasChromatographySystems.OptionsType
Options(; 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 book Temperature-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 than k_th than the retention factor is set to the value k_th. This is done to avoid to small step widths in the solver for highly retained soultes at the beginning of a GC program.
source
GasChromatographySystems.PressurePointType
PressurePoint(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 the PressurePoint.
  • P: Pressure program as structure GasChromatographySystems.PressureProgram or as a number for constant pressure.
source
GasChromatographySystems.PressureProgramType
PressureProgram(time_steps, pressure_steps)

Structure describing the pressure program.

Arguments

  • time_steps: Time steps in s, after which the corresponding pressure in pressure_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).
source
GasChromatographySystems.SystemType
System(g, pressurepoints, modules, options)

Structure describing a GC system.

Arguments

  • name: Name of the GC system.
  • g: The graph representation of the GC system, using SimpleDiGraph from Graphs.jl.
  • pressurepoints: The vertices of graph g and their pressure programs. These are structures of type PressurePoint.
  • modules: The edges of graph g. These are column segments of type ModuleColumn or thermal modulator points of type ModuleTM.

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:

source
GasChromatographySystems.TemperatureProgramType
TemperatureProgram(time_steps, temp_steps, gf, a_gf)

Structure describing the temperature program.

Arguments

  • time_steps: Time steps in s, after which the corresponding temperature in temp_steps is reached.
  • temp_steps: Temperature steps in °C.
  • gf: Gradient function gf(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), with CP 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], with Ti temperature niveaus, ti holding times for the corresponding tempertures, ri the heating ramp between temperatures Ti and Ti+1.

A default temperature program is avaliable:

  • default_TP(): Heating from 40°C to 340°C in 1800 s (30 min).
source
GasChromatographySystems.build_pressure_squared_functionsMethod
build_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 = κ)
source
GasChromatographySystems.check_expressions_λ_κMethod
check_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 system n = ne(sys.g).
source
GasChromatographySystems.flow_balanceMethod
flow_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.
source
GasChromatographySystems.flow_functionsMethod
flow_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 from build_pressure_squared_functions(sys; mode="λ")
  • mode: Mode for flow equations to use flow permeabilities λ (mode = λ; default) or flow restrictions κ (mode = κ)
source
GasChromatographySystems.flow_permeabilitiesMethod
flow_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.
source
GasChromatographySystems.flow_restrictionsMethod
flow_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.
source
GasChromatographySystems.holdup_time_functionsMethod
holdup_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 from build_pressure_squared_functions(sys; mode="λ")
  • mode: Mode for flow equations to use flow permeabilities λ (mode = λ; default) or flow restrictions κ (mode = κ)
source
GasChromatographySystems.holdup_time_pathMethod
holdup_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 from build_pressure_squared_functions(sys; mode="λ")
  • numpaths: Number of the different paths between inlet and outlets of system sys.
  • mode: Mode for flow equations to use flow permeabilities λ (mode = λ; default) or flow restrictions κ (mode = κ)
source
GasChromatographySystems.interpolate_pressure_functionsMethod
interpolate_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 from build_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 = κ)
source
GasChromatographySystems.pressure_functionsMethod
pressure_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 from build_pressure_squared_functions(sys; mode="λ")
  • mode: Mode for flow equations to use flow permeabilities λ (mode = λ; default) or flow restrictions κ (mode = κ)
source
GasChromatographySystems.save_build_pressure_squared_functionsMethod
save_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. Default pwd()*"/p2fun_"*sys.name attached with "_λ.jl" or "_κ.jl", depending on mode.
  • 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$.

source
GasChromatographySystems.solve_balanceMethod
solve_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 = κ)
source
GasChromatographySystems.substitute_pressure_squared_functionsMethod
substitute_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 from build_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 = κ)
source
GasChromatographySystems.substitute_unknown_flowsMethod
substitute_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 ìandjwith 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 to flow_balance(sys)
source
GasChromatographySystems.unknown_FMethod

unknown_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.
source
GasChromatographySystems.unknown_pMethod

unknown_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.
source
GasChromatographySystems.unknown_λMethod

unknown_λ(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.
source