Skip to content

Commit

Permalink
Improve calculator doc and move into folder Calculated Data
Browse files Browse the repository at this point in the history
  • Loading branch information
magnesj committed Dec 12, 2022
1 parent 6f19ca5 commit 9cf6b84
Show file tree
Hide file tree
Showing 6 changed files with 88 additions and 35 deletions.
Original file line number Diff line number Diff line change
@@ -1,30 +1,45 @@
+++
title = "Curve Calculator"
title = "Calculator Expressions"
published = true
weight = 60
weight = 10
+++

![]({{< relref "" >}}images/plot-window/SummaryCurveCalculator.png)
![]({{< relref "" >}}images/calculated-data/calculator-text-expression.png)

The summary curve calculator is a tool to do relative simple vector calculations on a set of curves. The created curves can be stored for later use in the project.

The calculator can be run by pressing the calculator icon {{< image-in-text src="images/Calculator.svg" >}} in the menu bar, or by right-clicking on either a summary case or the summary plot collection.
Two similar calculators use expressions, summary curve calculator and grid cell calculator. These two variants share the text parsing for calculator expressions.

## Calculation Settings
To make a new calculated curve, click on **New Calculation**. This will add a new calculation to **Calculated Summaries**. Before choosing which curves to do calculations on, a calculation expression must be made. The default expression *Calculation_1 := x + y* will do a vector addition on the curves which *x* and *y* are placeholders for, and assign it to the calculation *Calculation_1*.
[Grid Property Calculator]({{< ref "GridPropertyCalculator.md" >}})

To assign a summary address to a variable, select a summary vector in **Data Sources**, and drag/drop this vector into the address field in the **Curve Calculator**. Further details on variable assignment is covered in section [Summary Address Selection](#summary-address-selection).
[Summary Curve Calculator]({{< ref "CurveCalculator.md" >}})

### Operators and Functions
Possible operations and functions are found by right-clicking in the expression window. The following tables show all the options available.
ResInsight supports a subset of the features supported in the **exprtk** parsing library. Scripting features like for/while loops are not supported. The full documentation for the expression parser is available at [C++ Mathematical Expression Toolkit Library](https://github.com/ArashPartow/exprtk)

#### Assignment Operators
## Operators and Functions
Possible operations and functions are found by right-clicking in the expression window.

### Comment lines

Create a comment line by prefixing with `//` or `##`

```
// Valid comment line 2
## Valid comment line 1
```


### Assignment Operators

| OPERATOR | DEFINITION |
|----------|-----------------------|
| := | Assign |
| := | Assignment |

#### Basic Operators
```
## Example
MY_VARIABLE := b + c
```

### Basic Operators

| OPERATOR | DEFINITION |
|----------|-----------------|
Expand All @@ -35,7 +50,21 @@ Possible operations and functions are found by right-clicking in the expression
| % | Modulus |
| ^ | Power |

#### Scalar Functions
```
## Example
a := (b * c) + d / 10.5
```

### Conditionals

**if-then-else** statements can be used to assign values based on the individual values in a vector. The following case will assign 0.01 if the **TRANX** is below 0.01, else copy the original **TRANX** value.

```
## Example
NEW_TRANX := if((TRANX < 0.01), 0.01, TRANX)
```

### Scalar Functions

| FUNCTION | DEFINITION |
|----------|-------------|
Expand All @@ -44,7 +73,12 @@ Possible operations and functions are found by right-clicking in the expression
| min | Minimum |
| sum | Sum |

#### Trigonometry Functions
```
## Example: Use the accumulated sum for all PORV values to compute the normalized PORV
NORMALIZED_PORV := x/sum(PORV)
```

### Trigonometry Functions

| FUNCTION | DEFINITION |
|----------|-----------------------------------------|
Expand All @@ -69,7 +103,7 @@ Possible operations and functions are found by right-clicking in the expression
| tan | Tangent |
| tanh | Hyperbolic tangent |

#### Vector Functions
### Vector Functions

| FUNCTION | DEFINITION |
|----------|---------------------------------------------------------|
Expand All @@ -85,18 +119,3 @@ Possible operations and functions are found by right-clicking in the expression
| sqrt | Square root |
| trunc | Integer portion of input |

### Unit
It is possible to add a unit to the calculated curve, in the field **Unit** beneath the expression field. This will be used as the label on the y-axis when the curve is used in a plot.

## Summary Address Selection
An expression consists of placeholders (variables) for curves (summary address). By clicking **Parse Expression**, the variables will appear in the table below the settings. To assign a summary address to a variable, select a summary vector in **Data Sources**, and drag/drop this vector into the address field in the **Curve Calculator**.

It is also possible to select the address by pressing the **Edit** button. This action will open a **Summary Address Selection** dialog. Use the dialog to select a summary address and press **OK**.

## Generating Curves
After assigning summary addresses to all variables, click **Calculate** to evaluate the expression. The curve is saved and can be accessed in the Plot Editor selecting the Summary Type: **Calculated**.

The curves can also be found in an existing curve's **Property Editor**. Choose the case **Calculated**, and the curves will appear in **Vector Selection**.


The similar concept is also used for [Grid Property Calculator]({{< ref "GridPropertyCalculator.md" >}})
34 changes: 34 additions & 0 deletions content/Calculated Data/CurveCalculator.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
+++
title = "Curve Calculator"
published = true
weight = 20
+++

![]({{< relref "" >}}images/plot-window/SummaryCurveCalculator.png)

The summary curve calculator is a tool to do relative simple vector calculations on a set of curves. The created curves can be stored for later use in the project.

The calculator can be run by pressing the calculator icon {{< image-in-text src="images/Calculator.svg" >}} in the menu bar, or by right-clicking on either a summary case or the summary plot collection.

More details on mathematical operations are described in [Calculator Expressions]({{< ref "CalculatorExpressions.md" >}})

## Calculation Settings
To make a new calculated curve, click on **New Calculation**. This will add a new calculation to **Calculated Summaries**. Before choosing which curves to do calculations on, a calculation expression must be made. The default expression *Calculation_1 := x + y* will do a vector addition on the curves which *x* and *y* are placeholders for, and assign it to the calculation *Calculation_1*.

To assign a summary address to a variable, select a summary vector in **Data Sources**, and drag/drop this vector into the address field in the **Curve Calculator**. Further details on variable assignment is covered in section [Summary Address Selection](#summary-address-selection).

### Unit
It is possible to add a unit to the calculated curve, in the field **Unit** beneath the expression field. This will be used as the label on the y-axis when the curve is used in a plot.

## Summary Address Selection
An expression consists of placeholders (variables) for curves (summary address). By clicking **Parse Expression**, the variables will appear in the table below the settings. To assign a summary address to a variable, select a summary vector in **Data Sources**, and drag/drop this vector into the address field in the **Curve Calculator**.

It is also possible to select the address by pressing the **Edit** button. This action will open a **Summary Address Selection** dialog. Use the dialog to select a summary address and press **OK**.

## Generating Curves
After assigning summary addresses to all variables, click **Calculate** to evaluate the expression. The curve is saved and can be accessed in the Plot Editor selecting the Summary Type: **Calculated**.

The curves can also be found in an existing curve's **Property Editor**. Choose the case **Calculated**, and the curves will appear in **Vector Selection**.


The similar concept is also used for [Grid Property Calculator]({{< ref "GridPropertyCalculator.md" >}})
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
+++
title = "Derived Results - Eclipse"
published = true
weight = 160
weight = 100
hidden = false
+++

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
+++
title = "Derived Results - Geomechanical"
published = true
weight = 161
weight = 110
hidden = false
+++

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
+++
title = "Grid Property Calculator"
published = true
weight = 105
weight = 30
+++

![]({{< relref "" >}}images/3d-main-window/GridPropertyCalculatorMain.png)

ResInsight offers a built-in property calculator for grid parameters.
The **Grid Property Calculator** enables arithmetic expressions to be parsed and calculated for visualization purposes.

More details on mathematical operations are described in [Curve Calculator]({{< ref "CurveCalculator.md" >}})
More details on mathematical operations are described in [Calculator Expressions]({{< ref "CalculatorExpressions.md" >}})

## Invoking the Grid Property Calculator

Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 9cf6b84

Please sign in to comment.