# Isochoric flash

This function calculates the mixture temperature or pressure at a fixed total volume.

## isochoric

<mark style="color:green;">`POST`</mark> `https://api.olisystems.com/engine/flash/{dbs_file_id}/isochoric`

run an isochoric calculation by varying temperature or pressure

#### Headers

| Name          | Type   | Description            |
| ------------- | ------ | ---------------------- |
| Authorization | string | Bearer {access\_token} |
| Content-Type  | string | application/json       |

{% tabs %}
{% tab title="200 Please look at "API call blueprint" page on how to obtain results" %}

```
{
	"code": 200,
	"data": {
		"file_id": "dee854a6-59db-487d-ad08-a20dee691133",
		"jobId": "f6b3375e-cd0f-4ace-a5ee-71e047b76754",
		"resultsLink": "https://devapi.olisystems.com/result/flash/f6b3375e-cd0f-4ace-a5ee-71e047b76754?context=engine",
		"status": "IN PROGRESS"
	},
	"message": "Process execution started Successfully",
	"status": "SUCCESS"
}
```

{% endtab %}
{% endtabs %}

### Request payload

```javascript
{
    "params": {
        "temperature": {
            "value": 30.0,
            "unit": "°C"
        },
        "pressure": {
            "value": 1.5,
            "unit": "atm"
        },
        "totalVolume": {
            "value": 0.4,
            "unit": "m3"
        },
        "calculatedVariable": "pressure",
        "inflows": {
            "unit": "mol",
            "values": {
                "H2O": 50.0,
                "CO2": 10.0,
                "NACL": 20.0,
                "BENZENE": 10.0
            }
        }
    }
}
```

| **params**         | type                                                           | description                                                                                             |
| ------------------ | -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
| temperature        | [valueObject](https://devdocs.olisystems.com/terms-definition) | specified or initial guess temperature with [unit](https://devdocs.olisystems.com/input-unit-set)       |
| pressure           | [valueObject](https://devdocs.olisystems.com/terms-definition) | specified or initial guess pressure with [unit](https://devdocs.olisystems.com/input-unit-set)          |
| totalVolume        | [valueObject](https://devdocs.olisystems.com/terms-definition) | specified total volume with [unit](https://devdocs.olisystems.com/input-unit-set)                       |
| calculatedVariable | string                                                         | variable to be calculated, i.e. "temperature" or "pressure"                                             |
| inflows            | object                                                         | specified inflow species composition, see [Inflows Input](https://devdocs.olisystems.com/inflows-input) |

{% hint style="info" %}
in addition to the inputs shown above some optional properties may also be specified. They can be viewed [here](https://devdocs.olisystems.com/optional-inputs)
{% endhint %}

### Response (status = PROCESSED)

{% tabs %}
{% tab title="temperature" %}

```javascript
{
    "code": 200,
    "data": {
        "result": {
            "calculatedVariables": [
                {
                    "name": "temperature",
                    "unit": "°C",
                    "value": 65.35602277638554
                }
            ],
            ...<snip>...
        }
    }, 
    "message": "Results returned successfully", 
    "status": "PROCESSED"
}
```

{% endtab %}

{% tab title="pressure" %}

```javascript
{
    "code": 200,
    "data": {
        "result": {
            "calculatedVariables": [
                {
                    "name": "pressure",
                    "unit": "atm",
                    "value": 0.8025085833327293
                }
            ],
            ...<snip>...
        }
    }, 
    "message": "Results returned successfully", 
    "status": "PROCESSED"
}
```

{% endtab %}
{% endtabs %}

The output of this calculation is the [**stream output** ](https://devdocs.olisystems.com/stream-output-json)which is common result output for all OLI's flash calculations or an [error](https://devdocs.olisystems.com/error-output). In addition to this output the result also contains the solution temperature/pressure which can be conveniently retrieved from the **data.result.calculatedVariables** array&#x20;

| data.result.calculatedVariables [\[ { } \]](https://devdocs.olisystems.com/terms-definition) | type   | description                                                                                                                                                |
| -------------------------------------------------------------------------------------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
| name                                                                                         | string | name of the calculated variable, i.e. temperature or pressure as specified in input **params.calculatedVariable**                                          |
| value                                                                                        | number | value of the calculated variable                                                                                                                           |
| unit                                                                                         | string | unit of the calculated variable, which is the same as specified in the input initial guess, i.e. **params.temperature.unit/params.pressure.unit** in input |

### Survey Calculation

Survey calculation is supported for the variables below. Please refer to [Survey calculation](https://devdocs.olisystems.com/survey-calculation) for explained input schema.

| supported **params.surveyInputs\[{}].field** |
| -------------------------------------------- |
| "/params/temperature/value"                  |
| "/params/pressure/value"                     |
| "/params/totalVolume/value"                  |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://devdocs.olisystems.com/group1/api-functions/isochoric.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
