Introducing User-Defined Calculations

We are really excited to unveil user-defined calculations with flotools version 1.3. This has been a long time in the making and we are thrilled to be finally sharing this power-user feature with our users. We are really looking forward to questions and feedback on this new feature to help guide future development. This post along with my detailed walk-through videos should get you on your way.

Overview

The idea of calculations within flotools is not new. Right from the beta version, flotools has included automatic calculated variables. For example, if you had ROG and GG in your output, flotools would automatically calculate QG for you. This would appear as QG* in your variable list to indicate that the values are calculated by flotools and not from the output file.

User-defined calculations is a feature that makes this idea available to the user. In other words, you can derive new quantities by combining existing quantities. Existing quantities include outputs from your files as well as other calculated quantities, be it one of flotools’ built-in calculations or your own.

Vector Mathematics

Since we deal mostly with trends and profile quantities in flotools (i.e., multi-dimensional array of numbers) almost all calculations require looping over the individual values in those arrays. This is what makes performing calculations with trends and profiles very cumbersome (in some cases impossible) in Excel. flotools uses a concept called vector mathematics to simplify your life. To add two profiles, simply use the + operator. The looping is done automatically by the calculation engine. If you just want to add one number to each entry in a profile, no problem – use the + operator again. The calculation engine is smart enough to know when mixed types are allowed and how to treat them. Look at this very simple definition to calculate the trend of a mud volume in a pipeline given the profile of mud holdup (HOLHLMUD) in a simulation.

Simple formula to calculate volume of mud in pipeline
Simple formula to calculate volume of mud in pipeline

In one simple formula, we calculate a trend from two profiles. Note that the AREA profile does not vary with time but HOLHLMUD does. The vector math engine does the right thing – it multiplies each time slice of HOLHLMUD by the same AREA profile. Then the INTEGRATE function integrates the resulting quantity over the distance of the pipeline thereby producing a trend. Try that in Excel!

Context-aware and Units-aware engine

In the example of mud volume above, how does flotools match the holdup variable to the corresponding branch’s area variable? That’s the handy work of flotools’ smart calculation “realizer” code. Not only does this code match up the right combinations of variables to use in calculations, it also then calculates the correct attributes of the resulting calculated variables.

Another challenge with performing calculations in Excel is dealing with incompatibilities in unit sets. Imagine having to multiply pressure by area when pressure is output in psig and area is in sq. ft. flotools eliminates the need to worry about such things, always making sure that mathematical operations are carried out in consistent unit sets. What’s more, flotools even tries to automatically figure out the units for resulting variables. If there are more than one unit type that match the physical dimensions of the resultant quantity, you can guide flotools on the correct unit type.

Powerful functions

We have shipped this first version of user-defined calculations with a powerful set of functions: integration, calculating average/max/min values, converting profiles at section boundaries to section mid-points and vice versa, to name a few. These functions enable you to define complex new variables with succinct expressions, thereby taking the guesswork out of reading through macros or complicated Excel formulae. There’s even a lookup function that lets you calculate hydrate proximity using many different hydrate curves for the same simulation.

Screenshot of DTHYD calculated using multiple hydrate curves in flotools
DTHYD calculated using multiple hydrate curves in flotools

If you are not a current flotools user, click here to visit our product page to learn more and contact us.