User Programming PetroWorks
User Programming PetroWorks
2010 Halliburton
Release 5000.0.1
November 2010
2010 Halliburton
All Rights Reserved
This publication has been provided pursuant to an agreement containing restrictions on its use. The publication is also protected by
Federal copyright law. No part of this publication may be copied or distributed, transmitted, transcribed, stored in a retrieval system,
or translated into any human or computer language, in any form or by any means, electronic, magnetic, manual, or otherwise, or
disclosed to third parties without the express written permission of:
Halliburton | Landmark Software & Services
2107 CityWest Blvd, Building 2, Houston, Texas 77042-3051, USA
P.O. Box 42806, Houston, Texas 77242, USA
Phone:713-839-2000, FAX: 713-839-2015
Internet: www.halliburton.com/landmark
Trademarks
3D Drill View, 3D Drill View KM, 3D Surveillance, 3DFS, 3DView, Active Field Surveillance, Active Reservoir Surveillance, Adaptive Mesh
Refining, ADC, Advanced Data Transfer, Analysis Model Layering, ARIES, ARIES DecisionSuite, Asset Data Mining, Asset Decision Solutions,
Asset Development Center, Asset Development Centre, Asset Journal, Asset Performance, AssetConnect, AssetConnect Enterprise, AssetConnect
Enterprise Express, AssetConnect Expert, AssetDirector, AssetJournal, AssetLink, AssetLink Advisor, AssetLink Director, AssetLink Observer,
AssetObserver, AssetObserver Advisor, AssetOptimizer, AssetPlanner, AssetPredictor, AssetSolver, AssetSolver Online, AssetView, AssetView
2D, AssetView 3D, BLITZPAK, CasingLife, CasingSeat, CDS Connect, Channel Trim, COMPASS, Contract Generation, Corporate Data Archiver,
Corporate Data Store, Data Analyzer, DataManager, DataStar, DBPlot, Decision Management System, DecisionSpace, DecisionSpace 3D Drill
View, DecisionSpace 3D Drill View KM, DecisionSpace AssetLink, DecisionSpace AssetPlanner, DecisionSpace AssetSolver, DecisionSpace
Atomic Meshing, DecisionSpace Desktop, DecisionSpace Nexus, DecisionSpace Reservoir, DecisionSuite, Deeper Knowledge. Broader
Understanding., Depth Team, Depth Team Explorer, Depth Team Express, Depth Team Extreme, Depth Team Interpreter, DepthTeam, DepthTeam
Explorer, DepthTeam Express, DepthTeam Extreme, DepthTeam Interpreter, Design, Desktop Navigator, DESKTOP-PVT, DESKTOP-VIP, DEX,
DIMS, Discovery, Discovery 3D, Discovery Asset, Discovery Framebuilder, Discovery PowerStation, DMS, Drillability Suite, Drilling Desktop,
DrillModel, Drill-to-the-Earth-Model, Drillworks, Drillworks ConnectML, DSS, Dynamic GeoModeling, Dynamic Reservoir Management,
Dynamic Surveillance System, EarthCube, EDM, EDM AutoSync, EDT, eLandmark, Engineer's Data Model, Engineer's Desktop, Engineer's Link,
ESP, Event Similarity Prediction, ezFault, ezModel, ezSurface, ezTracker, ezTracker2D, FastTrack, Field Scenario Planner, FieldPlan, For
Production, FrameBuilder, FZAP!, GeoAtlas, GeoDataLoad, GeoGraphix, GeoGraphix Exploration System, GeoLink, Geometric Kernel,
GeoProbe, GeoProbe GF DataServer, GeoSmith, GES, GES97, GESXplorer, GMAplus, GMI Imager, Grid3D, GRIDGENR, H. Clean, Handheld
Field Operator, HHFO, High Science Simplified, Horizon Generation, I2 Enterprise, iDIMS, Infrastructure, Iso Core, IsoMap, iWellFile,
KnowledgeSource, Landmark (as a service), Landmark (as software), Landmark Decision Center, Landmark Logo and Design, Landscape, Large
Model, Lattix, LeaseMap, LithoTect, LogEdit, LogM, LogPrep, Magic Earth, Make Great Decisions, MathPack, MDS Connect, MicroTopology,
MIMIC, MIMIC+, Model Builder, NETool, Nexus (as a service), Nexus (as software), Nexus View, Object MP, OpenBooks, OpenJournal,
OpenSGM, OpenVision, OpenWells, OpenWire, OpenWire Client, OpenWire Server, OpenWorks, OpenWorks Development Kit, OpenWorks
Production, OpenWorks Well File, PAL, Parallel-VIP, Parametric Modeling, PetroBank, PetroBank Explorer, PetroBank Master Data Store,
PetroStor, PetroWorks, PetroWorks Asset, PetroWorks Pro, PetroWorks ULTRA, PlotView, Point Gridding Plus, Pointing
Dispatcher, PostStack, PostStack ESP, PostStack Family, Power Interpretation, PowerCalculator, PowerExplorer, PowerExplorer Connect,
PowerGrid, PowerHub, PowerModel, PowerView, PrecisionTarget, Presgraf, PressWorks, PRIZM, Production, Production Asset Manager,
PROFILE, Project Administrator, ProMAGIC, ProMAGIC Connect, ProMAGIC Server, ProMAX, ProMAX 2D, ProMax 3D, ProMAX 3DPSDM,
ProMAX 4D, ProMAX Family, ProMAX MVA, ProMAX VSP, pSTAx, Query Builder, Quick, Quick+, QUICKDIF, Quickwell, Quickwell+,
Quiklog, QUIKRAY, QUIKSHOT, QUIKVSP, RAVE, RAYMAP, RAYMAP+, Real Freedom, Real Time Asset Management Center, Real Time
Decision Center, Real Time Operations Center, Real Time Production Surveillance, Real Time Surveillance, Real-time View, Reference Data
Manager, Reservoir, Reservoir Framework Builder, RESev, ResMap, RTOC, SCAN, SeisCube, SeisMap, SeisModel, SeisSpace, SeisVision,
SeisWell, SeisWorks, SeisWorks 2D, SeisWorks 3D, SeisWorks PowerCalculator, SeisWorks PowerJournal, SeisWorks PowerSection, SeisWorks
PowerView, SeisXchange, Semblance Computation and Analysis, Sierra Family, SigmaView, SimConnect, SimConvert, SimDataStudio,
SimResults, SimResults+, SimResults+3D, SIVA+, SLAM, SmartFlow, smartSECTION, smartSTRAT, Spatializer, SpecDecomp, StrataAmp,
StrataMap, StrataModel, StrataSim, StratWorks, StratWorks 3D, StreamCalc, StressCheck, STRUCT, Structure Cube, Surf & Connect, SurfNet,
SynTool, System Start for Servers, SystemStart, SystemStart for Clients, SystemStart for Servers, SystemStart for Storage, Tanks & Tubes, TDQ,
Team Workspace, TERAS, T-Grid, The Engineer's DeskTop, Total Drilling Performance, TOW/cs, TOW/cs Revenue Interface, TracPlanner,
TracPlanner Xpress, Trend Form Gridding, Trimmed Grid, Turbo Synthetics, Unconventional Essentials, VESPA, VESPA+, VIP, VIP-COMP,
VIP-CORE, VIPDataStudio, VIP-DUAL, VIP-ENCORE, VIP-EXECUTIVE, VIP-Local Grid Refinement, VIP-THERM, WavX, Web Editor, Well
Cost, Well H. Clean, Well Seismic Fusion, Wellbase, Wellbore Planner, Wellbore Planner Connect, WELLCAT, WellDirect, WELLPLAN,
WellSolver, WellXchange, WOW, Xsection, You're in Control. Experience the difference, ZAP!, and Z-MAP Plus are trademarks, registered
trademarks, or service marks of Halliburton.
All other trademarks, service marks, and product or service names are the trademarks or names of their respective owners.
Note
The information contained in this document is subject to change without notice and should not be construed as a commitment by
Halliburton. Halliburton assumes no responsibility for any error that may appear in this manual. Some states or jurisdictions do not
allow disclaimer of expressed or implied warranties in certain transactions; therefore, this statement may not apply to you.
$PWHOME/docs /Third_Party.pdf
Disclaimer
The programs and documentation may provide links to external web sites and access to content, products, and services from third
parties. Halliburton is not responsible for the availability of, or any content provided on, third party web sites. You bear all risks
associated with the use of such content. If you choose to purchase any products or services from a third party, the relationship is
directly between you and the third party. Halliburton is not responsible for: (a) the quality of third party products or services; or (b)
fulfilling any of the terms of the agreement with the third party, including delivery of products or services and warranty obligations
related to purchased products or services. Halliburton is not responsible for any loss or damage of any sort that you may incur from
dealing with any third party.
Contents
Contents
iii
mb_obj .................................................................................................. 36
mb_pppdf ............................................................................................. 36
mb_src .................................................................................................. 37
How Model Builder Software Uses the .mdl File ................................ 44
Creating and Editing the .mdl File ........................................................... 44
General Rules ............................................................................................ 45
The .mdl Reserved Variable Names and Features ................................. 48
Processing Flags ...................................................................................... 58
Flags for Checking .............................................................................. 58
Flags to Be Set by Model .................................................................... 59
Defining Processing Criteria.................................................................... 61
Criteria for Automatic Determination of Model Processing ............ 61
Model Controls of Processing Criteria .............................................. 61
Input Working Sample Framework .......................................................... 66
User-Specified Reference Curve ........................................................ 67
Model Fixed Reference Curve ............................................................ 68
Model Variables in .mdl Code............................................................. 69
Runtime Curve Reselection ..................................................................... 69
Curve Attributes................................................................................... 69
Multi-valued (Multi-dimensional) Curve Data ......................................... 71
Parameter Data.......................................................................................... 76
Parameter Key Rules........................................................................... 76
.mdl File ................................................................................................ 77
Processing Interval.............................................................................. 77
Output Curves...................................................................................... 77
Release 5000.0.1
Contents
iv
General Rules....................................................................................... 79
.mds File Keywords and Delimiters ................................................... 80
Source Files............................................................................................... 82
Compile Button .................................................................................... 83
Build Library Button ............................................................................ 83
Object Files................................................................................................ 84
Libraries ..................................................................................................... 85
Compiler Switches .................................................................................... 86
Debugging Your Model ....................................................................... 86
Information ................................................................................................ 89
Vertical Curve Gradient .......................................................................... 105
Gradient .mds File ............................................................................. 105
Gradient .mdl File .............................................................................. 106
Three-Point Filter with User Weights .................................................... 108
Filter3Pt .mds File.............................................................................. 108
Filter3Pt .mdl File............................................................................... 109
Check Processing Flags..........................................................................110
Check Any Depth Flag .mds File .......................................................110
Check Any Depth Flag .mdl File ........................................................110
Reconfiguring Curve Selection During Runtime...................................112
Checking Curve Reconfiguration Flags .mds File...........................112
Checking Curve Reconfiguration Flags .mdl File............................112
Create 2D Output Curve ..........................................................................114
Create 2D Log .mds File.....................................................................114
Create 2D Log .mdl File......................................................................114
Release 5000.0.1
Contents
Contents
vi
Contents
vii
Contents
viii
Release 5000.0.1
Contents
ix
Release 5000.0.1
Contents
User Programming
Release 5000.0.1
11
User Programming
Release 5000.0.1
12
User Programming
Overview
Model Builder software allows you to design your own algorithmic
petrophysical model, a mathematical description of how you want to
manipulate the physical measurements taken from well curves. Then,
from your own specifications, Model Builder software builds an
executable PetroWorks application, that you and others can run to
analyze and interpret well log data.
Model Builders must know FORTRAN or C.
A working knowledge of FORTRAN 77 or C is essential for designing models with
Model Builder software. You should also be comfortable working within the
Unix operating system environment for the purposes of locating files and using the
GNU debugger.
Release 5000.0.1
13
User Programming
Important Features
Model Builder software creates interpretive applications that can
Release 5000.0.1
Overview
14
User Programming
Select to launch a
published model
Whether a model is run from the Model Builder menu or from the
User Models location, it runs like any other PetroWorks interpretive
application. As a model writer, you have control over the input and
output curves, depth framework, and parameters. Input and output
curve default names can be overwritten at runtime through the use of
Curve Aliases, Curve Names, or Curve Details with the Wellbore
Parameter Editor. As a model writer, you also determine the parameters
that users input, and you have the ability to specify default, maximum,
and minimum values.
Release 5000.0.1
Overview
15
User Programming
The model algorithm code (.mdl) file is the algorithm code file that
contains the FORTRAN and C calls.
The general workflow for building and running models is shown below.
Start
Build model
optional
Process model
End
Release 5000.0.1
Overview
16
User Programming
You can compose an .mdl in any text editor. You can also open an
existing .mdl file in any text editor, modify it, and save it as a different
.mdl for a new model. You can even copy long, complex algorithms
Release 5000.0.1
Overview
17
User Programming
Release 5000.0.1
Overview
18
User Programming
Sharing Models
When using Model Builder software, your role may depart from
traditional interpretive or analytical workflows typical of the rest of
PetroWorks. As a model writer, you become, whatever your other
duties, a software developer. Consequently, you are affected by issues
that may not be obvious to a geoscientist, such as the creation and
maintenance of source text files within your project workspace.
A project workspace is meant to be used as a private area where a
model writer can safely develop models. To minimize confusion and
inadvertent overwriting of model files, do not share your project
workspace with other model writers. No two writers can predictably
build the same model within a project workspace any more than two
people can share the same spreadsheet file on a PC.
It is strongly recommended that model writers agree to a policy for how
work is to be done within a central or master workspace where
accepted versions of common models may be built and copied.
Release 5000.0.1
Overview
19
User Programming
Release 5000.0.1
20
User Programming
Main
menu
fields
Release 5000.0.1
21
User Programming
Release 5000.0.1
22
User Programming
Release 5000.0.1
23
User Programming
Model field
Model
contents
field
Status area
Status Area
Model Builder software uses this area to keep you informed of the
status of each process.
Release 5000.0.1
24
User Programming
Getting Started
Before you begin using Model Builder software, you must select a
project from OpenWorks and specify an interpreter and well list
normally done by using the Project Status tool from the OpenWorks
Command Menu.
You must then create and save your source priority preferences from
the Session menu on the PetroWorks Command Menu. (Refer to
PetroWorks/LogEdit Basics on page 25 in the Introduction to
PetroWorks Family of Products manual.)
To begin working in Model Builder software, select Interpret >
Model Builder from the PetroWorks Command Menu.
Release 5000.0.1
1.
From the menu bar, select File > Create Model Group Directory.
The following screen appears:
2.
3.
Getting Started
25
User Programming
Click on the New button on the main window. The New Model
window appears.
Note that the Model Group Directory name appears above the new
model name field. If this is not the directory in which you wish to
create your new model, do the following:
1. Click on the Select button.
2. Select the proper directory.
3. Click on the Filter button.
4. Click on the OK button.
The correct model group directory name now appears in the
New Model window.
5.
Type the name of the new model. (Your models name must
contain at least 4 characters and no more than 13 characters.) In
the sample window above, we named our model GOLD.
6.
Release 5000.0.1
Getting Started
26
User Programming
7.
If you choose to use the template files, click on OK and skip the
next section (Copying an Existing Model on page 29).
8.
Below is a sample workflow for creating a new model and a new model
group directory:
Workflow to Create
a New Model and a
New Model Group
Directory
Select File Create Model Group Directory
and name the new directory.
Optional
Select any optional source files,
object files, or libraries you want to
use in your model.
Configure
Build
Errors?
Errors?
Yes
Debug
No
Run
Release 5000.0.1
Getting Started
27
User Programming
The diagram below shows a sample workflow for creating a new model
in an existing directory:
Workflow to Create
a New Model in an
Existing Directory
Optional
Is this
the Model Group
Directory you want to
work in?
No
Select a different group directory.
Filter
OK
Yes
Optional
Select any optional source files,
object files, or libraries you want
to use in your model.
Configure
Yes
Build
Errors?
Debug
No
Run
Release 5000.0.1
Getting Started
28
User Programming
1.
If you know the file and path name of the .mdl and .mds files you
want to use, you can type either one and click on OK. Both files
are copied into your workspace and given the model name you
chose.
2.
If you do not know the file and path name of the .mdl and .mds
files you want to copy, click on the Select button to browse.
3.
When you find the .mdl or .mds file you need, select it and click on
OK. Both files are copied into the .mdl and .mds files that appear
in the Model Contents Field (page 24) of the Model Builder
main window.
Copy command does not copy optional, associated source and
object files.
The copy feature does not copy optional source and object files associated with
existing .mdl and .mds files. To copy additional files, you must use a standard
Unix command, such as cp, from an xterm window.
Release 5000.0.1
Getting Started
29
User Programming
Optional
Optional
Select any optional source files,
object files, or libraries you want
to use in your model.
Configure
Build
Errors?
Yes
Debug
No
Run
Release 5000.0.1
Getting Started
30
User Programming
GOLD subdirectory
GOLD source files are in subdirectory src
src subdirectory
.mds file name = GOLD.mds
When copying an existing model, proceed from one screen to the next
using Filter. When you reach either the .mds or .mdl file, select it and
click on OK to copy it into your new model area. Both files are copied.
Release 5000.0.1
Getting Started
31
User Programming
Deleting a Model
1.
2.
3.
Release 5000.0.1
Getting Started
32
User Programming
4.
Select the Model Group Directory containing the model you wish
to delete. Press OK.
A list of available models appears in the Model List area.
Release 5000.0.1
5.
6.
Getting Started
33
User Programming
home/workerbee/cmolaro/Arctic/GOLD/src/GOLD.mdl
Your home directory
Model
Model Model
Directory Source
Group
Directory
Files
Directory
.mdl file
The diagram above shows the path to the .mdl file for the model GOLD
in the model group directory Arctic.
Protect Built Models
Once a model is built, you should protect the model files from being edited.
Automatic Files
When Model Builder software builds a model, it creates various
interdependent source and include files in FORTRAN and C as well as
necessary system files for compiling and linking. These are all stored in
this subdirectory (as shown in the following diagram).
Release 5000.0.1
34
User Programming
The diagram below illustrates the hierarchy of Model Buildergenerated subdirectories and files:
mb_html
SunOS
mb_include
bin***
mb_lib
See More About Files
on page 36 for a
description of these files.
.exe
Linux
mb_obj
.exe
mb_pppdf
mb_src
include
Model**
lib
obj
.mdl
src
.mds
* The name you give your model group directory appears here in the hierarchy.
**The name you give your model appears here in the hierarchy.
*** An executable is created for the platform on which you create your model. SunOs is the
platform for Solaris.
Release 5000.0.1
35
User Programming
mb_html
When you create a model, Model Builder software generates the
mb_html directory, which contains two files for each model. These
files, <modelname>.html and <modelname>_pl.html allow
you to open a page from your internet browser and view the .mdl and
.mds files as well as any information about the model that you entered
the via the Configure > Information feature of Model Builders main
menu.
mb_include
This directory is created by Model Builder software as a repository
for include files that you may want to share across multiple models.
You can write include files in FORTRAN or C.
mb_lib
This directory is created by Model Builder software as a repository
for library files that you may want to share across multiple models.
mb_obj
This directory is created by Model Builder software as a repository
for object files that you may want to share across multiple models.
mb_pppdf
This directory contains the petrophysical parameters definition files
created by Model Builder software when you build a model.
Release 5000.0.1
36
User Programming
mb_src
This directory is created by Model Builder software as a repository
for source files that you may want to share across multiple models.
Release 5000.0.1
37
User Programming
comment
algorithm
.mds file
data specification file
comment
38
User Programming
You will learn more about keywords in the section Editing the .mds
File on page 78.
When this model is built and run from the Model Builder main
window, a user interface identical to other PetroWorks applications is
generated. From the user interface, you can select wells and processing
depths or strat units, enter Wellbore Parameter Editor, and process your
Model Builder application. These processes are illustrated in the next
example.
The model PHID2RHOB converts density porosity to bulk density
when given the input parameters of matrix density and fluid density.
The FORTRAN file, PHID2RHOB.mdl, and its corresponding .mds
file, PHID2RHOB.mds, are shown below followed by the user
interface and corresponding Wellbore Parameter windows.
Release 5000.0.1
39
User Programming
Release 5000.0.1
40
User Programming
Note that more features are present in the PHID2RHOB .mds file than
in the GammaRays .mds file. Whereas the PHID2RHOB .mdl file
contains code familiar to a novice FORTRAN programmer, the .mds
file introduces the keywords unique to Model Builder software:
TITL
VERS
GRPN
CNST
After you have finished creating and editing these two files, you can
click on the Build and Run buttons from the Model Builder main
window. If there are no errors, Model Builder software builds an
application user interface with the name of your model such as the one
shown on the previous page. Clicking on the Model Builder Run
button causes the model interface to display; it does not process data.
To process data, you must use the Process button on the model
interface. The following diagram illustrates the workflow.
Enter
Model
Builder
Your Model
(user interface)
.mdl file
Edit
Parameters?
Select wells
Select depth units
Select processing depth intervals
or zones
Set processing direction
Process model
Process
Build
Select parameters
Select input and output curves
Save parameters
Run
Release 5000.0.1
41
User Programming
What is my goal? This may seem obvious, but there are at least
two reasons to specify the goal of your model in a somewhat
formal way:
to clarify it in your own mind as much as possible.
to communicate it to those who may use it after you have built
it (See the chapter User Models on page 198.)
2.
What is my input?
Where does it come from? Does it come from a log curve? If so,
is it in an alias list? (Refer to the chapter Curve Alais List
Managerin the PetroWorks/LogEdit Project Management
manual.) Do I have constants?
Are parameters shared or local? If parameters are shared, they
are visible to, and can be used by, other users.
What do I want the user to see in the Wellbore Parameter
Editor? You can control what the model user sees in the
Wellbore Parameter Editor with several keywords such as
LATT (log attributes) and CATT (curve attributes).
3.
What is my output?
What do I want to call it?
Do I want to write it out or use it in another calculation?
Does it need to be saved?
Release 5000.0.1
42
User Programming
4.
These questions and others are addressed in the next two sections,
Editing the .mdl File on page 44 and Editing the .mds File on
page 78. You should read and thoroughly understand these sections
before attempting to build a model.
Actual code entries always contain the CMNT keyword before the field
delimiter descriptions and the dashed lines, but in the examples we
these have been removed.
Pipe symbols (|) are field delimiters.
In the example here, the top line contains field descriptions: Option,
Type, Attribute, and Value. The main keyword, here
IFRAMEWORK, appears to the left of the of the table. The other entries,
here ALL, USER, REFERENCE, reference curve, and null, consist of
allowed values that are described in this chapter.
Release 5000.0.1
43
User Programming
After you have created a model group directory and a model, the model
name and path appear in the Model Contents field as previously
described. To edit the .mdl file, follow the instructions below:
Release 5000.0.1
44
User Programming
1.
Select File > Open Algorithm File (.mdl). The .mdl file shown
on the main Model Builder window opens in the NEDIT file
editor.
If this is a new model rather than a copy of an existing one (see
Copying an Existing Model on page 29), a file containing only
two lines of code opens:
3.
Use the general rules, below, to continue editing the .mdl file.
4.
When you are finished editing the .mdl file, select File Save.
General Rules
You must follow some specific rules when developing your .mdl file:
Release 5000.0.1
45
User Programming
In the .mdl file you can use virtually any legal FORTRAN syntax.
For example:
Separate include files may also be included
Named COMMON blocks
PARAMETERS (FORTRAN constants).
DATA statements
Release 5000.0.1
46
User Programming
Release 5000.0.1
47
User Programming
In the table, numbers in parentheses refer to pages where you can find
more information on or an example of the variable.
Release 5000.0.1
48
User Programming
Value/Type
Explanation
Model Can
Modify
General Information
MODEL_NAME (45)
character string
no
MD_TITLE (93)
character string
no
MD_MODELTYPE (76)
INTERP or
ACQUISITION
(see rows below)
no
INTERP
100
ACQUISITION
200
MD_UNIT_NAME
character string
no
MD_WELL_NAME
character string
no
MD_WELLBT
depth value
Bottom of well
no
MD_WELLTP
depth value
Top of well
no
Release 5000.0.1
49
User Programming
Value/Type
Explanation
Model Can
Modify
Processing Flags
MD_MDLINT (58)
TRUE or FALSE
no
MD_WELLINT (58)
TRUE or FALSE
no
MD_ZONINT (58)
TRUE or FALSE
MD_LSTMDL (58)
TRUE or FALSE
no
MD_LSTWELL (59)
TRUE or FALSE
no
MD_LSTZON (59)
TRUE or FALSE
MD_MDLEND (59)
TRUE or FALSE
yes
MD_WELLEND (63)
TRUE or FALSE
yes
MD_ZONEND (60)
TRUE or FALSE
yes
MD_MDLABORT (111)
TRUE or FALSE
yes
MD_DEPTH (63)
depth value
yes
MD_SETCUR_IN
TRUE or FALSE
yes
MD_XOTDEP (63)
depth value
yes
MD_SETCUR_OUT
TRUE or FALSE
yes
Depth Control
Release 5000.0.1
50
User Programming
Value/Type
Explanation
Model Can
Modify
depth value
MD_RESPONSE (93)
WEAK or
STRONG
(see rows below)
no
Constant used to determine that
incompatible, nonresampleable curves
within sample framework are
processed with warning message only
no
Constant used to determine that
incompatible, nonresampleable curves
within sample framework abort
processing at the current well
depth values
STRONG
MD_FRAME_INCREMENT (69)
Release 5000.0.1
no
51
User Programming
Value/Type
Explanation
Model Can
Modify
Processing Direction
no
MD_PROC_DIRECT
+1 or -1
(see below)
Processing
Direction
IS_DOWN
+1
IS_UP
-1
MD_PROC_UNIT
Measured
Depth
FEET
no
METERS
no
TRUE or FALSE
no
MD_NSMP (101)
numeric value
no
MD_NSMI (101)
numeric value
no
MD_NSMO (101)
numeric value
no
MD_INC_DEP_BY (102)
numeric value
no
MD_ISMO (102)
numeric value
no
MD_NEWPAS (62)
TRUE or FALSE
yes
numeric value
no
MD_DIRECT_FIXED
no
Multiple Sampling
Multiple Passes
Release 5000.0.1
52
User Programming
Value/Type
Explanation
Model Can
Modify
Curve Reconfiguration
MD_NEWSEL (112)
TRUE or FALSE
yes
MD_SETCUR_IN (62)
TRUE or FALSE
yes
MD_SETCUR_OUT
TRUE or FALSE
yes
MD_XLNUM
numeric value
no
MD_CURVE_NAME
character strings
no
MD_CURVE_INPUT_NAME
character strings
no
MD_CURVE_OUTPUT_NAME
character strings
no
MD_CURVE_IN_SELECTED
(69)
1 or 0
yes
MD_CURVE_OUT_SELECTED
(69)
1 or 0
yes
MD_CURVE_INCREMENT
depth values
yes
(for output logs
only)
MD_CURVE_SIZE
numeric value
yes
(for output logs
only)
Release 5000.0.1
53
User Programming
Value/Type
Explanation
Model Can
Modify
MD_CURVE_NUM_DIM
numeric value
no
MD_CURVE_2ND_NPOINTS
(74)
numeric value
yes
(for output logs
only)
MD_CURVE_MDS_2ND_NPOINTS
numeric value
no
MD_CURVE_DB_2ND_NPOINTS
numeric value
no
MD_CURVE_3RD_NPOINTS
(74)
numeric value
MD_CURVE_MDS_3RD_NPOINTS
numeric value
no
MD_CURVE_DB_3RD_NPOINTS
numeric value
no
Release 5000.0.1
54
User Programming
Value/Type
enumerated
strings
(see rows below)
Explanation
Array containing curve resampling
schemes. Accepted values are given
in rows below.
Model Can
Modify
yes
(for output logs
only)
no
SINGLE_POINT
no
STEP_FUNCTION_
TOP
no
STEP_FUNCTION_
BOTTOM
no
STEP_FUNCTION_
MIDPOINT
no
REQUIRED
no
OPTIONAL
no
MD_CURVE_OPT_REQ
R or O
(letter "oh")
no
MD_CURVE_FRAME_ID
numeric value
yes
(for output logs
only)
MD_CURVE_UNIT
character strings
no
Curve
CONTINUOUS_
Resampling FUNCTION
Scheme
Release 5000.0.1
55
User Programming
Value/Type
Explanation
Model Can
Modify
MD_CURVE_2ND_UNIT
character strings
no
MD_CURVE_3RD_UNIT
character strings
no
MD_NUMPAR
numeric value
no
CDX_ParameterMnemonic
(77)
numeric value
no
MD_PARNAM (77)
character strings
no
Parameter Information
-999.25
no
FILL
-999.25
no
NULL
-999.25
no
CANADIAN_METRIC
no
SPE_METRIC
no
US_OIL_FIELD
no
US_OIL_FIELD_METRIC
no
Measurement System
Release 5000.0.1
56
User Programming
Value/Type
Explanation
Model Can
Modify
no
TUNT2
no
TUNT3
no
character string
yes
Miscellaneous
CSTRNG
Release 5000.0.1
57
User Programming
Processing Flags
You can use logical flags to determine the processing state at a
particular point in your model or to change the processing state. There
are two types of flags:
Release 5000.0.1
58
User Programming
Total Depth
Beginning of Model:
MD_WELLINT = TRUE
1000 ft
Top Depth
MD_WELLINT=TRUE
MD_ZONINT=TRUE &
MD_LSTZON=FALSE
(All LST = FALSE)
A
At Depths Between
MD_WELLINT=FALSE
MD_LSTWELL=FALSE
At Depths Between
MD_WELLINT=FALSE
MD_LSTWELL=FALSE
MD_ZONINT=FALSE &
MD_LSTZON=TRUE
7000 ft
MD_WELLINT=TRUE
MD_ZONINT=TRUE
At Depths Between
MD_ZONINT=FALSE
MD_LSTZON=FALSE
8000 ft
9000 ft
9000 ft
Bottom Depth
MD_LSTZON=TRUE
MD_LSTWELL=TRUE
MD_ZONINT=TRUE &
MD_LSTZON=FALSE
8000 ft
9000 ft
At Depths Between
MD_WELLINT=FALSE
MD_LSTWELL=FALSE
MD_ZONINT=FALSE
MD_LSTZON=TRUE &
MD_LSTWEL=TRUE
Bottom Depth
MD_LSTWELL=TRUE
59
User Programming
Some of the reserved variable names used in the sample above have not
yet been discussed. To look up a reserved variable name and its
definition, refer to the table The .mdl Reserved Variable Names and
Features on page 48.
Release 5000.0.1
60
User Programming
If all input curves are resampleable, the model uses the curve with
the smallest increment as the reference curve
The actual processing interval depends on the set of input curves and
the user-selected type: Total Depth Range, Depth Interval, or Unit
Selection. The intervals top depth is the shallowest point of any input
curve. The bottom of the interval is the deepest point.
Release 5000.0.1
DEPTH_UOM=FEET
DEPTH_UOM=METERS
61
User Programming
RESPONSE=WEAK
Model reports incompatibility warning, but continues processing
(default).
RESPONSE=STRONG
Model reports incompatibility error and aborts processing well.
Multiple Passes
If you want your model to make multiple passes over a particular depth
interval (defined by total depth of the well, a specified top and bottom
depth, or by an interval previously defined as a strat unit), you must
include the following code:
MD_DEPTH =(whatever local variable you have used to save
initial zone depth)
MD_SETCUR_IN =.TRUE.
MD_NEWPAS =.TRUE.
IMPORTANT!
You must also add PASS=YES to the .mds file. See Editing the .mds File on
page 78.
Change Depths
A powerful feature of Model Builder software gives you control over
the depths from which data is retrieved and the depths to which data is
written. (Be sure to read How Model Builder Software Uses the
.mdl File on page 44 for basic information about depth control.)
Release 5000.0.1
62
User Programming
In the model, you can change the input depth (MD_DEPTH) and output
depth (MD_XOTDEP). (Note that each time you set MD_DEPTH, you
must also set a corresponding MD_SETCUR_IN=.TRUE.; each time
you set MD_XOTDEP, you must also set a corresponding
MD_SETCUR_OUT =.TRUE.) If the model only needs to process and
output data, you must set the current depth to ABSENT with the
command MD_DEPTH=ABSENT. The model then resets MD_DEPTH
automatically for the next iteration. You must set the depth to ABSENT
each time you want to suppress an input or an output. At the end of a
zone or the end of processing, it resets with MD_ZONEND=.TRUE.,
MD_WELLEND, and MD_MDLEND=.TRUE., respectively. The variable
names described in last three sections are all used when making
multiple passes and changing or controlling depth.
Release 5000.0.1
63
User Programming
Filtering
Most petrophysical applications process data at only one depth level at
a time. The simpler Model Builder applications do the same.
However, Model Builder software can read in and process log curves
over multiple depth levels, as in, for example, when vertically filtering
log curves. You can specify how many depth levels to read in at a time
by using the variable NSMI in the .mds file. For example, to read in
three depth levels at a time and to assign that value to a variable
(NumSamplesIn) used in the .mdl file, you type the following line in
your models .mds file:
NSMI| 3 | NumSamplesIn |
You can specify how many depth levels to write out by using the
variable NSMO in your .mds file. For example, even though you may
read in three samples, when you do a vertical filter operation, you only
Release 5000.0.1
64
User Programming
want to write out one sample. The following line in a .mds file writes a
single sample, as well as assigns that value to a variable
(NumSamplesOut) accessible in the .mdl file:
NSMO| 1 | NumSamplesOut |
Recall that the model user can specify the direction in which the model
processes data. Assume that the direction is set to Down, and you have
the following Depths and GR values:
Depth
Current Depth Level-->1000.0
1000.5
1001.0
1001.5
1002.0
1002.5
1003.0
1004.5
1005.0
GR
Output Index
75.2
82.5
65.2
55.6
45.8
34.2
29.9
21.1
19.6
| 1
| 2
| 3
As you can see, ISMO is set to a value of 2, and given the name
OutputIndex. If you examine the depths and log values above, you
will see why it has been given the value of 2: to write out a data value at
a depth corresponding to the middle depth of the three log values that
were read in.
Release 5000.0.1
65
User Programming
At the next depth level the application processes, the data in the
program would look like this:
Depth
1000.0
Current Depth Level-->1000.5
1001.0
1001.5
1002.0
1002.5
1003.0
1004.5
1005.0
GR
75.2
82.5
65.2
55.6
45.8
34.2
29.9
21.1
19.6
OutputIndex
| 1
| 2 <-- Depth we want to write out
| 3
The output value of the GR_FILTER writes out at a depth index offset
one element (2) from the current input depth element (1).
Release 5000.0.1
66
User Programming
The former is used to specify a default reference curve name for the
parameter; the latter leaves the parameter value undefined (NULL).
Release 5000.0.1
67
User Programming
The model writer may also choose to let users enter a depth increment
value as a parameter. The model writer controls this behavior with the
IFRAMEWORK .mds keyword, the USER framework type, and the
INCREMENT attribute. The model writer can supply a default
increment value for the parameter.
+------|------------+------------------------+
|Option| Type | Attribute | Value
|
+------|-------------------------------------+
IFRAMEWORK| ALL | USER | INCREMENT | parameter name
|
+------|-----------+-------------------------+
Release 5000.0.1
68
User Programming
MD_FRAME_INCREMENT(1)
Set to 0 if non-resampleable; or to a specific value. Note that you
must have an index for all frame variables even if there is only one
framework (input and output).
Curve Attributes
Curve attributes are specified in the .mds file with the LOGS keyword
entries as well as with LATT entries. The attributes from LOGS are:
Release 5000.0.1
Name
Input/Output type
Unit of Measure
Editing the .mdl File
69
User Programming
Release 5000.0.1
70
User Programming
Release 5000.0.1
71
User Programming
The following table lists curve types that can be processed by Model
Builder models. The example column shows how the curves are
referenced in the model code to designate a particular curve data
element. The indices are locally defined variables. For example,
(i, j, k), (M_INDEX, N_INDEX, Z_INDEX), or whatever the model
writer prefers. The table uses the following syntax: i = 1,n; j=1,m, and
k=1,z. Multi-sampling (multiple samples over a set of depths) is also
included.
Curve Types Processed by Model Builder Models
Data Type
Scalar curves
Size
1
Multi-sampling
z
Examples
Comments
gr
gr(k)
not applicable
RAMP(i)
Acoustic waveforms
m,n
z,m
wff1(i,j)
wffl(j,i,k)
wffl(i)
Dipmeter
m,n
z,m,n
dip(i,k)
Photographs (core,
SEM, outcrop,)
2,n
m,n
z,2,n
z,m,n
dip(j,i,k)
scd(i,k)
scd(j,i,k)
bmp(i,k)
bmp(j,i,k)
2,n
z,m,n
wtd(i,k)
wtd(j,i,k)
Release 5000.0.1
72
User Programming
Dimension Metrics
The attribute DIMENSION2 refers to the n-dimension, and
DIMENSION3, to the m-dimension. It is important to note that the
actual number of curve data values would be the number of points for
DIMENSION2 multiplied by the number of points for DIMENSION3.
The keyword entries below describe evenly spaced points on the
dimension axes.
For input 2D/3D curves, the only required.mds file keyword entry for
defining dimension metrics is NPOINTS (number of points).
+--------------|------------|--------|------+
| Curve Name
| Attribute | Type
| Value|
+--------------|------------|--------|------+
LATT|array name
| DIMENSION2 | NPOINTS| n
|
+--------------|------------|--------|------+
LATT|array name
| DIMENSION3 | NPOINTS| m
|
+---------------|------------|--------|-------+
Release 5000.0.1
73
User Programming
Dimension MetricsExplicit
You can dynamically redefine the number points on a specific
dimensions axis at the beginning of the model runs where the
maximum number of points for that specific dimension has been
specified in the .mds file. Define these values using the model variables
MD_CURVE_2ND_NPOINTS and MD_CURVE_3RD_NPOINTS.
UNITS is the unit of measure for the point values along the specific
dimension axis. For example, a semblance plot might have ms
(milliseconds) for DIMENSION2 axis and ft/s (feet per second) for
the DIMENSION3 axis.
+--------------|------------|--------|------+
| Curve Name
| Attribute | Type
| Value|
+--------------|------------|--------|------+
LATT|array name
| DIMENSION2 |DYNAMIC |
|
LATT|array name
| DIMENSION2 |UNITTYPE|time |
LATT|array name
| DIMENSION2 | UNIT
| ms
|
LATT|array name
| DIMENSION2 |NPOINTS | 512 |
LATT|array name
| DIMENSION3 |DYNAMIC |
|
LATT|array name
| DIMENSION3 |UNITTYPE|time |
LATT|array name
| DIMENSION3 | UNIT
| ft/s |
LATT|array name
| DIMENSION3 |NPOINTS | 512 |
+---------------|------------|--------|------+
Release 5000.0.1
74
User Programming
Initialize counter
if (MD_MDLINT) then
MD_CURVE_2ND_NPOINTS(LDX_LOG2X) = NINT(USER_DIM)
SET_CURVE_SECOND_NPTS(LDX_LOG2X,NINT(USER_DIM), IER)
MD_CURVE_2ND_NPOINTS(LDX_LOG2F) = NINT(USER_DIM)
SET_CURVE_SECOND_NPTS(LDX_LOG2F,NINT(USER_DIM), IER)
ENDIF
CHECK_SM = 0.0
LOG2X_1 = LOG2X(1)
C---- Set new value and increment counter
DO 10 J = 1,MD_CURVE_2ND_NPOINTS(LDX_LOG2F)
if (LOG2X(J).NE.ABSENT) THEN
Release 5000.0.1
75
10
User Programming
LOG2F(J) = LOG2X(J)
CHECK_SM = CHECK_SM + LOG2X(J)
ENDIF
CONTINUE
END
Parameter Data
Parameter Key Rules
Alternate set or sets of rules are required for interpretive and
acquisition models. These different rules determine which tabs appear
in Wellbore Parameter Editor.
The default type is an interpretive model. You can define an acquisition
model in the .mds file with the following syntax:
MODELTYPE=ACQUISITION
The rules to be used for retrieving parameters from the database are as
follows.
Interpretive
Curves:
projects
well
Parameters:
project
well
zone
zone/well
Process Selection:
model GUI
Acquisition
Release 5000.0.1
Curves:
project
well/service/run/pass
Parameters:
project
well/service/run/pass
Process Selection:
well/service/run/pass
Editing the .mdl File
76
User Programming
.mdl File
There is only one model variable array of interest when you program
the acquisition method for your model. These are the parameter names,
to be used in the model code for reporting purposes:
MD_PARNAM(CDX_parameter_name)
Array of parameter names passed from the database (1 MD_PARNUM)
CRX_parameter_name
Defines the index of the parameter_name in the array of names.
MD_PARNUM is the total number of parameters.
Processing Interval
The processing interval for an acquisition model is the intersection of
the input curves with details corresponding to the process control
values. If a required input curve is selected whose details are different
and does not intersect with the other curves, an error is reported and the
model aborts. If an optional input curve is selected whose details are
different and does not intersect with the other curves, a warning is
issued and the model continues. This is identical to the manner of
handling required versus optional curves in general.
Output Curves
If all acquisition input curves represent the same service, pass, and run,
then the output curves are considered a part of this set, and those details
are written to the output curve header. However, if the input curves
have mixed details, then the output curves are created as composite
curves.
Release 5000.0.1
77
User Programming
After you have created a model group directory and a new model, the
new model name and path appear in the Model Contents field as
described in Creating Your Model Workspace on page 25. To build a
new .mds file, follow the instructions below:
1.
Double-click on the .mds file and path name shown in the Model
Contents field to select the file.
2.
Select Tools > File Editor. The .mds template file opens.
Double-click on
the .mds file line
to select the file.
Release 5000.0.1
78
User Programming
4.
When you have finished editing this file, select File > Save.
General Rules
Model Builder software interprets the .mds file using keywords
separated by delimiters. Therefore, the physical file format is just as
critical in the .mds file as it is in the .mdl (FORTRAN) file. The
following are some general rules for creating an .mds file:
Release 5000.0.1
The .mds file must have a .mds extension and have a filename that
is the same as the .mdl filename.
Begin each line in the .mds file with a keyword. (See the
discussion of keywords below.)
Editing the .mds File
79
User Programming
Delimiter
Meaning
CATT (100)
CHKA (97)
CMNT (93)
no limiter
CNST (98)
Constants (Parameters)
CREF (99)
GRPN (97)
IFRAMEWORK (94)
ISMO (102)
LATT (95)
Curve attributes
LOGS (94)
Curves
NINC (102)
NSMI (101)
NSMO (101)
NSMP (101)
OPTNLIST (97)
PASS (103)
TITL (93)
Release 5000.0.1
80
User Programming
Release 5000.0.1
81
User Programming
Source Files
Source files are ASCII text files written in C or FORTRAN and are
compiled to create object files. You can create your own source files in
any text editor that can save files as ASCII text. Follow the instructions
below to choose a source file to include in your model.
Use only GNU compiled external library files.
When you link files from external FORTRAN libraries, those libraries must be
GNU FORTRAN compiled. Do not mix libraries built under GNU and other
FORTRAN compilers.
If you make changes to a source file, you can click on the Compile
button to make sure it compiles without error before you continue. (See
Compile Button on page 83.)
To choose a source file:
Release 5000.0.1
1.
Click on the Source Files tab in the Configure window. Any source
files that exist in your path appear in the window.
2.
3.
4.
5.
6.
Click on the Select button. The file or files you chose now appear
in the Model Contents window under Optional Source Files.
82
User Programming
Compile Button
The Compile button is located at the bottom of the Source Files tab
panel. To be sure that your source files compile,
1.
Select one or more source files from the Source Files tab panel.
2.
3.
4.
Release 5000.0.1
1.
In the Source Files tab panel, select the source files you wish to
combine.
2.
3.
4.
83
User Programming
Once you have built a library, it appears in the Libraries window. See
Libraries on page 85 for instructions on selecting a library.
Object Files
If you choose to include specific object files (compiled source files) in
your model, make your selection from the Object Files tab panel.
To choose an object file:
1.
2.
3.
4.
5.
OR
If you already know the directory path,
Release 5000.0.1
1.
2.
3.
4.
84
User Programming
Libraries
A library is a group of object files.
Link to external libraries only if the libraries are compiled GNU.
When you link files from external FORTRAN libraries, those libraries must be
GNU FORTRAN compiled. Do not mix libraries built under GNU and other
FORTRAN compilers.
To select a library:
1.
2.
3.
4.
5.
OR
If you already know the directory path,
Release 5000.0.1
1.
2.
3.
4.
85
User Programming
Compiler Switches
To configure the FORTRAN and C compiler switches:
1.
2.
3.
4.
Click on Close. The options you selected now appear on the main
window in the Model Contents field.manager.
5.
For a list of options that you can enter in the Additional Options
field, refer to the GNU Debugger documentation discussed in the
next section.
Release 5000.0.1
86
User Programming
To run your model using the GNU debugger, click on the Configure
button in the main Model Builder window, then choose the debug
options in the Compilers Switches tab to use the GNU g77 FORTRAN
debugger while your model is running. Then follow the instructions
below.
Release 5000.0.1
1.
In the main Model Builder window, select Tools > Gnu > Gnu
Debugger. The DDD: The Data Display Debugger window
appears.
2.
Select File > Open Program, then navigate to your models .exe
file and click on the Open button. The DDD: Run Program dialog
box appears.
87
User Programming
3.
4.
5.
6.
For help on using the GNU debugger, click on the Help button on
the menu bar at the top of the DDD GNU debugger main window.
Release 5000.0.1
88
User Programming
Information
To record information about the model you are writing as well as
contact information for any others who might copy or run your model,
1.
Release 5000.0.1
2.
3.
89
User Programming
2.
Release 5000.0.1
90
User Programming
3.
Your model window appears. If you have not yet selected a well,
you are prompted to do so before you can process the model.
Release 5000.0.1
91
User Programming
Release 5000.0.1
92
User Programming
Release 5000.0.1
93
User Programming
Release 5000.0.1
94
User Programming
CMNT Note: curve names ARE case-sensitive. However, the curve variable
CMNT names in Fortran are not. This means that you can specify a curve
CMNT "Log1" and the database will create a "Log1" which is different from
CMNT an existing curve "log1". However, because of the Fortran limitations,
CMNT you cannot specify two curves, "log1" and "Log1" in the same model.
CMNT
CMNT Field 2 - IO-INPUT/OUTPUT:
CMNT I/O type, can be I (input)or O (output).
CMNT
CMNT Note: If an input curve is required (i.e. not optional see OPTNLIST
CMNT below), and does not exist in the well, the program will abort.
CMNT
CMNT Field 3 - UNITS:
CMNT Curve units expected by the model. If the measurement system being
CMNT run is different from the measurement system containing the specified
CMNT unit, the values will be converted to the units specified in the mds
CMNT file. All curve units must conform to the OpenWorks database table. See
CMNT the pulldown menu in Model Builder. The maximum length of a unit
CMNT is 12 characters.
CMNT
CMNT Field 4 - TYPE: (obsolete)
CMNT Not presently used
CMNT
CMNT All curve values are returned as floats.
CMNT
CMNT Field 5 - DESCRIPTION:
CMNT Curve description written to curve header in database for the curve.
CMNT If a longer description is required see LATT below.
CMNT
CMNT For additional options, see keyword LATT below.
CMNT
CMNT Example:
CMNT|-----------------+-+-----------+-+---------------------------+
CMNT|
| |
| |
|
CMNT|
|I|
| |
|
CMNT| CURVE NAME
|O|
UNITS
| |
DESCRIPTION
|
CMNT|-----------------+-+-----------+-+---------------------------+
LOGS|Neutron_Porosity |I|v/v decimal| |Limestone neutron porosity |
LOGS|RHOB
|I|g/cm3
| |Bulk density
|
LOGS|Temperature
|I|degF
| |Formation Temperature
|
LOGS|CDE
|O|g/cm3
| |Corrected Density Log
|
CMNT|-----------------+-+-----------+-+---------------------------+
CMNT
CMNT-----------------------------------------------------------------CMNT <<LATT>>
ADDITIONAL DATABASE CURVE ATTRIBUTES
CMNT
CMNT This keyword allows for additional information for a specific curve
CMNT
CMNT Field 1 - CURVE NAME:
CMNT
CMNT The curve name must exactly match a curve name defined with LOGS.
CMNT
CMNT Field 2 - ATTRIBUTE TYPE:
CMNT
CMNT TITLE:
The curve title which can be used for column headings.
CMNT
Linefeeds may be imbedded into the title.
CMNT
CMNT DESCRIPTION:
CMNT
If a long description is desired, several of these lines
Release 5000.0.1
95
User Programming
CMNT
may be included.
CMNT
Note: You can have several entries for description to get a more
CMNT
detailed description.
CMNT
CMNT ************************************************************************
CMNT UNITTYPE:
CMNT
For output curves only, type of unit of measure. The types can
CMNT
be found on the Model Builder window on the pulldown menu under
CMNT
"Tools"
CMNT ************************************************************************
CMNT
CMNT FRAME ID:
CMNT
If output curve is to belong to a certain output working
CMNT
framework, that id is inserted in Field 3
CMNT
CMNT DIMENSION 2:
CMNT
CMNT
Field 3:
CMNT
2nd dimension attributes:
CMNT
CMNT
NPOINTS -- number of elements (size) in 2nd dimension
CMNT
UNITS
-- units of measure for 2nd dimension
CMNT
CMNT
Field 4: Value for the above attributes.
CMNT
CMNT DIMENSION 3:
CMNT
Field 3:
CMNT
3rd dimension attributes:
CMNT
CMNT
NPOINTS -- number of elements (size) in 3rd dimension
CMNT
UNITS
-- units of measure for 3rd dimension
CMNT
CMNT
Field 4: Value for the above attributes.
CMNT
CMNT It is best to include these lines right after the LOGS entry. An
CMNT example of using a combination of LOGS and LATT is described below.
CMNT For readability purposes the fields are spaced out.
CMNT
CMNT|-----------------+-+-----------+-+----------------------------------------+
CMNT|
| |
| |
|
CMNT|
|I|
| |
|
CMNT| CURVE NAME
|O|
UNITS
| |
DESCRIPTION
|
CMNT|
| |
| |
|
CMNT|-----------------+-+-----------+-+----------------------------------------+
LOGS|Neutron_Porosity |I|v/v decimal| |Limestone neutron porosity
|
LATT|Neutron_Porosity
| TITLE
|Limestone\n neutron\n porosity
|
LATT|Neutron_Porosity
| DESCRIPTION |Total porosity. Output is in decimal
|
CMNT|-----------------+-+-----------+-+----------------------------------------|
LOGS|FWA
|I|unitless
| |Full wave
|
LATT|FWA
| TITLE
|Full Wave
|
LATT|FWA
| DIMENSION2 |NPOINTS
| 1026
|
LATT|FWA
| DIMENSION2 |UNITS
| unitless
|
CMNT|-----------------+-+-----------+-+----------------------------------------|
LOGS|BITMAP
|O|unitless
| |a 200-400 bit map
|
LATT|BITMAP | TITLE
|Bit Map
|
LATT|BITMAP | DIMENSION2|NPOINTS
| 200
|
LATT|BITMAP | DIMENSION2 |UNITS
| unitless
|
LATT|BITMAP | DIMENSION3 |NPOINTS
| 400
|
Release 5000.0.1
96
User Programming
Release 5000.0.1
97
User Programming
CMNT
CMNT If during runtime, a parameter value is outside the range of the
CMNT definition, you may specify which action is to be taken for this
CMNT particular parameter.
CMNT
CMNT Available actions:
CMNT
ALLOW
Allow the value to be used
CMNT
CLIP
Clip the value using minimum or maximum
CMNT
DEFAULT
Use the default value defined in the mds file
CMNT
NULL
Use a null value.
CMNT
CMNT If a check action is not defined, the default value as defined
CMNT in the mds file or shared definition is used.
CMNT
CMNT Example:
CHKA=ALLOW
CMNT
CMNT-----------------------------------------------------------------CMNT <<CNST>>
DEFINITION OF CONSTANTS (parameters)
CMNT
CMNT Field 1 - NAME:
CMNT Name used in the model for this parameter. The maximum length
CMNT of a parameter is 28 characters. A unique parameter name is
CMNT saved in the database, prefixed with the model name and an
CMNT underscore. This insures that a value for the same name used by
CMNT another model is not overridden. (Also see description of
CMNT SHARED PARAMETERS (CREF) below.) If a title is not specified using
CMNT parameter attributes (see CATT below), the name is used for
CMNT the title.
CMNT
CMNT Note: parameter names ARE case sensitive. However, the parameter
CMNT variable names in Fortran are not. This means that you can specify
CMNT a parameter "Parm1" and the database will create a "Parm1" which is
CMNT different from an existing parameter "parm1". However, because of the
CMNT Fortran limitations, you cannot specify two parameters, "parm1" and
CMNT "Parm1" in the same model.
CMNT
CMNT Field 2 - DEFAULT:
CMNT Original value of parameter when first created or if value in
CMNT database has gone out of range. If this field is left blank
CMNT it will be set to null.
CMNT
CMNT Field 3 - TYPE:
CMNT With this present implementation, only input parameters are
CMNT allowed.
CMNT
CMNT Field 4 - MINIMUM:
CMNT Minimum value of parameter allowed. If this field is left blank
CMNT it will be set to null, therefore no lower limit is checked.
CMNT
CMNT Field 5 - MAXIMUM:
CMNT Maximum value of parameter allowed. If this field is left blank
CMNT it will be set to null, therefore no upper limit is checked.
CMNT
CMNT Field 6 - UNIT:
CMNT Parameter unit expected by the model. If the measurement system being
CMNT run is different from the measurement system containing the specified
CMNT unit, the values will be converted to the units specified in the mds
CMNT file. All parameter units must conform to the OpenWorks database table.
Release 5000.0.1
98
User Programming
CMNT See the pulldown menu in Model Builder. The maximum length of a unit
CMNT is 12 characters.
CMNT
CMNT Field 7 - DESCRIPTION:
CMNT Describes the parameter. More extensive descriptions can be defined
CMNT using CATT below.
CMNT
CMNT Field 8 - GROUP ID FIELD:
CMNT This field may be blank, or it may contain group-id numbers assigning
CMNT the parameter to the group identified by the integer. A field
CMNT may be assigned to any or all the defined groups. The numbers
CMNT must be separated by commas ",". If the field is left blank, the
CMNT parameter will be added to the DEFAULT_GROUP.
CMNT
CMNT For additional options, see keyword CATT below.
CMNT
CMNT Example:
CMNT|-------------+-------+-+----+-------+---------+---------------------+-----+
CMNT| NAME
|DEFAULT|T| MIN| MAX
|UNIT
| DESCRIPTION
|GROUP|
CMNT|
|
| |
|
|
|
|IDS |
CMNT|-------------+-------+-+----+-------+---------+---------------------+-----|
CNST|BITS
|8.75
|I| 0.0|
60.0|inches
|Bit size
| 1 |
CNST|BHD
|10000.0|I| 0.0|99999.0|feet
|Bottom Hole Depth
| 1 |
CNST|BHT
|175.0 |I| 0.0| 600.0|degF
|Bottom Hole Temp.
| 1 |
CNST|TPclay
| 12.0 |I| 0.0|
20.0|ns/m
|Prop. Time, Clay
| 2 |
CNST|TPsand
| 7.2 |I| 0.0|
15.0|ns/m
|Prop. Time, Sand
| 3 |
CMNT|-------------+-------+-+----+-------+---------+---------------------+-----+
CMNT
CMNT
CMNT-----------------------------------------------------------------CMNT <<CREF>>
DEFINITION OF SHARED CONSTANTS
CMNT
CMNT A "shared" parameter is a parameter defined in a common area that
CMNT can be used by any model. A list of available shared parameters
CMNT can be pulled down from the Model Builder, along with all the
CMNT definitions (default, minimum, maximum and units) for the particular
CMNT shared parameter.
CMNT
CMNT If you want to use the shared parameter but override the definition
CMNT (perhaps by limiting the minimum and maximum values, or changing the
CMNT default value for your particular model) the fields are exactly as
CMNT described above for a CNST, except that Field 8 is left blank.
CMNT The definition for the parameter is given the model name.
CMNT
CMNT However, if the shared definition is appropriate only the name of
CMNT the parameter is entered in Field 1 and the name of the definition
CMNT is entered in Field is entered in Field 9.
CMNT
CMNT Example:
CMNT|-------+-------+-+---+---+-----------+---------------------+------+-----------+
CMNT| NAME |DEFAULT|T|MIN|MAX|UNIT
| DESCRIPTION
|GROUP |DEFINITION |
CMNT|
|
| |
|
|
|
| IDS |
|
CMNT|-------+-------+-+---+---+-----------+---------------------+------+-----------+
CREF|NeuSalt|-0.03|I| |
|
|v/v decimal|Salt Neutron Porosity|
|
|
CREF|RhoSalt|
| |
|
|
|
|
|COMMON_SALT|
CMNT|-------+-------+-+---+---+-----------+---------------------+------+-----------+
CMNT
CMNT
CMNT------------------------------------------------------------------
Release 5000.0.1
99
User Programming
CMNT <<CATT>>
ADDITIONAL PARAMETER ATTRIBUTES
CMNT
CMNT This keyword allows for additional information for a specific parameter.
CMNT This can be used for both CNST and CREF parameters.
CMNT
CMNT Field 1 - PARAMETER NAME:
CMNT
CMNT The parameter name must exactly match a parameter name defined with CNST.
CMNT
CMNT Field 2 - ATTRIBUTE TYPE:
CMNT
CMNT TITLE:
The curve title which can be used for columnar headings
CMNT
Linefeeds may be imbedded into the title.
CMNT
CMNT DESCRIPTION:
CMNT
If a long description is desired, several of these lines
CMNT
may be included.
CMNT
CMNT CHECK ACTION:
CMNT
If during runtime, a parameter value is outside the range
CMNT
of the definition, you may specify which action is to be taken
CMNT
for this particular parameter. (See description of CHKA
CMNT
above.) Available actions: ALLOW, CLIP, DEFAULT, NULL.
CMNT
CMNT TYPE:
Type of parameter
CMNT
CMNT
Field 3: Type
CMNT
CMNT
REAL
CMNT
CMNT
Field 4: UNITTYPE
CMNT
CMNT
Field 5:
Actual unit type as defined in Model Builder
CMNT
CMNT
ENUMERATED
(1, 2, ...)
CMNT
CMNT
Field 4: Default
CMNT
CMNT
default (defaults to first)
CMNT
CMNT
LOGICAL
(yes or no, defaults to no)
CMNT
CMNT
Field 4: Default
CMNT
CMNT
yes
(defaults to no)
CMNT
CMNT
CMNT
CMNT It is best to include these lines right after the CNST entry. An
CMNT example of using a combination of CNST and CATT is described below.
CMNT For readability purposes the fields are spaced out.
CMNT
CMNT|-------------+-------+-+----+-------+---------+---------------------+-----+
CMNT| NAME
|DEFAULT|T| MIN| MAX
|UNIT
| DESCRIPTION
|GROUP|
CMNT|
|
| |
|
|
|
|IDS |
CMNT|-------------+-------+-+----+-------+---------+---------------------+-----|
CNST|tpClay
| 12.0 |I| 0.0|
20.0|ns/m
|Prop. Time, Clay
| 2 |
CATT|tpClay
| TITLE
| Propagation Time\n Clay
|
CATT|tpClay
| CHECK_ACTION | CLIP
|
Release 5000.0.1
100
User Programming
CATT|tpClay
| DESCRIPTION | Propagation time of Clay. Needed if and only|
CATT|tpClay
| DESCRIPTION | the TPL curve is used. If used, must be
|
CATT|tpClay
| DESCRIPTION | non-null and must be > 0.0. tpClay is used |
CATT|tpClay
| DESCRIPTION | in the SX0 calculation.
|
CMNT|-------------+-------+-+----+-------+---------+---------------------+-----+
CNST|mType
|
| |
|
|unitless |Source of m value
| 3 |
CATT|mType
| TYPE |ENUM | This is choice one
|
CATT|mType
| TYPE |ENUM | This is choice two
|
CATT|mType
| TYPE |ENUM | This is choice three
|default |
CATT|mType
| TYPE |ENUM | This is choice four
|
CATT|mType
| TYPE |ENUM | This is choice five
|
CATT|mType
| TYPE |ENUM | This is choice six
|
CMNT|-------------+-------+-+----+-------+---------+---------------------+-----+
CNST|OilMud
|
|I|
|
|
|Oil Mud
| 2 |
CATT|OilMud
| TYPE |LOGICAL| yes
|
CATT|Oilmud
| EFFECT|
mudtype_function
|
CMNT|-------------+-------+-+----+-------+---------+---------------------+-----+
CNST|TEMP
|70.0
| |
|
|degF
|Base Temperature
|
|
CATT|TEMP
| TYPE |R| UNITTYPE
|temperature
|
CMNT|-------------+-------+-+----+-------+---------+---------------------+-----+
CMNT
CMNT
CMNT-----------------------------------------------------------------CMNT <<NSMP>>
MULTIPLE VALUE SAMPLING
CMNT
CMNT Instead of getting one depth sample at a time, you can specify the
CMNT number of samples you wish to process. It is important to note
CMNT that arrays of log values will be delivered to the model and written
CMNT out to the database.
CMNT
CMNT First you can simply MD_NSMP to specify the number of samples
CMNT (for do-loops, etc.).
CMNT
CMNT Example:
NSMP=10
CMNT
CMNT However, you can use your own pre-defined variable name as follows:
CMNT
CMNT Example:
CMNT|---+----------------|
CMNT|NUM| NAME VARIABLE |
CMNT|---+----------------|
NSMP|10 | NUM_SAMPLES
|
CMNT|---+----------------|
CMNT
CMNT Since filtering is considered the default process for multiple
CMNT sampling, the depth counter will only advance one step at a time,
CMNT each time bringing back the number of samples specified, starting
CMNT at that particular depth. In the above case, with a step of 0.25
CMNT starting at 7000 feet and processing down, ten samples will be
CMNT given to the model representing values from 7000 feet to 7002.25.
CMNT and values will be output over the same range. The next time,
CMNT 10 values will be given to the model from 7000.25 to 7002.5, etc.
CMNT
CMNT
CMNT-----------------------------------------------------------------CMNT <<NSMI,NSMO>> MULTIPLE VALUE SAMPLING (different input/output)
CMNT
CMNT Instead of getting one depth sample at a time, you can specify the
Release 5000.0.1
101
User Programming
Release 5000.0.1
102
User Programming
CMNT|---+-----------------|
CMNT|NUM| NAME VARIABLE
|
CMNT|---+-----------------|
NSMI|10 | NUM_SAMPLES_INC |
CMNT|---+-----------------|
CMNT
CMNT Using the example in NSMP above, the model would receive 10 samples
CMNT of each curve at 7000 feet, process these and then send output values
CMNT back to the database. The next set of 10 samples would represent
CMNT curve values for 7002.5 through 7004.75.
CMNT
CMNT-----------------------------------------------------------------CMNT <<PASS>>
MULTIPLE PASS FLAG
CMNT
CMNT Defines if multiple passes are needed for the model (i.e., the
CMNT depth is to be set back to the beginning of the zone and
CMNT additional sequential runs are to be made. (See explanation
CMNT below for impact on .mdl file code.)
CMNT
PASS=YES
CMNT
CMNT
CMNT-----------------------------------------------------------------CMNT <<$EOF>> -The $EOF keyword must be at the end of each data spec
CMNT file.
CMNT-----------------------------------------------------------------$EOF
Release 5000.0.1
103
User Programming
Example Models
This section provides some useful sample model .mds-.mdl pairs. You
can use these as starting points for your own models. For your
convenience, the models are on the PetroWorks installation CD,
under $PWHOME/dat/src.
Release 5000.0.1
Example Models
104
User Programming
Release 5000.0.1
Example Models
105
User Programming
PROGRAM Gradient
=========Gradient.mdl=========================
This program calculates a vertical gradient of a Log Curve (curve value
at a depth minus the curve value at the next deeper depth). The convention
is that a positive gradient means the log value got larger as the depth
decreased.
The most typical application of a vertical curve gradient is to use a
CALIPER gradient as a bad hole indicator, i.e. rapid changes in hole
diameter cannot be followed by pad devices as well as gradual changes
can.
We want to run the computation bottom up, since that is the same direction
the logging tool went. Therefore, we specified the direction in the .mds
by setting PZDR=UP.
We will be reading curve data two depth samples at a time as indicated
by NSMI = 2 in the .mds file.
We want to output our gradient at the upper depth of the two depths,
which we read two at a time. Therefore we define that array access in the
.mds file by setting ISMO = 2 to be the OUTPUT_INDEX.
The Variable PREV_INDEX is an integer which will refer to a curve value
at a deeper depth index than the calculation index.
INTEGER PREV_INDEX
PREV_INDEX = OUTPUT_INDEX - 1
C
C
C
C
C
C
C Below is the actual gradient calculation. Simply subtract the Cali curve at
C the previous (shallower) depth from the Cali curve at the current output
C depth:
Gradient(OUTPUT_INDEX) = Cali(OUTPUT_INDEX) - Cali(PREV_INDEX)
C And we calculate the absolute value of the Gradient, which is really more
C useful as a bad hole indicator.
AbsGradient(OUTPUT_INDEX) = ABS(Gradient(OUTPUT_INDEX))
ELSE
C Of course, if either of the Cali values are NULL, we want the gradient to
C be NULL as well:
Gradient(OUTPUT_INDEX)= ABSENT
AbsGradient(OUTPUT_INDEX)= ABSENT
Release 5000.0.1
Example Models
106
100
User Programming
ENDIF
CONTINUE
END
Release 5000.0.1
Example Models
107
User Programming
multiple depths
null handling
user parameters
Log curve data smoothed with an equally weighted (or box-car) filter
retains more high-frequency noise than a corresponding symmetrical
filter. Judicious selection of filter weights may be necessary for
different depositional environments.
As currently written, the user is not required to make the filter weights
symmetrical. However, the operation of asymmetrical filters depend
upon the processing direction, and the output may be totally erroneous
if processed in the wrong direction. Also, improperly selected filter
weights may actually skew a curve by one or more steps, depending
upon the filter weight.
Example Models
108
User Programming
CMNT
CMNT We read in three depth levels at time using NSMI = 3
NSMI| 3 | NumSamplesIn |
CMNT We will only write out one value for every three we read using NSMO = 1
NSMO| 1 | NumSamplesOut |
CMNT The depth we write out must be in the middle of the three samples we read
CMNT by setting ISMO = OutputIndex = 2.
ISMO| 2 | OutputIndex|
$EOF
GR_FILTERED(OutputIndex) = ABSENT
ELSE
C
C
C
C
Otherwise filter the curve, multiplying each level by C it's user set
weight, add them up, and divide by the sum of the weights.
================ CAUTION!!! ===============
If the sum of the weights is zero, division by zero will occur!!
GR_FILTERED(OutputIndex)=(GR(1)*W_P1
; /(W_P1 + W__0 + W_N1)
+ GR(2)*W__0
+ GR(3)*W_N1)
ENDIF
END
Release 5000.0.1
Example Models
109
User Programming
Initialize counter
txt = " "
if (md_mdlint) then
write (txt,'(a,i2)') "model initializing",MD_MDLINT
call model_message(txt)
endif
txt = " "
if (md_wellint) then
write (txt,'(a,i2,2x,a)') "well initializing",MD_MDLINT,
&
MD_WELL_NAME(1:20)
call model_message(txt)
endif
txt = " "
if (md_zonint) then
write (txt,'(a,i2)') "zone initializing",MD_ZONINT
Release 5000.0.1
Example Models
110
User Programming
call model_message(txt)
endif
C
last sample
txt = " "
if (md_lstmdl) then
write (txt,'(a,i2)') "last sample for model",MD_lstmdl
call model_message(txt)
endif
txt = " "
if (md_lstwell) then
write (txt,'(a,i2)') "last sample for well",MD_lstwell
call model_message(txt)
endif
txt = " "
if (md_lstzon) then
write (txt,'(a,i2)') "last sample for zone",MD_lstzon
call model_message(txt)
endif
txt = " "
if (md_depth.eq.endmdldep) then
write (txt,'(a,f10.2)') "ending model at ",md_depth
call model_message(txt)
MD_MDLEND = .TRUE.
endif
txt = " "
if (md_depth.eq.endzondep) then
write (txt,'(a,f10.2)') "ending zone at ",md_depth
MD_ZONEND = .TRUE.
call model_message(txt)
endif
txt = " "
if (md_depth.eq.abtmdldep) then
write (txt,'(a,f10.2)') "aborting model at ",md_depth
call model_message(txt)
MD_MDLABORT = .TRUE.
endif
LOGO = GR
END
Release 5000.0.1
Example Models
111
User Programming
Release 5000.0.1
Example Models
112
User Programming
call model_message(txt)
MD_NEWSEL = .TRUE.
ELSE IF (MD_DEPTH.EQ.ODEPTH_OFF) THEN
MD_CURVE_OUT_SELECTED(2) = 0
write(txt,'(A,f10.2)') "Setting output read off at",md_depth
call model_message(txt)
MD_NEWSEL = .TRUE.
ELSE IF (MD_DEPTH.EQ.ODEPTH_ON) THEN
MD_CURVE_OUT_SELECTED(2) = 1
write(txt,'(A,f10.2)') "Setting output read on at",md_depth
call model_message(txt)
MD_NEWSEL = .TRUE.
ENDIF
Make sure that unreal values are set to ABSENT
LOG1 = ABSENT
END
Release 5000.0.1
Example Models
113
User Programming
PROGRAM CREATE_2D
Create 2D log
INTEGER I,J
SAVE I
character txt*80
Initialize counter
IF (MD_MDLINT) THEN
I = 0
ENDIF
Example Models
114
User Programming
Release 5000.0.1
Example Models
115
User Programming
SAVE I
Initialize counter
IF (MD_MDLINT) THEN
I = 1
TXT = " "
TXT = "Current Well "//MD_WELL_NAME
CALL MODEL_MESSAGE(TXT)
ENDIF
CHECK_SM = 0
LOG2X_1 = LOG2X(1)
C---- Set new value and increment counter
C---- This part demonstrates how data in 2nd Dimension can be accessed
DO 10 J = 1,MD_CURVE_2ND_NPOINTS(LDX_LOG2F)
IF (LOG2X(J).NE.ABSENT) THEN
LOG2F(J) = LOG2X(J)
CHECK_SM = CHECK_SM + LOG2X(J)
ENDIF
10
CONTINUE
C---- This part demonstrates how a 2nd Dimension can be created
LOG2G(1) = I
DO 20 J = 2,MD_CURVE_2ND_NPOINTS(LDX_LOG2G)
LOG2G(J) = LOG2G(J-1) + J + INCR
20
CONTINUE
I = I+1
END
Release 5000.0.1
Example Models
116
User Programming
Release 5000.0.1
Example Models
117
User Programming
Initialize counter
IF (MD_MDLINT) THEN
IF (USER_DIM.LT.0. OR. USER_DIM.GT.MAXDIM) THEN
CALL MODEL_MESSAGE(MSG)
MD_MDLEND = .TRUE.
GO TO 100
ENDIF
&
&
C
5
&
&
&
LOG2F_1 = LOG2X(1)
C---- Set new value and increment counter
DO 10 J = 1,NDIM
IF (LOG2X(J).NE.ABSENT) THEN
LOG2F(J) = LOG2X(J)
CHECK_SM = CHECK_SM + LOG2X(J)
ENDIF
10
CONTINUE
100
CONTINUE
Release 5000.0.1
Example Models
118
User Programming
END
Release 5000.0.1
Example Models
119
User Programming
Release 5000.0.1
Example Models
120
User Programming
Release 5000.0.1
Example Models
121
User Programming
C
C
C
C
INTEGER i,j
REAL TPI, RADC, RFMVLC2
----- Beginning Program MVLC_2D ----This will create a set of 2-D Multi-Valued Log Curves
that can be read by the PetroWorks 1998.5 Data Model.
j = 10
TPI = 2.*3.14156
RADC = TPI/360.
DO i=1,500
FMVLC1(i) = AGAIN*float(i)*float(j)
RFMVLC2
= float(i)/TC
FMVLC2(i) = 1./EXP(RFMVLC2)
FMVLC3(i) = SINE_MAX*float(j)*sin(RADC*float(i))
FI(i)
= float(i)
ENDDO
----- Ending PROGRAM MVLC_2D ----END
Example Models
122
User Programming
LATT|MVL3D2|DIMENSION3| NPOINTS
|
5
|
LATT|MVL3D3|DIMENSION3| NPOINTS
|
5
|
LATT|FI
|DIMENSION3| NPOINTS
|
5
|
CMNT|------+----------+---------------+-----------+
CMNT
CMNT|---------+-------+-+----+-------+---------+---------------------+-----+
CMNT| NAME
|DEFAULT|T| MIN| MAX
|UNIT
| DESCRIPTION
|GROUP|
CMNT|
|
| |
|
|
|
|IDS |
CMNT|---------+-------+-+----+-------+---------+---------------------+-----|
CNST|AGAIN
| 1.
|I| 1.0| 1000.0|
|Gain on Linear Curve | 1 |
CNST|TC
| 5.
|I| 0.1|
20.0|
|Decay Time Constant | 1 |
CNST|SINE_MAX | 2.
|I| 1.0| 1000.0|
|Gain on Sine Wave
| 1 |
CMNT|---------+-------+-+----+-------+---------+---------------------+-----|
$EOF
C
C
C
C
INTEGER i,j
REAL TPI, RADC, RFMVLC2
----- Beginning Program MVLC ----This will create a set of 3-D Multi-Valued Log Curves
that can be read by the PetroWorks 1998.5 Data Model.
TPI = 2.*3.14156
RADC = TPI/360.
TC
= 2.
DO j=1,5
DO i=1,50
MVL3D1(i,j) = AGAIN*float(i)*float(j)
RFMVLC2
= float(i)/TC
MVL3D2(i,j) = 1./EXP(RFMVLC2)
MVL3D3(i,j) = SINE_MAX*float(j)*sin(RADC*float(i))
FI(i,j)
= float(i)
ENDDO
ENDDO
----- Ending PROGRAM MVLC
----END
Release 5000.0.1
Example Models
123
User Programming
C
C
&
&
CHARACTER*80 TEXT
integer lastch
external lastch
Increment gamma ray by 1
IF (MD_MDLINT) THEN
TEXT = " "
'Model mds input framework reference curve',
&
MDS_REF_CURVE_NAME(1)(1:lastch(MDS_REF_CURVE_NAME(1)))
CALL MODEL_MESSAGE(TEXT)
MD_FRAME_REF_NAME(1)(1:lastch(MD_FRAME_REF_NAME(1))),
&
MD_FRAME_REQD_REF(1),MD_FRAME_REF_ID(1),
&
MD_FRAME_INCREMENT(1)
CALL MODEL_MESSAGE(TEXT)
ENDIF
IF (INT(GR).NE.INT(ABSENT)) THEN
GR_OUT = GR+1.0
ELSE
GR_OUT = ABSENT
ENDIF
END
Release 5000.0.1
Example Models
124
User Programming
Release 5000.0.1
Example Models
125
User Programming
Recommended Reading
You may find the following resources helpful.
Metcalf, M., Effective FORTRAN 77, 256 pp., Oxford University Press,
1985 (out of print).
Press, W. H. , S. A. Teukolsky, W. T. Vetterling, and B. P. Flannery,
Numerical Recipes in FORTRAN: The Art of Scientific Computing, 2nd
ed., 963 pp., Cambridge University Press, 1992.
Release 5000.0.1
Recommended Reading
126
User Programming
Overview
Using MathPack
PetroWorks comes with a wide range of algorithms; from simple data
conversion, to standard porosity and fluid saturation calculations, to
complex processes for the simultaneous estimation of lithology,
porosity, and fluid saturation. Those algorithms reside in a variety of
applications under the PetroWorks Command Menu items of Data
Prep, PreInterp, and Interpret. In some cases, however, those prepackaged algorithms may not meet your specific needs.
MathPack provides an easy way for you to quickly create the
algorithms that will meet your needs in specific interpretive situations.
Remember that if you have very complex processing needs
(simultaneously accessing multiple depths, complex looping and
branching, or creating a process that can be securely distributed to
colleagues), you should also consider ModelBuilder as another
application in which to build your algorithms.
Release 5000.0.1
125
Landmark
MathPack Features
126
Release 5000.0.1
User Programming
MathPack Workflow
Open MathPack
Interpret > MathPack
Close MathPack
Release 5000.0.1
127
Landmark
2.
3.
To Close MathPack
128
1.
2.
If you have not saved the algorithm that you created, a warning
window will appear which will allow you to Cancel the Exit
command (so you can save the algorithm, then exit) or continue
with the exit of MathPack (OK) without saving the algorithm.
Release 5000.0.1
User Programming
This section will guide you through the steps of creating a simple
algorithm and running it. For information about how to create more
complex algorithms, see the Building Algorithms section of this
documentation.
Creating an Algorithm
You create an algorithm by typing in the curves, parameters, and
functions to create an equation. Some rules are:
The curve or parameter that you want to create is always on the left
side of the equal sign, which is interpreted as an assignment
statement.
Each equation in the algorithm always ends with a semi-colon (;).
The names of curves that you use are always enclosed in double
quotes ( ).
The names of parameters (Local Variables or Global Parameters)
or numbers are NOT enclosed in double-quotes.
Release 5000.0.1
129
Landmark
Once you have typed the equation into MathPack, click the Check
Syntax button below the Algorithm window. If you have typed the
algorithm correctly, >> Syntax check passed. will appear in the Status
Area. If you have made a mistake in your algorithm, the Status Area
will display an error message, and MathPack will highlight the part of
the algorithm that has the error.
Once you have passed the syntax check, you are ready to use the
algorithm for processing.
In the Well Selection window, pick the wells that you want to
process. You can use a combination of the Select All (Select None)
button and mouse clicks to select the wells.
2.
After you have selected all the wells that you want, click the
Apply Well Selections button. This causes MathPack to query the
OpenWorks database and (among other things) update the items in
the Unit Selections text field. This MUST be done before you
select the processing interval.
3.
4.
You can Set Sample Increment, but leaving the choice defaulted
to Follow Framework Rules will ensure that MathPack honors
non-resampleable curves like core data.
5.
The curves that you created during processing will be written to the
selected wells in the OpenWorks database, and are immediately
available for use and display.
130
Release 5000.0.1
User Programming
Main Menu
Interval and
Sample Framework Selection
Well Selection
Divider/ Sash
Button
Algorithm Field
Status Area
Main Menu
The Main Menu consists of 5 items.
File
New Algorithm clears the Algorithm Field and then enters the
following text in that field, in preparation for creation of a new
algorithm.
Release 5000.0.1
131
Landmark
New Algorithm... will clear the Algorithm Field WITHOUT asking if you want
to save the algorithm that is already there. There is no way to recover the text that
was in place before New Algorithm... is invoked.
Save Algorithm... allows you to save the algorithm that you created to
a file with your choice of name and location. The file will automatically
be appended with a suffix of .mathpack. See Save Algorithm
Window for details of the window and its use.
The first time you use this command after you have opened
MathPack, a window opens that allows you to set the name and
location of the file that you want to create.
Subsequent times that you use this command, the previouslyselected file is automatically updated with the contents of the
Algorithm Field. The window does not appear, but a message is
displayed in the Status Area.
To change the destination of subsequent changes in your algorithm, use Save As...
instead of Save Algorithm...
Save As... opens a window that allows you to save the algorithm that
you created to a file with your choice of name and location. The file
132
Release 5000.0.1
User Programming
Exit closes the MathPack application. If you have not saved the
information in the Algorithm Field, a window will appear that allows
you to
Cancel the exit and return to MathPack, or
OK the exit, and exit MathPack WITHOUT saving your current
work.
Edit
Cut removes highlighted text from the Algorithm Field.
Copy copies highlighted text in the Algorithm Field in preparation for
pasting the text in another part of the field or in the Symbolic
Equations window.
Paste pastes text that has been Cut or Copied in to a location in the
Algorithm Field starting at the current cursor location.
The three operations above can be accessed by clicking MB3 when the
cursor is in the Algorithm Field.
View
Clear Algorithm clears the entire contents of the Algorithm Field.
Once the field is cleared, you cannot recover the previous contents.
This feature can also be accessed by clicking MB3 when the cursor is
in the Algorithm Field.
Clear Status Area clears the entire contents of the Status Area. Once
the text field is cleared, you cannot recover the previous contents. This
feature can also be accessed by clicking MB3 when the cursor is in the
Status Area.
Release 5000.0.1
133
Landmark
Options
The History Insertions feature ensures that a curve history is created
each of the output curves. That information will help you to understand
where the curve came from. The curve history is accessed in Curve
Utility.
Automatic is the default option for curve history.
None is available only if you have Project Manager status for the
project.
Tools
Select Log Curves... opens the Log Curve Selection window. You can
insert curves into your algorithm from this window (by Curve Alias,
Curve Name, or Curve Details) instead of typing directly in the
Algorithm Field. See the Log Curve Selection Window section of
this documentation for more details.
Select Wellbore Parameters... opens the Parameter Selection
window. You can insert Global Parameters into your algorithm from
this window instead of typing directly in the Algorithm Field. See the
Parameter Selection Window section of this documentation for more
details.
Global Parameters
You can use two types of parameters in MathPack. Local parameters are defined
in your algorithm and are not available to any other algorithmic processes. Global
Parameters are available to all algorithmic processes including the algorithms
that you write in MathPack. The value of the global parameter at the time that the
MathPack algorithm is executed is used by the algorithm. See the Local Variables
and Global (Wellbore) Parameters sections for more details.
Release 5000.0.1
User Programming
Remarks... opens the Remarks window. You can add comments here
that will be included in the curve history of each curve created by your
algorithm. The remarks will come before information about how the
curve was created. See the Remarks Window section of this
documentation for more details.
Well Selection
The wells that appear in the list are from the Well List chosen in
OpenWorks Project Status Tool, or selected when you started
PetroWorks. The list responds to changes in the Well Format (in the
Project Status Tool) but does NOT respond to the Well Order.
There are several ways to select wells on the list:
You can click on the Select None button (which then becomes
Select All).
The display at the bottom of the well list shows how many wells have
been selected out of the total number of wells in the well list.
Select All/Select None button toggles between the two shown settings
and allows you to select or deselect all the wells in the well list.
The Apply Well Selections button causes MathPack to read well data
from the project database.
Press the Apply Well Selections button
You MUST press the Apply Well Selections button AFTER you have selected the
wells that you want to process, and BEFORE you make any Unit Selections, for
the algorithms to process properly.
Release 5000.0.1
135
Landmark
Algorithm Field
You can Output Petrophysical Parameters as Curves. This will
create curves with the parameter values over the interval which you
have processed the algorithm.
The text field is where you actually create the algorithm that you want
to use. Remember that the algorithm can have multiple lines, and can
136
Release 5000.0.1
User Programming
The Process button causes MathPack to process the algorithms that you
have created over the interval (or intervals) and wells that you have
specified. Process checks the syntax and ensures that all referenced
curves exist before MathPack begins processing for each well. If an
error is found, an informational message informs you of the type of
error and processing is attempted on the next well. Otherwise, the
application continues to process the algorithm currently displayed in
the Algorithm field.
Using MB3 in the Algorithm Field will invoke the menu shown at
left. Clear Algorithm clears the entire algorithm field. There is no
recovery from this action.
Status Area
Results of the syntax check and processing are reported in the Status
Area, as are other messages that are broadcast to all open applications,
such as when wells or projects are changed.
Using MB3 in the Status Area allows you to clear the status area.
Divider/Sash Buttons
These two buttons, on the right side of the MathPack window, between
the Interval and Sample Framework Selection area and the Algorithm
Field, and between the Algorithm Field and the Status Area, allow you
to resize the three panes in the MathPack window. When you move
Release 5000.0.1
137
Landmark
your cursor over the button, the cursor arrow turns to a plus (+). Hold
down MB1 and drag the cursor up or down to resize the pane. Each
pane has a minimum size.
Pointing Dispatcher
The OpenWorks PD (Pointing Dispatcher) allows you to import single
and multiple wells and curves from Curve Utility into MathPack. You
can PD OUT well names and PD IN well names and curve names.
Press Ctrl-l to activate/deactivate the PD facility. When the PD border
is green, PD is listening for other curve/well data. When the border is
red, PD is deactivated for this application.
Iconified windows can receive information.
You can PD information to a window that is iconified as long as the border on the
icon is green. If the iconified window is a StratUtil application and the border is red,
you can use the key combination Ctrl+l (lowercase letter el) or click on the
iconified window and select PD Listen from the menu that appears to turn the
border green and to enable listening capability.
138
1.
2.
3.
Release 5000.0.1
User Programming
Curve
Selection
Search/Filter
Curve List
Selection
Display
Action Buttons
139
Landmark
Search/Filter
The text box provides for entry of a text string by which to search or
filter the items in the Curve List.
If you enter a character string, all curves having that character
string anywhere in their identifier will be found.
* can be used to indicate any character, and can be used as part
of a character string.
I*M will find ILM, TIDMR, and CALIMAX.
^ can be used to indicate that the following character string
must occur at the beginning of the entry.
Search/Find Next highlights the next table entry that matches the text
string, and moves the list so that the highlighted entry is at the top of
the list.
Filter causes the list to be reduced to only those entries which match
the text string.
Reset causes the curve list to be returned to its original contents, and
deletes the text string from the text box.
Curve List
The curve list shows the curves in alphabetical order, based on the
selections made in the Curve Selection area. The list cannot be
reordered.
Selection Display
Immediately below the Curve List, the Selection Display shows the
number of curves that:
140
Release 5000.0.1
User Programming
Action Buttons
Insert causes the selected curve to be inserted into the algorithm at the
location of the cursor in the Algorithm Field. Insert must be used to
insert the curve into the algorithm; double-clicking on the curve
identifier to insert it in the algorithm is not supported.
Close closes the Log Curve Selection window with no further action.
Release 5000.0.1
141
Landmark
Search/Filter
Parameter List
Selection
Display
Action Buttons
142
Release 5000.0.1
User Programming
Parameter List
The parameter list shows the Global Parameters in alphabetical order.
The left-hand column is the actual parameter name; the right-hand
column is the title of the parameter as it appears as a column heading in
the Wellbore Parameter Editor. The list cannot be reordered.
More information about each Global Parameter is available in
Appendix 5: MathPack Syntax, and in the Wellbore Parameter
Editor documentation.
Appendix 5 shows the parameter Name, Title, Description,
Minimum and Maximum Values, optional Default Values, and the
Units of Measurement.
Wellbore Parameter Editor documentation contains the above
information, plus expanded default values for a small number of
parameters. To open Wellbore Parameter Editor:
Go to PetroWorks Command Menu > Utilities > Wellbore
Parameter Editor, make sure Applications is set to Global
Parameters and Columns (Parameter Group) is set to All.
Find the parameter that you want, then double-click on a cell in
that parameters column. The Cell/Parameter Detail window
will appear which provides details about the parameter and its
current value.
Release 5000.0.1
143
Landmark
Selection Display
Immediately below the Parameter List, the Selection Display shows
the number of parameters that:
Action Buttons
Insert causes the selected parameter to be inserted into the algorithm at
the location of the cursor in the Algorithm Field. Insert must be used
to insert the parameter into the algorithm; double-clicking on the
parameter to insert it in the algorithm is not supported.
Close closes the Parameter Selection window with no further action.
144
Release 5000.0.1
User Programming
Algorithm
Elements
Palette
Close button
Release 5000.0.1
145
Landmark
Close button
The Close button closes the Algorithm Elements window with no
further action.
146
Release 5000.0.1
User Programming
Main Menu
Equation
List
Equation Field
Equation
Name
Field
Action
Buttons
Release 5000.0.1
147
Landmark
Equation List
The Equation List shows all the symbolic equations and their names.
The equations are listed in alphabetical order by name. The equations
are defined in Appendix 2: Pre-Defined Symbolic Equations.
Equation Field
The Equation Field shows the selected equation. If you create a new
Symbolic Equation, you type the entire equation here (information
from BOTH sides of the equal sign), or paste the equation here from the
MathPack Main Window Algorithm Area.
Action Buttons
Add/Update adds a new Symbolic Equation to the Equation List, or
updates an existing Symbolic Equation.
Delete removes the Symbolic Equation in the Equation Name Field
from the list of equations.
Insert into Algorithm inserts the Symbolic Equation in the Equation
Field into the algorithm in the MathPack Main Window Algorithm
Area at the location of the cursor.
Close closes the Symbolic Equation window without further action.
148
1.
Enter a name for the equation in the Equation Name Field. Pick a
name that you can easily recognize at a later date.
2.
3.
Release 5000.0.1
User Programming
2.
3.
4.
Click File > Save to save the changes to the Symbolic Equations
file.
2.
Click the Delete button to delete the equation from the list.
3.
Click File > Save to save the changes to the Symbolic Equations
file.
Release 5000.0.1
149
Landmark
Remarks Window
The Remarks window allows you to add remarks to the history file of
curves. The same remarks are added to the history files of all curves
generated during a single MathPack processing event. The Remarks
Window is accessed from the Main Menu via Tools > Remarks...
Text Window
OK button
OK Button
The OK button closes the window and saves the text that you have
written for inclusion in the curve histories of all the curves processed in
the next MathPack processing instance.
150
Release 5000.0.1
User Programming
Go to File > Save Algorithm... or File > Save As... Either menu
item will open the Save Algorithm window shown above.
2.
3.
Type the file name that you want to use in the Selection Text Box
and click OK.
Release 5000.0.1
151
Landmark
152
Release 5000.0.1
User Programming
Algorithm Preview
Release 5000.0.1
1.
2.
3.
4.
If you are unsure of the contents of the file, you can click the
Preview button at the bottom of the window. The contents of the
file will be displayed in the Algorithm Preview window.
5.
153
Landmark
154
Release 5000.0.1
User Programming
Building Algorithms
This section provides the details of creating algorithms, including the
grammar and syntax of the algorithms, and an explanation of error
messages when they appear.
Introduction
Algorithms in MathPack are based on a simple language and grammar.
Algorithms can take on a free-form user-defined arrangement and may
be composed of any number of lines, including comments in separate
lines or in lines containing algorithms. Moreover, no limits are placed
on the number of lines or curves used, or the length of individual lines.
Arithmetic and logical (boolean) operators have their conventional
meanings and follow their conventional order of precedence. The order
of precedence (the order of evaluation) of the operators may be
modified by grouping expressions within parentheses. The groupings
may be of arbitrary complexity and may be repeated to any level.
Statements are processed sequentially in the algorithm from top to
bottom, for each valid sample point; i.e., the algorithms apply only to
the current depth; no access to depths other than the current depth is
possible.
The algorithm checker (parser) performs reasonable static checks on
the algorithm, searching for common errors in syntax and semantics.
When an error occurs, a message that indicates the nature of the error
(and where applicable, possible solutions to the problem) is generated
in the Status Area of the MathPack window. See Appendix 4:
Understanding Error Messages for more details.
A simple example
This section illustrates the different ways in which a simple algorithm
can be written. The basic algorithm calculates a sonic porosity
(PHIsonic) from acoustic wave travel time (DT) using the RaymerHunt-Gardner transform:
DT DT matrix
PHI sonic = 0.625 ----------------------------------DT
Release 5000.0.1
155
Landmark
This version of the equation substitutes the Curve Alias (Acoustic_Wave_Travel_Time) for
the Curve Name (DT), and substitutes the Global Parameter (TransitTimeMatrix) for the locally-defined variable (DTmatrix). The Curve Alias provides the means to process wells with
variations in the
name of the
sonic measurement, and the
Global Parameter provides the means to access a parameter which is shared by several applications, and
which is defined in the Wellbore Parameter Editor.
Note that the Global Parameter is NOT declared in the algorithm.
This version of the equation is exactly like
the version immediately above, except
that it has been written on several lines to
limit the width of the text.
This version of the equation is in the same form as the two immediately above, and also includes an IFTHEN-ELSE statement. In this form, SPHI is calculated by the Raymer-Hunt-Gardner transform when
Acoustic_Wave_Travel_Time (DT) is greater than TransitTimeMatrix (DTmatrix). If the log measurement
is less than or equal to the matrix value, SPHI is set to 0.001 (0.1 percent porosity).
156
Release 5000.0.1
User Programming
Algorithmic Results
Some reasons that an expression cannot be computed:
Divide by zero;
The function call has an argument which is out of range;
One or more input curves does not exist.
Comments (optional)
Variable declarations (optional)
Statements
Comments
Comments are preceded by a double-dash ( -- ) and extend to the end of
the line on which they begin. They may appear anywhere on a line or
anywhere in an algorithm. Comments are an optional part of an
algorithm, but are strongly suggested, especially when creating
complex algorithms, or algorithms that you will share with others.
Comments do not affect the meaning of the line on which they appear
and are ignored when the algorithm is processed.
Comment examples:
Variable Declarations
Local Variables must be declared at the beginning of an algorithm,
before they are used in any statement. Variables can be assigned
Release 5000.0.1
157
Landmark
In the example above, Rw, m, and RHOB_calc are local variables. After
their declaration by the Variable statement, Rw is defined as a
constant while m and RHOB_calc are defined as expressions.
The example above also contains two Global Parameters,
DensityFluid and DensityMatrix. They are used like Local Variables,
and have the same appearance (they are used in expressions without
quotation marks). They are not explicitly declared in the algorithm, but
they are implicitly declared, and as such are available to all
applications. See Global (Wellbore) Parameters for more details.
158
Release 5000.0.1
User Programming
Statements
There are three types of statements:
Assignment Statements
IF Statements
LOOP Statements
Assignment Statements
Assignment statements evaluate an expression by computing a value,
and placing that value in the specified curve or variable at the given
depth for which the algorithm is being applied.
Examples of assignment statements:
IF Statements
IF statements allow a MathPack user to define conditional processing
on enclosed algorithm statements.
IF statements come in two forms:
IF (expression) THEN
(expression);
END IF;
If the expression immediately following IF is satisfied, the expression
immediately following THEN is evaluated. If the expression
Release 5000.0.1
159
Landmark
LOOP Statements
LOOP statements allow you to iteratively process data. By using a
LOOP statement you can converge on a value by using the previous
value determined by the expression in the same expression, and you
can also set a counter that will terminate a loop after a reasonable
number of iterations. The LOOP statement takes the form of the classic
do-while loop.
The LOOP statement has the form:
(expressions setting initial conditions);
WHILE (expressions) LOOP
160
Release 5000.0.1
User Programming
(expression);
(expressions to iterate values);
END LOOP;
The condition of each loop statement is evaluated once for each
iteration. If upon evaluation the condition is met, the loop body is
entered. Statements in the loop body are processed and control is
passed back to the top of the loop, where the condition of the loop body
is re-evaluated.
Static checks (via the Check Syntax button) are performed to
determine if the loop will be infinite or entered at all. If the loop is
determined to be infinite, the parser will produce an error message in
the Status Area. If the loop will never be entered, the parser will warn
the user and will remove all associated statements (including the
evaluation of the condition) from processing.
Loops are processed and must terminate or run to completion FOR
EACH DEPTH at which the algorithm is applied. Loops that require
large numbers of iterations to complete will greatly increase processing
time for an algorithm.
Example of a LOOP statement:
Variable declarations
Variable initialization
LOOP body
Statement Elements
Curve Identifiers
Curve identifiers are the way that you specify curves as inputs to
algorithms, and as outputs; that is, as the results of algorithm
Release 5000.0.1
161
Landmark
Identifier
Input Curve
Output Curve
Curve Alias
Curve Name
Curve Details
Case 1
Case 2
Case 3
Case 4
Case 1 shows the use of Curve Names as input and output curve
identifiers.
162
Release 5000.0.1
User Programming
Curve Identifiers:
Cannot contain quotes within the enclosing quotes. My new Curve is not a
valid curve name.
Are case sensitive. Sw SW and sw are interpreted as three different curves.
Are limited to 25 characters.
Can be Curve Names or Curve Aliases, or Curve Details. (See the table above for
identifier usage limitations.)
Numeric Literals
Numeric literals are numbers that are used in an algorithm. Numbers do
NOT have to contain a decimal point.
Release 5000.0.1
163
Landmark
Local Variables
Local Variables are algorithm components that you have defined in the
algorithm. As described in the Variable Declarations section, they are
declared at the beginning of the algorithm by the word VARIABLE.
The value of a Local Variable can be set to a constant, or can be
determined by an expression.
Local Variable names are not limited in length, and the names are case
sensitive. Local Variable names are used in algorithms WITHOUT
quotation marks.
Release 5000.0.1
User Programming
Function Calls
Function calls are references to built-in arithmetic and trigonometric
functions. MathPack provides a varied selection of functions and
maintains their conventional meanings. All but one function (MOD) act
as operations on a simple expression. MOD is a binary operation that
requires two values.
Function calls are case insensitive; LN, Ln, ln, lN are considered
the same function.
Trigonometric Function Calls expect Radians
The trigonometric Function Calls operate on a number or on a resolved expression
which are expected to be in RADIANS, NOT degrees.
The conversion from degrees to radians is:
Degrees
Radians = ---------------------- 2
360
Release 5000.0.1
165
Landmark
Exponentiation
Exponentiation is represented by the carat symbol ( ^ ) or by the
Function Call EXP. The expressions are equivalent.
Roots may be calculated by using a fractional exponent.
Fractions may be calculated by using a negative exponent.
Roots of negative values cannot be calculated.
Some examples of exponentiation are shown here:
166
Release 5000.0.1
User Programming
Release 5000.0.1
1.
Make sure that all curves used in calculations exist in the selected wells
2.
Check for a disk file of the algorithm youre interested in chances are it may
already have been written.
3.
Add any commonly-used constant (or equation) to the constant (equation) table. Edits
to that constant or equation then only need to be made once in the table.
4.
5.
6.
7.
Check for missing or misspelled reserved words such as thne for then.
8.
9.
Check for quoted curve names that span multiple lines. Note that curve names should
not exceed 25 characters.
10.
11.
12.
Use NEG (), not a minus sign (-) for negative values.
167
Landmark
Appendices
Appendix 1: Algorithm elements with definitions
Element
Definition
Arithmetic Operations
+
addition
subtraction
multiplication
division
Relational Operations
=
is equal to
!=
is not equal to
<
is less than
<=
>
is greater than
>=
Logical Operators
AND
OR
Function Calls
168
ABS( )
ACOS( )
ASIN( )
ATAN( )
Release 5000.0.1
User Programming
Element
Definition
COS( )
LN( )
LOG( )
MOD( )
NEG( )
SIN( )
SQRT( )
TAN( )
EXP( )
RANDOM( )
Statement Elements
VARIABLE
equal to
open parenthesis
close parenthesis
IF ( ) THEN
IF statement
( );
END IF;
IF ( ) THEN
IF-THEN statement
ELSE ( );
END IF;
WHILE ( )
LOOP
LOOP statement
( );
END LOOP;
Release 5000.0.1
169
Landmark
Element
--
Definition
Precedes comments, either at the beginning of a line, or at the end of a
line containing an expression, after the semi-colon.
Value Literals
170
TRUE
FALSE
NULL
Release 5000.0.1
User Programming
Equation Name
ARCHIE
Definition
a Rmf
Sw = ---------------------m
Rxo
1--n
ARCHIE_SXO
BVW
Release 5000.0.1
a Rw n
Sxo = -----------------m-
Rt
Sxo =SXO_ARCH (flushed zone water saturation
a = TortuosityFactor
Rmf = ResMudFiltrate (mud filtrate resistivity)
Rxo = Flushed_Zone_Resistivity
= Porosity
m = CementationExponent
n = SaturationExponent
BVW = S w
BVW = BVWC (bulk volume water)
Sw = Water_Saturation
= Effective_Porosity
171
Equation Name
Landmark
Definition
DEN_to_POR
DT_to_POR
F_FACTOR
matrix b
DPHI = ---------------------------------- matrix fluid
DPHI = DPHI (density porosity)
b = Bulk_Density (the log measurement)
matrix = DensityMatrix
fluid = DensityFluid
T T matrix
SPHI = ------------------------------------------T fluid T matrix
SPHI = DTPORC (sonic porosity)
T = Acoustic_Wave_Travel_Time (log measurement)
Tmatrix = TransitTimeMatrix
Tfluid = TransitTimeFluid
a
F = -----m
F = F (formation factor)
a = TortuosityFactor
= Porosity
m = CementationExponent
MOVEABLE_SH
172
Moveable hydrocarbon
saturation (also called
moveable oil saturation). The
fraction of in-place
hydrocarbons that can be
moved or produced.
MOS = Sxo Sw
MOS = MOS
Sxo = Flushed_Zone_Water_Sat
Sw = Water_Saturation
Release 5000.0.1
User Programming
Equation Name
Definition
POR_to_DEN
RESIDUAL_SH
Residual hydrocarbon
saturation (also called
residual oil saturation). The
fraction of in-place
hydrocarbons that cannot be
produced.
b = 1 matrix + fluid
b = RHOBC)
= Density_Porosity
matrix = DensityMatrix
fluid = DensityFluid
ROS = 1 Sxo
ROS = ROS
Sxo = Flushed_Zone_Water_Sat
m
RMFA
Rxo
Rmfa = ---------------------a
Rmfa = RMFA
Rxo = Flushed_Zone_Resistivity
a = TortuosityFactor
= Porosity
m = CementationExponent
RWA
Rt
Rwa = -----------------a
Rwa = RWA
Rt = True_Resistivity
a = TortuosityFactor
= Porosity
m = CementationExponent
Release 5000.0.1
173
Landmark
Equation Name
Definition
RWA_ARCH
Rt
Rwa = ----F
Rwa = RWA_ARCH
Rt = True_Resistivity
F = F_Factor
RWA_RATIO
Rt
Rwa = Rmf ----------
Rxo
Rwa = RWA_RATIO
Rmf = ResMudFiltrate (mud filtrate resistivity)
Rt = True_Resistivity
Rxo = Flushed_Zone_Resistivity
174
Release 5000.0.1
User Programming
Parameter Name
BitSize
Bit Size
60
8.75
inches
BottomHoleDepth
Bottom Hole
Depth
50000
10000
feet
BottomHoleTemperature
Bottom Hole
Temperature
600
175
degF
CementationExponent
Cementation
Exponent (m)
0.1
unitless
ConcentrationKcl
Concentration
KCl
Concentration KCl
30
DensityAnhydrite
Anhydrite
Density
2.95
3.1
2.98
g/cm3
DensityCasing
Casing Density
66.427
lbm/
galUS
DensityCoal
Coal Density
1.4
g/cm3
DensityDolomite
Dolomite
Density
2.82
2.92
2.87
g/cm3
DensityDryShale
Dry Shale
Density
2.65
g/cm3
DensityFluid
Fluid Density
g/cm3
DensityFormationWater
g/cm3
Release 5000.0.1
Units
175
Landmark
Parameter Name
DensityHydrocarbon
Hydrocarbon
Density
g/cm3
DensityLimestone
Limestone
Density
2.69
2.8
2.71
g/cm3
DensityMatrix
Matrix Density
1.5
3.5
2.65
g/cm3
DensityMudFiltrate
Mud Filtrate
Density
g/cm3
DensityPorosityCoal
Coal density
Porosity
0.65
v/v
decimal
DensityPorositySalt
Salt Density
Porosity
-1
-0.03
v/v
decimal
DensityPorosityShale
Shale Density
Porosity
0.2
v/v
decimal
DensitySalt
Salt Density
2.1
g/cm3
DensitySandstone
Sandstone
Density
2.62
2.68
2.65
g/cm3
DensityShale
Shale Density
2.65
g/cm3
DensityWetShale
Wet Shale
Density
2.3
g/cm3
DiameterBorehole
Borehole
Diameter
100
8.75
inches
DiameterCasing
36
inches
DiameterOfInvasion
Diameter of
Invasion
100
inches
DiameterTubing
inches
DielectricConstantHC
Hydrocarbon
Dielectric
Constant
DielectricConstantMatrix
0
Diameter of the invasion of
drilling fluids into the surrounding
reservoir rock.
Units
2.2
fred
3.5
35
4.65
unitless
DielectricConstantShale
Shale Dielectric
Constant
10
55
25
unitless
EmpiricalInvasionFactor
Invasion Factor
Sw Sxo
0.5
unitless
EquivCationConductance
30
3.83
mho/m
per
meq/cc
GammaRayClean
Gamma Ray
Clean
500
20
API
GammaRayShale
Gamma Ray
Shale
500
100
API
HydrogenIndexFluid
1.5
unitless
NeutronPorosityAnhydrite
Anhydrite
Neutron porosity for Anhydrite.
Neutron Porosity
-0.025 0.025
-0.015
v/v
decimal
176
Release 5000.0.1
User Programming
Parameter Name
NeutronPorosityClean
NeutronPorosityCoal
Coal Neutron
Porosity
0.38
v/v
decimal
NeutronPorosityDryShale
0.2
v/v
decimal
NeutronPorosityHM
Heavy Mineral
Neutron porosity for Heavy
Neutron Porosity Minerals.
0.6
0.03
v/v
decimal
NeutronPorositySalt
Salt Neutron
Porosity
-1
-0.03
v/v
decimal
NeutronPorosityShale
0.2
v/v
decimal
NeutronPorosityShale
0.4
v/v
decimal
NeutronPorosityWetShale
0.25
v/v
decimal
PermeabilityConstant
Permeability
Constant
10000
250
unitless
PhotoelecIndexWetShale
Wet Shale
Photoelectric
Factor
100
b/elec
PhotoelecXsecShale
Photoelectric
Cross Section
Shale
10
b/cm3
PorosityShale
Shale Porosity
Shale porosity
0.4
v/v
decimal
PropagationTimeDolomite
Propagation
Time Dolomite
15
8.7
ns/m
PropagationTimeHC
Propagation
Time
Hydrocarbons
10
4.7
ns/m
PropagationTimeLimestone
Propagation
Travel time in Limestone for high 0
Time Limestone frequency (microwave) waves.
15
9.7
ns/m
PropagationTimeSand
Propagation
Travel time in Sandstone for high 0
Time Sandstone frequency (microwave) waves.
15
7.2
ns/m
PropagationTimeShale
Propagation
Time Shale
20
12
ns/m
PropagationTimeWater
Propagation
Time Water
20
Travel Time in Water for High
Frequency (microwave) waves.
The rate of travel is determined
almost entirely by the dielectric
(insulating) properties of the
formation, which is largely related
to the water content of the
formation.
90
29.5
ns/m
ResBoundWater
0.01
100
0.04
ohm.m
ResBoundWaterInv
Mud Filtrate
Bound
Resistivity
0.01
0.2
0.04
ohm.m
Release 5000.0.1
Units
v/v
decimal
177
Landmark
Min. Max. Default
Value Value Value
Parameter Name
ResBoundWaterInvTemp
Mud Filtrate
Temperature which the resistivity 32
Bound
of the bound water in the invaded
Resistivity Temp zone was measured
500
75
degF
ResBoundWaterTemp
32
500
75
degF
ResistivityCleanLimit
True Resistivty
Clean limit
10000
ResistivityFlushZoneShale
20
12
ohm.m
ResistivityShale
0.001
2000
0.5
ohm.m
ResistivityShaleLimit
True Resistivity
Shale limit
10000
ohm.m
ResMud
Mud Resistivity
0.005
10
ohm.m
ResMudcake
Mudcake
Resistivity
0.005
10
ohm.m
ResMudcakeTemp
Mudcake
Temperature which the resistivity 32
Resistivity Temp of the mudcake was measured
500
degF
ResMudFiltrate
Mud Filtrate
Resistivity of the Mud Filtrate
Resistivity (Rmf) which is present in the invaded
zone.
10
ohm.m
ResMudFiltrateTemp
500
degF
ResMudTemp
Mud Resistivity
Temp
500
degF
ResWater
ohm.m
ResWaterTemp
degF
RHGFactor
Raymer Hunt
Gardner Factor
(k)
SalinityBorehole
ppm
SalinityFormation
0.005
Units
ohm.m
500
0.625
unitless
0.001
300000
ppm
SalinityMudFiltrate
Mud Filtrate
Salinity
0.001
300000
ppm
SaturationExponent
Saturation
Exponent (n)
0.1
SigmaBoundWater
Bound Water
Sigma
178
150
unitless
cu
Release 5000.0.1
User Programming
Min. Max. Default
Value Value Value
Parameter Name
SigmaFreeWater
Free Water
Sigma
150
cu
SigmaHydrocarbon
Hydrocarbon
Sigma
25
cu
SigmaMatrix
Matrix Sigma
300
10
cu
SonicPorosityShale
Shale Sonic
Porosity
0.5
0.3
v/v
decimal
SpontaneousPotentialClean
Spontaneous
Potential Clean
-200
100
-100
mV
SpontaneousPotentialShale
Spontaneous
Potential Shale
100
mV
ThicknessCasing
Casing
Thickness
0.5
inches
TortuosityFactor
unitless
TransitTimeCoal
Coal Transit
Time
150
120
us/ft
TransitTimeCp
Transit Time
Compaction
Correction
10
unitless
TransitTimeDolomite
38.5
43.5
41
us/ft
TransitTimeDryShale
Dry Shale
Transit Time
20
150
50
us/ft
TransitTimeFluid
Fluid Transit
Time
100
500
189
us/ft
TransitTimeLimestone
Limestone
Transit Time
43.5
47.6
46
us/ft
TransitTimeMatrix
Matrix Transit
Time
20
150
50
us/ft
TransitTimeSalt
20
150
64.4
us/ft
Release 5000.0.1
20
Units
179
Landmark
Parameter Name
TransitTimeSandstone
Sandstone
Transit Time
51.3
55.5
53.4
us/ft
TransitTimeShale
20
150
50
us/ft
TransitTimeWetShale
Wet Shale
Transit Time
20
150
50
us/ft
WeightCasing
Casing Weight
120
30
lbm/ft
WeightCement
Cement Weight
30
15
lbm/
galUS
WeightMud
Mud weight
28
11
lbm/
galUS
180
Units
Release 5000.0.1
User Programming
Information messages
Error messages
Information Messages
Information messages are generated for different reasons, but are
always preceded by the pattern
>> INFO:
These messages may display the status of MathPack algorithm
processing or provide additional detail about a previous message. One
or more information messages often follow an error message. See the
discussion that follows.
Error Messages
Error messages are generated when the algorithm checker detects an
unresolved error in the specified algorithm. Error messages are always
preceded by the pattern
>> ERROR:
These messages state the nature of the error and attempt to provide the
lexical element (or part) of the algorithm causing the error. This
explanation generally consists of an element enclosed in quotes and the
line number of the offending occurrence in the algorithm. As in the
fragment:
at ")" on line 3
Note that the lines are not numbered as currently displayed in the
algorithm builder, but when possible, the offending element is
Release 5000.0.1
181
Landmark
Syntax errors
Semantic errors
Syntax Errors
Syntax errors originate when a grammar rule for the correct
specification of an algorithm has been violated. Examples include:
mismatched parentheses
missing or misplaced commas
unterminated statements
missing or misspelled reserved words
improperly quoted curve ids
Semantic Errors
Semantic errors may occur in syntactically correct algorithms, but
violate some meaning of a construct. Examples include:
Release 5000.0.1
User Programming
current dataset
depth and sampling parameters,
the algorithm specification
Release 5000.0.1
183
Landmark
184
Release 5000.0.1
User Programming
Release 5000.0.1
185
Landmark
186
Release 5000.0.1
User Programming
Release 5000.0.1
187
Landmark
188
Release 5000.0.1
User Programming
The next several messages are related to the above message and will
appear in some combination, depending on the context.
Check terms and relations, if static condition
is not intended (I)
This message serves as an additional warning. Some static
conditions may be intentional.
Condition is always TRUE (I)
Condition is always FALSE (I)
The parser has detected a condition of an if or loop statement
that is statically determined to be TRUE (or FALSE).
If statement will never be performed (I)
The condition of an if statement (without an else part) was
statically determined to be FALSE. The condition is not
considered and the if statement (including all of its enclosed
statements) is effectively removed from processing.
Note that the case for if statements that are ALWAYS TRUE is
not explicitly announced. The condition of the if statement is not
considered during processing and the statements enclosed by the
if are always performed.
Else part will always be performed (I)
The condition of an if statement (with an else part) was
statically determined to be FALSE. The condition is not
considered during processing and the statements enclosed by the
else part are always performed.
Release 5000.0.1
189
Landmark
190
Release 5000.0.1
User Programming
Expression
The table beginning on the following page lists the syntax rules that
you must adhere to when you generate a MathPack algorithm.
For example, the first rule states that
An algorithm is represented as an optional
declaration_list followed by a statement_list.
Release 5000.0.1
191
Landmark
Left Side
Meta
Symbol
Right Side
algorithm
::=
{declaration_list}
statement_list
declaration_list
::=
declaration
{declaration_list}
declaration
::=
VARIABLE id;
statement_list
::=
statement
statement_list |
EMPTY
statement
::=
assignment_statement|
if_statement
loop_statement|
assignment_statement
::=
CURVE_ID = expression;
if_statement
::=
if (condition) then
statement
statement_list
[else
statement;
statement_list]
end if;
condition
::=
expression
expression
::=
relation
relation and relation
relation or relation
relation
::=
simple_expression
simple_expression =
simple_expression!=
simple_expression <
simple_expression<=
simple_expression >
simple_expression>=
simple_expression
::=
term
term + simple_expression
term - simple_expression
term
::=
factor
factor * term
factor / term
192
|
|
|
simple_expression|
simple_expression|
simple_expression|
simple_expression|
simple_expression|
simple_expression
|
|
|
|
Release 5000.0.1
User Programming
Meta
Symbol
Left Side
Right Side
factor
::=
primary |
primary ^ primary
primary
::=
ID
CURVE_ID
REAL_LITERAL
INTEGER_LITERAL
BOOLEAN_LITERAL
NULL_LITERAL
function_call
(expression)
function_call
::=
abs
aco
asin
atan
cos
exp
cot
log
ln
mod
neg
random
sin
sqrt
tan
|
|
|
|
|
|
|
(simple_expression)|
(simple_expression)|
(simple_expression)|
(simple_expression)|
(simple_expression)|
(simple_expression)
(simple_expression |
(simple_expression)|
(simple_expression |
(simple_expression,
simple expression)|
(simple_expression) |
(min_value, max_value)
(simple_expression) |
(simple_expression) |
(simple_expression)
Non-terminals
Non-terminals do not end an expression by themselves; they refer to
other grammar rules. Notice that this process may lead to recursive,
self-reference and allows the grammar to represent arbitrarily nested
constructs.
Meta-symbols
Meta-symbols have no meaning except to help define the grammar
itself. As such, meta symbols do not become a part of the algorithm
specification.The following meta-symbols are used in the grammar
rules:
Release 5000.0.1
Colon, Colon, Equal Sign (::=) is placed between the left and the
right hand side of a rule, and stands for is represented by.
Building Algorithms with MathPack: Appendices
193
Landmark
Terminals
Terminals are not defined in terms of further grammar rules and
therefore cannot be reduced further. Each terminal is composed of
unique patterns of characters that help distinguish it from another
terminal. The patterns for each terminal are shown in the following
table. The ellipsis (...) is used to indicate a range of possible values.
Terminals
194
Representation
I
D
alphanum{alphanum | otherchar}
C
U
R
V
E
_I
D
alphanum{otherchar}
I
N
T
E
G
E
R
_
L
I
T
E
R
A
L
digit{digit}
Release 5000.0.1
User Programming
Terminals
Release 5000.0.1
Representation
R
E
A
L
_
L
I
T
E
R
A
L
{digit}.digit{digit}
B
O
O
L
E
A
N
_
L
I
T
E
R
A
L
true | false
N
U
L
L
_
L
I
T
E
R
A
L
null
195
Landmark
Terminals
196
Representation
al
p
h
a
n
u
m
di
gi
t
0 ... 9
ot
h
er
c
h
ar
V
A
R
I
A
B
L
E
symbol name
E
M
P
T
Y
<nothing>
Release 5000.0.1
User Programming
Literals
Literals stand for themselves, that is, are to be interpreted literally, and
are, in fact, terminals. Some literals are special markers and are
reserved.
Following is a list of reserved literals:
if
then
else
or
true
false
null
end
loop
variable
Release 5000.0.1
197
Landmark
User Models
Introduction
User Models is a tool that allows everyone running PetroWorks out of
the PetroWorks home directory to see and run published user-written
models. When you select Interpret > User Models from the
PetroWorks Command Menu, the following screen appears:
User Models
198
User Programming
Comments
Group Title
place holder
IMPORTANT
You must be logged in as root in order to edit the user_models.dat file.
Otherwise you will not be able to make changes to this file.
199
Landmark
Each model or group occupies a single line. Each line contains three
fields separated by the vertical bar (|) character as a delimiter:
Model Title | Application Path | PPPDF Path
Model Title
This is the title for your model. Please note that the title you choose
does not have to be identical to the actual model executable name. The
name you enter here is the name that is displayed in the Models field of
the User Models window. You can use spaces within the Model Title.
Application Path
This is the absolute path to the models executable, or .exe file. Do not
use relative path names, such as $PWHOME since doing so makes the
path dependent on system variables which can change over time,
causing your model to become invisible. This field MUST start with
a vertical bar (|) delimiter. Do not use any spaces between the bar
delimiters.
PPPDF Path
This is the absolute path to the models Petrophysical Parameter
Definition File. For the same reasons as described above, do not use
relative path names; Use the fully qualified path to the pppdf file. This
field also MUST start with a vertical bar (|) delimiter. Do not use any
spaces after the vertical bar delimiter. Also, be sure the line does not
end with a space.
Group Title
If you would like to visually separate your models into meaningful
groups, you can use Group Titles. Group titles do not correspond to any
other files and can therefore be arbitrary. Group Titles have the
following syntax:
Group Title||
Release 5000.0.1
User Models
200
User Programming
Spaces and all other characters, except the backslash (\), forward slash
(/) and vertical bar (|), are allowed in the title. \, /, and | can cause erratic
behavior of the display. You cannot have spaces immediately following
a vertical bar.
The following is an example of the user_models.dat file and four
published user models. Three of these are in a Model Group called
Bedrock Analysis:
-- User Models
--- Copyright (c) 1999, Landmark Graphics Corp.
--- Format: this file consists of entries for user models.
-- Models may be grouped for user convenience using group statements
-- Statements must follow this syntax or they will be ignored:
--- Group Title||
-- Model Title|<fully declared model path>|<fully declared pppdf path>
--- Consult your PetroWorks documentation for further information.
----------------------------------------------------------------------GOLD|/home/sebastian/Arctic/GOLD/bin/SUNSV/GOLD.exe|/home/sebastian/Arctic/mb_pppdf/GOLD.pppdf
Bedrock Analysis||
Pebbles|/home/dino/models/Pebbles/bin/SUNSV/Pebbles.exe|/home/dino/models/mb_pppdf/Pebbles.pppdf
Slate|/home/dino/models/Slate/bin/SUNSV/Slate.exe|/home/dino/models/mb_pppdf/Slate.pppdf
Rubble|/home/dino/models/mrian/bin/SUNSV/mrian.exe|/home/dino/models/mb_pppdf/mrian.pppdf
After you have edited and saved the user_modes.dat file, you can select
User Models from the PetroWorks Command Menu to view and launch
your model.When you select Interpret > User Models, PetroWorks
does the following:
Release 5000.0.1
201
Landmark
Shown below is the User Models window displayed for the example
above:
Errors
Errors and status messages are sent to the status area at the bottom of
the User Models window. The status area will hold 100 messages.
To clear the status area select View > Clear Status or place the cursor
over the status area and press MB3 and Clear.
Each time you run User Models the program creates an error file in
$HOME/run/um.err. This file catches any error messages output by
User Models.
Release 5000.0.1
User Models
202
User Programming
Index
User Programming
g
B
keywords
in Model Builder 80
D
debugging models 86
delimiters
in Model Builder 80
libraries 18
library 18
list of terminals 194
literals 197
log curves 18
log file
for model processing 91
presetting for depth-by-depth messages 91
File
Model Builder options 22
files
copying existing MDS/MDL 18
library 18
log file for model processing 91
mdl 17
MDS 17
Model Algorithm Code (or .mdl) 17
Model Data Specification (or .mds) 18
object 18
filtering in Model Builder 64
MathPack
algorithms used in Model Builder 18
MathPack error messages 181, 181-190
information messages 181
semantic errors 182
syntax errors 182
MDL file 17
MDS file 17
MDS files
editing 78
messages
model processing 91
meta-symbols 193
grammar rules 193
types of 193
Model Builder 13
delimiters 80
features of 14
files generated by 17
G
GNU
model debugger, FORTRAN compiler, C
compiler 88
Release 5000.0.1
Index
203
how it works 16
keywords 80
Main Menu 22
Model Group Directory 17
Opening, Launching 20
variables by category 49
Model Workspace 17
models
debugging your 86
sharing your 19
User Programming
literals 197
meta-symbols 193
non-terminals 193
pointing dispatcher 138
syntax rules 191-193
terminals 194
N
non-terminals 193
O
object files
used in Model Builder 18
OpenWorks
pointing dispatcher 138
P
pointing dispatcher
MathPack-specific instructions 138
project workspace
maintenance of 19
Model Builder 19
S
sample interval 137
status messages
model processing 91
T
terminals 194
definition of 194
U
User Programming 125-190
checklist 167
error messages 181
learning about MathPack syntax ??-197
Release 5000.0.1
Index
204