Skip to content

CemGEMS web app tutorial

Redefining processes (using jsoneditor)

The provided process definition templates cover several most frequent scenarios in thermodynamic modeling of cement hydration, blending and degradation by leaching, carbonation or salt ingress (attack). However, the actual scenarios of interest for CemGEMS users may go far beyound those implemented in process templates. In order to support users creativity in this context, CemGEMS provides (for expert users) some tools to clone a process document and modify it with help of jsoneditor widget. Doing so requires experience and understanding of the structure of CemGEMS JSON documents that define recipes and processes.

Creating a new process definition

Let us consider a process of "Ingress" type, created out of "Ingress::Add-Salts" template by doing selections as shown below:


After setting these selections, and entering Recipe name and Process name, click on the "Simulate process" button to equilibrate the parent recipe, simulate process, and plot the simulation results. In Plot Select row, change Abscissa to "Lead-linear" and Ordinate to "Volumes-solids" to see the plot frame below:


The "Ingress::Add-Salts" template defines a linear process that increases stepwise the mass (g) of "Salts" material while keeping the same initial temperature and w/b ratio as in the parent recipe. All template recipes define the "Salts" material as composed of 100 %mass CO2 constituent, hence, the "Ingress:Add-Salts:$default" will simulate the carbonation process (an addition of 0 to 30 g CO2 in 101 steps). To simulate ingress of another salt, the parent recipe needs to be cloned and the composition of "Salts" material needs to be modified.

However, in this tutorial page, we will look at what can be modified directly in (cloned) process definition document. The user may wish to perform the simulation in a narrower interval, namely 101 steps by adding 10 to 25 g CO2 instead of 0 to 30 g.

To make this change, let us first clone the process under the name "carb-narrow". In the Process row, click on the "Clone" button (squares and a green eye), enter the new process name, and click "Clone". The plot frame disappears. Before starting the simulation, we need to modify the cloned process document.

First look at a process document

To get access to the process JSON document, click on the "Edit JSON data" button (a pencil inside of a rectangle) in the Process row. This will open the jsoneditor widget. Expand the second row (by clicking on a triangle):


Now, the JSON subdocument describing the process is visible. The main part of it is the "inputSpans" list that contains one or more spans. The span is a JSON object telling what and how changes from step to step in the current recipe inputs. This simple process is defined by only one span. Click on triangle to expand "inputSpans" and again into an appearing triangle with index 0 to see inside the span:


This span defines 101 steps ("numsteps" : "101") generated by linear stepping starting from 0 ("valstart" : "0.00000") and running until 40 ("valstop" : "40.00000") with step value 0.4 ("valstep" : "0.40000"). The "targetPath" field contains a string (JSON path) showing which field of the current recipe input will be changed: in this case, the Quantity of material #0 ("Salts") in recipe #0. This field (and its units) can be seen by expanding the input recipes and materials in the [inputRecipes (All recipes)] area of the tree-like table.

Now we can edit the process definition as desired: set "valstart" : "10.00000"; "valstop" : "30.00000"; and "valstep" : "auto" (as we retain "numsteps" : "101", the valstep value will be calculated automatically).

Attention: value types

Please be careful with value types. If any of numbers that you changed is shown in red color then use the menu on the left side against this JSON field to change the type to string.

After editing, the span should look like that shown below (note that jsoneditor marks all edited fields in color):


Click on the green tick in the upper-left corner to save the edited fields and close the jsoneditor widget. You can open it again and choose the Text mode (instead of default Tree mode) to see how the edited part of the process JSON document looks in JSON format:

    "Comment": "Linear CO2 or salt ingress into 100 g of (hydrated) cement of any type. Composition of added Salts material has to be defined in the parent recipe task",
    "Process": "CO2 or salt ingress",
    "ProcessComputed": true,
    "built_in_model": "none",
    "initialGuessType": "StartCold",
    "inputSpans": [
        "Comment": "Increase of mass of Salts (stepwise linear)",
        "InputSpan": "Adding Salts",
        "lead": true,
        "numsteps": "101",
        "stepping": "linear",
        "targetPath": "/recipes/0/materials/3/Quantity",
        "targetUnit": "g",
        "valstart": "10",
        "valstep": "auto",
        "valstop": "25"
    "inputSpans__isExpanded": false,
    "parentTaskId": "dk_recipes/CEM-I-SR::xrf::PCSRx",
    "processType": "attack",
    "stepDoneAll": [

Now, click on "Simulate Process" button to run the cloned and modified process. After a few seconds, the plot frame appears, showing Volumes (of phases) against Process Step (from 0 to 100). Switch Abscissa to "Lead-linear" in "Plot Select" row, to see (below) that indeed, we have been adding from 10 to 25 g CO2, as intended. Change the Chart to "StackedBars" and Ordinate to "Masses" to look at an alternative view of results:


In a similar way (by modifying process spans or adding new spans), the desired scenarios can be implemented for process simulations. Only one span can be declared as ("lead" : true), other spans must be declared as ("lead" : false). If the process is controlled by the time then time is a lead variable, and all spans must be declared as ("lead" : false).


Last update: June 14, 2020