Adding an End-Of-Pipe (EOP) Simulation - Introduction to the $data Macro and Complex Project Directory Structure

Here you will learn how to simulate end-of-pipe (EOP) experiments by introducing you to the $data macro, as well as a few other options for modifying your experimental data. We will also show you how to spread CaRMeN's configuration across multiple files in your Project Directory.

In this tutorial we will therefore show you how to configure an EOP simulation for a fourth set of experimental data using the $data macro, a routine to perform multiple simulations according to a variable listed in the data file. Please complete the tutorial Adding Other Reactor Types before starting with the present one.

Steps

  1. Introduction to EOP Experiments and the $data Macro
  2. Description of the Example Setup
  3. Adding the New Experimental Data
    1. Consolidating Files into the Project Directory
    2. Writing the package.json file
    3. Writing the carmen.yml file
      1. Adding Resources
      2. Adding the New Case
  4. Concluding Remarks

1. Introduction to EOP Experiments and the $data Macro

Before we start, lets answer the most obvious question: what is an end-of-pipe experiment, and why is it so special?

An end-of-pipe experiment is a very common type of experiment where the measurements, for example species concentrations, are measured, as the name suggests, at the end of the pipe or whatever setup one uses. In other words, in an EOP one measures what comes out of the reactor. Such a setup looses in comparison to spatially resolved measurements one dimension, i.e. the position dimension. EOP experiments allow however, and are very widely applied, to measure for example conversion rates at different temperatures and/or pressures.

What makes EOP experiments so special for simulating is that one simulation provides only a single point in the plot, so to obtain a certain number of simulated points the same number of simulations has to be performed, and only the results from the reactor (or pipe) end of each simulation are depicted in the graph. So if one measures the conversion of a certain species at multiple temperatures, CaRMeN will perform one simulation for each temperature and one will obtain a plot of convertion against temperature.

Configuring an EOP simulation requires the already mentioned $data macro. This macro takes a given variable from the data file and instructs CaRMeN to perform one simulation for the each of the listed values of this variable. So if one has for example a csv file containing a column with the temperature, one can write $data: T to perform one simulation for each of the temperature values in the T column. In this tutorial we will show you where to introduce this macro in the case definition.

2. Description of the Example Setup

In this tutorial we will add experimental data collected by Donazzi et al. 1 for the catalytic partial oxidation of methane over a 4% Rh/α-Al2O3 catalyst. The measured data consists of the concentration of H2O, H2, CO, CO2, and O2 in the exhaustion gas of an annular reactor, where the catalyst is deposited only on the inner wall. To simulate this data we will use the annular configuration of the DETCHEM channel driver. Further details on the experimental setup can be found in Donazzi and coworkers publication 1. The original experimental data is also available for download as a .zip-file from DETCHEM's homepage (http://www.detchem.com/html/downloads.html#Carmen).

The following table summarizes the experimental conditions. All values are given in SI-units.

name value unit
Gas temperature at inlet - K
Gas velocity at inlet - m/s
Gas mole fraction of CH4 0.01
Gas mole fraction of H2 0.02
Gas mole fraction of O2 0.01
Gas mole fraction of N2 0.06
Channel length 0.02 m
Channel inner radius 4.0e-3 m
Channel outer radius 5.0e-3 m
Reactor pressure 1.013e5 Pa
Reactor wall temperature - K

The temperature and the velocity of the gas flow at the inlet as well as the temperature of the reactor wall will be taken from the experimental data file using $data macros. Here is a preview of the experimental data when opened with either Pages or Excel:

SR\_EOP\_600-1100

3. Adding the New Experimental Data

We will now add the new experimental data for our simulations.

i. Consolidating Files into the Project Directory

In all previous tutorials of this documentation we have defined all experimental data and chemical models including cases, resources, and mixins into one and the same carmen.yml file. This approach is very practical for a small number of cases and mixins. However this, as you may have already noticed by now, gets progressively impractical as we continue to add data and models to our simulation. We have defined no more than three experimental data sets and two chemical models and our carmen.yml is already quite long and overwhelming when copied into this documentation.

One way to get around this issue is to spread (or divide) the definition of the different cases and mixins across multiple individual files, which results in shorter, easier to read files. We will follow this approach in present tutorial.

There are a few aspects to consider when defining cases and mixins over multiple files:

  • Stay within the Project Directory: Weather you create a complex folder hierarchy or just a bunch of cleverly named files you must always keep all of your files and folders into the one folder you instructed CaRMeN to use as the Project Directory. Any file or folder outside of the Project Directory will not be loaded by CaRMeN. This introduces however a further degree of flexibility. Create different folders containing different files to be used as Project Directories, if you wish to work with (or show) only some of your cases and mixins, either in a presentation or in a meeting.

  • Only one package.json file per folder: CaRMeN strictly requires the presence of a package.json file in order to load any kind of configuration. Moreover, package.json files can only contain one object with a name key, a version key, and a carmen key, so if you define your CaRMeN's configuration parameters by refereeing in the carmem: field to an external .yml file, you must create one package.json file —and therefore also one folder for each package.json file since the name of these files can not be changed,— for each of the .yml files you are using. In all of the tutorials in this documentation we have named these .yml files carmen.yml.

  • Keep Cases/Mixins with their resources: Cases and Mixins usually employ resources to load data from external files. However, a resource is an internal file definition only, which means that it only applies within the file that is written in. So if you move the definition of a case's/mixin's resource into a different file, CaRMeN will not be able to load the resource of the case/mixin at hand.

  • Do not change the hierarchy of the Project Directory: Before starting a case study with CaRMeN it is strongly recommendable to agree on a common hierarchy for all of your folders and files within your Project Directory, to follow this hierarchy consequently, and to not move your created files around unless it is really necessary. Experimental data, chemical models, and configuration parameters can and are usually defined or loaded from external files when working with CaRMeN, for which the path to the respective files must be specified. So if at some point you move for example the experimental data file of a case into a different folder but you forgot to update the path to the file in your carmen.yml file, CaRMeN is not going to be able to load the package correctly. One way to get around this issue is to set individual folders for each case/mixin (or group of similar cases/mixins) and to consolidate all files refereed to by the cases/mixins within the same folder. So if you wish to create one (or more cases) for the experimental data of a certain group for example, you can create an identifiably named folder containing a package.json file (and optionally a carmen.yml file) as well as the file (or files) containing the experimental data. If you wish to create a mixin for a specific chemical model for example, you can create a folder containing again a package.json file (and optionally a carmen.yml file) as well as the files containing the chemical data (e.g. moldata), the thermodynamic data (e.g. thermo.ckt), and the reaction mechanism (e.g. surface.ckr). This way you will be able move and rearrange the folders containing your cases'/mixins' definitions without having to update the external file paths.

Create a new folder within your Project Directory an give it any name of your choice. In this example we will name the new folder EOP. The original files from Donazzi and coworkers 1 are in the folder downloaded from DETCHEM's homepage under the path /PCCP 2018 10.1039_c7cp07777g/experiments/published data/Donazzi 2008 10.1016_j.jcat.2008.02.009/SR_EOP_StoC2.0. Now copy the file containing the experimental data into the Project Directory. We will take the original data file called data.csv and rename it to SR_EOP_600-1100.csv. In this example the data is written in CSV format, however, using ; semicolons as delimiters, so we have to define a resource for it in oder for CaRMeN to load the data correctly. Moreover, the file's first column u0 contains data for the gas flow velocity which we do not wish to plot, so we will have to implement additional configurations to the data resource in order to define the independent variable and the columns to be plotted.

ii. Writing the package.json file

Create a new file with the name package.json in your new folder EOP and write one object containing the general syntax of a package.json file. We have named our package.json file "first_eop".

{
  "name": "first_eop",
  "version": "0.0.0",
  "carmen": "carmen.yml"
}

iii. Writing the carmen.yml file

Create now a new file with the name carmen.yml in your new folder EOP.

iii.i. Adding Resources

We will begin by defining the resource to the data file. Open your carmen.yml file and start writing the general syntax of an end-to-end resource. If you are not familiar with the concept of end-to-end resources see the tutorial Adding Other Reactor Types.

#...
resources:
  -
    name: data
    input: ./SR_EOP_600-1100.csv
    options:
      delimiter: ;
      primaryKey: T
      columns:
        - T
        - H2O
        - H2
        - CO
        - CO2
        - O2
#...

Here we give the new resource the name data and specify the path to the experimental file ./SR_EOP_600-1100.csv. As we already mentioned, we must set the resource loader to use ; semicolons as delimiters so we write delimiter: ; under the options: field.

The primaryKey: field is optional. It defines which of the variables (i.e. columns) in the data file is used as the primary key (i.e. the independent variable for the plot). If no primarykey key is defined, CaRMeN assumes the first column of the data file, in this case that would be u0, as the primary key. Since in this example we want plot the mole fraction of species against the temperature, we must specify the column under the name T to be taken as the primary key by writing primaryKey: T under the options: field.

The columns: field is optional. It defines which columns from the data file are to be plotted, given as an array, each one starting with a double blank space followed by a - hyphen and a blank space. Non listed columns will not be plotted, if the columns option key is used. If no columns key is defined, CaRMeN plots all columns contained in the data file, regardless of their order of appearance. Since in this example we do not want plot the gas flow velocity u0, we must specify the columns under the names T, H2O, H2, CO, CO2, and O2 to be plotted by writing them as an array under the columns: field.

iii.ii. Adding the New Case

We will now define the case for the new experimental data set. Create a new array entry under cases: and start typing the general structure of a case.

cases:
  -
    title: My first EOP - SR 600-1100 Rh
    data: data
    view:
      label:
        x: temperature (T/K)
        y: mole fractions
    configuration:
      driver: detchem_channel
      parameters:
        #...

Here we name the new case My first EOP - SR 600-1100 Rh and we define the data of the case to be taken from the data resource we just created. In this example we also make use of the optional view key containing a label key. In this case we want to plot mole fraction of species against the temperature T in kelvin (K), so we write x: Temperature (T/K) and y: mole fractions under the label: field. We implement the DETCHEM channel driver by writing driver: detchem_channel under the configuration: field, and under the parameters: field of the driver we write the an inlet key, a channel key, a catalytic_activity: key, a washcoat key, an f_cat_geo key, a pressure key, and a wall_temperature key.

#...
parameters:
  inlet:
    #...
  channel:
    #...
  catalytic_activity:
    #...
  washcoat:
    #...
  f_cat_geo: 100
  pressure: 1.013e5
  wall_temperature:
    #...

Under the inlet: field we define the conditions of the gas flow entering the reactor by writing a temperature key, a gas_velocity key, and a mole_fractions key.

      #...
        inlet:
          temperature:
            $data: T
          gas_velocity:
            $data: u0
          mole_fractions:
            CH4: 0.01
            H2: 0.02
            O2: 0.01
            N2: "*"
              #...

The temperature of the gas flow entering the reactor is given in the data file under the T column, so we write $data: T under the temperature: field. The velocity of the gas flow entering the reactor is also given in the data file but under the u0 column, so we write $data: u0 under the gas_velocity: field. The mole fractions of the species entering the reactor are given as usual. Under the channel: field we define the geometry of the channel for an annular reactor.

        #...
        channel:
          length: 0.02
          radius:
            inner: 4.0e-3
            outer: 5.0e-3
        catalytic_activity:
          inner: true
          outer: false
        #...

We define the length of the channel by writing length: 0.02 under the channel: field. The radius of the inner and of the outer wall of the channel we define by writing inner: 4.0e-3 and outer: 5.0e-3 respectively under the radius: field. Since the catalyst was only applied on the inner reactor wall we define the inner wall to be catalytically active and the outer wall to be catalytically inactive by writing inner: true and outer: false under the catalytic_activity: field. The washcoat is defined as usual under the washcoat: field.

        #...
        washcoat:
          thickness: 10e-6
          pore_diameter: 100e-9
          tortuosity: 3
          porosity: 0.64
          diffusion_limiting_species:
            - CH4
        #...

Previous work done with this data set suggests the values given above as a good approximation of the washcoat structure and conditions. The value for the f_cat_geo variable is also taken from previous work done with this data set. The reactor pressure is set to the experimental pressure as usual by writing pressure: 1.013e5 under the parameters: field. The temperature of the reactor wall is given in the data file under the T column, so we write $data: T under the wall_temperature: field.

        #...
        wall_temperature:
          $data: T
        #...

The definition of the case for the new experimental data is now complete. Your new carmen.yml file should look by now as follows:

resources:
  -
    name: data
    input: ./SR_EOP_600-1100.csv
    options:
      delimiter: ;
      primaryKey: T
      columns:
        - T
        - H2O
        - H2
        - CO
        - CO2
        - O2

cases:
  -
    title: My first EOP - SR 600-1100 Rh
    data: data
    view:
      label:
        x: temperature (T/K)
        y: mole fractions
    configuration:
      driver: detchem_channel
      parameters:
        inlet:
          temperature:
            $data: T
          gas_velocity:
            $data: u0
          mole_fractions:
            CH4: 0.01
            H2: 0.02
            O2: 0.01
            N2: "*"
        channel:
          length: 0.02
          radius:
            inner: 4.0e-3
            outer: 5.0e-3
        catalytic_activity:
          inner: true
          outer: false
        washcoat:
          thickness: 10e-6
          pore_diameter: 100e-9
          tortuosity: 3
          porosity: 0.64
          diffusion_limiting_species:
            - CH4
        f_cat_geo: 100
        pressure: 1.013e5
        wall_temperature:
          $data: T

You may now proceed to load the Project Directory into CaRMeN and run the simulation as shown in the tutorial Quick Start. If you have followed all steps correctly you should see the following result in CaRMeN's Combiner View window.

Result First EOP

Notice that all the cases and mixins we created before are still loaded by CaRMeN since they are defined by another package in the Project Directory.

4. Concluding Remarks

Thank you for completing this tutorial. You should now be able to perform end-of-pipe (EOP) simulations by using the $data macro as well as other options for data resources. You should now be also aware that cases and mixins can be conveniently defined in individual packages by following a few simple rules regarding the data structure of the Project Directory. This last point is crucial when performing case studies on a large number of experimental data sets and/or chemical mechanisms.

In the next tutorial Unknown we will ...

1. A. Donazzi, A. Beretta, G. Groppi and P. Forzatti, J. Catal., 2008, 255, 241–258, DOI:10.1016/j.jcat.2008.02.009

results matching ""

    No results matching ""