Académique Documents
Professionnel Documents
Culture Documents
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