pmutt.io.omkm.write_yaml
- pmutt.io.omkm.write_yaml(reactor_type=None, temperature_mode=None, pressure_mode=None, nodes=None, V=None, T=None, P=None, A=None, L=None, cat_abyv=None, flow_rate=None, residence_time=None, mass_flow_rate=None, end_time=None, transient=None, stepping=None, init_step=None, step_size=None, atol=None, rtol=None, full_SA=None, reactions_SA=None, species_SA=None, phases=None, reactor=None, inlet_gas=None, multi_T=None, multi_P=None, multi_flow_rate=None, output_format=None, solver=None, simulation=None, multi_input=None, misc=None, units=None, filename=None, yaml_options={'default_flow_style': False, 'indent': 4}, newline='\n')
Writes the reactor options in a YAML file for OpenMKM.
- Parameters:
reactor_type (str) –
Type of reactor. Supported options include:
pfr
pfr_0d
cstr
batch
Value written to
reactor.type.temperature_mode (str) –
Operation of reactor. Supported options include:
Isothermal
Adiabatic
Value written to
reactor.temperature_mode.pressure_mode (str) –
Operation of reactor. Supported options include:
Isobaric
Isochoric
Value written to
reactor.pressure_mode.nodes (int) – Number of nodes to use if
reactor_typeis ‘pfr_0d’. Value written toreactor.nodesV (float or str) – Volume of reactor. Value written to
reactor.volume. Units of length^3. See Notes section regarding unit specification.T (float) – Temperature (in K) of reactor. Value written to
reactor.temperature.P (float or str) – Pressure of reactor. Value written to
reactor.pressure. Units of pressure. See Notes section regarding unit specification.A (float or str) – Surface area of reactor. Value written to
reactor.area. Units of length^2. See Notes section regarding unit specification.L (float or str) – Length of reactor. Value written to
reactor.length. Units of length. See Notes section regarding unit specification.cat_abyv (float or str) – Catalyst surface area to volume ratio. Value written to
reactor.cat_abyv. Units of 1/length. See Notes section regarding unit specification.flow_rate (float or str) – Volumetric flow rate of inlet. Value written to
inlet_gas.flow_rate. Units of length^3/time. See Notes section regarding unit specification.residence_time (float or str) – Residence time of reactor. Value written to
inlet_gas.residence_time. Not required ifflow_rateormass_flow_ratealready specified. Units of time. See Notes section regarding unit specification.mass_flow_rate (float or str) – Mass flow rate of inlet. Value written to
inlet_gas.mass_flow_rate. Units of mass^3/time. See Notes section regarding unit specification.end_time (float or str) – Reactor simulation time. For continuous reactors, the system is assumed to reach steady state by this time. Value written to
simulation.end_time. Units of time. See Notes section regarding unit specification.transient (bool) – If True, transient operation results are saved. Otherwise, transient files are left blank. Value written to
simulation.transient.stepping (str) –
Time steps taken to simulate reactor. Supported options include:
logarithmic
regular
Value written to
simulation.stepping.init_step (float or str) – Initial step to take. Value written to
simulation.init_step.step_size (float or str) – If
steppingis logarithmic, represents the ratio between the next step and the current step. Ifsteppingis regular, represents the time between the next step and the current step in units of time. Value written to simulation.step_size. See Notes section regarding unit specification.atol (float) – Absolute tolerance for solver. Value written to
simulation.solver.atol.rtol (float) – Relative tolerance for solver. Value written to
simulation.solver.rtol.full_SA (bool) – If True, OpenMKM will do a full sensitivity analysis using the Fisher Information Matrix (FIM). Value written to
simulation.sensitivity.full.reactions_SA (list of str or list of
SurfaceReactionobj) – List of reactions to perturb using local sensitivity analysis (LSA). If a list ofSurfaceReactionis given, theidattribute will be used.species_SA (list of str or list of
EmpiricalBaseobj) – List of species to perturb using local sensitivity analysis (LSA). If a list ofEmpiricalBaseis given, thenameattribute will be used.phases (list of
Phaseobjects) – Phases present in reactor. Each phase should have thenameandinitial_stateattribute.reactor (dict) – Generic dictionary for reactor to specify values not supported by
write_yaml.inlet_gas (dict) – Generic dictionary for inlet_gas to specify values not supported by
write_yaml.multi_T (list of float) – Multiple temperatures (in K) of reactor. Value written to
simulation.multi_input.temperature.multi_P (list of float/str) – Multiple pressures of reactor. Value written to
simulation.multi_input.pressure. Units of pressure. See Notes section regarding unit specification.multi_flow_rate (list of float/str) – Multiple flow rates to run the model. Value written to
simulation.multi_input.flow_rate. Units of length3/time. See Notes section regarding unit specification.output_format (str) –
Format for output files. Supported options include:
CSV
DAT
Value written to
simulation.output_format.misc (dict) – Generic dictionary for any parameter specified at the top level.
solver (dict) – Generic dictionary for solver to specify values not supported by
write_yaml.simulation (dict) – Generic dictionary for simultaion to specify values not supported by
write_yaml.multi_input (dict) – Generic dictionary for multi_input to specify values not supported by
write_yaml.units (dict or
Unitobject, optional) – Units used for file. If a dict is inputted, the key is the quantity and the value is the unit. If not specified, uses the default units ofUnit.filename (str, optional) – Filename for the input.cti file. If not specified, returns file as str.
yaml_options (dict) – Options to pass when converting the parameters to YAML format. See PyYAML documentation for
dumpfor available options.
- Returns:
lines_out – If
filenameis None, CTI file is returned- Return type:
Notes
Units If
unitsis not specified, all values in file are assumed to be SI units. Ifunitsis specified, all values inputted are assumed to be in the units specified byunits. If a particular unit set is desired for a value, a str can be inputted with the form quantity=”<<value>> <<desired units>>” wherevalueis float-like anddesired unitsis a string. For example, flow_rate=”1 cm3/s”. See https://vlachosgroup.github.io/openmkm/input for the most up-to-date supported values.Generic Dictionaries Also, values in generic dictionaries (i.e.
reactor,inlet_gas,simulation) will ben written preferentially over arguments passed. i.e. The value inreactor['temperature']will be written instead ofT.