# Optional inputs

In addition to the mandatory inputs required for the various [flash calculations](https://devdocs.olisystems.com/group1/api-functions), three additional inputs may also be present to control the calculation or for requesting additional data in the output. These are:-

* included/excluded solids
* optional properties
* output units

{% hint style="info" %}
In this example, let's assume the chemistry model file contains **H2O, NACL, CO2** and **BENZENE** as inflows and is using the **MSE thermodynamic framework.**&#x20;
{% endhint %}

### include or exclude solid species from precipitating&#x20;

OLI flash computations by default account for the formation of all solid species in the chemistry model. However, users can choose a subset of solid species in the computation by specifying them in the **params.excludedSolids** or **params.includedSolids** array.  Example input and description are given below.&#x20;

Note: Solids must be specified using the fully qualified tag. This is returned as the trueName when using the [Chemistry Info](https://devdocs.olisystems.com/group1/api-functions/chemistry-info)[rmation](https://devdocs.olisystems.com/group1/api-functions/chemistry-info) API.

{% tabs %}
{% tab title="exclude solids" %}

```javascript
"excludedSolids": [
            "NAOH.2H2O",
            "NAOH.4H2O",
            "NACLPPT"
        ]
```

{% endtab %}

{% tab title="exclude all solids" %}

```javascript
"includedSolids": [] 
```

{% endtab %}

{% tab title="include solids" %}

```javascript
"includedSolids": [
            "NAOH.2H2O",
            "NAOH.4H2O",
            "NACLPPT"
        ]
```

{% endtab %}
{% endtabs %}

| **params**     | type      | description                                                                                                      |
| -------------- | --------- | ---------------------------------------------------------------------------------------------------------------- |
| excludedSolids | \[string] | list of excluded solid species in the flash computation                                                          |
| includedSolids | \[string] | list of included solid species in flash computation, if an empty array is specified, all solids will be excluded |

{% hint style="warning" %}
**params.excludedSolids** and **params.includedSolids** cannot be specified at the same time.&#x20;
{% endhint %}

### Optional properties

After the equilibrium solution is obtained, the user has the option to specify a number of optional properties to be computed along with this output. These can be turned on or off using a Boolean flag (true/false) in the **params.optionalProperties** objec&#x74;**.** Example input and description is given below

```javascript
{
    "params": {
        ...<snip>...
        "optionalProperties": {
            "electricalConductivity": true,
            "viscosity": true,
            "selfDiffusivity": true,
            "heatCapacity": true,
            "thermalConductivity": true,
            "surfaceTension": true,
            "interfacialTension": true,
            "prescalingTendencies": true
        }
    }
}
```

| params.optionalProperties       | type | desc                                                                |
| ------------------------------- | ---- | ------------------------------------------------------------------- |
| electricalConductivity          | bool | Electrical conductivity of the liquid phase                         |
| viscosity                       | bool | Viscosity for any liquid or gas phases                              |
| selfDiffusivityAndMobility      | bool | Self diffusivity and mobility for any liquid or gas phases          |
| heatCapacity                    | bool | Heat capacity for any phases                                        |
| thermalConductivity             | bool | Thermal conductivity for any phases                                 |
| surfaceTension                  | bool | Surface tension for any liquid phases                               |
| interfacialTension              | bool | Interfacial tension between liquid1 and liquid2 phases              |
| volumeStdConditions             | bool | liquid1, liquid2, and vapor phase volume at standard conditions     |
| prescalingTendenciesEstimated   | bool | prescaling tendencies of solids using the estimated method          |
| prescalingIndexEstimated        | bool | prescaling indices of solids using the estimated method             |
| prescalingTendenciesRigorous    | bool | prescaling tendencies of solids using the rigorous method           |
| prescalingIndexRigorous         | bool | prescaling indices of solids using the rigorous method              |
| scalingTendencies               | bool | scaling tendencies of solids                                        |
| scalingIndex                    | bool | scaling indices of solids                                           |
| hardness                        | bool | hardness of liquid1 phase                                           |
| ionicStrengthXBased             | bool | x-based ionic strength of any liquid phases                         |
| ionicStrengthMBased             | bool | m-based ionic strength of any liquid phases                         |
| totalDissolvedSolids            | bool | total dissolved solids in the liquid1 phase                         |
| vaporToInflowMoleFraction       | bool | vapor to inflow mole fraction                                       |
| partialPressure                 | bool | vapor phase partial pressures of all species                        |
| vaporDiffusivityMatrix          | bool | vapor diffusivity matrix                                            |
| entropyStream                   | bool | entropy of stream for all phases                                    |
| entropySpecies                  | bool | entropy of each species for all phases                              |
| entropyStreamStandardState      | bool | entropy of stream at standard state for all phases                  |
| entropySpeciesStandardState     | bool | entropy of each species at standard state for all phases            |
| gibbsEnergyStream               | bool | Gibbs free energy of stream for all phases                          |
| gibbsEnergySpecies              | bool | Gibbs free energy of each species for all phases                    |
| gibbsEnergyStreamStandardState  | bool | Gibbs free energy of stream at standard state for all phases        |
| gibbsEnergySpeciesStandardState | bool | Gibbs free energy of each species at standard state for all phases  |
| activityCoefficientsMBased      | bool | m-based activity coefficients of each species for all liquid phases |
| activityCoefficientsXBased      | bool | x-based activity coefficients of each species for all liquid phases |
| fugacityCoefficients            | bool | fugacity coefficients of each species for liquid2 and vapor phases  |
| vaporFugacity                   | bool | fugacities of each species for vapor phase                          |
| kValuesXBased                   | bool | x-based K-values for all equilibrium reactions                      |
| kValuesMBased                   | bool | x-based M-values for all equilibrium reactions                      |
| materialBalanceGroup            | bool | material balance group compositions for all phases                  |

{% hint style="warning" %}
**params.optionalProperties.volumeStdConditions** calculate liquid1, liquid2, and vapor phase volume at default standard conditions, which can be specified in [here](#standard-conditions).
{% endhint %}

{% hint style="info" %}
**params.optionalProperties.scalingInductionTime** calculates induction time for scaling solids. Additional inputs are needed for this calculation and explained [here](#undefined). This property is only supported for MSE and MSE-SRK thermodynamic properties.
{% endhint %}

### Scaling Induction Time

Induction time is estimated based on the supersaturation level of the scaling solid. Therefore, such solids need to be excluded to calculate their induction times, as specified below.

```json
{
    "params": {
        ...<snip>...
        "inductionTimeExcludedSolids": [
            "ARAGONITEPPT",
            "BACO3PPT",
            "BASO4PPT",
            ...<snip>...
        ]
    }
}
```

#### Standard conditions

Standard conditions can be specified to calculate the optional property **params.optionalProperties.volumeStdConditions**.&#x20;

```javascript
{
    "params": {
        ...<snip>...
        "standardConditions": [
            {
                "phase": "oil",
                "temperature": {
                    "unit": "°C",
                    "value": 15.5556
                },
                "pressure": {
                    "unit": "atm",
                    "value": 1.0
                }
            },
            {
                "phase": "gas",
                ...<snip>...
            },
            {
                "phase": "aqueous",
                ...<snip>...
            }
        ]
    }
}
```

| params.standardConditions\[i] | type                                                                       | description                                          |
| ----------------------------- | -------------------------------------------------------------------------- | ---------------------------------------------------- |
| phase                         | string                                                                     | name of the phase, which can be oil, aqueous, or gas |
| temperature                   | [valueObject](https://devdocs.olisystems.com/terms-definition#valueobject) | standard condition temperature                       |
| pressure                      | [valueObject](https://devdocs.olisystems.com/terms-definition#valueobject) | standard condition temperature                       |

| phase   | default temperature in °C | default pressure in atm |
| ------- | ------------------------- | ----------------------- |
| oil     | 15.5556                   | 1.0                     |
| gas     | 16.8500                   | 1.48038                 |
| aqueous | 25.0                      | 1.0                     |

### Output units&#x20;

Users can optionally specify units of the output values in the [Stream output](https://devdocs.olisystems.com/stream-output-json). More details are explained in [User-defined output unit set](https://devdocs.olisystems.com/user-defined-output-unit-set).&#x20;

{% hint style="info" %}
**params.unitSetInfo** is optional. OLIEngine default units will be used if this object is not specified.&#x20;
{% endhint %}

### Molecular conversion

There are two types of [speciation information](https://devdocs.olisystems.com/stream-output-json#speciation-information) in the [stream output](https://devdocs.olisystems.com/stream-output-json): true concentration and molecular concentration. While the true concentration reflects the speciation of the real species which is unique, the molecular concentration is one of many representations for the true species in molecular/inflow forms. Users have the option to specify three weighting methods for this molecular conversion:

```json
{
    "params": {
        ...<snip>...
        "molecularConversion": {
            "option": "userSpecified",
            "weightFactors": {
                "NAOH": 50.0,
                "CACO3": 10.0
            }
        }
    }    
}
```

| molecularConversion.option | description                                      |
| -------------------------- | ------------------------------------------------ |
| automatic                  | no weightage preference                          |
| inflowRateBased            | weightage is proportional to input inflow values |
| userSpecified              | user-specified weight factors for any inflows    |

{% hint style="info" %}
**molecularConversion.weightFactors** object is only specified when **molecularConversion.option** is "userSpecified". The weight factor of each inflow is specified as **"inflow\_name": number**, in the range from 0.0 to 100.0
{% endhint %}

{% hint style="info" %}
**params.molecularConversion** object is optional. By default, "inflowRateBased" option is used.
{% endhint %}

### JSON input (sample)

Below is the sample JSON input covering all three options using [isothermal flash](https://devdocs.olisystems.com/group1/api-functions/isothermal) as an example.

```javascript
{
    "method": "oliengine.isothermalFlash",
    "params": {
        "temperature": {
            "value": 40.0,
            "unit": "°C"
        },
        "pressure": {
            "value": 1.5,
            "unit": "atm"
        },
        "inflows": {
            "unit": "mol",
            "values": {
                "H2O": 50.0,
                "BENZENE": 10.0,
                "CH4": 20.0,
                "NAOH": 35.0
            },
            "totalAmount":
            {
                "value": 3402.68,
                "unit": "g"
            }
        },
        "excludedSolids": [
            "NAOH.2H2O",
            "NAOH.4H2O"
        ],
        "optionalProperties": {
            "electricalConductivity": true,
            "viscosity": true,
            "selfDiffusivity": true,
            "heatCapacity": true,
            "thermalConductivity": true,
            "surfaceTension": true,
            "interfacialTension": true,
            "prescalingTendencies": true
        },
        "unitSetInfo": {
            "inflows": "mol",
            "total": "g",
            "liq1_phs_comp": "mol/mol",
            ...<snip>...
            "hardness": "mg/L of Mg+2 and Ca+2",
            "tic": "mol C/L"
        }
}
```
