Sie sind auf Seite 1von 112

Landmark Graphics Corporation

User Programming

ModelBuilder

Whats in This Chapter?


This chapter describes ModelBuilder, PetroWorks advanced user
programming application, which you can think of as a rapid application
development environment. The chapter contains instructions for
developing models (better thought of as interpretive applications) in
ModelBuilder. The emphasis is on model writing rather than on using
created models. Using any interpretive application involves only
selecting the appropriate application from the PetroWorks launcher bar
and proceeding as with most other PetroWorks applicationsmany of
which 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 Basic
Interpretive Applications manual.
As noted above, this chapter details the steps needed to develop or write
a model. The chapter User Models on page 193 contains instructions
for publishing a model, that is, placing the model in an area accessible
to other model users who you want to be able to use the model as well.
This chapter consists of the following sections:

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)

ModelBuilder: Whats in This Chapter?

Landmark Graphics Corporation

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.

Like MathPack, ModelBuilder provides the capability for users to


create customized interpretation and processing. However, MathPack is
a user programming application; whereas ModelBuilder is a rapid
application development environment. The differences are detailed in
the following table.
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 is


created

creates no permanent files

creates an executable, allowing you to protect your intellectual


property while at the same time providing for distribution of that
application throughout your organization

Conceptually, applications implemented in ModelBuilder comprise two


basic parts:

R2003.12.1

model data specification (.mds file)


This is the declarative portion, in which input and output curves
and input petrophysical parameters are defined. This portion
contains sufficient information for ModelBuilder to create a
graphical interface for the application to communicate to end users
and to the OpenWorks database.

model algorithm code (.mdl file)


This is the procedural portion, where algorithms and/or procedures
act upon the data (curves and parameters) defined in the
declarative portion (.mds file) of the application.
ModelBuilder: Overview

Landmark

New Features For PetroWorks

Important 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 for


filtering

run multiple processing passes over particular depth ranges or


stratigraphic 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 be


created.
Special Procedure for User Created Acquisition Models
Acquisition models created by users in ModelBuilder will not process multiple
passes correctly unless a specific procedure is followed. For more information on
this procedure, contact Customer Support. The need for this procedure is
temporary 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

Landmark Graphics Corporation

User Programming

In addition, the interpretive applications created by ModelBuilder can


be published; that is, made available under the Interpret > User
Models location on the launcher bar so that you and other users can
have easy access to the applications.

Select to launch a
published model

Published user models


appear here

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

New Features For PetroWorks

How ModelBuilder Works


Before you begin using ModelBuilder, it is important to understand the
files that are needed and the structure of the project workspace that
ModelBuilder creates.
In the simplest case, only two files are needed to create an interpretive
application from ModelBuilder.

The model algorithm code (.mdl) file is the algorithm code file that
contains the FORTRAN and C calls.

The model data specification (.mds) file is the data specification


file that specifies how Wellbore Parameter Editor displays
information for this application and how it interacts with the user.

The general workflow for building and running models is shown below.

Start

Open ModelBuilder

Create or modify .mdl and .mds files

Build model

optional

Via model interface, edit parameters


in Wellbore Parameter Editor

Process model

End

ModelBuilder has been constructed to minimize the interaction that the


writer needs to have with underlying PetroWorks and OpenWorks
systems, to the point of automatically creating the necessary
development file structures when first starting. A text editor and various
GNU compilers and debuggers are also supplied so that a complete
development system is available. Your preferred editor, compiler, and
debuggers can be used if desired.

R2003.12.1

ModelBuilder

10

Landmark Graphics Corporation

User Programming

ModelBuilder Directories and Files


Your project workspace is defined by the Model Group Directories and
subdirectories in which you create, build, and run models. Each model
you create has its own structured subdirectory under the Model Group
Directory where your model source files are located. To create a new
model, you must first create or select a Model Group Directory. This
directory is an area in which you can create and store related models.
You can create as many model group directories as you need to contain
your related models.
When you create a Model Group Directory, ModelBuilder creates a
subdirectory in which to store your model source files. After you create
your model group directory and supply a name for your model,
ModelBuilder generates two essential files in the model subdirectory
the model algorithm code (.mdl) file and the model data specification
(.mds) file. (Refer to the diagrams in Finding Your ModelBuilder
Files on page 28 later in this chapter.) ModelBuilder must have a
minimum of one .mdl-.mds file pair before it can build a model.
Your model belongs to you.
The default permissions for accessing files in your model directories do not allow
others to make changes or to delete created objects or executables.

Model Algorithm Code File


The .mdl file is the file in which you write your algorithms in standard
FORTRAN (because of the use of the GNU products, it must be
FORTRAN 77). This is also referred to as the algorithm code file. Refer
to the section Editing the .mdl File on page 38 for details.
Must I code in FORTRAN?
Although you must use FORTRAN in the .mdl file, you can call C files of
FORTRAN files from the .mdl file. Thus, you can write your entire program in C
if 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 built
under GNU and other FORTRAN compilers.

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

New Features For PetroWorks

Model Data Specification (.mds) File


The .mds file is the file in which you specify all parameters and curves
the .mdl file requires. In this file, you define log curves and their
attributes, parameters and their attributes, parameter groupings, and
several other model features using specific keywords. This file provides
information for the model interface within Wellbore Parameter Editor
(WPE). The ease of use of your application will depend to a great deal
on the effort you put into this file, as it will impact curve and parameter
names, titles, and the interaction of WPE with the Units of Measure
system. Refer to the section Editing the .mds File on page 72 for
details.
A sample .mds file format with examples of keywords and their usages
is provided at the end of this chapter in the section Model Data
Specification Template with Keywords on page 87.

Source Files, Objects, and Libraries


Although not required for an application, ModelBuilder increases your
development 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 .o


extension)

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)


Note
You can copy existing .mdl and .mds files directly into your new model source file
area 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, ModelBuilder
uses the model name you selected for the new model. The Copy feature does NOT
copy optional source and object files associated with existing .mdl/.mds files.

See Configuring Your Model on page 75 for more details on optional


additions to ModelBuilder models.

R2003.12.1

ModelBuilder

12

Landmark Graphics Corporation

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

New Features For PetroWorks

Opening ModelBuilder
To open ModelBuilder from the PetroWorks launcher bar, select
Interpret > ModelBuilder:

The ModelBuilder main window appears:

R2003.12.1

ModelBuilder

14

Landmark Graphics Corporation

User Programming

Main 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

Main
menu
fields

Main window buttons

R2003.12.1

ModelBuilder: Main Window Layout

15

Landmark

New Features For PetroWorks

Main Menu Bar


ModelBuilders main menu bar lies across the top of the screen. The
menu 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 model
FORTRAN source code (.F files) and include (.inc) file to be
recompiled and linked.

Tools, which lets you

R2003.12.1

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 manual

ModelBuilder

16

Landmark Graphics Corporation

User Programming

Commands, 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 a
button function, place the cursor on the button and click on MB1.
New lets you create and name a new model within the current model
directory. This button opens the same window as File New Model
from 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 the
main menu.
Configure opens the Configure window. From this window, you can
choose optional source files, object files, libraries, and compiler
switches for your model. You can also review or document information
on existing models by title and version.
Build Model lets you begin the model building process. This button is
grayed out (desensitized) if you are not the owner of the model.
Run lets you run your model after you have built it. This button is
grayed 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 PetroWorks

Main Window Fields


Model Field
If you already know of an existing model that you want to use, you can
type the pathname followed by the filename in this field located at the
top of the ModelBuilder main window. After you create a new model,
the path and name appear in this field.

Model field

Model
contents
field

Status area

Model Contents Field


This field shows you the path and filename of the current models .mdl
and .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 each
process.

R2003.12.1

ModelBuilder

18

Landmark Graphics Corporation

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/

Creating Your Model Workspace


The first time you build a model, or the first time you create a model in
an area different from your current build location, you must create or
choose a model group directory for your files. This allows
ModelBuilder to find the files it needs when it tries to build and run
your model. To create a model group directory, follow these steps:

R2003.12.1

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 directory


name. In the sample above, we created the new model group
directory Arctic.

3.

Look in the status area at the bottom of the ModelBuilder screen.


A status message appears indicating that your model root directory
has been created:

ModelBuilder: Getting Started

19

Landmark

New Features For PetroWorks

Creating a New Model


1.

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.

Choose one of the two options offered by toggling on the button


next to the option. When the button is green, the selection is turned
on. Options are
Use Specification/Algorithm Template Files to use template
files for the .mdl and .mds files. These files are very basic
models. (See Editing the .mdl File on page 38 and Editing
the .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 the
next 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 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.

Select File New Model and name


the new model.

Edit .mdl and .mds files


using Tools File Editor.

Optional
Select any optional source files,
object files, or libraries you want to
use in your model.

Configure

Set FORTRAN and C compiler


switches.
Supply information about your
model.

Build

Errors?
Errors?

Yes

Debug

No
Run

R2003.12.1

ModelBuilder: Getting Started

21

Landmark

New Features For PetroWorks

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

Click on the New button.

Optional
Is this
the Model Group
Directory you want to
work in?

Find the directory you want

No
Select a different group directory.

Filter
OK

Yes

Name your model.

Edit .mdl/.mds files


using Tools File Editor.

Optional
Select any optional source files,
object files, or libraries you want
to use in your model.

Configure

Set FORTRAN and C compiler


switches.
Supply information about your
model.

Yes
Build

Errors?

Debug

No
Run

R2003.12.1

ModelBuilder

22

Landmark Graphics Corporation

User Programming

Copying an Existing Model


If you chose to copy an existing Specification/Algorithm file, the
following screen appears:

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.

Copy command does not copy optional, associated source and


object files.
The copy feature does not copy optional source and object files associated with
existing .mdl and .mds files. To copy additional files, you must use a standard
UNIX command, such as cp, from an xterm window.

R2003.12.1

ModelBuilder: Getting Started

23

Landmark

New Features For PetroWorks

The diagram below describes a workflow for copying an existing model


into your own workspace and giving it new name.
Workflow to Copy an
Existing Model and
Give It a new Name

Click on the New button.

Optional

Select Use/Copy existing


Specification/Algorithm
Files.

Name your model.

Find the .mdl or .mds file you want to


copy in the [ModelName]_src subdirectory for that model.
Filter
OK

Edit .mdl/.mds files


using Tools File Editor.

Optional
Select any optional source files,
object files, or libraries you want
to use in your model.

Configure

Set FORTRAN and C compiler


switches.
Supply information about your
model.

Build

Errors?

Yes

Debug

No
Run

R2003.12.1

ModelBuilder

24

Landmark Graphics Corporation

User Programming

Model Group Directory = Arctic


Model Name = GOLD

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

ModelBuilder: Getting Started

25

Landmark

New Features For PetroWorks

Deleting a Model
1.

Select File > Delect Model.


The Delete Model dialog box appears, showing a list of available
models 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.

R2003.12.1

Choose a Model Group Directory by clicking the Select button.

ModelBuilder

26

Landmark Graphics Corporation

User Programming

The Select Model Group Directory dialog box appears:

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.

Click on the model you wish to delete.

6.

Press OK to delete the model.

ModelBuilder: Getting Started

27

Landmark

New Features For PetroWorks

Finding Your ModelBuilder Files


If by now you have created your model workspace and have created a
new model or copied an existing model as described in Getting
Started on page 19, ModelBuilder has generated many new files and
subdirectories associated with the model and workspace. You will to
need 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 ModelBuilder
creates and specifies the file locations with respect to your home
directory. The home directory in our example here is called
home/workerbee/cmolaro/.
Remember that ModelBuilder stores the .mds and .mdl files in the
<Model Group Dir>/<ModelName>/src subdirectory. See the
following diagrams.

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

Landmark Graphics Corporation

User Programming

The diagram below illustrates the hierarchy of ModelBuilder-generated


subdirectories and files:

Your Home Directory

Hierarchy of ModelBuilder-generated
Subdirectories and Files

Model Group Directory*

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

ModelBuilder: Finding Your ModelBuilder Files

29

Landmark

New Features For PetroWorks

More About Files


The following six subdirectories, located directly under Model Group
Directory, and shown in the diagram Hierarchy of ModelBuildergenerated Subdirectories and Files on page 29, are generated by
ModelBuilder when you create a model. The files these subdirectories
contain 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_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

Landmark Graphics Corporation

User Programming

Understanding the .mdl-.mds File Pair


Before delving into the details of editing .mdl and .mds files for
content, it is important to understand how these files work together to
build a model. As stated earlier, you may have other optional files
associated with your model, but ModelBuilder only requires the .mdl
and .mds files to build a model.
This section describes how the .mdl-.mds file pair works, ultimately to
generate an executable application with ModelBuilder. The .mdl-.mds
file pair shown below illustrates this process for a simple program
called GammaRays.
The purpose of the GammaRays program is to read in a gamma ray log
curve named GR, add 1 to the value at each depth increment, then write
out a new log curve called GROUT.
.mdl file
algorithm code file

comment
algorithm

.mds file
data specification file
comment

input log curve


output log curve
end of file

The first window above, GammaRays.mdl, shows the .mdl file


containing the FORTRAN code for the model. The second window,
GammaRays.mds, shows the input and output log curves specified
using the keyword LOGS. Other keywords used above are CMNT and
$EOF, which indicate a comment and the end of the file, respectively.
R2003.12.1

ModelBuilder: Understanding the .mdl-.mds File Pair

31

Landmark

New Features For PetroWorks

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

Landmark Graphics Corporation

User Programming

When you click on the Edit


Parameters button on the
PHID2RHOB application
window, the Wellbore
Parameter Editor main
window appears. In the
example below, the density
parameters, as specified in
the .mdl and .mds files, are
Rho_fl and Rho_ma, the
input curve is PhiD, and
the output curve is RHOB.
After you have edited
parameters, you can click
on the Process button from
the PHID2RHOB
application window to run
the application.

R2003.12.1

ModelBuilder: Understanding the .mdl-.mds File Pair

33

Landmark

New Features For PetroWorks

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)

Create or open models


Create or modify .mds and .mdl
files
Debug model (at build time)
.mds file

.mdl file

Edit
Parameters?

Select wells
Select depth units
Select processing depth intervals
or zones
Set processing direction
Process model

Process

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)

Build

Wellbore Parameter Editor

Select parameters
Select input and output curves
Save parameters

Run

R2003.12.1

ModelBuilder

34

Landmark Graphics Corporation

User Programming

Designing 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 designing
it, you may prefer to create one or the other first.
Questions you might ask yourself when you are thinking about how
you want the model to work are
1.

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

ModelBuilder: Designing Your Model

35

Landmark

New Features For PetroWorks

4.

How does my model process data?


What kind of depth frameworks do I want to use: one for all
curves, different frameworks of all inputs and outputs, multiple
frameworks 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 sequential
multiple 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 on
page 72. You should read and thoroughly understand these sections
before attempting to build a model.

Understanding Example File Syntax


In the following sections, .mdl and .mds file code examples are
provided. 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 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

Landmark Graphics Corporation

User Programming

Editing the .mdl File


How ModelBuilder Uses the .mdl File
When you write a procedure in ModelBuilder, you are writing standard
FORTRAN (or standard C, accessed from a simple FORTRAN call).
When the model is compiled, ModelBuilder is wrapping your code into
a larger program. That larger program is the portal to the OpenWorks
database and provides the user interface, including connections to the
Wellbore Parameter Editor and parameter storage in the OpenWorks
database.
It is important, then, to think of your code as a subroutine running
inside a large DO loop. The loop gets the curve data and parameters
from the database, then calls your model. The data is passed to the
model, which processes it, then returns control to the loop. The process
continues 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 the
curve 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 the
necessary code into the .mdl file. Moreover, if you have code you want
to use in an existing FORTRAN or C file, it is best to make the code
into a subroutine to be called in the .mdl file.This way the algorithm
retains the original variable names, and the call to the subroutine uses
the log names and parameters to be specified in the .mds file.
Using Subroutines from External Libraries
Be aware that although you can link subroutines from external FORTRAN
libraries, those libraries must be GNU FORTRAN complied. Do not mix libraries
built under GNU and other FORTRAN compilers.

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

ModelBuilder: Editing the .mdl File

37

Landmark

New Features For PetroWorks

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:

When you entered a name for your model, ModelBuilder


generated this file from the template. The file editor recognizes the
name you assigned, but the file is empty except for the program
name 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:

R2003.12.1

You must use FORTRAN 77 syntax rather than later versions of


the language. ModelBuilder is compatible only with FORTRAN
77 syntax.

Code must start on the first line in column 7 with:


PROGRAM <MODEL_NAME>
(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.

ModelBuilder

38

Landmark Graphics Corporation

User Programming

No line may exceed column 72.

In order to override the standard FORTRAN default for variable


definitions, IMPLICIT NONE is automatically added to the
generated FORTRAN source file.

You can use three types of variables in the .mdl file:


logs and parameters
These are automatically declared in the include file, which is
automatically added to the FORTRAN code. These are always
declared as REAL. The curves may be 2 -D or 3-D.
local working variables
Any additional variables used in the code must be declared in
the .mdl file, directly after the PROGRAM statements. As stated
previously, your model code is a subroutine running inside a
large DO loop. Therefore, FORTRAN does not save the values
of local variables from one iteration to the next unless you use
the SAVE statement. See the example below.
ModelBuilder reserved words
Reserved variable names are declared in the model include file
automatically generated by ModelBuilder when you build the
model. Do not use any reserved ModelBuilder variable names.
These include all names specified in the .mds file, processing
flags, depth and step variables, etc. (See The .mdl Reserved
Variable Names and Features on page 42.)
There are functions that can be called by the model to get or set
certain 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 statements

R2003.12.1

ModelBuilder: Editing the .mdl File

39

Landmark

New Features For PetroWorks

The following sample of code illustrates how these features are


used:

R2003.12.1

ModelBuilder

40

Landmark Graphics Corporation

User Programming

The .mdl Reserved Variable Names and Features


The .mdl FORTRAN code has access to many reserved variable names
that you can use to perform various tasks. Some provide information to
the model and some are available for redefinition by the model. These
variables are listed below by category and alphabetically.
For example, for the variable MD_PROC_UNIT, the value can be either
FEET 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 find
more 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 specifically
identified as one that the model can modify (such as output depth or current
depth).

R2003.12.1

ModelBuilder: Editing the .mdl File

41

Landmark

New Features For PetroWorks

.mdl Reserved Variable Names by Category


Category
Variable Name

Value/Type

Model Can
Modify

Explanation

General Information
MODEL_NAME (39)

character string

FORTRAN constant containing name


of model

no

MD_TITLE (87)

character string

FORTRAN constant containing title


of model that appears at top of model
application

no

MD_MODELTYPE (70)

INTERP or
ACQUISITION
(see rows below)

FORTRAN constant indicating which


type 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 based
on well/service/run/passused for,
e.g., Env Corr, MRIL models

MD_UNIT_NAME

character string

FORTRAN variable containing name


of current strat unit

no

MD_WELL_NAME

character string

FORTRAN variable containing name


of current well

no

MD_WELLBT

depth value

Bottom of well

no

MD_WELLTP

depth value

Top of well

no

R2003.12.1

ModelBuilder

42

Landmark Graphics Corporation

User Programming

.mdl Reserved Variable Names by Category (Continued)


Category
Variable Name

Value/Type

Explanation

Model Can
Modify

Processing Flags
MD_MDLINT (52)

TRUE or FALSE

Is this the first sample of the model?

no

MD_WELLINT (52)

TRUE or FALSE

Is this the first sample of the well?

no

MD_ZONINT (52)

TRUE or FALSE

Is this the first sample of the stratunit? no

MD_LSTMDL (52)

TRUE or FALSE

Is this the last sample of the model?

no

MD_LSTWELL (53)

TRUE or FALSE

Is this the last sample of the well?

no

MD_LSTZON (53)

TRUE or FALSE

Is this the last sample of the stratunit? no

MD_MDLEND (53)

TRUE or FALSE

Model sets to TRUE to cause the


model to end before completing
processing the well

yes

MD_WELLEND (57)

TRUE or FALSE

Model sets to TRUE to end well


processing

yes

MD_ZONEND (54)

TRUE or FALSE

Model sets to TRUE to cause the


model to end before completing
processing the unit

yes

MD_MDLABORT (105)

TRUE or FALSE

Model sets to TRUE to cause the


model to abort

yes

MD_DEPTH (57)

depth value

Current input depth; whenever you set


MD_DEPTH, you must also set
MD_SETCUR_IN=.TRUE.

yes

MD_SETCUR_IN

TRUE or FALSE

Model sets to TRUE every time model


wants to change input depth
(MD_DEPTH)

yes

MD_XOTDEP (57)

depth value

Current output depth; whenever you


set MD_XOTDEP, you must also set
MD_SETCUR_OUT=.TRUE.

yes

MD_SETCUR_OUT

TRUE or FALSE

Model sets to TRUE every time model


wants to change output depth
(MD_XOTDEP)

yes

Depth Control

R2003.12.1

ModelBuilder: Editing the .mdl File

43

Landmark

New Features For PetroWorks

.mdl Reserved Variable Names by Category (Continued)


Category
Variable Name

Value/Type

Model Can
Modify

Explanation

Input Sample Framework Depth Information


MD_DEPTH

depth value

Current input measured depth; same


as MD_XINDEP

MD_RESPONSE (87)

WEAK or
STRONG
(see rows below)

Response to automatically determined


input working sample framework

Automatic WEAK (default)


Framework
Response
(56) (87)

Constant used to determine that


no
incompatible, nonresampleable curves
within sample framework are
processed with warning message only

Constant used to determine that


no
incompatible, nonresampleable curves
within sample framework abort
processing at the current well

depth values

Array of increment values of working


sample frameworks; this is scalar.

STRONG

MD_FRAME_INCREMENT (63)

R2003.12.1

no

ModelBuilder

44

Landmark Graphics Corporation

User Programming

.mdl Reserved Variable Names by Category (Continued)


Category
Variable Name

Value/Type

Explanation

Model Can
Modify

Processing Direction
MD_PROC_DIRECT

+1 or -1
(see below)

Constant for processing direction; can


be used in calculations (+/- step
increment), e.g.,
+MD_PROC_DIRECT*MD_CURVE_
INCREMENT

no

Processing
Direction

IS_DOWN

+1

FORTRAN constant used to


no
determine that the model is processing
from the top of well to bottom

IS_UP

-1

FORTRAN constant used to


no
determine that the model is processing
from the bottom of well to top

MD_PROC_UNIT

FEET or METERS Processing unit; can be compared to


(see rows below)
FORTRAN constants FEET or
METERS

Measured
Depth

FEET

FORTRAN constant that can be used


to determine depth unit

no

METERS

FORTRAN constant that can be used


to determine depth unit

no

TRUE or FALSE

FORTRAN constant flag indicating


whether processing direction has been
fixed in model

no

MD_NSMP (95)

numeric value

FORTRAN constant: Maximum


number of input/output samples

no

MD_NSMI (95)

numeric value

Number of input samples when using


multiple sampling

no

MD_NSMO (95)

numeric value

Number of output samples when


using multiple sampling

no

MD_INC_DEP_BY (96)

numeric value

Number of input samples between


current set and next sample set

no

MD_ISMO (96)

numeric value

Index for first output sample when


using multiple sampling

no

MD_NEWPAS (56)

TRUE or FALSE

Model sets to TRUE to start a new


interpretive pass

yes

MD_PASS (97) (56)

numeric value

Number of current interpretive pass;


this is automatically incremented

no

MD_DIRECT_FIXED

no

Multiple Sampling

Multiple Passes

R2003.12.1

ModelBuilder: Editing the .mdl File

45

Landmark

New Features For PetroWorks

.mdl Reserved Variable Names by Category (Continued)


Category
Variable Name

Value/Type

Model Can
Modify

Explanation

Curve Reconfiguration
MD_NEWSEL (106)

TRUE or FALSE

Model sets to TRUE to indicate that


model has changed the curve
configuration

yes

MD_SETCUR_IN (56)

TRUE or FALSE

Indicates whether an input log is to be


read. The order is determined by the
order of the logs in the.mds file
(TRUE = yes; FALSE = no)

yes

MD_SETCUR_OUT

TRUE or FALSE

Indicates whether an output log is to


be written to the well. The order is
determined by the order of the logs in
the .mds file
(TRUE = yes; FALSE = no)

yes

MD_XLNUM

numeric value

FORTRAN constant: Total number of


logs needed by model

no

MD_CURVE_NAME

character strings

Array contains curve mnemonic name


from the.mds file for each log

no

MD_CURVE_INPUT_NAME

character strings

Array contains all actual well input


names for each log. If curve is not
input; value = ABSENT

no

MD_CURVE_OUTPUT_NAME

character strings

Array contains all actual well output


names of each log. If curve is not
output, value = ABSENT

no

MD_CURVE_IN_SELECTED (63) 1 or 0

Array of 1s or 0s indicating whether a


log is to be read (1 = yes, 0 = no)

yes

MD_CURVE_OUT_SELECTED
(63)

1 or 0

Array of 1s or 0s indicating whether a


log is to be output (1 = yes, 0 = no)

yes

MD_CURVE_INCREMENT

depth values

Array containing increments for each


log

yes
(for output logs
only)

MD_CURVE_SIZE

numeric value

Array containing number of samples


for all logs. If curve is scalar, value =
1; if curve is multi-dimensional,
value = 0

yes
(for output logs
only)

Curve Information General

R2003.12.1

ModelBuilder

46

Landmark Graphics Corporation

User Programming

.mdl Reserved Variable Names by Category (Continued)


Category
Variable Name
MD_CURVE_NUM_DIM

Value/Type
numeric value

MD_CURVE_2ND_NPOINTS (68) numeric value

Explanation

Model Can
Modify

Array contains number of dimensions


for each curve: 1, 2, or 3

no

Array contains size of curve second


dimension which is to actually read/
created

yes
(for output logs
only)

MD_CURVE_MDS_2ND_NPOINTS

numeric value

Array contains size of curve second


dimension as defined in.mds file (i.e.,
maximum size)

no

MD_CURVE_DB_2ND_NPOINTS

numeric value

Array contains size of curve second


dimension of input curve in database

no

Array contains size of curve third


dimension which is to be actually
created/read

yes (for output


logs only)

MD_CURVE_3RD_NPOINTS (68) numeric value

MD_CURVE_MDS_3RD_NPOINTS

numeric value

Array contains size of curve third


dimension as defined in.mds file (i.e.,
maximum size)

no

MD_CURVE_DB_3RD_NPOINTS

numeric value

Array contains size of curve third


dimension of input curve in database

no

R2003.12.1

ModelBuilder: Editing the .mdl File

47

Landmark

New Features For PetroWorks

.mdl Reserved Variable Names by Category (Continued)


Category
Variable Name
MD_CURVE_RESAMPLING_
SCHEME

Value/Type
enumerated
strings
(see rows below)

Model Can
Modify

Explanation

Array containing curve resampling


yes
schemes. Accepted values are given in (for output logs
rows below.
only)
For more information on these values,
see the table subsection Curve
Resampling Scheme below and the
section Data Framework on
page 46 of the Introduction to
PetroWorks Family of Products
manual.

Curve
CONTINUOUS_
Resampling FUNCTION
Scheme

Constant used to determine that the


resampling scheme of a curve is
continuous (i.e., resampling by
interpolation)

no

SINGLE_POINT

Constant used to determine that the


resampling scheme of a curve is not
resampleable

no

STEP_FUNCTION_
TOP

Constant used to determine that the


resampling scheme of a curve is
continuous (i.e., value is repeated for
z index point immediately above
current point)

no

STEP_FUNCTION_
BOTTOM

Constant used to determine that the


resampling scheme of a curve is
continuous (i.e., the value is repeated
for z index point below current point)

no

STEP_FUNCTION_
MIDPOINT

Constant used to determine that the


resampling scheme of a curve is
continuous (i.e., value is repeated for
z index point nearest current point)

no

REQUIRED

Constant used to determine if curve is


required

no

OPTIONAL

Constant used to determine if curve is


optional

no

MD_CURVE_OPT_REQ

R or O
(letter "oh")

Array containing letters indicating


whether logs are required (R) or
optional (O)

no

MD_CURVE_FRAME_ID

numeric value

Array containing framework IDs for


each log. Default sample input
framework = 1

yes
(for output logs
only)

MD_CURVE_UNIT

character strings

Array containing curve units of


measure for each log

no

R2003.12.1

ModelBuilder

48

Landmark Graphics Corporation

User Programming

.mdl Reserved Variable Names by Category (Continued)


Category
Variable Name

Value/Type

Explanation

Model Can
Modify

MD_CURVE_2ND_UNIT

character strings

Array contains units for 2nd


dimension component. If curve is not
multidimensional, value = ABSENT

no

MD_CURVE_3RD_UNIT

character strings

Array contains units for 3rd


dimension component. If curve is not
multidimensional, value = ABSENT

no

MD_NUMPAR

numeric value

FORTRAN constant: Total number of


parameters needed by model

no

CDX_ParameterMnemonic
(71)

numeric value

FORTRAN constant. Index of


ParameterMnemonic in parameter
arrays

no

MD_PARNAM (71)

character strings

FORTRAN array containing all the


parameter names in the same order as
defined in the .mds file

no

Parameter Information

FORTRAN, Constants and Temporary Variables


Nulls
ABSENT

-999.25

FORTRAN constant to indicate no or


invalid value

no

FILL

-999.25

FORTRAN constant to indicate no or


invalid value

no

NULL

-999.25

FORTRAN constant to indicate no or


invalid value

no

CANADIAN_METRIC

FORTRAN constant used to


determine that current measurement
system is Canadian Metric

no

SPE_METRIC

FORTRAN constant used to


determine that current measurement
system is SPE Metric

no

US_OIL_FIELD

FORTRAN constant used to


determine that current measurement
system is US Oil Field

no

US_OIL_FIELD_METRIC

FORTRAN constant used to


determine that current measurement
system is US Oil Field Metric

no

Measurement System

R2003.12.1

ModelBuilder: Editing the .mdl File

49

Landmark

New Features For PetroWorks

.mdl Reserved Variable Names by Category (Continued)


Category
Variable Name

Value/Type

Model Can
Modify

Explanation

FORTRAN File Units


TUNT1

File unit for FORTRAN file

no

TUNT2

File unit for FORTRAN file

no

TUNT3

File unit for FORTRAN file

no

character string

Temporary string a model writer can


use for any purpose to avoid having to
declare a local string (maximum
length is 80 characters)

yes

Miscellaneous
CSTRNG

R2003.12.1

ModelBuilder

50

Landmark Graphics Corporation

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:

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 the
flags for checking.
Zone and model initialization flags are automatically set by
ModelBuilder to indicate when the first sample of any zone is being
processed and when the first sample of a well is being processed. These
are available only for checking by the model.
MD_MDLINTBeginning of model. At this point in the program, you
can open files, do a one-time initialization, save original curve
configurations, 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, you
can open files, do a one-time initialization, save original curve
configurations, etc.
The flag MD_WELLLINT is TRUE only for the first sample of the well.
MD_ZONINTThis section is good for initialization, setting local
variables to interval/unit start/ends, etc. At the beginning of each
processing zone the flag MD_ZONINT is set to TRUE. After the first
iteration through the model algorithm, this flag is reset to FALSE. It is
then reset to TRUE at the beginning of the next process zone.
MD_PASSINTThis section is good for initialization, setting local
variables to interval/unit start/ends, etc. for acquisition models. At the
beginning of each acquisition model the flag MD_ZONINT is set to
TRUE. After the first iteration through the model algorithm, this flag is
reset to FALSE. It is then reset to TRUE at the beginning of the next
model.
MD_LSTMDLLast sample in the units. Good time to close files.

R2003.12.1

ModelBuilder: Editing the .mdl File

51

Landmark

New Features For PetroWorks

MD_LSTWELLLast sample in well. Good time to close external wellbased 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 during
processing. The following diagram illustrates the processing for a
single well.
User-SpecifiedDepth = 7000-8000 ft

Total Depth
Beginning of Model:
MD_WELLINT = TRUE
1000 ft

(or single unit)


1000 ft

Top Depth

Two Strat Units, A & =


B
1000 ft

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

Flags to Be Set by Model


MD_MDLENDGiven certain situations (errors found for example) you
may want to stop the model. At this point all samples, excluding the
current calculated values will be output to the database.
R2003.12.1

ModelBuilder

52

Landmark Graphics Corporation

User Programming

MD_ZONENDSame as above except model continues to the next unit.


Keep in mind that once MD_MDLEND or MD_ZONEND appear in the
model, any data created at the current depth is not output to the
database. 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 next
iteration and then set MD_MDLEND or MD_ZONEND. The local variable
must also be declared with a FORTRAN SAVE statement, since local
variables may become reintialized at every depth increment. The
sample of code that follows illustrates how these flags can be used.
You must explicitly close output files.
Any output files opened in the model code must be closed explicitly before the
program or well end with the CLOSE command. Otherwise, your output may not
be written to the file.

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

ModelBuilder: Editing the .mdl File

53

Landmark

New Features For PetroWorks

Defining Processing Criteria


Criteria for Automatic Determination of Model Processing
The user-selected set of input curves and the interval determines the set
of depths a model processes. The set of processing depth values
depends on the curves Resampleability and sample rates:

If all input curves are resampleable, the model uses the curve with
the smallest increment as the reference curve

If one or more curves are nonresampleable, the nonresampleable


curve with the most points becomes 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.

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 between
feet and meters. This function helps model writers who have different
data sources at different depth units.
You can specify the depth unit of measurement (UOM) to handle
depth-dependent calculations or read depths from external files. The
.mds keywords are:

R2003.12.1

DEPTH_UOM=FEET
DEPTH_UOM=METERS

ModelBuilder

54

Landmark Graphics Corporation

User Programming

Response 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 reference
curve (i.e., the curve that determines the output framework).
The models response to incompatible input curve framework is
controlled by the .mds keyword RESPONSE. This keyword can take
one of two values:

RESPONSE=WEAK
Model reports incompatibility warning, but continues processing
(default).

RESPONSE=STRONG
Model 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 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

ModelBuilder: Editing the .mdl File

55

Landmark

New Features For PetroWorks

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

Landmark Graphics Corporation

User Programming

Change Depths Example


In this example the interval or strat unit starts at 1000 feet, the depth
increment is 0.5 feet, and processing is in a downward direction.
Initially, log curve data is sent to your model from 1000 feet. You want
to compare the GR value at the current depth, 1000 feet, to the value 10
feet deeper. When your model starts, MD_DEPTH will be 1000 feet.
Within your program, you can reset MD_DEPTH = 1010 feet and
then read in the GR value.
Perhaps you wish to average the two GR values and then output the
average to a depth half way between 1000 feet and 1010 feet. Initially,
MD_XOTDEP will be set to the initial depth, 1000 feet. If you do not
reset MD_XOTDEP, your answer (in this case, the average of the GR at
1000 feet and 1010 feet) will be written to the output curve at 1000 feet,
since this is the value of MD_XOTDEP set by ModelBuilder when your
model initially ran. You can, however, set MD_XOTDEP = 1005 feet,
which is half way between your depths. When you set MD_XOTDEP =
1005, this tells ModelBuilder to output your answer to 1005 feet and
not the current depth which is 1000 feet.
Let us say you are now finished with the all your calculations at the
current depth. You need to reset MD_XOTDEP = ABSENT so when the
depth is incremented and a new set of log curve values is passed to your
model, ModelBuilder will then resume control of the depth and begin
use using 1000.5 feet as its current depth. Likewise you must reset
MD_XOTDEP = ABSENT at the end of your model to allow outputting
of any new data to the next incremental depth.

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

ModelBuilder: Editing the .mdl File

57

Landmark

New Features For PetroWorks

single sample, as well as assigns that value to a variable


(NumSamplesOut) accessible in the .mdl file:
NSMO| 1 | NumSamplesOut |

Recall that the model user can specify the direction in which the model
processes data. Assume that the direction is set to Down, and you have
the following Depths and GR values:
Depth
Current Depth Level-->1000.0
1000.5
1001.0
1001.5
1002.0
1002.5
1003.0
1004.5
1005.0

GR

Output Index

75.2
82.5
65.2
55.6
45.8
34.2
29.9
21.1
19.6

| 1
| 2
| 3

<-- Depth we want to write out

If the current depth level the application is processing is 1000.0 feet.,


the application will read in log values for the depths 1000.0, 1000.5,
and 1001.0. If we filter the log data vertically, we would average the
three log values over those three depths, but we would want to write out
the averaged (filtered) value at a depth in the middle of the three depths
we read in, for example, at 1000.5.
Do that by declaring another variable ISMO, the Multiple Sampling
Output Index, in our .mds file:
ISMO| 2 | OutputIndex

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

Landmark Graphics Corporation

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

When processing multiple depth levels, ModelBuilder reads log values


into an array of size NSMI. We can refer to those log values in that
array by putting the number of the array element in parenthesis next to
the name of the input or output curve. Assuming that we have read the
input log in as GR, a simple equal weighted filter routine in the .mdl file
would look like this:
GR_FILTER(OutputIndex) = (GR(1) +GR(2) + GR(3))/3

The following would have the same effect:


GR_FILTER(2) = (GR(1) +GR(2) + GR(3))/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).

Input Working Sample Framework


For a complete discusion of sample frameworks, see Data
Framework on page 46 in the PetroWorks Basics chapter of the
Introduction to PetroWorks Family of Products manual.
The input working sample framework is usually set to the smallest
increment (sample rate) of the set of input curves. However, if the set
includes a nonresampleable curve, the working sample framework for
the set is based on the nonresampleable curve. If there is more than one
nonresampleable curve in the set, the working sample framework is
based on the curve with the greatest number of samples.
The only explicit option for an input framework is ALL.

R2003.12.1

ModelBuilder: Editing the .mdl File

59

Landmark

New Features For PetroWorks

User-Specified Reference Curve


You can allow users to specify a reference curve using an automatically
generated parameter in the Wellbore Parameter Editor. Reference
curves are included in the reference curve group. You can also provide
a default value for that parameter (i.e., the default reference curve
name) if you choose. If no default value is specified, the default
parameter value is <NULL>. It is important to note that the default
name, if specified, can be the same as one of the input curve
mnemonics in the.mds file (as defined by a LOGS keyword entry) or
any existing curve in the well. The input reference curve must exist in
the well.
During processing, if a user accepts the default reference curve name,
the .mds curve mnemonics are searched for a match. If found, the well
curve name selected by the user in the Wellbore Parameter Editor for
that .mds curve mnemonic becomes the working reference curve. If not
found, then that mnemonic is assumed to correspond to a curve existing
in the well.
During runtime, the model validates that the reference curve, as
resolved above, exists in the well. If it exists, its framework is evaluated
for compatibility with the input curve frameworks. If the input curve
frameworks are resampleable or compatible nonresampleable,
processing continues, and the inputs are resampled as necessary. If the
input curve frameworks are not compatible with the reference curve,
processing continues on the basis of the value of the RESPONSE
keyword.
If the value of the reference curve parameter is NULL, the working
sample framework is automatically determined.
These behaviors are controlled with the IFRAMEWORK .mds keyword
and the USER framework type:
+-------------------+----------------------+
|Option| Type | Attribute | Value
|
+----------|-----------+-------------------+
IFRAMEWORK| ALL | USER | REFERENCE |reference curve |
IFRAMEWORK| ALL | USER | REFERENCE | NULL
|
+------------------------+-----------------+

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

Landmark Graphics Corporation

User Programming

Model Fixed Reference Curve


You can define the reference curve in the .mds file and hide that curve
from the user. It is important to note the defined reference curve must
match an existing curve in the well. The reference curve mnemonic can
also match one of the input curve mnemonics in the .mds file.
During processing, the .mds input mnemonics are searched for a match
to the predefined reference curve. If found, the input curve name
specified by the user in the Wellbore Parameter Editor for that .mds
curve mnemonic (as defined by a LOGS keyword entry) becomes the
working reference curve. If not found, then that mnemonic is assumed
to correspond to a curve existing in the well.
If the reference curve exists in the well, the model evaluates the
compatibility of the reference curve framework and the input curve
frameworks. If the frameworks are resampleable or are
nonresampleable but compatible, processing continues and the inputs
are resampled as necessary. If the frameworks are incompatible and
nonresampleable, processing continues on the basis of the value of the
RESPONSE keyword.
If the named reference curve cannot be resolved in the well, processing
is terminated for the well, and an appropriate error message is written
to the model status window.
The .mds syntax options for this case are the IFRAMEWORK keyword
and the FIXED framework type.
+--------------------------------------------+
| Option | Type | Attribute | Value
|
+-------------------+------------------------+
IFRAMEWORK| ALL
| FIXED | REFERENCE | reference curve|
+-------------------+------------------------+
User Selected Increment

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

ModelBuilder: Editing the .mdl File

61

Landmark

New Features For PetroWorks

The parameter name refers to parameter specified by a CNST entry for


this purpose. It may belong to any parameter group defined in the .mds
file.
The input curve frameworks are evaluated for compatibility with the
increment value during processing by determining resampleability of
each. If incompatibility is found (nonresampleable curve), processing
continues on the basis of the value of the RESPONSE keyword.
ModelBuilder defaults to automatic determination.
In the absence of an IFRAMEWORK entry, the automatic process described
above in Criteria for Automatic Determination of Model Processing on page 55
determines the sample framework.

Model Variables in .mdl Code


There is one model variable that can be examined in the code in the
.mdl file to evaluate the working input sample framework:

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).

Runtime Curve Reselection


Curves can be turned on and off during runtime by resetting the
MD_CURVE_IN_SELECTED and MD_CURVE_OUT_SELECTED
arrays for input and output curves, respectively. The index is the order
that the curve is in under LOGS in the .mds file. Each time curves are
reselected, the selection flag should be turned on.
It is recommended that the original curve mapping configuration be
saved to local working arrays.

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

Landmark Graphics Corporation

User Programming

Description (maximum is 40 characters, but can be added to with


LATT entries)
Why explicitly define units in ModelBuilder?
Like most applications, ModelBuilder results are greatly influenced by the units
of measurement issue: Unless explicitly stated otherwise in your .mds file,
ModelBuilder expects that curves are retrieved and manipulated using the units
defined for that curve in the session measurement system.

The attributes from LATT are:

R2003.12.1

Multiple description lines (to be concatenated together for a


possible maximum of 1K)
Title (for display in Wellbore Parameter Editor)
2nd and 3rd dimensions
Unit Type (UNIT) and Base Unit Type (UNITTYPE)

ModelBuilder: Editing the .mdl File

63

Landmark

New Features For PetroWorks

Multi-valued (Multi-dimensional) Curve Data


Models can process multi-dimensional data as long as that data is
stored in the OpenWorks log tables or read from an external file. You
can process data with two or three dimensions (2D or 3D).
For purposes of this discussion, a multi-valued array refers to a single
curve array (2D or DIMENSION2), and multi-dimensional curve
data refers to multiple arrays or matrix data (3D or DIMENSION3). A
curve with a second dimension (DIMENSION2) is defined by a set of
monotonic values along a single axis. Curves with a second and third
dimension (DIMENSION3) are defined with monotonic values along
two axes. These axes need not be orthogonal to the z-index axis or to
each other.

R2003.12.1

ModelBuilder

64

Landmark Graphics Corporation

User Programming

The following table lists curve types that can be processed by


ModelBuilder models. The example column shows how the curves are
referenced in the model code to designate a particular curve data
element. The indices are locally defined variables. For example,
(i, j, k), (M_INDEX, N_INDEX, Z_INDEX), or whatever the model
writer prefers. The table uses the following syntax: i = 1,n; j=1,m, and
k=1,z. Multi-sampling (multiple samples over a set of depths) is also
included.
Curve Types Processed by ModelBuilder Models
Data Type
Scalar curves

Size
1

Multi-sampling
z

Examples

Comments

gr

Any of the common single valued data

gr(k)

Multiple samples of scalar data on z-index

MRIL echo trains

not applicable

RAMP(i)

MRIL data arrives as two multi-valued


curves, RAMP (raw amplitude) and RPHA
(raw phase). Data points can number from
3 to 1000, but are usually about 400.
Elements are at a uniform sample
increment, Te.G

Acoustic waveforms

m,n

z,m

wff1(i,j)

m receivers by n samples: receivers = 1 to


m, samples = 256, 512, 1024, (4096).

wffl(j,i,k)

Multiple sample sets on z-index. These are


normally defined as individual waveforms
in Halliburton models.

wffl(i)
Dipmeter

m,n

z,m,n

dip(i,k)

n pads by m buttons per pad: pads = 3,4,6;


buttons = 1,2
Multiple sample sets on z-index of pads x
buttons

Special core analysis

Photographs (core,
SEM, outcrop,)

2,n

m,n

z,2,n

z,m,n

dip(j,i,k)

Tadpoles: dip angle, dip magnitude,


quality

scd(i,k)

n number of pairs (m=2)

scd(j,i,k)

Multiple samples of special core analysis

bmp(i,k)

m by n rectangle of data. The data area


may be scaled to a depth range (as with a
core photo) or may be indexed to a single
depth (as an SEM photo)

bmp(j,i,k)

multiple sample sets on z-index


Well test data

2,n

z,m,n

wtd(i,k)
wtd(j,i,k)

Usually pressure vs. time: pressure-time


pairs with time periodic or aperiodic.
multiple samples on z-index

R2003.12.1

ModelBuilder: Editing the .mdl File

65

Landmark

New Features For PetroWorks

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
|
+---------------|------------|--------|-------+

NPOINTS is the actual number of elements required for the specific


dimension axis. It can also be the maximum number of elements that
can be defined dynamically for the specific dimension axis at the
beginning of model processing.

R2003.12.1

ModelBuilder

66

Landmark Graphics Corporation

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 |
+---------------|------------|--------|------+

It is important to note that the actual size of the second or third


dimension can be different from the value specified in the .mds file if
any of the following are true:

R2003.12.1

The number of points for specific dimension of curve is defined


dynamically at the beginning of processing. The defined number of
points cannot exceed the .mds-specified number of points.

The number of points for actual dimension of the selected input


curve is greater than the .mds-specified number of points. In this
case, only the number of input curve elements specified in the .mds
file is passed to the model code.

The number of points for actual dimension of the selected input


curve is less than the .mds-specified number of points. In this case,
all the input curve element values are passed to the model code,
and the remaining values are filled with nulls.

ModelBuilder: Editing the .mdl File

67

Landmark

New Features For PetroWorks

Here is an example of the .mds file entry to dynamically redefine size.


TITL| Dynamic 2D log |
CMNT
CMNT
CMNT|-----------------+-+----------------------------+
CMNT|
| |
|T|
|
CMNT| CURVE|I|
|Y|
|
CMNT| NAME |O| UNITS |P|
DESCRIPTION
|
CMNT|------|-|--------|-|----------------------------|
LOGS|LOG2X |I|
|0| Input 2D log
|
LOGS|LOG2F |O|
|0| Output 2D log
|
LOGS|CHECK_SM |O|
|0| Check sum for LOG2D
|
LOGS|LOG2G |O|
|0| Output 2D log
|
LOGS|LOG2X_1|O|
|0| Check sum for LOG2D
|
CMNT|------+-+--------+-+----------------------------+
CMNT|------+------------+---------+------------------+
LATT|LOG2X | DIMENSION2 | NPOINTS |
20
|
LATT|LOG2F | DIMENSION2 | NPOINTS |
20
|
CMNT|------+------------+---------+------------------+
CMNT
CMNT|------+---------+-+---------+--------+--+-------------+---+-----------+
CMNT| NAME |DEFAULT |T| MIN
| MAX
|UN|DESCRIPTION |GRP| DEFINITION|
CMNT|
|
|Y|
|
|IT|
|IDS|
|
CMNT|------+---------+-+---------+--------+--+-------------+---+-----------|
CNST|INCR | 1.0
|I| 1.0
|1000.0 | |Increment
|
|
|
CNST|USER_DIM |
|I|
|
| |User entered dimension | | |
CMNT|------+---------+-+---------+--------+--+-------------+---+-----------+
CMNT
$EOF

The related .mdl file entry for this example is:


PROGRAM DYNAMIC 2D
C
C
C

Dynamically redefine size


INTEGER I,J,IER
character txt*80

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

Landmark Graphics Corporation

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

New Features For PetroWorks

.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

Landmark Graphics Corporation

User Programming

Editing the .mds File


The purpose of the .mds file is to specify, using keywords, all
parameters, input and output curves, variables, units of measurement,
and data structures required for your model.
Note
Once you have a working model that runs, you can edit values set in the .mds file
by selecting Edit Parameters from the running model window. Doing so opens
the Wellbore Parameter Editor from the model and allows you to change
parameter values.

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

ModelBuilder: Editing the .mds File

71

Landmark

New Features For PetroWorks

When you entered a name for your model, ModelBuilder


generated this file along with the .mdl file as previously described.
3.

Use the following general rules, keywords, and delimiters to


continue building the .mds file.

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.

Files should follow the format of the example shown in the


Model Data Specification Template with Keywords on page 87.

Begin each line in the .mds file with a keyword. (See the
discussion of keywords below.)

ModelBuilder

72

Landmark Graphics Corporation

User Programming

Leave fields blank if they do not apply to your model.

Remember to start comment lines with the keyword CMNT.

End all .mds files with the keyword $EOF.

.mds File Keywords and Delimiters


The table below contains a list of keywords, their meanings, and the
delimiters you must use to separate them. A sample .mds file template
with keywords and their usage is provided at the end of this chapter
inModel Data Specification Template with Keywords on page 87.
Keyword

Delimiter

Meaning

CATT (94)

Constant attributes (parameters)

CHKA (91)

Check action for out-of-range parameter

CMNT (87)

no limiter

Comments (not read or used)

CNST (92)

Constants (Parameters)

CREF (93)

Shared Constants (Parameters)

GRPN (91)

Group names for parameters.


Note that names may include alphanumeric text, including underscores;
names cannot include reserved FORTRAN operators such as &, +, /,
and *. You can build models using these characters, but the models will
not run.

IFRAMEWORK (88)

Define input framework

ISMO (96)

Output index in multiple sampling

LATT (89)

Curve attributes

LOGS (88)

Curves

NINC (96)

Number of samples to increment in multiple sampling for next depth


iteration

NSMI (95)

Number of input samples in multiple sampling

NSMO (95)

Number of output samples in multiple sampling

NSMP (95)

Number of samples in multiple sampling

OPTNLIST (91)

List of optional curves

PASS (97)

Multiple pass indicator

TITL (87)

Model title (appears at top of model screen). The title is limited to 54


characters. If a title longer than 54 characters is used, the model will not
run.

R2003.12.1

ModelBuilder: Editing the .mds File

73

Landmark

New Features For PetroWorks

Configuring Your Model


The final steps before you build and run your model may be to provide
information related to your model and make selections from the
Configure window. From the Configuration window, you may:

Select optional source files, object files, or libraries you wish to


use in your model

Set compiler switches

Supply information about your model


Configuration options are not required to build and run a model.
You do not need to use any of the configure options to create a model that
successfully builds and runs. The configuration selections are all optional.

To open the Configure window, click on the Configure button on the


ModelBuilder main window. The ModelBuilder Configure window
appears:

The following sections describe the tabbed configuration options in the


Configure window.

R2003.12.1

ModelBuilder

74

Landmark Graphics Corporation

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.

To select one or more files from the window, click on the


filename(s), and click on the Close button.

3.

To select a file from another directory, click on the Select button to


view a list of directories and files.

4.

Click on a directory to select it, then click on the Filter button if


you want to view only the source files listed in that directory.
Alternately, if you already know the directory path, type the
pathname in the Directory Path field and click on the Filter
button.

5.

Click on one or more source files in the right-hand column to


highlight the source files.

6.

Click on the Select button. The file or files you chose now appear
in the Model Contents window under Optional Source Files.

ModelBuilder: Configuring Your Model

75

Landmark

New Features For PetroWorks

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.

Click on the Compile button. The Build Messages window


appears. When the file or files have finished compiling, or if errors
occur, status messages appear the Build Messages window.

3.

After the compile has successfully completed, click on the Cancel


button at the bottom of the Build Messages window.

4.

If a model fails to successfully compile, first look at the .err file


generated under the /run directory, a subdirectory of your root
directory. This file gives you information about problems that
occurred when the program attempted to compile your model.
Note
ModelBuilder automatically runs g77 with the option -fno-second-underscore.
This produces linking symbols that end in one underscore.

Build Library Button


If you have more than one source file, you may want to place the source
files together in a library to which you can assign a meaningful name.
The Build Library button is also located at the bottom of the Source
Files tab panel. Note that when you build a library, the source files you
select are automatically compiled.
To build a library:

R2003.12.1

1.

In the Source Files tab panel, select the source files you wish to
combine.

2.

Click on the Build Library button. The Build Library window


appears. If any libraries already exist in the directory in which
your source files reside, they are listed in the Library List window.

3.

Type a new library name in the New Library field.

4.

Click on the Build button. A message indicating that the library


has been built successfully appears in the Build Messages window.

ModelBuilder

76

Landmark Graphics Corporation

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.

Click on the Object Files tab in the Configure window.

2.

Click on the Select button to view a list of directories and files.

3.

Click on a directory to select it, then click on the Filter button if


you want to view only the object files listed in that directory.

4.

Click on an object file in the right-hand column to highlight the


object file.

5.

Click on the Select button.

OR
If you already know the directory path,

R2003.12.1

1.

Type the directory path.

2.

Click on the Select button.

3.

Click on an object file from the right-hand column to highlight the


object file.

4.

Click on the Select button.

ModelBuilder: Configuring Your Model

77

Landmark

New Features For PetroWorks

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.

Click on the Libraries tab in the Configure window.

2.

Click on the Select button to view a list of directories and files.

3.

Click on a directory to select it, then click on the Filter button if


you want to view only the libraries listed in that directory.

4.

Click on a library file from the right-hand column to highlight the


library file.

5.

Click on the Select button.

OR
If you already know the directory path,

R2003.12.1

1.

Type the directory path in the field.

2.

Click on the Select button.

3.

Click on a library file in the right-hand column to highlight the


library file.

4.

Click on the Select button.

ModelBuilder

78

Landmark Graphics Corporation

User Programming

Compiler Switches
To configure the FORTRAN and C compiler switches:
1.

Click on the Compiler Switches tab in the Configure window. A


panel displaying FORTRAN compiler switches and C Compiler
Switches appears.

2.

To choose the default values, click on the Default button. The


default values are shown in the sample screen below.

3.

To choose other values, click on them to highlight them. Click on


highlighted items to unselect them.

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.

Debugging Your Model


If a models fails to successfully build (compile), first look at the .err file
generated under the /run directory. This file gives you information
about problems that occurred when the program attempted to compile
your model.

R2003.12.1

ModelBuilder: Configuring Your Model

79

Landmark

New Features For PetroWorks

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

Landmark Graphics Corporation

User Programming

3.

Click on the Run button. The following window appears with a


field for arguments.

4.

Type the arguments as follows:


-fc PTWPRO -pppdf <full path and file name for the
pppdf file>.

Below is an example for the model named Filter in the Arctic


directory.
-fc PTWPRO -pppdf /home/jeeves/rtekell50/Arctic/
mb_pppdf/Filter.pppdf

5.

Click on the Run button.

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.

You can view information on the GNU debugger (g++), C compiler


(gcc), and FORTRAN compiler (g77) by selecting Tools > Gnu > Gnu
Man Pages. For updated, detailed information about the g77 compiler,
refer to online documents at
http://www/gnu.org/software/gcc/onlinedocs/

Landmark does not support questions regarding the Gnu debugging


software; it is provided for your convenience.

R2003.12.1

ModelBuilder: Configuring Your Model

81

Landmark

New Features For PetroWorks

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.

Select the Information tab in the Configure window.


This panel contains fields that allow you to enter the title, version,
and description of your model and model author contact
information.

R2003.12.1

2.

Type in the appropriate fields the information you wish to disclose.

3.

After you have entered information, click on Close.

ModelBuilder

82

Landmark Graphics Corporation

User Programming

Building and Running a Model


Once you have created or edited an .mdl-.mds file pair and have made
any other selections as described above, you are ready to build the
model. You must build a model before you can run it.
When you initiate the Build Model function, the files are compiled and
an executable file is generated. If any errors exist that cause the compile
to abort, you will see an error message in the status field of the
ModelBuilder main window that tells you which file to look in for more
details regarding the error. (See Debugging Your Model on page 80.)
To initiate the build:
1.

Click on the Build Model button.


The Build Messages window appears and provides status
messages.

2.

R2003.12.1

Click on the Close button to close the Build Messages window.

ModelBuilder: Building and Running a Model

83

Landmark

New Features For PetroWorks

3.

In the main ModelBuilder window, click on the Run button.


How do I know what happens during processing?
Most status area messages, along with a great deal of other information
pertaining to how model processing progressed, are echoed to the
model_<model name>.log file (for example, model_DualWater.log), which is
stored in your run directory. Echoed messages are prefixed with ==Status:.
To see just these status messages in the log file, use the command:
grep ==Status: model_<model name>.log | more
Note that depth-by-depth messages are not logged unless you preset the
OpenWorks Command Menu System Error Logger Error Level to 0
(trace).

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

Landmark Graphics Corporation

User Programming

Before processing your model be sure you have read:

R2003.12.1

the section Understanding the Interface on page 16 of the


PetroWorks Basic Interpretive Applications manual. Your model
window interface has the same appearance and functionality as
any Landmark-supplied interpretive application.

the chapter Editing Wellbore Parameters on page 70 of the


PetroWorks/LogEdit Well Data Management and Editing manual.
You access Wellbore Parameter Editor via the Edit Parameters
button in your model window.

ModelBuilder: Building and Running a Model

85

Landmark

New Features For PetroWorks

Model Data Specification Template with Keywords


The following template describes the setup of the model specification
(.mds) file. The keywords appear in the first four spaces followed by
fields separated by delimiters (|, ,, =). This template can be
used as a basis for creating such a file by including the keywords and
fields needed for your particular model and then deleting any unneeded
or extraneous lines. Field widths are not fixed and can be widened if
needed, and, in many cases, left blank. The keyword is first introduced
in double angle brackets (<<KEYWORD>>), followed by a description
of its purpose and fields and then an example. Note that each keyword
must be immediately followed by the delimiter.
Boldface lines in this template indicate new keywords and fields for the
current PetroWorks Pro release.
CMNT-------------------------------------------------------------CMNT template.mds
CMNT MODEL SPECIFICATION FILE - PETROWORKS VERSION 2.00 2003
CMNT
CMNT-----------------------------------------------------------------CMNT <<CMNT>>
COMMENT LINES
CMNT
CMNT Comments can appear anywhere in the file.
CMNT
CMNT
CMNT-----------------------------------------------------------------CMNT <<TITL>>
MODEL TITLE
CMNT
CMNT This is the title you want to appear at the top of the model screen
CMNT
CMNT Example:
TITL| Complex Lithology Analysis |
CMNT
CMNT-----------------------------------------------------------------CMNT
CMNT <<DEPTH_UOM>>
MODEL DEPTH UNIT OF MEASURE
CMNT
CMNT If an algorithm will be using depth in calculations, these must be defined
CMNT as feet or meters, regardless of what is set in the session units.
CMNT
CMNT Example:
DEPTH_UOM=METERS
CMNT
CMNT-----------------------------------------------------------------CMNT
CMNT <<RESPONSE>>
MODEL RESPONSE TO AUTOMATICALLY CALCULATED WORKING
CMNT
FRAMEWORK
CMNT
CMNT As PetroWorks is now handling the concept of non-resampleability,
CMNT the set of depths over which a model processes (known as Input Working Sample
CMNT Framework, also referred to as IWSF), the model writer can control whether
CMNT the default will allow automatic determination of the IWSF. The default
CMNT is a weak response, which involves resampling non-compatible curves. The
CMNT model can be set to respond with a strong response.
CMNT
CMNT Example:
RESPONSE=STRONG
CMNT
CMNT-----------------------------------------------------------------CMNT

R2003.12.1

ModelBuilder

86

Landmark Graphics Corporation

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

ModelBuilder: Model Data Specification Template with Keywords

87

Landmark

New Features For PetroWorks

CMNT Not presently used


CMNT
CMNT All curve values are returned as floats.
CMNT
CMNT Field 5 - DESCRIPTION:
CMNT Curve description written to curve header in database for the curve.
CMNT If a longer description is required see LATT below.
CMNT
CMNT For additional options, see keyword LATT below.
CMNT
CMNT Example:
CMNT|-----------------+-+-----------+-+---------------------------+
CMNT|
| |
| |
|
CMNT|
|I|
| |
|
CMNT| CURVE NAME
|O|
UNITS
| |
DESCRIPTION
|
CMNT|-----------------+-+-----------+-+---------------------------+
LOGS|Neutron_Porosity |I|v/v decimal| |Limestone neutron porosity |
LOGS|RHOB
|I|g/cm3
| |Bulk density
|
LOGS|Temperature
|I|degF
| |Formation Temperature
|
LOGS|CDE
|O|g/cm3
| |Corrected Density Log
|
CMNT|-----------------+-+-----------+-+---------------------------+
CMNT
CMNT-----------------------------------------------------------------CMNT <<LATT>>
ADDITIONAL DATABASE CURVE ATTRIBUTES
CMNT
CMNT This keyword allows for additional information for a specific curve
CMNT
CMNT Field 1 - CURVE NAME:
CMNT
CMNT The curve name must exactly match a curve name defined with LOGS.
CMNT
CMNT Field 2 - ATTRIBUTE TYPE:
CMNT
CMNT TITLE:
The curve title which can be used for column headings.
CMNT
Linefeeds may be imbedded into the title.
CMNT
CMNT DESCRIPTION:
CMNT
If a long description is desired, several of these lines
CMNT
may be included.
CMNT
Note: You can have several entries for description to get a more
CMNT
detailed description.
CMNT
CMNT ************************************************************************
CMNT UNITTYPE:
CMNT
For output curves only, type of unit of measure. The types can
CMNT
be found on the ModelBuilder window on the pulldown menu under
CMNT
"Tools"
CMNT ************************************************************************
CMNT
CMNT FRAME ID:
CMNT
If output curve is to belong to a certain output working
CMNT
framework, that id is inserted in Field 3
CMNT
CMNT DIMENSION 2:
CMNT
CMNT
Field 3:
CMNT
2nd dimension attributes:
CMNT
CMNT
NPOINTS -- number of elements (size) in 2nd dimension
CMNT
UNITS
-- units of measure for 2nd dimension
CMNT
CMNT
Field 4: Value for the above attributes.
CMNT
CMNT DIMENSION 3:
CMNT
Field 3:
CMNT
3rd dimension attributes:
CMNT
CMNT
NPOINTS -- number of elements (size) in 3rd dimension
CMNT
UNITS
-- units of measure for 3rd dimension
CMNT

R2003.12.1

ModelBuilder

88

Landmark Graphics Corporation

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

ModelBuilder: Model Data Specification Template with Keywords

89

Landmark

New Features For PetroWorks

CMNT specified, the name will be used.


CMNT
CMNT Example:
CMNT|---------+--+------------------+
CMNT| NAME
|ID| TITLE
|
CMNT|---------+--+------------------|
GRPN|SETUP
| 1| Initial\nSetup
|
GRPN|ClayShale| 2| Clay\nShale
|
GRPN|Minerals | 3| Minerals
|
CMNT|---------+--+------------------+
CMNT
CMNT
CMNT-----------------------------------------------------------------CMNT <<CHKA>>
CHECK ACTION
CMNT
CMNT If during runtime, a parameter value is outside the range of the
CMNT definition, you may specify which action is to be taken for this
CMNT particular parameter.
CMNT
CMNT Available actions:
CMNT
ALLOW
Allow the value to be used
CMNT
CLIP
Clip the value using minimum or maximum
CMNT
DEFAULT
Use the default value defined in the mds file
CMNT
NULL
Use a null value.
CMNT
CMNT If a check action is not defined, the default value as defined
CMNT in the mds file or shared definition is used.
CMNT
CMNT Example:
CHKA=ALLOW
CMNT
CMNT-----------------------------------------------------------------CMNT <<CNST>>
DEFINITION OF CONSTANTS (parameters)
CMNT
CMNT Field 1 - NAME:
CMNT Name used in the model for this parameter. The maximum length
CMNT of a parameter is 28 characters. A unique parameter name is
CMNT saved in the database, prefixed with the model name and an
CMNT underscore. This insures that a value for the same name used by
CMNT another model is not overridden. (Also see description of
CMNT SHARED PARAMETERS (CREF) below.) If a title is not specified using
CMNT parameter attributes (see CATT below), the name is used for
CMNT the title.
CMNT
CMNT Note: parameter names ARE case sensitive. However, the parameter
CMNT variable names in Fortran are not. This means that you can specify
CMNT a parameter "Parm1" and the database will create a "Parm1" which is
CMNT different from an existing parameter "parm1". However, because of the
CMNT Fortran limitations, you cannot specify two parameters, "parm1" and
CMNT "Parm1" in the same model.
CMNT
CMNT Field 2 - DEFAULT:
CMNT Original value of parameter when first created or if value in
CMNT database has gone out of range. If this field is left blank
CMNT it will be set to null.
CMNT
CMNT Field 3 - TYPE:
CMNT With this present implementation, only input parameters are
CMNT allowed.
CMNT
CMNT Field 4 - MINIMUM:
CMNT Minimum value of parameter allowed. If this field is left blank
CMNT it will be set to null, therefore no lower limit is checked.
CMNT
CMNT Field 5 - MAXIMUM:
CMNT Maximum value of parameter allowed. If this field is left blank
CMNT it will be set to null, therefore no upper limit is checked.
CMNT
CMNT Field 6 - UNIT:
CMNT Parameter unit expected by the model. If the measurement system being
CMNT run is different from the measurement system containing the specified

R2003.12.1

ModelBuilder

90

Landmark Graphics Corporation

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

ModelBuilder: Model Data Specification Template with Keywords

91

Landmark

New Features For PetroWorks

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

Landmark Graphics Corporation

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

ModelBuilder: Model Data Specification Template with Keywords

93

Landmark

New Features For PetroWorks

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

Landmark Graphics Corporation

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

Vertical Curve Gradient (page 99)

Three-Point Filter with User Weights (page 102)

Check Processing Flags (page 104)

Reconfiguring Curve Selection During Runtime (page 106)

Create 2D Output Curve (page 108)

Check 2D Log Curve (page 109)

Dynamically Redefine Dimensions for Output Curves (page 111)

Multi-Valued Log Curves (page 114)

Explicit Input Framework Based on User-Specified Reference


Curve (page 118)

Explicit Input Framework Based on User-Specified Increment


(page 119)

ModelBuilder: Example Models

95

Landmark

New Features For PetroWorks

Vertical Curve Gradient


Vertical Curve Gradient is a simple but useful model that uses

multiple depth levels


absent value handling
model defined processing direction control

Gradient .mds File


C ==========Gradient.mds==============
CMNT
CMNT
CMNT
CMNT
VERS=1.0
CMNT|--------+-+-----------+--+------------------------------------+
CMNT|
| |
|T |
|
CMNT|
| |
|Y |
|
CMNT| CURVE | |
|P |
|
CMNT| NAME |T|UNITS
|E |
DESCRIPTION
|
CMNT|--------+-+-----------+--+------------------------------------+
LOGS|Cali
|I|inches
| | Input Log
|
LOGS|Gradient|O|
| | Vertical Gradient of the IP Log
|
LOGS|AbsGradient|O|
| | Absolute Value of the Gradient
|
CMNT|--------+-+-----------+--+------------------------------------+
CMNT|
CMNT|--------------------CMNT|NUM| NAME VARIABLE |
CMNT|--------------------ISMO|2| OUTPUT_INDEX
|
NSMI|2| NUM_SAMPLES_IN |
CMNT|--------------------NSMO=1
CMNT
$EOF

R2003.12.1

ModelBuilder

96

Landmark Graphics Corporation

User Programming

Gradient .mdl File


C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C

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

!!!!! Very important - Handling ABSENT or NULL values !!!!!


We need to check both input curve values to see if they are absent (null)
values. If they are absent, we want the output curve to be absent.
If we omit this step, whatever value that is used as a NULL value will be
used in the calculation when a NULL value occurs in a log curve.
IF ((Cali(OUTPUT_INDEX) .NE. ABSENT) .AND.
; (Cali(PREV_INDEX) .NE. ABSENT)) THEN

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

ModelBuilder: Example Models

97

Landmark

100

New Features For PetroWorks

ENDIF
CONTINUE

END

R2003.12.1

ModelBuilder

98

Landmark Graphics Corporation

User Programming

Three-Point Filter with User Weights


This Three-Point Filter with User Weights model uses

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.

Filter3Pt .mds File


CMNT|=========Filter3Pt.mds=========================
VERS=1.0
CMNT|=======================================================================+
CMNT| ----- LOG CURVE DEFINITIONS ----CMNT|
CMNT|-------------------------+-+-----------+--+----------------------------+
CMNT|
| |
|T |
|
CMNT|
| |
|Y |
|
CMNT|
CURVE
| |
|P |
|
CMNT|
NAME
|T|
UNITS
|E |
DESCRIPTION
|
CMNT|-------------------------+-+-----------+--+----------------------------+
LOGS|GR
|I|
| |
|
LOGS|GR_FILTERED
|O|
| |
|
CMNT|
| |
| |
|
CMNT|-------------------------+-+-----------+--+----------------------------+
CMNT
CMNT|-------------------------+-+-------------+
CMNT|Name
|Group ID| Title
|
GRPN|Filter_Weights | 1
| Filter Weights |
CMNT|-------------------------+-+-------------+
CMNT
CMNT|------+---------+---+-----+-----+-----+------------+----------+
CMNT| Name | Default | T | Min | Max |Unit| Description | Group ID |
CMNT|------+---------+---+-----+-----+-----+------------+----------+
CNST|W_P1 | .5
| I | 0.0 | 1.0 | | Weight of Previous Depth Sample | 1 |
CNST|W__0 | 1.0 | I | 0.0 | 1.0 | | Weight of Middle Depth Sample | 1 |
CNST|W_N1 | .5 | I | 0.0 | 1.0 | | Weight of Next Depth Sample | 1 |
CMNT|------+---------+---+-----+-----+-----+------------+----------+
R2003.12.1

ModelBuilder: Example Models

99

Landmark

New Features For PetroWorks

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

Filter3Pt .mdl File


PROGRAM Filter3Pt
C =========Filter3Pt.mdl=========================
C Simple three point vertical averaging program that uses parameter values
C as weights for the vertical filter levels
C
C Check for NULL values at any of the depth levels
IF ((GR(1).EQ.ABSENT ) .OR.
; (GR(2).EQ.ABSENT ) .OR.
; (GR(3).EQ.ABSENT )) THEN
C If any curve is NULL ( absent)
C

set the output to be NULL

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

Landmark Graphics Corporation

User Programming

Check Processing Flags


This example checks and sets processing flags.

Check Any Depth Flag .mds File


TITL| Check any depth flag |
CMNT
CMNT
CMNT|-----------------+-+----------------------------+
CMNT|
| |
|T|
|
CMNT| CURVE|I|
|Y|
|
CMNT| NAME |O| UNITS |P|
DESCRIPTION
|
CMNT|------|-|--------|-|----------------------------|
LOGS|GR
|I|
|0| any input curve
|
LOGS|LOGO |O|
|0| calculate based on input
|
CMNT|------+-+--------+-+----------------------------+
CMNT|------+------------+---------+------------------+
CNST|ENDMDLDEP |11900.00 |I| 0.0
|12000.00 | |Depth to end model| |
CNST|ENDZONDEP |11700.00 |I| 0.0
|12000.00 | |Depth to end zone | |
CNST|ABTMDLDEP |11850.00 |I| 0.0
|12000.00 | |Depth to abort model| |
CMNT
CMNT
$EOF

Check Any Depth Flag .mdl File


PROGRAM Check_flags
C
C
Check an output 2D log
C
INTEGER I,J
character txt*80
C

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

ModelBuilder: Example Models

101

Landmark

New Features For PetroWorks

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

Landmark Graphics Corporation

User Programming

Reconfiguring Curve Selection During Runtime


This example turns curves on and off during processing.

Checking Curve Reconfiguration Flags .mds File


TITL| Checking Curve Reconfiguration Flags |
CMNT
CMNT|-----------------+-+----------------------------+----------------+
CMNT|
| |
|T|
| SPECIAL
|
CMNT| CURVE|I|
|Y|
| PROCESS
|
CMNT| NAME |O| UNITS |P|
DESCRIPTION
|
FIELD
|
CMNT|------|-|--------|-|----------------------------|----------------|
LOGS|LOG1 |I|
|0| Input log
|
|
LOGS|LOGO |O|
|0| Output log
|
|
CMNT|------+-+--------+-+----------------------------+----------------+
CMNT
GRPN|TSTMDL| 1 | Depth Settings |
CMNT|------+---------+-+---------+--------+--+-------------+---+----------+
CMNT| NAME |DEFAULT |T| MIN
| MAX
|UN|DESCRIPTION |GRP|DEFINITION|
CMNT|
|
|Y|
|
|IT|
|IDS|
|
CMNT|------+---------+-+---------+--------+--+-------------+---+----------|
CNST|IDEPTH_OFF| 11570.0 |I| 0.0 |20000.0 | |Input Depth | 1 |
|
CNST|IDEPTH_ON | 11574.0 |I| 0.0 |20000.0 | |Input Depth | 1 |
|
CNST|ODEPTH_OFF| 11582.0 |I| 0.0 |20000.0 | |Output Depth | 1 |
|
CNST|ODEPTH_ON | 11586.0 |I| 0.0 |20000.0 | |Output Depth | 1 |
|
CMNT|------+---------+-+---------+--------+--+-------------+---+----------+
CMNT
$EOF

Checking Curve Reconfiguration Flags .mdl File


PROGRAM Check_set_io
CHARACTER*80 TXT
C

Calculate LOGO before reconfiguring curve flags


IF (MD_XLSELI(1).EQ.0.OR.LOG1.EQ.ABSENT) THEN
LOGO = ABSENT
ELSE
LOGO= LOG1 + 1
ENDIF
IF (MD_DEPTH.EQ.IDEPTH_OFF) THEN
MD_CURVE_IN_SELECTED(1) = 0
write(txt,'(A,f10.2)') "Setting input read off at",md_depth
call model_message(txt)
MD_NEWSEL = .TRUE.
ELSE IF (MD_DEPTH.EQ.IDEPTH_ON) THEN
MD_CURVE_IN_SELECTED(1) = 1
write(txt,'(A,f10.2)') "Setting input read on at",md_depth

R2003.12.1

ModelBuilder: Example Models

103

Landmark

New Features For PetroWorks

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

Landmark Graphics Corporation

User Programming

Create 2D Output Curve


This example illustrates how to create a two dimensional output curve.

Create 2D Log .mds File


TITL| Create 2D log |
CMNT
CMNT
CMNT|-----------------+-+----------------------------+
CMNT|
| |
|T|
|
CMNT| CURVE|I|
|Y|
|
CMNT| NAME |O| UNITS |P|
DESCRIPTION
|
CMNT|------|-|--------|-|----------------------------|
LOGS|GR
|I|
|0| Gamma ray
|
LOGS|LOG2X |O|
|0| Output 2D log
|
CMNT|------+-+--------+-+----------------------------+
CMNT|------+------------+---------+------------------+
LATT|LOG2X | DIMENSION2 | NPOINTS |
20
|
CMNT|------+------------+---------+------------------+
CMNT
CMNT|------+---------+-+---------+--------+--+-------------+---+-----------+
CMNT| NAME |DEFAULT |T| MIN
| MAX
|UN|DESCRIPTION |GRP| DEFINITION|
CMNT|
|
|Y|
|
|IT|
|IDS|
|
CMNT|------+---------+-+---------+--------+--+-------------+---+-----------|
CNST|INCR | 1.0
|I| 1.0
|1000.0 | |Increment
|
|
|
CMNT|------+---------+-+---------+--------+--+-------------+---+-----------+
CMNT
$EOF

Create 2D Log .mdl File


C
C

PROGRAM CREATE_2D
Create 2D log
INTEGER I,J
SAVE I
character txt*80

Initialize counter
IF (MD_MDLINT) THEN
I = 0
ENDIF

C---- Set new value and increment counter


DO 10 J = 1,MD_CURVE_2ND_NPOINTS(2)
LOG2X(J) = I + INCR + J
10
CONTINUE
I=I+1
END
R2003.12.1

ModelBuilder: Example Models

105

Landmark

New Features For PetroWorks

Check 2D Log Curve


This example reads a 2D input curve and creates two output
dimensional curves.

Check 2D Log .mds File


TITL| Check 2D log |
CMNT
CMNT
CMNT|-------------------+-+----------------------------+
CMNT|
| |
|T|
|
CMNT| CURVE |I|
|Y|
|
CMNT| NAME
|O| UNITS |P|
DESCRIPTION
|
CMNT|--------|-|--------|-|----------------------------|
LOGS|LOG2X
|I|
|0| Input 2D log
|
LOGS|LOG2F
|O|
|0| Output 2D log
|
LOGS|CHECK_SM|O|
|0| Check sum for LOG2D
|
LOGS|LOG2G
|O|
|0| Output 2D log
|
LOGS|LOG2X_1 |O|
|0| Check sum for LOG2D
|
CMNT|--------+-+--------+-+----------------------------+
CMNT|------+------------+---------+------------------+
LATT|LOG2X | DIMENSION2 | NPOINTS |
20
|
LATT|LOG2F | DIMENSION2 | NPOINTS |
20
|
LATT|LOG2G | DIMENSION2 | NPOINTS |
35
|
CMNT|------+------------+---------+------------------+
CMNT
GRPN| INCREMENT | 1 | Add\n Increment |
CMNT|------+---------+-+---------+--------+--+-------------+---+
CMNT| NAME |DEFAULT |T| MIN
| MAX
|UN|DESCRIPTION |GRP|
CMNT|
|
|Y|
|
|IT|
|IDS|
CMNT|------+---------+-+---------+--------+--+-------------+---+
CNST|INCR | 1.0
|I| 1.0
|1000.0 | |Increment
|
|
CMNT|------+---------+-+---------+--------+--+-------------+---+
CMNT
$EOF

R2003.12.1

ModelBuilder

106

Landmark Graphics Corporation

User Programming

Check 2D Log .mdl File


PROGRAM CHECK_2D
C
C
C

Check an output 2D log


INTEGER I,J
CHARACTER TXT*80

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

ModelBuilder: Example Models

107

Landmark

New Features For PetroWorks

Dynamically Redefine Dimensions for Output Curves


This example reads a file to determine the dimension of the new output
curve. A maximum size has to be specified in the.mds file.

Dynamic 2D Log .mds File


TITL| Dynamic 2D log |
CMNT
CMNT
CMNT|-----------------+-+----------------------------+
CMNT|
| |
|T|
|
CMNT| CURVE|I|
|Y|
|
CMNT| NAME |O| UNITS |P|
DESCRIPTION
|
CMNT|------|-|--------|-|----------------------------|
LOGS|LOG2X |I|
|0| Input 2D log
|
LOGS|LOG2F |O|
|0| Output 2D log
|
LOGS|LOG2F_1|O|
|0| SUM curve|
LOGS|CHECK_SM |O|
|0| Check sum for LOG2D
|
CMNT|------+-+--------+-+----------------------------+
CMNT|------+------------+---------+------------------+
LATT|LOG2X | DIMENSION2 | NPOINTS |
50
|
LATT|LOG2F | DIMENSION2 | NPOINTS |
20
|
CMNT|------+------------+---------+------------------+
CMNT
CMNT|------+---------+-+---------+--------+--+-------------+---+-----------+
CMNT| NAME |DEFAULT |T| MIN
| MAX
|UN|DESCRIPTION |GRP| DEFINITION|
CMNT|
|
|Y|
|
|IT|
|IDS|
|
CMNT|------+---------+-+---------+--------+--+-------------+---+-----------|
CNST|INCR | 1.0
|I| 1.0
|1000.0 | |Increment
|
|
|
CNST|USER_DIM | 20
|I| 1.0
| 20.0 | |User entered dimension | | |
CMNT|------+---------+-+---------+--------+--+-------------+---+-----------+
CMNT
$EOF

R2003.12.1

ModelBuilder

108

Landmark Graphics Corporation

User Programming

Dynamic 2D Log .mdl File


PROGRAM DYNAMIC_2D
C
C
C

Dynamically redefine size


INTEGER I,J,IER
INTEGER NDIM
CHARACTER TXT*80
INTEGER MAXDIM
PARAMETER (MAXDIM = 15)
CHARACTER MSG*50
DATA MSG/"USER_DIM must be assigned a value of 1 to 15"/

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

FIND MINIMUM NUMBER OF VALUES TO COPY


MD_CURVE_2ND_NPOINTS(LDX_LOG2F) = NINT(USER_DIM)
NDIM = MIN(MD_CURVE_2ND_NPOINTS(LDX_LOG2X),
MD_CURVE_2ND_DB_NPOINTS(LDX_LOG2X),
MD_CURVE_2ND_NPOINTS(LDX_LOG2F))

&
&
C

INITIALIZE ARRAY
DO 5 I=1,MD_CURVE_2ND_NPOINTS(LDX_LOG2F)
LOG2F(I) = ABSENT

&
&
&

TXT = " "


MD_CURVE_2ND_NPOINTS(LDX_LOG2X)
CALL MODEL_MESSAGE(TXT)
MD_CURVE_2ND_DB_NPOINTS(LDX_LOG2X)
CALL MODEL_MESSAGE(TXT)
MD_CURVE_2ND_NPOINTS(LDX_LOG2F)
CALL MODEL_MESSAGE(TXT)
ENDIF
CHECK_SM = 0.0

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

ModelBuilder: Example Models

109

Landmark

New Features For PetroWorks

END

R2003.12.1

ModelBuilder

110

Landmark Graphics Corporation

User Programming

Multi-Valued Log Curves


The following two examples create 2-D and 3-D output curves. Note
that you cannot verify the 3-D model output with any PetroWorks/
OpenWorks tools. Well Data Manager does show the minimum and
maximum values and whether the curve is properly dimensioned. You
can view the 2-D curve in both CrossPlot and Single Well Viewer by
setting up a Multi-Value Log Curve track in Well Template Editor.
The 2-D example creates three 2-D output curves, FMVLC1,
FMVLC2, FMVLC3, and one check curve, FI. Each curve has 500
array elements that are defined in the .mds file.
A companion model creates 3-D rather than 2-D curves. The model
generates three 500 50 3-D curves (equivalent to 50 2-D curves, each
curve having 500 elements).
The values for FMVLC1 start at the value entered for AGAIN and
increase linearly to the maximum value (500 AGAIN). For the 3-D
model, the maximum value is 25,000 (50 500 AGAIN). The AGAIN
controls how quickly the curve increases.
The second curve, FMVLC2, decays exponentially from 1 with a time
constant assigned from TC. The default is 1. Modifying the TC
parameter affects how quickly this parameter decays. The larger the
number, the longer it takes the curve to decay to nearly zero. When
plotted on a logarithmic grid, this curve shows a linear decay.
The last curve, FMVLC3, has sinusoidal values from +/-SINE_MAX.
Modifying the SINE_MAX parameter directly controls the maximum
value of the curve.
The 3-D model uses the same parameters as the 2-D model. However,
because 50 2-D curves are created, the resulting data set is much larger,
and maximum values may be significantly greater than for the 2-D
model.

R2003.12.1

ModelBuilder: Example Models

111

Landmark

New Features For PetroWorks

MVLC_2D .mds File


CMNT-------------------------------------------------------------CMNT
CMNT MODEL SPECIFICATION FILE - 2-D Multi-Valued Log Curve Routine
CMNT
VERS=1.00
CMNT
CMNT|------+-+-----+--+---------------------------+
CMNT|
| |
|T |
|
CMNT|
| |
|Y |
|
CMNT| CURVE| |
|P |
|
CMNT| NAME|T|UNITS|E |
DESCRIPTION
|
CMNT|------+-+-----+--+---------------------------+
LOGS|GR
|I|
| 0|Input curve for Framework |
LOGS|FMVLC1|O|
| 0|Linear MVLC
|
LOGS|FMVLC2|O|
| 0|Linear MVLC
|
LOGS|FMVLC3|O|
| 0|Sinusoidal MVLC
|
LOGS|FI
|O|
| 0|Float(i)
|
CMNT|------+-+-----+--+---------------------------+
CMNT
CMNT|------+----------+---------------+-----------+
LATT|FMVLC1|DIMENSION2| NPOINTS
|
500
|
LATT|FMVLC2|DIMENSION2| NPOINTS
|
500
|
LATT|FMVLC3|DIMENSION2| NPOINTS
|
500
|
LATT|FI
|DIMENSION2| NPOINTS
|
500
|
CMNT|------+----------+---------------+-----------+
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

R2003.12.1

ModelBuilder

112

Landmark Graphics Corporation

User Programming

MVLC_2D .mdl File


PROGRAM MVLC_2D

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

MVLC_3D .mds File


CMNT-------------------------------------------------------------CMNT
CMNT MODEL SPECIFICATION FILE - 3-D MultiValue Log Curve Routine
CMNT
VERS=1.00
CMNT
CMNT|------+-+-----+--+---------------------------+
CMNT|
| |
|T |
|
CMNT|
| |
|Y |
|
CMNT| CURVE| |
|P |
|
CMNT| NAME|T|UNITS|E |
DESCRIPTION
|
CMNT|------+-+-----+--+---------------------------+
LOGS|GR
|I|
| 0|Reference Curve for Framework|
LOGS|MVL3D1|O|
| 0|Linear 3-D MVLC
|
LOGS|MVL3D2|O|
| 0|Exponential Decay 3-D MVLC |
LOGS|MVL3D3|O|
| 0|Sinusoidal 3-D MVLC
|
LOGS|FI
|O|
| 0|Float(i)
|
CMNT|------+-+-----+--+---------------------------+
CMNT
CMNT|------+----------+---------------+-----------+
LATT|MVL3D1|DIMENSION2| NPOINTS
|
50
|
LATT|MVL3D2|DIMENSION2| NPOINTS
|
50
|
LATT|MVL3D3|DIMENSION2| NPOINTS
|
50
|
LATT|FI
|DIMENSION2| NPOINTS
|
50
|
CMNT|------+----------+---------------+-----------+
CMNT
CMNT|------+----------+---------------+-----------+
LATT|MVL3D1|DIMENSION3| NPOINTS
|
5
|
R2003.12.1

ModelBuilder: Example Models

113

Landmark

New Features For PetroWorks

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

MVLC_3D .mdl File


PROGRAM MVLC_3D

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

Landmark Graphics Corporation

User Programming

Explicit Input Framework Based on User-Specified Reference Curve


Simple output curve calculations based on a user specified reference
curve framework:

Check Input Framework - Reference Curve .mds File


CMNT
TITL| Check Input Framework - Reference Curve
CMNT
CMNT|-----------------+-+----------------------------+----------------+
CMNT|
| |
|T|
| SPECIAL
|
CMNT| CURVE|I|
|Y|
| PROCESS
|
CMNT| NAME |O| UNITS |P|
DESCRIPTION
|
FIELD
|
CMNT|------|-|--------|-|----------------------------|----------------|
LOGS|GR
|I| API
|0| input curve
|
|
LOGS|GR_OUT |O| API
|0| output curve
|
|
CMNT|------|-|--------|-|----------------------------|----------------|
CMNT
IFRAMEWORK| ALL | USER | REFERENCE | LOG40 |
CMNT
CMNT
$EOF

Check Input Framework - Reference Curve .mdl File


PROGRAM CHECK_IFRAME_REFERENCE_CURVE
C

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

ModelBuilder: Example Models

115

Landmark

New Features For PetroWorks

Explicit Input Framework Based on User-Specified Increment


Simple output curve calculations based on a user specified increment
framework:

Check Input Framework - Explicit Increment .mdsFile


CMNT
TITL| Check Input Framework - Explicit increment
GRPN|INCREMENT| 1 | Processing Sample Rate |
CMNT
CMNT|-----------------+-+----------------------------+----------------+
CMNT|
| |
|T|
| SPECIAL
|
CMNT| CURVE|I|
|Y|
| PROCESS
|
CMNT| NAME |O| UNITS |P|
DESCRIPTION
|
FIELD
|
CMNT|------|-|--------|-|----------------------------|----------------|
LOGS|GR
|I| API
|0| input curve
|
|
LOGS|GR_OUT|O| API
|0| output curve
|
|
CMNT|------|-|--------|-|----------------------------|----------------|
CMNT
CMNT|--------+----+-+---+---+------+----------------+---+-----------+
CMNT| NAME
|DEF |T|MIN|MAX|UNITS |DESCRIPTION
|GRP| DEFINITION|
CMNT|
|
|Y|
|
|
|
|IDS|
|
CMNT|--------+----+-+---+---+------+----------------+---+-----------+
CNST|PARM_INC|0.61|I|
|
|
|Frame Increment | 1 |
|
CMNT|--------+----+-+---+---+------+----------------+---+-----------+
CMNT
IFRAMEWORK| ALL | USER | INCREMENT | PARM_INC |
CMNT
CMNT
$EOF

Check Input Framework - Explicit Increment .mdl File


PROGRAM CHECK_IFRAME_INCREMENT
C
CHARACTER*80 TEXT
C
Increment gamma ray by 1
C
IF (INT(GR).NE.INT(ABSENT)) THEN
GR_OUT = GR+1.0
ELSE
GR_OUT = ABSENT
ENDIF
END

R2003.12.1

ModelBuilder

116

Landmark Graphics Corporation

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

ModelBuilder: Recommended Reading

117

Das könnte Ihnen auch gefallen