-
Landmark Graphics Corporation User ProgrammingUser
Programming
IntroductionWhat Is in This Manual?
....................................................................................
1
About This Manual Set
......................................................................................
2
PetroWorks/LogEdit Documentation
......................................................... 2
StratUtils Documentation
............................................................................
4
OpenWorks Documentation
........................................................................
4
Manual Conventions
....................................................................................
5
ModelBuilderWhats in This Chapter?
...................................................................................
6
Overview
.............................................................................................................
7
Important Features
.......................................................................................
8
How ModelBuilder Works
......................................................................
10
ModelBuilder Directories and Files
....................................................... 11
Source Files, Objects, and Libraries
..................................................... 12
Sharing Models
.......................................................................................
13
Opening ModelBuilder
......................................................................................
14
Main Window Layout
.........................................................................................
15
Main Menu Bar
..............................................................................................
16
Main Window Buttons
..................................................................................
17
ContentsR2003.12.1 Contents 6
Main Window Fields
.....................................................................................
18
Model Field
..............................................................................................
18
Model Contents Field
.............................................................................
18
-
Landmark Graphics Corporation User ProgrammingStatus Area
..............................................................................................
18
Getting Started
...................................................................................................
19
Creating Your Model Workspace
................................................................
19
Creating a New Model
..................................................................................
20
Copying an Existing Model
.........................................................................
23
Deleting a Model
...........................................................................................
26
Finding Your ModelBuilder Files
.....................................................................
28
Automatic Files
............................................................................................
28
More About Files
..........................................................................................
30
mb_html
...................................................................................................
30
mb_include
..............................................................................................
30
mb_lib
......................................................................................................
30
mb_obj
.....................................................................................................
30
mb_pppdf
................................................................................................
30
mb_src
.....................................................................................................
31
Understanding the .mdl-.mds File Pair
............................................................ 32
Designing Your Model
.......................................................................................
36
Editing the .mdl File
..........................................................................................
38
How ModelBuilder Uses the .mdl File
........................................................ 38
Creating and Editing the .mdl File
..............................................................
38
General Rules
...............................................................................................
39
The .mdl Reserved Variable Names and Features
.................................... 42
Processing Flags
.........................................................................................
52
Flags for Checking
.................................................................................
52
Flags to Be Set by Model
.......................................................................
53
Defining Processing Criteria
.......................................................................
55
Criteria for Automatic Determination of Model Processing
............... 55R2003.12.1 : 7
-
Landmark New Features For PetroWorksModel Controls of Processing
Criteria ................................................. 55
Input Working Sample Framework
.............................................................
60
User-Specified Reference Curve
........................................................... 61
Model Fixed Reference Curve
...............................................................
62
Model Variables in .mdl Code
................................................................
63
Runtime Curve Reselection
........................................................................
63
Curve Attributes
......................................................................................
63
Multi-valued (Multi-dimensional) Curve Data
............................................ 65
Parameter Data
.............................................................................................
70
Parameter Key Rules
..............................................................................
70
.mdl File
...................................................................................................
71
Processing Interval
.................................................................................
71
Output Curves
.........................................................................................
71
Editing the .mds File
.........................................................................................
72
General Rules
..........................................................................................
73
.mds File Keywords and Delimiters
...................................................... 74
Configuring Your Model
....................................................................................
75
Source Files
..................................................................................................
76
Compile Button
.......................................................................................
77
Build Library Button
...............................................................................
77
Object Files
...................................................................................................
78
Libraries
........................................................................................................
79
Compiler Switches
.......................................................................................
80
Debugging Your Model
..........................................................................
80
Information
...................................................................................................
83
Building and Running a Model
.........................................................................
84
Model Data Specification Template with Keywords
....................................... 87R2003.12.1 8
-
Landmark Graphics Corporation User ProgrammingExample Models
................................................................................................
98
Vertical Curve Gradient
...............................................................................
99
Gradient .mds File
..................................................................................
99
Gradient .mdl File
...................................................................................
100
Three-Point Filter with User Weights
......................................................... 102
Filter3Pt .mds File
...................................................................................
102
Filter3Pt .mdl File
....................................................................................
103
Check Processing Flags
..............................................................................
104
Check Any Depth Flag .mds File
........................................................... 104
Check Any Depth Flag .mdl File
............................................................
104
Reconfiguring Curve Selection During Runtime
....................................... 106
Checking Curve Reconfiguration Flags .mds File
............................... 106
Checking Curve Reconfiguration Flags .mdl File
................................ 106
Create 2D Output Curve
..............................................................................
108
Create 2D Log .mds File
.........................................................................
108
Create 2D Log .mdl File
..........................................................................
108
Check 2D Log Curve
....................................................................................
109
Check 2D Log .mds File
.........................................................................
109
Check 2D Log .mdl File
..........................................................................
110
Dynamically Redefine Dimensions for Output Curves
............................. 111
Dynamic 2D Log .mds File
.....................................................................
111
Dynamic 2D Log .mdl File
......................................................................
112
Multi-Valued Log Curves
.............................................................................
114
MVLC_2D .mds File
................................................................................
115
MVLC_2D .mdl File
.................................................................................
116
MVLC_3D .mds File
................................................................................
116
MVLC_3D .mdl File
.................................................................................
117R2003.12.1 : 9
-
Landmark New Features For PetroWorksExplicit Input Framework
Based on User-Specified Reference Curve ... 118
Check Input Framework - Reference Curve .mds File
......................... 118
Check Input Framework - Reference Curve .mdl File
.......................... 118
Explicit Input Framework Based on User-Specified Increment
............... 119
Check Input Framework - Explicit Increment .mdsFile
....................... 119
Check Input Framework - Explicit Increment .mdl File
....................... 119
Recommended Reading
....................................................................................
120
Building Algorithms with MathPackOverview
.............................................................................................................
121
Using MathPack
...........................................................................................
121
About this Version of MathPack
.................................................................
121
MathPack Features
......................................................................................
122
MathPack Workflow
.....................................................................................
123
Opening and Closing MathPack
.................................................................
124
To Open MathPack
.................................................................................
124
To Close MathPack
.................................................................................
124
How Do I Use MathPack?
..................................................................................
125
Creating an Algorithm
............................................................................
125
Running the Algorithm
...........................................................................
126
MathPack Window Descriptions
......................................................................
127
MathPack Main Window
..............................................................................
127
MathPack Main Window Components
.................................................. 127
Pointing Dispatcher
................................................................................
134
Log Curve Selection Window
......................................................................
135
Log Curve Selection Window Components
......................................... 135
Parameter Selection Window
......................................................................
138R2003.12.1 10
-
Landmark Graphics Corporation User ProgrammingParameter
Selection Window Components
......................................... 138
Algorithm Elements Window
......................................................................
141
Algorithm Elements Window Components
.......................................... 141
Symbolic Equations Window
......................................................................
143
Symbolic Equations Window components
.......................................... 143
Adding an Equation to the Symbolic Equations List
.......................... 144
Modifying an Existing Symbolic Equation
........................................... 145
Remarks Window
.........................................................................................
146
Remarks Window Components
.............................................................
146
Save Algorithm Window
..............................................................................
147
Saving a New Algorithm
.........................................................................
147
Saving a Previously-Saved Algorithm
.................................................. 147
Open Algorithm window
..............................................................................
149
Opening an Existing Algorithm
.............................................................
149
Building Algorithms
..........................................................................................
151
Introduction
..................................................................................................
151
A simple example
.........................................................................................
151
Algorithmic Results
.....................................................................................
153
Algorithm Component Details
....................................................................
153
Comments
...............................................................................................
153
Variable Declarations
.............................................................................
153
Statements
..............................................................................................
155
Statement Elements
...............................................................................
157
Top Twelve Check List
................................................................................
163
Appendices
........................................................................................................
164
Appendix 1: Algorithm elements with definitions
..................................... 164
Appendix 2: Pre-Defined Symbolic Equations
.......................................... 167R2003.12.1 : 11
-
Landmark New Features For PetroWorksAppendix 3: Global
(Wellbore) Parameters and Definitions .................... 170
Appendix 4: Understanding Error Messages
............................................ 176
Information Messages
............................................................................
176
Error Messages
.......................................................................................
176
Syntax Errors
..........................................................................................
177
Semantic Errors
......................................................................................
177
Explanation of Information and Error Messages
................................. 178
Appendix 5: MathPack Syntax
....................................................................
186
Non-terminals
.........................................................................................
188
Meta-symbols
..........................................................................................
188
Terminals
.................................................................................................
189
Literals
.....................................................................................................
192
User ModelsIntroduction
........................................................................................................
193
Publishing Your Model
......................................................................................
194
Model Title
....................................................................................................
195
Application Path
...........................................................................................
195
PPPDF Path
..................................................................................................
195
Group Title
....................................................................................................
195
Errors
............................................................................................................
197
Index
....................................................................................................................
198R2003.12.1 12
-
Landmark Graphics Corporation User ProgrammingIntroduction
What Is in This Manual?
This manual describes the following advanced programming
tools(available in LogEditLE; PetroWorks AssetPA;PetroWorks
ProPP):
ModelBuilder (page 6) is PetroWorks' rapid
applicationdevelopment environment, or advanced user
programmingapplication. It contains instructions for developing
models, orinterpretive applications, in ModelBuilder; that is, the
emphasis ison model writing rather than on using the created
models.
MathPack (page 121) processes user-defined algorithms
overspecified depth intervals to compute new log data.
Thesealgorithms may be stored as text files and reused. You may
useMathPack to modify existing curve data or to generate
syntheticcurves.
User Models (page 6) is a tool that allows everyone
runningPetroWorks out of the PetroWorks home directory to see and
runpublished user-written models.
To access this manual online, select Help > Online Manual
from thePetroWorks Pro, PetroWorks Asset, or LogEdit Command
Menu.
PP
LE PA PP
PPPA PPR2003.12.1 Introduction: What Is in This Manual? 6
-
Landmark Graphics Corporation User ProgrammingAbout This Manual
Set
PetroWorks/LogEdit Documentation
The PetroWorks/LogEdit documentation manual set consists of
thefollowing.
PetroWorks/LogEdit Documentation Manual Set
Book Chapters Application
Introduction to PetroWorks
Family of Products
Introduction to PetroWorks Family ofProducts
PetroWorks BasicsGlossary
Overview of PetroWorks Pro,PetroWorks Asset, and
LogEditapplications and command menusCross-application concepts
andactivities
PetroWorks/LogEdit Project
Management
IntroductionCurve Alias List ManagerPetroWorks Preferences
Curve Alias List ManagerPreferences
PetroWorks/Log Edit Data
Import, Export, and
Conversion
IntroductionExporting Log DataConverting Wellbore Data
Log ExportWellbore Data Converter
PetroWorks Data
Preparation
IntroductionEnvironmental CorrectionsCreating a Temperature
CurveSmoothing Curves
Environmental CorrectionsTemperature Curve CreationCurve
Smoothing
PetroWorks/LogEdit Well
Data Management and
Editing
IntroductionEditing Curve Data in LogEditEditing Wellbore
ParametersEditing StratUnits, Surfaces, and PicksManaging Curves
with Curve Utility
LogEditWellbore Parameter EditorStratUnit EditorCurve
Utility
PetroWorks Basic
Interpretive Applications
IntroductionPreliminary ReconnaissanceLog
FunctionsQuickInterp
Preliminary ReconnaissanceLog FunctionsQuickInterpR2003.12.1
Introduction: About This Manual Set 7
-
Landmark New Features For PetroWorksPetroWorks Progressive
Interpretive Applications
IntroductionShale VolumeComplex LithologyOnePhiSwShaly SandDual
WaterMultiMineralPulsed NeutronPreMRIANSwbMRIANMRIANAppendix A:
Water Saturation EquationsUsed in Shaly Formations
Shale VolumeComplex LithologyOnePhiSwShaly SandDual
WaterMultiMineralPulsed NeutronPreMRIANSwbMRIANMRIAN
PetroWorks/LogEdit User
Programming
IntroductionModelBuilderBuilding Algorithms with MathpackUser
Models
ModelBuilderMathPackUser Models
PetroWorks/LogEdit
Visualization
IntroductionGenerating CrossplotsTabular ListViewing Reports
with Report Viewer
CrossPlotTabular ListReport Viewer
PetroWorks Volumetrics IntroductionSummationDetermining
Sensitivity
SummationSensitivity
PetroWorks Parameters available online only; describes
theparameters required for all interpretiveapplications.
PetroWorks/LogEdit Documentation Manual Set (Continued)
Book Chapters ApplicationR2003.12.1 Introduction 8
-
Landmark Graphics Corporation User ProgrammingStratUtils
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 StratWorksmanuals:
OpenWorks Documentation
In addition to the PetroWorks/LogEdit and StratWorks manuals,
youmay occasionally need to refer to several OpenWorks manuals
toperform certain tasks. These manuals include
Using OpenWorks. Refer to this manual for an explanation of
theOpenWorks environment .
OpenWorks Data Management. Refer to this manual forinstructions
on creating and managing projects. You must create aproject with a
Cartographic Reference System (described in theProject Management
and Map Projection Editor chapters)before you can load data. This
manual also provides instructionsfor using some of the OpenWorks
utilities like the Well DataManager and Well List Manager.
OpenWorks Data Import/Export. Refer to this manual
forinstructions on how to load and transfer data between
applicationsrunning under the OpenWorks environment.
StratWorks Documentation Manual Set
Book Section Application
Introduction to StratWorks Using the Color Control Tools
Using the Marginalia EditorDefining Headers and
TrailersGenerating Lithology Log Curves
Color Control Seismic & LogVariable FillsColor Control
Contour &GeoCellularMarginalia EditorHeader/Trailer
EditorLithology Curve Generator
Setting Up StratWorks Creating and Transferring Well
TemplatesPreviewing Your Well DataCreating Stratigraphic
Columns
Well Template EditorSingle Well ViewerStrat Column Editor
Mapping and Cross Sections Creating Basemaps; Making Structure
andIsochore Maps
MapView
Wellbore Manager User
Guide
All Wellbore ManagerR2003.12.1 Introduction: About This Manual
Set 9
-
Landmark New Features For PetroWorksManual Conventions
This manual uses certain conventions to explain how to use
variousfeatures of the program:
Menu options Menu options and button names are printed
inboldface, for example, Setup.
key Press the indicated key on the keyboard, forexample,
Return.
type startow Text that you are required to type in is printedin
a different typeface (Courier).Type exactly what you see.
typeprojectname
A different typeface in italics (CourierItalics) indicates that
you are to supplyinformation. At projectname, for example,you
should enter the name of your project.
Click on Move the cursor to the option or objectspecified and
quickly press and release themouse button. Unless otherwise
specified,use Button 1.
Press and drag Press the mouse button and continue to hold
itdown while moving the cursor to the optionyou want or to a new
location in the graphicdisplay area; then release the button.
Highlight In a dialog box, move the cursor to the name ofthe
item you wish to use and select it with themouse.
Select Move the cursor to the option or object youwant to select
and click on it.
Double-click Click the mouse button twice rapidly withoutmoving
the mouse. The first click highlightsthe option, object, or text
beneath the cursor;the second click is equivalent to pressing theOK
button to accept the selection.
Triple-click Click the mouse button three times rapidlywithout
moving the mouse to highlight a stringof text (more than one word)
beneath thecursor.R2003.12.1 Introduction 10
-
Landmark Graphics Corporation User ProgrammingModelBuilder
Whats in This Chapter?
This chapter describes ModelBuilder, PetroWorks advanced
userprogramming application, which you can think of as a rapid
applicationdevelopment environment. The chapter contains
instructions fordeveloping models (better thought of as
interpretive applications) inModelBuilder. The emphasis is on model
writing rather than on usingcreated models. Using any interpretive
application involves onlyselecting the appropriate application from
the PetroWorks launcher barand proceeding as with most other
PetroWorks applicationsmany ofwhich have actually been created with
ModelBuilder.
If you are a model user (not a model writer) you can skip this
chapter,but be sure to read the introductory chapter of the
PetroWorks BasicInterpretive Applications manual.
As noted above, this chapter details the steps needed to develop
or writea model. The chapter User Models on page 193 contains
instructionsfor publishing a model, that is, placing the model in
an area accessibleto other model users who you want to be able to
use the model as well.
This chapter consists of the following sections:
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)R2003.12.1 ModelBuilder: Whats in
This Chapter? 6
-
Landmark Graphics Corporation User ProgrammingOverview
ModelBuilder allows you to design your own algorithmic
petrophysicalmodel, a mathematical description of how you want to
manipulate thephysical measurements taken from well curves. Then,
from your ownspecifications, ModelBuilder builds an executable
PetroWorksapplication, that you and others can run to analyze and
interpret welllog data.
Like MathPack, ModelBuilder provides the capability for users
tocreate customized interpretation and processing. However,
MathPack isa user programming application; whereas ModelBuilder is
a rapidapplication development environment. The differences are
detailed inthe following table.
Conceptually, applications implemented in ModelBuilder comprise
twobasic parts:
model data specification (.mds file)This is the declarative
portion, in which input and output curvesand input petrophysical
parameters are defined. This portioncontains sufficient information
for ModelBuilder to create agraphical interface for the application
to communicate to end usersand to the OpenWorks database.
model algorithm code (.mdl file)This is the procedural portion,
where algorithms and/or proceduresact upon the data (curves and
parameters) defined in thedeclarative portion (.mds file) of the
application.
ModelBuilders must know FORTRAN or C.
A working knowledge of FORTRAN 77 or C is essential for
designing models withModelBuilder. You should also be comfortable
working within the UNIX operatingsystem environment for the
purposes of locating files and using the GNU debuggerprovided with
ModelBuilder.
MathPack Features ModelBuilder Features
uses its own interpreted language uses standard FORTRAN or C
user source code is interpreted at runtime user source code is
compiled and a fully integrated application iscreated
creates no permanent files creates an executable, allowing you
to protect your intellectualproperty while at the same time
providing for distribution of thatapplication throughout your
organizationR2003.12.1 ModelBuilder: Overview 7
-
Landmark New Features For PetroWorksImportant Features
ModelBuilder creates interpretive applications that can
interact with multiple wells over multiple intervals
interface with the Wellbore Parameter Editor
define a specific depth framework for input curves.
simultaneously read and process multiple depth samples, as
forfiltering
run multiple processing passes over particular depth ranges
orstratigraphic units
dynamically redefine input depths, and turn curves off or on
process data either up or down the borehole
handle multi-dimensional data
end processing if processing conditions so warrant
import data from unconventional files
export data to external files and create reports during
processing
access libraries, objects, and subroutines during processing
Both interpretive (composite/processed) and acquisition models
can becreated.
Special Procedure for User Created Acquisition Models
Acquisition models created by users in ModelBuilder will not
process multiplepasses correctly unless a specific procedure is
followed. For more information onthis procedure, contact Customer
Support. The need for this procedure istemporary and will be
resolved in the next release of PetroWorks. At that
time,acquisition models created using this special procedure will
need to be modified.R2003.12.1 ModelBuilder 8
-
Landmark Graphics Corporation User ProgrammingIn addition, the
interpretive applications created by ModelBuilder canbe published;
that is, made available under the Interpret > UserModels
location on the launcher bar so that you and other users canhave
easy access to the applications.
Whether a model is run from the ModelBuilder menu or from the
UserModels location, it runs like any other PetroWorks
interpretiveapplication. As a model writer, you have control over
the input andoutput curves, depth framework, and parameters. Input
and outputcurve default names can be overwritten at runtime through
the use ofCurve Aliases, Curve Names, or Curve Details with the
WellboreParameter Editor. As a model writer, you also determine the
parametersthat users input, and you have the ability to specify
default, maximum,and minimum values.
Published user modelsappear here
Select to launch apublished modelR2003.12.1 ModelBuilder:
Overview 9
-
Landmark New Features For PetroWorksHow ModelBuilder Works
Before you begin using ModelBuilder, it is important to
understand thefiles that are needed and the structure of the
project workspace thatModelBuilder creates.
In the simplest case, only two files are needed to create an
interpretiveapplication from ModelBuilder.
The model algorithm code (.mdl) file is the algorithm code file
thatcontains the FORTRAN and C calls.
The model data specification (.mds) file is the data
specificationfile that specifies how Wellbore Parameter Editor
displaysinformation for this application and how it interacts with
the user.
The general workflow for building and running models is shown
below.
ModelBuilder has been constructed to minimize the interaction
that thewriter needs to have with underlying PetroWorks and
OpenWorkssystems, to the point of automatically creating the
necessarydevelopment file structures when first starting. A text
editor and variousGNU compilers and debuggers are also supplied so
that a completedevelopment system is available. Your preferred
editor, compiler, anddebuggers can be used if desired.
Open ModelBuilder
Create or modify .mdl and .mds files
Build model
Process model
Via model interface, edit parametersin Wellbore Parameter
Editor
End
Start
optionalR2003.12.1 ModelBuilder 10
-
Landmark Graphics Corporation User ProgrammingModelBuilder
Directories and Files
Your project workspace is defined by the Model Group Directories
andsubdirectories in which you create, build, and run models. Each
modelyou create has its own structured subdirectory under the Model
GroupDirectory where your model source files are located. To create
a newmodel, you must first create or select a Model Group
Directory. Thisdirectory is an area in which you can create and
store related models.You can create as many model group directories
as you need to containyour related models.
When you create a Model Group Directory, ModelBuilder creates
asubdirectory in which to store your model source files. After you
createyour model group directory and supply a name for your
model,ModelBuilder generates two essential files in the model
subdirectorythe model algorithm code (.mdl) file and the model data
specification(.mds) file. (Refer to the diagrams in Finding Your
ModelBuilderFiles on page 28 later in this chapter.) ModelBuilder
must have aminimum of one .mdl-.mds file pair before it can build a
model.
Model Algorithm Code File
The .mdl file is the file in which you write your algorithms in
standardFORTRAN (because of the use of the GNU products, it must
beFORTRAN 77). This is also referred to as the algorithm code file.
Referto the section Editing the .mdl File on page 38 for
details.
You can compose an .mdl in any text editor. You can also open
anexisting .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
algorithmsfrom existing MathPack files and translate to FORTRAN
syntax topreserve the essential equations and related logic.
Your model belongs to you.
The default permissions for accessing files in your model
directories do not allowothers to make changes or to delete created
objects or executables.
Must I code in FORTRAN?
Although you must use FORTRAN in the .mdl file, you can call C
files ofFORTRAN files from the .mdl file. Thus, you can write your
entire program in Cif you choose.
Also be aware that although you can link files from external
FORTRAN libraries,those libraries must be GNU FORTRAN complied. Do
not mix libraries builtunder GNU and other FORTRAN
compilers.R2003.12.1 ModelBuilder: Overview 11
-
Landmark New Features For PetroWorksModel Data Specification
(.mds) File
The .mds file is the file in which you specify all parameters
and curvesthe .mdl file requires. In this file, you define log
curves and theirattributes, parameters and their attributes,
parameter groupings, andseveral other model features using specific
keywords. This file providesinformation for the model interface
within Wellbore Parameter Editor(WPE). The ease of use of your
application will depend to a great dealon the effort you put into
this file, as it will impact curve and parameternames, titles, and
the interaction of WPE with the Units of Measuresystem. Refer to
the section Editing the .mds File on page 72 fordetails.
A sample .mds file format with examples of keywords and their
usagesis provided at the end of this chapter in the section Model
DataSpecification Template with Keywords on page 87.
Source Files, Objects, and Libraries
Although not required for an application, ModelBuilder increases
yourdevelopment flexibility by allowing the inclusion of:
separate source files in FORTRAN or C (source files have an .F
or.c extension)
compiled source code modules, or objects (object files have an
.oextension)
a group of objects called a library (libraries have an .a
extension)
FORTRAN include files (include files have an .inc extension)
C header files (header files have an .h extension)
See Configuring Your Model on page 75 for more details on
optionaladditions to ModelBuilder models.
Note
You can copy existing .mdl and .mds files directly into your new
model source filearea when you create a new model. Doing so
automatically generates the .mdl and.mds files you need to build
and run the copied model; however, ModelBuilderuses the model name
you selected for the new model. The Copy feature does NOTcopy
optional source and object files associated with existing .mdl/.mds
files.R2003.12.1 ModelBuilder 12
-
Landmark Graphics Corporation User ProgrammingSharing Models
When using ModelBuilder, your role may depart from
traditionalinterpretive or analytical workflows typical of the rest
of PetroWorks.As a model writer, you become, whatever your other
duties, a softwaredeveloper. Consequently, you are affected by
issues that may not beobvious to a geoscientist, such as the
creation and maintenance ofsource text files within your project
workspace.
A project workspace is meant to be used as a private area where
amodel writer can safely develop models. To minimize confusion
andinadvertent overwriting of model files, do not share your
projectworkspace with other model writers. No two writers can
predictablybuild the same model within a project workspace any more
than twopeople can share the same spreadsheet file on a PC.
It is strongly recommended that model writers agree to a policy
for howwork is to be done within a central or master workspace
whereaccepted versions of common models may be built and
copied.R2003.12.1 ModelBuilder: Overview 13
-
Landmark New Features For PetroWorksOpening ModelBuilder
To open ModelBuilder from the PetroWorks launcher bar,
selectInterpret > ModelBuilder:
The ModelBuilder main window appears:R2003.12.1 ModelBuilder
14
-
Landmark Graphics Corporation User ProgrammingMain Window
Layout
The main ModelBuilder window consists of the three major
areas:
main menu bar main window fields main window buttons
These areas are described in detail on the following pages.
Main menu bar
Mainmenufields
Main window buttonsR2003.12.1 ModelBuilder: Main Window Layout
15
-
Landmark New Features For PetroWorksMain Menu Bar
ModelBuilders main menu bar lies across the top of the screen.
Themenu bar options are:
File, which lets you
create and name a new model open a pre-existing model delete a
model create a model group directory, a workspace in which to
develop
your model update/save configuration list of source files your
model needs open the specification file, (.mds extension) open the
algorithm file, (.mdl extension) exit ModelBuilder
View, which lets you
clear the status area of messages that ModelBuilder
generates
Options, which lets you
toggle the Create FORTRAN and Includes option on or off.Turning
this option on causes the previously generated modelFORTRAN source
code (.F files) and include (.inc) file to berecompiled and
linked.
Tools, which lets you
enter the file editor, NEDIT, supplied with ModelBuilder view
the build messages screen view units of measurement view details of
global parameters run the GNU debugger and view the Man Pages,
relevant pages
from the GNU users manualR2003.12.1 ModelBuilder 16
-
Landmark Graphics Corporation User ProgrammingCommands, which
lets you
open the Configure window build your model unbuild your model
(delete all but user-created files in the model
group directory) run the current model
Main Window Buttons
The five buttons on the main window are described below. To
choose abutton function, place the cursor on the button and click
on MB1.
New lets you create and name a new model within the current
modeldirectory. This button opens the same window as File New
Modelfrom the main menu.
Open lets you see a list of existing models within a particular
directory.This button opens the same window as File Open Model from
themain menu.
Configure opens the Configure window. From this window, you
canchoose optional source files, object files, libraries, and
compilerswitches for your model. You can also review or document
informationon existing models by title and version.
Build Model lets you begin the model building process. This
button isgrayed out (desensitized) if you are not the owner of the
model.
Run lets you run your model after you have built it. This button
isgrayed out (desensitized) until a model has been successfully
built,producing a viable model application executable.R2003.12.1
ModelBuilder: Main Window Layout 17
-
Landmark New Features For PetroWorksMain Window Fields
Model Field
If you already know of an existing model that you want to use,
you cantype the pathname followed by the filename in this field
located at thetop of the ModelBuilder main window. After you create
a new model,the path and name appear in this field.
Model Contents Field
This field shows you the path and filename of the current models
.mdland .mds files, the path and filenames of any source files,
object files,and libraries, and the current compiler switch
settings.
Status Area
ModelBuilder uses this area to keep you informed of the status
of eachprocess.
Modelcontentsfield
Status area
Model fieldR2003.12.1 ModelBuilder 18
-
Landmark Graphics Corporation User ProgrammingGetting
Started
Before you begin using ModelBuilder, you must select a project
fromOpenWorks and specify an interpreter and well listnormally done
byusing the Project Status tool from the OpenWorks Command
Menu.
You must then create and save your source priority preferences
fromthe Session menu on the PetroWorks Command Menu. (Refer
toPetroWorks/LogEdit Basics on page 24 in the Introduction
toPetroWorks Family of Products manual.)
To begin working in ModelBuilder, select Interpret >
ModelBuilderfrom the PetroWorks Command Menu/
Creating Your Model Workspace
The first time you build a model, or the first time you create a
model inan area different from your current build location, you
must create orchoose a model group directory for your files. This
allowsModelBuilder to find the files it needs when it tries to
build and runyour model. To create a model group directory, follow
these steps:
1. From the menu bar, select File > Create Model Group
Directory.The following screen appears:
2. Type a name and click on the OK button to accept the
directoryname. In the sample above, we created the new model
groupdirectory Arctic.
3. Look in the status area at the bottom of the ModelBuilder
screen.A status message appears indicating that your model root
directoryhas been created:R2003.12.1 ModelBuilder: Getting Started
19
-
Landmark New Features For PetroWorksCreating a New Model
1. Click on the New button on the main window. The New
Modelwindow appears.
Note that the Model Group Directory name appears above the
newmodel name field. If this is not the directory in which you wish
tocreate 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 theNew
Model window.
5. Type the name of the new model. (Your models name mustcontain
at least 4 characters and no more than 13 characters.) Inthe sample
window above, we named our model GOLD.
6. Choose one of the two options offered by toggling on the
buttonnext to the option. When the button is green, the selection
is turnedon. Options are
Use Specification/Algorithm Template Files to use templatefiles
for the .mdl and .mds files. These files are very basicmodels. (See
Editing the .mdl File on page 38 and Editingthe .mds File on page
72.)R2003.12.1 ModelBuilder 20
-
Landmark Graphics Corporation User Programming Use/Copy existing
Specification/Algorithm Files
7. If you choose to use the template files, click on OK and skip
thenext section (Copying an Existing Model on page 23).
8. If you choose to copy existing files, read the next
section(Copying an Existing Model on page 23).
Below is a sample workflow for creating a new model and a new
modelgroup directory:
Configure
Build
Run
Yes
No
Select File Create Model Group Directoryand name the new
directory.
Edit .mdl and .mds filesusing Tools File Editor.
Select any optional source files,object files, or libraries you
want touse in your model.
Set FORTRAN and C compilerswitches.
Supply information about yourmodel.
Errors? DebugErrors?
Select File New Model and namethe new model.
Optional
Workflow to Createa New Model and aNew Model
GroupDirectoryR2003.12.1 ModelBuilder: Getting Started 21
-
Landmark New Features For PetroWorksThe diagram below shows a
sample workflow for creating a new modelin an existing
directory:
Select a different group directory.Is this
the Model GroupDirectory you want to
work in?
No
Yes
Click on the New button.
Find the directory you want
Filter
OK
Name your model.
Configure
Build
Run
Yes
No
Edit .mdl/.mds filesusing Tools File Editor.
Select any optional source files,object files, or libraries you
wantto use in your model.
Set FORTRAN and C compilerswitches.
Supply information about yourmodel.
DebugErrors?
Optional
Optional
Workflow to Createa New Model in anExisting DirectoryR2003.12.1
ModelBuilder 22
-
Landmark Graphics Corporation User ProgrammingCopying an
Existing Model
If you chose to copy an existing Specification/Algorithm file,
thefollowing screen appears:
1. If you know the file and path name of the .mdl and .mds files
youwant to use, you can type either one and click on OK. Both
filesare copied into your workspace and given the model name
youchose.
2. If you do not know the file and path name of the .mdl and
.mdsfiles 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 onOK. Both files are copied into the .mdl and .mds files that
appearin the Model Contents Field (page 18) of the ModelBuilder
mainwindow.
Copy command does not copy optional, associated source andobject
files.
The copy feature does not copy optional source and object files
associated withexisting .mdl and .mds files. To copy additional
files, you must use a standardUNIX command, such as cp, from an
xterm window.R2003.12.1 ModelBuilder: Getting Started 23
-
Landmark New Features For PetroWorksThe diagram below describes
a workflow for copying an existing modelinto your own workspace and
giving it new name.
Name your model.
Click on the New button.
Configure
Build
Run
Yes
No
Edit .mdl/.mds filesusing Tools File Editor.
Select any optional source files,object files, or libraries you
want
Set FORTRAN and C compilerswitches.
Supply information about yourmodel.
DebugErrors?
Find the .mdl or .mds file you want tocopy in the
[ModelName]_src sub-directory for that model.
Filter
OK
Select Use/Copy existingSpecification/AlgorithmFiles.
to use in your model.
Optional
Workflow to Copy anExisting Model andGive It a new Name
OptionalR2003.12.1 ModelBuilder 24
-
Landmark Graphics Corporation User ProgrammingWhen copying an
existing model, proceed from one screen to the nextusing Filter.
When you reach either the .mds or .mdl file, select it andclick on
OK to copy it into your new model area. Both files are copied.
Model Group Directory = ArcticModel Name = GOLD
GOLD subdirectoryGOLD source files are in subdirectory src
src subdirectory.mds file name = GOLD.mdsR2003.12.1
ModelBuilder: Getting Started 25
-
Landmark New Features For PetroWorksDeleting a Model
1. Select File > Delect Model.
The Delete Model dialog box appears, showing a list of
availablemodels in the currently selected Model Group
Directory:
2. Choose one of the following:
If this is the correct Model Group Directory, go to step 5.
If you wish to select a new Model Group Directory, go to step
3.
3. Choose a Model Group Directory by clicking the Select
button.R2003.12.1 ModelBuilder 26
-
Landmark Graphics Corporation User ProgrammingThe Select Model
Group Directory dialog box appears:
4. Select the Model Group Directory containing the model you
wishto delete. Press OK.
A list of available models appears in the Model List area.
5. Click on the model you wish to delete.
6. Press OK to delete the model.R2003.12.1 ModelBuilder: Getting
Started 27
-
Landmark New Features For PetroWorksFinding Your ModelBuilder
Files
If by now you have created your model workspace and have created
anew model or copied an existing model as described in
GettingStarted on page 19, ModelBuilder has generated many new
files andsubdirectories associated with the model and workspace.
You will toneed access and edit some of these files, such as the
.mdl and .mds files.Other files are for ModelBuilders use only.
The information in this section describes the files that
ModelBuildercreates and specifies the file locations with respect
to your homedirectory. The home directory in our example here is
calledhome/workerbee/cmolaro/.
Remember that ModelBuilder stores the .mds and .mdl files in
the//src subdirectory. See thefollowing diagrams.
The diagram above shows the path to the .mdl file for the model
GOLDin the model group directory Arctic.
Automatic Files
When ModelBuilder builds a model, it creates various
interdependentsource and include files in FORTRAN and C as well as
necessarysystem files for compiling and linking. These are all
stored in thissubdirectory (as shown in the following diagram).
Protect Built Models
Once a model is built, you should protect the model files from
being edited.
home/workerbee/cmolaro/Arctic/GOLD/src/GOLD.mdl
Your home directory Model GroupDirectory
ModelDirectory Source
.mdl fileModel
FilesDirectoryR2003.12.1 ModelBuilder 28
-
Landmark Graphics Corporation User ProgrammingThe diagram below
illustrates the hierarchy of ModelBuilder-generatedsubdirectories
and files:
Your Home Directory
Model Group Directory*
mb_html
mb_include
mb_lib
mb_obj
mb_pppdf
mb_src
Model**
bin***
include
lib
obj
src
.mdl
.mds
SUNSV
.exe
SGI
.exe
* 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 theplatform for Solaris, and SGI is the
platform for Silicon Graphics.
See More About Fileson page 30 for adescription of these
files.
Hierarchy of ModelBuilder-generatedSubdirectories and
FilesR2003.12.1 ModelBuilder: Finding Your ModelBuilder Files
29
-
Landmark New Features For PetroWorksMore About Files
The following six subdirectories, located directly under Model
GroupDirectory, and shown in the diagram Hierarchy of
ModelBuilder-generated Subdirectories and Files on page 29, are
generated byModelBuilder when you create a model. The files these
subdirectoriescontain are available to all models in the Model
Group Directory.Below is a description of each subdirectory.
mb_html
When you create a model, ModelBuilder generates the
mb_htmldirectory, which contains two files for each model. These
files,.html and _pl.html allow you toopen a page from your internet
browser and view the .mdl and .mdsfiles as well as any information
about the model that you entered the viathe Configure >
Information feature of ModelBuilders main menu.
mb_include
This directory is created by ModelBuilder as a repository for
includefiles that you may want to share across multiple models. You
can writeinclude files in FORTRAN or C.
mb_lib
This directory is created by ModelBuilder as a repository for
libraryfiles that you may want to share across multiple models.
mb_obj
This directory is created by ModelBuilder as a repository for
objectfiles that you may want to share across multiple models.
mb_pppdf
This directory contains the petrophysical parameters definition
filescreated by ModelBuilder when you build a model.
mb_src
This directory is created by ModelBuilder as a repository for
sourcefiles that you may want to share across multiple
models.R2003.12.1 ModelBuilder 30
-
Landmark Graphics Corporation User ProgrammingUnderstanding the
.mdl-.mds File Pair
Before delving into the details of editing .mdl and .mds files
forcontent, it is important to understand how these files work
together tobuild a model. As stated earlier, you may have other
optional filesassociated with your model, but ModelBuilder only
requires the .mdland .mds files to build a model.
This section describes how the .mdl-.mds file pair works,
ultimately togenerate an executable application with ModelBuilder.
The .mdl-.mdsfile pair shown below illustrates this process for a
simple programcalled GammaRays.
The purpose of the GammaRays program is to read in a gamma ray
logcurve named GR, add 1 to the value at each depth increment, then
writeout a new log curve called GROUT.
The first window above, GammaRays.mdl, shows the .mdl
filecontaining the FORTRAN code for the model. The second
window,GammaRays.mds, shows the input and output log curves
specifiedusing the keyword LOGS. Other keywords used above are CMNT
and$EOF, which indicate a comment and the end of the file,
respectively.
input log curveoutput log curve
end of file
comment
comment
.mds filedata specification file
.mdl filealgorithm code file
algorithmR2003.12.1 ModelBuilder: Understanding the .mdl-.mds
File Pair 31
-
Landmark New Features For PetroWorksYou will learn more about
keywords in the section Editing the .mdsFile 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 orstrat units, enter Wellbore Parameter Editor,
and process yourModelBuilder application. These processes are
illustrated in the nextexample.
The model PHID2RHOB converts density porosity to bulk
densitywhen given the input parameters of matrix density and fluid
density.The FORTRAN file, PHID2RHOB.mdl, and its corresponding
.mdsfile, PHID2RHOB.mds, are shown below followed by the
userinterface and corresponding Wellbore Parameter
windows.R2003.12.1 ModelBuilder 32
-
Landmark Graphics Corporation User ProgrammingWhen you click on
the EditParameters button on thePHID2RHOB applicationwindow, the
WellboreParameter Editor mainwindow appears. In theexample below,
the densityparameters, as specified inthe .mdl and .mds files,
areRho_fl and Rho_ma, theinput curve is PhiD, andthe output curve
is RHOB.After you have editedparameters, you can clickon the
Process button fromthe PHID2RHOBapplication window to runthe
application.R2003.12.1 ModelBuilder: Understanding the .mdl-.mds
File Pair 33
-
Landmark New Features For PetroWorksNote that more features are
present in the PHID2RHOB .mds file thanin the GammaRays .mds file.
Whereas the PHID2RHOB .mdl filecontains code familiar to a novice
FORTRAN programmer, the .mdsfile introduces the keywords unique to
ModelBuilder:
TITL VERS GRPN CNST
After you have finished creating and editing these two files,
you canclick on the Build and Run buttons from the ModelBuilder
mainwindow. If there are no errors, ModelBuilder builds an
application userinterface with the name of your model such as the
one shown on theprevious page. Clicking on the ModelBuilder Run
button causes themodel interface to display; it does not process
data. To process data,you must use the Process button on the model
interface. The followingdiagram illustrates the workflow.
EditParameters?
Process
EnterModelBuilder
.mdl file.mds file
Build
Wellbore Parameter Editor
Select parameters Select input and output curves Save
parameters
Write code for ModelBuilder Define default input/output
curves
and parameters Define UOM Define min and max (with error
handling) Design the WPE model interface
(parameter grouping and handing)
Select wells Select depth units Select processing depth
intervals
or zones Set processing direction Process model
Your Model(user interface)
Create or open models Create or modify .mds and .mdl
files Debug model (at build time)
RunR2003.12.1 ModelBuilder 34
-
Landmark Graphics Corporation User ProgrammingDesigning Your
Model
It makes no difference whether you create the .mdl file or .mds
file first.Depending on how you think about your model when you are
designingit, you may prefer to create one or the other first.
Questions you might ask yourself when you are thinking about
howyou want the model to work are
1. What is my goal? This may seem obvious, but there are at
leasttwo reasons to specify the goal of your model in a
somewhatformal 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 ListManager
on page 6 of the PetroWorks/LogEdit ProjectManagement manual.) Do I
have constants?
Are parameters shared or local? If parameters are shared,
theyare visible to, and can be used by, other users.
What do I want the user to see in the Wellbore ParameterEditor?
You can control what the model user sees in theWellbore Parameter
Editor with several keywords such asLATT (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 ModelBuilder: Designing Your
Model 35
-
Landmark New Features For PetroWorks4. How does my model process
data?
What kind of depth frameworks do I want to use: one for
allcurves, different frameworks of all inputs and outputs,
multipleframeworks for different sets of output curves?
What units of measurement do I want to use for depths,individual
curves, and parameters?
Do I need to read in data and process a set of
sequentialmultiple depths?
In which direction do I want the model to process data?
These questions and others are addressed in the next two
sections,Editing the .mdl File on page 38 and Editing the .mds File
onpage 72. You should read and thoroughly understand these
sectionsbefore attempting to build a model.
Understanding Example File Syntax
In the following sections, .mdl and .mds file code examples
areprovided. A code example might look like this:
CMNT+-------------------+----------------------+ CMNT|Option|
Type | Attribute | Value |
CMNT+----------|-----------+-------------------+IFRAMEWORK| ALL |
USER | REFERENCE |reference curve |IFRAMEWORK| ALL | USER |
REFERENCE | NULL |
CMNT+-------------------------+----------------+
Actual code entries always contain the CMNT keyword before the
fielddelimiter descriptions and the dashed lines, but in the
examples wethese 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, hereIFRAMEWORK, appears to the left of the
of the table. The other entries,here ALL, USER, REFERENCE,
reference curve, and null, consist ofallowed values that are
described in this chapter.R2003.12.1 ModelBuilder 36
-
Landmark Graphics Corporation User ProgrammingEditing the .mdl
File
How ModelBuilder Uses the .mdl File
When you write a procedure in ModelBuilder, you are writing
standardFORTRAN (or standard C, accessed from a simple FORTRAN
call).When the model is compiled, ModelBuilder is wrapping your
code intoa larger program. That larger program is the portal to the
OpenWorksdatabase and provides the user interface, including
connections to theWellbore Parameter Editor and parameter storage
in the OpenWorksdatabase.
It is important, then, to think of your code as a subroutine
runninginside a large DO loop. The loop gets the curve data and
parametersfrom the database, then calls your model. The data is
passed to themodel, which processes it, then returns control to the
loop. The processcontinues from the first depth point until the
last depth point.
Unless you use certain processing variables (specified
below),ModelBuilder will process one depth value at a time, using
only thecurve and parameter values associated with that depth.
Creating and Editing the .mdl File
Read this entire section before attempting to build your
model.
If you already have a FORTRAN file you want to use, you can copy
thenecessary code into the .mdl file. Moreover, if you have code
you wantto use in an existing FORTRAN or C file, it is best to make
the codeinto a subroutine to be called in the .mdl file.This way
the algorithmretains the original variable names, and the call to
the subroutine usesthe log names and parameters to be specified in
the .mds file.
After you have created a model group directory and a model, the
modelname and path appear in the Model Contents field as
previouslydescribed. To edit the .mdl file, follow the instructions
below:
Using Subroutines from External Libraries
Be aware that although you can link subroutines from external
FORTRANlibraries, those libraries must be GNU FORTRAN complied. Do
not mix librariesbuilt under GNU and other FORTRAN
compilers.R2003.12.1 ModelBuilder: Editing the .mdl File 37
-
Landmark New Features For PetroWorks1. Select File > Open
Algorithm File (.mdl). The .mdl file shown onthe main ModelBuilder
window opens in the NEDIT file editor.
If this is a new model rather than a copy of an existing one
(seeCopying an Existing Model on page 23), a file containing
onlytwo lines of code opens:
When you entered a name for your model, ModelBuildergenerated
this file from the template. The file editor recognizes thename you
assigned, but the file is empty except for the programname MYMODEL
and the last line of code, END.
2. Change the program name MYMODEL to the name of your
model.
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:
You must use FORTRAN 77 syntax rather than later versions ofthe
language. ModelBuilder is compatible only with FORTRAN77
syntax.
Code must start on the first line in column 7 with:PROGRAM (Note
that PROGRAM must be all caps.)
Code must end in column 7 with: END(Note that END must be all
caps.)
All executable statements must start in column 7.
Continuation symbols must appear in column 6.R2003.12.1
ModelBuilder 38
-
Landmark Graphics Corporation User Programming No line may
exceed column 72.
In order to override the standard FORTRAN default for
variabledefinitions, IMPLICIT NONE is automatically added to
thegenerated FORTRAN source file.
You can use three types of variables in the .mdl file:
logs and parametersThese are automatically declared in the
include file, which isautomatically added to the FORTRAN code.
These are alwaysdeclared as REAL. The curves may be 2 -D or
3-D.
local working variablesAny additional variables used in the code
must be declared inthe .mdl file, directly after the PROGRAM
statements. As statedpreviously, your model code is a subroutine
running inside alarge DO loop. Therefore, FORTRAN does not save the
valuesof local variables from one iteration to the next unless you
usethe SAVE statement. See the example below.
ModelBuilder reserved wordsReserved variable names are declared
in the model include fileautomatically generated by ModelBuilder
when you build themodel. Do not use any reserved ModelBuilder
variable names.These include all names specified in the .mds file,
processingflags, depth and step variables, etc. (See The .mdl
ReservedVariable Names and Features on page 42.)
There are functions that can be called by the model to get or
setcertain values in place of using model variables.
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 statementsR2003.12.1
ModelBuilder: Editing the .mdl File 39
-
Landmark New Features For PetroWorksThe following sample of code
illustrates how these features areused:R2003.12.1 ModelBuilder
40
-
Landmark Graphics Corporation User ProgrammingThe .mdl Reserved
Variable Names and Features
The .mdl FORTRAN code has access to many reserved variable
namesthat you can use to perform various tasks. Some provide
information tothe model and some are available for redefinition by
the model. Thesevariables are listed below by category and
alphabetically.
For example, for the variable MD_PROC_UNIT, the value can be
eitherFEET or METERS. An example of code is:
CHARACTER*6 PROC_UNIT
IF (MD_PROC_UNIT .EQ. 0) THEN PROC_UNIT = "FEET"ELSEIF
(MD_PROC_UNIT .EQ. 1) THEN PROC_UNIT = "METERS"ENDIF
In the table, numbers in parentheses refer to pages where you
can findmore information on or an example of the variable.
Important: Changing Model Variable Values
You should not change any variable value in the model unless it
is specificallyidentified as one that the model can modify (such as
output depth or currentdepth).R2003.12.1 ModelBuilder: Editing the
.mdl File 41
-
Landmark New Features For PetroWorks.mdl Reserved Variable Names
by Category
CategoryVariable Name Value/Type Explanation
Model CanModify
General Information
MODEL_NAME (39) character string FORTRAN constant containing
nameof model
no
MD_TITLE (87) character string FORTRAN constant containing
titleof model that appears at top of modelapplication
no
MD_MODELTYPE (70) INTERP orACQUISITION(see rows below)
FORTRAN constant indicating whichtype of model
no
INTERP 100 curves are based on project and well;parameters are
based on project, well,zone (strat unit), and zone/well
ACQUISITION 200 curves are based on project and
well/service/run/pass; parameters are basedon
well/service/run/passused for,e.g., Env Corr, MRIL models
MD_UNIT_NAME character string FORTRAN variable containing nameof
current strat unit
no
MD_WELL_NAME character string FORTRAN variable containing nameof
current well
no
MD_WELLBT depth value Bottom of well no
MD_WELLTP depth value Top of well noR2003.12.1 ModelBuilder
42
-
Landmark Graphics Corporation User ProgrammingProcessing
Flags
MD_MDLINT (52) TRUE or FALSE Is this the first sample of the
model? noMD_WELLINT (52) TRUE or FALSE Is this the first sample of
the well? noMD_ZONINT (52) TRUE or FALSE Is this the first sample
of the stratunit? noMD_LSTMDL (52) TRUE or FALSE Is this the last
sample of the model? noMD_LSTWELL (53) TRUE or FALSE Is this the
last sample of the well? noMD_LSTZON (53) TRUE or FALSE Is this the
last sample of the stratunit? noMD_MDLEND (53) TRUE or FALSE Model
sets to TRUE to cause the
model to end before completingprocessing the well
yes
MD_WELLEND (57) TRUE or FALSE Model sets to TRUE to end
wellprocessing
yes
MD_ZONEND (54) TRUE or FALSE Model sets to TRUE to cause
themodel to end before completingprocessing the unit
yes
MD_MDLABORT (105) TRUE or FALSE Model sets to TRUE to cause
themodel to abort
yes
Depth Control
MD_DEPTH (57) depth value Current input depth; whenever you
setMD_DEPTH, you must also setMD_SETCUR_IN=.TRUE.
yes
MD_SETCUR_IN TRUE or FALSE Model sets to TRUE every time
modelwants to change input depth(MD_DEPTH)
yes
MD_XOTDEP (57) depth value Current output depth; whenever youset
MD_XOTDEP, you must also setMD_SETCUR_OUT=.TRUE.
yes
MD_SETCUR_OUT TRUE or FALSE Model sets to TRUE every time
modelwants to change output depth(MD_XOTDEP)
yes
.mdl Reserved Variable Names by Category (Continued)
CategoryVariable Name Value/Type Explanation
Model CanModifyR2003.12.1 ModelBuilder: Editing the .mdl File
43
-
Landmark New Features For PetroWorksInput Sample Framework Depth
Information
MD_DEPTH depth value Current input measured depth; sameas
MD_XINDEP
no
MD_RESPONSE (87) WEAK orSTRONG(see rows below)
Response to automatically determinedinput working sample
framework
AutomaticFrameworkResponse(56) (87)
WEAK (default) 0 Constant used to determine thatincompatible,
nonresampleable curveswithin sample framework areprocessed with
warning message only
no
STRONG 1 Constant used to determine thatincompatible,
nonresampleable curveswithin sample framework abortprocessing at
the current well
no
MD_FRAME_INCREMENT (63) depth values Array of increment values
of workingsample frameworks; this is scalar.
.mdl Reserved Variable Names by Category (Continued)
CategoryVariable Name Value/Type Explanation
Model CanModifyR2003.12.1 ModelBuilder 44
-
Landmark Graphics Corporation User ProgrammingProcessing
Direction
MD_PROC_DIRECT +1 or -1(see below)
Constant for processing direction; canbe used in calculations
(+/- stepincrement), e.g.,+MD_PROC_DIRECT*MD_CURVE_INCREMENT
no
ProcessingDirection
IS_DOWN +1 FORTRAN constant used todetermine that the model is
processingfrom the top of well to bottom
no
IS_UP -1 FORTRAN constant used todetermine that the model is
processingfrom the bottom of well to top
no
MD_PROC_UNIT FEET or METERS(see rows below)
Processing unit; can be compared toFORTRAN constants FEET
orMETERS
no
MeasuredDepth
FEET 0 FORTRAN constant that can be usedto determine depth
unit
no
METERS 1 FORTRAN constant that can be usedto determine depth
unit
no
MD_DIRECT_FIXED TRUE or FALSE FORTRAN constant flag
indicatingwhether processing direction has beenfixed in model
no
Multiple Sampling
MD_NSMP (95) numeric value FORTRAN constant: Maximumnumber of
input/output samples
no
MD_NSMI (95) numeric value Number of input samples when
usingmultiple sampling
no
MD_NSMO (95) numeric value Number of output samples whenusing
multiple sampling
no
MD_INC_DEP_BY (96) numeric value Number of input samples
betweencurrent set and next sample set
no
MD_ISMO (96) numeric value Index for first output sample
whenusing multiple sampling
no
Multiple Passes
MD_NEWPAS (56) TRUE or FALSE Model sets to TRUE to start a
newinterpretive pass
yes
MD_PASS (97) (56) numeric value Number of current interpretive
pass;this is automatically incremented
no
.mdl Reserved Variable Names by Category (Continued)
CategoryVariable Name Value/Type Explanation
Model CanModifyR2003.12.1 ModelBuilder: Editing the .mdl File
45
-
Landmark New Features For PetroWorksCurve Reconfiguration
MD_NEWSEL (106) TRUE or FALSE Model sets to TRUE to indicate
thatmodel has changed the curveconfiguration
yes
MD_SETCUR_IN (56) TRUE or FALSE Indicates whether an input log
is to beread. The order is determined by theorder of the logs in
the.mds file(TRUE = yes; FALSE = no)
yes
MD_SETCUR_OUT TRUE or FALSE Indicates whether an output log is
tobe written to the well. The order isdetermined by the order of
the logs inthe .mds file(TRUE = yes; FALSE = no)
yes
Curve Information General
MD_XLNUM numeric value FORTRAN constant: Total number oflogs
needed by model
no
MD_CURVE_NAME character strings Array contains curve mnemonic
namefrom the.mds file for each log
no
MD_CURVE_INPUT_NAME character strings Array contains all actual
well inputnames for each log. If curve is notinput; value =
ABSENT
no
MD_CURVE_OUTPUT_NAME character strings Array contains all actual
well outputnames of each log. If curve is notoutput, value =
ABSENT
no
MD_CURVE_IN_SELECTED (63) 1 or 0 Array of 1s or 0s indicating
whether alog is to be read (1 = yes, 0 = no)
yes
MD_CURVE_OUT_SELECTED(63)
1 or 0 Array of 1s or 0s indicating whether alog is to be output
(1 = yes, 0 = no)
yes
MD_CURVE_INCREMENT depth values Array containing increments for
eachlog
yes(for output logsonly)
MD_CURVE_SIZE numeric value Array containing number of
samplesfor all logs. If curve is scalar, value =1; if curve is
multi-dimensional,value = 0
yes(for output logsonly)
.mdl Reserved Variable Names by Category (Continued)
CategoryVariable Name Value/Type Explanation
Model CanModifyR2003.12.1 ModelBuilder 46
-
Landmark Graphics Corporation User ProgrammingMD_CURVE_NUM_DIM
numeric value Array contains number of dimensionsfor each curve: 1,
2, or 3
no
MD_CURVE_2ND_NPOINTS (68) numeric value Array contains size of
curve seconddimension which is to actually read/created
yes(for output logsonly)
MD_CURVE_MDS_2ND_NPOINTS numeric value Array contains size of
curve seconddimension as defined in.mds file (i.e.,maximum
size)
no
MD_CURVE_DB_2ND_NPOINTS numeric value Array contains size of
curve seconddimension of input curve in database
no
MD_CURVE_3RD_NPOINTS (68) numeric value Array contains size of
curve thirddimension which is to be actuallycreated/read
yes (for outputlogs only)
MD_CURVE_MDS_3RD_NPOINTS numeric value Array contains size of
curve thirddimension as defined in.mds file (i.e.,maximum size)
no
MD_CURVE_DB_3RD_NPOINTS numeric value Array contains size of
curve thirddimension of input curve in database
no
.mdl Reserved Variable Names by Category (Continued)
CategoryVariable Name Value/Type Explanation
Model CanModifyR2003.12.1 ModelBuilder: Editing the .mdl File
47
-
Landmark New Features For
PetroWorksMD_CURVE_RESAMPLING_SCHEME
enumeratedstrings(see rows below)
Array containing curve resamplingschemes. Accepted values are
given inrows below.
For more information on these values,see the table subsection
CurveResampling Scheme below and thesection Data Framework onpage
46 of the Introduction toPetroWorks Family of Productsmanual.
yes(for output logsonly)
CurveResamplingScheme
CONTINUOUS_FUNCTION
0 Constant used to determine that theresampling scheme of a
curve iscontinuous (i.e., resampling byinterpolation)
no
SINGLE_POINT 4 Constant used to determine that theresampling
scheme of a curve is notresampleable
no
STEP_FUNCTION_TOP
1 Constant used to determine that theresampling scheme of a
curve iscontinuous (i.e., value is repeated forz index point
immediately abovecurrent point)
no
STEP_FUNCTION_BOTTOM
2 Constant used to determine that theresampling scheme of a
curve iscontinuous (i.e., the value is repeatedfor z index point
below current point)
no
STEP_FUNCTION_MIDPOINT
3 Constant used to determine that theresampling scheme of a
curve iscontinuous (i.e., value is repeated forz index point
nearest current point)
no
REQUIRED 0 Constant used to determine if curve isrequired
no
OPTIONAL 1 Constant used to determine if curve isoptional
no
MD_CURVE_OPT_REQ R or O(letter "oh")
Array containing letters indicatingwhether logs are required (R)
oroptional (O)
no
MD_CURVE_FRAME_ID numeric value Array containing framework IDs
foreach log. Default sample inputframework = 1
yes(for output logsonly)
MD_CURVE_UNIT character strings Array containing curve units
ofmeasure for each log
no
.mdl Reserved Variable Names by Category (Continued)
CategoryVariable Name Value/Type Explanation
Model CanModifyR2003.12.1 ModelBuilder 48
-
Landmark Graphics Corporation User ProgrammingMD_CURVE_2ND_UNIT
character strings Array contains units for 2nddimension component.
If curve is notmultidimensional, value = ABSENT
no
MD_CURVE_3RD_UNIT character strings Array contains units for
3rddimension component. If curve is notmultidimensional, value =
ABSENT
no
Parameter Information
MD_NUMPAR numeric value FORTRAN constant: Total number
ofparameters needed by model
no
CDX_ParameterMnemonic(71)
numeric value FORTRAN constant. Index ofParameterMnemonic in
parameterarrays
no
MD_PARNAM (71) character strings FORTRAN array containing all
theparameter names in the same order asdefined in the .mds file
no
FORTRAN, Constants and Temporary Variables
Nulls
ABSENT -999.25 FORTRAN constant to indicate no orinvalid
value
no
FILL -999.25 FORTRAN constant to indicate no orinvalid value
no
NULL -999.25 FORTRAN constant to indicate no orinvalid value
no
Measurement System
CANADIAN_METRIC 3 FORTRAN constant used todetermine that current
measurementsystem is Canadian Metric
no
SPE_METRIC 1 FORTRAN constant used todetermine that current
measurementsystem is SPE Metric
no
US_OIL_FIELD 0 FORTRAN constant used todetermine that current
measurementsystem is US Oil Field
no
US_OIL_FIELD_METRIC 2 FORTRAN constant used todetermine that
current measurementsystem is US Oil Field Metric
no
.mdl Reserved Variable Names by Category (Continued)
CategoryVariable Name Value/Type Explanation
Model CanModifyR2003.12.1 ModelBuilder: Editing the .mdl File
49
-
Landmark New Features For PetroWorksFORTRAN File Units
TUNT1 2 File unit for FORTRAN file no
TUNT2 3 File unit for FORTRAN file no
TUNT3 4 File unit for FORTRAN file no
Miscellaneous
CSTRNG character string Temporary string a model writer canuse
for any purpose to avoid having todeclare a local string
(maximumlength is 80 characters)
yes
.mdl Reserved Variable Names by Category (Continued)
CategoryVariable Name Value/Type Explanation
Model CanModifyR2003.12.1 ModelBuilder 50
-
Landmark Graphics Corporation User ProgrammingProcessing
Flags
You can use logical flags to determine the processing state at
aparticular point in your model or to change the processing state.
Thereare two types of flags:
Flags for checking Flags to be set by the model
Flags for Checking
The following flags are for information only. Do not change any
of theflags for checking.
Zone and model initialization flags are automatically set
byModelBuilder to indicate when the first sample of any zone is
beingprocessed and when the first sample of a well is being
processed. Theseare available only for checking by the model.
MD_MDLINTBeginning of model. At this point in the program,
youcan open files, do a one-time initialization, save original
curveconfigurations, etc.
The flag MD_MDLINT is TRUE only for the first sample of the
model.
MD_WELLINTBeginning of well. At this point in the program,
youcan open files, do a one-time initialization, save original
curveconfigurations, etc.
The flag MD_WELLLINT is TRUE only for the first sample of the
well.
MD_ZONINTThis section is good for initialization, setting
localvariables to interval/unit start/ends, etc. At the beginning
of eachprocessing zone the flag MD_ZONINT is set to TRUE. After the
firstiteration through the model algorithm, this flag is reset to
FALSE. It isthen reset to TRUE at the beginning of the next process
zone.
MD_PASSINTThis section is good for initialization, setting
localvariables to interval/unit start/ends, etc. for acquisition
models. At thebeginning of each acquisition model the flag
MD_ZONINT is set toTRUE. After the first iteration through the
model algorithm, this flag isreset to FALSE. It is then reset to
TRUE at the beginning of the nextmodel.
MD_LSTMDLLast sample in the units. Good time to close
files.R2003.12.1 ModelBuilder: Editing the .mdl File 51
-
Landmark New Features For PetroWorksMD_LSTWELLLast sample in
well. Good time to close external well-based files.
MD_LSTZONLast sample in the interval/unit. Good for
determining,for example, when it is time to go to the next
pass.
The diagram below illustrates how these flags function
duringprocessing. The following diagram illustrates the processing
for asingle well.
Flags to Be Set by Model
MD_MDLENDGiven certain situations (errors found for example)
youmay want to stop the model. At this point all samples, excluding
thecurrent calculated values will be output to the database.
Top Depth
Total Depth
Bottom Depth
1000 ft
9000 ft
MD_LSTWELL=TRUE
At Depths BetweenMD_WELLINT=FALSEMD_LSTWELL=FALSE
1000 ft
9000 ft
MD_LSTWELL=TRUE
User-SpecifiedDepth = 7000-8000 ft
7000 ft
8000 ft
MD_ZONINT=TRUE
MD_LSTZON=TRUE
At Depths BetweenMD_ZONINT=FALSEMD_LSTZON=FALSE
(or single unit)
Bottom Depth
1000 ft
9000 ft
MD_LSTWEL=TRUE
At Depths BetweenMD_WELLINT=FALSEMD_LSTWELL=FALSE
Two Strat Units, A & B=
8000 ft MD_LSTZON=TRUE &
MD_LSTZON=FALSE
A
B
MD_ZONINT=FALSE &MD_LSTZON=TRUE
MD_ZONINT=TRUE &
MD_ZONINT=FALSE
MD_ZONINT=TRUE &MD_LSTZON=FALSE
At Depths BetweenMD_WELLINT=FALSEMD_LSTWELL=FALSE
Beginning of Model:MD_WELLINT = TRUE
MD_WELLINT=TRUE
(All LST = FALSE)
MD_WELLINT=TRUER2003.12.1 ModelBuilder 52
-
Landmark Graphics Corporation User ProgrammingMD_ZONENDSame as
above except model continues to the next unit.
Keep in mind that once MD_MDLEND or MD_ZONEND appear in
themodel, any data created at the current depth is not output to
thedatabase. If you want the model to output the current depth
sample,then quit, you must use a local flag, turn it on/off, check
it on the nextiteration and then set MD_MDLEND or MD_ZONEND. The
local variablemust also be declared with a FORTRAN SAVE statement,
since localvariables may become reintialized at every depth
increment. Thesample of code that follows illustrates how these
flags can be used.
Some of the reserved variable names used in the sample above
have notyet been discussed. To look up a reserved variable name and
itsdefinition, refer to the table The .mdl Reserved Variable Names
andFeatures on page 42.
You must explicitly close output files.
Any output files opened in the model code must be closed
explicitly before theprogram or well end with the CLOSE command.
Otherwise, your output may notbe written to the file.R2003.12.1
ModelBuilder: Editing the .mdl File 53
-
Landmark New Features For PetroWorksDefining Processing
Criteria
Criteria for Automatic Determination of Model Processing
The user-selected set of input curves and the interval
determines the setof depths a model processes. The set of
processing depth valuesdepends on the curves Resampleability and
sample rates:
If all input curves are resampleable, the model uses the curve
withthe smallest increment as the reference curve
If one or more curves are nonresampleable, the
nonresampleablecurve with the most points becomes the reference
curve
The actual processing interval depends on the set of input
curves andthe user-selected type: Total Depth Range, Depth
Interval, or UnitSelection. The intervals top depth is the
shallowest point of any inputcurve. The bottom of the interval is
the deepest point.
Model Controls of Processing Criteria
The model can control or define the following criteria:
Depth Unit of Measurement Response to Automatically Determined
Framework Multiple Passes Processing Direction Change Depths
Filtering Define Explicit Framework
Depth Unit of Measurement
The Feet/Meters button allows users to switch back and forth
betweenfeet and meters. This function helps model writers who have
differentdata sources at different depth units.
You can specify the depth unit of measurement (UOM) to
handledepth-dependent calculations or read depths from external
files. The.mds keywords are:
DEPTH_UOM=FEET DEPTH_UOM=METERSR2003.12.1 ModelBuilder 54
-
Landmark Graphics Corporation User ProgrammingResponse to
Automatically Determined Framework
If the set of input curves contains more than one
nonresampleable,incompatible (i.e., share the same framework as the
other curves)curve, the curve with the most depth points becomes
the referencecurve (i.e., the curve that determines the output
framework).
The models response to incompatible input curve framework
iscontrolled by the .mds keyword RESPONSE. This keyword can takeone
of two values:
RESPONSE=WEAKModel reports incompatibility warning, but
continues processing(default).
RESPONSE=STRONGModel reports incompatibility error and aborts
processing well.
The response applies to the input sample framework only.
Multiple Passes
If you want your model to make multiple passes over a particular
depthinterval (defined by total depth of the well, a specified top
and bottomdepth, or by an interval previously defined as a strat
unit), you mustinclude the following code:
MD_DEPTH =(whatever local variable you have used to saveinitial
zone depth)
MD_SETCUR_IN =.TRUE.
MD_NEWPAS =.TRUE.
Change Depths
A powerful feature of ModelBuilder gives you control over the
depthsfrom which data is retrieved and the depths to which data is
written.(Be sure to read How ModelBuilder Uses the .mdl File on
page 38for basic information about depth control.)
IMPORTANT!
You must also add PASS=YES to the .mds file. See Editing the
.mds File onpage