Академический Документы
Профессиональный Документы
Культура Документы
User Programming
Contents
User Programming
Introduction
What Is in This Manual? ....................................................................................
ModelBuilder
Whats in This Chapter? ...................................................................................
Overview .............................................................................................................
10
11
12
13
14
15
16
17
18
18
18
R2003.12.1
Contents
User Programming
18
19
19
20
23
26
28
28
30
mb_html ...................................................................................................
30
mb_include ..............................................................................................
30
mb_lib ......................................................................................................
30
mb_obj .....................................................................................................
30
mb_pppdf ................................................................................................
30
mb_src .....................................................................................................
31
32
36
38
38
38
39
42
52
52
53
55
55
R2003.12.1
Landmark
55
60
61
62
63
63
63
65
70
70
71
71
71
72
73
74
75
76
77
77
78
Libraries ........................................................................................................
79
80
80
Information ...................................................................................................
83
84
87
R2003.12.1
User Programming
98
99
99
Landmark
R2003.12.1
10
User Programming
11
Landmark
User Models
Introduction ........................................................................................................ 193
Publishing Your Model ...................................................................................... 194
Model Title .................................................................................................... 195
Application Path ........................................................................................... 195
PPPDF Path .................................................................................................. 195
Group Title .................................................................................................... 195
Errors ............................................................................................................ 197
Index ....................................................................................................................
R2003.12.1
198
12
User Programming
Introduction
LE
PP
PA
PP
PA
PP
To access this manual online, select Help > Online Manual from the
PetroWorks Pro, PetroWorks Asset, or LogEdit Command Menu.
R2003.12.1
User Programming
Chapters
Application
PetroWorks Basics
Glossary
PetroWorks/LogEdit Project
Management
Introduction
Curve Alias List Manager
PetroWorks Preferences
Introduction
Exporting Log Data
Converting Wellbore Data
Log Export
Wellbore Data Converter
PetroWorks Data
Preparation
Introduction
Environmental Corrections
Creating a Temperature Curve
Smoothing Curves
Environmental Corrections
Temperature Curve Creation
Curve Smoothing
PetroWorks/LogEdit Well
Data Management and
Editing
Introduction
Editing Curve Data in LogEdit
Editing Wellbore Parameters
Editing StratUnits, Surfaces, and Picks
Managing Curves with Curve Utility
LogEdit
Wellbore Parameter Editor
StratUnit Editor
Curve Utility
PetroWorks Basic
Interpretive Applications
Introduction
Preliminary Reconnaissance
Log Functions
QuickInterp
Preliminary Reconnaissance
Log Functions
QuickInterp
R2003.12.1
Landmark
Chapters
Application
PetroWorks Progressive
Interpretive Applications
Introduction
Shale Volume
Complex Lithology
OnePhiSw
Shaly Sand
Dual Water
MultiMineral
Pulsed Neutron
PreMRIAN
SwbMRIAN
MRIAN
Appendix A: Water Saturation Equations
Used in Shaly Formations
PetroWorks/LogEdit User
Programming
Introduction
ModelBuilder
Building Algorithms with Mathpack
User Models
ModelBuilder
MathPack
User Models
PetroWorks/LogEdit
Visualization
Introduction
Generating Crossplots
Tabular List
Viewing Reports with Report Viewer
CrossPlot
Tabular List
Report Viewer
PetroWorks Volumetrics
Introduction
Summation
Determining Sensitivity
Summation
Sensitivity
PetroWorks Parameters
R2003.12.1
Shale Volume
Complex Lithology
OnePhiSw
Shaly Sand
Dual Water
MultiMineral
Pulsed Neutron
PreMRIAN
SwbMRIAN
MRIAN
Introduction
User Programming
StratUtils Documentation
PetroWorks/LogEdit applications share a set of project management,
data management, visualization, and mapping utilities with StratWorks.
Documentation for these utilities appears in the following StratWorks
manuals:
Section
Introduction to StratWorks
Application
Setting Up StratWorks
MapView
All
Wellbore Manager
OpenWorks Documentation
In addition to the PetroWorks/LogEdit and StratWorks manuals, you
may occasionally need to refer to several OpenWorks manuals to
perform certain tasks. These manuals include
R2003.12.1
Landmark
Manual Conventions
This manual uses certain conventions to explain how to use various
features of the program:
R2003.12.1
Menu options
key
type startow
type
projectname
Click on
Highlight
Select
Double-click
Triple-click
Introduction
10
User Programming
ModelBuilder
R2003.12.1
Overview (page 7)
Opening ModelBuilder (page 14)
Main Window Layout (page 15)
Getting Started (page 19)
Finding Your ModelBuilder Files (page 28)
Understanding the .mdl-.mds File Pair (page 32)
Designing Your Model (page 36)
Editing the .mdl File (page 38)
Editing the .mds File (page 72)
Configuring Your Model (page 75)
Building and Running a Model (page 84)
Model Data Specification Template with Keywords (page 87)
Example Models (page 98)
Recommended Reading (page 120)
User Programming
Overview
ModelBuilder 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, ModelBuilder builds an executable PetroWorks
application, that you and others can run to analyze and interpret well
log data.
ModelBuilders must know FORTRAN or C.
A working knowledge of FORTRAN 77 or C is essential for designing models with
ModelBuilder. You should also be comfortable working within the UNIX operating
system environment for the purposes of locating files and using the GNU debugger
provided with ModelBuilder.
ModelBuilder Features
R2003.12.1
Landmark
Important Features
ModelBuilder creates interpretive applications that can
R2003.12.1
ModelBuilder
User Programming
Select to launch a
published model
Whether a model is run from the ModelBuilder 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.
R2003.12.1
ModelBuilder: Overview
Landmark
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
Open ModelBuilder
Build model
optional
Process model
End
R2003.12.1
ModelBuilder
10
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
from existing MathPack files and translate to FORTRAN syntax to
preserve the essential equations and related logic.
R2003.12.1
ModelBuilder: Overview
11
Landmark
R2003.12.1
ModelBuilder
12
User Programming
Sharing Models
When using ModelBuilder, 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.
R2003.12.1
ModelBuilder: Overview
13
Landmark
Opening ModelBuilder
To open ModelBuilder from the PetroWorks launcher bar, select
Interpret > ModelBuilder:
R2003.12.1
ModelBuilder
14
User Programming
Main
menu
fields
R2003.12.1
15
Landmark
R2003.12.1
ModelBuilder
16
User Programming
R2003.12.1
17
Landmark
Model field
Model
contents
field
Status area
Status Area
ModelBuilder uses this area to keep you informed of the status of each
process.
R2003.12.1
ModelBuilder
18
User Programming
Getting Started
Before you begin using ModelBuilder, you must select a project from
OpenWorks and specify an interpreter and well listnormally 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 24 in the Introduction to
PetroWorks Family of Products manual.)
To begin working in ModelBuilder, select Interpret > ModelBuilder
from the PetroWorks Command Menu/
R2003.12.1
1.
From the menu bar, select File > Create Model Group Directory.
The following screen appears:
2.
3.
19
Landmark
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.
R2003.12.1
ModelBuilder
20
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 23).
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
R2003.12.1
21
Landmark
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
R2003.12.1
ModelBuilder
22
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 18) of the ModelBuilder main
window.
R2003.12.1
23
Landmark
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
R2003.12.1
ModelBuilder
24
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.
R2003.12.1
25
Landmark
Deleting a Model
1.
2.
3.
R2003.12.1
ModelBuilder
26
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.
R2003.12.1
5.
6.
27
Landmark
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 ModelBuilder 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).
R2003.12.1
ModelBuilder
28
User Programming
Hierarchy of ModelBuilder-generated
Subdirectories and Files
mb_html
SUNSV
mb_include
mb_lib
See More About Files
on page 30 for a
description of these files.
bin***
.exe
SGI
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. SUNSV is the
platform for Solaris, and SGI is the platform for Silicon Graphics.
R2003.12.1
29
Landmark
mb_html
When you create a model, ModelBuilder 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 ModelBuilders main menu.
mb_include
This directory is created by ModelBuilder 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 ModelBuilder as a repository for library
files that you may want to share across multiple models.
mb_obj
This directory is created by ModelBuilder 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 ModelBuilder when you build a model.
mb_src
This directory is created by ModelBuilder as a repository for source
files that you may want to share across multiple models.
R2003.12.1
ModelBuilder
30
User Programming
comment
algorithm
.mds file
data specification file
comment
31
Landmark
You will learn more about keywords in the section Editing the .mds
File on page 72.
When this model is built and run from the ModelBuilder 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
ModelBuilder 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.
R2003.12.1
ModelBuilder
32
User Programming
R2003.12.1
33
Landmark
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 ModelBuilder:
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 ModelBuilder main
window. If there are no errors, ModelBuilder builds an application user
interface with the name of your model such as the one shown on the
previous page. Clicking on the ModelBuilder 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
ModelBuilder
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
R2003.12.1
ModelBuilder
34
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 193.)
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 Alias List
Manager on page 6 of 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?
R2003.12.1
35
Landmark
4.
These questions and others are addressed in the next two sections,
Editing the .mdl File on page 38 and Editing the .mds File on
page 72. 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.
R2003.12.1
ModelBuilder
36
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:
R2003.12.1
37
Landmark
1.
Select File > Open Algorithm File (.mdl). The .mdl file shown on
the main ModelBuilder 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 23), 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:
R2003.12.1
ModelBuilder
38
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
R2003.12.1
39
Landmark
R2003.12.1
ModelBuilder
40
User Programming
In the table, numbers in parentheses refer to pages where you can find
more information on or an example of the variable.
R2003.12.1
41
Landmark
Value/Type
Model Can
Modify
Explanation
General Information
MODEL_NAME (39)
character string
no
MD_TITLE (87)
character string
no
MD_MODELTYPE (70)
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
R2003.12.1
ModelBuilder
42
User Programming
Value/Type
Explanation
Model Can
Modify
Processing Flags
MD_MDLINT (52)
TRUE or FALSE
no
MD_WELLINT (52)
TRUE or FALSE
no
MD_ZONINT (52)
TRUE or FALSE
MD_LSTMDL (52)
TRUE or FALSE
no
MD_LSTWELL (53)
TRUE or FALSE
no
MD_LSTZON (53)
TRUE or FALSE
MD_MDLEND (53)
TRUE or FALSE
yes
MD_WELLEND (57)
TRUE or FALSE
yes
MD_ZONEND (54)
TRUE or FALSE
yes
MD_MDLABORT (105)
TRUE or FALSE
yes
MD_DEPTH (57)
depth value
yes
MD_SETCUR_IN
TRUE or FALSE
yes
MD_XOTDEP (57)
depth value
yes
MD_SETCUR_OUT
TRUE or FALSE
yes
Depth Control
R2003.12.1
43
Landmark
Value/Type
Model Can
Modify
Explanation
depth value
MD_RESPONSE (87)
WEAK or
STRONG
(see rows below)
depth values
STRONG
MD_FRAME_INCREMENT (63)
R2003.12.1
no
ModelBuilder
44
User Programming
Value/Type
Explanation
Model Can
Modify
Processing Direction
MD_PROC_DIRECT
+1 or -1
(see below)
no
Processing
Direction
IS_DOWN
+1
IS_UP
-1
MD_PROC_UNIT
Measured
Depth
FEET
no
METERS
no
TRUE or FALSE
no
MD_NSMP (95)
numeric value
no
MD_NSMI (95)
numeric value
no
MD_NSMO (95)
numeric value
no
MD_INC_DEP_BY (96)
numeric value
no
MD_ISMO (96)
numeric value
no
MD_NEWPAS (56)
TRUE or FALSE
yes
numeric value
no
MD_DIRECT_FIXED
no
Multiple Sampling
Multiple Passes
R2003.12.1
45
Landmark
Value/Type
Model Can
Modify
Explanation
Curve Reconfiguration
MD_NEWSEL (106)
TRUE or FALSE
yes
MD_SETCUR_IN (56)
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 (63) 1 or 0
yes
MD_CURVE_OUT_SELECTED
(63)
1 or 0
yes
MD_CURVE_INCREMENT
depth values
yes
(for output logs
only)
MD_CURVE_SIZE
numeric value
yes
(for output logs
only)
R2003.12.1
ModelBuilder
46
User Programming
Value/Type
numeric value
Explanation
Model Can
Modify
no
yes
(for output logs
only)
MD_CURVE_MDS_2ND_NPOINTS
numeric value
no
MD_CURVE_DB_2ND_NPOINTS
numeric value
no
MD_CURVE_MDS_3RD_NPOINTS
numeric value
no
MD_CURVE_DB_3RD_NPOINTS
numeric value
no
R2003.12.1
47
Landmark
Value/Type
enumerated
strings
(see rows below)
Model Can
Modify
Explanation
Curve
CONTINUOUS_
Resampling FUNCTION
Scheme
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
R2003.12.1
ModelBuilder
48
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
(71)
numeric value
no
MD_PARNAM (71)
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
R2003.12.1
49
Landmark
Value/Type
Model Can
Modify
Explanation
no
TUNT2
no
TUNT3
no
character string
yes
Miscellaneous
CSTRNG
R2003.12.1
ModelBuilder
50
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:
R2003.12.1
51
Landmark
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
ModelBuilder
52
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 42.
R2003.12.1
53
Landmark
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.
R2003.12.1
DEPTH_UOM=FEET
DEPTH_UOM=METERS
ModelBuilder
54
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 72.
Change Depths
A powerful feature of ModelBuilder gives you control over the depths
from which data is retrieved and the depths to which data is written.
(Be sure to read How ModelBuilder Uses the .mdl File on page 38
for basic information about depth control.)
R2003.12.1
55
Landmark
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.
R2003.12.1
ModelBuilder
56
User Programming
Filtering
Most petrophysical applications process data at only one depth level at
a time. The simpler ModelBuilder applications do the same. However,
ModelBuilder 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
want to write out one sample. The following line in a .mds file writes a
R2003.12.1
57
Landmark
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.
R2003.12.1
ModelBuilder
58
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).
R2003.12.1
59
Landmark
The former is used to specify a default reference curve name for the
parameter; the latter leaves the parameter value undefined (NULL).
R2003.12.1
ModelBuilder
60
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
|
+------|-----------+-------------------------+
R2003.12.1
61
Landmark
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:
R2003.12.1
Name
Input/Output type
Unit of Measure
ModelBuilder
62
User Programming
R2003.12.1
63
Landmark
R2003.12.1
ModelBuilder
64
User Programming
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)
R2003.12.1
65
Landmark
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
|
+---------------|------------|--------|-------+
R2003.12.1
ModelBuilder
66
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 |
+---------------|------------|--------|------+
R2003.12.1
67
Landmark
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
R2003.12.1
ModelBuilder
68
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
R2003.12.1
Curves:
project
well/service/run/pass
Parameters:
project
well/service/run/pass
Process Selection:
well/service/run/pass
ModelBuilder: Editing the .mdl File
69
Landmark
.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.
R2003.12.1
ModelBuilder
70
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 19. 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.
R2003.12.1
71
Landmark
4.
When you have finished editing this file, select File > Save.
General Rules
ModelBuilder 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:
R2003.12.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.)
ModelBuilder
72
User Programming
Delimiter
Meaning
CATT (94)
CHKA (91)
CMNT (87)
no limiter
CNST (92)
Constants (Parameters)
CREF (93)
GRPN (91)
IFRAMEWORK (88)
ISMO (96)
LATT (89)
Curve attributes
LOGS (88)
Curves
NINC (96)
NSMI (95)
NSMO (95)
NSMP (95)
OPTNLIST (91)
PASS (97)
TITL (87)
R2003.12.1
73
Landmark
R2003.12.1
ModelBuilder
74
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 complied. 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 77.)
To choose a source file:
R2003.12.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.
75
Landmark
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.
R2003.12.1
1.
In the Source Files tab panel, select the source files you wish to
combine.
2.
3.
4.
ModelBuilder
76
User Programming
Once you have built a library, it appears in the Libraries window. See
Libraries on page 79 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,
R2003.12.1
1.
2.
3.
4.
77
Landmark
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 complied. 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,
R2003.12.1
1.
2.
3.
4.
ModelBuilder
78
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.
R2003.12.1
79
Landmark
To run your model using the GNU debugger, click on the Configure
button in the main ModelBuilder 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.
R2003.12.1
1.
In the main ModelBuilder 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.
ModelBuilder
80
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.
R2003.12.1
81
Landmark
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.
R2003.12.1
2.
3.
ModelBuilder
82
User Programming
2.
R2003.12.1
83
Landmark
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.
R2003.12.1
ModelBuilder
84
User Programming
R2003.12.1
85
Landmark
R2003.12.1
ModelBuilder
86
User Programming
CMNT <<IFRAMEWORK>>
MODEL EXPLICIT DEFINITION OF INPUT WORKING SAMPLE FRAMEWORK
CMNT
CMNT The IWSF can be defined by the model for all the input curves. The two types
CMNT are either "FIXED" or "USER". The USER type sets up values in the Wellbore
CMNT parameter editor, which can be changed by the user. The two possible attributes
CMNT are either based on a reference curve framework or a specified increment.
CMNT
CMNT Field 1: OPTION
CMNT
ALL
This is used to be consistent with the entry for OFRAMEWORK
CMNT
below
CMNT Field 2: TYPE
CMNT
FIXED Fixed by the model, user cannot change
CMNT
USER
User can change in the Wellbore Parameter Editor
CMNT
CMNT Field 3: ATTRIBUTE
CMNT
REFERENCE
A curve existing in the well which will provide
CMNT
information to predefine the ISWF depth points
CMNT
INCREMENT
An increment selected by the user
CMNT
CMNT Field 4: Value
CMNT
NULL:
The model writer leaves it to the user to select
CMNT
a curve or not.
CMNT
Reference curve name:
CMNT
This can be one of the input curves defined in the
CMNT
model, or any existing curve in the database.
CMNT
Aliases can be used.
CMNT
Parameter name for increment:
CMNT
This is the parameter in the Wellbore Parameter
CMNT
Editor the user can use to enter an processing
CMNT
increment. This must be a parameter defined
CMNT
as one of the CNST entries for this model.
CMNT
CMNT Example: All possible valid definitions are listed below:
CMNT|-------------+---------+-------------+----------------+
CMNT|
OPTION | TYPE
| ATTRIBUTE |
Value
|
CMNT|-------------+---------+-------------+----------------+
IFRAMEWORK| ALL | FIXED | REFERENCE |
Depth
|
IFRAMEWORK| ALL | USER
| REFERENCE |
NULL
|
IFRAMEWORK| ALL | USER
| REFERENCE |
Depth
|
IFRAMEWORK| ALL | USER
| INCREMENT |
My_increment |
CMNT|-------------+---------+-------------+----------------+
CMNT
CMNT-----------------------------------------------------------------CMNT <<LOGS>>
DATABASE CURVE DEFINITIONS
CMNT
CMNT Field 1 - CURVE NAME:
CMNT Variable name used in the model (can be assigned to a database curve)
CMNT The maximum length of a curve is 28 characters. If a curve attribute
CMNT (see CATT below) for TITLE is not defined, the name will be
CMNT used for the title (column headings, etc.).
CMNT
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 ModelBuilder. The maximum length of a unit
CMNT is 12 characters.
CMNT
CMNT Field 4 - TYPE: (obsolete)
R2003.12.1
87
Landmark
R2003.12.1
ModelBuilder
88
User Programming
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
|
LATT|BITMAP | DIMENSION3 |UNITS
| unitless
|
CMNT|-----------------+-+-----------+-+----------------------------------------|
LOGS|RHOB
|O|g/cm3
| |Bulk density
|
LATT|RHOB
| TITLE
|Bulk\n Density
|
LATT|RHOB
| OFRAMEWORK | 2
|
CMNT|-----------------+-+-----------+-+----------------------------------------+
CMNT
CMNT
CMNT <<OPTNLIST>> OPTIONAL CURVES
CMNT
CMNT OPTNLIST is the list of curves that are not required for running
CMNT the model.
CMNT
CMNT Example:
OPTNLIST,RHOB,CDE
CMNT
CMNT
CMNT-----------------------------------------------------------------CMNT <<GRPN>>
DEFINITION OF GROUP NAMES
CMNT
CMNT Group names are optional. If GRPN specification is omitted,
CMNT inclusion of group-id field in CNST definition is not required.
CMNT The parameter is included in the DEFAULT_GROUP. However, if a
CMNT group is defined, the group-id field must be included in the
CMNT definition of the pertinent parameters.
CMNT
CMNT If a group is not assigned to a particular parameter, it will not
CMNT be created in the database.
CMNT
CMNT Field 1 - NAME:
CMNT Descriptive names used by the database to group a set of parameters.
CMNT The maximum length of a group name is 40 characters. Group names
CMNT are case sensitive. Alphanumeric characters, including underscores
CMNT are permitted in names; reserved FORTRAN operators such as &, +,
CMNT /, and * are not permitted. You can build models with these
CMNT characters, but the models will not run.
CMNT
CMNT Field 2 - ID-CODE:
CMNT Code which is used by parameters for identifying groups to which
CMNT parameters will assigned. (See CNST below.)
CMNT
CMNT Field 3 - TITLE:
CMNT Descriptive text that can be used in reports and by the parameter
CMNT as column headers. Linefeeds ("\n") can be included in the text.
CMNT The maximum length of a title is 40 characters. If no title is
R2003.12.1
89
Landmark
R2003.12.1
ModelBuilder
90
User Programming
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.
CMNT See the pulldown menu in ModelBuilder. 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 ModelBuilder, 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-----------------------------------------------------------------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:
R2003.12.1
91
Landmark
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 modelbuilder
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
|
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
R2003.12.1
ModelBuilder
92
User Programming
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
CMNT number of input/output samples you wish to process. It is important
CMNT to note that arrays of log values will be delivered to the model. If the
CMNT number of output samples is not specified, it will be the same
CMNT as the number of input samples. If they are different, only
CMNT the specified number of samples is output. Any other values
CMNT in the output curve array are lost.
CMNT
CMNT You can use MD_NSMI and MD_NSMO to specify total number of input
CMNT and output samples, or define your own variable names.
CMNT
CMNT Example:
NSMI=10
NSMO=5
CMNT
CMNT|---+-----------------|
CMNT|NUM| NAME VARIABLE
|
CMNT|---+-----------------|
NSMI|10 | NUM_SAMPLES_IN |
NSMO| 5 | NUM_SAMPLES_OUT |
CMNT|---+-----------------|
CMNT
CMNT As above, depth processing advances one step at a time.
CMNT
CMNT
CMNT-----------------------------------------------------------------CMNT <<ISMO>> MULTIPLE SAMPLING OUTPUT INDEX
CMNT
CMNT Using the keywords defined above, you may also specify the output
CMNT index in the curve array. You can use MD_ISMO or define your own
CMNT index variable name.
CMNT
CMNT Example:
ISMO=3
CMNT
R2003.12.1
93
Landmark
CMNT|---+-----------------|
CMNT|NUM| NAME VARIABLE
|
CMNT|---+-----------------|
NSMI| 5 | NUM_SAMPLES_IN |
NSMO| 1 | NUM_SAMPLES_OUT |
ISMO| 3 | OUTPUT_INDEX
|
CMNT|---+-----------------|
CMNT
CMNT In this example, five log values are given to the model for processing
CMNT but you would only output one value in your array(3).
CMNT
CMNT As above depth processing advances one step at a time.
CMNT
CMNT
CMNT-----------------------------------------------------------------CMNT <<NINC>> MULTIPLE SAMPLING INCREMENT
CMNT
CMNT Instead of advancing one step, at a time, you can specify how
CMNT depth processing advances. You can also use MD_INC_DEP_BY or
CMNT define your own variable name to identify this increment.
CMNT The increment cannot be larger than the maximum number of samples
CMNT
CMNT Example:
NINC=10
CMNT
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
R2003.12.1
ModelBuilder
94
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.
R2003.12.1
95
Landmark
R2003.12.1
ModelBuilder
96
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
R2003.12.1
97
Landmark
100
ENDIF
CONTINUE
END
R2003.12.1
ModelBuilder
98
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.
99
Landmark
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
R2003.12.1
ModelBuilder
100
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
R2003.12.1
101
Landmark
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
R2003.12.1
ModelBuilder
102
User Programming
R2003.12.1
103
Landmark
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
R2003.12.1
ModelBuilder
104
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
105
Landmark
R2003.12.1
ModelBuilder
106
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
R2003.12.1
107
Landmark
R2003.12.1
ModelBuilder
108
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
INITIALIZE ARRAY
DO 5 I=1,MD_CURVE_2ND_NPOINTS(LDX_LOG2F)
LOG2F(I) = ABSENT
&
&
&
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
R2003.12.1
109
Landmark
END
R2003.12.1
ModelBuilder
110
User Programming
R2003.12.1
111
Landmark
R2003.12.1
ModelBuilder
112
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)
CONTINUE
----- Ending PROGRAM MVLC_2D ----END
113
Landmark
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)
CONTINUE
CONTINUE
----- Ending PROGRAM MVLC
----END
R2003.12.1
ModelBuilder
114
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
R2003.12.1
115
Landmark
R2003.12.1
ModelBuilder
116
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.
R2003.12.1
117
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.
R2003.12.1
121
Landmark
MathPack Features
122
R2003.12.1
User Programming
MathPack Workflow
Open MathPack
Interpret > MathPack
Close MathPack
R2003.12.1
123
Landmark
2.
3.
To Close MathPack
124
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.
R2003.12.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.
R2003.12.1
125
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.
126
R2003.12.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.
R2003.12.1
127
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
128
R2003.12.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.
R2003.12.1
129
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.
R2003.12.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.
R2003.12.1
131
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
132
R2003.12.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
R2003.12.1
133
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.
134
1.
2.
3.
R2003.12.1
User Programming
Curve
Selection
Search/Filter
Curve List
Selection
Display
Action Buttons
135
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:
136
R2003.12.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.
R2003.12.1
137
Landmark
Search/Filter
Parameter List
Selection
Display
Action Buttons
138
R2003.12.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.
R2003.12.1
139
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.
140
R2003.12.1
User Programming
Algorithm
Elements
Palette
Close button
R2003.12.1
141
Landmark
Close button
The Close button closes the Algorithm Elements window with no
further action.
142
R2003.12.1
User Programming
Main Menu
Equation
List
Equation Field
Equation
Name
Field
Action
Buttons
R2003.12.1
143
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.
144
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.
R2003.12.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.
R2003.12.1
145
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.
146
R2003.12.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.
R2003.12.1
147
Landmark
148
R2003.12.1
User Programming
Algorithm Preview
R2003.12.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.
149
Landmark
150
R2003.12.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 Raymer-HuntGardner transform:
DT DT matrix
PH I sonic = 0.625 -----------------------------------DT
R2003.12.1
151
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).
152
R2003.12.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
R2003.12.1
153
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.
154
R2003.12.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
R2003.12.1
155
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 dowhile loop.
The LOOP statement has the form:
(expressions setting initial conditions);
WHILE (expressions) LOOP
156
R2003.12.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
R2003.12.1
157
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.
158
R2003.12.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.
R2003.12.1
159
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.
R2003.12.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
R2003.12.1
161
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:
162
R2003.12.1
User Programming
R2003.12.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.
163
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
164
ABS( )
ACOS( )
ASIN( )
ATAN( )
R2003.12.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;
R2003.12.1
165
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
166
TRUE
FALSE
NULL
R2003.12.1
User Programming
Equation Name
ARCHIE
Definition
a Rmf
Sw = ---------------------m
Rxo
1
--n
ARCHIE_SXO
BVW
R2003.12.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
167
Equation Name
DEN_to_POR
Landmark
Definition
DT_to_POR
F_FACTOR
matrix b
DPHI = ---------------------------------- matrix fluid
DPHI = DPHI (density porosity)
a
F = -----m
F = F (formation factor)
a = TortuosityFactor
= Porosity
m = CementationExponent
MOVEABLE_SH
168
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
R2003.12.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
R2003.12.1
169
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
170
R2003.12.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
R2003.12.1
Units
171
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
2.2
fred
DielectricConstantMatrix
3.5
35
4.65
unitless
DielectricConstantShale
Shale Dielectric
Constant
10
55
25
unitless
EmpiricalInvasionFactor
Invasion Factor
Sw Sxo
0.5
unitless
EquivCationConductance
Equivalent
Equivalent cation conductance.
Cation
Conductance(B)
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
172
0
Diameter of the invasion of
drilling fluids into the surrounding
reservoir rock.
Units
R2003.12.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
R2003.12.1
Units
v/v
decimal
173
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
Mud Filtrate
Temperature which the resistivity 32
Resistivity Temp of the Mud Filtrate which is
(TRmf)
present in the invaded zone was
measured
500
degF
ResMudTemp
Mud Resistivity
Temp
500
degF
ResWater
ohm.m
ResWaterTemp
degF
RHGFactor
Raymer Hunt
Gardner Factor
(k)
SalinityBorehole
0.005
0.625
SalinityFormation
0.001
SalinityMudFiltrate
Mud Filtrate
Salinity
0.001
300000
SaturationExponent
Saturation
Exponent (n)
0.1
SigmaBoundWater
Bound Water
Sigma
174
ohm.m
500
Units
unitless
ppm
300000
ppm
ppm
150
unitless
cu
R2003.12.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
R2003.12.1
20
Units
175
Landmark
Parameter Name
TransitTimeSandstone
Sandstone
Transit Time
51.3
55.5
53.4
us/ft
TransitTimeShale
Acoustic Transit
Time in Shale
20
150
50
us/ft
TransitTimeWetShale
Wet Shale
Transit Time
20
150
50
us/ft
WeightCasing
Casing Weight
120
30
lbm/ft
30
15
lbm/
galUS
28
11
lbm/
galUS
WeightCement
Cement Weight
WeightMud
Mud weight
176
Units
R2003.12.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
R2003.12.1
177
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:
R2003.12.1
User Programming
current dataset
depth and sampling parameters,
the algorithm specification
R2003.12.1
179
Landmark
/2) (I)
180
R2003.12.1
User Programming
R2003.12.1
181
Landmark
182
R2003.12.1
User Programming
R2003.12.1
183
Landmark
184
R2003.12.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.
R2003.12.1
185
Landmark
186
R2003.12.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.
R2003.12.1
187
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
188
|
|
|
simple_expression|
simple_expression|
simple_expression|
simple_expression|
simple_expression|
simple_expression
|
|
|
|
R2003.12.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:
R2003.12.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
189
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
190
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}
R2003.12.1
User Programming
Terminals
R2003.12.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
191
Landmark
Terminals
192
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>
R2003.12.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
R2003.12.1
193
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
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.
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||
R2003.12.1
User Models
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:
R2003.12.1
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.
R2003.12.1
User Models
10
User Programming
Index
User Programming
g
B
building algorithms with MathPack 121-185
buttons
mouse
Button 1
clicking 5
press and drag 5
C
conventions
reference list 5
copying files in Model Builder 12, 25
D
debugging models 80
delimiters
in Model Builder 74
documentation
for OpenWorks 4
dragging
defined 5
E
error messages, see MathPack error messages
external library files
using 11, 76, 79
F
File
Model Builder options 16
files
copying existing MDS/MDL 12
library 12
log file for model processing 85
mdl 11
MDS 11
R2003.12.1
I
information messages 176
Introduction
PetroWorks and LogEdit documentation 2
introduction
conventions used in this user guide 5
K
keywords
in Model Builder 74
L
libraries 12
library 12
list of terminals 189
literals 192
log curves 12
log file
for model processing 85
presetting for depth-by-depth messages 85
Index
User Programming
MathPack
algorithms used in Model Builder 11
MathPack error messages 176, 176-185
information messages 176
semantic errors 177
syntax errors 177
MDL file 11
MDS file 11
MDS files
editing 72
messages
model processing 85
meta-symbols 188
grammar rules 188
types of 188
Model Builder 7
delimiters 74
features of 8
files generated by 11
how it works 10
keywords 74
Main Menu 16
Model Group Directory 11
Opening, Launching 14
variables by category 43
Model Workspace 11
models
debugging your 80
sharing your 13
mouse buttons
selecting items with 5
pointing dispatcher
MathPack-specific instructions 134
press and drag
defined 5
project workspace
maintenance of 13
Model Builder 13
S
sample interval 133
shortcuts
double-clicking to select data 5
triple-clicking to highlight 5
status messages
model processing 85
T
terminals 189
definition of 189
U
User Programming 121-185
checklist 163
error messages 176
learning about MathPack syntax ??-192
literals 192
meta-symbols 188
non-terminals 188
pointing dispatcher 134
syntax rules 186-188
terminals 189
non-terminals 188
O
object files
used in Model Builder 12
online documentation, accessing 1
OpenWorks
pointing dispatcher 134
R2003.12.1
Index