Chemical Function Section
Applicability: Synapse (core versions 0315+)

Synapse enables you to quickly and easily place constraints on physical properties. For example, if we are designing a chemical that should have liquid densities close to those of water, we can quickly enter the following constraints:

Function Minimum Goal Maximum
f("Density, Liquid - f(T)", 293.15, 0) 950 1000 1050
f("Density, Liquid - f(T)", 353.15, 0) 925 975 1025

However, we must often enter more complicated constraints. For example, constraints on ratios of properties, dimensionless numbers (e.g., the Prantl number), or heat transfer coefficients. Thus, each design and selection document contains a Functions chapter. The Functions chapter enables you to construct a design constraint of any complexity needed.

Editing Function Code

Clicking the left mouse button on the code edit control activates the Code Edit dialog.

The function's code is run for every chemical candidate in a design or selection. For input, the function is given the candidate's name, components, and composition. These input arguments can be accessed by the standard functions shown in the code to the right.

// Default declarations string candidate; // Default assignments candidate = Chemical();

For details on editing function code, see documentation for the Code Edit Dialog.

Field Commands Menu

Clicking the right mouse button within the field's code edit control activates the field's commands menu.

The menu's commands enable you to copy, cut and paste values to and from the data control. See Common Menu Commands for documentation on the commands commonly found on command menus.

Example: Entering a function to calculate the heat transfer coefficient

In this example we will create a function that will calculate the heat transfer coefficient for a fluid flowing through a tube. This function can be used in a constraint for designing a new solar thermal working fluid.

The heat transfer coefficient is calculated from the dimenionless Nusselt number:

The Nusselt number is calculated from the Dittus-Boelter correlation:


  1. Open the MKS Chemical Design Examples document. Save a "working" copy of the document. (See documentation on Copying Documents for details.)
  2. Change to the Functions chapter and add a new entity either by pressing the large "+" sign on the toolbar or selecting the Add New Page command from the Edit menu. Synapse will add a new, blank page to the current document.
  3. Click the left mouse button in the Identifier pane and enter a name for the new function.
  4. Click the left mouse button in the Function Section's large edit field. Synapse will activate the Code Edit dialog. (See the Code Edit Dialog for additional documentation.)
  5. Enter code to declare variables and assign parameter values.

    // Default declarations string candidate; // Default assignments candidate = Chemical(); // Variable declarations double den, visc, k, cp, temp, d, v; double pr, re, nu, h; string prop; int err; // Initialize parameters temp = 25 + 273.15; // K d = 0.020; // meters v = 0.80; // m/s
  6. Retrieve data values or estimates for each of the dependent physical properties.

    // Density prop = "Density, Liquid - f(T)"; den = CProp(candidate, prop, temp, 0, err); if( err != 0 ) return FALSE; // Viscosity prop = "Viscosity, Liquid - f(T)"; visc = CProp(candidate, prop, temp, 0, err); if( err != 0 ) return FALSE; // Thermal conductivity prop = "Thermal Conductivity, Liquid - f(T)"; k = CProp(candidate, prop, temp, 0, err); if( err != 0 ) return FALSE; // Heat capacity prop = "Heat Capacity - Isobaric, Liquid - f(T)"; cp = CProp(candidate, prop, temp, 0, err); if( err != 0 ) return FALSE;
  7. Calculate the Prantl and Reynolds numbers.

    // Calculate dimensionless numbers re = den * v * d / v; pr = visc * cp / k;
  8. Finally, calculate the Nusselt number and then heat transfer coefficient. Assign this result and return TRUE to indicate a successful calculation.
    // Calculate heat transfer coefficient nu = 0.023 * pr^0.4 * re^0.8; h = k / d * nu; // Assign value SetResult(h); // Successful return TRUE;
  9. Press the dialog's Save button. Synapse will check the code for errors and, if no errors are found, save the code into the current design document.
  10. To test the new function, select the Test Chemical Function command from the Commands menu.
  11. Synapse activates the Test Chemical Function dialog. Select 'Water' from the list of chemical candidates and press the dialog's Calculate button. Synapse will run the chemical function using water's physical properties and display the result.
Related Documentation
Topic Description
Getting Started using Synapse provides a quick tour of Synapse's capabilities including examples of chemical product design.
Designing Chemical Products a short video demonstrating how to use Synapse to design candidate chemicals that satisfy a set of physical property and molecular structure constraints.